Question: Need this unsigned 4 x 4 multiplier to do signed multiplication. module Multiplier ( input Clock, Reset, / / declare inputs input [ 3 :
Need this unsigned x multiplier to do signed multiplication.
module Multiplier
input Clock, Reset, declare inputs
input : Multiplicand,
input : Multiplier,
output : Product, declare outputs
output Halt;
reg : RegQ, RegM; Q and M registers
reg : RegA; A register
reg : Count; bit iteration counter
wire C Start, Add, Shift;
assign Product RegA:RegQ; product A:Q
bit counter for #iterations
always @posedge Clock
if Start Count b; clear in Start state
else if Shift Count Count ; increment in Shift state
assign C Count & Count; detect count
Multiplicand register load only
always @posedge Clock
if Start RegM Multiplicand; load in Start state
Multiplier register load shift
always @posedge Clock
if Start RegQ Multiplier; load in Start state
else if Shift RegQ RegARegQ:; shift in Shift state
Accumulator register clear load, shift
always @posedge Clock
if Start RegA b; clear in Start state
else if Add RegA RegA RegM; load in Add state
else if Shift RegA RegA ; shift in Shift state
Instantiate controller module
MultControl Ctrl Clock Reset, RegQ C Start, Add, Shift, Halt;
endmodule
module MultControl
input Clock, Reset, Q Cdeclare inputs
output Start, Add, Shift, Halt; declare outputs
reg : state; five states one hot one flipflop per state
onehot state assignments for five states
parameter StartSb TestSb AddSb ShiftSb HaltSb;
reg : Counter; bit counter for # of algorithm iterations
State transitions on positive edge of Clock or Resets
always @posedge Clock, posedge Reset
if Reset state StartS; enter StartS state on Reset
else change state on Clock
case state
StartS: state TestS; StartS to TestS
TestS: if Q state AddS; TestS to AddS if Q
else state ShiftS; TestS to ShiftS if Q
AddS: state ShiftS; AddS to ShiftS
ShiftS: if C state HaltS; ShiftS to HaltS if C
else state TestS; ShiftS to TestS if C
HaltS: state HaltS; stay in HaltS
endcase
Moore model activate one output per state
assign Start state; Start in state StartS, else
assign Add state; Add in state AddS, else
assign Shift state; Shift in state ShiftS, else
assign Halt state; Halt in state HaltS, else
endmodule
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
