Question

In: Electrical Engineering

Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...

Please Create the Verilog/Vivado Code For:

An LFSR Pseudonumber generator, and the testbench for test it,

please comment and explain the answer as much as possible,(Make your own code, even it is more simple, but do not copy from others sources on the internet)

if possible, post Pic of the waveform simulation!

Solutions

Expert Solution

Answer 1)

Verilog Code for the 4 bit LFSR is shown below

module lfsr (Data, Load, Clock, Out);
input [3:0] Data;
input Load;
input Clock;
output [3:0] Out;

reg [3:0] temp;

always @ (posedge Clock)
begin   
if (Load)
temp <= Data;
else
temp <= {!(temp[2]^temp[0]), temp[3], temp[2], temp[1]};
end

assign Out = temp;

endmodule

Testbench for the above LFSR is shown below:-

module lfsr_tb;
reg [3:0] Data;
reg Load, Clock;
wire [3:0] Out;

lfsr m1 (.Clock(Clock), .Load(Load), .Data(Data), .Out(Out));

initial
begin
Clock = 1'b0;
forever #5 Clock = ~Clock;
end

initial
begin
Data = 4'b1100;
Load = 1'b1;
@(negedge Clock);
Load = 1'b0;
repeat(20)
@(negedge Clock);
$finish;
end

endmodule

Waveform for the LFSR is :-


Related Solutions

Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible if possible, post Pic of the waveform simulation!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible waveform simulation answer would be nice too!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible!
Design and write a verilog code and testbench for a 16-bit RISC MIPS Processor on vivado...
Design and write a verilog code and testbench for a 16-bit RISC MIPS Processor on vivado and show waveform.
code an 8 bit LFSR random number generator in system verilog. Write a test bench, load...
code an 8 bit LFSR random number generator in system verilog. Write a test bench, load the seed 11111111, and generate the first 10 random numbers.
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 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
Verilog code to make 8bit bcd to 8bit binary please with testbench
Verilog code to make 8bit bcd to 8bit binary please with testbench
Write a Verilog code to implement 16 bit LFSR
Write a Verilog code to implement 16 bit LFSR
Create a testbench in Verilog for the following module (logic). Verify the testbench works in your...
Create a testbench in Verilog for the following module (logic). Verify the testbench works in your answer. I'll upvote correct answers. This module does the following. The algorithm takes an input between 0 and 255 (in unsigned binary and counts the number of ones in each number (ex. 01010101 has 4 ones). Then the output would be 00000100 (4 in binary because there are 4 ones. The test bench would need to verify the inputs and outputs of each number....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT