-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/FaresAtef1/5-stage-pipeline…
- Loading branch information
Showing
4 changed files
with
257 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
LIBRARY ieee; | ||
USE ieee.std_logic_1164.ALL; | ||
ENTITY EXMEMRegister IS | ||
PORT ( | ||
Clk : IN STD_LOGIC; | ||
RST_Reg : IN STD_LOGIC; | ||
RTI : IN STD_LOGIC; | ||
Register_Write : IN STD_LOGIC; | ||
Mem_2PC : IN STD_LOGIC; | ||
Mem_2Reg : IN STD_LOGIC; | ||
Push : IN STD_LOGIC; | ||
Stack : IN STD_LOGIC; | ||
Push_INT_PC : IN STD_LOGIC; | ||
Call : IN STD_LOGIC; | ||
Mem_Write : IN STD_LOGIC; | ||
Mem_Read : IN STD_LOGIC; | ||
Branch : IN STD_LOGIC; | ||
Port_Write : IN STD_LOGIC; | ||
Port_Read : IN STD_LOGIC; | ||
RST : IN STD_LOGIC; | ||
INT : IN STD_LOGIC; | ||
Stack_Pointer : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
INC_PC : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
ALU_Result : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
Memory_Data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
Flags : IN STD_LOGIC_VECTOR(2 DOWNTO 0); | ||
Rdst, Rsrc1, Rsrc2 : IN STD_LOGIC_VECTOR(2 DOWNTO 0); | ||
Protect_State : IN STD_LOGIC; | ||
-- output ports | ||
RTI_Out : OUT STD_LOGIC; | ||
Register_Write_Out : OUT STD_LOGIC; | ||
Mem_2PC_Out : OUT STD_LOGIC; | ||
Mem_2Reg_Out : OUT STD_LOGIC; | ||
Push_Out : OUT STD_LOGIC; | ||
Stack_Out : OUT STD_LOGIC; | ||
Push_INT_PC_Out : OUT STD_LOGIC; | ||
Call_Out : OUT STD_LOGIC; | ||
Mem_Write_Out : OUT STD_LOGIC; | ||
Mem_Read_Out : OUT STD_LOGIC; | ||
Branch_Out : OUT STD_LOGIC; | ||
Port_Write_Out : OUT STD_LOGIC; | ||
Port_Read_Out : OUT STD_LOGIC; | ||
RST_Out : OUT STD_LOGIC; | ||
INT_Out : OUT STD_LOGIC; | ||
Stack_Pointer_Out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
INC_PC_Out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
ALU_Result_Out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
Memory_Data_Out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | ||
Flags_Out : OUT STD_LOGIC_VECTOR(2 DOWNTO 0); | ||
Rdst_Out, Rsrc1_Out, Rsrc2_Out : OUT STD_LOGIC_VECTOR(2 DOWNTO 0); | ||
Protect_State_Out : OUT STD_LOGIC | ||
); | ||
END ENTITY EXMEMRegister; | ||
|
||
ARCHITECTURE ArchEXMEMRegister OF EXMEMRegister IS | ||
BEGIN | ||
PROCESS (Clk, RST_Reg) | ||
BEGIN | ||
|
||
IF RST_Reg = '1' THEN | ||
RTI_Out <= '0'; | ||
Register_Write_Out <= '0'; | ||
Mem_2PC_Out <= '0'; | ||
Mem_2Reg_Out <= '0'; | ||
Push_Out <= '0'; | ||
Stack_Out <= '0'; | ||
Push_INT_PC_Out<='0'; | ||
Call_Out <= '0'; | ||
Mem_Write_Out <= '0'; | ||
Mem_Read_Out <= '0'; | ||
Branch_Out <= '0'; | ||
Port_Write_Out <= '0'; | ||
Port_Read_Out <= '0'; | ||
RST_Out <= '0'; | ||
INT_Out <= '0'; | ||
Stack_Pointer_Out<= (OTHERS=>'0'); | ||
INC_PC_Out <= (OTHERS => '0'); | ||
ALU_Result_Out <= (OTHERS=>'0'); | ||
Memory_Data_Out <= (OTHERS=>'0'); | ||
Flags_Out <= (OTHERS=>'0'); | ||
Rdst_Out <= (OTHERS => '0'); | ||
Rsrc1_Out <= (OTHERS => '0'); | ||
Rsrc2_Out <= (OTHERS => '0'); | ||
Protect_State_Out<='0'; | ||
ELSIF RISING_EDGE(Clk) THEN | ||
RTI_Out <= RTI; | ||
Register_Write_Out <= Register_Write; | ||
Mem_2PC_Out <= Mem_2PC; | ||
Mem_2Reg_Out <= Mem_2Reg; | ||
Push_Out <= Push; | ||
Stack_Out <= Stack; | ||
Push_INT_PC_Out<=Push_INT_PC; | ||
Call_Out <= Call; | ||
Mem_Write_Out <= Mem_Write; | ||
Mem_Read_Out <= Mem_Read; | ||
Branch_Out <= Branch; | ||
Port_Write_Out <= Port_Write; | ||
Port_Read_Out <= Port_Read; | ||
RST_Out <= RST; | ||
INT_Out <= INT; | ||
Stack_Pointer_Out<= Stack_Pointer; | ||
INC_PC_Out <= INC_PC; | ||
ALU_Result_Out <= ALU_Result; | ||
Memory_Data_Out <= Memory_Data; | ||
Flags_Out <= Flags; | ||
Rdst_Out <= Rdst; | ||
Rsrc1_Out <= Rsrc1; | ||
Rsrc2_Out <= Rsrc2; | ||
Protect_State_Out<=Protect_State; | ||
END IF; | ||
END PROCESS; | ||
|
||
END ArchEXMEMRegister; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
add wave -position insertpoint \ | ||
sim:/exmemregister/Clk \ | ||
sim:/exmemregister/RST_Reg \ | ||
sim:/exmemregister/RTI \ | ||
sim:/exmemregister/Register_Write \ | ||
sim:/exmemregister/Mem_2PC \ | ||
sim:/exmemregister/Mem_2Reg \ | ||
sim:/exmemregister/Push \ | ||
sim:/exmemregister/Stack \ | ||
sim:/exmemregister/Push_INT_PC \ | ||
sim:/exmemregister/Call \ | ||
sim:/exmemregister/Mem_Write \ | ||
sim:/exmemregister/Mem_Read \ | ||
sim:/exmemregister/Branch \ | ||
sim:/exmemregister/Port_Write \ | ||
sim:/exmemregister/Port_Read \ | ||
sim:/exmemregister/RST \ | ||
sim:/exmemregister/INT \ | ||
sim:/exmemregister/Stack_Pointer \ | ||
sim:/exmemregister/INC_PC \ | ||
sim:/exmemregister/ALU_Result \ | ||
sim:/exmemregister/Memory_Data \ | ||
sim:/exmemregister/Flags \ | ||
sim:/exmemregister/Rdst \ | ||
sim:/exmemregister/Rsrc1 \ | ||
sim:/exmemregister/Rsrc2 \ | ||
sim:/exmemregister/Protect_State \ | ||
sim:/exmemregister/RTI_Out \ | ||
sim:/exmemregister/Register_Write_Out \ | ||
sim:/exmemregister/Mem_2PC_Out \ | ||
sim:/exmemregister/Mem_2Reg_Out \ | ||
sim:/exmemregister/Push_Out \ | ||
sim:/exmemregister/Stack_Out \ | ||
sim:/exmemregister/Push_INT_PC_Out \ | ||
sim:/exmemregister/Call_Out \ | ||
sim:/exmemregister/Mem_Write_Out \ | ||
sim:/exmemregister/Mem_Read_Out \ | ||
sim:/exmemregister/Branch_Out \ | ||
sim:/exmemregister/Port_Write_Out \ | ||
sim:/exmemregister/Port_Read_Out \ | ||
sim:/exmemregister/RST_Out \ | ||
sim:/exmemregister/INT_Out \ | ||
sim:/exmemregister/Stack_Pointer_Out \ | ||
sim:/exmemregister/INC_PC_Out \ | ||
sim:/exmemregister/ALU_Result_Out \ | ||
sim:/exmemregister/Memory_Data_Out \ | ||
sim:/exmemregister/Flags_Out \ | ||
sim:/exmemregister/Rdst_Out \ | ||
sim:/exmemregister/Rsrc1_Out \ | ||
sim:/exmemregister/Rsrc2_Out \ | ||
sim:/exmemregister/Protect_State_Out | ||
force -freeze sim:/exmemregister/Clk 1 0, 0 {100 ps} -r 200 | ||
force -freeze sim:/exmemregister/RST_Reg 1 0 | ||
run | ||
force -freeze sim:/exmemregister/RST_Reg 0 0 | ||
force -freeze sim:/exmemregister/RTI 1 0 | ||
force -freeze sim:/exmemregister/Register_Write 1 0 | ||
force -freeze sim:/exmemregister/Mem_2PC 1 0 | ||
force -freeze sim:/exmemregister/Mem_2Reg 1 0 | ||
force -freeze sim:/exmemregister/Push 1 0 | ||
force -freeze sim:/exmemregister/Stack 1 0 | ||
force -freeze sim:/exmemregister/Push_INT_PC 1 0 | ||
force -freeze sim:/exmemregister/Call 1 0 | ||
force -freeze sim:/exmemregister/Mem_Write 1 0 | ||
force -freeze sim:/exmemregister/Mem_Read 1 0 | ||
force -freeze sim:/exmemregister/Branch 1 0 | ||
force -freeze sim:/exmemregister/Port_Write 1 0 | ||
force -freeze sim:/exmemregister/Port_Read 1 0 | ||
force -freeze sim:/exmemregister/RST 1 0 | ||
force -freeze sim:/exmemregister/INT 1 0 | ||
force -freeze sim:/exmemregister/Stack_Pointer 10#25 0 | ||
force -freeze sim:/exmemregister/INC_PC 10#35 0 | ||
force -freeze sim:/exmemregister/ALU_Result 10#45 0 | ||
force -freeze sim:/exmemregister/Memory_Data 10#55 0 | ||
force -freeze sim:/exmemregister/Flags 110 0 | ||
force -freeze sim:/exmemregister/Rdst 10#1 0 | ||
force -freeze sim:/exmemregister/Rsrc1 10#2 0 | ||
force -freeze sim:/exmemregister/Rsrc2 10#3 0 | ||
force -freeze sim:/exmemregister/Protect_State 1 0 | ||
run | ||
run | ||
run | ||
force -freeze sim:/exmemregister/Stack_Pointer 10#65 0 | ||
run | ||
run | ||
run |