Line 30... |
Line 30... |
signal data_in_s, pc, pc_last, pc_plus4, pc_next, result, branch, jump, ext32, ext32b, ext32h, alu_src: std_logic_vector(31 downto 0);
|
signal data_in_s, pc, pc_last, pc_plus4, pc_next, result, branch, jump, ext32, ext32b, ext32h, alu_src: std_logic_vector(31 downto 0);
|
signal opcode, funct: std_logic_vector(5 downto 0);
|
signal opcode, funct: std_logic_vector(5 downto 0);
|
signal read_reg1, read_reg2, write_reg, rs, rt, rd, target: std_logic_vector(4 downto 0);
|
signal read_reg1, read_reg2, write_reg, rs, rt, rd, target: std_logic_vector(4 downto 0);
|
signal write_data, read_data1, read_data2: std_logic_vector(31 downto 0);
|
signal write_data, read_data1, read_data2: std_logic_vector(31 downto 0);
|
signal imm: std_logic_vector(15 downto 0);
|
signal imm: std_logic_vector(15 downto 0);
|
signal wreg, zero, less_than, br_link_ctl, branch_taken, branch_taken_dly, jump_taken, jump_taken_dly, stall_reg: std_logic;
|
signal wreg, zero, less_than, br_link_ctl, branch_taken, jump_taken, stall_reg: std_logic;
|
signal irq_ack_s, irq_ack_s_dly, bds: std_logic;
|
signal irq_ack_s, irq_ack_s_dly, bds: std_logic;
|
|
|
-- control signals
|
-- control signals
|
signal reg_dst_ctl, reg_write_ctl, alu_src_ctl, reg_to_mem_ctl, mem_to_reg_ctl, mem_to_reg_ctl_dly, signed_imm_ctl, signed_rd_ctl, shift_ctl: std_logic;
|
signal reg_dst_ctl, reg_write_ctl, alu_src_ctl, reg_to_mem_ctl, mem_to_reg_ctl, mem_to_reg_ctl_dly, signed_imm_ctl, signed_rd_ctl, shift_ctl: std_logic;
|
signal jump_ctl, mem_read_ctl, mem_write_ctl: std_logic_vector(1 downto 0);
|
signal jump_ctl, mem_read_ctl, mem_write_ctl: std_logic_vector(1 downto 0);
|
Line 65... |
Line 65... |
if stall = '0' then
|
if stall = '0' then
|
if busy = '0' then
|
if busy = '0' then
|
pc <= pc_next;
|
pc <= pc_next;
|
pc_last <= pc;
|
pc_last <= pc;
|
else
|
else
|
if (reg_to_mem_ctl_r = '1' or mem_to_reg_ctl_r = '1') and branch_taken_dly = '0' and jump_taken_dly = '0' then
|
if (reg_to_mem_ctl_r = '1' or mem_to_reg_ctl_r = '1') and bds = '0' then
|
pc <= pc_last;
|
pc <= pc_last;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
Line 92... |
Line 92... |
process(clock, reset, irq, irq_ack_s, mem_to_reg_ctl_r, busy, stall)
|
process(clock, reset, irq, irq_ack_s, mem_to_reg_ctl_r, busy, stall)
|
begin
|
begin
|
if reset = '1' then
|
if reset = '1' then
|
irq_ack_s_dly <= '0';
|
irq_ack_s_dly <= '0';
|
bds <= '0';
|
bds <= '0';
|
branch_taken_dly <= '0';
|
|
jump_taken_dly <= '0';
|
|
mem_to_reg_ctl_dly <= '0';
|
mem_to_reg_ctl_dly <= '0';
|
stall_reg <= '0';
|
stall_reg <= '0';
|
elsif clock'event and clock = '1' then
|
elsif clock'event and clock = '1' then
|
stall_reg <= stall;
|
stall_reg <= stall;
|
if stall = '0' then
|
if stall = '0' then
|
Line 107... |
Line 105... |
if branch_taken = '1' or jump_taken = '1' then
|
if branch_taken = '1' or jump_taken = '1' then
|
bds <= '1';
|
bds <= '1';
|
else
|
else
|
bds <= '0';
|
bds <= '0';
|
end if;
|
end if;
|
branch_taken_dly <= branch_taken;
|
|
jump_taken_dly <= jump_taken;
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
Line 192... |
Line 188... |
mem_read_ctl_r <= "00";
|
mem_read_ctl_r <= "00";
|
signed_rd_ctl_r <= '0';
|
signed_rd_ctl_r <= '0';
|
shift_ctl_r <= '0';
|
shift_ctl_r <= '0';
|
else
|
else
|
if busy = '0' then
|
if busy = '0' then
|
if reg_to_mem_ctl_r = '1' or mem_to_reg_ctl_r = '1' or branch_taken_dly = '1' or jump_taken_dly = '1' then
|
if reg_to_mem_ctl_r = '1' or mem_to_reg_ctl_r = '1' or bds = '1' then
|
rs_r <= (others => '0');
|
rs_r <= (others => '0');
|
rt_r <= (others => '0');
|
rt_r <= (others => '0');
|
rd_r <= (others => '0');
|
rd_r <= (others => '0');
|
imm_r <= (others => '0');
|
imm_r <= (others => '0');
|
reg_dst_ctl_r <= '0';
|
reg_dst_ctl_r <= '0';
|