Question

In: Electrical Engineering

Write and verify a behavioral Verilog model of J-K flip-flop with active-low asynchronous reset.

Write and verify a behavioral Verilog model of J-K flip-flop with active-low asynchronous reset.

Solutions

Expert Solution

// Verilog behavioral model for J-K flipflop

module JK_ff (

//input port declarations

input clk,

input resetn,

input J,

input K,

  

//output port declarations

output Q ,

output Q_bar );

  

//internal signal declarations

reg Q_temp ;

  

//always block for JK flipflop operations

always @ (posedge clk or negedge resetn)

//jk flipflop triggered by positive edge of clock (clk)and has asynchronous active low reset (resetn)

begin

if (~resetn) //active low reset

Q_temp <= 1'b0;

else begin

case ({J,K})

2'b00: Q_temp <= Q_temp;//hold previous output

2'b01: Q_temp <= 1'b0;//reset

2'b10: Q_temp <= 1'b1;//set

2'b11: Q_temp <=(~Q_temp) ; //toggle previous output

endcase

end

end

  

//flipflop output logics

assign Q = Q_temp;

assign Q_bar = ~Q_temp;

  

endmodule

//verilog testbenh code for JK fliplfop

module test_JK_ff;

  

reg clk;

reg resetn;

reg J;

reg K;

  

wire Q;

wire Q_bar;

  

  

//instantiate DUT of JK_ff

JK_ff dut (.clk(clk),.resetn(resetn),.J(J),.K(K),.Q(Q),.Q_bar(Q_bar));

//clock generation

initial begin

clk = 1'b0;

forever #5 clk = ~clk;

end

  

//reset generation

initial begin

resetn = 1'b0;

#10 resetn = 1'b1;

end

  

//inpu stimulus generations

initial

begin

$dumpfile("dump.vcd");

$dumpvars(1);

J = 1'b0; K = 1'b0; #10;

J = 1'b0; K = 1'b1; #10;

J = 1'b1; K = 1'b0; #10;

J = 1'b1; K = 1'b1; #10;

J = 1'b1; K = 1'b0; #10;

J = 1'b0; K = 1'b0; #10;

J = 1'b0; K = 1'b1; #10;

J = 1'b1; K = 1'b1; #10;

J = 1'b0; K = 1'b0; #10;

  

#10 $finish;

end

endmodule

// Simulation waveforms


Related Solutions

You are to implement the following in VHDL: D flip-flop D flip-flop       with enable and reset J-K...
You are to implement the following in VHDL: D flip-flop D flip-flop       with enable and reset J-K flip flop with asynchronous set T Flip flop with asynchronous clear
Write the VHDL PROCESS statements for a D flip-flop with synchronous active-LOW clear, synchronous active-LOW preset,...
Write the VHDL PROCESS statements for a D flip-flop with synchronous active-LOW clear, synchronous active-LOW preset, and responsive to a rising edge clock. Use D for the input, Q for the output, PRE for the preset, CLR for the clear, and CLK for the clock. All signals are BIT type
Implement a JK Flip flop using behavioral modeling in verilog, also write its test bench code.
Implement a JK Flip flop using behavioral modeling in verilog, also write its test bench code.
Write a VHDL code and testbench for a positive-edge-triggered JK-type FF with asynchronous active-low reset (RN)...
Write a VHDL code and testbench for a positive-edge-triggered JK-type FF with asynchronous active-low reset (RN) - JKFFR
Provide the VHDL code and simulation results for a mod-7 counter, with asynchronous active low reset.
Provide the VHDL code and simulation results for a mod-7 counter, with asynchronous active low reset.
2. Design a falling-edge triggered SR flip-flop with an active-high asynchronous clear. a) Draw the logic...
2. Design a falling-edge triggered SR flip-flop with an active-high asynchronous clear. a) Draw the logic symbol and a truth table. b) Write a complete VHDL model (entity and behavioral architecture)
Imagine a new kind of flip-flop called a J N flip-flop which has two inputs J...
Imagine a new kind of flip-flop called a J N flip-flop which has two inputs J and N. Input J behaves like the J input of the J K flip-flop, and input N behaves like the complement of the K input of a J K flip-flop (N=K’). Derive the characteristic table and excitation table of the J N flip-flop. Show that a D flip-flop can be constructed from a J N flip-flop by connecting its two inputs (J and N)...
Read sections in the TTL data sheets pertaining to the 74LS112A Dual J-K flip-flop. 1. For...
Read sections in the TTL data sheets pertaining to the 74LS112A Dual J-K flip-flop. 1. For the 74LS112A, what is the maximum clock rate, minimum pulse width for the clock’s high and low levels, worst case propagation delay of the outputs from the high-to-low clock transition, and minimum input setup time? 2. Design a nine-step counter to count in the following sequence. Use J-K flip-flops, NAND gates, and Inverters only. 0011, 0101, 1001, 1000, 1011, 1010, 0110, 0100, 0111, 0011,...
design 4 bit four way traffic light signal by using j k flip flop and 555...
design 4 bit four way traffic light signal by using j k flip flop and 555 timer ic state equation and k map and also schematic diagram.
Verify the operation of a D flip-flop by providing appropriate inputs to the D, Preset, and...
Verify the operation of a D flip-flop by providing appropriate inputs to the D, Preset, and Clear pins. Use CLOCK input to the flip-flop to function properly ( can be found under wiring in Logisim) //If you present a diagram designed in the "Logisim app" it would be very much appreciated. Thank you
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT