Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone fix my code? I have pasted my code along with the original directions. Please paste the entire finished code when done. Thank you!
Can someone fix my code? I have pasted my code along with the original directions. Please paste the entire finished code when done. Thank you! VHDL
library IEEE;
use IEEE.STDLOGICALL;
entity signedmultiplier is
Port
clk : in stdlogic; Clock signal
rst : in stdlogic; Reset signal
ain : in stdlogicvector downto ; Input A bit signed
bin : in stdlogicvector downto ; Input B bit signed
resultout : out stdlogicvector downto Output result bit signed
;
end signedmultiplier;
architecture Behavioral of signedmultiplier is
signal areg, breg : stdlogicvector downto ;
signal accumulator : stdlogicvector downto :others ;
component multiplierunit is
Port
a : in stdlogicvector downto ;
b : in stdlogicvector downto ;
product : out stdlogicvector downto
;
end component;
component accumulatorunit is
Port
clk : in stdlogic;
rst : in stdlogic;
datain : in stdlogicvector downto ;
accumulatorout : out stdlogicvector downto
;
end component;
begin
Register A and Register B
processclk rst
begin
if rst then
areg others ;
breg others ;
elsif risingedgeclk then
areg ain;
breg bin;
end if;
end process;
Multiplier Unit
multiplierinst : multiplierunit port mapareg, breg, accumulator downto ;
Accumulator Unit
accumulatorinst : accumulatorunit port mapclk rst accumulator, resultout;
end Behavioral;
library IEEE;
use IEEE.STDLOGICALL;
entity multipliercontroller is
Port
clk : in stdlogic; Clock signal
rst : in stdlogic; Reset signal
start : in stdlogic; Start signal to initiate multiplication
done : out stdlogic Done signal indicating multiplication is complete
;
end multipliercontroller;
architecture Behavioral of multipliercontroller is
type statetype is IDLE LOADINPUTS, MULTIPLY, ACCUMULATE;
signal currentstate, nextstate : statetype : IDLE;
signal startflag, doneflag : stdlogic :;
begin
processclk rst
begin
if rst then
currentstate IDLE;
startflag ;
doneflag ;
elsif risingedgeclk then
currentstate nextstate;
startflag start;
doneflag ;
end if;
end process;
processcurrentstate, startflag
begin
case currentstate is
when IDLE
if startflag then
nextstate LOADINPUTS;
else
nextstate IDLE;
end if;
when LOADINPUTS
Code to load inputs into registers
nextstate MULTIPLY;
when MULTIPLY
Code to trigger multiplication
nextstate ACCUMULATE;
when ACCUMULATE
Code to accumulate results
nextstate IDLE;
doneflag ;
when others
nextstate IDLE;
end case;
end process;
done doneflag;
end Behavioral;
library IEEE;
use IEEE.STDLOGICALL;
entity multipliertop is
Port
clk : in stdlogic; Clock signal
rst : in stdlogic; Reset signal
start : in stdlogic; Start signal for multiplication
ain : in stdlogicvector downto ; Input A bit signed
bin : in stdlogicvector downto ; Input B bit signed
resultout : out stdlogicvector downto Output result bit signed
;
end multipliertop;
architecture Behavioral of multipliertop is
signal doneflag : stdlogic;
component signedmultiplier is
Port
clk : in stdlogic;
rst : in stdlogic;
ain : in stdlogicvector downto ;
bin : in stdlogicvector downto ;
resultout : out stdlogicvector downto
;
end component;
component multipliercontroller is
Port
clk : in stdlogic;
rst : in stdlogic;
start : in stdlogic;
done : out stdlogic
;
end component;
begin
multiplierinst : signedmultiplier port mapclk rst ain bin resultout;
controllerinst : multipliercontroller port mapclk rst start, doneflag;
end Behavioral;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started