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,222 +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.helpers.all;
|
8
|
-
|
9
|
-
entity loadstore1 is
|
10
|
-
port(
|
11
|
-
clk : in std_ulogic;
|
12
|
-
rst : in std_ulogic;
|
13
|
-
l_in : in execute1toloadstore1type;
|
14
|
-
l_out : out loadstore1towritebacktype;
|
15
|
-
d_out : out loadstore1todcachetype;
|
16
|
-
d_in : in dcachetoloadstore1type;
|
17
|
-
dc_stall : in std_ulogic;
|
18
|
-
stall_out : out std_ulogic);
|
19
|
-
end entity loadstore1;
|
20
|
-
|
21
|
-
architecture behave of loadstore1 is
|
22
|
-
|
23
|
-
type state_t is (idle,second_req,first_ack_wait,last_ack_wait,ld_update);
|
24
|
-
|
25
|
-
type reg_stage_t is record
|
26
|
-
load : std_ulogic;
|
27
|
-
addr : std_ulogic_vector(63 downto 0);
|
28
|
-
store_data : std_ulogic_vector(63 downto 0);
|
29
|
-
load_data : std_ulogic_vector(63 downto 0);
|
30
|
-
write_reg : gpr_index_t;
|
31
|
-
length : std_ulogic_vector(3 downto 0);
|
32
|
-
byte_reverse : std_ulogic;
|
33
|
-
sign_extend : std_ulogic;
|
34
|
-
update : std_ulogic;
|
35
|
-
update_reg : gpr_index_t;
|
36
|
-
xerc : xer_common_t;
|
37
|
-
reserve : std_ulogic;
|
38
|
-
rc : std_ulogic;
|
39
|
-
nc : std_ulogic;
|
40
|
-
state : state_t;
|
41
|
-
second_bytes : std_ulogic_vector(7 downto 0);
|
42
|
-
end record;
|
43
|
-
|
44
|
-
type byte_sel_t is array(range 0 to 7) of std_ulogic;
|
45
|
-
|
46
|
-
subtype byte_trim_t is std_ulogic_vector(1 downto 0);
|
47
|
-
|
48
|
-
type trim_ctl_t is array(range 0 to 7) of byte_trim_t;
|
49
|
-
signal r : reg_stage_t;
|
50
|
-
signal rin : reg_stage_t;
|
51
|
-
signal lsu_sum : std_ulogic_vector(63 downto 0);
|
52
|
-
|
53
|
-
function length_to_sel(length : in std_logic_vector(3 downto 0)) return std_ulogic_vector is
|
54
|
-
begin
|
55
|
-
case length is
|
56
|
-
when "0001" =>
|
57
|
-
return "00000001";
|
58
|
-
when "0010" =>
|
59
|
-
return "00000011";
|
60
|
-
when "0100" =>
|
61
|
-
return "00001111";
|
62
|
-
when "1000" =>
|
63
|
-
return "11111111";
|
64
|
-
when others =>
|
65
|
-
return "00000000";
|
66
|
-
end case;
|
67
|
-
end function length_to_sel;
|
68
|
-
|
69
|
-
function xfer_data_sel(size : in std_logic_vector(3 downto 0);address : in std_logic_vector(2 downto 0)) return std_ulogic_vector is
|
70
|
-
variable longsel : std_ulogic_vector(15 downto 0);
|
71
|
-
begin
|
72
|
-
longsel := "00000000" & length_to_sel(size);
|
73
|
-
return std_ulogic_vector(shift_left(unsigned(longsel),to_integer(unsigned(address))));
|
74
|
-
end function xfer_data_sel;
|
75
|
-
begin
|
76
|
-
|
77
|
-
lsu_sum <= std_ulogic_vector(unsigned(l_in.addr1) + unsigned(l_in.addr2)) when l_in.valid = '1' else (others => '0');
|
78
|
-
|
79
|
-
loadstore1_0 : process(clk)
|
80
|
-
begin
|
81
|
-
if rising_edge(clk) then
|
82
|
-
if rst = '1' then
|
83
|
-
r.state <= idle;
|
84
|
-
else
|
85
|
-
r <= rin;
|
86
|
-
end if;
|
87
|
-
end if;
|
88
|
-
end process;
|
89
|
-
|
90
|
-
loadstore1_1 : process(all)
|
91
|
-
variable v : reg_stage_t;
|
92
|
-
variable brev_lenm1 : unsigned(2 downto 0);
|
93
|
-
variable byte_offset : unsigned(2 downto 0);
|
94
|
-
variable j : integer;
|
95
|
-
variable k : unsigned(2 downto 0);
|
96
|
-
variable kk : unsigned(3 downto 0);
|
97
|
-
variable long_sel : std_ulogic_vector(15 downto 0);
|
98
|
-
variable byte_sel : std_ulogic_vector(7 downto 0);
|
99
|
-
variable req : std_ulogic;
|
100
|
-
variable stall : std_ulogic;
|
101
|
-
variable addr : std_ulogic_vector(63 downto 0);
|
102
|
-
variable wdata : std_ulogic_vector(63 downto 0);
|
103
|
-
variable write_enable : std_ulogic;
|
104
|
-
variable do_update : std_ulogic;
|
105
|
-
variable two_dwords : std_ulogic;
|
106
|
-
variable done : std_ulogic;
|
107
|
-
variable data_permuted : std_ulogic_vector(63 downto 0);
|
108
|
-
variable data_trimmed : std_ulogic_vector(63 downto 0);
|
109
|
-
variable use_second : byte_sel_t;
|
110
|
-
variable trim_ctl : trim_ctl_t;
|
111
|
-
variable negative : std_ulogic;
|
112
|
-
begin
|
113
|
-
v := r;
|
114
|
-
req := '0';
|
115
|
-
stall := '0';
|
116
|
-
done := '0';
|
117
|
-
byte_sel := (others => '0');
|
118
|
-
addr := lsu_sum;
|
119
|
-
write_enable := '0';
|
120
|
-
do_update := '0';
|
121
|
-
two_dwords := or(r.second_bytes);
|
122
|
-
if r.load = '1' then
|
123
|
-
byte_offset := unsigned(r.addr(2 downto 0));
|
124
|
-
brev_lenm1 := "000";
|
125
|
-
if r.byte_reverse = '1' then
|
126
|
-
brev_lenm1 := unsigned(r.length(2 downto 0)) - 1;
|
127
|
-
end if;
|
128
|
-
negative := (r.length(3) and data_permuted(63)) or (r.length(2) and data_permuted(31)) or (r.length(1) and data_permuted(15)) or (r.length(0) and data_permuted(7));
|
129
|
-
end if;
|
130
|
-
case r.state is
|
131
|
-
when idle =>
|
132
|
-
if l_in.valid = '1' then
|
133
|
-
v.load := l_in.load;
|
134
|
-
v.addr := lsu_sum;
|
135
|
-
v.write_reg := l_in.write_reg;
|
136
|
-
v.length := l_in.length;
|
137
|
-
v.byte_reverse := l_in.byte_reverse;
|
138
|
-
v.sign_extend := l_in.sign_extend;
|
139
|
-
v.update := l_in.update;
|
140
|
-
v.update_reg := l_in.update_reg;
|
141
|
-
v.xerc := l_in.xerc;
|
142
|
-
v.reserve := l_in.reserve;
|
143
|
-
v.rc := l_in.rc;
|
144
|
-
v.nc := l_in.ci;
|
145
|
-
if lsu_sum(31 downto 28) = "1100" then
|
146
|
-
v.nc := '1';
|
147
|
-
end if;
|
148
|
-
long_sel := xfer_data_sel(l_in.length,v.addr(2 downto 0));
|
149
|
-
byte_sel := long_sel(7 downto 0);
|
150
|
-
v.second_bytes := long_sel(15 downto 8);
|
151
|
-
v.addr := lsu_sum;
|
152
|
-
if v.load = '0' then
|
153
|
-
byte_offset := unsigned(lsu_sum(2 downto 0));
|
154
|
-
brev_lenm1 := "000";
|
155
|
-
if l_in.byte_reverse = '1' then
|
156
|
-
brev_lenm1 := unsigned(l_in.length(2 downto 0)) - 1;
|
157
|
-
end if;
|
158
|
-
end if;
|
159
|
-
req := '1';
|
160
|
-
stall := '1';
|
161
|
-
if long_sel(15 downto 8) = "00000000" then
|
162
|
-
v.state := last_ack_wait;
|
163
|
-
else
|
164
|
-
v.state := second_req;
|
165
|
-
end if;
|
166
|
-
end if;
|
167
|
-
when second_req =>
|
168
|
-
addr := std_ulogic_vector(unsigned(r.addr(63 downto 3)) + 1) & "000";
|
169
|
-
byte_sel := r.second_bytes;
|
170
|
-
req := '1';
|
171
|
-
stall := '1';
|
172
|
-
v.state := first_ack_wait;
|
173
|
-
when first_ack_wait =>
|
174
|
-
stall := '1';
|
175
|
-
if d_in.valid = '1' then
|
176
|
-
v.state := last_ack_wait;
|
177
|
-
if r.load = '1' then
|
178
|
-
v.load_data := data_permuted;
|
179
|
-
end if;
|
180
|
-
end if;
|
181
|
-
when last_ack_wait =>
|
182
|
-
stall := '1';
|
183
|
-
if d_in.valid = '1' then
|
184
|
-
write_enable := r.load;
|
185
|
-
if r.load = '1' and r.update = '1' then
|
186
|
-
v.state := ld_update;
|
187
|
-
else
|
188
|
-
do_update := r.update;
|
189
|
-
stall := '0';
|
190
|
-
done := '1';
|
191
|
-
v.state := idle;
|
192
|
-
end if;
|
193
|
-
end if;
|
194
|
-
when ld_update =>
|
195
|
-
do_update := '1';
|
196
|
-
v.state := idle;
|
197
|
-
done := '1';
|
198
|
-
end case;
|
199
|
-
d_out.valid <= req;
|
200
|
-
d_out.load <= v.load;
|
201
|
-
d_out.nc <= v.nc;
|
202
|
-
d_out.reserve <= v.reserve;
|
203
|
-
d_out.addr <= addr;
|
204
|
-
d_out.data <= v.store_data;
|
205
|
-
d_out.byte_sel <= byte_sel;
|
206
|
-
l_out.valid <= done;
|
207
|
-
if do_update = '1' then
|
208
|
-
l_out.write_enable <= '1';
|
209
|
-
l_out.write_reg <= r.update_reg;
|
210
|
-
l_out.write_data <= r.addr;
|
211
|
-
else
|
212
|
-
l_out.write_enable <= write_enable;
|
213
|
-
l_out.write_reg <= r.write_reg;
|
214
|
-
l_out.write_data <= data_trimmed;
|
215
|
-
end if;
|
216
|
-
l_out.xerc <= r.xerc;
|
217
|
-
l_out.rc <= r.rc and done;
|
218
|
-
l_out.store_done <= d_in.store_done;
|
219
|
-
stall_out <= stall;
|
220
|
-
rin <= v;
|
221
|
-
end process;
|
222
|
-
end behave;
|
@@ -1,87 +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.decode_types.all;
|
7
|
-
|
8
|
-
entity logical is
|
9
|
-
port(
|
10
|
-
rs : in std_ulogic_vector(63 downto 0);
|
11
|
-
rb : in std_ulogic_vector(63 downto 0);
|
12
|
-
op : in insn_type_t;
|
13
|
-
invert_in : in std_ulogic;
|
14
|
-
invert_out : in std_ulogic;
|
15
|
-
result : out std_ulogic_vector(63 downto 0);
|
16
|
-
datalen : in std_logic_vector(3 downto 0);
|
17
|
-
popcnt : out std_ulogic_vector(63 downto 0);
|
18
|
-
parity : out std_ulogic_vector(63 downto 0));
|
19
|
-
end entity logical;
|
20
|
-
|
21
|
-
architecture behaviour of logical is
|
22
|
-
|
23
|
-
subtype twobit is unsigned(1 downto 0);
|
24
|
-
|
25
|
-
type twobit32 is array(range 0 to 31) of twobit;
|
26
|
-
signal pc2 : twobit32;
|
27
|
-
|
28
|
-
subtype threebit is unsigned(2 downto 0);
|
29
|
-
|
30
|
-
type threebit16 is array(range 0 to 15) of threebit;
|
31
|
-
signal pc4 : threebit16;
|
32
|
-
|
33
|
-
subtype fourbit is unsigned(3 downto 0);
|
34
|
-
|
35
|
-
type fourbit8 is array(range 0 to 7) of fourbit;
|
36
|
-
signal pc8 : fourbit8;
|
37
|
-
|
38
|
-
subtype sixbit is unsigned(5 downto 0);
|
39
|
-
|
40
|
-
type sixbit2 is array(range 0 to 1) of sixbit;
|
41
|
-
signal pc32 : sixbit2;
|
42
|
-
signal par0 : std_ulogic;
|
43
|
-
signal par1 : std_ulogic;
|
44
|
-
begin
|
45
|
-
|
46
|
-
|
47
|
-
logical_0 : process(all)
|
48
|
-
variable rb_adj : std_ulogic_vector(63 downto 0);
|
49
|
-
variable tmp : std_ulogic_vector(63 downto 0);
|
50
|
-
begin
|
51
|
-
rb_adj := rb;
|
52
|
-
if invert_in = '1' then
|
53
|
-
rb_adj := rb;
|
54
|
-
end if;
|
55
|
-
case op is
|
56
|
-
when op_and =>
|
57
|
-
tmp := rs and rb_adj;
|
58
|
-
when op_or =>
|
59
|
-
tmp := rs or rb_adj;
|
60
|
-
when others =>
|
61
|
-
tmp := rs xor rb_adj;
|
62
|
-
end case;
|
63
|
-
result <= tmp;
|
64
|
-
if invert_out = '1' then
|
65
|
-
result <= tmp;
|
66
|
-
end if;
|
67
|
-
;
|
68
|
-
;
|
69
|
-
popcnt <= (others => '0');
|
70
|
-
if datalen(3 downto 2) = "00" then
|
71
|
-
;
|
72
|
-
elsif datalen(3) = '0' then
|
73
|
-
;
|
74
|
-
else
|
75
|
-
popcnt(6 downto 0) <= std_ulogic_vector(('0' & pc32(0)) + ('0' & pc32(1)));
|
76
|
-
end if;
|
77
|
-
par0 <= rs(0) xor rs(8) xor rs(16) xor rs(24);
|
78
|
-
par1 <= rs(32) xor rs(40) xor rs(48) xor rs(56);
|
79
|
-
parity <= (others => '0');
|
80
|
-
if datalen(3) = '1' then
|
81
|
-
parity(0) <= par0 xor par1;
|
82
|
-
else
|
83
|
-
parity(0) <= par0;
|
84
|
-
parity(32) <= par1;
|
85
|
-
end if;
|
86
|
-
end process;
|
87
|
-
end behaviour;
|
@@ -1,84 +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.decode_types.all;
|
8
|
-
|
9
|
-
entity multiply is
|
10
|
-
generic(
|
11
|
-
pipeline_depth : natural16 := 16);
|
12
|
-
port(
|
13
|
-
clk : in std_logic;
|
14
|
-
m_in : in execute1tomultiplytype;
|
15
|
-
m_out : out multiplytoexecute1type);
|
16
|
-
end entity multiply;
|
17
|
-
|
18
|
-
architecture behaviour of multiply is
|
19
|
-
signal m : execute1tomultiplytype;
|
20
|
-
|
21
|
-
type multiply_pipeline_stage is record
|
22
|
-
valid : std_ulogic;
|
23
|
-
insn_type : insn_type_t;
|
24
|
-
data : signed(129 downto 0);
|
25
|
-
is_32bit : std_ulogic;
|
26
|
-
end record;
|
27
|
-
constant multiplypipelinestageinit : multiply_pipeline_stage := (valid => '0',insn_type => op_illegal,is_32bit => '0',data => (others => '0'));
|
28
|
-
|
29
|
-
type multiply_pipeline_type is array(range 0 to pipeline_depth - 1) of multiply_pipeline_stage;
|
30
|
-
constant multiplypipelineinit : multiply_pipeline_type := (others => multiplypipelinestageinit);
|
31
|
-
|
32
|
-
type reg_type is record
|
33
|
-
multiply_pipeline : multiply_pipeline_type;
|
34
|
-
end record;
|
35
|
-
signal r : reg_type;
|
36
|
-
signal rin : reg_type := (multiply_pipeline => multiplypipelineinit);
|
37
|
-
begin
|
38
|
-
|
39
|
-
|
40
|
-
multiply_0 : process(clk)
|
41
|
-
begin
|
42
|
-
if rising_edge(clk) then
|
43
|
-
m <= m_in;
|
44
|
-
r <= rin;
|
45
|
-
end if;
|
46
|
-
end process;
|
47
|
-
|
48
|
-
multiply_1 : process(all)
|
49
|
-
variable v : reg_type;
|
50
|
-
variable d : std_ulogic_vector(129 downto 0);
|
51
|
-
variable d2 : std_ulogic_vector(63 downto 0);
|
52
|
-
variable ov : std_ulogic;
|
53
|
-
begin
|
54
|
-
v := r;
|
55
|
-
m_out <= multiplytoexecute1init;
|
56
|
-
v.multiply_pipeline(0).valid := m.valid;
|
57
|
-
v.multiply_pipeline(0).insn_type := m.insn_type;
|
58
|
-
v.multiply_pipeline(0).data := signed(m.data1) * signed(m.data2);
|
59
|
-
v.multiply_pipeline(0).is_32bit := m.is_32bit;
|
60
|
-
d := std_ulogic_vector(v.multiply_pipeline(pipeline_depth - 1).data);
|
61
|
-
ov := '0';
|
62
|
-
case v.multiply_pipeline(pipeline_depth - 1).insn_type is
|
63
|
-
when op_mul_l64 =>
|
64
|
-
d2 := d(63 downto 0);
|
65
|
-
if v.multiply_pipeline(pipeline_depth - 1).is_32bit = '1' then
|
66
|
-
ov := (or(d(63 downto 31))) and (and(d(63 downto 31)));
|
67
|
-
else
|
68
|
-
ov := (or(d(127 downto 63))) and (and(d(127 downto 63)));
|
69
|
-
end if;
|
70
|
-
when op_mul_h32 =>
|
71
|
-
d2 := d(63 downto 32) & d(63 downto 32);
|
72
|
-
when op_mul_h64 =>
|
73
|
-
d2 := d(127 downto 64);
|
74
|
-
when others =>
|
75
|
-
d2 := (others => '0');
|
76
|
-
end case;
|
77
|
-
m_out.write_reg_data <= d2;
|
78
|
-
m_out.overflow <= ov;
|
79
|
-
if v.multiply_pipeline(pipeline_depth - 1).valid = '1' then
|
80
|
-
m_out.valid <= '1';
|
81
|
-
end if;
|
82
|
-
rin <= v;
|
83
|
-
end process;
|
84
|
-
end behaviour;
|
@@ -1,75 +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.decode_types.all;
|
7
|
-
use work.common.all;
|
8
|
-
use work.glibc_random.all;
|
9
|
-
use work.ppc_fx_insns.all;
|
10
|
-
|
11
|
-
entity multiply_tb is
|
12
|
-
end entity multiply_tb;
|
13
|
-
|
14
|
-
architecture behave of multiply_tb is
|
15
|
-
signal clk : std_ulogic;
|
16
|
-
constant clk_period : time := 10 ns;
|
17
|
-
constant pipeline_depth : integer := 4;
|
18
|
-
signal m1 : execute1tomultiplytype;
|
19
|
-
signal m2 : multiplytoexecute1type;
|
20
|
-
begin
|
21
|
-
|
22
|
-
multiply_0 : entity work.multiply
|
23
|
-
port map(
|
24
|
-
clk => clk,
|
25
|
-
m_in => m1,
|
26
|
-
m_out => m2);
|
27
|
-
|
28
|
-
|
29
|
-
clk_process : process
|
30
|
-
begin
|
31
|
-
clk <= '0';
|
32
|
-
wait clk_period / 2;
|
33
|
-
clk <= '1';
|
34
|
-
wait clk_period / 2;
|
35
|
-
end process;
|
36
|
-
|
37
|
-
stim_process : process
|
38
|
-
variable ra : std_ulogic_vector(63 downto 0);
|
39
|
-
variable rb : std_ulogic_vector(63 downto 0);
|
40
|
-
variable rt : std_ulogic_vector(63 downto 0);
|
41
|
-
variable behave_rt : std_ulogic_vector(63 downto 0);
|
42
|
-
variable si : std_ulogic_vector(15 downto 0);
|
43
|
-
begin
|
44
|
-
wait clk_period;
|
45
|
-
m1.valid <= '1';
|
46
|
-
m1.insn_type <= op_mul_l64;
|
47
|
-
m1.data1 <= '0' & x"0000000000001000";
|
48
|
-
m1.data2 <= '0' & x"0000000000001111";
|
49
|
-
wait clk_period;
|
50
|
-
assert m2.valid = '0';
|
51
|
-
m1.valid <= '0';
|
52
|
-
wait clk_period;
|
53
|
-
assert m2.valid = '0';
|
54
|
-
wait clk_period;
|
55
|
-
assert m2.valid = '0';
|
56
|
-
wait clk_period;
|
57
|
-
assert m2.valid = '1';
|
58
|
-
assert m2.write_reg_data = x"0000000001111000";
|
59
|
-
wait clk_period;
|
60
|
-
assert m2.valid = '0';
|
61
|
-
m1.valid <= '1';
|
62
|
-
wait clk_period;
|
63
|
-
assert m2.valid = '0';
|
64
|
-
m1.valid <= '0';
|
65
|
-
wait clk_period * (pipeline_depth - 1);
|
66
|
-
assert m2.valid = '1';
|
67
|
-
assert m2.write_reg_data = x"0000000001111000";
|
68
|
-
;
|
69
|
-
;
|
70
|
-
;
|
71
|
-
assert false
|
72
|
-
report "end of test" severity failure;
|
73
|
-
wait ;
|
74
|
-
end process;
|
75
|
-
end behave;
|
@@ -1,46 +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
|
-
use ieee.math_real.all;
|
6
|
-
|
7
|
-
entity plru is
|
8
|
-
generic(
|
9
|
-
bits : positive2 := 2);
|
10
|
-
port(
|
11
|
-
clk : in std_ulogic;
|
12
|
-
rst : in std_ulogic;
|
13
|
-
acc : in std_ulogic_vector(bits - 1 downto 0);
|
14
|
-
acc_en : in std_ulogic;
|
15
|
-
lru : out std_ulogic_vector(bits - 1 downto 0));
|
16
|
-
end entity plru;
|
17
|
-
|
18
|
-
architecture rtl of plru is
|
19
|
-
constant count : positive := 2 ** bits - 1;
|
20
|
-
|
21
|
-
subtype node_t is integer range 0 to count;
|
22
|
-
|
23
|
-
type tree_t is array(range node_t) of std_ulogic;
|
24
|
-
signal tree : tree_t;
|
25
|
-
begin
|
26
|
-
|
27
|
-
|
28
|
-
get_lru : process(tree)
|
29
|
-
variable node : node_t;
|
30
|
-
begin
|
31
|
-
node := 0;
|
32
|
-
end process;
|
33
|
-
|
34
|
-
update_lru : process(clk)
|
35
|
-
variable node : node_t;
|
36
|
-
variable abit : std_ulogic;
|
37
|
-
begin
|
38
|
-
if rising_edge(clk) then
|
39
|
-
if rst = '1' then
|
40
|
-
tree <= (others => '0');
|
41
|
-
elsif acc_en = '1' then
|
42
|
-
node := 0;
|
43
|
-
end if;
|
44
|
-
end if;
|
45
|
-
end process;
|
46
|
-
end rtl;
|
@@ -1,93 +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
|
-
use work.wishbone_types.all;
|
7
|
-
|
8
|
-
entity plru_tb is
|
9
|
-
end entity plru_tb;
|
10
|
-
|
11
|
-
architecture behave of plru_tb is
|
12
|
-
signal clk : std_ulogic;
|
13
|
-
signal rst : std_ulogic;
|
14
|
-
constant clk_period : time := 10 ns;
|
15
|
-
signal acc_en : std_ulogic;
|
16
|
-
signal acc : std_ulogic_vector(2 downto 0);
|
17
|
-
signal lru : std_ulogic_vector(2 downto 0);
|
18
|
-
begin
|
19
|
-
|
20
|
-
plru0 : entity work.plru
|
21
|
-
port map(
|
22
|
-
clk => clk,
|
23
|
-
rst => rst,
|
24
|
-
acc => acc,
|
25
|
-
acc_en => acc_en,
|
26
|
-
lru => lru);
|
27
|
-
|
28
|
-
|
29
|
-
clk_process : process
|
30
|
-
begin
|
31
|
-
clk <= '0';
|
32
|
-
wait clk_period / 2;
|
33
|
-
clk <= '1';
|
34
|
-
wait clk_period / 2;
|
35
|
-
end process;
|
36
|
-
|
37
|
-
rst_process : process
|
38
|
-
begin
|
39
|
-
rst <= '1';
|
40
|
-
wait 2 * clk_period;
|
41
|
-
rst <= '0';
|
42
|
-
wait ;
|
43
|
-
end process;
|
44
|
-
|
45
|
-
stim : process
|
46
|
-
begin
|
47
|
-
wait 4 * clk_period;
|
48
|
-
report "accessing 1:";
|
49
|
-
acc <= "001";
|
50
|
-
acc_en <= '1';
|
51
|
-
wait clk_period;
|
52
|
-
report "lru:" & to_hstring(lru);
|
53
|
-
report "accessing 2:";
|
54
|
-
acc <= "010";
|
55
|
-
wait clk_period;
|
56
|
-
report "lru:" & to_hstring(lru);
|
57
|
-
report "accessing 7:";
|
58
|
-
acc <= "111";
|
59
|
-
wait clk_period;
|
60
|
-
report "lru:" & to_hstring(lru);
|
61
|
-
report "accessing 4:";
|
62
|
-
acc <= "100";
|
63
|
-
wait clk_period;
|
64
|
-
report "lru:" & to_hstring(lru);
|
65
|
-
report "accessing 3:";
|
66
|
-
acc <= "011";
|
67
|
-
wait clk_period;
|
68
|
-
report "lru:" & to_hstring(lru);
|
69
|
-
report "accessing 5:";
|
70
|
-
acc <= "101";
|
71
|
-
wait clk_period;
|
72
|
-
report "lru:" & to_hstring(lru);
|
73
|
-
report "accessing 3:";
|
74
|
-
acc <= "011";
|
75
|
-
wait clk_period;
|
76
|
-
report "lru:" & to_hstring(lru);
|
77
|
-
report "accessing 5:";
|
78
|
-
acc <= "101";
|
79
|
-
wait clk_period;
|
80
|
-
report "lru:" & to_hstring(lru);
|
81
|
-
report "accessing 6:";
|
82
|
-
acc <= "110";
|
83
|
-
wait clk_period;
|
84
|
-
report "lru:" & to_hstring(lru);
|
85
|
-
report "accessing 0:";
|
86
|
-
acc <= "000";
|
87
|
-
wait clk_period;
|
88
|
-
report "lru:" & to_hstring(lru);
|
89
|
-
assert false
|
90
|
-
report "end of test" severity failure;
|
91
|
-
wait ;
|
92
|
-
end process;
|
93
|
-
end behave;
|