Line 26... |
Line 26... |
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 dpMuxInputs; --! Select inputs from dataPath(Memory,Imediate,RegisterFile,Alu)
|
muxSel : in dpMuxInputs; --! Select inputs from dataPath(Memory,Imediate,RegisterFile,Alu)
|
muxRegFile : in STD_LOGIC_VECTOR(1 downto 0); --! Select Alu InputA (Memory,Imediate,RegFileA)
|
muxRegFile : in dpMuxAluIn; --! 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 45... |
Line 45... |
signal inputImm : std_logic_vector(n downto 0) := (others => 'U'); --! Wire to connect Test signal to component
|
signal inputImm : std_logic_vector(n downto 0) := (others => 'U'); --! Wire to connect Test signal to component
|
signal clk : std_logic := '0'; --! Wire to connect Test signal to component
|
signal clk : std_logic := '0'; --! Wire to connect Test signal to component
|
signal outEn : typeEnDis := disable; --! Wire to connect Test signal to component
|
signal outEn : typeEnDis := disable; --! Wire to connect Test signal to component
|
signal aluOp : aluOps := alu_pass; --! Wire to connect Test signal to component
|
signal aluOp : aluOps := alu_pass; --! Wire to connect Test signal to component
|
signal muxSel : dpMuxInputs := fromMemory; --! Wire to connect Test signal to component
|
signal muxSel : dpMuxInputs := fromMemory; --! Wire to connect Test signal to component
|
signal muxRegFile : std_logic_vector(1 downto 0) := (others => 'U'); --! Wire to connect Test signal to component
|
signal muxRegFile : dpMuxAluIn := fromMemory; --! Wire to connect Test signal to component
|
signal regFileWriteAddr : generalRegisters := r0; --! Wire to connect Test signal to component
|
signal regFileWriteAddr : generalRegisters := r0; --! Wire to connect Test signal to component
|
signal regFileWriteEn : std_logic := '0'; --! Wire to connect Test signal to component
|
signal regFileWriteEn : std_logic := '0'; --! Wire to connect Test signal to component
|
signal regFileReadAddrA : generalRegisters := r0; --! Wire to connect Test signal to component
|
signal regFileReadAddrA : generalRegisters := r0; --! Wire to connect Test signal to component
|
signal regFileReadAddrB : generalRegisters := r0; --! Wire to connect Test signal to component
|
signal regFileReadAddrB : generalRegisters := r0; --! Wire to connect Test signal to component
|
signal regFileEnA : std_logic := '0'; --! Wire to connect Test signal to component
|
signal regFileEnA : std_logic := '0'; --! Wire to connect Test signal to component
|
Line 99... |
Line 99... |
REPORT "MOV r0,10" SEVERITY NOTE;
|
REPORT "MOV r0,10" SEVERITY NOTE;
|
inputImm <= conv_std_logic_vector(10, nBits);
|
inputImm <= conv_std_logic_vector(10, nBits);
|
regFileWriteAddr <= r0;
|
regFileWriteAddr <= r0;
|
aluOp <= alu_pass;
|
aluOp <= alu_pass;
|
muxSel <= fromImediate;
|
muxSel <= fromImediate;
|
muxRegFile <= muxRegPos(fromRegFileA);
|
muxRegFile <= fromRegFileA;
|
regFileWriteEn <= '1';
|
regFileWriteEn <= '1';
|
wait for CLK_period; -- Wait for clock cycle to latch some data to the register file
|
wait for CLK_period; -- Wait for clock cycle to latch some data to the register file
|
-- Read value in r0 to verify if is equal to 20
|
-- Read value in r0 to verify if is equal to 20
|
regFileWriteEn <= '0';
|
regFileWriteEn <= '0';
|
inputImm <= (others => 'U');
|
inputImm <= (others => 'U');
|
Line 123... |
Line 123... |
REPORT "MOV r1,20" SEVERITY NOTE;
|
REPORT "MOV r1,20" SEVERITY NOTE;
|
inputImm <= conv_std_logic_vector(20, nBits);
|
inputImm <= conv_std_logic_vector(20, nBits);
|
regFileWriteAddr <= r1;
|
regFileWriteAddr <= r1;
|
aluOp <= alu_pass;
|
aluOp <= alu_pass;
|
muxSel <= fromImediate;
|
muxSel <= fromImediate;
|
muxRegFile <= muxRegPos(fromRegFileA);
|
muxRegFile <= fromRegFileA;
|
regFileWriteEn <= '1';
|
regFileWriteEn <= '1';
|
wait for CLK_period; -- Wait for clock cycle to latch some data to the register file
|
wait for CLK_period; -- Wait for clock cycle to latch some data to the register file
|
-- Read value in r1 to verify if is equal to 20
|
-- Read value in r1 to verify if is equal to 20
|
regFileWriteEn <= '0';
|
regFileWriteEn <= '0';
|
inputImm <= (others => 'U');
|
inputImm <= (others => 'U');
|
Line 147... |
Line 147... |
REPORT "MOV r2,r1" SEVERITY NOTE;
|
REPORT "MOV r2,r1" SEVERITY NOTE;
|
regFileReadAddrB <= r1; -- Read data from r1
|
regFileReadAddrB <= r1; -- Read data from r1
|
regFileEnB <= '1';
|
regFileEnB <= '1';
|
regFileWriteAddr <= r2; -- Write data in r2
|
regFileWriteAddr <= r2; -- Write data in r2
|
muxSel <= fromRegFileB; -- Select the PortB output from regFile
|
muxSel <= fromRegFileB; -- Select the PortB output from regFile
|
muxRegFile <= muxRegPos(fromRegFileA);
|
muxRegFile <= fromRegFileA;
|
regFileWriteEn <= '1';
|
regFileWriteEn <= '1';
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
-- Read value in r2 to verify if is equal to r1(20)
|
-- Read value in r2 to verify if is equal to r1(20)
|
regFileWriteEn <= '0';
|
regFileWriteEn <= '0';
|
inputImm <= (others => 'U');
|
inputImm <= (others => 'U');
|
Line 174... |
Line 174... |
regFileReadAddrB <= r0; -- Read data from r0
|
regFileReadAddrB <= r0; -- Read data from r0
|
regFileEnB <= '1';
|
regFileEnB <= '1';
|
aluOp <= alu_sum;
|
aluOp <= alu_sum;
|
regFileWriteAddr <= r2; -- Write data in r2
|
regFileWriteAddr <= r2; -- Write data in r2
|
muxSel <= fromAlu; -- Select the Alu output
|
muxSel <= fromAlu; -- Select the Alu output
|
muxRegFile <= muxRegPos(fromRegFileA);
|
muxRegFile <= fromRegFileA;
|
regFileWriteEn <= '1';
|
regFileWriteEn <= '1';
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
-- Read value in r2 to verify if is equal to 30(10+20)
|
-- Read value in r2 to verify if is equal to 30(10+20)
|
regFileWriteEn <= '0';
|
regFileWriteEn <= '0';
|
inputImm <= (others => 'U');
|
inputImm <= (others => 'U');
|
Line 202... |
Line 202... |
regFileReadAddrB <= r0; -- Read data from r0
|
regFileReadAddrB <= r0; -- Read data from r0
|
regFileEnB <= '1';
|
regFileEnB <= '1';
|
aluOp <= alu_sum;
|
aluOp <= alu_sum;
|
regFileWriteAddr <= r3; -- Write data in r2
|
regFileWriteAddr <= r3; -- Write data in r2
|
muxSel <= fromAlu; -- Select the Alu output
|
muxSel <= fromAlu; -- Select the Alu output
|
muxRegFile <= muxRegPos(fromRegFileA);
|
muxRegFile <= fromRegFileA;
|
regFileWriteEn <= '1';
|
regFileWriteEn <= '1';
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
-- Read value in r2 to verify if is equal to 30(10+20)
|
-- Read value in r2 to verify if is equal to 30(10+20)
|
regFileWriteEn <= '0';
|
regFileWriteEn <= '0';
|
inputImm <= (others => 'U');
|
inputImm <= (others => 'U');
|
Line 226... |
Line 226... |
REPORT "ADD r3,2" SEVERITY NOTE;
|
REPORT "ADD r3,2" SEVERITY NOTE;
|
inputImm <= conv_std_logic_vector(2, nBits);
|
inputImm <= conv_std_logic_vector(2, nBits);
|
regFileReadAddrB <= r3; -- Read data from r2
|
regFileReadAddrB <= r3; -- Read data from r2
|
regFileEnB <= '1';
|
regFileEnB <= '1';
|
regFileWriteAddr <= r3;
|
regFileWriteAddr <= r3;
|
muxRegFile <= muxRegPos(fromImediate);
|
muxRegFile <= fromImediate;
|
aluOp <= alu_sum;
|
aluOp <= alu_sum;
|
muxSel <= fromAlu; -- Select the Alu output
|
muxSel <= fromAlu; -- Select the Alu output
|
regFileWriteEn <= '1';
|
regFileWriteEn <= '1';
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
wait for CLK_period; -- Wait for clock cycle to write into r2
|
-- Read value in r2 to verify if is equal to 42(40+2)
|
-- Read value in r2 to verify if is equal to 42(40+2)
|