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)
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,...
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
Please no hand writing Start a new Quartus project for D flip-flop with enable, reset, set,...
Please no hand writing Start a new Quartus project for D flip-flop with enable, reset, set, cp. type the VHDL code create the circuits in Quartus.
Explain in detail the differences between 4-Bit Synchronous and Asynchronous Counters. Each Flip-Flop is negative-edge triggered....
Explain in detail the differences between 4-Bit Synchronous and Asynchronous Counters. Each Flip-Flop is negative-edge triggered. Use the relevant block diagrams, Truth Table of state sequence, and Timing Diagram to support your explanation.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT