origen_verilog 0.5.2 → 0.6.0
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 +4 -4
- data/config/version.rb +2 -2
- data/grammars/verilog.rb +71 -25
- data/lib/origen_verilog/top_level.rb +25 -20
- data/lib/origen_verilog/verilog/node.rb +33 -3
- metadata +2 -3
- data/bin/fix_my_workspace +0 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8a72a2d45842605da53d1676dc4b18d8b703e46dedb038141d32d3c5ef2d573
|
4
|
+
data.tar.gz: 7fefa5c0a725295dbb2b27487d622ad8d1864d578cac367cd5d511222a94d70a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5005b17b7b837f3590427a5ca9c4c77334ea36a1b752b5e0e01a706ea610fc884af8916420a69dc46a5bb3ab9cc77dae88247dc4f6be94c29fe293b206a590a0
|
7
|
+
data.tar.gz: 234d1a5b66981caa859a59cf3531b5d050e62c3a8a7f6e71d51041ba44a98da6dc77147b4ffbe8426964b8b62ae7736888e87447231dfade9effc157802b367f
|
data/config/version.rb
CHANGED
data/grammars/verilog.rb
CHANGED
@@ -7374,7 +7374,11 @@ module OrigenVerilog
|
|
7374
7374
|
|
7375
7375
|
module NetType0
|
7376
7376
|
def to_ast
|
7377
|
-
text_value
|
7377
|
+
if text_value == "wire real" || text_value == 'wreal'
|
7378
|
+
"real"
|
7379
|
+
else
|
7380
|
+
text_value
|
7381
|
+
end
|
7378
7382
|
end
|
7379
7383
|
end
|
7380
7384
|
|
@@ -7390,11 +7394,11 @@ module OrigenVerilog
|
|
7390
7394
|
end
|
7391
7395
|
|
7392
7396
|
i0 = index
|
7393
|
-
if (match_len = has_terminal?("
|
7397
|
+
if (match_len = has_terminal?("wire real", false, index))
|
7394
7398
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7395
7399
|
@index += match_len
|
7396
7400
|
else
|
7397
|
-
terminal_parse_failure('"
|
7401
|
+
terminal_parse_failure('"wire real"')
|
7398
7402
|
r1 = nil
|
7399
7403
|
end
|
7400
7404
|
if r1
|
@@ -7403,11 +7407,11 @@ module OrigenVerilog
|
|
7403
7407
|
r0.extend(NetType0)
|
7404
7408
|
r0.extend(NetType0)
|
7405
7409
|
else
|
7406
|
-
if (match_len = has_terminal?("
|
7410
|
+
if (match_len = has_terminal?("wreal", false, index))
|
7407
7411
|
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7408
7412
|
@index += match_len
|
7409
7413
|
else
|
7410
|
-
terminal_parse_failure('"
|
7414
|
+
terminal_parse_failure('"wreal"')
|
7411
7415
|
r2 = nil
|
7412
7416
|
end
|
7413
7417
|
if r2
|
@@ -7416,11 +7420,11 @@ module OrigenVerilog
|
|
7416
7420
|
r0.extend(NetType0)
|
7417
7421
|
r0.extend(NetType0)
|
7418
7422
|
else
|
7419
|
-
if (match_len = has_terminal?("
|
7423
|
+
if (match_len = has_terminal?("real", false, index))
|
7420
7424
|
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7421
7425
|
@index += match_len
|
7422
7426
|
else
|
7423
|
-
terminal_parse_failure('"
|
7427
|
+
terminal_parse_failure('"real"')
|
7424
7428
|
r3 = nil
|
7425
7429
|
end
|
7426
7430
|
if r3
|
@@ -7429,11 +7433,11 @@ module OrigenVerilog
|
|
7429
7433
|
r0.extend(NetType0)
|
7430
7434
|
r0.extend(NetType0)
|
7431
7435
|
else
|
7432
|
-
if (match_len = has_terminal?("
|
7436
|
+
if (match_len = has_terminal?("supply0", false, index))
|
7433
7437
|
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7434
7438
|
@index += match_len
|
7435
7439
|
else
|
7436
|
-
terminal_parse_failure('"
|
7440
|
+
terminal_parse_failure('"supply0"')
|
7437
7441
|
r4 = nil
|
7438
7442
|
end
|
7439
7443
|
if r4
|
@@ -7442,11 +7446,11 @@ module OrigenVerilog
|
|
7442
7446
|
r0.extend(NetType0)
|
7443
7447
|
r0.extend(NetType0)
|
7444
7448
|
else
|
7445
|
-
if (match_len = has_terminal?("
|
7449
|
+
if (match_len = has_terminal?("supply1", false, index))
|
7446
7450
|
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7447
7451
|
@index += match_len
|
7448
7452
|
else
|
7449
|
-
terminal_parse_failure('"
|
7453
|
+
terminal_parse_failure('"supply1"')
|
7450
7454
|
r5 = nil
|
7451
7455
|
end
|
7452
7456
|
if r5
|
@@ -7455,11 +7459,11 @@ module OrigenVerilog
|
|
7455
7459
|
r0.extend(NetType0)
|
7456
7460
|
r0.extend(NetType0)
|
7457
7461
|
else
|
7458
|
-
if (match_len = has_terminal?("
|
7462
|
+
if (match_len = has_terminal?("tri", false, index))
|
7459
7463
|
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7460
7464
|
@index += match_len
|
7461
7465
|
else
|
7462
|
-
terminal_parse_failure('"
|
7466
|
+
terminal_parse_failure('"tri"')
|
7463
7467
|
r6 = nil
|
7464
7468
|
end
|
7465
7469
|
if r6
|
@@ -7468,11 +7472,11 @@ module OrigenVerilog
|
|
7468
7472
|
r0.extend(NetType0)
|
7469
7473
|
r0.extend(NetType0)
|
7470
7474
|
else
|
7471
|
-
if (match_len = has_terminal?("
|
7475
|
+
if (match_len = has_terminal?("triand", false, index))
|
7472
7476
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7473
7477
|
@index += match_len
|
7474
7478
|
else
|
7475
|
-
terminal_parse_failure('"
|
7479
|
+
terminal_parse_failure('"triand"')
|
7476
7480
|
r7 = nil
|
7477
7481
|
end
|
7478
7482
|
if r7
|
@@ -7481,11 +7485,11 @@ module OrigenVerilog
|
|
7481
7485
|
r0.extend(NetType0)
|
7482
7486
|
r0.extend(NetType0)
|
7483
7487
|
else
|
7484
|
-
if (match_len = has_terminal?("
|
7488
|
+
if (match_len = has_terminal?("trior", false, index))
|
7485
7489
|
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7486
7490
|
@index += match_len
|
7487
7491
|
else
|
7488
|
-
terminal_parse_failure('"
|
7492
|
+
terminal_parse_failure('"trior"')
|
7489
7493
|
r8 = nil
|
7490
7494
|
end
|
7491
7495
|
if r8
|
@@ -7494,11 +7498,11 @@ module OrigenVerilog
|
|
7494
7498
|
r0.extend(NetType0)
|
7495
7499
|
r0.extend(NetType0)
|
7496
7500
|
else
|
7497
|
-
if (match_len = has_terminal?("
|
7501
|
+
if (match_len = has_terminal?("tri0", false, index))
|
7498
7502
|
r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7499
7503
|
@index += match_len
|
7500
7504
|
else
|
7501
|
-
terminal_parse_failure('"
|
7505
|
+
terminal_parse_failure('"tri0"')
|
7502
7506
|
r9 = nil
|
7503
7507
|
end
|
7504
7508
|
if r9
|
@@ -7507,11 +7511,11 @@ module OrigenVerilog
|
|
7507
7511
|
r0.extend(NetType0)
|
7508
7512
|
r0.extend(NetType0)
|
7509
7513
|
else
|
7510
|
-
if (match_len = has_terminal?("
|
7514
|
+
if (match_len = has_terminal?("tri1", false, index))
|
7511
7515
|
r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7512
7516
|
@index += match_len
|
7513
7517
|
else
|
7514
|
-
terminal_parse_failure('"
|
7518
|
+
terminal_parse_failure('"tri1"')
|
7515
7519
|
r10 = nil
|
7516
7520
|
end
|
7517
7521
|
if r10
|
@@ -7520,11 +7524,11 @@ module OrigenVerilog
|
|
7520
7524
|
r0.extend(NetType0)
|
7521
7525
|
r0.extend(NetType0)
|
7522
7526
|
else
|
7523
|
-
if (match_len = has_terminal?("
|
7527
|
+
if (match_len = has_terminal?("uwire", false, index))
|
7524
7528
|
r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7525
7529
|
@index += match_len
|
7526
7530
|
else
|
7527
|
-
terminal_parse_failure('"
|
7531
|
+
terminal_parse_failure('"uwire"')
|
7528
7532
|
r11 = nil
|
7529
7533
|
end
|
7530
7534
|
if r11
|
@@ -7533,8 +7537,50 @@ module OrigenVerilog
|
|
7533
7537
|
r0.extend(NetType0)
|
7534
7538
|
r0.extend(NetType0)
|
7535
7539
|
else
|
7536
|
-
|
7537
|
-
|
7540
|
+
if (match_len = has_terminal?("wire", false, index))
|
7541
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7542
|
+
@index += match_len
|
7543
|
+
else
|
7544
|
+
terminal_parse_failure('"wire"')
|
7545
|
+
r12 = nil
|
7546
|
+
end
|
7547
|
+
if r12
|
7548
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
7549
|
+
r0 = r12
|
7550
|
+
r0.extend(NetType0)
|
7551
|
+
r0.extend(NetType0)
|
7552
|
+
else
|
7553
|
+
if (match_len = has_terminal?("wand", false, index))
|
7554
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7555
|
+
@index += match_len
|
7556
|
+
else
|
7557
|
+
terminal_parse_failure('"wand"')
|
7558
|
+
r13 = nil
|
7559
|
+
end
|
7560
|
+
if r13
|
7561
|
+
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
7562
|
+
r0 = r13
|
7563
|
+
r0.extend(NetType0)
|
7564
|
+
r0.extend(NetType0)
|
7565
|
+
else
|
7566
|
+
if (match_len = has_terminal?("wor", false, index))
|
7567
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
7568
|
+
@index += match_len
|
7569
|
+
else
|
7570
|
+
terminal_parse_failure('"wor"')
|
7571
|
+
r14 = nil
|
7572
|
+
end
|
7573
|
+
if r14
|
7574
|
+
r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
|
7575
|
+
r0 = r14
|
7576
|
+
r0.extend(NetType0)
|
7577
|
+
r0.extend(NetType0)
|
7578
|
+
else
|
7579
|
+
@index = i0
|
7580
|
+
r0 = nil
|
7581
|
+
end
|
7582
|
+
end
|
7583
|
+
end
|
7538
7584
|
end
|
7539
7585
|
end
|
7540
7586
|
end
|
@@ -7,26 +7,31 @@ module OrigenVerilog
|
|
7
7
|
def initialize(options = {})
|
8
8
|
@name = options[:ast].to_a[0]
|
9
9
|
|
10
|
-
options[:ast].pins.each
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
10
|
+
options[:ast].pins(digital: true).each { |n| _add_pin_(n, :digital) }
|
11
|
+
options[:ast].pins(analog: true).each { |n| _add_pin_(n, :analog) }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def _add_pin_(node, type)
|
17
|
+
node = node.evaluate # Resolve any functions in the ranges
|
18
|
+
if node.type == :input_declaration
|
19
|
+
direction = :input
|
20
|
+
elsif node.type == :ouput_declaration
|
21
|
+
direction = :output
|
22
|
+
else
|
23
|
+
direction = :io
|
24
|
+
end
|
25
|
+
if r = node.find(:range)
|
26
|
+
size = r.to_a[0] - r.to_a[1] + 1
|
27
|
+
offset = r.to_a[1]
|
28
|
+
else
|
29
|
+
size = 1
|
30
|
+
offset = nil
|
31
|
+
end
|
32
|
+
n = node.to_a.dup
|
33
|
+
while n.last.is_a?(String)
|
34
|
+
add_pin n.pop.to_sym, direction: direction, size: size, offset: offset, type: type
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
@@ -50,9 +50,39 @@ module OrigenVerilog
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
# Returns an array containing all input, output and inout AST nodes
|
54
|
-
|
55
|
-
|
53
|
+
# Returns an array containing all input, output and inout AST nodes.
|
54
|
+
# Supply analog: true in the options to return only those pins defined as a
|
55
|
+
# real/wreal type and digital: true to return only the pins without a real/wreal
|
56
|
+
# type.
|
57
|
+
def pins(options = {})
|
58
|
+
pins = find_all(:input_declaration, :output_declaration, :inout_declaration)
|
59
|
+
if options[:analog] || options[:digital]
|
60
|
+
wreals = self.wreals.map { |n| n.to_a.last }
|
61
|
+
subset = []
|
62
|
+
pins.each do |pin|
|
63
|
+
attrs = pin.to_a
|
64
|
+
if attrs.include?('real') || wreals.include?(attrs.last)
|
65
|
+
subset << pin if options[:analog]
|
66
|
+
else
|
67
|
+
subset << pin if options[:digital]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
subset
|
71
|
+
else
|
72
|
+
pins
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Returns an array containing all wire real/wreal declaration AST nodes, which have
|
77
|
+
# been declared as part of a module definition, returning something like this:
|
78
|
+
# [
|
79
|
+
# s(:net_declaration, "real", "vdd")),
|
80
|
+
# s(:net_declaration, "real", "vddf")),
|
81
|
+
# ]
|
82
|
+
def wreals
|
83
|
+
find_all(:non_port_module_item)
|
84
|
+
.map { |item| item.find(:net_declaration) }
|
85
|
+
.select { |net| net.to_a.include?('real') }
|
56
86
|
end
|
57
87
|
|
58
88
|
# Evaluates all functions and turns numbers into Ruby literals
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen_verilog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -59,7 +59,6 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- bin/fix_my_workspace
|
63
62
|
- config/application.rb
|
64
63
|
- config/boot.rb
|
65
64
|
- config/commands.rb
|
data/bin/fix_my_workspace
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$VERBOSE = nil # Don't care about world writable dir warnings and the like
|
3
|
-
|
4
|
-
if $_fix_my_workspace_version_check
|
5
|
-
$_fix_my_workspace_version = '0.7.0'
|
6
|
-
else
|
7
|
-
if File.exist?(File.expand_path('../../lib/origen.rb', __FILE__))
|
8
|
-
# If this script is being run from within an origen-core workspace, use that Origen-core,
|
9
|
-
# not the system-installed origen-core version.
|
10
|
-
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
11
|
-
require 'origen'
|
12
|
-
else
|
13
|
-
# Use system-installed Origen (the gem in system Ruby)
|
14
|
-
require 'origen'
|
15
|
-
end
|
16
|
-
|
17
|
-
if !Origen.site_config.gem_manage_bundler
|
18
|
-
puts 'Sorry but you have opted to manage Bundler yourself via your Origen site config, and this means'
|
19
|
-
puts 'that I cannot make certain assumptions about how your workspace is configured.'
|
20
|
-
puts 'You will need to either resolve this problem yourself, or else change the value of'
|
21
|
-
puts 'gem_mange_bundler to true.'
|
22
|
-
puts 'See here for more details on how to do that: http://origen-sdk.org/origen/guides/starting/company/'
|
23
|
-
|
24
|
-
else
|
25
|
-
ENV['BUNDLE_GEMFILE'] = File.join(Origen.root, 'Gemfile')
|
26
|
-
ENV['BUNDLE_PATH'] = File.expand_path(Origen.site_config.gem_install_dir)
|
27
|
-
ENV['BUNDLE_BIN'] = File.join(Origen.root, 'lbin')
|
28
|
-
|
29
|
-
# Force copy system gems to local gems
|
30
|
-
if Origen.site_config.gem_use_from_system
|
31
|
-
local_gem_dir = "#{ENV['BUNDLE_PATH']}/ruby/#{Pathname.new(Gem.dir).basename}"
|
32
|
-
gem_dir = Pathname.new(Gem.dir)
|
33
|
-
|
34
|
-
Origen.site_config.gem_use_from_system.each do |gem, version|
|
35
|
-
begin
|
36
|
-
# This will raise an error if the system doesn't have this gem installed, that
|
37
|
-
# will be rescued below
|
38
|
-
spec = Gem::Specification.find_by_name(gem, version)
|
39
|
-
|
40
|
-
local_dir = File.join(local_gem_dir, Pathname.new(spec.gem_dir).relative_path_from(gem_dir))
|
41
|
-
FileUtils.mkdir_p local_dir
|
42
|
-
FileUtils.cp_r("#{spec.gem_dir}/.", local_dir)
|
43
|
-
|
44
|
-
local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.cache_file).relative_path_from(gem_dir)))
|
45
|
-
FileUtils.mkdir_p local_file.dirname
|
46
|
-
FileUtils.cp(spec.cache_file, local_file)
|
47
|
-
|
48
|
-
if spec.extension_dir && File.exist?(spec.extension_dir)
|
49
|
-
local_dir = File.join(local_gem_dir, Pathname.new(spec.extension_dir).relative_path_from(gem_dir))
|
50
|
-
FileUtils.mkdir_p local_dir
|
51
|
-
FileUtils.cp_r("#{spec.extension_dir}/.", local_dir)
|
52
|
-
end
|
53
|
-
|
54
|
-
local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.spec_file).relative_path_from(gem_dir)))
|
55
|
-
FileUtils.mkdir_p local_file.dirname
|
56
|
-
FileUtils.cp(spec.spec_file, local_file)
|
57
|
-
|
58
|
-
rescue Gem::LoadError
|
59
|
-
# This just means that one of the gems that should be copied from the system
|
60
|
-
# was not actually installed in the system, so nothing we can do about that here
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Delete lbin
|
66
|
-
FileUtils.rm_rf(ENV['BUNDLE_BIN']) if File.exist?(ENV['BUNDLE_BIN'])
|
67
|
-
|
68
|
-
# Run bundler with correct switches
|
69
|
-
cmd = "bundle install --gemfile #{ENV['BUNDLE_GEMFILE']} --binstubs #{ENV['BUNDLE_BIN']} --path #{ENV['BUNDLE_PATH']}"
|
70
|
-
`chmod o-w #{Origen.root}` # Stops some annoying world writable warnings during install
|
71
|
-
`chmod o-w #{Origen.root}/bin` if File.exist?("#{Origen.root}/bin")
|
72
|
-
`chmod o-w #{Origen.root}/.bin` if File.exist?("#{Origen.root}/.bin")
|
73
|
-
|
74
|
-
# Try again, this time updating the bundle
|
75
|
-
if system(cmd)
|
76
|
-
fixed = true
|
77
|
-
elsif system 'bundle update'
|
78
|
-
fixed = true
|
79
|
-
end
|
80
|
-
|
81
|
-
if File.exist?(ENV['BUNDLE_BIN'])
|
82
|
-
`chmod o-w #{ENV['BUNDLE_BIN']}`
|
83
|
-
|
84
|
-
# Make .bat versions of all executables, Bundler should really be doing this when running
|
85
|
-
# on windows
|
86
|
-
if Origen.os.windows?
|
87
|
-
Dir.glob("#{ENV['BUNDLE_BIN']}/*").each do |bin|
|
88
|
-
unless bin =~ /.bat$/
|
89
|
-
bat = "#{bin}.bat"
|
90
|
-
unless File.exist?(bat)
|
91
|
-
File.open(bat, 'w') { |f| f.write('@"ruby.exe" "%~dpn0" %*') }
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
system 'origen -v' if fixed
|
99
|
-
end
|
100
|
-
end
|