2 use IEEE.std_logic_1164.all;
3 use IEEE.numeric_std.all;
5 use work.common_pkg.all;
8 -------------------------------------------------------------------------------
10 -------------------------------------------------------------------------------
16 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 architecture behavior of pipeline_tb is
21 constant cc : time := 30 ns; -- test clock period
23 signal sys_clk_pin : std_logic;
24 signal sys_res_n_pin : std_logic;
27 signal dummy : std_logic;
29 signal jump_result_pin : instruction_addr_t;
30 signal prediction_result_pin : instruction_addr_t;
31 signal branch_prediction_bit_pin : std_logic;
32 signal alu_jump_bit_pin : std_logic;
33 signal instruction_pin : instruction_word_t;
35 signal reg_w_addr_pin : std_logic_vector(REG_ADDR_WIDTH-1 downto 0);
36 signal reg_wr_data_pin : gp_register_t;
37 signal reg_we_pin : std_logic;
38 signal to_next_stage_pin : dec_op;
42 -- instruction_ram : r_w_ram
44 -- PHYS_INSTR_ADDR_WIDTH,
50 -- instr_w_addr(PHYS_INSTR_ADDR_WIDTH-1 downto 0),
51 -- instr_r_addr_nxt(PHYS_INSTR_ADDR_WIDTH-1 downto 0),
57 fetch_st : fetch_stage
66 clk => sys_clk_pin, --: in std_logic;
67 reset => sys_res_n_pin, --: in std_logic;
70 jump_result => jump_result_pin, --: in instruction_addr_t;
71 prediction_result => prediction_result_pin, --: in instruction_addr_t;
72 branch_prediction_bit => branch_prediction_bit_pin, --: in std_logic;
73 alu_jump_bit => alu_jump_bit_pin, --: in std_logic;
76 instruction => instruction_pin --: out instruction_word_t
79 decode_st : decode_stage
89 clk => sys_clk_pin, --: in std_logic;
90 reset => sys_res_n_pin, -- : in std_logic;
93 instruction => instruction_pin, --: in instruction_word_t;
94 reg_w_addr => reg_w_addr_pin, --: in std_logic_vector(REG_ADDR_WIDTH-1 downto 0);
95 reg_wr_data => reg_wr_data_pin, --: in gp_register_t;
96 reg_we => reg_we_pin, --: in std_logic;
99 branch_prediction_res => prediction_result_pin, --: instruction_word_t;
100 branch_prediction_bit => branch_prediction_bit_pin, --: std_logic
101 to_next_stage => to_next_stage_pin
107 -------------------------------------------------------------------------------
108 -- generate simulation clock
109 -------------------------------------------------------------------------------
118 -------------------------------------------------------------------------------
120 -------------------------------------------------------------------------------
123 -- wait for n clock cycles
124 procedure icwait(cycles : natural) is
126 for i in 1 to cycles loop
127 wait until sys_clk_pin = '1' and sys_clk_pin'event;
132 -----------------------------------------------------------------------------
134 -----------------------------------------------------------------------------
135 sys_res_n_pin <= '0';
136 reg_w_addr_pin <= (others => '0');
137 reg_wr_data_pin <= (others => '0');
142 sys_res_n_pin <= '1';
143 wait until sys_res_n_pin = '1';
148 ---------------------------------------------------------------------------
150 ---------------------------------------------------------------------------
152 report "Test finished"
160 -------------------------------------------------------------------------------
162 -------------------------------------------------------------------------------
163 configuration pipeline_conf_beh of pipeline_tb is
165 for fetch_st : fetch_stage use entity work.fetch_stage(behav);
167 for decode_st : decode_stage use entity work.decode_stage(behav);
171 end pipeline_conf_beh;