vertigo_vhdl 0.8.5 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vertigo/parser.rb +28 -5
  3. data/lib/vertigo/tb_generator.rb +20 -7
  4. data/lib/vertigo/version.rb +1 -1
  5. data/tests/parser_tests/test_adder_rca_vhdl93.vhd +37 -0
  6. metadata +4 -85
  7. data/tests/ghdl_tests/test_fsm.vhd +0 -162
  8. data/tests/parser_tests/else.vhd +0 -64
  9. data/tests/parser_tests/pingpong.vhd +0 -34
  10. data/tests/parser_tests/test_accelerator_pp.vhd +0 -144
  11. data/tests/parser_tests/test_aggregate_pp.vhd +0 -15
  12. data/tests/parser_tests/test_archi_1_pp.vhd +0 -41
  13. data/tests/parser_tests/test_array_array_00_pp.vhd +0 -25
  14. data/tests/parser_tests/test_array_urange_pp.vhd +0 -25
  15. data/tests/parser_tests/test_chu-1_pp.vhd +0 -104
  16. data/tests/parser_tests/test_concat_pp.vhd +0 -14
  17. data/tests/parser_tests/test_counter_pp.vhd +0 -35
  18. data/tests/parser_tests/test_de2_pp.vhd +0 -274
  19. data/tests/parser_tests/test_encode_pp.vhd +0 -2549
  20. data/tests/parser_tests/test_fsm_pp.vhd +0 -125
  21. data/tests/parser_tests/test_fsm_synth_pp.vhd +0 -197
  22. data/tests/parser_tests/test_function-01_pp.vhd +0 -18
  23. data/tests/parser_tests/test_lfsr_pp.vhd +0 -44
  24. data/tests/parser_tests/test_microwatt_cache_ram_pp.vhd +0 -68
  25. data/tests/parser_tests/test_microwatt_common_pp.vhd +0 -336
  26. data/tests/parser_tests/test_microwatt_control_pp.vhd +0 -187
  27. data/tests/parser_tests/test_microwatt_core_debug_pp.vhd +0 -104
  28. data/tests/parser_tests/test_microwatt_core_pp.vhd +0 -231
  29. data/tests/parser_tests/test_microwatt_core_tb_pp.vhd +0 -43
  30. data/tests/parser_tests/test_microwatt_countzero_pp.vhd +0 -120
  31. data/tests/parser_tests/test_microwatt_countzero_tb_pp.vhd +0 -70
  32. data/tests/parser_tests/test_microwatt_cr_file_pp.vhd +0 -74
  33. data/tests/parser_tests/test_microwatt_cr_hazard_pp.vhd +0 -51
  34. data/tests/parser_tests/test_microwatt_crhelpers_pp.vhd +0 -48
  35. data/tests/parser_tests/test_microwatt_dcache_pp.vhd +0 -481
  36. data/tests/parser_tests/test_microwatt_dcache_tb_pp.vhd +0 -98
  37. data/tests/parser_tests/test_microwatt_decode1_pp.vhd +0 -138
  38. data/tests/parser_tests/test_microwatt_decode2_pp.vhd +0 -300
  39. data/tests/parser_tests/test_microwatt_decode_types_pp.vhd +0 -67
  40. data/tests/parser_tests/test_microwatt_divider_pp.vhd +0 -132
  41. data/tests/parser_tests/test_microwatt_divider_tb_pp.vhd +0 -95
  42. data/tests/parser_tests/test_microwatt_dmi_dtm_dummy_pp.vhd +0 -29
  43. data/tests/parser_tests/test_microwatt_dmi_dtm_tb_pp.vhd +0 -197
  44. data/tests/parser_tests/test_microwatt_dmi_dtm_xilinx_pp.vhd +0 -139
  45. data/tests/parser_tests/test_microwatt_execute1_pp.vhd +0 -689
  46. data/tests/parser_tests/test_microwatt_fetch1_pp.vhd +0 -88
  47. data/tests/parser_tests/test_microwatt_fetch2_pp.vhd +0 -79
  48. data/tests/parser_tests/test_microwatt_glibc_random_helpers_pp.vhd +0 -25
  49. data/tests/parser_tests/test_microwatt_glibc_random_pp.vhd +0 -41
  50. data/tests/parser_tests/test_microwatt_gpr_hazard_pp.vhd +0 -68
  51. data/tests/parser_tests/test_microwatt_helpers_pp.vhd +0 -153
  52. data/tests/parser_tests/test_microwatt_icache_pp.vhd +0 -337
  53. data/tests/parser_tests/test_microwatt_icache_tb_pp.vhd +0 -104
  54. data/tests/parser_tests/test_microwatt_insn_helpers_pp.vhd +0 -208
  55. data/tests/parser_tests/test_microwatt_loadstore1_pp.vhd +0 -222
  56. data/tests/parser_tests/test_microwatt_logical_pp.vhd +0 -87
  57. data/tests/parser_tests/test_microwatt_multiply_pp.vhd +0 -84
  58. data/tests/parser_tests/test_microwatt_multiply_tb_pp.vhd +0 -75
  59. data/tests/parser_tests/test_microwatt_plru_pp.vhd +0 -46
  60. data/tests/parser_tests/test_microwatt_plru_tb_pp.vhd +0 -93
  61. data/tests/parser_tests/test_microwatt_ppc_fx_insns_pp.vhd +0 -665
  62. data/tests/parser_tests/test_microwatt_register_file_pp.vhd +0 -86
  63. data/tests/parser_tests/test_microwatt_rotator_pp.vhd +0 -149
  64. data/tests/parser_tests/test_microwatt_rotator_tb_pp.vhd +0 -134
  65. data/tests/parser_tests/test_microwatt_sim_bram_helpers_pp.vhd +0 -52
  66. data/tests/parser_tests/test_microwatt_sim_bram_pp.vhd +0 -53
  67. data/tests/parser_tests/test_microwatt_sim_console_pp.vhd +0 -43
  68. data/tests/parser_tests/test_microwatt_sim_jtag_pp.vhd +0 -64
  69. data/tests/parser_tests/test_microwatt_sim_jtag_socket_pp.vhd +0 -36
  70. data/tests/parser_tests/test_microwatt_sim_uart_pp.vhd +0 -90
  71. data/tests/parser_tests/test_microwatt_soc_pp.vhd +0 -195
  72. data/tests/parser_tests/test_microwatt_utils_pp.vhd +0 -39
  73. data/tests/parser_tests/test_microwatt_wishbone_arbiter_pp.vhd +0 -54
  74. data/tests/parser_tests/test_microwatt_wishbone_bram_tb_pp.vhd +0 -157
  75. data/tests/parser_tests/test_microwatt_wishbone_bram_wrapper_pp.vhd +0 -62
  76. data/tests/parser_tests/test_microwatt_wishbone_debug_master_pp.vhd +0 -124
  77. data/tests/parser_tests/test_microwatt_wishbone_types_pp.vhd +0 -38
  78. data/tests/parser_tests/test_microwatt_writeback_pp.vhd +0 -87
  79. data/tests/parser_tests/test_package-1_pp.vhd +0 -53
  80. data/tests/parser_tests/test_precedence_pp.vhd +0 -16
  81. data/tests/parser_tests/test_selected_sig_pp.vhd +0 -10
  82. data/tests/parser_tests/test_slice_pp.vhd +0 -16
  83. data/tests/parser_tests/test_tb-00_pp.vhd +0 -71
  84. data/tests/parser_tests/test_type_decl_02_pp.vhd +0 -11
  85. data/tests/parser_tests/test_use_pp.vhd +0 -10
  86. data/tests/parser_tests/test_while_1_pp.vhd +0 -26
  87. data/tests/parser_tests/test_with-00_pp.vhd +0 -12
  88. data/tests/tb_gen_tests/test_accelerator.vhd +0 -160
