Line 22... |
Line 22... |
clk : in STD_LOGIC; --! Main system clock
|
clk : in STD_LOGIC; --! Main system clock
|
FlagsDp : in STD_LOGIC_VECTOR (2 downto 0); --! Flags comming from the Datapath
|
FlagsDp : in STD_LOGIC_VECTOR (2 downto 0); --! Flags comming from the Datapath
|
DataDp : in STD_LOGIC_VECTOR (n downto 0); --! Data comming from the Datapath
|
DataDp : in STD_LOGIC_VECTOR (n downto 0); --! Data comming from the Datapath
|
outEnDp : out typeEnDis; --! Enable/Disable datapath output
|
outEnDp : out typeEnDis; --! Enable/Disable datapath output
|
MuxDp : out dpMuxInputs; --! Select on datapath data from (Memory, Imediate, RegFileA, RegFileB, AluOut)
|
MuxDp : out dpMuxInputs; --! Select on datapath data from (Memory, Imediate, RegFileA, RegFileB, AluOut)
|
MuxRegDp : out STD_LOGIC_VECTOR(1 downto 0); --! Select Alu InputA (Memory,Imediate,RegFileA)
|
MuxRegDp : out dpMuxAluIn; --! Select Alu InputA (Memory,Imediate,RegFileA)
|
ImmDp : out STD_LOGIC_VECTOR (n downto 0); --! Imediate value passed to the Datapath
|
ImmDp : out STD_LOGIC_VECTOR (n downto 0); --! Imediate value passed to the Datapath
|
DpAluOp : out aluOps; --! Alu operations
|
DpAluOp : out aluOps; --! Alu operations
|
DpRegFileWriteAddr : out generalRegisters; --! General register address to write
|
DpRegFileWriteAddr : out generalRegisters; --! General register address to write
|
DpRegFileWriteEn : out STD_LOGIC; --! Enable register write
|
DpRegFileWriteEn : out STD_LOGIC; --! Enable register write
|
DpRegFileReadAddrA : out generalRegisters; --! General register address to read
|
DpRegFileReadAddrA : out generalRegisters; --! General register address to read
|
Line 236... |
Line 236... |
nextExState <= readRegisterB;
|
nextExState <= readRegisterB;
|
|
|
-- ADD r2,r0 (See the testDatapath to see how to drive the datapath for this function)
|
-- ADD r2,r0 (See the testDatapath to see how to drive the datapath for this function)
|
when add_reg | sub_reg | and_reg | or_reg | xor_reg =>
|
when add_reg | sub_reg | and_reg | or_reg | xor_reg =>
|
MuxDp <= fromAlu;
|
MuxDp <= fromAlu;
|
MuxRegDp <= muxRegPos(fromRegFileA);
|
MuxRegDp <= fromRegFileA;
|
DpRegFileReadAddrA <= Num2reg(conv_integer(UNSIGNED(operand_reg1))); -- Read first operand
|
DpRegFileReadAddrA <= Num2reg(conv_integer(UNSIGNED(operand_reg1))); -- Read first operand
|
DpRegFileReadAddrB <= Num2reg(conv_integer(UNSIGNED(operand_reg2))); -- Read second operand
|
DpRegFileReadAddrB <= Num2reg(conv_integer(UNSIGNED(operand_reg2))); -- Read second operand
|
DpRegFileReadEnA <= '1';
|
DpRegFileReadEnA <= '1';
|
DpRegFileReadEnB <= '1';
|
DpRegFileReadEnB <= '1';
|
DpRegFileWriteAddr <= Num2reg(conv_integer(UNSIGNED(operand_reg1))); -- Point to write in first operand (pointing to register)
|
DpRegFileWriteAddr <= Num2reg(conv_integer(UNSIGNED(operand_reg1))); -- Point to write in first operand (pointing to register)
|
Line 255... |
Line 255... |
nextExState <= writeRegister;
|
nextExState <= writeRegister;
|
|
|
-- ADD r3,2 (r2 <= r2+2) (See the testDatapath to see how to drive the datapath for this function)
|
-- ADD r3,2 (r2 <= r2+2) (See the testDatapath to see how to drive the datapath for this function)
|
when add_val | sub_val | and_val | or_val | xor_val =>
|
when add_val | sub_val | and_val | or_val | xor_val =>
|
MuxDp <= fromAlu;
|
MuxDp <= fromAlu;
|
MuxRegDp <= muxRegPos(fromImediate);
|
MuxRegDp <= fromImediate;
|
DpRegFileWriteAddr <= Num2reg(conv_integer(UNSIGNED(operand_reg1)));
|
DpRegFileWriteAddr <= Num2reg(conv_integer(UNSIGNED(operand_reg1)));
|
DpRegFileReadAddrB <= Num2reg(conv_integer(UNSIGNED(operand_reg1))); -- Read first operand
|
DpRegFileReadAddrB <= Num2reg(conv_integer(UNSIGNED(operand_reg1))); -- Read first operand
|
DpRegFileReadEnB <= '1';
|
DpRegFileReadEnB <= '1';
|
ImmDp <= "0000000000" & operand_imm; -- & is used to concatenate signals
|
ImmDp <= "0000000000" & operand_imm; -- & is used to concatenate signals
|
DpAluOp <= opcode2AluOp(opcodeIR); -- Select the alu operation from the operand
|
DpAluOp <= opcode2AluOp(opcodeIR); -- Select the alu operation from the operand
|