vertigo_vhdl 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. checksums.yaml +7 -0
  2. data/bin/vertigo +7 -0
  3. data/lib/vertigo.rb +4 -0
  4. data/lib/vertigo/ast.rb +87 -0
  5. data/lib/vertigo/ast_vertigo_rkgen.rb +607 -0
  6. data/lib/vertigo/code.rb +57 -0
  7. data/lib/vertigo/compiler.rb +61 -0
  8. data/lib/vertigo/generic_lexer.rb +61 -0
  9. data/lib/vertigo/generic_parser.rb +44 -0
  10. data/lib/vertigo/indent.rb +20 -0
  11. data/lib/vertigo/lexer.rb +172 -0
  12. data/lib/vertigo/parser.rb +1458 -0
  13. data/lib/vertigo/pretty_printer.rb +749 -0
  14. data/lib/vertigo/runner.rb +115 -0
  15. data/lib/vertigo/tb_generator.rb +81 -0
  16. data/lib/vertigo/template.tb.vhd +72 -0
  17. data/lib/vertigo/token.rb +67 -0
  18. data/lib/vertigo/version.rb +3 -0
  19. data/lib/vertigo/vertigo.rkg +354 -0
  20. data/lib/vertigo/visitor_vertigo_rkgen.rb +447 -0
  21. data/tests/ghdl_tests/fsm.vhd +98 -0
  22. data/tests/ghdl_tests/fsm_synth.vhd +248 -0
  23. data/tests/ghdl_tests/test_fsm.vhd +162 -0
  24. data/tests/parser_tests/else.vhd +64 -0
  25. data/tests/parser_tests/test_MUST_fail.vhd +1 -0
  26. data/tests/parser_tests/test_accelerator.vhd +160 -0
  27. data/tests/parser_tests/test_accelerator_pp.vhd +144 -0
  28. data/tests/parser_tests/test_aggregate.vhd +17 -0
  29. data/tests/parser_tests/test_aggregate_pp.vhd +15 -0
  30. data/tests/parser_tests/test_archi_1.vhd +45 -0
  31. data/tests/parser_tests/test_archi_1_pp.vhd +41 -0
  32. data/tests/parser_tests/test_array_array_00.vhd +25 -0
  33. data/tests/parser_tests/test_array_array_00_pp.vhd +25 -0
  34. data/tests/parser_tests/test_array_urange.vhd +25 -0
  35. data/tests/parser_tests/test_array_urange_pp.vhd +25 -0
  36. data/tests/parser_tests/test_chu-1.vhd +80 -0
  37. data/tests/parser_tests/test_chu-1_pp.vhd +104 -0
  38. data/tests/parser_tests/test_concat.vhd +11 -0
  39. data/tests/parser_tests/test_concat_pp.vhd +14 -0
  40. data/tests/parser_tests/test_counter.vhd +35 -0
  41. data/tests/parser_tests/test_counter_pp.vhd +35 -0
  42. data/tests/parser_tests/test_de2.vhd +358 -0
  43. data/tests/parser_tests/test_de2_pp.vhd +274 -0
  44. data/tests/parser_tests/test_encode.vhd +2679 -0
  45. data/tests/parser_tests/test_encode_pp.vhd +2549 -0
  46. data/tests/parser_tests/test_fsm.vhd +162 -0
  47. data/tests/parser_tests/test_fsm_pp.vhd +125 -0
  48. data/tests/parser_tests/test_fsm_synth.vhd +248 -0
  49. data/tests/parser_tests/test_fsm_synth_pp.vhd +197 -0
  50. data/tests/parser_tests/test_function-01.vhd +33 -0
  51. data/tests/parser_tests/test_function-01_pp.vhd +18 -0
  52. data/tests/parser_tests/test_lfsr.vhd +75 -0
  53. data/tests/parser_tests/test_lfsr_pp.vhd +44 -0
  54. data/tests/parser_tests/test_microwatt_cache_ram.vhd +1 -0
  55. data/tests/parser_tests/test_microwatt_cache_ram_pp.vhd +68 -0
  56. data/tests/parser_tests/test_microwatt_common.vhd +1 -0
  57. data/tests/parser_tests/test_microwatt_common_pp.vhd +336 -0
  58. data/tests/parser_tests/test_microwatt_control.vhd +1 -0
  59. data/tests/parser_tests/test_microwatt_control_pp.vhd +187 -0
  60. data/tests/parser_tests/test_microwatt_core.vhd +1 -0
  61. data/tests/parser_tests/test_microwatt_core_debug.vhd +1 -0
  62. data/tests/parser_tests/test_microwatt_core_debug_pp.vhd +104 -0
  63. data/tests/parser_tests/test_microwatt_core_pp.vhd +231 -0
  64. data/tests/parser_tests/test_microwatt_core_tb.vhd +1 -0
  65. data/tests/parser_tests/test_microwatt_core_tb_pp.vhd +43 -0
  66. data/tests/parser_tests/test_microwatt_countzero.vhd +1 -0
  67. data/tests/parser_tests/test_microwatt_countzero_pp.vhd +120 -0
  68. data/tests/parser_tests/test_microwatt_countzero_tb.vhd +1 -0
  69. data/tests/parser_tests/test_microwatt_countzero_tb_pp.vhd +70 -0
  70. data/tests/parser_tests/test_microwatt_cr_file.vhd +1 -0
  71. data/tests/parser_tests/test_microwatt_cr_file_pp.vhd +74 -0
  72. data/tests/parser_tests/test_microwatt_cr_hazard.vhd +1 -0
  73. data/tests/parser_tests/test_microwatt_cr_hazard_pp.vhd +51 -0
  74. data/tests/parser_tests/test_microwatt_crhelpers.vhd +1 -0
  75. data/tests/parser_tests/test_microwatt_crhelpers_pp.vhd +48 -0
  76. data/tests/parser_tests/test_microwatt_dcache.vhd +1 -0
  77. data/tests/parser_tests/test_microwatt_dcache_pp.vhd +481 -0
  78. data/tests/parser_tests/test_microwatt_dcache_tb.vhd +1 -0
  79. data/tests/parser_tests/test_microwatt_dcache_tb_pp.vhd +98 -0
  80. data/tests/parser_tests/test_microwatt_decode1.vhd +1 -0
  81. data/tests/parser_tests/test_microwatt_decode1_pp.vhd +138 -0
  82. data/tests/parser_tests/test_microwatt_decode2.vhd +1 -0
  83. data/tests/parser_tests/test_microwatt_decode2_pp.vhd +300 -0
  84. data/tests/parser_tests/test_microwatt_decode_types.vhd +1 -0
  85. data/tests/parser_tests/test_microwatt_decode_types_pp.vhd +67 -0
  86. data/tests/parser_tests/test_microwatt_divider.vhd +1 -0
  87. data/tests/parser_tests/test_microwatt_divider_pp.vhd +132 -0
  88. data/tests/parser_tests/test_microwatt_divider_tb.vhd +1 -0
  89. data/tests/parser_tests/test_microwatt_divider_tb_pp.vhd +95 -0
  90. data/tests/parser_tests/test_microwatt_dmi_dtm_dummy.vhd +1 -0
  91. data/tests/parser_tests/test_microwatt_dmi_dtm_dummy_pp.vhd +29 -0
  92. data/tests/parser_tests/test_microwatt_dmi_dtm_tb.vhd +1 -0
  93. data/tests/parser_tests/test_microwatt_dmi_dtm_tb_pp.vhd +197 -0
  94. data/tests/parser_tests/test_microwatt_dmi_dtm_xilinx.vhd +1 -0
  95. data/tests/parser_tests/test_microwatt_dmi_dtm_xilinx_pp.vhd +139 -0
  96. data/tests/parser_tests/test_microwatt_execute1.vhd +1 -0
  97. data/tests/parser_tests/test_microwatt_execute1_pp.vhd +689 -0
  98. data/tests/parser_tests/test_microwatt_fetch1.vhd +1 -0
  99. data/tests/parser_tests/test_microwatt_fetch1_pp.vhd +88 -0
  100. data/tests/parser_tests/test_microwatt_fetch2.vhd +1 -0
  101. data/tests/parser_tests/test_microwatt_fetch2_pp.vhd +79 -0
  102. data/tests/parser_tests/test_microwatt_glibc_random.vhd +1 -0
  103. data/tests/parser_tests/test_microwatt_glibc_random_helpers.vhd +1 -0
  104. data/tests/parser_tests/test_microwatt_glibc_random_helpers_pp.vhd +25 -0
  105. data/tests/parser_tests/test_microwatt_glibc_random_pp.vhd +41 -0
  106. data/tests/parser_tests/test_microwatt_gpr_hazard.vhd +1 -0
  107. data/tests/parser_tests/test_microwatt_gpr_hazard_pp.vhd +68 -0
  108. data/tests/parser_tests/test_microwatt_helpers.vhd +1 -0
  109. data/tests/parser_tests/test_microwatt_helpers_pp.vhd +153 -0
  110. data/tests/parser_tests/test_microwatt_icache.vhd +1 -0
  111. data/tests/parser_tests/test_microwatt_icache_pp.vhd +337 -0
  112. data/tests/parser_tests/test_microwatt_icache_tb.vhd +1 -0
  113. data/tests/parser_tests/test_microwatt_icache_tb_pp.vhd +104 -0
  114. data/tests/parser_tests/test_microwatt_insn_helpers.vhd +1 -0
  115. data/tests/parser_tests/test_microwatt_insn_helpers_pp.vhd +208 -0
  116. data/tests/parser_tests/test_microwatt_loadstore1.vhd +1 -0
  117. data/tests/parser_tests/test_microwatt_loadstore1_pp.vhd +222 -0
  118. data/tests/parser_tests/test_microwatt_logical.vhd +1 -0
  119. data/tests/parser_tests/test_microwatt_logical_pp.vhd +87 -0
  120. data/tests/parser_tests/test_microwatt_multiply.vhd +1 -0
  121. data/tests/parser_tests/test_microwatt_multiply_pp.vhd +84 -0
  122. data/tests/parser_tests/test_microwatt_multiply_tb.vhd +1 -0
  123. data/tests/parser_tests/test_microwatt_multiply_tb_pp.vhd +75 -0
  124. data/tests/parser_tests/test_microwatt_plru.vhd +1 -0
  125. data/tests/parser_tests/test_microwatt_plru_pp.vhd +46 -0
  126. data/tests/parser_tests/test_microwatt_plru_tb.vhd +1 -0
  127. data/tests/parser_tests/test_microwatt_plru_tb_pp.vhd +93 -0
  128. data/tests/parser_tests/test_microwatt_ppc_fx_insns.vhd +1 -0
  129. data/tests/parser_tests/test_microwatt_ppc_fx_insns_pp.vhd +665 -0
  130. data/tests/parser_tests/test_microwatt_register_file.vhd +1 -0
  131. data/tests/parser_tests/test_microwatt_register_file_pp.vhd +86 -0
  132. data/tests/parser_tests/test_microwatt_rotator.vhd +1 -0
  133. data/tests/parser_tests/test_microwatt_rotator_pp.vhd +149 -0
  134. data/tests/parser_tests/test_microwatt_rotator_tb.vhd +1 -0
  135. data/tests/parser_tests/test_microwatt_rotator_tb_pp.vhd +134 -0
  136. data/tests/parser_tests/test_microwatt_sim_bram.vhd +1 -0
  137. data/tests/parser_tests/test_microwatt_sim_bram_helpers.vhd +1 -0
  138. data/tests/parser_tests/test_microwatt_sim_bram_helpers_pp.vhd +52 -0
  139. data/tests/parser_tests/test_microwatt_sim_bram_pp.vhd +53 -0
  140. data/tests/parser_tests/test_microwatt_sim_console.vhd +1 -0
  141. data/tests/parser_tests/test_microwatt_sim_console_pp.vhd +43 -0
  142. data/tests/parser_tests/test_microwatt_sim_jtag.vhd +1 -0
  143. data/tests/parser_tests/test_microwatt_sim_jtag_pp.vhd +64 -0
  144. data/tests/parser_tests/test_microwatt_sim_jtag_socket.vhd +1 -0
  145. data/tests/parser_tests/test_microwatt_sim_jtag_socket_pp.vhd +36 -0
  146. data/tests/parser_tests/test_microwatt_sim_uart.vhd +1 -0
  147. data/tests/parser_tests/test_microwatt_sim_uart_pp.vhd +90 -0
  148. data/tests/parser_tests/test_microwatt_soc.vhd +1 -0
  149. data/tests/parser_tests/test_microwatt_soc_pp.vhd +195 -0
  150. data/tests/parser_tests/test_microwatt_utils.vhd +1 -0
  151. data/tests/parser_tests/test_microwatt_utils_pp.vhd +39 -0
  152. data/tests/parser_tests/test_microwatt_wishbone_arbiter.vhd +1 -0
  153. data/tests/parser_tests/test_microwatt_wishbone_arbiter_pp.vhd +54 -0
  154. data/tests/parser_tests/test_microwatt_wishbone_bram_tb.vhd +1 -0
  155. data/tests/parser_tests/test_microwatt_wishbone_bram_tb_pp.vhd +157 -0
  156. data/tests/parser_tests/test_microwatt_wishbone_bram_wrapper.vhd +1 -0
  157. data/tests/parser_tests/test_microwatt_wishbone_bram_wrapper_pp.vhd +62 -0
  158. data/tests/parser_tests/test_microwatt_wishbone_debug_master.vhd +1 -0
  159. data/tests/parser_tests/test_microwatt_wishbone_debug_master_pp.vhd +124 -0
  160. data/tests/parser_tests/test_microwatt_wishbone_types.vhd +1 -0
  161. data/tests/parser_tests/test_microwatt_wishbone_types_pp.vhd +38 -0
  162. data/tests/parser_tests/test_microwatt_writeback.vhd +1 -0
  163. data/tests/parser_tests/test_microwatt_writeback_pp.vhd +87 -0
  164. data/tests/parser_tests/test_package-1.vhd +68 -0
  165. data/tests/parser_tests/test_package-1_pp.vhd +53 -0
  166. data/tests/parser_tests/test_precedence.vhd +13 -0
  167. data/tests/parser_tests/test_precedence_pp.vhd +16 -0
  168. data/tests/parser_tests/test_selected_sig.vhd +14 -0
  169. data/tests/parser_tests/test_selected_sig_pp.vhd +10 -0
  170. data/tests/parser_tests/test_slice.vhd +15 -0
  171. data/tests/parser_tests/test_slice_pp.vhd +16 -0
  172. data/tests/parser_tests/test_tb-00.vhd +94 -0
  173. data/tests/parser_tests/test_tb-00_pp.vhd +71 -0
  174. data/tests/parser_tests/test_type_decl_02.vhd +9 -0
  175. data/tests/parser_tests/test_type_decl_02_pp.vhd +11 -0
  176. data/tests/parser_tests/test_use.vhd +7 -0
  177. data/tests/parser_tests/test_use_pp.vhd +10 -0
  178. data/tests/parser_tests/test_while_1.vhd +38 -0
  179. data/tests/parser_tests/test_while_1_pp.vhd +26 -0
  180. data/tests/parser_tests/test_with-00.vhd +21 -0
  181. data/tests/parser_tests/test_with-00_pp.vhd +12 -0
  182. data/tests/tb_gen_tests/test_accelerator.vhd +160 -0
  183. metadata +224 -0
@@ -0,0 +1,71 @@
1
+ -- generated by Vertigo VHDL tool
2
+ library ieee;
3
+ use ieee.std_logic_1164.all;
4
+ use ieee.std_logic_arith.all;
5
+
6
+ entity decoder_tb is
7
+ end entity decoder_tb;
8
+
9
+ architecture tb of decoder_tb is
10
+ signal t_i : std_logic_vector(1 downto 0) := "00";
11
+ signal t_o : std_logic_vector(3 downto 0);
12
+ component decoder is
13
+ port(
14
+ i : in std_logic_vector(1 downto 0);
15
+ o : out std_logic_vector(3 downto 0));
16
+ end component;
17
+ begin
18
+
19
+ u_decoder : component decoder
20
+ port map(
21
+ t_i,
22
+ t_o);
23
+
24
+
25
+ process
26
+ variable err_cnt : integer := 0;
27
+ begin
28
+ wait 10 ns;
29
+ t_i <= "00";
30
+ wait 1 ns;
31
+ assert (t_o = "0001")
32
+ report "error case 0" severity error;
33
+ if (t_o /= "0001") then
34
+ err_cnt := err_cnt + 1;
35
+ end if;
36
+ wait 10 ns;
37
+ t_i <= "01";
38
+ wait 1 ns;
39
+ assert (t_o = "0010")
40
+ report "error case 1" severity error;
41
+ if (t_o /= "0010") then
42
+ err_cnt := err_cnt + 1;
43
+ end if;
44
+ wait 10 ns;
45
+ t_i <= "10";
46
+ wait 1 ns;
47
+ assert (t_o = "0100")
48
+ report "error case 2" severity error;
49
+ if (t_o /= "0100") then
50
+ err_cnt := err_cnt + 1;
51
+ end if;
52
+ wait 10 ns;
53
+ t_i <= "11";
54
+ wait 1 ns;
55
+ assert (t_o = "1000")
56
+ report "error case 3" severity error;
57
+ if (t_o /= "1000") then
58
+ err_cnt := err_cnt + 1;
59
+ end if;
60
+ wait 10 ns;
61
+ t_i <= "uu";
62
+ if (err_cnt = 0) then
63
+ assert false
64
+ report "testbench of adder completed successfully!" severity note;
65
+ else
66
+ assert true
67
+ report "something wrong, try again" severity error;
68
+ end if;
69
+ wait ;
70
+ end process;
71
+ end tb;
@@ -0,0 +1,9 @@
1
+ entity test is
2
+ end;
3
+
4
+ architecture test_var of test is
5
+
6
+ type TestIt is array(natural range <>) of boolean;
7
+
8
+ begin
9
+ end test_var;
@@ -0,0 +1,11 @@
1
+ -- generated by Vertigo VHDL tool
2
+
3
+ entity test is
4
+ end entity test;
5
+
6
+ architecture test_var of test is
7
+
8
+ type testit is array(natural range <>) of boolean;
9
+ begin
10
+
11
+ end test_var;
@@ -0,0 +1,7 @@
1
+ library ieee,std;
2
+ use ieee.std_logic_1164.all;
3
+ use ieee.numeric_std.all;
4
+ use work.accelerator_pkg.all;
5
+
6
+ entity test is
7
+ end entity;
@@ -0,0 +1,10 @@
1
+ -- generated by Vertigo VHDL tool
2
+ library ieee;
3
+ library std;
4
+ use ieee.std_logic_1164.all;
5
+ use ieee.numeric_std.all;
6
+ use work.accelerator_pkg.all;
7
+
8
+ entity test is
9
+ end entity test;
10
+
@@ -0,0 +1,38 @@
1
+
2
+
3
+ architecture test_while of while_tester is
4
+
5
+ begin -- test_while
6
+
7
+ Clk_1 : process (Clock)
8
+ begin
9
+ L1 : loop
10
+ Clock <= not Clock after 5 ns;
11
+ end loop L1;
12
+ end process Clk_1;
13
+
14
+ process
15
+ begin
16
+ L2 : loop
17
+ A := A+1;
18
+ exit L2 when A > 10;
19
+ end loop L2;
20
+ end process;
21
+
22
+ Shift_3 : process (Input_X)
23
+ variable i : positive := 1;
24
+ begin
25
+ L3 : while i <= 8 loop
26
+ Output_X(i) <= Input_X(i+8) after 5 ns;
27
+ i := i + 1;
28
+ end loop L3;
29
+ end process Shift_3;
30
+
31
+ Shift_4 : process (Input_X)
32
+ begin
33
+ L4 : for count_value in 1 to 8 loop
34
+ Output_X(count_value) <= Input_X(count_value + 8) after 5 ns;
35
+ end loop L4;
36
+ end process Shift_4;
37
+
38
+ end test_while;
@@ -0,0 +1,26 @@
1
+ -- generated by Vertigo VHDL tool
2
+ architecture test_while of while_tester is
3
+ begin
4
+
5
+
6
+ clk_1 : process(clock)
7
+ begin
8
+ ;
9
+ end process;
10
+
11
+ process
12
+ begin
13
+ ;
14
+ end process;
15
+
16
+ shift_3 : process(input_x)
17
+ variable i : positive := 1;
18
+ begin
19
+ ;
20
+ end process;
21
+
22
+ shift_4 : process(input_x)
23
+ begin
24
+ ;
25
+ end process;
26
+ end test_while;
@@ -0,0 +1,21 @@
1
+
2
+
3
+ architecture flow of ttimer is
4
+
5
+ begin
6
+
7
+ with s_sum select
8
+ dig_sig1 <= "10000001" when 0,
9
+ "11001111" when 1,
10
+ "10010010" when 2,
11
+ "10000110" when 3,
12
+ "10000100" when 59;
13
+
14
+ dig_sig0 <= "10000001" when s_sum >= 0 and s_sum <= 9 else
15
+ "11001111" when s_sum >=10 and s_sum <= 19 else
16
+ "10010010" when s_sum >=20 and s_sum <= 29 else
17
+ "10000110" when s_sum >=30 and s_sum <= 39 else
18
+ "11001100" when s_sum >=40 and s_sum <= 49 else
19
+ "10100100" ;
20
+
21
+ end flow;
@@ -0,0 +1,12 @@
1
+ -- generated by Vertigo VHDL tool
2
+ architecture flow of ttimer is
3
+ begin
4
+
5
+ with s_sum select dig_sig1 <=
6
+ "10000001" when 0,
7
+ "11001111" when 1,
8
+ "10010010" when 2,
9
+ "10000110" when 3,
10
+ "10000100" when 59,;
11
+ dig_sig0 <= "10000001" when s_sum >= 0 and s_sum <= 9 else "11001111" when s_sum >= 10 and s_sum <= 19 else "10010010" when s_sum >= 20 and s_sum <= 29 else "10000110" when s_sum >= 30 and s_sum <= 39 else "11001100" when s_sum >= 40 and s_sum <= 49 else "10100100";
12
+ end flow;
@@ -0,0 +1,160 @@
1
+ library ieee,std;
2
+ use ieee.std_logic_1164.all;
3
+ use ieee.numeric_std.all;
4
+ use work.accelerator_pkg.all;
5
+
6
+ entity accelerator is
7
+ port(
8
+ clock : in std_logic;
9
+ reset_n : in std_logic;
10
+ bus_addr : in std_logic_vector(31 downto 0);
11
+ bus_data_p2a : in std_logic_vector(31 downto 0);
12
+ bus_data_a2p : out std_logic_vector(31 downto 0);
13
+ bus_rd : in std_logic;
14
+ bus_wr : in std_logic
15
+ );
16
+ end accelerator;
17
+
18
+ architecture rtl of accelerator is
19
+
20
+ type regs_t is record
21
+ a, b, res : std_logic_vector(31 downto 0);
22
+ ctrl : std_logic;
23
+ status : std_logic_vector(1 downto 0); --busy,done
24
+ end record;
25
+
26
+ constant INIT_REGS : regs_t := (
27
+ (others => '0'),
28
+ (others => '0'),
29
+ (others => '0'),
30
+ '0',
31
+ "00"
32
+ );
33
+
34
+ signal ifregs : regs_t;
35
+
36
+ type state_t is (idle, running);
37
+ signal state, state_c : state_t;
38
+
39
+ type vars_t is record
40
+ go : std_logic;
41
+ a, b : unsigned(31 downto 0);
42
+ done : std_logic;
43
+ end record;
44
+
45
+ -- constant VARS_INIT : vars_t := (
46
+ -- '0',
47
+ -- to_unsigned(0, 32),
48
+ -- to_unsigned(0, 32),
49
+ -- '0');
50
+
51
+ signal vars, vars_c : vars_t;
52
+
53
+ begin
54
+ --========================================
55
+ -- Bus interface
56
+ --========================================
57
+ bus_wr_proc : process(clk, reset_n)
58
+ begin
59
+ if reset_n = '0' then
60
+ ifregs <= INIT_REGS;
61
+ elsif rising_edge(clk) then
62
+ ifregs.ctrl <= '0'; --autoreset
63
+ if bus_wr = '1' then
64
+ case bus_addr is
65
+ when ADDR_A =>
66
+ ifregs.a <= bus_data_p2a;
67
+ when ADDR_B =>
68
+ ifregs.b <= bus_data_p2a;
69
+ when ADDR_CTRL =>
70
+ ifregs.ctrl <= bus_data_p2a(0); --write/clear a go
71
+ when ADDR_STATUS =>
72
+ ifregs.status <= bus_data_p2a(1 downto 0); --clear rdy
73
+ when others => null;
74
+ end case;
75
+ elsif vars.done = '1' then
76
+ ifregs.res <= std_logic_vector(vars.a); --BUG : vars.a ne passait pas
77
+ --=> FIX lexer : selected_name
78
+ --ifregs.status(0) <= vars.done; --BUG : (0) ne passe pas
79
+ ifregs.status <= vars.done; --BUG : (0) ne passe pas
80
+ end if;
81
+ end if;
82
+ end process;
83
+
84
+ bus_rd_proc : process(reset_n, clk)
85
+ begin
86
+ if reset_n = '0' then
87
+ bus_data_a2p <= (others => '0');
88
+ elsif rising_edge(clk) then
89
+ if bus_rd = '1' then
90
+ case bus_addr is
91
+ when ADDR_A =>
92
+ bus_data_a2p <= ifregs.a;
93
+ when ADDR_B =>
94
+ bus_data_a2p <= ifregs.b;
95
+ when ADDR_CTRL =>
96
+ null;
97
+ --bus_data_a2p <= X"0000000" & "000" & ifregs.ctrl; --write/clear a go
98
+ when ADDR_STATUS =>
99
+ null;
100
+ bus_data_a2p <= X"0000000" & "00" & ifregs.status;
101
+ when ADDR_RES =>
102
+ bus_data_a2p <= ifregs.res;
103
+ when others => null;
104
+ end case;
105
+ end if;
106
+ end if;
107
+ end process;
108
+
109
+ --=============================================
110
+ -- BUG
111
+ --=============================================
112
+
113
+ reg : process(clk, reset_n)
114
+ begin
115
+ if reset_n = '0' then
116
+ state <= idle;
117
+ vars <= VARS_INIT;
118
+ elsif rising_edge(clk) then
119
+ state <= state_c;
120
+ vars <= vars_c;
121
+ if ifregs.ctrl = '1' then
122
+ vars.a <= unsigned(ifregs.a);
123
+ vars.b <= unsigned(ifregs.b);
124
+ vars.go <= '1';
125
+ end if;
126
+ end if;
127
+ end process;
128
+
129
+ comb : process (state, vars)
130
+ variable state_v : state_t;
131
+ variable vars_v : vars_t;
132
+ begin
133
+ state_v := state;
134
+ vars_v := vars;
135
+ case state_v is
136
+ when idle =>
137
+ if vars_v.go = '1' then
138
+ state_v := running;
139
+ vars_v.go := '0';
140
+ else
141
+ vars_v := VARS_INIT;
142
+ end if;
143
+ when running =>
144
+ if vars_v.a /= vars_v.b then
145
+ if vars_v.a > vars_v.b then
146
+ vars_v.a := vars_v.a-vars_v.b;
147
+ else
148
+ vars_v.b := vars_v.b-vars_v.a;
149
+ end if;
150
+ else
151
+ vars_v.done := '1';
152
+ state_v := idle;
153
+ end if;
154
+ when others => null;
155
+ end case;
156
+ state_c <= state_v;
157
+ vars_c <= vars_v;
158
+ end process;
159
+
160
+ end rtl;
metadata ADDED
@@ -0,0 +1,224 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vertigo_vhdl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.2
5
+ platform: ruby
6
+ authors:
7
+ - Jean-Christophe Le Lann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Ruby handwritten VHDL parser and utilities
14
+ email: jean-christophe.le_lann@ensta-bretagne.fr
15
+ executables:
16
+ - vertigo
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/vertigo
21
+ - lib/vertigo.rb
22
+ - lib/vertigo/ast.rb
23
+ - lib/vertigo/ast_vertigo_rkgen.rb
24
+ - lib/vertigo/code.rb
25
+ - lib/vertigo/compiler.rb
26
+ - lib/vertigo/generic_lexer.rb
27
+ - lib/vertigo/generic_parser.rb
28
+ - lib/vertigo/indent.rb
29
+ - lib/vertigo/lexer.rb
30
+ - lib/vertigo/parser.rb
31
+ - lib/vertigo/pretty_printer.rb
32
+ - lib/vertigo/runner.rb
33
+ - lib/vertigo/tb_generator.rb
34
+ - lib/vertigo/template.tb.vhd
35
+ - lib/vertigo/token.rb
36
+ - lib/vertigo/version.rb
37
+ - lib/vertigo/vertigo.rkg
38
+ - lib/vertigo/visitor_vertigo_rkgen.rb
39
+ - tests/ghdl_tests/fsm.vhd
40
+ - tests/ghdl_tests/fsm_synth.vhd
41
+ - tests/ghdl_tests/test_fsm.vhd
42
+ - tests/parser_tests/else.vhd
43
+ - tests/parser_tests/test_MUST_fail.vhd
44
+ - tests/parser_tests/test_accelerator.vhd
45
+ - tests/parser_tests/test_accelerator_pp.vhd
46
+ - tests/parser_tests/test_aggregate.vhd
47
+ - tests/parser_tests/test_aggregate_pp.vhd
48
+ - tests/parser_tests/test_archi_1.vhd
49
+ - tests/parser_tests/test_archi_1_pp.vhd
50
+ - tests/parser_tests/test_array_array_00.vhd
51
+ - tests/parser_tests/test_array_array_00_pp.vhd
52
+ - tests/parser_tests/test_array_urange.vhd
53
+ - tests/parser_tests/test_array_urange_pp.vhd
54
+ - tests/parser_tests/test_chu-1.vhd
55
+ - tests/parser_tests/test_chu-1_pp.vhd
56
+ - tests/parser_tests/test_concat.vhd
57
+ - tests/parser_tests/test_concat_pp.vhd
58
+ - tests/parser_tests/test_counter.vhd
59
+ - tests/parser_tests/test_counter_pp.vhd
60
+ - tests/parser_tests/test_de2.vhd
61
+ - tests/parser_tests/test_de2_pp.vhd
62
+ - tests/parser_tests/test_encode.vhd
63
+ - tests/parser_tests/test_encode_pp.vhd
64
+ - tests/parser_tests/test_fsm.vhd
65
+ - tests/parser_tests/test_fsm_pp.vhd
66
+ - tests/parser_tests/test_fsm_synth.vhd
67
+ - tests/parser_tests/test_fsm_synth_pp.vhd
68
+ - tests/parser_tests/test_function-01.vhd
69
+ - tests/parser_tests/test_function-01_pp.vhd
70
+ - tests/parser_tests/test_lfsr.vhd
71
+ - tests/parser_tests/test_lfsr_pp.vhd
72
+ - tests/parser_tests/test_microwatt_cache_ram.vhd
73
+ - tests/parser_tests/test_microwatt_cache_ram_pp.vhd
74
+ - tests/parser_tests/test_microwatt_common.vhd
75
+ - tests/parser_tests/test_microwatt_common_pp.vhd
76
+ - tests/parser_tests/test_microwatt_control.vhd
77
+ - tests/parser_tests/test_microwatt_control_pp.vhd
78
+ - tests/parser_tests/test_microwatt_core.vhd
79
+ - tests/parser_tests/test_microwatt_core_debug.vhd
80
+ - tests/parser_tests/test_microwatt_core_debug_pp.vhd
81
+ - tests/parser_tests/test_microwatt_core_pp.vhd
82
+ - tests/parser_tests/test_microwatt_core_tb.vhd
83
+ - tests/parser_tests/test_microwatt_core_tb_pp.vhd
84
+ - tests/parser_tests/test_microwatt_countzero.vhd
85
+ - tests/parser_tests/test_microwatt_countzero_pp.vhd
86
+ - tests/parser_tests/test_microwatt_countzero_tb.vhd
87
+ - tests/parser_tests/test_microwatt_countzero_tb_pp.vhd
88
+ - tests/parser_tests/test_microwatt_cr_file.vhd
89
+ - tests/parser_tests/test_microwatt_cr_file_pp.vhd
90
+ - tests/parser_tests/test_microwatt_cr_hazard.vhd
91
+ - tests/parser_tests/test_microwatt_cr_hazard_pp.vhd
92
+ - tests/parser_tests/test_microwatt_crhelpers.vhd
93
+ - tests/parser_tests/test_microwatt_crhelpers_pp.vhd
94
+ - tests/parser_tests/test_microwatt_dcache.vhd
95
+ - tests/parser_tests/test_microwatt_dcache_pp.vhd
96
+ - tests/parser_tests/test_microwatt_dcache_tb.vhd
97
+ - tests/parser_tests/test_microwatt_dcache_tb_pp.vhd
98
+ - tests/parser_tests/test_microwatt_decode1.vhd
99
+ - tests/parser_tests/test_microwatt_decode1_pp.vhd
100
+ - tests/parser_tests/test_microwatt_decode2.vhd
101
+ - tests/parser_tests/test_microwatt_decode2_pp.vhd
102
+ - tests/parser_tests/test_microwatt_decode_types.vhd
103
+ - tests/parser_tests/test_microwatt_decode_types_pp.vhd
104
+ - tests/parser_tests/test_microwatt_divider.vhd
105
+ - tests/parser_tests/test_microwatt_divider_pp.vhd
106
+ - tests/parser_tests/test_microwatt_divider_tb.vhd
107
+ - tests/parser_tests/test_microwatt_divider_tb_pp.vhd
108
+ - tests/parser_tests/test_microwatt_dmi_dtm_dummy.vhd
109
+ - tests/parser_tests/test_microwatt_dmi_dtm_dummy_pp.vhd
110
+ - tests/parser_tests/test_microwatt_dmi_dtm_tb.vhd
111
+ - tests/parser_tests/test_microwatt_dmi_dtm_tb_pp.vhd
112
+ - tests/parser_tests/test_microwatt_dmi_dtm_xilinx.vhd
113
+ - tests/parser_tests/test_microwatt_dmi_dtm_xilinx_pp.vhd
114
+ - tests/parser_tests/test_microwatt_execute1.vhd
115
+ - tests/parser_tests/test_microwatt_execute1_pp.vhd
116
+ - tests/parser_tests/test_microwatt_fetch1.vhd
117
+ - tests/parser_tests/test_microwatt_fetch1_pp.vhd
118
+ - tests/parser_tests/test_microwatt_fetch2.vhd
119
+ - tests/parser_tests/test_microwatt_fetch2_pp.vhd
120
+ - tests/parser_tests/test_microwatt_glibc_random.vhd
121
+ - tests/parser_tests/test_microwatt_glibc_random_helpers.vhd
122
+ - tests/parser_tests/test_microwatt_glibc_random_helpers_pp.vhd
123
+ - tests/parser_tests/test_microwatt_glibc_random_pp.vhd
124
+ - tests/parser_tests/test_microwatt_gpr_hazard.vhd
125
+ - tests/parser_tests/test_microwatt_gpr_hazard_pp.vhd
126
+ - tests/parser_tests/test_microwatt_helpers.vhd
127
+ - tests/parser_tests/test_microwatt_helpers_pp.vhd
128
+ - tests/parser_tests/test_microwatt_icache.vhd
129
+ - tests/parser_tests/test_microwatt_icache_pp.vhd
130
+ - tests/parser_tests/test_microwatt_icache_tb.vhd
131
+ - tests/parser_tests/test_microwatt_icache_tb_pp.vhd
132
+ - tests/parser_tests/test_microwatt_insn_helpers.vhd
133
+ - tests/parser_tests/test_microwatt_insn_helpers_pp.vhd
134
+ - tests/parser_tests/test_microwatt_loadstore1.vhd
135
+ - tests/parser_tests/test_microwatt_loadstore1_pp.vhd
136
+ - tests/parser_tests/test_microwatt_logical.vhd
137
+ - tests/parser_tests/test_microwatt_logical_pp.vhd
138
+ - tests/parser_tests/test_microwatt_multiply.vhd
139
+ - tests/parser_tests/test_microwatt_multiply_pp.vhd
140
+ - tests/parser_tests/test_microwatt_multiply_tb.vhd
141
+ - tests/parser_tests/test_microwatt_multiply_tb_pp.vhd
142
+ - tests/parser_tests/test_microwatt_plru.vhd
143
+ - tests/parser_tests/test_microwatt_plru_pp.vhd
144
+ - tests/parser_tests/test_microwatt_plru_tb.vhd
145
+ - tests/parser_tests/test_microwatt_plru_tb_pp.vhd
146
+ - tests/parser_tests/test_microwatt_ppc_fx_insns.vhd
147
+ - tests/parser_tests/test_microwatt_ppc_fx_insns_pp.vhd
148
+ - tests/parser_tests/test_microwatt_register_file.vhd
149
+ - tests/parser_tests/test_microwatt_register_file_pp.vhd
150
+ - tests/parser_tests/test_microwatt_rotator.vhd
151
+ - tests/parser_tests/test_microwatt_rotator_pp.vhd
152
+ - tests/parser_tests/test_microwatt_rotator_tb.vhd
153
+ - tests/parser_tests/test_microwatt_rotator_tb_pp.vhd
154
+ - tests/parser_tests/test_microwatt_sim_bram.vhd
155
+ - tests/parser_tests/test_microwatt_sim_bram_helpers.vhd
156
+ - tests/parser_tests/test_microwatt_sim_bram_helpers_pp.vhd
157
+ - tests/parser_tests/test_microwatt_sim_bram_pp.vhd
158
+ - tests/parser_tests/test_microwatt_sim_console.vhd
159
+ - tests/parser_tests/test_microwatt_sim_console_pp.vhd
160
+ - tests/parser_tests/test_microwatt_sim_jtag.vhd
161
+ - tests/parser_tests/test_microwatt_sim_jtag_pp.vhd
162
+ - tests/parser_tests/test_microwatt_sim_jtag_socket.vhd
163
+ - tests/parser_tests/test_microwatt_sim_jtag_socket_pp.vhd
164
+ - tests/parser_tests/test_microwatt_sim_uart.vhd
165
+ - tests/parser_tests/test_microwatt_sim_uart_pp.vhd
166
+ - tests/parser_tests/test_microwatt_soc.vhd
167
+ - tests/parser_tests/test_microwatt_soc_pp.vhd
168
+ - tests/parser_tests/test_microwatt_utils.vhd
169
+ - tests/parser_tests/test_microwatt_utils_pp.vhd
170
+ - tests/parser_tests/test_microwatt_wishbone_arbiter.vhd
171
+ - tests/parser_tests/test_microwatt_wishbone_arbiter_pp.vhd
172
+ - tests/parser_tests/test_microwatt_wishbone_bram_tb.vhd
173
+ - tests/parser_tests/test_microwatt_wishbone_bram_tb_pp.vhd
174
+ - tests/parser_tests/test_microwatt_wishbone_bram_wrapper.vhd
175
+ - tests/parser_tests/test_microwatt_wishbone_bram_wrapper_pp.vhd
176
+ - tests/parser_tests/test_microwatt_wishbone_debug_master.vhd
177
+ - tests/parser_tests/test_microwatt_wishbone_debug_master_pp.vhd
178
+ - tests/parser_tests/test_microwatt_wishbone_types.vhd
179
+ - tests/parser_tests/test_microwatt_wishbone_types_pp.vhd
180
+ - tests/parser_tests/test_microwatt_writeback.vhd
181
+ - tests/parser_tests/test_microwatt_writeback_pp.vhd
182
+ - tests/parser_tests/test_package-1.vhd
183
+ - tests/parser_tests/test_package-1_pp.vhd
184
+ - tests/parser_tests/test_precedence.vhd
185
+ - tests/parser_tests/test_precedence_pp.vhd
186
+ - tests/parser_tests/test_selected_sig.vhd
187
+ - tests/parser_tests/test_selected_sig_pp.vhd
188
+ - tests/parser_tests/test_slice.vhd
189
+ - tests/parser_tests/test_slice_pp.vhd
190
+ - tests/parser_tests/test_tb-00.vhd
191
+ - tests/parser_tests/test_tb-00_pp.vhd
192
+ - tests/parser_tests/test_type_decl_02.vhd
193
+ - tests/parser_tests/test_type_decl_02_pp.vhd
194
+ - tests/parser_tests/test_use.vhd
195
+ - tests/parser_tests/test_use_pp.vhd
196
+ - tests/parser_tests/test_while_1.vhd
197
+ - tests/parser_tests/test_while_1_pp.vhd
198
+ - tests/parser_tests/test_with-00.vhd
199
+ - tests/parser_tests/test_with-00_pp.vhd
200
+ - tests/tb_gen_tests/test_accelerator.vhd
201
+ homepage: http://www.github.com/JC-LL/vertigo
202
+ licenses:
203
+ - GPL-2.0-only
204
+ metadata: {}
205
+ post_install_message:
206
+ rdoc_options: []
207
+ require_paths:
208
+ - lib
209
+ required_ruby_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - ">="
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ requirements: []
220
+ rubygems_version: 3.0.6
221
+ signing_key:
222
+ specification_version: 4
223
+ summary: VHDL parser and utilities
224
+ test_files: []