Question

In: Electrical Engineering

Write RTL code to design a sequence generator which will generate the sequence : 0,0,1,0,1,1 and...

Write RTL code to design a sequence generator which will generate the sequence : 0,0,1,0,1,1 and repeat . 

(FSM shouldn't be used in RTL) 

Solutions

Expert Solution

module program1 (
input      CLK, RST,
output reg SIG
);

reg [2:0] counter;

// MOD 6 counter geneartion
always @ (posedge CLK)
begin
    if (RST)
       counter <= 3'b0;
    else
       if (counter == 3'd5)
          counter <= 3'd0;
       else
          counter <= counter + 1'b1;
end

// Output generation
always @ (*)
begin
    case(counter)
      3'b000 : SIG = 1'b0;
      3'b001 : SIG = 1'b0;
      3'b010 : SIG = 1'b1;
      3'b011 : SIG = 1'b0;
      3'b100 : SIG = 1'b1;
      3'b101 : SIG = 1'b1;
   endcase
end

endmodule

// Test bench file
module testbench();
reg        CLK, RST;
wire       SIG;

// DUT instantiation
program1 DUT1 (.CLK(CLK), .RST(RST), .SIG(SIG));

// Clock generation
always
   #5 CLK = !CLK;

// Stimulus generation
initial
begin
    CLK = 1'b1;
    RST = 1'b1;
    repeat(2)
      @(negedge CLK);
    RST = 1'b0;
   repeat(15)
      @(negedge CLK);
   $finish;
end

initial begin // dump creation for waveform
$dumpfile("dump.vcd");
$dumpvars;
end

endmodule


Related Solutions

(Write/Design) both the RTL and Testbench using the Verilog HDL language of the five input majority...
(Write/Design) both the RTL and Testbench using the Verilog HDL language of the five input majority using the structure modeling approach. NOTE: Design means RTL code and Testbench covering all possible corner cases
Write a program which accepts a sequence of comma-separated numbers from console and generate a list...
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34, 67, 55, 33, 12, 98. Then, the output should be: ['34', '67', '55', '33', '12', '98'] and ('34',67', '55', '33', '12', '98').
Write a program which accepts a sequence of comma-separated numbers from console and generate a list...
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34, 67, 55, 33, 12, 98. Then, the output should be: ['34', '67', '55', '33', '12', '98'] and ('34',67', '55', '33', '12', '98'). Input can be comma separated in one line.
Using MARIE RTL, write RTL commands for CALL X and RET Instructions, assume there is an...
Using MARIE RTL, write RTL commands for CALL X and RET Instructions, assume there is an additional register called SP (Stack Pointer)
Generate a transmitted dada sequence for “101010” using Hamming code? If an error occurs in the...
Generate a transmitted dada sequence for “101010” using Hamming code? If an error occurs in the third bit, the received data is 101011”, how would Hamming technique fix it?
Write a verilog code for 8-bit signed multiplication using Booth algorithm and represent the RTL view...
Write a verilog code for 8-bit signed multiplication using Booth algorithm and represent the RTL view for code
Write the R code to generate five independent uniform random numbers and use that to generate...
Write the R code to generate five independent uniform random numbers and use that to generate 5 independent Bernoulli random variables with probability of success p = 0.4. please use RStudio. please do not use lab nor rbern for calculations.
Write a python code to Design and implement a function with no input parameter which reads...
Write a python code to Design and implement a function with no input parameter which reads a number from input (like 123). Only non-decimal numbers are valid (floating points are not valid). The number entered by the user should not be divisible by 10 and if the user enters a number that is divisible by 10 (like 560), it is considered invalid and the application should keep asking until the user enters a valid input. Once the user enters a...
2. Show the trace of the RTL code for Booth's algorithm for X = 0111 and...
2. Show the trace of the RTL code for Booth's algorithm for X = 0111 and Y = 1011.
I just wrote Python code to solve this problem: Write a generator that will return a...
I just wrote Python code to solve this problem: Write a generator that will return a sequence of month names. Thus gen = next_month('October') creates a generator that generates the strings 'November', 'December', 'January' and so on. If the caller supplies an illegal month name, your function should raise a ValueError exception with text explaining the problem. Here is my code: month_names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] def next_month(name: str) -> str:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT