Write Verilog program, verify using test benches using monitor/display/strobe and provide output for the following programs.
28

module testbench_28;
integer count;
initial begin
count = 0;
repeat(128)
begin
$display("count = %d", count);
count = count + 1;
end
end
endmodule
// Part a) This program prints the output from 0 to 127
/************ Output of Program ************
count = 0
count = 1
count = 2
count = 3
count = 4
:::: :: :::
count = 125
count = 126
count = 127
*******************************************/
module testbench_29;
reg [4:0] memory_size = 5'd16;
reg [3:0] word_address;
reg [3:0] memory[15:0];
initial begin
word_address = 0;
repeat(memory_size)
begin
memory[word_address] = 0;
$display("memory[%d] = %d", word_address,
memory[word_address]);
word_address = word_address + 1;
end
end
endmodule
// Part b) This part of code will initialize memory with '0' for
all memory address locations
/************ Output of Program ************
memory[ 0] = 0
memory[ 1] = 0
memory[ 2] = 0
memory[ 3] = 0
memory[ 4] = 0
memory[ 5] = 0
memory[ 6] = 0
memory[ 7] = 0
memory[ 8] = 0
memory[ 9] = 0
memory[10] = 0
memory[11] = 0
memory[12] = 0
memory[13] = 0
memory[14] = 0
memory[15] = 0
*******************************************/
module testbench_30;
reg clock;
initial begin
clock = 1'b0;
forever #10 clock = !clock;
end
initial begin
$monitor("@time = %4d : clock = %b", $time, clock);
end
endmodule
// Part C)
// This peice of code will create a clock with time period = 2*20 =
40 time units
// This clock will have same ON time as well as same OFF time i.e
Duty cycle of the clock is 50 %
// And the clock start from '0' onwards, and keeps on continuing
like a infinite loop
/************ Output of Program ************
@time = 0 : clock = 0
@time = 10 : clock = 1
@time = 20 : clock = 0
@time = 30 : clock = 1
@time = 40 : clock = 0
@time = 50 : clock = 1
@time = 60 : clock = 0
::::: :: :::: ::::::: :::
::::: :: :::: ::::::: :::
::::: :: :::: ::::::: :::
::::: :: :::: ::::::: :::
@time = 573680 : clock = 0
@time = 573690 : clock = 1
@time = 573700 : clock = 0
@time = 573710 : clock = 1
@time = 573720 : clock = 0
@time = 573730 : clock = 1
@time = 573740 : clock = 0
@time = 573750 : clock = 1
@time = 573760 : clock = 0
@time = 573770 : clock = 1
@time = 573780 : clock = 0
*******************************************/
module testbench_31;
reg clock;
initial begin : clock_loop
clock = 0;
forever begin
#10 clock = 1;
#10 clock = 0;
end
end
initial #350 disable clock_loop;
initial begin
$monitor("@time = %4d : clock = %b", $time, clock);
end
endmodule
// Part D)
// This peice of code creates the clock with Toff time = 10 time
units; and
// Ton time = 10 units; So, the Total time period = 10 + 10 = 20
time units
// While the duty cycle is 50 %, for this clock
// The simulation stops after #350 time unit
//
/************ Output of Program ************
@time = 0 : clock = 0
@time = 10 : clock = 1
@time = 20 : clock = 0
@time = 30 : clock = 1
@time = 40 : clock = 0
@time = 50 : clock = 1
@time = 60 : clock = 0
@time = 70 : clock = 1
@time = 80 : clock = 0
@time = 90 : clock = 1
@time = 100 : clock = 0
@time = 110 : clock = 1
@time = 120 : clock = 0
@time = 130 : clock = 1
@time = 140 : clock = 0
@time = 150 : clock = 1
@time = 160 : clock = 0
@time = 170 : clock = 1
@time = 180 : clock = 0
@time = 190 : clock = 1
@time = 200 : clock = 0
@time = 210 : clock = 1
@time = 220 : clock = 0
@time = 230 : clock = 1
@time = 240 : clock = 0
@time = 250 : clock = 1
@time = 260 : clock = 0
@time = 270 : clock = 1
@time = 280 : clock = 0
@time = 290 : clock = 1
@time = 300 : clock = 0
@time = 310 : clock = 1
@time = 320 : clock = 0
@time = 330 : clock = 1
@time = 340 : clock = 0
*******************************************/
Write Verilog program, verify using test benches using monitor/display/strobe and provide output for the following programs....
I need the following in verilog. Attached is also the test bench. CODE // Design a circuit that divides a 4-bit signed binary number (in) // by 3 to produce a 3-bit signed binary number (out). Note that // integer division rounds toward zero for both positive and negative // numbers (e.g., -5/3 is -1). module sdiv3(out, in); output [2:0] out; input [3:0] in; endmodule // sdiv3 TEST BENCH module test; // these are inputs to "circuit under test" reg...
Modify the Moore FSM below to detect the sequence "110" , simulate using the same test bench and create a Moore Transition Diagram for the new sequence 110. module moore_seq ( input clock, reset, x, output reg z ); //assign binary encoded codes to the states A through D parameter A = 2'b00, B = 2'b01, C = 2'b10, D = 2'b11; reg [1 : 0] current_state, next_state; //Section 1: Next state generator (NSG)...
I need help writing the Verilog Design code for this test bench. I have to calculate the dot product of two 8-bit vectors a and b. I have listed the test bench below: // Code your testbench here module test_VVM; wire [3:0] value; wire done; reg clk, rst; reg [7:0] a, b; initial begin a = 8'b11011101; b = 8'b11010111; clk = 1'd0; //at time 0 rst = 1'd0; //at time 0 rst = #2 1'd1; //at...
program an 8-to-1 multiplexor using verilog
output of time table from 1 - 2047
For example output should look like....
--------- [Start of table] ---------------------------- [End of
table] ----------
Here is example of 4x1 Multiplexor ... Just need code
for 8x1 Multiplexor
module DecoderMod(s, o);
input [1:0] s;
output [0:3] o;
wire [1:0] inv_s;
not(inv_s[1], s[1]);
not(inv_s[0], s[0]);
and(o[0], inv_s[1], inv_s[0]);
and(o[1], inv_s[1], s[0]);
and(o[2], s[1], inv_s[0]);
and(o[3], s[1], s[0]);
endmodule
module MuxMod(s, d, o);
input [1:0] s;
input [0:3]...
Using the Windows Starter Visual Studio project create the following two programs. 1. Write a program that will loop three times and raise the number 25 to the third power (25pts). (25*25*25) Note: Make sure you have a large enough memory for the final number 2. Write a program using a whileSum that adds one to the index until it is five (25pts). Sample: mov sum, 0 ; sum := 0 mov ecx, 1 ; count := 1 whileA:...
In C language using printf and scanf statements: Write a program to display a histogram based on a number entered by the user. A histogram is a graphical representation of a number (in our case, using the asterisk character). On the same line after displaying the histogram, display the number. The entire program will repeat until the user enters zero or a negative number. Before the program ends, display "Bye...". The program will ask the user to enter a non-zero...
#8 Verilog
Program 6-6 Test bench for a 2-to-4 decoder tinescale i ne 7 100 ps nodule Vr2to4dec tb O integer i, errors; reg (3:0] expectY; Vratoidec, UUT AO(AOs), A1 CA1s), .ENCENa), I/ Instantiate unit under initial begin errors 0: for (i-o; ic-7: 1-1+1) begin // Apply test input combination // Expect no outputs asserted it E #10 ; expecty 4'b0000 if' (ENs-1 ) expectrais,AOs)) 1 'b1; // Else output {A1,AO} should bL if (fr3s, Y2s, Y1s, YOs expectY) begin...
Using Verilog, write a simulation code that shows the function g(w, x, y, z) = wxyz + w’x’y’z+w’x’yz’+w’xy’z’+wx’y’z’ using a 4 to 16 decoder that is built with two 3 to 8 decoders. The 3 to 8 source code I'm using is: module Dec3to8( input[2:0] A, input E, output[7:0] D ); assign D[0] = E & ~A[2] & ~A[1] & ~A[0]; assign D[1] = E & ~A[2] & ~A[1] & A[0]; assign D[2]...
There is an example below
Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A The MiteASM Assembler and Appendix B The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should 1. display a count on the 7-segment display. The count should increase by 1 when button 0 is pressed. It should reset to 0 when button...
Write a program to help answer questions like the following: Suppose the species Klingon ox has a population of 100 and a growth rate of 15 percent, and the species elephant has a population of 10 and a growth rate of 35 percent. How many years will it take for the elephant population to exceed the Klingon ox population? You can assume that this will happen within 10 years. Use the version of the class Species from Sakai’s Week 7...