Skip to content

Commit c0a6c77

Browse files
committed
correction(jugad) in lw,adz and ndz dependency
1 parent 2c286e1 commit c0a6c77

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

Project_2_RISC_Pipelined/IF_stage.vhd

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ entity memory_instruction is
99
end entity;
1010
architecture mem of memory_instruction is
1111
type RAM_array is array (0 to 2**16-1) of std_logic_vector (15 downto 0);
12-
signal RAM : RAM_array:= (X"3201",X"8205",X"0000",X"0000",X"3401",X"3601",X"3801",others=>X"0000");
12+
signal RAM : RAM_array:= (X"3201",X"35ff",X"420f",X"2299",X"3801",X"3a01",others=>X"0000");
1313
begin
1414
data_out <= RAM(to_integer(unsigned(address)));
1515
end architecture mem;
@@ -138,7 +138,7 @@ d: IF_interface_reg port map(
138138
ip(16 downto 1)=>mem_instr_out,
139139
ip(0)=>validate_control,
140140
op=>IF_reg_op);
141-
process(PC_control,ALU1_out,memd_out,alu2_out,alu3_out,RF_d2,memid_08)
141+
process(PC_control,ALU1_out,memd_out,alu2_out,alu3_out,RF_d2,memid_08,alu3_ex)
142142
begin
143143
if (PC_control = "000") then
144144
PC_in<=ALU1_out;

Project_2_RISC_Pipelined/Mem_stage.vhd

+16-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,21 @@ dummy_mem_write<=(EX_reg_op(60) and not(EX_reg_op(0)));
9595

9696
a: memory_data port map(clk=>clock,mem_write=>dummy_mem_write,address=>mem_muxaddr_op,data_in=>mem_mux_datain_op,data_out=>mem_data_out_sig);
9797

98-
b:mem_interface_reg port map(EN=>'1',CLK=>clock,reset=>reset,ip(76 downto 61)=>EX_reg_op(93 downto 78),ip(60 downto 45)=>EX_reg_op(77 downto 62),ip(44 downto 29)=>mem_data_out_sig,ip(28 downto 13)=>EX_reg_op(53 downto 38),ip(5 downto 3)=>EX_reg_op(5 downto 3),ip(2)=>EX_reg_op(2),ip(1)=>memd_muxz_output,ip(0)=>nullify_control_mem,ip(12)=>EX_reg_op(61),ip(11 downto 6)=>EX_reg_op(59 downto 54),op=>Mem_reg_op);
98+
b:mem_interface_reg port map(
99+
EN=>'1',
100+
CLK=>clock,
101+
reset=>reset,
102+
ip(76 downto 61)=>EX_reg_op(93 downto 78),
103+
ip(60 downto 45)=>EX_reg_op(77 downto 62),
104+
ip(44 downto 29)=>mem_data_out_sig,
105+
ip(28 downto 13)=>EX_reg_op(53 downto 38),
106+
ip(5 downto 3)=>EX_reg_op(5 downto 3),
107+
ip(2)=>EX_reg_op(2),
108+
ip(1)=>memd_muxz_output,
109+
ip(0)=>nullify_control_mem,
110+
ip(12)=>EX_reg_op(61),
111+
ip(11 downto 6)=>EX_reg_op(59 downto 54),
112+
op=>Mem_reg_op);
99113

100114
memd_out<= mem_data_out_sig;
101115
load_flag_z<=memd_z_flag;
@@ -113,7 +127,7 @@ process(EX_reg_op,memd_z_flag)
113127
begin
114128
if((EX_reg_op(93 downto 90)="0100") and (EX_reg_op(0)='0')) then
115129
memd_muxz_output<=memd_z_flag;
116-
else
130+
else
117131
memd_muxz_output<=EX_reg_op(1);
118132
end if;
119133
end process;

Project_2_RISC_Pipelined/write_control.vhd

+6-7
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ begin
1919
authentic_c_op<=authentic_c;
2020
authentic_z_op<=authentic_z;
2121
-----------------------------------
22-
process(flag_z_ex,flag_z_mem,opcode_mem,opcode_EX,flagz_enable_ex,flagz_enable_mem,user_flagz)
22+
process(flag_z_ex,flag_z_mem,opcode_mem,opcode_EX,flagz_enable_ex,flagz_enable_mem,user_flagz,load_flag_z)
2323
begin
2424
if(flagz_enable_ex = '0') then
2525
if (flagz_enable_mem = '0') then
2626
authentic_z<=user_flagz;
2727
else
2828
authentic_z<=flag_z_mem;
2929
end if;
30-
else
31-
authentic_z<=flag_z_ex;
30+
else
31+
authentic_z<=flag_z_ex;
3232
end if;
3333
end process;
3434

@@ -47,7 +47,9 @@ end process;
4747

4848
process(authentic_c,authentic_z,opcode_EX,opcode_OR,load_flag_z,nullify_ex,rf_write_or,flagc_write_or,flagz_write_or)
4949
begin
50-
if((((opcode_OR = "000001") or (opcode_OR = "001001")) and (authentic_z = '0')) or (((opcode_OR = "000010") or (opcode_OR = "001010")) and (authentic_c = '0')) or ((opcode_EX(5 downto 2) = "0100") and ((opcode_OR = "000001") or (opcode_OR = "001001")) and (load_flag_z = '0') and (nullify_ex = '0'))) then
50+
if((((opcode_OR = "000001") or (opcode_OR = "001001")) and (authentic_z = '0') and not (opcode_EX(5 downto 2) = "0100"))
51+
or (((opcode_OR = "000010") or (opcode_OR = "001010")) and (authentic_c = '0'))
52+
or ((opcode_EX(5 downto 2) = "0100") and ((opcode_OR = "000001") or (opcode_OR = "001001")) and (load_flag_z = '0') and (nullify_ex = '0'))) then
5153
RF_write_out<='0';
5254
flagc_write_out<='0';
5355
flagz_write_out<='0';
@@ -58,6 +60,3 @@ begin
5860
end if;
5961
end process;
6062
end Behave;
61-
62-
63-

0 commit comments

Comments
 (0)