vertigo_vhdl 0.8.6 → 0.8.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vertigo/parser.rb +28 -5
- data/lib/vertigo/tb_generator.rb +39 -18
- data/lib/vertigo/version.rb +1 -1
- data/tests/parser_tests/test_adder_rca_vhdl93.vhd +37 -0
- metadata +4 -85
- data/tests/ghdl_tests/test_fsm.vhd +0 -162
- data/tests/parser_tests/else.vhd +0 -64
- data/tests/parser_tests/pingpong.vhd +0 -34
- data/tests/parser_tests/test_accelerator_pp.vhd +0 -144
- data/tests/parser_tests/test_aggregate_pp.vhd +0 -15
- data/tests/parser_tests/test_archi_1_pp.vhd +0 -41
- data/tests/parser_tests/test_array_array_00_pp.vhd +0 -25
- data/tests/parser_tests/test_array_urange_pp.vhd +0 -25
- data/tests/parser_tests/test_chu-1_pp.vhd +0 -104
- data/tests/parser_tests/test_concat_pp.vhd +0 -14
- data/tests/parser_tests/test_counter_pp.vhd +0 -35
- data/tests/parser_tests/test_de2_pp.vhd +0 -274
- data/tests/parser_tests/test_encode_pp.vhd +0 -2549
- data/tests/parser_tests/test_fsm_pp.vhd +0 -125
- data/tests/parser_tests/test_fsm_synth_pp.vhd +0 -197
- data/tests/parser_tests/test_function-01_pp.vhd +0 -18
- data/tests/parser_tests/test_lfsr_pp.vhd +0 -44
- data/tests/parser_tests/test_microwatt_cache_ram_pp.vhd +0 -68
- data/tests/parser_tests/test_microwatt_common_pp.vhd +0 -336
- data/tests/parser_tests/test_microwatt_control_pp.vhd +0 -187
- data/tests/parser_tests/test_microwatt_core_debug_pp.vhd +0 -104
- data/tests/parser_tests/test_microwatt_core_pp.vhd +0 -231
- data/tests/parser_tests/test_microwatt_core_tb_pp.vhd +0 -43
- data/tests/parser_tests/test_microwatt_countzero_pp.vhd +0 -120
- data/tests/parser_tests/test_microwatt_countzero_tb_pp.vhd +0 -70
- data/tests/parser_tests/test_microwatt_cr_file_pp.vhd +0 -74
- data/tests/parser_tests/test_microwatt_cr_hazard_pp.vhd +0 -51
- data/tests/parser_tests/test_microwatt_crhelpers_pp.vhd +0 -48
- data/tests/parser_tests/test_microwatt_dcache_pp.vhd +0 -481
- data/tests/parser_tests/test_microwatt_dcache_tb_pp.vhd +0 -98
- data/tests/parser_tests/test_microwatt_decode1_pp.vhd +0 -138
- data/tests/parser_tests/test_microwatt_decode2_pp.vhd +0 -300
- data/tests/parser_tests/test_microwatt_decode_types_pp.vhd +0 -67
- data/tests/parser_tests/test_microwatt_divider_pp.vhd +0 -132
- data/tests/parser_tests/test_microwatt_divider_tb_pp.vhd +0 -95
- data/tests/parser_tests/test_microwatt_dmi_dtm_dummy_pp.vhd +0 -29
- data/tests/parser_tests/test_microwatt_dmi_dtm_tb_pp.vhd +0 -197
- data/tests/parser_tests/test_microwatt_dmi_dtm_xilinx_pp.vhd +0 -139
- data/tests/parser_tests/test_microwatt_execute1_pp.vhd +0 -689
- data/tests/parser_tests/test_microwatt_fetch1_pp.vhd +0 -88
- data/tests/parser_tests/test_microwatt_fetch2_pp.vhd +0 -79
- data/tests/parser_tests/test_microwatt_glibc_random_helpers_pp.vhd +0 -25
- data/tests/parser_tests/test_microwatt_glibc_random_pp.vhd +0 -41
- data/tests/parser_tests/test_microwatt_gpr_hazard_pp.vhd +0 -68
- data/tests/parser_tests/test_microwatt_helpers_pp.vhd +0 -153
- data/tests/parser_tests/test_microwatt_icache_pp.vhd +0 -337
- data/tests/parser_tests/test_microwatt_icache_tb_pp.vhd +0 -104
- data/tests/parser_tests/test_microwatt_insn_helpers_pp.vhd +0 -208
- data/tests/parser_tests/test_microwatt_loadstore1_pp.vhd +0 -222
- data/tests/parser_tests/test_microwatt_logical_pp.vhd +0 -87
- data/tests/parser_tests/test_microwatt_multiply_pp.vhd +0 -84
- data/tests/parser_tests/test_microwatt_multiply_tb_pp.vhd +0 -75
- data/tests/parser_tests/test_microwatt_plru_pp.vhd +0 -46
- data/tests/parser_tests/test_microwatt_plru_tb_pp.vhd +0 -93
- data/tests/parser_tests/test_microwatt_ppc_fx_insns_pp.vhd +0 -665
- data/tests/parser_tests/test_microwatt_register_file_pp.vhd +0 -86
- data/tests/parser_tests/test_microwatt_rotator_pp.vhd +0 -149
- data/tests/parser_tests/test_microwatt_rotator_tb_pp.vhd +0 -134
- data/tests/parser_tests/test_microwatt_sim_bram_helpers_pp.vhd +0 -52
- data/tests/parser_tests/test_microwatt_sim_bram_pp.vhd +0 -53
- data/tests/parser_tests/test_microwatt_sim_console_pp.vhd +0 -43
- data/tests/parser_tests/test_microwatt_sim_jtag_pp.vhd +0 -64
- data/tests/parser_tests/test_microwatt_sim_jtag_socket_pp.vhd +0 -36
- data/tests/parser_tests/test_microwatt_sim_uart_pp.vhd +0 -90
- data/tests/parser_tests/test_microwatt_soc_pp.vhd +0 -195
- data/tests/parser_tests/test_microwatt_utils_pp.vhd +0 -39
- data/tests/parser_tests/test_microwatt_wishbone_arbiter_pp.vhd +0 -54
- data/tests/parser_tests/test_microwatt_wishbone_bram_tb_pp.vhd +0 -157
- data/tests/parser_tests/test_microwatt_wishbone_bram_wrapper_pp.vhd +0 -62
- data/tests/parser_tests/test_microwatt_wishbone_debug_master_pp.vhd +0 -124
- data/tests/parser_tests/test_microwatt_wishbone_types_pp.vhd +0 -38
- data/tests/parser_tests/test_microwatt_writeback_pp.vhd +0 -87
- data/tests/parser_tests/test_package-1_pp.vhd +0 -53
- data/tests/parser_tests/test_precedence_pp.vhd +0 -16
- data/tests/parser_tests/test_selected_sig_pp.vhd +0 -10
- data/tests/parser_tests/test_slice_pp.vhd +0 -16
- data/tests/parser_tests/test_tb-00_pp.vhd +0 -71
- data/tests/parser_tests/test_type_decl_02_pp.vhd +0 -11
- data/tests/parser_tests/test_use_pp.vhd +0 -10
- data/tests/parser_tests/test_while_1_pp.vhd +0 -26
- data/tests/parser_tests/test_with-00_pp.vhd +0 -12
- data/tests/tb_gen_tests/test_accelerator.vhd +0 -160
@@ -1,231 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
use ieee.numeric_std.all;
|
5
|
-
library work;
|
6
|
-
use work.common.all;
|
7
|
-
use work.wishbone_types.all;
|
8
|
-
|
9
|
-
entity core is
|
10
|
-
generic(
|
11
|
-
sim : booleanfalse := false;
|
12
|
-
disable_flatten : booleanfalse := false;
|
13
|
-
ex1_bypass : booleantrue := true);
|
14
|
-
port(
|
15
|
-
clk : in std_logic;
|
16
|
-
rst : in std_logic;
|
17
|
-
wishbone_insn_in : in wishbone_slave_out;
|
18
|
-
wishbone_insn_out : out wishbone_master_out;
|
19
|
-
wishbone_data_in : in wishbone_slave_out;
|
20
|
-
wishbone_data_out : out wishbone_master_out;
|
21
|
-
dmi_addr : in std_ulogic_vector(3 downto 0);
|
22
|
-
dmi_din : in std_ulogic_vector(63 downto 0);
|
23
|
-
dmi_dout : out std_ulogic_vector(63 downto 0);
|
24
|
-
dmi_req : in std_ulogic;
|
25
|
-
dmi_wr : in std_ulogic;
|
26
|
-
dmi_ack : out std_ulogic;
|
27
|
-
terminated_out : out std_logic);
|
28
|
-
end entity core;
|
29
|
-
|
30
|
-
architecture behave of core is
|
31
|
-
signal fetch2_to_decode1 : fetch2todecode1type;
|
32
|
-
signal fetch1_to_icache : fetch1toicachetype;
|
33
|
-
signal icache_to_fetch2 : icachetofetch2type;
|
34
|
-
signal decode1_to_decode2 : decode1todecode2type;
|
35
|
-
signal decode2_to_execute1 : decode2toexecute1type;
|
36
|
-
signal register_file_to_decode2 : registerfiletodecode2type;
|
37
|
-
signal decode2_to_register_file : decode2toregisterfiletype;
|
38
|
-
signal writeback_to_register_file : writebacktoregisterfiletype;
|
39
|
-
signal decode2_to_cr_file : decode2tocrfiletype;
|
40
|
-
signal cr_file_to_decode2 : crfiletodecode2type;
|
41
|
-
signal writeback_to_cr_file : writebacktocrfiletype;
|
42
|
-
signal execute1_to_writeback : execute1towritebacktype;
|
43
|
-
signal execute1_to_fetch1 : execute1tofetch1type;
|
44
|
-
signal execute1_to_loadstore1 : execute1toloadstore1type;
|
45
|
-
signal loadstore1_to_writeback : loadstore1towritebacktype;
|
46
|
-
signal loadstore1_to_dcache : loadstore1todcachetype;
|
47
|
-
signal dcache_to_loadstore1 : dcachetoloadstore1type;
|
48
|
-
signal fetch1_stall_in : std_ulogic;
|
49
|
-
signal icache_stall_out : std_ulogic;
|
50
|
-
signal fetch2_stall_in : std_ulogic;
|
51
|
-
signal decode1_stall_in : std_ulogic;
|
52
|
-
signal decode2_stall_in : std_ulogic;
|
53
|
-
signal decode2_stall_out : std_ulogic;
|
54
|
-
signal ex1_icache_inval : std_ulogic;
|
55
|
-
signal ex1_stall_out : std_ulogic;
|
56
|
-
signal ls1_stall_out : std_ulogic;
|
57
|
-
signal dcache_stall_out : std_ulogic;
|
58
|
-
signal flush : std_ulogic;
|
59
|
-
signal complete : std_ulogic;
|
60
|
-
signal terminate : std_ulogic;
|
61
|
-
signal core_rst : std_ulogic;
|
62
|
-
signal icache_rst : std_ulogic;
|
63
|
-
signal sim_cr_dump : std_ulogic;
|
64
|
-
signal dbg_core_stop : std_ulogic;
|
65
|
-
signal dbg_core_rst : std_ulogic;
|
66
|
-
signal dbg_icache_rst : std_ulogic;
|
67
|
-
signal dbg_core_is_stopped : std_ulogic;
|
68
|
-
|
69
|
-
function keep_h(disable : boolean) return string is
|
70
|
-
begin
|
71
|
-
if disable then
|
72
|
-
return "yes";
|
73
|
-
else
|
74
|
-
return "no";
|
75
|
-
end if;
|
76
|
-
end function keep_h;
|
77
|
-
attribute keep_hierarchy : string;
|
78
|
-
attribute keep_hierarchy of fetch1_0 : label is keep_h(disable_flatten);
|
79
|
-
attribute keep_hierarchy of icache_0 : label is keep_h(disable_flatten);
|
80
|
-
attribute keep_hierarchy of fetch2_0 : label is keep_h(disable_flatten);
|
81
|
-
attribute keep_hierarchy of decode1_0 : label is keep_h(disable_flatten);
|
82
|
-
attribute keep_hierarchy of decode2_0 : label is keep_h(disable_flatten);
|
83
|
-
attribute keep_hierarchy of register_file_0 : label is keep_h(disable_flatten);
|
84
|
-
attribute keep_hierarchy of cr_file_0 : label is keep_h(disable_flatten);
|
85
|
-
attribute keep_hierarchy of execute1_0 : label is keep_h(disable_flatten);
|
86
|
-
attribute keep_hierarchy of loadstore1_0 : label is keep_h(disable_flatten);
|
87
|
-
attribute keep_hierarchy of dcache_0 : label is keep_h(disable_flatten);
|
88
|
-
attribute keep_hierarchy of writeback_0 : label is keep_h(disable_flatten);
|
89
|
-
attribute keep_hierarchy of debug_0 : label is keep_h(disable_flatten);
|
90
|
-
begin
|
91
|
-
|
92
|
-
core_rst <= dbg_core_rst or rst;
|
93
|
-
fetch1_0 : entity work.fetch1
|
94
|
-
port map(
|
95
|
-
clk => clk,
|
96
|
-
rst => core_rst,
|
97
|
-
stall_in => fetch1_stall_in,
|
98
|
-
flush_in => flush,
|
99
|
-
stop_in => dbg_core_stop,
|
100
|
-
e_in => execute1_to_fetch1,
|
101
|
-
i_out => fetch1_to_icache);
|
102
|
-
|
103
|
-
fetch1_stall_in <= icache_stall_out or decode2_stall_out;
|
104
|
-
icache_0 : entity work.icache
|
105
|
-
port map(
|
106
|
-
clk => clk,
|
107
|
-
rst => icache_rst,
|
108
|
-
i_in => fetch1_to_icache,
|
109
|
-
i_out => icache_to_fetch2,
|
110
|
-
flush_in => flush,
|
111
|
-
stall_out => icache_stall_out,
|
112
|
-
wishbone_out => wishbone_insn_out,
|
113
|
-
wishbone_in => wishbone_insn_in);
|
114
|
-
|
115
|
-
icache_rst <= rst or dbg_icache_rst or ex1_icache_inval;
|
116
|
-
fetch2_0 : entity work.fetch2
|
117
|
-
port map(
|
118
|
-
clk => clk,
|
119
|
-
rst => core_rst,
|
120
|
-
stall_in => fetch2_stall_in,
|
121
|
-
flush_in => flush,
|
122
|
-
i_in => icache_to_fetch2,
|
123
|
-
f_out => fetch2_to_decode1);
|
124
|
-
|
125
|
-
fetch2_stall_in <= decode2_stall_out;
|
126
|
-
decode1_0 : entity work.decode1
|
127
|
-
port map(
|
128
|
-
clk => clk,
|
129
|
-
rst => core_rst,
|
130
|
-
stall_in => decode1_stall_in,
|
131
|
-
flush_in => flush,
|
132
|
-
f_in => fetch2_to_decode1,
|
133
|
-
d_out => decode1_to_decode2);
|
134
|
-
|
135
|
-
decode1_stall_in <= decode2_stall_out;
|
136
|
-
decode2_0 : entity work.decode2
|
137
|
-
port map(
|
138
|
-
clk => clk,
|
139
|
-
rst => core_rst,
|
140
|
-
stall_in => decode2_stall_in,
|
141
|
-
stall_out => decode2_stall_out,
|
142
|
-
flush_in => flush,
|
143
|
-
complete_in => complete,
|
144
|
-
stopped_out => dbg_core_is_stopped,
|
145
|
-
d_in => decode1_to_decode2,
|
146
|
-
e_out => decode2_to_execute1,
|
147
|
-
r_in => register_file_to_decode2,
|
148
|
-
r_out => decode2_to_register_file,
|
149
|
-
c_in => cr_file_to_decode2,
|
150
|
-
c_out => decode2_to_cr_file);
|
151
|
-
|
152
|
-
decode2_stall_in <= ex1_stall_out or ls1_stall_out;
|
153
|
-
register_file_0 : entity work.register_file
|
154
|
-
port map(
|
155
|
-
clk => clk,
|
156
|
-
d_in => decode2_to_register_file,
|
157
|
-
d_out => register_file_to_decode2,
|
158
|
-
w_in => writeback_to_register_file,
|
159
|
-
sim_dump => terminate,
|
160
|
-
sim_dump_done => sim_cr_dump);
|
161
|
-
|
162
|
-
cr_file_0 : entity work.cr_file
|
163
|
-
port map(
|
164
|
-
clk => clk,
|
165
|
-
d_in => decode2_to_cr_file,
|
166
|
-
d_out => cr_file_to_decode2,
|
167
|
-
w_in => writeback_to_cr_file,
|
168
|
-
sim_dump => sim_cr_dump);
|
169
|
-
|
170
|
-
execute1_0 : entity work.execute1
|
171
|
-
port map(
|
172
|
-
clk => clk,
|
173
|
-
rst => core_rst,
|
174
|
-
flush_out => flush,
|
175
|
-
stall_out => ex1_stall_out,
|
176
|
-
e_in => decode2_to_execute1,
|
177
|
-
l_out => execute1_to_loadstore1,
|
178
|
-
f_out => execute1_to_fetch1,
|
179
|
-
e_out => execute1_to_writeback,
|
180
|
-
icache_inval => ex1_icache_inval,
|
181
|
-
terminate_out => terminate);
|
182
|
-
|
183
|
-
loadstore1_0 : entity work.loadstore1
|
184
|
-
port map(
|
185
|
-
clk => clk,
|
186
|
-
rst => core_rst,
|
187
|
-
l_in => execute1_to_loadstore1,
|
188
|
-
l_out => loadstore1_to_writeback,
|
189
|
-
d_out => loadstore1_to_dcache,
|
190
|
-
d_in => dcache_to_loadstore1,
|
191
|
-
dc_stall => dcache_stall_out,
|
192
|
-
stall_out => ls1_stall_out);
|
193
|
-
|
194
|
-
dcache_0 : entity work.dcache
|
195
|
-
port map(
|
196
|
-
clk => clk,
|
197
|
-
rst => core_rst,
|
198
|
-
d_in => loadstore1_to_dcache,
|
199
|
-
d_out => dcache_to_loadstore1,
|
200
|
-
stall_out => dcache_stall_out,
|
201
|
-
wishbone_in => wishbone_data_in,
|
202
|
-
wishbone_out => wishbone_data_out);
|
203
|
-
|
204
|
-
writeback_0 : entity work.writeback
|
205
|
-
port map(
|
206
|
-
clk => clk,
|
207
|
-
e_in => execute1_to_writeback,
|
208
|
-
l_in => loadstore1_to_writeback,
|
209
|
-
w_out => writeback_to_register_file,
|
210
|
-
c_out => writeback_to_cr_file,
|
211
|
-
complete_out => complete);
|
212
|
-
|
213
|
-
debug_0 : entity work.core_debug
|
214
|
-
port map(
|
215
|
-
clk => clk,
|
216
|
-
rst => rst,
|
217
|
-
dmi_addr => dmi_addr,
|
218
|
-
dmi_din => dmi_din,
|
219
|
-
dmi_dout => dmi_dout,
|
220
|
-
dmi_req => dmi_req,
|
221
|
-
dmi_wr => dmi_wr,
|
222
|
-
dmi_ack => dmi_ack,
|
223
|
-
core_stop => dbg_core_stop,
|
224
|
-
core_rst => dbg_core_rst,
|
225
|
-
icache_rst => dbg_icache_rst,
|
226
|
-
terminate => terminate,
|
227
|
-
core_stopped => dbg_core_is_stopped,
|
228
|
-
nia => fetch1_to_icache.nia,
|
229
|
-
terminated_out => terminated_out);
|
230
|
-
|
231
|
-
end behave;
|
@@ -1,43 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
use ieee.numeric_std.all;
|
5
|
-
library work;
|
6
|
-
use work.common.all;
|
7
|
-
use work.wishbone_types.all;
|
8
|
-
|
9
|
-
entity core_tb is
|
10
|
-
end entity core_tb;
|
11
|
-
|
12
|
-
architecture behave of core_tb is
|
13
|
-
signal clk : std_logic;
|
14
|
-
signal rst : std_logic;
|
15
|
-
constant clk_period : time := 10 ns;
|
16
|
-
begin
|
17
|
-
|
18
|
-
soc0 : entity work.soc
|
19
|
-
port map(
|
20
|
-
rst => rst,
|
21
|
-
system_clk => clk,
|
22
|
-
uart0_rxd => '0',
|
23
|
-
uart0_txd => open);
|
24
|
-
|
25
|
-
|
26
|
-
clk_process : process
|
27
|
-
begin
|
28
|
-
clk <= '0';
|
29
|
-
wait clk_period / 2;
|
30
|
-
clk <= '1';
|
31
|
-
wait clk_period / 2;
|
32
|
-
end process;
|
33
|
-
|
34
|
-
rst_process : process
|
35
|
-
begin
|
36
|
-
rst <= '1';
|
37
|
-
wait 10 * clk_period;
|
38
|
-
rst <= '0';
|
39
|
-
wait ;
|
40
|
-
end process;
|
41
|
-
jtag : entity work.sim_jtag
|
42
|
-
|
43
|
-
end behave;
|
@@ -1,120 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
use ieee.numeric_std.all;
|
5
|
-
library work;
|
6
|
-
|
7
|
-
entity zero_counter is
|
8
|
-
port(
|
9
|
-
clk : in std_logic;
|
10
|
-
rs : in std_ulogic_vector(63 downto 0);
|
11
|
-
count_right : in std_ulogic;
|
12
|
-
is_32bit : in std_ulogic;
|
13
|
-
result : out std_ulogic_vector(63 downto 0));
|
14
|
-
end entity zero_counter;
|
15
|
-
|
16
|
-
architecture behaviour of zero_counter is
|
17
|
-
|
18
|
-
type intermediate_result is record
|
19
|
-
v16 : std_ulogic_vector(15 downto 0);
|
20
|
-
sel_hi : std_ulogic_vector(1 downto 0);
|
21
|
-
is_32bit : std_ulogic;
|
22
|
-
count_right : std_ulogic;
|
23
|
-
end record;
|
24
|
-
signal r : intermediate_result;
|
25
|
-
signal r_in : intermediate_result;
|
26
|
-
|
27
|
-
function encoder(v : std_ulogic_vector(3 downto 0);right : std_ulogic) return std_ulogic_vector is
|
28
|
-
begin
|
29
|
-
if right = '0' then
|
30
|
-
if v(3) = '1' then
|
31
|
-
return "11";
|
32
|
-
elsif v(2) = '1' then
|
33
|
-
return "10";
|
34
|
-
elsif v(1) = '1' then
|
35
|
-
return "01";
|
36
|
-
else
|
37
|
-
return "00";
|
38
|
-
end if;
|
39
|
-
else
|
40
|
-
if v(0) = '1' then
|
41
|
-
return "00";
|
42
|
-
elsif v(1) = '1' then
|
43
|
-
return "01";
|
44
|
-
elsif v(2) = '1' then
|
45
|
-
return "10";
|
46
|
-
else
|
47
|
-
return "11";
|
48
|
-
end if;
|
49
|
-
end if;
|
50
|
-
end function encoder;
|
51
|
-
begin
|
52
|
-
|
53
|
-
|
54
|
-
zerocounter_0 : process(clk)
|
55
|
-
begin
|
56
|
-
if rising_edge(clk) then
|
57
|
-
r <= r_in;
|
58
|
-
end if;
|
59
|
-
end process;
|
60
|
-
|
61
|
-
zerocounter_1 : process(all)
|
62
|
-
variable v : intermediate_result;
|
63
|
-
variable y : std_ulogic_vector(3 downto 0);
|
64
|
-
variable z : std_ulogic_vector(3 downto 0);
|
65
|
-
variable sel : std_ulogic_vector(5 downto 0);
|
66
|
-
variable v4 : std_ulogic_vector(3 downto 0);
|
67
|
-
begin
|
68
|
-
z(0) := or(rs(15 downto 0));
|
69
|
-
z(1) := or(rs(31 downto 16));
|
70
|
-
z(2) := or(rs(47 downto 32));
|
71
|
-
z(3) := or(rs(63 downto 48));
|
72
|
-
if is_32bit = '0' then
|
73
|
-
v.sel_hi := encoder(z,count_right);
|
74
|
-
else
|
75
|
-
v.sel_hi(1) := '0';
|
76
|
-
if count_right = '0' then
|
77
|
-
v.sel_hi(0) := z(1);
|
78
|
-
else
|
79
|
-
v.sel_hi(0) := z(0);
|
80
|
-
end if;
|
81
|
-
end if;
|
82
|
-
case v.sel_hi is
|
83
|
-
when "00" =>
|
84
|
-
v.v16 := rs(15 downto 0);
|
85
|
-
when "01" =>
|
86
|
-
v.v16 := rs(31 downto 16);
|
87
|
-
when "10" =>
|
88
|
-
v.v16 := rs(47 downto 32);
|
89
|
-
when others =>
|
90
|
-
v.v16 := rs(63 downto 48);
|
91
|
-
end case;
|
92
|
-
v.is_32bit := is_32bit;
|
93
|
-
v.count_right := count_right;
|
94
|
-
r_in <= v;
|
95
|
-
sel(5 downto 4) := r.sel_hi;
|
96
|
-
y(0) := or(r.v16(3 downto 0));
|
97
|
-
y(1) := or(r.v16(7 downto 4));
|
98
|
-
y(2) := or(r.v16(11 downto 8));
|
99
|
-
y(3) := or(r.v16(15 downto 12));
|
100
|
-
sel(3 downto 2) := encoder(y,r.count_right);
|
101
|
-
case sel(3 downto 2) is
|
102
|
-
when "00" =>
|
103
|
-
v4 := r.v16(3 downto 0);
|
104
|
-
when "01" =>
|
105
|
-
v4 := r.v16(7 downto 4);
|
106
|
-
when "10" =>
|
107
|
-
v4 := r.v16(11 downto 8);
|
108
|
-
when others =>
|
109
|
-
v4 := r.v16(15 downto 12);
|
110
|
-
end case;
|
111
|
-
sel(1 downto 0) := encoder(v4,r.count_right);
|
112
|
-
if v4 = "0000" then
|
113
|
-
result <= x"00000000000000" & '0' & r.is_32bit & r.is_32bit & "00000";
|
114
|
-
elsif r.count_right = '0' then
|
115
|
-
result <= x"00000000000000" & "00" & (sel(5) and r.is_32bit) & sel(4 downto 0);
|
116
|
-
else
|
117
|
-
result <= x"00000000000000" & "00" & sel;
|
118
|
-
end if;
|
119
|
-
end process;
|
120
|
-
end behaviour;
|
@@ -1,70 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
use ieee.numeric_std.all;
|
5
|
-
library work;
|
6
|
-
use work.common.all;
|
7
|
-
use work.glibc_random.all;
|
8
|
-
|
9
|
-
entity countzero_tb is
|
10
|
-
end entity countzero_tb;
|
11
|
-
|
12
|
-
architecture behave of countzero_tb is
|
13
|
-
constant clk_period : time := 10 ns;
|
14
|
-
signal rs : std_ulogic_vector(63 downto 0);
|
15
|
-
signal is_32bit : std_ulogic;
|
16
|
-
signal count_right : std_ulogic := '0';
|
17
|
-
signal result : std_ulogic_vector(63 downto 0);
|
18
|
-
signal randno : std_ulogic_vector(63 downto 0);
|
19
|
-
signal clk : std_ulogic;
|
20
|
-
begin
|
21
|
-
|
22
|
-
zerocounter_0 : entity work.zero_counter
|
23
|
-
port map(
|
24
|
-
clk => clk,
|
25
|
-
rs => rs,
|
26
|
-
result => result,
|
27
|
-
count_right => count_right,
|
28
|
-
is_32bit => is_32bit);
|
29
|
-
|
30
|
-
|
31
|
-
clk_process : process
|
32
|
-
begin
|
33
|
-
clk <= '0';
|
34
|
-
wait clk_period / 2;
|
35
|
-
clk <= '1';
|
36
|
-
wait clk_period / 2;
|
37
|
-
end process;
|
38
|
-
|
39
|
-
stim_process : process
|
40
|
-
variable r : std_ulogic_vector(63 downto 0);
|
41
|
-
begin
|
42
|
-
report "test zero input";
|
43
|
-
rs <= (others => '0');
|
44
|
-
is_32bit <= '0';
|
45
|
-
count_right <= '0';
|
46
|
-
wait clk_period;
|
47
|
-
assert result = x"0000000000000040"
|
48
|
-
report "bad cntlzd 0 = " & to_hstring(result);
|
49
|
-
count_right <= '1';
|
50
|
-
wait clk_period;
|
51
|
-
assert result = x"0000000000000040"
|
52
|
-
report "bad cnttzd 0 = " & to_hstring(result);
|
53
|
-
is_32bit <= '1';
|
54
|
-
count_right <= '0';
|
55
|
-
wait clk_period;
|
56
|
-
assert result = x"0000000000000020"
|
57
|
-
report "bad cntlzw 0 = " & to_hstring(result);
|
58
|
-
count_right <= '1';
|
59
|
-
wait clk_period;
|
60
|
-
assert result = x"0000000000000020"
|
61
|
-
report "bad cnttzw 0 = " & to_hstring(result);
|
62
|
-
report "test cntlzd/w";
|
63
|
-
count_right <= '0';
|
64
|
-
report "test cnttzd/w";
|
65
|
-
count_right <= '1';
|
66
|
-
assert false
|
67
|
-
report "end of test" severity failure;
|
68
|
-
wait ;
|
69
|
-
end process;
|
70
|
-
end behave;
|
@@ -1,74 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
use ieee.numeric_std.all;
|
5
|
-
library work;
|
6
|
-
use work.common.all;
|
7
|
-
|
8
|
-
entity cr_file is
|
9
|
-
generic(
|
10
|
-
sim : booleanfalse := false);
|
11
|
-
port(
|
12
|
-
clk : in std_logic;
|
13
|
-
d_in : in decode2tocrfiletype;
|
14
|
-
d_out : out crfiletodecode2type;
|
15
|
-
w_in : in writebacktocrfiletype;
|
16
|
-
sim_dump : in std_ulogic);
|
17
|
-
end entity cr_file;
|
18
|
-
|
19
|
-
architecture behaviour of cr_file is
|
20
|
-
signal crs : std_ulogic_vector(31 downto 0) := (others => '0');
|
21
|
-
signal crs_updated : std_ulogic_vector(31 downto 0);
|
22
|
-
signal xerc : xer_common_t := xerc_init;
|
23
|
-
signal xerc_updated : xer_common_t;
|
24
|
-
begin
|
25
|
-
|
26
|
-
|
27
|
-
cr_create_0 : process(all)
|
28
|
-
variable hi : integer;
|
29
|
-
variable lo : integer := 0;
|
30
|
-
variable cr_tmp : std_ulogic_vector(31 downto 0) := (others => '0');
|
31
|
-
begin
|
32
|
-
cr_tmp := crs;
|
33
|
-
crs_updated <= cr_tmp;
|
34
|
-
if w_in.write_xerc_enable = '1' then
|
35
|
-
xerc_updated <= w_in.write_xerc_data;
|
36
|
-
else
|
37
|
-
xerc_updated <= xerc;
|
38
|
-
end if;
|
39
|
-
end process;
|
40
|
-
|
41
|
-
cr_write_0 : process(clk)
|
42
|
-
begin
|
43
|
-
if rising_edge(clk) then
|
44
|
-
if w_in.write_cr_enable = '1' then
|
45
|
-
report "writing " & to_hstring(w_in.write_cr_data) & " to cr mask " & to_hstring(w_in.write_cr_mask);
|
46
|
-
crs <= crs_updated;
|
47
|
-
end if;
|
48
|
-
if w_in.write_xerc_enable = '1' then
|
49
|
-
report "writing xerc";
|
50
|
-
xerc <= xerc_updated;
|
51
|
-
end if;
|
52
|
-
end if;
|
53
|
-
end process;
|
54
|
-
|
55
|
-
cr_read_0 : process(all)
|
56
|
-
begin
|
57
|
-
if d_in.read = '1' then
|
58
|
-
report "reading cr " & to_hstring(crs_updated);
|
59
|
-
end if;
|
60
|
-
d_out.read_cr_data <= crs_updated;
|
61
|
-
d_out.read_xerc_data <= xerc_updated;
|
62
|
-
end process;
|
63
|
-
if sim generate
|
64
|
-
|
65
|
-
dump_cr : process(all)
|
66
|
-
begin
|
67
|
-
if sim_dump = '1' then
|
68
|
-
report "cr 00000000" & to_hstring(crs);
|
69
|
-
assert false
|
70
|
-
report "end of test" severity failure;
|
71
|
-
end if;
|
72
|
-
end process;
|
73
|
-
end generate;
|
74
|
-
end behaviour;
|
@@ -1,51 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
use ieee.numeric_std.all;
|
5
|
-
|
6
|
-
entity cr_hazard is
|
7
|
-
generic(
|
8
|
-
pipeline_depth : natural2 := 2);
|
9
|
-
port(
|
10
|
-
clk : in std_ulogic;
|
11
|
-
stall_in : in std_ulogic;
|
12
|
-
cr_read_in : in std_ulogic;
|
13
|
-
cr_write_in : in std_ulogic;
|
14
|
-
stall_out : out std_ulogic);
|
15
|
-
end entity cr_hazard;
|
16
|
-
|
17
|
-
architecture behaviour of cr_hazard is
|
18
|
-
|
19
|
-
type pipeline_entry_type is record
|
20
|
-
valid : std_ulogic;
|
21
|
-
end record;
|
22
|
-
constant pipeline_entry_init : pipeline_entry_type := (valid => '0');
|
23
|
-
|
24
|
-
type pipeline_t is array(range 0 to pipeline_depth - 1) of pipeline_entry_type;
|
25
|
-
constant pipeline_t_init : pipeline_t := (others => pipeline_entry_init);
|
26
|
-
signal r : pipeline_t;
|
27
|
-
signal rin : pipeline_t := pipeline_t_init;
|
28
|
-
begin
|
29
|
-
|
30
|
-
|
31
|
-
cr_hazard0 : process(clk)
|
32
|
-
begin
|
33
|
-
if rising_edge(clk) then
|
34
|
-
if stall_in = '0' then
|
35
|
-
r <= rin;
|
36
|
-
end if;
|
37
|
-
end if;
|
38
|
-
end process;
|
39
|
-
|
40
|
-
cr_hazard1 : process(all)
|
41
|
-
variable v : pipeline_t;
|
42
|
-
begin
|
43
|
-
v := r;
|
44
|
-
stall_out <= '0';
|
45
|
-
v(0).valid := cr_write_in;
|
46
|
-
if cr_read_in = '0' then
|
47
|
-
stall_out <= '0';
|
48
|
-
end if;
|
49
|
-
rin <= v;
|
50
|
-
end process;
|
51
|
-
end behaviour;
|
@@ -1,48 +0,0 @@
|
|
1
|
-
-- generated by Vertigo VHDL tool
|
2
|
-
library ieee;
|
3
|
-
use ieee.std_logic_1164.all;
|
4
|
-
library work;
|
5
|
-
use work.common.all;
|
6
|
-
|
7
|
-
package crhelpers is
|
8
|
-
|
9
|
-
subtype crnum_t is integer range 0 to 7;
|
10
|
-
|
11
|
-
subtype crmask_t is std_ulogic_vector(7 downto 0);
|
12
|
-
function fxm_to_num(fxm : crmask_t) return crnum_t
|
13
|
-
function num_to_fxm(num : crnum_t) return crmask_t
|
14
|
-
|
15
|
-
end crhelpers;
|
16
|
-
|
17
|
-
package body crhelpers is
|
18
|
-
|
19
|
-
function fxm_to_num(fxm : crmask_t) return crnum_t is
|
20
|
-
begin
|
21
|
-
;
|
22
|
-
return 7;
|
23
|
-
end function fxm_to_num;
|
24
|
-
|
25
|
-
function num_to_fxm(num : crnum_t) return crmask_t is
|
26
|
-
begin
|
27
|
-
case num is
|
28
|
-
when 0 =>
|
29
|
-
return "10000000";
|
30
|
-
when 1 =>
|
31
|
-
return "01000000";
|
32
|
-
when 2 =>
|
33
|
-
return "00100000";
|
34
|
-
when 3 =>
|
35
|
-
return "00010000";
|
36
|
-
when 4 =>
|
37
|
-
return "00001000";
|
38
|
-
when 5 =>
|
39
|
-
return "00000100";
|
40
|
-
when 6 =>
|
41
|
-
return "00000010";
|
42
|
-
when 7 =>
|
43
|
-
return "00000001";
|
44
|
-
when others =>
|
45
|
-
return "00000000";
|
46
|
-
end case;
|
47
|
-
end function num_to_fxm;
|
48
|
-
end crhelpers;
|