Question

In: Electrical Engineering

Analyze the following Verilog code and write down its output as pictured in the code. module...

Analyze the following Verilog code and write down its output as pictured in the code.

module blocking;

reg [0:7] A, B;

initial begin: init1

A = last decimal digit of your ID;

#1 A = A + 1; // blocking procedural assignment

B = A + 1;

$display("Output 1: A= %b B= %b", A, B );

A = last decimal digit of your ID;

#1 A <= A + 1;

B <= A + 1;

#1 $display ("Output 2: A= %b B= %b", A, B );

end

endmodule

Solutions

Expert Solution

Analyzing the code:

Here blocking procedural assignment (=) and non blocking procedural assignment (<=) statements are used.

Given A and B are 8 bit numbers. Initially Let A=7(last digit of id number).

In first case Using blocking procedural assignment:

#1 A=A+1 means after 1 time unit output will be A= 7+1=8,

B=A+1 = 8+1 = 9 .

While using blocking procedural assignment ,the value of A gets updated and it will be used in next statements.

In second case Using non blocking procedural assignment:

#1A<=A+1 means after one time unit the value of will be A= 7+1=8

B<=A+1=7+1=8

In case of nonblocking procedural assignment the old value (initial value) of A will be used in all statements.

The purpose of Non blocking procedural assignment is to use the previous values to the variables at the start of current time unit and assigning new values to variables at the end of current time unit.

Blocking procedural assignment are used for combinational circuits and nonblocking for sequential circuits.

Here let last digit of id number be 7

OUTPUT:

Output1:A=00001000 B=00001001

Output2:A=00001000 B=00001000


Related Solutions

Write down the VERILOG code for an XOR gate and the testbench code to test it
Write down the VERILOG code for an XOR gate and the testbench code to test it
Write a Verilog HDL module that has three inputs, A, B, C, and one output, Y,...
Write a Verilog HDL module that has three inputs, A, B, C, and one output, Y, to implement a function that Y output is true if at least two of the inputs are false Also, write a testbench for the function.
Write the Verilog Code for the module to multiply two 7-bit numbers using the array multiplie
Write the Verilog Code for the module to multiply two 7-bit numbers using the array multiplie
Write a Class called Module with the following attributes: module code, module name, list of lecturers...
Write a Class called Module with the following attributes: module code, module name, list of lecturers for the module (some modules may have more than one lecturer – we only want to store their names), number of lecture hours, and module description. Create a parameterised (with parameters for all of the class attributes) and a non-parameterised constructor, and have the accessor and mutator methods for each attribute including a toString method. Write a class Student with the following attributes: student...
Please write down in Verilog code with testbench: Audio Tone Generator like Ambulance siren or Police...
Please write down in Verilog code with testbench: Audio Tone Generator like Ambulance siren or Police siren.
Write Verilog code for a Moore detector that detects sequences 10111 and 10101 on its j...
Write Verilog code for a Moore detector that detects sequences 10111 and 10101 on its j input and creates a pulse of exactly one clock duration on its output. The output becomes 1 if either of the sequences, or an overlap of the two is detected. A) Show the state diagram of this machine. B) Write complete Verilog for the design. C) Write a testbench and test your state machine using ModelSim.
SOLVE FOLLOWING a.   Desgin and VERILOG code of a 3 bit up down counter USING T...
SOLVE FOLLOWING a.   Desgin and VERILOG code of a 3 bit up down counter USING T FLIP FLOP..... b. using behavioural module.Write a verilog discription of an N-BIT up down binary counter. Record the simulation output waveform in observation.....
Write a Verilog code to implement 16 bit LFSR
Write a Verilog code to implement 16 bit LFSR
Write the VERILOG code for an arithmetic/logic unit (ALU) following , and can be tested in...
Write the VERILOG code for an arithmetic/logic unit (ALU) following , and can be tested in on nexys 4 board This is to be implement on : ISE Design Suite - Xilinx /* ALU Arithmetic and Logic Operations ---------------------------------------------------------------------- |ALU_Sel| ALU Operation ---------------------------------------------------------------------- | 0000 | ALU_Out = A + B; ---------------------------------------------------------------------- | 0001 | ALU_Out = A - B; ---------------------------------------------------------------------- | 0010 | ALU_Out = A * B; ---------------------------------------------------------------------- | 0011 | ALU_Out = A / B; ---------------------------------------------------------------------- |...
Write the Verilog code and test bench for the following circuits: - Mealy State machine design...
Write the Verilog code and test bench for the following circuits: - Mealy State machine design for a Serial Adder Circuit - Moore State Machine design for a Serial Adder Circuit
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT