Question

implement the following hardware synchronously in verilogسخت افزار ضرب Start Multiplier0 = 1 Multipiero = 0 1. Test Multipliero 1a. Add multiplicand to product and place the result i

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

the following is the design code

// Code your design here
module multiplier(clk,reset,A,B,product);
input clk,reset;
input [31:0] A,B;
output reg [63:0] product;
reg [31:0] multiplicand, multiplier;
integer count;
reg state;
always@(posedge reset)
begin
multiplicand=A;
multiplier=B;
count=0;
state=0;
product=0;
end
  
always@(posedge clk)
begin
if(state==0)
begin
if(count==32)
begin
state<=1;
end
else
begin
if(multiplier == 0)
begin
multiplicand<=multiplicand << 1;
multiplier<=multiplier>>1;
end
else
begin
product<=product+multiplicand;
multiplicand<=multiplicand << 1;
multiplier<=multiplier>>1;
end
count<=count+1;
end
end
else
product<=product;
end
endmodule

// Code your testbench here
// or browse Examples
module test();
reg clk,reset;
reg [31:0] A,B;
wire [63:0] product;
  
  
multiplier m1(clk,reset,A,B,product);
  
initial
begin
A=12;B=12;
clk=0;reset=0;
#2 reset=1;
#2 reset=0;
#200 $finish;
end
  
initial
forever
#2 clk=~clk;
  
initial
begin
$dumpfile("dump.vcd");
$dumpvars(2);
end
endmodule

Add a comment
Know the answer?
Add Answer to:
implement the following hardware synchronously in verilog سخت افزار ضرب Start Multiplier0 = 1 Multipiero =...
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
  • Multipliero = 1 Multipliero = 0 Multiplicand Shift Left 1. Test Multiplero 64 bits Multiplier Shift...

    Multipliero = 1 Multipliero = 0 Multiplicand Shift Left 1. Test Multiplero 64 bits Multiplier Shift Right la. Add multiplicand to product and place the result in Product register 64-bit ALU 32 bits Product Write 64 bits Control Test 2. Shift the Multiplicand register left I bit 3. Shift the Multiplier register right I bit 324 Repetition Yes Done b) [20 Points] In class we discussed the implementation of the multiplication of 32- binary numbers. The above figure shows the...

  • 6) For following multiplier circuit, calculate the process time if: Td (carry) 2ns, Td (sum) -2ns,...

    6) For following multiplier circuit, calculate the process time if: Td (carry) 2ns, Td (sum) -2ns, Td (gate) ns, Td (each shit operation) = 10ns, only input logic two gates are available. a. Ripple carry adder used in ALU Carry Look Ahead used in ALU Multiplicand 32 bits 32-bit ALU Shift right Write Control Product test 64 bits 6) For following multiplier circuit, calculate the process time if: Td (carry) 2ns, Td (sum) -2ns, Td (gate) ns, Td (each shit...

  • 4) This exercise will first present the modified algorithm for computing the product of two numbers...

    4) This exercise will first present the modified algorithm for computing the product of two numbers represented in twos complement with an illustrated example and then ask you to repeat for a different number pair The hardware and the flowchart for signed multiplication in twos complement representation of binary numbers will be slightly modified as follows. Use the version of the unsigned multiplication hardware which employs one double-sized register to hold the partial product and the multiplier a. When shifting...

  • Using java, I am trying to recreate an arithmetic logic unit which performs an integer multiplication....

    Using java, I am trying to recreate an arithmetic logic unit which performs an integer multiplication. I should able to get an output like this: 387637653 x 366499587 = 142069039730149311 But I am not sure because something is wrong apparently. The algorithm of the program goes like: Test multiplier0 If multiplier0 = 0 Shift the multiplicand register left 1 bit Shift the multiplier register right 1 bit If multiplier0 = 1 Add multiplicand to product and place the result in...

  • lis 2) ALU Design: Carry-Select Adder 31 Given: The following questions deal with two unsigned 6-bit...

    lis 2) ALU Design: Carry-Select Adder 31 Given: The following questions deal with two unsigned 6-bit numbers shown below in the hex format. A= 0x02 B=0x15 Suppose that the multiplier shown below is used to calculate the product of A (Multiplicand) and B (Multiplier) (Assume both values are unsigned). Consider using the "Add-and-Right-Shift Multiplier" design to compute A B. You may assume all registers are large enough to contain as many bits as are required. Sought: a) What are the...

  • 2. Serial shift registers Draw missing connections to implement various shift registers 1. Shift right: All...

    2. Serial shift registers Draw missing connections to implement various shift registers 1. Shift right: All bits of the register move right by one position, and a new bit value from a serial input is stored in the most significant bit (leftmost flip-flop below). Serial input -02 az 02 a Do ao Serial indino 2. Shift left: All bits of the register move left by one position, and a new bit value from a serial input is stored in the...

  • A shift operation is often used to implement either multiply-by-power-of-2 or divide-by power-of-...

    A shift operation is often used to implement either multiply-by-power-of-2 or divide-by power-of-2 operations. For example, 0010 x4 1000. This multiplication can be achieved by shifting 0010 by 2 bits to the left. Likewise, 10004 0010, which can be obtained by shifting 1000 to the right by 2 bits. As multipliers are more "expensive" in terms of area and power consumption, multiplication by shifting is preferred if applicable. Sometime, the multiplier does not have to be power-of-2. For example, 0010...

  • The Arithmetic Logic Unit The first topic for the project is to create an Arithmetic Logic...

    The Arithmetic Logic Unit The first topic for the project is to create an Arithmetic Logic Unit, using a structured approached with a Virtual Hardware Design Language such as Verilog. Mainly, the program is very close to a simulator for a programming calculator. An ALU typically has the following operations Math Functions: Add, Subtract, Multiply, Divide, Modulus Logic Functions: And, Or, XOR, Not, Nand, Nor, XNOR Error Modes: Divide by Zero, Overflow Support Functions: No Operation, Shift Left, Shift Right,...

  • Hey i have a project due, and for the life of me i cannot figure out...

    Hey i have a project due, and for the life of me i cannot figure out how to do this with the restrictions that are put in place, shiftwise operators such as << and >> <<<< >>>> cannot be used This is the question that follows: Shifter Implement a 32-bit shifter. Input: x (32 bits), c (5 bits), and op (2 bits). Output: y. This shifter should shift the input number x by c bits according to the shift operations...

  • Design and implement a 8 or 6 Port Dip Switch that control 4 LED Lights Components:...

    Design and implement a 8 or 6 Port Dip Switch that control 4 LED Lights Components: Dip Switch, LEDs, Resistors Description: Using a dipswitch create an application that uses bitwise operator to shift the bits to the left one bit at a time. Turning on one LED at a time that corresponds to the dipswitch position. After the bits are shifted 4 positions, start shifting the bits to the right turning the light on and off in the reverse order...

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