// verilog code for COUNTER using j-k flipfops
module counter(D,clk,Reset,count);
//input port declaartions
input D,clk,Reset ;
//output port declarations
output [2:0] count ;
//internal signal declarations for flipflop inputs
reg [2:0] J,K;
//internal signal declarations for flipflop outputs
reg [2:0] Q,Q_bar;
//logic for flipflop input expressions
assign J[2] = ((~Q[1]) & (~(Q[0] ^ D)));
assign K[2] = ((~Q[1]) & (Q[0] ^ D));
assign J[1] = ((Q[2] & (~(Q[0] ^ D))) | ((~Q[2]) & (Q[0] ^ D))) ;
assign K[1] = (((~Q[2]) & (~(Q[0] ^ D))) | (Q[2] & (Q[0] ^ D))) ;
assign J[0] = (Q[1] & (~(Q[2] ^ D)));
assign K[0] = (Q[1] & (Q[2] ^ D));
//INSTANTIATION of JK flipflops
JK_FF U0 (.J(J[2]),.K(K[2]),.clk(clk),.Reset(Reset),.Q(Q[2]),.Q_bar(Q_bar[2]));
JK_FF U1 (.J(J[1]),.K(K[1]),.clk(clk),.Reset(Reset),.Q(Q[1]),.Q_bar(Q_bar[1]));
JK_FF U2 (.J(J[0]),.K(K[0]),.clk(clk),.Reset(Reset),.Q(Q[0]),.Q_bar(Q_bar[0]));
//combo logic for counter output
assign count = Q;
endmodule
//verilog code for J-K flipflop
module JK_FF (J,K,clk,Reset,Q,Q_bar);
input J,K,clk,Reset;
output Q,Q_bar;
reg temp;
always @(posedge clk)
begin
if (Reset==1'b0)
begin
temp <= 1'b0;
end
else begin
case({J,K})
2'b00: temp <= temp;
2'b01: temp <= 1'b0;
2'b10: temp <= 1'b1;
2'b11: temp <= (~temp);
endcase
end
end
assign Q = temp ;
assign Q_bar = ~(Q);
endmodule
// verilog testbench code for counter
module test_counter ;
//inputs
reg D,clock,Reset ;
//outputs
wire [2:0] count;
//instantiate counter DUT
counter DUT (D,clock,Reset,count);
//clock input genartion
initial
begin
clock = 1'b0 ;
forever #5 clock = ~clock ;
end
initial
begin
$dumpfile("file.vcd");
$dumpvars;
Reset = 1'b0 ;
D=1'b1;#10;
Reset = 1'b1;
D=1'b0;
#80 ;
D= 1'b1;
#70;
D=1'b0;
$finish;
end
endmodule
verilog code needed for the counter using the JK flip flop please include the testbench, thanks!...
Using verilog code, write the testbench and design for a D- Flip Flop (latch)
write 3-bit Gray code using jk-flip flop in verilog (behavioral code)
I need the verilog module and testbench for this Thanks Design a binary sequence detector that detects 4 consecutive 1's; overlap is allowed. You should have 5 states and thus you need 3 flip-flops. For simplicity, you can assign the states to be 000, 001, 010, 011, 100.
Verilog! NOT VHDL Please (4 pts) Write a behavioral Verilog module to implement a counter that counts in the following sequence: 000, 010, 100, 110, 001, 011, 101, 111, (repeat) 000, etc. Use a ROM and D flip-flops. Create a test bench for your counter design and run functional simulation in ModelSim. (4 pts) Write a behavioral Verilog module to implement a counter that counts in the following sequence: 000, 010, 100, 110, 001, 011, 101, 111, (repeat) 000, etc....
Design serial (asynchronous) counter modulo 7 using synchronous flip-flops (T, D or JK). The counter should count up.
C. The task is to create a complex counter that can count in binary or in Gray code, depending on the value of a mode input: "A synchronous 3-bit counter has a mode control input m. When m = 0, the counter steps through the binary sequence 000, 001,010, 011, 100, 101, 110, 111, and repeat. When m = 1, the counter advances through the Gray code sequence 000, 001,011, 010, 110, 111, 101, 100, and repeat. (USE JK FLIP...
3. Design a counter with the following repeated binary sequence: 0,1,2,4,6. Use D flip-flop. 4. Design a counter to count with T flip-flops that goes through the following binary repeated sequence: 0,1,3,7,6,4. Find out the counter response towards the unused state. Illustrate the response with a state diagram. 5. Design a mod-7 counter (repeat binary sequence: 0,1,2,3,4,5,6) use JK flip-flop.
Design a counter that counts in the following sequence: 010, 011, 100, 101, and repeat. Use JK flip-flops in your implementation.
(a) Design an asynchronous Binary Coded Decimal (BCD) count-up counter using JK flip-flops. Draw the counter circuit clearly showing the configuration of the JK flip-flops and the necessary logic gate(s). Sketch the input and output waveforms of this counter (7 Marks) (b) The binary up/down counter for a cargo lift controller in a 7-storey building has an up-down (UID) control input and a buzzer output (B). The buzzer will sound B 1) when the lift is at level 1 or...
Design a 5-bit binary counter using JK flip flops. Draw the flip-flop circuit diagram, the state graph, the timing diagram, the truth table (with clk pulse) and the state table (with present and next states).