Question

# Problem 1. a) Write a behavioral model of J-K flip-flop with active-low asynchronous reset. b) Write...

Problem 1.

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

b) Write a proper test-bench and stimulus, thoroughly test your J-K-FlipFlop. Also, show your waveform and describe why your JK-FF does what is is designed to do.

Problem 2.

a) Write a Verilog module that will assert its output if a 4-bit input binary word is even.

b) Show the waveform for two input patterns “1100” and “0101”

a.)

an async. reset mean the reset/ clear can occur even when there is no posedge of clock at the time

an active low keword mean that the rest value for activation will be 0 instead of 1

module jkffpos(j,k,q,clk,clear);
input j,k,clk,clear;// inputs
output reg q=0;
always@(posedge clk,negedge clear)// active low async. reset and clock sensitivity
begin
if(!clear)// active low check
q<=0;
else
begin
case({j,k})// output selction based on inputs j-k
0: q<=q;
1: q<=1;
2: q<=0;
3: q<=~q;
endcase
end
end
endmodule

b.) testbench:

module test();
reg j,k,clk,clear;
wire a;
jkffpos j1(j,k,a,clk,clear);

initial
begin// sending inputs to the design
clk=0;clear=1;j=0;k=0;
#2 clear=0;
#4 clear=1;j=0;k=0;
#1 j=1;k=1;
#8 j=0;
#4 j=1;k=0;
#4 j=0;
#10 \$finish;
end
initial// wave genration from dump files
begin
\$dumpfile("dump.vcd");
\$dumpvars(1);
end
initial// clock generation
forever
#2 clk=~clk;
endmodule

the parity can be check if we xor all bit of the input to itself. if the result is 0 then even if the result is 1 then odd parity is detected.

here even is 1 if the input has even parity.

module even_parity_checker(in,even);
input [3:0] in;
output even;

wire w1,w2,w3;// internal wires

xor x1(w1,in[0],in[1]);// xor gate
xor x2(w2,in[2],in[3]);
xor x3(w3,w1,w2);
not n1(even,w3);// used to give an active high output for even
endmodule

b.)

module test();
reg [3:0] in;
wire even;

even_parity_checker c1(.*);// automatic connection of testbench and design if names of the ports are same

initial// giving input values
begin
in=4'b1100;

1. #2 in=4'b0101;

#2 \$finish;
end
initial
begin
\$dumpfile("dump.vcd");
\$dumpvars(1);
end
endmodule

waveform:

#### Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
• ### Problem 1. a) Write a behavioral model of J-K flip-flop with active-low asynchronous reset. b) Write...

Problem 1. a) Write a behavioral model of J-K flip-flop with active-low asynchronous reset. b) Write a proper test-bench and stimulus, thoroughly test your J-K-FlipFlop. Also, show your waveform and describe why your JK-FF does what is is designed to do. Problem 2. a) Write a Verilog module that will assert its output if a 4-bit input binary word is even. b) Show the waveform for two input patterns “1100” and “0101”

• ### 10.21 Write a behavioral Verilog module vrDnegEc for a negative-edge-triggered D flip-flop with enable and asynchronous...

10.21 Write a behavioral Verilog module vrDnegEc for a negative-edge-triggered D flip-flop with enable and asynchronous active-low clear. Also write a test bench that instantiates your flip-flop and exercises its operation for a comprehensive input sequence.

• ### Q1. The basic functionality of a D flip-flop (FF) can be implemented with a J-K FF...

Q1. The basic functionality of a D flip-flop (FF) can be implemented with a J-K FF by connecting the input D to J and D' to K. a) Show that this is true by comparing the characteristic equations for a D FF and JK FF. b) Draw a timing diagram for clock, D and outputs Qp, On, Qms that illustrates the difference in input/output behavior of a positive edge triggered D FF, negative edge triggered D FF and a master...

• ### Model the following using Structural Verilog and write a Test Bench. a. Half adder b. Full...

Model the following using Structural Verilog and write a Test Bench. a. Half adder b. Full adder c 4 1 Multiplexer d. 2-to-4-Line Decoder 2. Model the following using Behavioral Verilog and write a Test Bench. a. Half adder b. 4-bit Up counter c. Positive edge triggered D Flip Flop d. Positive edge triggered JK Flip Flop

• ### Write the verilog code that implements a negitive edge D-Flip Flop with asynchronous active low preset...

Write the verilog code that implements a negitive edge D-Flip Flop with asynchronous active low preset and clear I have : module dff( preset, clear, clk, D, Q) input preset; input clear; input clk; input D; output Q; reg Q; always @ (negedge clk or negedge preset or negedge clear); if (preset); Q = 0; else (clear == 0); Q = D; endmodule I honestly just want to know if i'm doing this right or not, if im not correct,...

• ### 7. Construct the D-flip-flop with positive-edge triggering and asynchronous Clear (active-low). I...

7. Construct the D-flip-flop with positive-edge triggering and asynchronous Clear (active-low). Implement the Master-Slave design with two gated D-latches from problem 6 as building blocks and inverters. a) b) Show the schematic. Complete the waveform template below (neglect the propagation delays). Qm and Q are the outputs of the Master and Slave D-latches, respectively. The initial state is unknown. CLK CLK bar CLEAR Qm 7. Construct the D-flip-flop with positive-edge triggering and asynchronous Clear (active-low). Implement the Master-Slave design with...

• ### a) Write a Verilog module that implements a 1-bit partial full adder (PFA). b) Through instantiating...

a) Write a Verilog module that implements a 1-bit partial full adder (PFA). b) Through instantiating the module in a) plus other logic, implement a 4-bit full adder with Verilog. c) Write a proper test-bench and stimulus, thoroughly test your 4 bit carry lookahead adder. d) Show a waveform snapshot that indicates you adder can correctly compute 0101 + 1101 and show your results.

• ### Lab Description Follow the instructions in the lab tasks below to behaviorially create and simulate a flip-flop. Af...

Lab Description Follow the instructions in the lab tasks below to behaviorially create and simulate a flip-flop. Afterwards, you will create a register and use your ALU from Lab 3 to create an accumulator-based processor. This will act ike a simple processor; the ALU will execute si operations and each result will be stored in the register. In an accumulator, the value of the register will be updated with each operation; the register is used as an input to the...

• ### Use a behavioral Verilog model to design a 3-bit fault tolerant up-down counter. For each flip-fl...

Use a behavioral Verilog model to design a 3-bit fault tolerant up-down counter. For each flip-flop (FF) include asynchronous reset and preset signals. Refer to Example 4.3 on page 160 for an example of a single FF with both reset and preset signals as well as with an enable signal. For this project, you don't need to use FFs with enables. You don't also need not-q (nq) in this assignment. Use active-high signals for reset and present signals. The example...

• ### 1) Based on the sequential circuit and answer the following questions SOV a) Write equations for...

1) Based on the sequential circuit and answer the following questions SOV a) Write equations for J, K, T, and Z in terms of the input X and the current state given by flip flop outputs QA, QB b) Based on these equations and the properties of JK and Toggle FF's fill out the state table CURRENT NEVT STATE OUTPUT QA QB X- O X=1 X-OX=1 QAQB QAQB 0 0 STATE NEXT STATE OUTPUT c) Based on the State table...