VHDL Sensitivity (Clock Delay Question)

Joined
Mar 7, 2011
Messages
4
Reaction score
0
I have a question about whether two processes syncronized by the same clock will alway create a clock delay or can you remove the clock delay by changing the sensitivty list.

here is an example.

x1_proc: process(clk)
begin
if(clk'event and clk = '1' then
B <= A;
end if;
end x1_proc;

x2_proc: process(clk)
begin
if(clk'event and clk = '1') then
C <= B;
end if;
end proc x2_proc;

Ok, i can easily see how could take to clock cycles (samples), to traverse A to C, one clock is occured in x1_proc, and one clock occurs in x2_proc;
now here is the question, say if i said

x3_proc: process(clk, B)
begin
if(clk'event and clk = '1') then
C <= B;
end if;
end x3_proc;

We have now changed process x3 to be sensitive to the change in B. Does x3, output the value A in just 1 clock and beats x2?? I hear all sorts of things about synthesis tools not caring about sensitivity lists, but in this case i really need to know....

Please help. Has anyone had any experience with this? I dont have access to tools like 'Chips Scope' to find out enough to be sure., but id like to be SURE. Can somebody try this code in a real and let me/ us all know.

Thanks
 
Joined
Mar 7, 2011
Messages
4
Reaction score
0
Thanks jeppe for your reply and the link.

I have one last question having read the link. What about the situation where one assigns a variable to a signal or a signal to a variable??

Being able to subtly infer a clock delay or not happening has real implications to me. I know i can separate combinational logic and registerd logic, however I am really interested in the particualars of the language.
 
Joined
Mar 10, 2008
Messages
348
Reaction score
0
Well - its surely important to understand the difference between Signals and Variables in VHDL.

I believe the best "book" to learn about this will be: "Evita VHDL" - its an interactive book which you can download for free from the firm.

In Chapter 6 will you find some great examples.
 
Joined
Jan 29, 2009
Messages
152
Reaction score
0
A signal gets it's value after 'one delta time' -- in a process that is 'at the end of the execution' of the process code.
It means that reads of an signal, after assignment to it, get the original value, and following writes effectively discard previous writes.

The semantics of a variable are different: they immediately get updated to the right-hand value. (taking into account that reads from a signal get the original signal value)


Just a crazy code (only written for the purpose to have a mix of different assignments)
Can you figure out the values at the end of the process? Consequently applying these rules should give the right answer
Code:
signal s_a, s_b, s_c : std_logic; -- inputs
signal s_d, s_e, s_f : std_logic;

process(s_a, s_b, s_c) is
  variable v_a, v_b, v_c : std_logic;
  variable v_d, v_e, v_f : std_logic;
begin
  v_a := s_a;
  v_b := s_b;


  v_d := s_a xor v_b;
  v_e := s_c and v_d;
  v_f := v_d xor v_e;

  s_d <= s_a xor v_b;
  s_e <= s_c and s_d;
  s_f <= s_d xor s_e;


  v_e := v_f;
  v_d := s_f;
  v_f := s_e;

  s_e <= s_f;
  s_d <= s_f;
  s_f <= s_e;
end process;
In practice I prefer to only read signals into variables as the first statements in a process, and only update signal values at the end of it -- that way it's obvious what is happening.

I hope that may help!
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top