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.

Output waveform problem for SR latch in Verilog

Status
Not open for further replies.

shockingshockley

Member level 1
Joined
Dec 11, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,286
Activity points
1,611
Hello. I am implementing this SR latch circuit below using Verilog:
1645073373578.png


This is the expected logical truth table for this SR latch:
1645073470526.png


This is the Verilog code I wrote:
1645073493771.png


The corresponding technology map is this after I compile the Verilog code. It is not the same as the NAND SR latches.
1645073536607.png


After compiling, I run the functionality check to observe the input and output waveforms:
1645073624929.png


However, the output Q is always logic 1 throughout the period. It should have an undefined outputs of 0 and 1. Could you please advise me what is something wrong in my Verilog implementation and behavioral simulation? Thanks in advance.
 

Hi,

Try this:
Take a pencil and a paper ... and draw strictly what your code says.
Then compare it with the given schematic.

In case it's still unclear, please show your drawing.

Klaus
 

@shockingshockley
If you want to implement exactly the SR latch circuit as in pic1, you need to use some SPICE simulations tool such as Tanner EDA.
In FPGA you have only LookupTables, Flipflops and Multiplexers as the most basic implementation elements. So when you synthesize a Verilog code, the structure will be different than as in the pic1. But the functionality will be the same.
 

As dpaul clarified, the Verilog description and the gate level circuit are functional equivalent.

The main problem of post #1 is however the confusion about "undefined". Seeing level '1' in a specific test case doesn't contradict the general specification as undefined. Your testbench must include all input signal combinations and respective transistions to see the different output states for input "11".
 

The SR flip-flop is a basic memory cell. There are certain situations which cause a change of state when you change an input.
And certain situations where no change of state occurs when you change an input.

Sometimes the Q output changes yet Q-bar does not. Or vice-versa.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top