@@ -1,125 +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 fsm is
7
- port(
8
- reset_n : in std_logic;
9
- clk : in std_logic;
10
- switches : in std_logic_vector(7 downto 0);
11
- leds : out std_logic_vector(7 downto 0));
12
- end entity fsm;
13
-
14
- library ieee;
15
- use ieee.std_logic_1164.all;
16
- use ieee.numeric_std.all;
17
- architecture rtl of fsm is
18
- signal wrap_reset_n : std_logic;
19
- signal wrap_clk : std_logic;
20
- signal wrap_switches : std_logic_vector(7 downto 0);
21
- signal wrap_leds : std_logic_vector(7 downto 0);
22
- signal state : std_logic_vector(2 downto 0);
23
- signal state_c : std_logic_vector(2 downto 0);
24
- signal n4_o : std_logic;
25
- signal n9_q : std_logic_vector(2 downto 0);
26
- signal n12_o : std_logic;
27
- signal n14_o : std_logic_vector(2 downto 0);
28
- signal n15_o : std_logic;
29
- signal n17_o : std_logic_vector(2 downto 0);
30
- signal n18_o : std_logic;
31
- signal n20_o : std_logic_vector(2 downto 0);
32
- signal n21_o : std_logic;
33
- signal n23_o : std_logic_vector(2 downto 0);
34
- signal n24_o : std_logic;
35
- signal n26_o : std_logic_vector(2 downto 0);
36
- signal n27_o : std_logic;
37
- signal n29_o : std_logic_vector(2 downto 0);
38
- signal n30_o : std_logic;
39
- signal n32_o : std_logic_vector(2 downto 0);
40
- signal n33_o : std_logic;
41
- signal n35_o : std_logic_vector(2 downto 0);
42
- signal n36_o : std_logic_vector(1 downto 0);
43
- signal n37_o : std_logic_vector(2 downto 0);
44
- signal n38_o : std_logic_vector(2 downto 0);
45
- signal n39_o : std_logic;
46
- signal n40_o : std_logic_vector(2 downto 0);
47
- signal n44_o : std_logic;
48
- signal n45_o : std_logic_vector(7 downto 0);
49
- signal n48_o : std_logic;
50
- signal n49_o : std_logic_vector(7 downto 0);
51
- signal n52_o : std_logic;
52
- signal n53_o : std_logic_vector(7 downto 0);
53
- signal n56_o : std_logic;
54
- signal n57_o : std_logic_vector(7 downto 0);
55
- signal n60_o : std_logic;
56
- signal n61_o : std_logic_vector(7 downto 0);
57
- signal n64_o : std_logic;
58
- signal n65_o : std_logic_vector(7 downto 0);
59
- signal n68_o : std_logic;
60
- signal n69_o : std_logic_vector(7 downto 0);
61
- begin
62
-
63
- wrap_reset_n <= reset_n;
64
- wrap_clk <= clk;
65
- wrap_switches <= switches;
66
- leds <= wrap_leds;
67
- wrap_leds <= n45_o;
68
- state <= n9_q;
69
- state_c <= n40_o;
70
- n4_o <= wrap_reset_n;
71
-
72
- process(wrap_clk,n4_o)
73
- begin
74
- if n4_o = '1' then
75
- n9_q <= "000";
76
- elsif rising_edge(wrap_clk) then
77
- n9_q <= state_c;
78
- end if;
79
- end process;
80
- n12_o <= wrap_switches(0);
81
- n14_o <= state when n12_o = '0' else "001";
82
- n15_o <= wrap_switches(1);
83
- n17_o <= state when n15_o = '0' else "010";
84
- n18_o <= wrap_switches(2);
85
- n20_o <= state when n18_o = '0' else "011";
86
- n21_o <= wrap_switches(3);
87
- n23_o <= state when n21_o = '0' else "100";
88
- n24_o <= wrap_switches(4);
89
- n26_o <= state when n24_o = '0' else "101";
90
- n27_o <= wrap_switches(5);
91
- n29_o <= state when n27_o = '0' else "110";
92
- n30_o <= wrap_switches(6);
93
- n32_o <= state when n30_o = '0' else "111";
94
- n33_o <= wrap_switches(7);
95
- n35_o <= state when n33_o = '0' else "000";
96
- n36_o <= state(1 downto 0);
97
- with n36_o select n37_o <=
98
- n14_o when "00",
99
- n17_o when "01",
100
- n20_o when "10",
101
- n23_o when "11",
102
- "xxx" when others,;
103
- with n36_o select n38_o <=
104
- n26_o when "00",
105
- n29_o when "01",
106
- n32_o when "10",
107
- n35_o when "11",
108
- "xxx" when others,;
109
- n39_o <= state(2);
110
- n40_o <= n37_o when n39_o = '0' else n38_o;
111
- n44_o <= '1' when state = "000" else '0';
112
- n45_o <= n49_o when n44_o = '0' else "00000000";
113
- n48_o <= '1' when state = "001" else '0';
114
- n49_o <= n53_o when n48_o = '0' else "00000001";
115
- n52_o <= '1' when state = "010" else '0';
116
- n53_o <= n57_o when n52_o = '0' else "00000010";
117
- n56_o <= '1' when state = "011" else '0';
118
- n57_o <= n61_o when n56_o = '0' else "00000011";
119
- n60_o <= '1' when state = "100" else '0';
120
- n61_o <= n65_o when n60_o = '0' else "00000100";
121
- n64_o <= '1' when state = "101" else '0';
122
- n65_o <= n69_o when n64_o = '0' else "00000101";
123
- n68_o <= '1' when state = "110" else '0';
124
- n69_o <= "00000111" when n68_o = '0' else "00000110";
125
- end rtl;
@@ -1,197 +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 fsm is
7
- port(
8
- reset_n : in std_logic;
9
- clk : in std_logic;
10
- switches : in std_logic_vector(7 downto 0);
11
- leds : out std_logic_vector(7 downto 0);
12
- o1 : out std_logic;
13
- o2 : out std_logic;
14
- o3 : out unsigned(3 downto 0));
15
- end entity fsm;
16
-
17
- library ieee;
18
- use ieee.std_logic_1164.all;
19
- use ieee.numeric_std.all;
20
- architecture rtl of fsm is
21
- signal wrap_reset_n : std_logic;
22
- signal wrap_clk : std_logic;
23
- signal wrap_switches : std_logic_vector(7 downto 0);
24
- signal wrap_leds : std_logic_vector(7 downto 0);
25
- signal wrap_o1 : std_logic;
26
- signal wrap_o2 : std_logic;
27
- signal wrap_o3 : std_logic_vector(3 downto 0);
28
- signal state : std_logic_vector(2 downto 0);
29
- signal state_c : std_logic_vector(2 downto 0);
30
- signal c3 : std_logic_vector(3 downto 0);
31
- signal n7_o : std_logic;
32
- signal n12_q : std_logic_vector(2 downto 0);
33
- signal n17_o : std_logic;
34
- signal n19_o : std_logic_vector(2 downto 0);
35
- signal n20_o : std_logic;
36
- signal n22_o : std_logic_vector(2 downto 0);
37
- signal n23_o : std_logic;
38
- signal n25_o : std_logic_vector(2 downto 0);
39
- signal n26_o : std_logic;
40
- signal n28_o : std_logic_vector(2 downto 0);
41
- signal n29_o : std_logic;
42
- signal n31_o : std_logic_vector(2 downto 0);
43
- signal n32_o : std_logic;
44
- signal n35_o : std_logic;
45
- signal n36_o : std_logic_vector(2 downto 0);
46
- signal n37_o : std_logic;
47
- signal n40_o : std_logic;
48
- signal n41_o : std_logic_vector(2 downto 0);
49
- signal n42_o : std_logic;
50
- signal n44_o : std_logic_vector(2 downto 0);
51
- signal n45_o : std_logic_vector(1 downto 0);
52
- signal n46_o : std_logic;
53
- signal n47_o : std_logic;
54
- signal n48_o : std_logic;
55
- signal n49_o : std_logic;
56
- signal n50_o : std_logic_vector(1 downto 0);
57
- signal n51_o : std_logic;
58
- signal n52_o : std_logic;
59
- signal n53_o : std_logic;
60
- signal n54_o : std_logic;
61
- signal n55_o : std_logic_vector(1 downto 0);
62
- signal n56_o : std_logic_vector(2 downto 0);
63
- signal n57_o : std_logic_vector(2 downto 0);
64
- signal n58_o : std_logic;
65
- signal n59_o : std_logic_vector(2 downto 0);
66
- signal n63_o : std_logic;
67
- signal n64_o : std_logic_vector(7 downto 0);
68
- signal n67_o : std_logic;
69
- signal n68_o : std_logic_vector(7 downto 0);
70
- signal n71_o : std_logic;
71
- signal n72_o : std_logic_vector(7 downto 0);
72
- signal n75_o : std_logic;
73
- signal n76_o : std_logic_vector(7 downto 0);
74
- signal n79_o : std_logic;
75
- signal n80_o : std_logic_vector(7 downto 0);
76
- signal n83_o : std_logic;
77
- signal n84_o : std_logic_vector(7 downto 0);
78
- signal n87_o : std_logic;
79
- signal n88_o : std_logic_vector(7 downto 0);
80
- signal n92_o : std_logic;
81
- signal n96_o : std_logic_vector(3 downto 0);
82
- signal n99_q : std_logic_vector(3 downto 0);
83
- begin
84
-
85
- wrap_reset_n <= reset_n;
86
- wrap_clk <= clk;
87
- wrap_switches <= switches;
88
- leds <= wrap_leds;
89
- o1 <= wrap_o1;
90
- o2 <= wrap_o2;
91
- o3 <= unsigned(wrap_o3);
92
- wrap_leds <= n64_o;
93
- wrap_o1 <= n49_o;
94
- wrap_o2 <= n54_o;
95
- wrap_o3 <= c3;
96
- state <= n12_q;
97
- state_c <= n59_o;
98
- c3 <= n99_q;
99
- n7_o <= wrap_reset_n;
100
-
101
- process(wrap_clk,n7_o)
102
- begin
103
- if n7_o = '1' then
104
- n12_q <= "000";
105
- elsif rising_edge(wrap_clk) then
106
- n12_q <= state_c;
107
- end if;
108
- end process;
109
- n17_o <= wrap_switches(0);
110
- n19_o <= state when n17_o = '0' else "001";
111
- n20_o <= wrap_switches(1);
112
- n22_o <= state when n20_o = '0' else "010";
113
- n23_o <= wrap_switches(2);
114
- n25_o <= state when n23_o = '0' else "011";
115
- n26_o <= wrap_switches(3);
116
- n28_o <= state when n26_o = '0' else "100";
117
- n29_o <= wrap_switches(4);
118
- n31_o <= state when n29_o = '0' else "101";
119
- n32_o <= wrap_switches(5);
120
- n35_o <= '0' when n32_o = '0' else '1';
121
- n36_o <= state when n32_o = '0' else "110";
122
- n37_o <= wrap_switches(6);
123
- n40_o <= '1' when n37_o = '0' else '1';
124
- n41_o <= state when n37_o = '0' else "111";
125
- n42_o <= wrap_switches(7);
126
- n44_o <= state when n42_o = '0' else "000";
127
- n45_o <= state(1 downto 0);
128
- with n45_o select n46_o <=
129
- '0' when "00",
130
- '0' when "01",
131
- '0' when "10",
132
- '0' when "11",
133
- 'x' when others,;
134
- with n45_o select n47_o <=
135
- '0' when "00",
136
- n35_o when "01",
137
- '0' when "10",
138
- '0' when "11",
139
- 'x' when others,;
140
- n48_o <= state(2);
141
- n49_o <= n46_o when n48_o = '0' else n47_o;
142
- n50_o <= state(1 downto 0);
143
- with n50_o select n51_o <=
144
- '1' when "00",
145
- '1' when "01",
146
- '1' when "10",
147
- '1' when "11",
148
- 'x' when others,;
149
- with n50_o select n52_o <=
150
- '1' when "00",
151
- '1' when "01",
152
- n40_o when "10",
153
- '1' when "11",
154
- 'x' when others,;
155
- n53_o <= state(2);
156
- n54_o <= n51_o when n53_o = '0' else n52_o;
157
- n55_o <= state(1 downto 0);
158
- with n55_o select n56_o <=
159
- n19_o when "00",
160
- n22_o when "01",
161
- n25_o when "10",
162
- n28_o when "11",
163
- "xxx" when others,;
164
- with n55_o select n57_o <=
165
- n31_o when "00",
166
- n36_o when "01",
167
- n41_o when "10",
168
- n44_o when "11",
169
- "xxx" when others,;
170
- n58_o <= state(2);
171
- n59_o <= n56_o when n58_o = '0' else n57_o;
172
- n63_o <= '1' when state = "000" else '0';
173
- n64_o <= n68_o when n63_o = '0' else "00000000";
174
- n67_o <= '1' when state = "001" else '0';
175
- n68_o <= n72_o when n67_o = '0' else "00000001";
176
- n71_o <= '1' when state = "010" else '0';
177
- n72_o <= n76_o when n71_o = '0' else "00000010";
178
- n75_o <= '1' when state = "011" else '0';
179
- n76_o <= n80_o when n75_o = '0' else "00000011";
180
- n79_o <= '1' when state = "100" else '0';
181
- n80_o <= n84_o when n79_o = '0' else "00000100";
182
- n83_o <= '1' when state = "101" else '0';
183
- n84_o <= n88_o when n83_o = '0' else "00000101";
184
- n87_o <= '1' when state = "110" else '0';
185
- n88_o <= "00000111" when n87_o = '0' else "00000110";
186
- n92_o <= wrap_reset_n;
187
- n96_o <= std_logic_vector(unsigned(c3) + unsigned'("0001"));
188
-
189
- process(wrap_clk,n92_o)
190
- begin
191
- if n92_o = '1' then
192
- n99_q <= "0000";
193
- elsif rising_edge(wrap_clk) then
194
- n99_q <= n96_o;
195
- end if;
196
- end process;
197
- end rtl;
@@ -1,18 +0,0 @@
1
- -- generated by Vertigo VHDL tool
2
- package body lfsr_pkg is
3
-
4
- function many_to_one_fb(data : std_logic_vector;taps : std_logic_vector) return std_logic_vector is
5
- variable xor_taps : std_logic;
6
- variable all_0s : std_logic;
7
- variable feedback : std_logic;
8
- begin
9
- if (data(data'length - 2 downto 0) = 0) then
10
- all_0s := '1';
11
- else
12
- all_0s := '0';
13
- end if;
14
- xor_taps := '0';
15
- feedback := xor_taps xor all_0s;
16
- return data((data'length - 2) downto 0) & feedback;
17
- end function many_to_one_fb;
18
- end lfsr_pkg;
@@ -1,44 +0,0 @@
1
- -- generated by Vertigo VHDL tool
2
- library ieee;
3
- use ieee.std_logic_1164.all;
4
- use ieee.std_logic_unsigned.all;
5
-
6
- package lfsr_pkg is
7
- function many_to_one_fb(data : std_logic_vector;taps : std_logic_vector) return std_logic_vector
8
- function one_to_many_fb(data : std_logic_vector;taps : std_logic_vector) return std_logic_vector
9
-
10
- end lfsr_pkg;
11
-
12
- package body lfsr_pkg is
13
-
14
- function many_to_one_fb(data : std_logic_vector;taps : std_logic_vector) return std_logic_vector is
15
- variable xor_taps : std_logic;
16
- variable all_0s : std_logic;
17
- variable feedback : std_logic;
18
- begin
19
- if (data(data'length - 2 downto 0) = 0) then
20
- all_0s := '1';
21
- else
22
- all_0s := '0';
23
- end if;
24
- xor_taps := '0';
25
- feedback := xor_taps xor all_0s;
26
- return data((data'length - 2) downto 0) & feedback;
27
- end function many_to_one_fb;
28
-
29
- function one_to_many_fb(data : std_logic_vector;taps : std_logic_vector) return std_logic_vector is
30
- variable xor_taps : std_logic;
31
- variable all_0s : std_logic;
32
- variable feedback : std_logic;
33
- variable result : std_logic_vector(data'length - 1 downto 0);
34
- begin
35
- if (data(data'length - 2 downto 0) = 0) then
36
- all_0s := '1';
37
- else
38
- all_0s := '0';
39
- end if;
40
- feedback := data(data'length - 1) xor all_0s;
41
- result(0) := feedback;
42
- return result;
43
- end function one_to_many_fb;
44
- end lfsr_pkg;
@@ -1,68 +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 cache_ram is
8
- generic(
9
- row_bits : integer16 := 16;
10
- width : integer64 := 64;
11
- trace : booleanfalse := false;
12
- add_buf : booleanfalse := false);
13
- port(
14
- clk : in std_logic;
15
- rd_en : in std_logic;
16
- rd_addr : in std_logic_vector(row_bits - 1 downto 0);
17
- rd_data : out std_logic_vector(width - 1 downto 0);
18
- wr_en : in std_logic;
19
- wr_sel : in std_logic_vector(width / 8 - 1 downto 0);
20
- wr_addr : in std_logic_vector(row_bits - 1 downto 0);
21
- wr_data : in std_logic_vector(width - 1 downto 0));
22
- end entity cache_ram;
23
-
24
- architecture rtl of cache_ram is
25
- constant size : integer := 2 ** row_bits;
26
-
27
- type ram_type is array(range 0 to size - 1) of std_logic_vector(width - 1 downto 0);
28
- signal ram : ram_type;
29
- attribute ram_style : string;
30
- attribute ram_style of ram : signal is "block";
31
- attribute ram_decomp : string;
32
- attribute ram_decomp of ram : signal is "power";
33
- signal rd_data0 : std_logic_vector(width - 1 downto 0);
34
- begin
35
-
36
-
37
- process(clk)
38
- variable lbit : integer range 0 to width - 1;
39
- variable mbit : integer range 0 to width - 1;
40
- variable widx : integer range 0 to size - 1;
41
- begin
42
- if rising_edge(clk) then
43
- if wr_en = '1' then
44
- if trace then
45
- report "write a:" & to_hstring(wr_addr) & " sel:" & to_hstring(wr_sel) & " dat:" & to_hstring(wr_data);
46
- end if;
47
- end if;
48
- if rd_en = '1' then
49
- rd_data0 <= ram(to_integer(unsigned(rd_addr)));
50
- if trace then
51
- report "read a:" & to_hstring(rd_addr) & " dat:" & to_hstring(ram(to_integer(unsigned(rd_addr))));
52
- end if;
53
- end if;
54
- end if;
55
- end process;
56
- if add_buf generate
57
-
58
- process(clk)
59
- begin
60
- if rising_edge(clk) then
61
- rd_data <= rd_data0;
62
- end if;
63
- end process;
64
- end generate;
65
- if add_buf generate
66
- rd_data <= rd_data0;
67
- end generate;
68
- end rtl;