delta136
Newbie level 5
- Joined
- Dec 5, 2014
- Messages
- 10
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 84
Hey everyone! Would greatly appreciate it if someone could look over my code and tell me if I implemented this correctly.
1-bit SR-Latch: (Teacher provided the diagram and truth table)
Code here: (c is for the clock)
1-bit D-Latch:
Code here:
The reason I ask for someone to look over it is because I'm not sure if my code reproduces the two truth tables.
And lastly, the ultimate goal is to use the SR-latch and D-latch to make a Flip Flop (That's a D-Flip Flop, right?)
Can someone explain to me what the 'P' is in the flip flop? Why does the truth table contain only Q and not Q' like the above pictures, yet the output of the flip flop has Q and Q'?
Thank you very much for your time and help!
1-bit SR-Latch: (Teacher provided the diagram and truth table)
Code here: (c is for the clock)
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 module sr_latch(output q, output q_not, input s, input c, input r); wire n1_out; wire n2_out; wire n3_out; wire n4_out; nand n1(n1_out, s, c); nand n2(n2_out, c, r); nand n3(n3_out, n1_out, n4_out); nand n4(n4_out, n3_out, n2_out); assign q = n3_out; assign q_not = n4_out; endmodule
1-bit D-Latch:
Code here:
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 module d_latch(output q, output q_not, input d, input c); wire inv_out; wire n1_out; wire n2_out; wire n3_out; wire n4_out; not(inv_out, d); nand(n1_out, d, c); nand(n2_out, c, inv_out); nand(n3_out, n1_out, n4_out); nand(n4_out, n3_out, n2_out); assign q = n3_out; assign q_not = n4_out; endmodule
The reason I ask for someone to look over it is because I'm not sure if my code reproduces the two truth tables.
And lastly, the ultimate goal is to use the SR-latch and D-latch to make a Flip Flop (That's a D-Flip Flop, right?)
Can someone explain to me what the 'P' is in the flip flop? Why does the truth table contain only Q and not Q' like the above pictures, yet the output of the flip flop has Q and Q'?
Thank you very much for your time and help!
Last edited by a moderator: