Question

In: Electrical Engineering

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.

Solutions

Expert Solution

module lfsrcode (output reg [7:0]out, input clk, input rst);

wire fdbk;

assign fdbk = ~(out[7] ^ out[6]);

always @(posedge clk, negedge rst)

begin

if (!rst)

out = 8'b11111111;

else

out = {out[6:0],fdbk};

end

endmodule

//testbench//

`timescale 1ns/1ps

module lfsrcode_test();

    reg clk,rst;

    wire [7:0]out;

    Lfsrcode UUT(.out(out),.clk(clk),.rst(rst));

    initial

        begin

        $display(“time,\t out,”);

        $monitor(“%g,\t %b”,$time,out);
#500 $stop;

        end

        always

            begin

            #50 clk_tb=1?b1;

            #50 clk_tb=1?b0;

            end

endmodule


Related Solutions

Write a Verilog code to implement 16 bit LFSR
Write a Verilog code to implement 16 bit LFSR
I am trying to create an 8-bit random number generator in verilog code using a mux,...
I am trying to create an 8-bit random number generator in verilog code using a mux, a d flip flop and a LFSR not sure what I am doing wrong but need some help with getting it working properly any help would be greatly appreciated. here is what I have so far: module RNG #(parameter size=8)(output [7:0]SO,output [7:0] RN,input clk,rst,input[size-1:0]seed,input L);    wire [7:0] Sin=SO[7]^SO[5]^SO[4]^SO[3];    ffw F1 (SO,clk,rst,Sin);    MUX M1 (Sin,seed,{SO[size-2:0],next},L);    xor X1 (next,SO[6],SO[7]);    assign RN=next;...
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!
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!
Write the VERILOG code for an arithmetic/logic unit (ALU) with a test bench that does the...
Write the VERILOG code for an arithmetic/logic unit (ALU) with a test bench that does the following with 4 bit inputs , 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;...
Can anyone write a Verilog code and a test bench for a universal shift register with...
Can anyone write a Verilog code and a test bench for a universal shift register with 4 bits using D flip flop? Thanks
Implement 4-bit binary adder/subtractor using gate level. ( verilog code and test bench)
Implement 4-bit binary adder/subtractor using gate level. ( verilog code and test bench)
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