Question

Verilog HDL Design a logic module to multiply an 8-bit binary number A [0:7] by a...

Verilog HDL

Design a logic module to multiply an 8-bit binary number A [0:7] by a 4-bit binary

number N [0:3]. The multiply is started when M is asserted. The output F is asserted

when the multiply is completed and the product P [0: 15] is available. The outputs need to

remain valid until the next multiply command is given. Assume M is valid for several of

your clock cycles and then is de-asserted.

Implement the multiply using repeated addition of A to form partial products

Homework Answers

Answer #1

module multiplier (clk,A, N, M, F, P);

input clk;

input [0:7] A;

input [0:3] N;

input M;

output reg F;

output reg [0:15] P;

reg [0:3] Mplier;

reg [0:15] Product;

always @ (posedge M) begin

Mplier <= N;

Product = 16'b0000000000000000;

end

always @ (posedge clk) begin

if (M == 1) begin

if ( Mplier != 0) begin

Mplier = Mplier - 1;

Product = Product + A;

F = 0;

end

else begin

F = 1;

P = Product;

end

end

end

endmodule

Know the answer?
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
Similar Questions
VERILOG Design an Arithmetic Logic Unit (ALU) that can perform four-bit 1. Four-bit addition; 2. Four-bit...
VERILOG Design an Arithmetic Logic Unit (ALU) that can perform four-bit 1. Four-bit addition; 2. Four-bit subtraction; 3. Four-bit multiplication; 4. Four-bit comparator (that compares two binary numbers to check whether two numbers are equal, or one is less/greater than other). Write test benches and simulate each module/submodule. Hint: First make individual modules of the four-bit adder, four-bit subtractor, four-bit multiplier, four-bit comparator modules (make all these in same/one project) and then use a multiplexer to combine these modules to...
Design a module that can perform a binary-coded decimal (BCD) addition. You have two 4-bit BCD...
Design a module that can perform a binary-coded decimal (BCD) addition. You have two 4-bit BCD (decimal digits 0 to 9) inputs “a” and “b” and an 8-bit output “x” which represents a two digit BCD number. X [7:4] represents the upper BCD digits X [3:0] represents the lower BCD digits In the Verilog file, please code a BCD adder. It should follow the following format. module bcd_adder( a,b,x ); input wire [3:0] a; input wire [3:0] b; output reg...
Design a FSM for a Vending Machine In this task, you will design a FSM for...
Design a FSM for a Vending Machine In this task, you will design a FSM for a simple (albeit strange) vending machine of office supplies. The vending machine sells three possible items, each at a different cost: Item Cost Pencil 10 cents Eraser 20 cents Pen 30 cents The vending machines accepts nickels (worth 5 cents), dimes (worth 10 cents), and quarters (worth 25 cents). Physically, it is only possible to insert a single coin at a time. The vending...