Exercise No
Exercise No
13
Latch
Date:
Komandur Raghunandan-RA1412008010032
Type: Sequential design
Aim : To design D latch and SR latch in behavior modeling using
verilog and verify the functionality with test bench.
Simulation tool: ModelSim 10.3
Circuit diagram:
Verilog program:
//Clocked d latch
module d_latch (output reg q,input d,rst,clk);
always@(clk or rst)
if(rst)
q<=1'b0;
else
q<=d;
endmodule
//SR latch
module sr_latch (output reg q,input s,r);
always@(s or r)
case (s,r)
2'b00:q<=q;
2'b01:q<=1'b0;
2'b10:q<=1'b1;
2'b11:q<=1'bx;
endcase
endmodule
//SR latch