add wave -radix hexadecimal /pipeline_tb/decode_st/reg_wr_data
add wave -radix hexadecimal /pipeline_tb/decode_st/reg_we
+add wave -radix hexadecimal /pipeline_tb/exec_st/gpm_inst/psw
+
run 5000 ns
\r
begin\r
\r
- add_inst : exec_op\r
+ add_inst : entity work.exec_op(add_op)\r
port map(clk,reset,left_operand, right_operand, op_detail, alu_state, add_result);\r
\r
- and_inst : exec_op\r
+ and_inst : entity work.exec_op(and_op)\r
port map(clk,reset,left_operand, right_operand, op_detail, alu_state, and_result);\r
- or_inst : exec_op\r
+\r
+ or_inst : entity work.exec_op(or_op)\r
port map(clk,reset,left_operand, right_operand, op_detail, alu_state, or_result);\r
- xor_inst : exec_op\r
+\r
+ xor_inst : entity work.exec_op(xor_op)\r
port map(clk,reset,left_operand, right_operand, op_detail, alu_state, xor_result);\r
\r
- shift_inst : exec_op\r
+ shift_inst : entity work.exec_op(shift_op)\r
port map(clk,reset,left_operand, right_operand, op_detail, alu_state, shift_result);\r
\r
calc: process(left_operand, right_operand, cond, op_group, op_detail ,alu_state,and_result,add_result,or_result,xor_result,shift_result)\r
\r
end architecture behaviour;\r
\r
-configuration alu_cfg of alu is\r
-\r
- for behaviour\r
- for add_inst : exec_op \r
- use entity work.exec_op(add_op);\r
- end for;\r
- for and_inst : exec_op \r
- use entity work.exec_op(and_op);\r
- end for;\r
- for or_inst : exec_op\r
- use entity work.exec_op(or_op);\r
- end for;\r
- for xor_inst : exec_op\r
- use entity work.exec_op(xor_op);\r
- end for;\r
- for shift_inst : exec_op\r
- use entity work.exec_op(shift_op);\r
- end for;\r
- end for;\r
- \r
-end configuration alu_cfg;\r
\r
end record alu_result_rec;\r
\r
- constant SHIFT_WIDTH : integer := 1;--log2c(gp_register_t'length);\r
+ constant SHIFT_WIDTH : integer := log2c(gp_register_t'length);\r
\r
constant COND_ZERO : condition_t := "0001";\r
constant COND_NZERO : condition_t := "0000";\r
-- function xor_op(left_operand, right_operand : gp_register_t; alu_result : alu_result_rec) return alu_result_rec;\r
\r
-- function shift_op(left_operand, right_operand : gp_register_t; arith,sleft,carry : std_logic ;alu_result : alu_result_rec) return alu_result_rec;\r
-
- component alu is
+ \r
+ component alu is\r
--some modules won't need all inputs\r
port(\r
--System inputs\r
right_operand : in gp_register_t;\r
op_detail : in op_opt_t;\r
alu_state : in alu_result_rec;\r
- alu_result : out alu_result_rec;
- addr : out gp_register_t;
+ alu_result : out alu_result_rec;\r
+ addr : out gp_register_t;\r
data : out gp_register_t\r
- );
+ );\r
end component alu;\r
\r
end package alu_pkg;\r
rtw_rec.immediate <= (others => '0');
rtw_rec.imm_set <= '0';
- dec_op_inst.condition <= (others => '0');
+ dec_op_inst.condition <= (others => '1');
dec_op_inst.op_detail <= (others => '0');
+ dec_op_inst.op_group <= ADDSUB_OP;
dec_op_inst.brpr <= '0'; --branch_prediction_bit;
dec_op_inst.src1 <= (others => '0');
dec_op_inst.src2 <= (others => '0');
dec_op_inst_nxt.saddr1 <= instr_spl.reg_src1_addr;
dec_op_inst_nxt.saddr2 <= instr_spl.reg_src2_addr;
dec_op_inst_nxt.daddr <= (others => '0');
+ dec_op_inst_nxt.op_group <= instr_spl.op_group;
end process;
complement := inc(not(right_operand));
l_neg := left_operand(gp_register_t'high);
- --carry_res := unsigned('0' & left_operand)+addcarry;
- carry_res := unsigned('0' & left_operand);
+ carry_res := unsigned('0' & left_operand)+addcarry;
oflo1 := add_oflo(l_neg,'0',carry_res(gp_register_t'high));
if sub = '1' then
alu_result_v.result := std_logic_vector(carry_res(gp_register_t'range));
alu_result_v.status.carry := carry_res(carry_res'high);
+ -- alu_result_v.result := (0 => '1', others => '0');
-
- alu_result_v.status.carry := oflo1 or oflo2;
+ alu_result_v.status.oflo := oflo1 or oflo2;
--sign will be set globally.
--zero will be set globally.
signal ram : RAM_TYPE := (
0 => x"00000000",
1 => x"00000001",
- 2 => x"00000002",
+ 2 => x"FFFFFFFF",
3 => x"00000003",
others=> x"00000000");
subtype RAM_ENTRY_TYPE is std_logic_vector(DATA_WIDTH -1 downto 0);
type RAM_TYPE is array (0 to (2**ADDR_WIDTH)-1) of RAM_ENTRY_TYPE;
- signal ram : RAM_TYPE := (0 => "11100000000000011001000000000000",
- 1 => "11110000000000001001000000000000",
- 2 => "11100000000010001001000000000000",
- 3 => "11100001000110010111011001101100",
- others => x"00000000");
+ signal ram : RAM_TYPE := (0 => "11100000000000011001000000000000", -- r0 = r3 + r2 (always)
+ 1 => "11100101000000001000100000000010", -- r0 = r1 << 0 (always)
+ 2 => "11100000000010000001100000000000", -- r1 = r0 + r3 (always)
+ 3 => "11100000101000000001000000000000",
+ 4 => "11100001000110010111011001101100",
+ others => x"E0000000");
begin
process(clk)