Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What is the syntex of synchronous reset in VHDL?

Status
Not open for further replies.

bigyellow

Member level 1
Joined
Jan 17, 2004
Messages
40
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Denmark, China
Activity points
365
should it be

Code:
if clk'event and clk = '1' then 
   if reset = '0'  then 
        ------
   else 
       if ........then

       elsif.......then 
          -------
       else
           --------
       end if; 
   end if;
end if;

or
Code:
if clk'event and clk = '1' then 
   if reset = '0'  then 
        ------
   elsif .........then
       ------------
   elsif ...........then
      ---------
   else
       ------------
   end if;
end if;
 

jitendra

Member level 3
Joined
Aug 20, 2004
Messages
58
Helped
10
Reputation
20
Reaction score
7
Trophy points
1,288
Location
India
Activity points
731
hi,
first code is more appropriate. Writing elsif in reset condition is not a proper practice.

e.g. Code for D FF with Synch reset is

Code:
signal D, Q, clk, reset : bit ;
...
process (clk)
begin
    if (clk’event and clk = ’1’) then
        if reset = ’1’ then
            D <= ’0’ ;
        else
            -- you can write if or case statement within this else part
            Q <= D ;
        end if ;
    end if ;
end process ;



Regards,
JItendra
 

    bigyellow

    Points: 2
    Helpful Answer Positive Rating

akrlot

Member level 3
Joined
Jan 14, 2005
Messages
55
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
450
jitendra said:
hi,
first code is more appropriate. Writing elsif in reset condition is not a proper practice.

e.g. Code for D FF with Synch reset is

Code:
signal D, Q, clk, reset : bit ;
...
process (clk)
begin
    if (clk’event and clk = ’1’) then
        if reset = ’1’ then
            D <= ’0’ ;
        else
            -- you can write if or case statement within this else part
            Q <= D ;
        end if ;
    end if ;
end process ;



Regards,
JItendra

The process of DFF depends also on signal reset so you need to add it to its sensibility list.

process (clk,reset)
begin
--code here
end process;
 

jitendra

Member level 3
Joined
Aug 20, 2004
Messages
58
Helped
10
Reputation
20
Reaction score
7
Trophy points
1,288
Location
India
Activity points
731
Hi,
In case of synchronous reset, reset signal is not required in sensitivity list as reset will be sampled on active clock edge only. Where as in asynchronous reset it is necessary to include reset signal in sensitivity list because it is supposed to function independent of clock signal.

Regards,
Jitendra

akrlot said:
The process of DFF depends also on signal reset so you need to add it to its sensibility list.

process (clk,reset)
begin
--code here
end process;
 

nittinsharma80

Member level 5
Joined
Apr 11, 2005
Messages
93
Helped
11
Reputation
22
Reaction score
2
Trophy points
1,288
Location
INDIA
Activity points
2,337
yes,
for simulation if its synchronous then it should be activated on clk signal only
that why only clk in the sensitivity list.
how ever because of this there can be a simulation mismatch b/n synthesis and symulation of the same.
comment invited....
 

amraldo

Advanced Member level 4
Joined
Aug 29, 2004
Messages
1,185
Helped
145
Reputation
290
Reaction score
40
Trophy points
1,328
Location
Egypt
Activity points
5,880
The first form is more appropriate.
There is no need for reset in the process sensitivity list in case of synchronous rest.
In case of a synchronous reset, the eset must be in the sensitivity list. But take care that only one signal of clock or reset can be edge sensitive. There is no process sensitive for 2 clocks.
for example:
process(reset, clock)
begin
if reset = X then
ur code
elsif rising_edge(clock)
ur code
end if
end process
 

rprince006

Member level 4
Joined
Jul 16, 2004
Messages
79
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
841
the correct coding style for an FSM with async reset in VHDL:

process (clk, reset_n) -- for FSM
begin
if reset_n = '0' then
state <= IDLE;
elsif clk'event and clk = '1' then
state <= next_state;
endif
end process;

process (clk, reset_n) -- for registerd logic
begin
if reset_n = '0' then
signals <= '0'
elsif clk'event and clk = '1' then
if ... then
elsif .... then
else
endif;
endif;
end process;


Note: the process has to react first to reset_n signal before it reacts to
the clk event for an async logic.

Cheers,
Rprince006,
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top