vertigo_vhdl 0.8.11 → 0.8.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f66142ff1aa2f02093dbc99c8cd22a78a44ae177d0ecaf41e1cc3289b505e80
4
- data.tar.gz: 406108f6e1fc88d54cd96b38708772e7051788b8c9ab9417a15bef96326004e1
3
+ metadata.gz: 3f7eecaed2d4b5a72e742bb50665fe8dc039c540ba3ccf97a5c78938b3eadec4
4
+ data.tar.gz: 04eaa1b607442048ef566c5bd067bf9c93e37bca35f8c60ed44301a6454423f1
5
5
  SHA512:
6
- metadata.gz: 9c3f59eea1d1a2ca3ec6c22361bcd5eb54512b95a9b76e60465d6aa2749072d730fc0d79d28cfe0b2d11048f49a29f655d55aabc34cf6f0c8fcbd0c82b3f440c
7
- data.tar.gz: a12214d7979e71a31172ce35fa67ac7ca3bbf69c4a3e8730acdeae20c451cb9344b3a2c1d567389db41ffa699a896db6244f8ec3fdd4f9d15600d9caf7ef857e
6
+ metadata.gz: b4d1b525899302571608d769efd34992e00310f9a851b920e82a39441e86fcfffa602f65ced5747c95acd5c75b44f610e190fe650dd1feb85acfe738c83ef8d7
7
+ data.tar.gz: 95862bbfc72888c6f48433ac4c019fbbf8294543f2e3b5a2db3cffce76fe867172bc1fba446602900b8591906ad059b7051cac7cbeedf74881c9c13446b10d68
@@ -669,6 +669,9 @@ module Vertigo
669
669
  if showNext.is_a?(:lparen)
670
670
  ret.sensitivity=parse_sensitivity_list
671
671
  end
672
+ if showNext.is_a? :is
673
+ acceptIt
674
+ end
672
675
  ret.decls=parse_decls
673
676
  ret.decls.flatten!
674
677
  expect :begin
@@ -1259,6 +1262,7 @@ module Vertigo
1259
1262
 
1260
1263
 
1261
1264
  def parse_term
1265
+ #pp showNext
1262
1266
  if showNext.is_a? [:ident,:dot,:integer,:natural,:positive,:decimal_literal,:based_literal,:char_literal,:string_literal,:true,:false,:bit_string_literal,:lparen,:others,:abs,:not,:sub,:open]
1263
1267
  case showNext.kind
1264
1268
  when :ident
@@ -74,7 +74,9 @@ module Vertigo
74
74
  code << " s <=not(s);"
75
75
  code << "end procedure;"
76
76
  code.newline
77
- @entity.ports.each do |port|
77
+ # bug discovered by a student : when he forgets "in" or "out" in entity port...
78
+ # fix : compact
79
+ @entity.ports.compact.each do |port|
78
80
  port_name=port.name.str.ljust(@max_length_str)
79
81
  port_type=port.type.str
80
82
  code << "signal #{port_name} : #{port_type};" unless @excluded.include?(port)
@@ -124,7 +126,7 @@ module Vertigo
124
126
  code << "port map ("
125
127
  code.indent=4
126
128
 
127
- @entity.ports.each_with_index do |port,idx|
129
+ @entity.ports.compact.each_with_index do |port,idx|
128
130
  port_name=port.name.str.ljust(@max_length_str)
129
131
  port_type=port.type.str
130
132
  if idx < @entity.ports.size-1
@@ -189,7 +191,9 @@ module Vertigo
189
191
  puts "\t-most probable clk : #{@clk.name.str}" unless options[:mute]
190
192
  puts "\t-most probable reset : #{@rst.name.str}" unless options[:mute]
191
193
 
192
- @max_length_str=entity.ports.map{|port| port.name.str.size}.max
194
+ # bug discovered by a student : when he forgets "in" or "out" in port !
195
+ # fix : .compact
196
+ @max_length_str=entity.ports.compact.map{|port| port.name.str.size}.max
193
197
 
194
198
  print "\t-validate [Y/n] ? "
