2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
10 PIPELINE_DEPTH : natural := 1
14 busy_in : in std_ulogic;
15 deferred : in std_ulogic;
16 complete_in : in std_ulogic;
17 flush_in : in std_ulogic;
18 issuing : in std_ulogic;
19 repeated : in std_ulogic;
21 gpr_write_valid_in : in std_ulogic;
22 gpr_write_in : in gspr_index_t;
23 bypass_avail : in std_ulogic;
24 gpr_read_valid_in : in std_ulogic;
25 gpr_read_in : in gspr_index_t;
27 ugpr_write_valid : in std_ulogic;
28 ugpr_write_reg : in gspr_index_t;
30 stall_out : out std_ulogic;
31 use_bypass : out std_ulogic
33 end entity gpr_hazard;
34 architecture behaviour of gpr_hazard is
35 type pipeline_entry_type is record
39 ugpr_valid : std_ulogic;
42 constant pipeline_entry_init : pipeline_entry_type := (valid => '0', bypass => '0', gpr => (others => '0'),
43 ugpr_valid => '0', ugpr => (others => '0'));
45 type pipeline_t is array(0 to PIPELINE_DEPTH) of pipeline_entry_type;
46 constant pipeline_t_init : pipeline_t := (others => pipeline_entry_init);
48 signal r, rin : pipeline_t := pipeline_t_init;
50 gpr_hazard0: process(clk)
52 if rising_edge(clk) then
57 gpr_hazard1: process(all)
58 variable v : pipeline_t;
62 if complete_in = '1' then
63 v(PIPELINE_DEPTH).valid := '0';
64 v(PIPELINE_DEPTH).ugpr_valid := '0';
69 if repeated = '0' and gpr_read_valid_in = '1' then
70 loop_0: for i in 0 to PIPELINE_DEPTH loop
71 -- The second half of a split instruction never has GPR
72 -- dependencies on the first half's output GPR,
73 -- so ignore matches when i = 0 for the second half.
74 if v(i).valid = '1' and r(i).gpr = gpr_read_in and
75 not (i = 0 and repeated = '1') then
76 if r(i).bypass = '1' then
82 if v(i).ugpr_valid = '1' and r(i).ugpr = gpr_read_in then
88 -- XXX assumes PIPELINE_DEPTH = 1
92 v(0).ugpr_valid := '0';
94 if deferred = '0' and issuing = '1' then
95 v(0).valid := gpr_write_valid_in;
96 v(0).bypass := bypass_avail;
97 v(0).gpr := gpr_write_in;
98 v(0).ugpr_valid := ugpr_write_valid;
99 v(0).ugpr := ugpr_write_reg;
101 if flush_in = '1' then
103 v(0).ugpr_valid := '0';
105 v(1).ugpr_valid := '0';