dff: switch to Verilog primitives to get edge triggering
This commit is contained in:
18
dff.v
18
dff.v
@@ -1,21 +1,9 @@
|
||||
`ifndef _dff_v
|
||||
`define _dff_v
|
||||
|
||||
`include "nand.v"
|
||||
`include "not.v"
|
||||
|
||||
module DFF (input in, input clk, output out);
|
||||
wire in_bar, clk_bar;
|
||||
wire u2o, u3o;
|
||||
wire s, r;
|
||||
|
||||
Not u1 (.in(in), .out(in_bar));
|
||||
Nand u2 (.a(in), .b(clk), .out(u2o));
|
||||
Nand u3 (.a(in_bar), .b(clk), .out(u3o));
|
||||
Nand u4 (.a(u2o), .b(r), .out(s));
|
||||
Nand u5 (.a(u3o), .b(s), .out(r));
|
||||
|
||||
assign out=s;
|
||||
module DFF (input in, input clk, output reg out);
|
||||
always @(posedge clk)
|
||||
out <= in;
|
||||
endmodule
|
||||
|
||||
`endif
|
||||
Reference in New Issue
Block a user