yosys/examples/cmos/cmos_cells.v

45 lines
541 B
Verilog
Raw Permalink Normal View History

2013-09-14 04:23:45 -05:00
2015-03-25 03:00:41 -05:00
module BUF(A, Y);
input A;
output Y;
assign Y = A;
endmodule
2013-09-14 04:23:45 -05:00
module NOT(A, Y);
input A;
2015-03-25 03:00:41 -05:00
output Y;
assign Y = ~A;
2013-09-14 04:23:45 -05:00
endmodule
module NAND(A, B, Y);
input A, B;
2015-03-25 03:00:41 -05:00
output Y;
assign Y = ~(A & B);
2013-09-14 04:23:45 -05:00
endmodule
module NOR(A, B, Y);
input A, B;
2015-03-25 03:00:41 -05:00
output Y;
assign Y = ~(A | B);
2013-09-14 04:23:45 -05:00
endmodule
module DFF(C, D, Q);
input C, D;
output reg Q;
always @(posedge C)
Q <= D;
endmodule
module DFFSR(C, D, Q, S, R);
input C, D, S, R;
output reg Q;
always @(posedge C, posedge S, posedge R)
if (S)
Q <= 1'b1;
else if (R)
Q <= 1'b0;
else
Q <= D;
endmodule