Question

Write a Verilog model of a circuit whose 8-bit output is formed by shifting its 8-bit...

Write a Verilog model of a circuit whose 8-bit output is formed by shifting its 8-bit input one position to the right and filling the vacant positions with the bit that was in the MSN before the shift occurred (shift arithmetic right). Write a test bench and simulate the circuit. Please Implement the exercises and comments for each line Thank you.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

module mod(in,out);
input[7:0] in;
output reg [7:0] out;

always@(in)
begin
out[7]=in[7];
out[6]=in[7];
out[5]=in[6];
out[4]=in[5];
out[3]=in[4];
out[2]=in[3];
out[1]=in[2];
out[0]=in[1];
end
endmodule

module tb;
reg[7:0] rin;
wire[7:0] wout;

mod m1(rin,wout);

initial
begin
rin=8'b10101010;
#5 $display("%b",wout);
end
endmodule

Add a comment
Know the answer?
Add Answer to:
Write a Verilog model of a circuit whose 8-bit output is formed by shifting its 8-bit...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit thermomete...

    Use as few 3-input NOR gates as possible to design a bubble detector circuit for 8-bit thermometer code. An n-bit thermometer code represents an integer m, with m 1s followed by (n-m) 0s. 1-bit bubble is an error in coding when a solitary 0 (or 1) is found in between two 1s (or 0s). What is the size of your circuit in terms of the number of NOR gates used? Give a gate level schematic diagram for your circuit. Implement...

  • 1) Using Verilog behavioral modeling, describe an n-bit circuit that has four n-bit unsigned inpu...

    1) Using Verilog behavioral modeling, describe an n-bit circuit that has four n-bit unsigned inputs A B, C, and D, and two control inputs C1, and CO. The circuit produces an n+1-bit output Y according to the following table: (No delavs) 120 marks CI CO Function 1 Y MAX (A,B,C,D) , i.e. Y equals the maximum of the four inputs 0 | Y 〈 MIN (A,B,C,D), i.e. Y, equals the minimum of the four inputs 1 YAVERAGE (A,B.C,D), i.e. Y...

  • Write a behavioral Verilog module for a 4-bit Johnson counter that has 8 states. The counter load...

    Write a behavioral Verilog module for a 4-bit Johnson counter that has 8 states. The counter loads the "0000" state if reset is low. The counter should start and end with this state. Write a testbench to verify the correctness of the 4-bit Johnson counter. The testbenclh should have a clock with a period of 20ns and a reset signal. The testbench should store the 4-bit binary outputs of the counter in a file, which will be used to provide...

  • You will use Quartus II to build an 8 bit arithmetic logic unit that performs the...

    You will use Quartus II to build an 8 bit arithmetic logic unit that performs the following functions: Control Value Function                                000 Copy In1 to theResult unchanged 001 Copy In2 to theResult unchanged 010 Add In1 to In2 011 Subtract In2 from In1 100 And In1 and In2 101 Or In1 and In2 110 Shift left In1 by 1 bit 111 Shift right In1 by 1 bit You are allowed to use either gates/logic schematic, or else Verilog. We suggest...

  • i just want the code Write a module in Verilog HDL that describes a parallel load...

    i just want the code Write a module in Verilog HDL that describes a parallel load shift register. The following are the requirements for the shift register • The shift register shifts right by one position at a time The shift register size (in bits) is set by a parameter called WIDTH The shift register has a parallel data bus input for loading a value in parallel. The parallel bus is called datalp. The size of the dataly, bus uses...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT