Continue to Site

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.

corner case in verilog code.........

Status
Not open for further replies.

sareene

Junior Member level 1
Joined
Aug 5, 2008
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,398
verilog corner case

Hi Everyone, The following is a small verilog code which below models a flip-flop with asynchronous set/reset logic (active low). The model synthesizes correctly, but there is a corner case where simulation results are incorrect. What is the corner case?


always_ff @( posedge clk
or negedge rst_n // active-low reset
or negedge set_n // active-low set
)
if (!rst_n) // reset has priority over set
q_out <= '0; // reset all bits to zero
else if (!set_n)
q_out <= '1; // set all bits to one
else
q_out <= data_in; // d input assignment
 

Look at when you assert the set and reset signal with respect to the clock, Since these two are asynchronous signals, they seem to work fine with the RTL code but you may face problems in the gate level simulation after the block is synthesized.
 

What hardware did you get out of this code? May be you had planned to generate flop. But I am afraid that this code will give you flop ....
 

set-reset priority depends on the lib. u r using.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top