195
199
  answer=$stdin.gets.chomp
@@ -1,3 +1,3 @@
1
1
  module Vertigo
2
- VERSION="0.8.11"
2
+ VERSION="0.8.13"
3
3
  end
@@ -0,0 +1,79 @@
1
+ library ieee;
2
+ use ieee.std_logic_1164.all;
3
+ use ieee.numeric_std.all;
4
+
5
+ entity arbitre is
6
+ port(
7
+ clk : in std_logic;
8
+ reset_n : in std_logic;
9
+ r : std_logic_vector(1 downto 0);
10
+ outputs : out std_logic_vector(1 downto 0)
11
+ );
12
+ end arbitre;
13
+
14
+ architecture arch of arbitre is
15
+ type etat is (A, B, C, D);
16
+ signal state, next_state : etat;
17
+ begin
18
+ p0 : process(clk, reset_n)
19
+ begin
20
+ if reset_n = '0' then
21
+ state <= A;
22
+ elsif rising_edge(clk) then
23
+ state <= next_state;
24
+ end if;
25
+ end process;
26
+
27
+ p1 : process(reset_n, r)
28
+ begin
29
+ next_state <= state;
30
+ case state is
31
+ when A =>
32
+ if r = "10" or r = "11" then
33
+ state <= C;
34
+ elsif r = "01" then
35
+ state <= D;
36
+ elsif r = "00" then
37
+ state <= state;
38
+ end if;
39
+ when B =>
40
+ if r = "01" or r = "11" then
41
+ state <= D;
42
+ elsif r = "10" then
43
+ state <= C;
44
+ elsif r = "00" then
45
+ state <= state;
46
+ end if;
47
+ when C =>
48
+ if r = "01" then
49
+ state <= D;
50
+ elsif r = "00" then
51
+ state <= B;
52
+ elsif r = "10" or r = "11" then
53
+ state <= state;
54
+ end if;
55
+ when D =>
56
+ if r = "10" then
57
+ state <= C;
58
+ elsif r = "00" then
59
+ state <= A;
60
+ elsif r = "01" or r = "11" then
61
+ state <= state;
62
+ end if;
63
+ end case;
64
+ end process;
65
+
66
+ p3 : process(state)
67
+ begin
68
+ if state = A then
69
+ outputs <= "00";
70
+ elsif state = B then
71
+ outputs <= "00";
72
+ elsif state = C then
73
+ outputs <= "10";
74
+ elsif state = D then
75
+ outputs <= "01";
76
+ end if;
77
+ end process;
78
+ end arch;
79
+
@@ -0,0 +1,67 @@
1
+ --------------------------------------------------------------------------------
2
+ -- this file was generated automatically by Vertigo Ruby utility
3
+ -- date : (d/m/y h:m) 15/02/2023 14:26
4
+ -- author : Jean-Christophe Le Lann - 2014
5
+ --------------------------------------------------------------------------------
6
+
7
+ library ieee;
8
+ use ieee.std_logic_1164.all;
9
+ use ieee.numeric_std.all;
10
+
11
+ entity arbitre_tb is
12
+ end entity;
13
+
14
+ architecture bhv of arbitre_tb is
15
+ constant HALF_PERIOD : time :=5 ns;
16
+
17
+ signal clk : std_logic := '0';
18
+ signal reset_n : std_logic := '0';
19
+
20
+ signal running : boolean := true;
21
+
22
+ procedure wait_cycles(n : natural) is
23
+ begin
24
+ for i in 0 to n-1 loop
25
+ wait until rising_edge(clk);
26
+ end loop;
27
+ end procedure;
28
+
29
+ procedure toggle(signal s : inout std_logic) is
30
+ begin
31
+ wait until rising_edge(clk);
32
+ s <=not(s);
33
+ wait until rising_edge(clk);
34
+ s <=not(s);
35
+ end procedure;
36
+
37
+ signal outputs : std_logic_vector(1 downto 0);
38
+ begin
39
+ --------------------------------------------------------------------------------
40
+ -- clock and reset
41
+ --------------------------------------------------------------------------------
42
+ reset_n <= '0','1' after 123 ns;
43
+
44
+ clk <= not(clk) after HALF_PERIOD when running else clk;
45
+ --------------------------------------------------------------------------------
46
+ -- Design Under Test
47
+ --------------------------------------------------------------------------------
48
+ dut : entity work.arbitre(arch)
49
+ port map (
50
+ clk => clk ,
51
+ reset_n => reset_n,
52
+ outputs => outputs);
53
+ --------------------------------------------------------------------------------
54
+ -- sequential stimuli
55
+ --------------------------------------------------------------------------------
56
+ stim : process
57
+ begin
58
+ report "running testbench for arbitre(arch)";
59
+ report "waiting for asynchronous reset";
60
+ wait until reset_n='1';
61
+ wait_cycles(10);
62
+ wait_cycles(200);
63
+ report "end of simulation";
64
+ running <= false;
65
+ wait;
66
+ end process;
67
+ end bhv;
@@ -0,0 +1,62 @@
1
+ -- ghdl -a [nom].vhd
2
+ -- vertigo --gen_tb [nom].vhd
3
+ -- ghdl -a [nom_tb].vhd
4
+ -- ghdl -e [nom_tb]
5
+ -- ghdl -r [nom_tb]
6
+ -- ghdl -r [nom_tb] --wave=[nom_wave].ghw
7
+ -- gtkwave [nom].ghw
8
+
9
+ library ieee;
10
+ use ieee.std_logic_1164.all;
11
+ use ieee.numeric_std.all;
12
+
13
+ entity LUT is
14
+ port (
15
+ clk : in std_logic;
16
+ rst : in std_logic;
17
+ push : in std_logic;
18
+ a : in std_logic;
19
+ b : in std_logic;
20
+ bitstream : in std_logic;
21
+ f : out std_logic
22
+
23
+ );
24
+ end LUT;
25
+
26
+ architecture arch of LUT is
27
+ signal Q : std_logic_vector (3 downto 0);
28
+ signal T : std_logic_vector (1 downto 0);
29
+ begin
30
+
31
+ process(clk, rst) is
32
+ begin
33
+
34
+ if rst = '0' then
35
+ Q(0) <= '0';
36
+ Q(1) <= '0';
37
+ Q(2) <= '0';
38
+ Q(3) <= '0';
39
+
40
+ elsif rising_edge(clk) then
41
+ if push = '1' then
42
+ Q(0) <= bitstream;
43
+ Q(1) <= Q(0);
44
+ Q(2) <= Q(1);
45
+ Q(3) <= Q(2);
46
+ end if;
47
+ end if;
48
+ end process;
49
+
50
+ process (a, b) is
51
+ begin
52
+ t(0) <= a;
53
+ t(1) <= b;
54
+ case t is
55
+ when "00" => f <= Q(0);
56
+ when "01" => f <= Q(1);
57
+ when "10" => f <= Q(2);
58
+ when "11" => f <= Q(3);
59
+ when others => f <= Q(0);
60
+ end case;
61
+ end process;
62
+ end arch;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertigo_vhdl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Christophe Le Lann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-02 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby handwritten VHDL parser and utilities
14
14
  email: jean-christophe.le_lann@ensta-bretagne.fr
@@ -35,8 +35,11 @@ files:
35
35
  - lib/vertigo/version.rb
36
36
  - lib/vertigo/vertigo.rkg
37
37
  - lib/vertigo/visitor_vertigo_rkgen.rb
38
+ - tests/ghdl_tests/arbitre.vhd
39
+ - tests/ghdl_tests/arbitre_tb.vhd
38
40
  - tests/ghdl_tests/fsm.vhd
39
41
  - tests/ghdl_tests/fsm_synth.vhd
42
+ - tests/parser_tests/test_LUT.vhd
40
43
  - tests/parser_tests/test_MUST_fail.vhd
41
44
  - tests/parser_tests/test_accelerator.vhd
42
45
  - tests/parser_tests/test_adder_rca_vhdl93.vhd