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 @@
1
+ ../microwatt/wishbone_types.vhdl
@@ -0,0 +1,38 @@
1
+ -- generated by Vertigo VHDL tool
2
+ library ieee;
3
+ use ieee.std_logic_1164.all;
4
+
5
+ package wishbone_types is
6
+ constant wishbone_addr_bits : integer := 32;
7
+ constant wishbone_data_bits : integer := 64;
8
+ constant wishbone_sel_bits : integer := wishbone_data_bits / 8;
9
+
10
+ subtype wishbone_addr_type is std_ulogic_vector(wishbone_addr_bits - 1 downto 0);
11
+
12
+ subtype wishbone_data_type is std_ulogic_vector(wishbone_data_bits - 1 downto 0);
13
+
14
+ subtype wishbone_sel_type is std_ulogic_vector(wishbone_sel_bits - 1 downto 0);
15
+
16
+ type wishbone_master_out is record
17
+ adr : wishbone_addr_type;
18
+ dat : wishbone_data_type;
19
+ cyc : std_ulogic;
20
+ stb : std_ulogic;
21
+ sel : wishbone_sel_type;
22
+ we : std_ulogic;
23
+ end record;
24
+ constant wishbone_master_out_init : wishbone_master_out := (cyc => '0',stb => '0',we => '0',others => (others => '0'));
25
+
26
+ type wishbone_slave_out is record
27
+ dat : wishbone_data_type;
28
+ ack : std_ulogic;
29
+ stall : std_ulogic;
30
+ end record;
31
+ constant wishbone_slave_out_init : wishbone_slave_out := (ack => '0',stall => '0',others => (others => '0'));
32
+
33
+ type wishbone_master_out_vector is array(natural range <>) of wishbone_master_out;
34
+
35
+ type wishbone_slave_out_vector is array(natural range <>) of wishbone_slave_out;
36
+
37
+ end wishbone_types;
38
+
@@ -0,0 +1 @@
1
+ ../microwatt/writeback.vhdl
@@ -0,0 +1,87 @@
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.crhelpers.all;
8
+
9
+ entity writeback is
10
+ port(
11
+ clk : in std_ulogic;
12
+ e_in : in execute1towritebacktype;
13
+ l_in : in loadstore1towritebacktype;
14
+ w_out : out writebacktoregisterfiletype;
15
+ c_out : out writebacktocrfiletype;
16
+ complete_out : out std_ulogic);
17
+ end entity writeback;
18
+
19
+ architecture behaviour of writeback is
20
+ begin
21
+
22
+
23
+ writeback_1 : process(all)
24
+ variable x : std_ulogic_vector(0 downto 0);
25
+ variable y : std_ulogic_vector(0 downto 0);
26
+ variable w : std_ulogic_vector(0 downto 0);
27
+ variable cf : std_ulogic_vector(3 downto 0);
28
+ variable zero : std_ulogic;
29
+ variable sign : std_ulogic;
30
+ variable scf : std_ulogic_vector(3 downto 0);
31
+ begin
32
+ x(0) := e_in.valid;
33
+ y(0) := l_in.valid;
34
+ assert (to_integer(unsigned(x)) + to_integer(unsigned(y))) <= 1;
35
+ x(0) := e_in.write_enable;
36
+ y(0) := l_in.write_enable;
37
+ assert (to_integer(unsigned(x)) + to_integer(unsigned(y))) <= 1;
38
+ w(0) := e_in.write_cr_enable;
39
+ x(0) := (e_in.write_enable and e_in.rc);
40
+ assert (to_integer(unsigned(w)) + to_integer(unsigned(x))) <= 1;
41
+ w_out <= writebacktoregisterfileinit;
42
+ c_out <= writebacktocrfileinit;
43
+ complete_out <= '0';
44
+ if e_in.valid = '1' or l_in.valid = '1' then
45
+ complete_out <= '1';
46
+ end if;
47
+ if e_in.write_enable = '1' then
48
+ w_out.write_reg <= e_in.write_reg;
49
+ w_out.write_data <= e_in.write_data;
50
+ w_out.write_enable <= '1';
51
+ end if;
52
+ if e_in.write_cr_enable = '1' then
53
+ c_out.write_cr_enable <= '1';
54
+ c_out.write_cr_mask <= e_in.write_cr_mask;
55
+ c_out.write_cr_data <= e_in.write_cr_data;
56
+ end if;
57
+ if e_in.write_xerc_enable = '1' then
58
+ c_out.write_xerc_enable <= '1';
59
+ c_out.write_xerc_data <= e_in.xerc;
60
+ end if;
61
+ if l_in.write_enable = '1' then
62
+ w_out.write_reg <= gpr_to_gspr(l_in.write_reg);
63
+ w_out.write_data <= l_in.write_data;
64
+ w_out.write_enable <= '1';
65
+ end if;
66
+ if l_in.rc = '1' then
67
+ scf(3) := '0';
68
+ scf(2) := '0';
69
+ scf(1) := l_in.store_done;
70
+ scf(0) := l_in.xerc.so;
71
+ c_out.write_cr_enable <= '1';
72
+ c_out.write_cr_mask <= num_to_fxm(0);
73
+ c_out.write_cr_data(31 downto 28) <= scf;
74
+ end if;
75
+ if e_in.rc = '1' and e_in.write_enable = '1' then
76
+ sign := e_in.write_data(63);
77
+ zero := (or(e_in.write_data));
78
+ c_out.write_cr_enable <= '1';
79
+ c_out.write_cr_mask <= num_to_fxm(0);
80
+ cf(3) := sign;
81
+ cf(2) := sign and zero;
82
+ cf(1) := zero;
83
+ cf(0) := e_in.xerc.so;
84
+ c_out.write_cr_data(31 downto 28) <= cf;
85
+ end if;
86
+ end process;
87
+ end behaviour;
@@ -0,0 +1,68 @@
1
+ ------------------------------------------------------------------------------
2
+ -- Test Bench for ALU design (ESD figure 2.5)
3
+ -- by Weijun Zhang, 04/2001
4
+ --
5
+ -- we illustrate how to use package and procedure in this example
6
+ -- it seems a kind of complex testbench for this simple module,
7
+ -- the method, however, makes huge circuit testing more complete,
8
+ -- covenient and managable
9
+ ------------------------------------------------------------------------------
10
+
11
+ library ieee;
12
+ use ieee.std_logic_1164.all;
13
+ use ieee.numeric_std.all;
14
+
15
+ -- define constant, signal and procedure within package for ALU
16
+
17
+ package ALU_package is
18
+
19
+ constant INTERVAL: TIME := 8 ns;
20
+
21
+ signal sig_A, sig_B: std_logic_vector(1 downto 0);
22
+ signal sig_Sel: std_logic_vector(1 downto 0);
23
+ signal sig_Res: std_logic_vector(1 downto 0);
24
+
25
+ procedure load_data(
26
+ signal A, B: out std_logic_vector(1 downto 0);
27
+ signal Sel: out std_logic_vector(1 downto 0)
28
+ );
29
+
30
+ procedure check_data(signal Sel: out std_logic_vector( 1 downto 0));
31
+
32
+ end ALU_package;
33
+
34
+ -- put all the procedure descriptions within package body
35
+
36
+ package body ALU_package is
37
+
38
+ procedure load_data (signal A, B: out std_logic_vector(1 downto 0);
39
+ signal Sel: out std_logic_vector(1 downto 0) ) is
40
+ begin
41
+ A <= sig_A;
42
+ B <= sig_B;
43
+ Sel <= sig_Sel;
44
+ end load_data;
45
+
46
+ procedure check_data (signal Sel: out std_logic_vector( 1 downto 0)) is
47
+ begin
48
+ Sel <= sig_Sel;
49
+ if (sig_Sel="00") then
50
+ assert(sig_Res = (sig_A + sig_B))
51
+ report "Error detected in Addition!"
52
+ severity warning;
53
+ elsif (sig_Sel="01") then
54
+ assert(sig_Res = (sig_A - sig_B))
55
+ report "Error detected in Subtraction!"
56
+ severity warning;
57
+ elsif (sig_Sel="10") then
58
+ assert(sig_Res = (sig_A and sig_B))
59
+ report "AND Operation Error!"
60
+ severity warning;
61
+ elsif (sig_Sel="11") then
62
+ assert(sig_Res = (sig_A or sig_B))
63
+ report "OR operation Error!"
64
+ severity warning;
65
+ end if;
66
+ end check_data;
67
+
68
+ end ALU_package;
@@ -0,0 +1,53 @@
1
+ -- generated by Vertigo VHDL tool
2
+ library ieee;
3
+ use ieee.std_logic_1164.all;
4
+ use ieee.numeric_std.all;
5
+
6
+ package alu_package is
7
+ constant interval : time := 8 ns;
8
+ signal sig_a : std_logic_vector(1 downto 0);
9
+ signal sig_b : std_logic_vector(1 downto 0);
10
+ signal sig_sel : std_logic_vector(1 downto 0);
11
+ signal sig_res : std_logic_vector(1 downto 0);
12
+
13
+ procedure load_data(
14
+ a : out std_logic_vector(1 downto 0);
15
+ b : out std_logic_vector(1 downto 0);
16
+ sel : out std_logic_vector(1 downto 0));
17
+
18
+ procedure check_data(
19
+ sel : out std_logic_vector(1 downto 0));
20
+
21
+ end alu_package;
22
+
23
+ package body alu_package is
24
+
25
+ procedure load_data(
26
+ a : out std_logic_vector(1 downto 0);
27
+ b : out std_logic_vector(1 downto 0);
28
+ sel : out std_logic_vector(1 downto 0)) is
29
+ begin
30
+ a <= sig_a;
31
+ b <= sig_b;
32
+ sel <= sig_sel;
33
+ end load_data;
34
+
35
+ procedure check_data(
36
+ sel : out std_logic_vector(1 downto 0)) is
37
+ begin
38
+ sel <= sig_sel;
39
+ if (sig_sel = "00") then
40
+ assert (sig_res = (sig_a + sig_b))
41
+ report "error detected in addition!" severity warning;
42
+ elsif (sig_sel = "01") then
43
+ assert (sig_res = (sig_a - sig_b))
44
+ report "error detected in subtraction!" severity warning;
45
+ elsif (sig_sel = "10") then
46
+ assert (sig_res = (sig_a and sig_b))
47
+ report "and operation error!" severity warning;
48
+ elsif (sig_sel = "11") then
49
+ assert (sig_res = (sig_a or sig_b))
50
+ report "or operation error!" severity warning;
51
+ end if;
52
+ end check_data;
53
+ end alu_package;
@@ -0,0 +1,13 @@
1
+
2
+ entity test is
3
+ end test;
4
+
5
+ architecture bhv of test is
6
+ begin
7
+ process
8
+ begin
9
+ if clk'event and clk='1' then
10
+ report "hourra!";
11
+ end if;
12
+ end process;
13
+ end bhv;
@@ -0,0 +1,16 @@
1
+ -- generated by Vertigo VHDL tool
2
+
3
+ entity test is
4
+ end entity test;
5
+
6
+ architecture bhv of test is
7
+ begin
8
+
9
+
10
+ process
11
+ begin
12
+ if clk'event and clk = '1' then
13
+ report "hourra!";
14
+ end if;
15
+ end process;
16
+ end bhv;
@@ -0,0 +1,14 @@
1
+
2
+ -- Deuxieme architecture concurrente decrivant un mux :
3
+
4
+ ARCHITECTURE mux_4_vers_1 OF porte_4_vers_1 IS
5
+
6
+ BEGIN
7
+
8
+ WITH adr SELECT
9
+ s <= a WHEN "00",
10
+ b WHEN "01",
11
+ c WHEN "10",
12
+ d WHEN others;
13
+
14
+ END mux_4_vers_1;
@@ -0,0 +1,10 @@
1
+ -- generated by Vertigo VHDL tool
2
+ architecture mux_4_vers_1 of porte_4_vers_1 is
3
+ begin
4
+
5
+ with adr select s <=
6
+ a when "00",
7
+ b when "01",
8
+ c when "10",
9
+ d when others,;
10
+ end mux_4_vers_1;
@@ -0,0 +1,15 @@
1
+ library ieee;
2
+ use ieee.std_logic_1164.all;
3
+ use ieee.numeric_std.all;
4
+
5
+ entity test is
6
+ end entity;
7
+
8
+ architecture arch of test is
9
+ constant CST : std_logic_vector(15 downto 0) := x"1234";
10
+ signal s1,s2 : std_logic_vector(31 downto 0);
11
+ begin
12
+
13
+ s2 <= s1(15 downto 0) & CST;
14
+
15
+ end architecture;
@@ -0,0 +1,16 @@
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 test is
7
+ end entity test;
8
+
9
+ architecture arch of test is
10
+ constant cst : std_logic_vector(15 downto 0) := x"1234";
11
+ signal s1 : std_logic_vector(31 downto 0);
12
+ signal s2 : std_logic_vector(31 downto 0);
13
+ begin
14
+
15
+ s2 <= s1(15 downto 0) & cst;
16
+ end arch;
@@ -0,0 +1,94 @@
1
+
2
+
3
+ library IEEE;
4
+ use IEEE.std_logic_1164.all;
5
+ use IEEE.std_logic_arith.all;
6
+
7
+ entity DECODER_TB is
8
+ end DECODER_TB;
9
+
10
+ architecture TB of DECODER_TB is
11
+
12
+ signal T_I : std_logic_vector(1 downto 0) := "00";
13
+ signal T_O : std_logic_vector(3 downto 0);
14
+
15
+
16
+ component decoder port(
17
+ I : in std_logic_vector(1 downto 0);
18
+ O : out std_logic_vector(3 downto 0)
19
+ );
20
+ end component;
21
+
22
+ begin
23
+
24
+ U_DECODER : DECODER port map (T_I, T_O);
25
+
26
+ process
27
+ variable err_cnt : integer := 0;
28
+ begin
29
+
30
+ wait for 10 ns;
31
+ T_I <= "00";
32
+ wait for 1 ns;
33
+ assert (T_O="0001") report "Error Case 0" severity error;
34
+ if (T_O/="0001") then
35
+ err_cnt := err_cnt + 1;
36
+ end if;
37
+
38
+
39
+ wait for 10 ns;
40
+ T_I <= "01";
41
+ wait for 1 ns;
42
+ assert (T_O="0010") report "Error Case 1"
43
+ severity error;
44
+ if (T_O/="0010") then
45
+ err_cnt := err_cnt + 1;
46
+ end if;
47
+
48
+
49
+ wait for 10 ns;
50
+ T_I <= "10";
51
+ wait for 1 ns;
52
+ assert (T_O="0100") report "Error Case 2"
53
+ severity error;
54
+ if (T_O/="0100") then
55
+ err_cnt := err_cnt + 1;
56
+ end if;
57
+
58
+
59
+ wait for 10 ns;
60
+ T_I <= "11";
61
+ wait for 1 ns;
62
+ assert (T_O="1000") report "Error Case 3"
63
+ severity error;
64
+ if (T_O/="1000") then
65
+ err_cnt := err_cnt + 1;
66
+ end if;
67
+
68
+
69
+ wait for 10 ns;
70
+ T_I <= "UU";
71
+
72
+
73
+ if (err_cnt=0) then
74
+ assert false
75
+ report "Testbench of Adder completed successfully!"
76
+ severity note;
77
+ else
78
+ assert true
79
+ report "Something wrong, try again"
80
+ severity error;
81
+ end if;
82
+
83
+ wait;
84
+
85
+ end process;
86
+
87
+ end TB;
88
+
89
+ ---------------------------------------------------------------
90
+ configuration CFG_TB of DECODER_TB is
91
+ for TB
92
+ end for;
93
+ end CFG_TB;
94
+ ----------------------------------------------------------------