Line 21... |
Line 21... |
inputImm : in STD_LOGIC_VECTOR (n downto 0); --! Input of Datapath from imediate value (instructions...)
|
inputImm : in STD_LOGIC_VECTOR (n downto 0); --! Input of Datapath from imediate value (instructions...)
|
clk : in STD_LOGIC; --! Clock signal
|
clk : in STD_LOGIC; --! Clock signal
|
outEn : in typeEnDis; --! Enable/Disable datapath output
|
outEn : in typeEnDis; --! Enable/Disable datapath output
|
aluOp : in aluOps; --! Alu operations
|
aluOp : in aluOps; --! Alu operations
|
muxSel : in STD_LOGIC_VECTOR (2 downto 0); --! Select inputs from dataPath(Memory,Imediate,RegisterFile,Alu)
|
muxSel : in STD_LOGIC_VECTOR (2 downto 0); --! Select inputs from dataPath(Memory,Imediate,RegisterFile,Alu)
|
|
muxRegFile : in STD_LOGIC_VECTOR(1 downto 0); --! Select Alu InputA (Memory,Imediate,RegFileA)
|
regFileWriteAddr : in generalRegisters; --! General register write address
|
regFileWriteAddr : in generalRegisters; --! General register write address
|
regFileWriteEn : in STD_LOGIC; --! RegisterFile write enable signal
|
regFileWriteEn : in STD_LOGIC; --! RegisterFile write enable signal
|
regFileReadAddrA : in generalRegisters; --! General register read address (PortA)
|
regFileReadAddrA : in generalRegisters; --! General register read address (PortA)
|
regFileReadAddrB : in generalRegisters; --! General register read address (PortB)
|
regFileReadAddrB : in generalRegisters; --! General register read address (PortB)
|
regFileEnA : in STD_LOGIC; --! Enable RegisterFile PortA
|
regFileEnA : in STD_LOGIC; --! Enable RegisterFile PortA
|
Line 47... |
Line 48... |
E : in STD_LOGIC_VECTOR (n downto 0); --! Fifth Input
|
E : in STD_LOGIC_VECTOR (n downto 0); --! Fifth Input
|
sel : in STD_LOGIC_VECTOR (2 downto 0); --! Select inputs (1, 2, 3, 4, 5)
|
sel : in STD_LOGIC_VECTOR (2 downto 0); --! Select inputs (1, 2, 3, 4, 5)
|
S : out STD_LOGIC_VECTOR (n downto 0)); --! Mux Output
|
S : out STD_LOGIC_VECTOR (n downto 0)); --! Mux Output
|
END COMPONENT;
|
END COMPONENT;
|
|
|
|
--! Component declaration to instantiate the Multiplexer3_1 circuit
|
|
COMPONENT Multiplexer3_1 is
|
|
generic (n : integer := nBits - 1); --! Generic value (Used to easily change the size of the Alu on the package)
|
|
Port ( A : in STD_LOGIC_VECTOR (n downto 0); --! First Input
|
|
B : in STD_LOGIC_VECTOR (n downto 0); --! Second Input
|
|
C : in STD_LOGIC_VECTOR (n downto 0); --! Third Input
|
|
sel : in STD_LOGIC_VECTOR(1 downto 0); --! Select inputs (1, 2, 3)
|
|
S : out STD_LOGIC_VECTOR (n downto 0)); --! Mux Output
|
|
end COMPONENT;
|
|
|
--! Component declaration to instantiate the Alu circuit
|
--! Component declaration to instantiate the Alu circuit
|
COMPONENT Alu
|
COMPONENT Alu
|
generic (n : integer := nBits - 1); --! Generic value (Used to easily change the size of the Alu on the package)
|
generic (n : integer := nBits - 1); --! Generic value (Used to easily change the size of the Alu on the package)
|
Port ( A : in STD_LOGIC_VECTOR (n downto 0); --! Alu Operand 1
|
Port ( A : in STD_LOGIC_VECTOR (n downto 0); --! Alu Operand 1
|
B : in STD_LOGIC_VECTOR (n downto 0); --! Alu Operand 2
|
B : in STD_LOGIC_VECTOR (n downto 0); --! Alu Operand 2
|
Line 85... |
Line 96... |
-- Signals that will connect the various components from the DataPath
|
-- Signals that will connect the various components from the DataPath
|
signal regFilePortA : STD_LOGIC_VECTOR (n downto 0);
|
signal regFilePortA : STD_LOGIC_VECTOR (n downto 0);
|
signal regFilePortB : STD_LOGIC_VECTOR (n downto 0);
|
signal regFilePortB : STD_LOGIC_VECTOR (n downto 0);
|
signal aluOut : STD_LOGIC_VECTOR (n downto 0);
|
signal aluOut : STD_LOGIC_VECTOR (n downto 0);
|
signal muxOut : STD_LOGIC_VECTOR (n downto 0);
|
signal muxOut : STD_LOGIC_VECTOR (n downto 0);
|
|
signal muxOutReg : STD_LOGIC_VECTOR (n downto 0);
|
begin
|
begin
|
--! Instantiate Multiplexer
|
--! Instantiate Multiplexer 5:1
|
uMux: Multiplexer4_1 PORT MAP (
|
uMux: Multiplexer4_1 PORT MAP (
|
A => inputMm,
|
A => inputMm,
|
B => inputImm,
|
B => inputImm,
|
C => regFilePortA,
|
C => regFilePortA,
|
D => regFilePortB,
|
D => regFilePortB,
|
E => aluOut,
|
E => aluOut,
|
sel => muxSel,
|
sel => muxSel,
|
S => muxOut
|
S => muxOut
|
);
|
);
|
|
|
|
--! Instantiate Multiplexer 5:1
|
|
uMux2: Multiplexer3_1 PORT MAP (
|
|
A => inputMm,
|
|
B => inputImm,
|
|
C => regFilePortA,
|
|
sel => muxRegFile,
|
|
S => muxOutReg
|
|
);
|
|
|
--! Instantiate the Unit Under Test (Alu) (Doxygen bug if it's not commented!)
|
--! Instantiate the Unit Under Test (Alu) (Doxygen bug if it's not commented!)
|
uAlu: Alu PORT MAP (
|
uAlu: Alu PORT MAP (
|
A => regFilePortA,
|
A => muxOutReg,
|
B => regFilePortB,
|
B => regFilePortB,
|
S => aluOut,
|
S => aluOut,
|
sel => aluOp
|
sel => aluOp
|
);
|
);
|
|
|