Saturday 22 January 2022

Verilog code for T Flipflop

 


Gate Level Modelling

module tflipflop(t,clk,q,qbar);

input t,clk;

output reg q,qbar;

wire x,y;

nand g1(x,t,clk,qbar);

nand g2(y,t,clk,q);

nand g3(q,x,qbar);

nand g4(qbar,y,q);

endmodule


Behavioral Level Modelling

module tflipflop(t,clk,q,qbar);

input t,clk;

output reg q,qbar;

always @ (posedge clk)

begin

case({t})

1'b0: begin q<=q; end

1'b1: begin q<=~q; end

endcase

end

endmodule


No comments:

Post a Comment

Verilog Code for Universal Shift Register

  Universal Shift Register module universalshift (clr,clk,sel,in,out); input clr,clk; input [1:0]sel; input [3:0]parin; output reg[3:0]out; ...