vertigo_vhdl 0.8.11 → 0.8.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f66142ff1aa2f02093dbc99c8cd22a78a44ae177d0ecaf41e1cc3289b505e80
4
- data.tar.gz: 406108f6e1fc88d54cd96b38708772e7051788b8c9ab9417a15bef96326004e1
3
+ metadata.gz: a3459a1e9abbe835d383e2137cfa7f34146d14d54813888019e75d72ac37a24d
4
+ data.tar.gz: 9a02b22f74a9843113918dfcb26e7f97681c72244df7bdcaa4651549294dec16
5
5
  SHA512:
6
- metadata.gz: 9c3f59eea1d1a2ca3ec6c22361bcd5eb54512b95a9b76e60465d6aa2749072d730fc0d79d28cfe0b2d11048f49a29f655d55aabc34cf6f0c8fcbd0c82b3f440c
7
- data.tar.gz: a12214d7979e71a31172ce35fa67ac7ca3bbf69c4a3e8730acdeae20c451cb9344b3a2c1d567389db41ffa699a896db6244f8ec3fdd4f9d15600d9caf7ef857e
6
+ metadata.gz: e676079468bfc02a31d541aef60289f2da02a7daf90c59019e240e3eb5b833ed1ff94f4391398bc61fecae80ff62a255c5db1a809b12f4dae37f3ae019a507aa
7
+ data.tar.gz: 2297f5a293fb186a4b4c7073b32d3a70af9df714835b8e58a1686c1757552629c0c6ec536ab0f18761d3d664b504b11952f325af89157392959f9ffd47978d48
@@ -1259,6 +1259,7 @@ module Vertigo
1259
1259
 
1260
1260
 
1261
1261
  def parse_term
1262
+ #pp showNext
1262
1263
  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
1264
  case showNext.kind
1264
1265
  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.12"
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;
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.12
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-02-15 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,6 +35,8 @@ 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
40
42
  - tests/parser_tests/test_MUST_fail.vhd