HDLRuby 2.6.18 → 2.6.19

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: 2d49fb40d2d1233c59c0ae1f6d7afea51ab17e70aaac5f605295f4c44e478fa4
4
- data.tar.gz: 0b14393197c0af246dae6c221d2beb94580fa9b4c30b234e82efdae4eebf5bca
3
+ metadata.gz: 752424361455f2bd949a8f90c9802337f3ce1d853ebff6bfa44bbe25ebeda369
4
+ data.tar.gz: f9c2dd84c0c875c423a94211948beaea44b54bfe234c01d6f35716b7df26053c
5
5
  SHA512:
6
- metadata.gz: e2c55c6966faa1274aee2ae712b376aec22670e9a574b4d5312e73a8a8a1f85713b8312d6b923e4daef030398667c327245ee8aeb813c3d379d137dd63ec9af8
7
- data.tar.gz: a28d25d1a5ff5893e64ede5229a4b53c7ad0c4ff6479807e3f76764c9f464fc5d0b6a41f8cce3ea8b49338895a3d95e8582760c64a0d8df21a5683fd0acba4d3
6
+ metadata.gz: cc71caee7a2435e579b533b4cbba22c6bc9ca9e8e75be4e57d4a629b7a467ac28a2a302f6d53cf7552a1c1f115e17f5ec7b7648eadc482ab62bc2fdff1319cc6
7
+ data.tar.gz: 4053a2050e82212db5901c7cb4756b21bca3465ec9ee4d08cd2875d8b57e5c53cd05df0405e2f5b249ec96b28271f514c8707fbb43b8e69db901ff9713a9b1f4
@@ -6,63 +6,35 @@ module HDLRuby::Verilog
6
6
  # This is sample.
7
7
  # n = "abc_ABC_いろは"
8
8
  # puts n
9
- # name = n.split("")
9
+ # name = n.split("")
10
+
11
+ @@hdr2verilog = {}
10
12
 
11
13
  # Since it is possible to use $ and numbers other than the beginning of the character string, it is divided.
12
14
  def name_to_verilog(name)
13
- # ref = "" # For storing the converted character.
14
- # name = name.to_s # Ensure name is a string
15
- #
16
- # if (name[0] =~ /[a-zA-Z]/) then
17
- # ref << name[0]
18
- # # _ To convert it to __.
19
- # elsif (name[0] == "_") then
20
- # ref << "__"
21
- # # If it does not satisfy the above, it is another character.
22
- # # In that case, convert it to UTF-8 and convert it to a usable character string.
23
- # else
24
- # l = name[0].bytes.map{|v| v.to_s(16)}.join # Conversion to UTF-8 hexadecimal number.
25
-
26
- # ref << "_" + l.rjust(6,"0") # Add an underscore indicating conversion.
27
- # # The remainder of 6 digits is filled with 0.
28
- # end
29
- #
30
- # name[1..-1].each_char do |c|
31
- # # Confirmation of characters in array.
32
- # # If it is a-zA-Z 0 - 9, it is added to ref as it is.
33
- # if (c =~ /[a-zA-Z0-9]|\$/) then
34
- # ref << c
35
- # # _ To convert it to __.
36
- # elsif (c == "_") then
37
- # ref << "__"
38
- # # If it does not satisfy the above, it is another character.
39
- # # In that case, convert it to UTF-8 and convert it to a usable character string.
40
- # else
41
- # l = c.bytes.map{|v| v.to_s(16)}.join # Conversion to UTF-8 hexadecimal number.
42
- #
43
- # ref << "_" + l.rjust(6,"0") # Add an underscore indicating conversion.
44
- # # The remainder of 6 digits is filled with 0.
45
- # end
46
- # end
47
- # return ref
48
-
49
-
15
+ # name = name.to_s
16
+ # # Convert special characters.
17
+ # name = name.each_char.map do |c|
18
+ # if c=~ /[a-z0-9]/ then
19
+ # c
20
+ # elsif c == "_" then
21
+ # "__"
22
+ # else
23
+ # "_" + c.ord.to_s
24
+ # end
25
+ # end.join
26
+ # # First character: only letter is possible.
27
+ # unless name[0] =~ /[a-z_]/ then
28
+ # name = "_" + name
29
+ # end
30
+ # return name
50
31
  name = name.to_s
51
- # Convert special characters.
52
- name = name.each_char.map do |c|
53
- if c=~ /[a-z0-9]/ then
54
- c
55
- elsif c == "_" then
56
- "__"
57
- else
58
- "_" + c.ord.to_s
59
- end
60
- end.join
61
- # First character: only letter is possible.
62
- unless name[0] =~ /[a-z_]/ then
63
- name = "_" + name
32
+ vname = @@hdr2verilog[name]
33
+ unless vname then
34
+ vname = "_v#{@@hdr2verilog.size}_#{name.split(/[^a-zA-Z_0-9]/)[-1]}"
35
+ @@hdr2verilog[name] = vname
64
36
  end
65
- return name
37
+ return vname
66
38
  end
67
39
 
68
40
  #puts ref
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.6.18"
2
+ VERSION = "2.6.19"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.18
4
+ version: 2.6.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-01 00:00:00.000000000 Z
11
+ date: 2021-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler