Hallo zusammen,
ich habe mal angefangen mich ein wenig mit Verilog zu beschäftigen.
Also dachte ich mir mal einen D-FlipFlop zu bauen, aber auf Grund von
Primitiven (mit einfach if-Abfragen ist das ja kein Problem).
1 | module dff(d, c, out1, out2);
|
2 |
|
3 | input d;
|
4 | input c;
|
5 |
|
6 | output out1;
|
7 | output out2;
|
8 |
|
9 | reg out1, out2;
|
10 |
|
11 | wire w1, w2, w3, w4;
|
12 |
|
13 | always@(posedge c)
|
14 | begin
|
15 | out1 <= w3;
|
16 | out2 <= w4;
|
17 | end
|
18 |
|
19 | nand n1(w1, d, c);
|
20 | nand n2(w2, w1, c);
|
21 | nand n3(w3, w1, w4);
|
22 | nand n4(w4, w3, w2);
|
23 |
|
24 | endmodule
|
1 | `include "mod_flipflop.v"
|
2 |
|
3 | module test;
|
4 |
|
5 | reg d, c;
|
6 | wire out1;
|
7 | wire out2;
|
8 |
|
9 | initial begin
|
10 | $monitor("Zeit: %0d d: %0b c: %0b out1: %0b out2: %0b", $time, d, c, out1, out2);
|
11 | d = 0;
|
12 | c = 0;
|
13 | #3 d = 1;
|
14 | #1 c = 1;
|
15 | #1 c = 0;
|
16 | $finish;
|
17 | end
|
18 |
|
19 | dff dflipflop(d, c, out1, out2);
|
20 |
|
21 | endmodule
|
Leider funktionierts nicht so, wie ich es gerne hätte.
Kann mir jemand auf die Sprünge helfen?
Gute Nacht,
Stefan