HDLRuby 2.6.10 → 2.6.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HDLRuby/hdrcc.rb +64 -34
- data/lib/HDLRuby/hruby_high.rb +114 -114
- data/lib/HDLRuby/hruby_low.rb +27 -27
- data/lib/HDLRuby/hruby_low_resolve.rb +24 -0
- data/lib/HDLRuby/hruby_low_without_namespace.rb +6 -2
- data/lib/HDLRuby/hruby_tools.rb +24 -0
- data/lib/HDLRuby/hruby_verilog.rb +5 -5
- data/lib/HDLRuby/hruby_verilog_name.rb +24 -52
- data/lib/HDLRuby/std/function_generator.rb +9 -7
- data/lib/HDLRuby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752424361455f2bd949a8f90c9802337f3ce1d853ebff6bfa44bbe25ebeda369
|
4
|
+
data.tar.gz: f9c2dd84c0c875c423a94211948beaea44b54bfe234c01d6f35716b7df26053c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc71caee7a2435e579b533b4cbba22c6bc9ca9e8e75be4e57d4a629b7a467ac28a2a302f6d53cf7552a1c1f115e17f5ec7b7648eadc482ab62bc2fdff1319cc6
|
7
|
+
data.tar.gz: 4053a2050e82212db5901c7cb4756b21bca3465ec9ee4d08cd2875d8b57e5c53cd05df0405e2f5b249ec96b28271f514c8707fbb43b8e69db901ff9713a9b1f4
|
data/lib/HDLRuby/hdrcc.rb
CHANGED
@@ -110,7 +110,7 @@ module HDLRuby
|
|
110
110
|
else
|
111
111
|
# A standard file is found, skip it since it does not
|
112
112
|
# need to be read.
|
113
|
-
#
|
113
|
+
# show? "Standard files: #{founds}"
|
114
114
|
return false
|
115
115
|
end
|
116
116
|
end
|
@@ -134,7 +134,7 @@ module HDLRuby
|
|
134
134
|
file = @top_file_name
|
135
135
|
end
|
136
136
|
end
|
137
|
-
#
|
137
|
+
# show? "read_all with file=#{file}"
|
138
138
|
# Read the file
|
139
139
|
# read(file)
|
140
140
|
unless read(file) then
|
@@ -158,7 +158,7 @@ module HDLRuby
|
|
158
158
|
|
159
159
|
# Displays the syntax tree of all the files.
|
160
160
|
def show_all(outfile = $stdout)
|
161
|
-
#
|
161
|
+
# show? "@checks.size=#{@checks.size}"
|
162
162
|
@checks.each { |check| check.show(outfile) }
|
163
163
|
end
|
164
164
|
|
@@ -166,7 +166,7 @@ module HDLRuby
|
|
166
166
|
def get_top
|
167
167
|
# Get all the systems.
|
168
168
|
systems = @checks.reduce([]) {|ar,check| ar + check.get_all_systems}
|
169
|
-
#
|
169
|
+
# show? "First systems=#{systems}"
|
170
170
|
# Remove the systems that are instantiated or included
|
171
171
|
# (they cannot be tops)
|
172
172
|
@checks.each do |check|
|
@@ -183,7 +183,7 @@ module HDLRuby
|
|
183
183
|
systems -= check.get_inherit_systems(inherit)
|
184
184
|
end
|
185
185
|
end
|
186
|
-
#
|
186
|
+
# show? "Now systems=#{systems}"
|
187
187
|
# Return the first top of the list.
|
188
188
|
return systems[-1]
|
189
189
|
end
|
@@ -195,7 +195,7 @@ module HDLRuby
|
|
195
195
|
if @top_system == "" then
|
196
196
|
# No, look for it.
|
197
197
|
@top_system = get_top
|
198
|
-
#
|
198
|
+
# show? "@top_system=#{@top_system}"
|
199
199
|
unless @top_system then
|
200
200
|
# Not found? Error.
|
201
201
|
# Maybe it is a parse error, look for it.
|
@@ -238,7 +238,7 @@ module HDLRuby
|
|
238
238
|
# Dump to a file.
|
239
239
|
if chunk.name != :sim then
|
240
240
|
# The chunk is to be dumbed to a file.
|
241
|
-
#
|
241
|
+
# show? "Outputing chunk:#{HDLRuby::Low::Low2C.obj_name(chunk)}"
|
242
242
|
outfile = File.open(path + "/" +
|
243
243
|
HDLRuby::Low::Low2C.obj_name(chunk) + "." +
|
244
244
|
chunk.name.to_s,"w")
|
@@ -351,6 +351,12 @@ $optparse = OptionParser.new do |opts|
|
|
351
351
|
opts.on("-D", "--debug","Set the HDLRuby debug mode") do |d|
|
352
352
|
$options[:debug] = d
|
353
353
|
end
|
354
|
+
opts.on("--verbose","Set verbose mode.") do |d|
|
355
|
+
HDLRuby.verbosity = 2
|
356
|
+
end
|
357
|
+
opts.on("--volubile","Set extreme verbose mode.") do |d|
|
358
|
+
HDLRuby.verbosity = 3
|
359
|
+
end
|
354
360
|
opts.on("-T","--test t0,t1,t2","Compile the unit tests named t0,t1,...") do |t|
|
355
361
|
$options[:test] = t
|
356
362
|
end
|
@@ -396,7 +402,7 @@ $optparse = OptionParser.new do |opts|
|
|
396
402
|
end
|
397
403
|
$optparse.parse!
|
398
404
|
|
399
|
-
#
|
405
|
+
# show? "options=#{$options}"
|
400
406
|
|
401
407
|
# Check the compatibility of the options
|
402
408
|
if $options.count {|op| [:yaml,:hdr,:verilog,:vhdl].include?(op) } > 1 then
|
@@ -436,7 +442,7 @@ if ($options[:test] || $options[:testall]) then
|
|
436
442
|
$test_file.write("require 'std/hruby_unit.rb'\nrequire_relative '#{$input}'\n\n" +
|
437
443
|
"HDLRuby::Unit.test(:\"#{$top}\"#{tests})\n")
|
438
444
|
# $test_file.rewind
|
439
|
-
#
|
445
|
+
# show? $test_file.read
|
440
446
|
# exit
|
441
447
|
$test_file.rewind
|
442
448
|
# It is the new input file.
|
@@ -491,24 +497,28 @@ end
|
|
491
497
|
|
492
498
|
# Generate the result.
|
493
499
|
# Get the top systemT.
|
500
|
+
HDLRuby.show Time.now
|
494
501
|
$top_system = $top_instance.to_low.systemT
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
end
|
502
|
+
$top_intance = nil # Free as much memory as possible.
|
503
|
+
HDLRuby.show "##### Top system built #####"
|
504
|
+
HDLRuby.show Time.now
|
505
|
+
|
506
|
+
|
507
|
+
# # Apply the pre drivers if any.
|
508
|
+
# Hdecorator.each_with_property(:pre_driver) do |obj, value|
|
509
|
+
# unless value.is_a?(Array) && value.size == 2 then
|
510
|
+
# raise "pre_driver requires a driver file name command name."
|
511
|
+
# end
|
512
|
+
# # Load the driver.
|
513
|
+
# require_relative(value[0].to_s)
|
514
|
+
# # Ensure obj is the low version.
|
515
|
+
# if obj.properties.key?(:high2low) then
|
516
|
+
# # obj is high, get the corresponding low.
|
517
|
+
# obj = obj.properties[:high2low][0]
|
518
|
+
# end
|
519
|
+
# # Execute it.
|
520
|
+
# send(value[1].to_sym,obj,*value[2..-1])
|
521
|
+
# end
|
512
522
|
|
513
523
|
|
514
524
|
# Gather the non-HDLRuby code.
|
@@ -558,15 +568,23 @@ elsif $options[:clang] then
|
|
558
568
|
# top_system = $top_system
|
559
569
|
# Preprocess the HW description for valid C generation.
|
560
570
|
$top_system.each_systemT_deep do |systemT|
|
571
|
+
HDLRuby.show "seq2seq step..."
|
561
572
|
# Coverts the par blocks in seq blocks to seq blocks to match
|
562
573
|
# the simulation engine.
|
563
574
|
systemT.par_in_seq2seq!
|
575
|
+
HDLRuby.show Time.now
|
576
|
+
HDLRuby.show "connections_to_behaviors step..."
|
564
577
|
# Converts the connections to behaviors.
|
565
578
|
systemT.connections_to_behaviors!
|
579
|
+
HDLRuby.show Time.now
|
566
580
|
# Break the RefConcat.
|
581
|
+
HDLRuby.show "concat_assigns step..."
|
567
582
|
systemT.break_concat_assigns!
|
583
|
+
HDLRuby.show Time.now
|
568
584
|
# Explicits the types.
|
585
|
+
HDLRuby.show "explicit_types step..."
|
569
586
|
systemT.explicit_types!
|
587
|
+
HDLRuby.show Time.now
|
570
588
|
end
|
571
589
|
# Generate the C.
|
572
590
|
if $options[:multiple] then
|
@@ -637,7 +655,7 @@ elsif $options[:clang] then
|
|
637
655
|
name = $output + "/" +
|
638
656
|
HDLRuby::Low::Low2C.c_name(systemT.name) +
|
639
657
|
".c"
|
640
|
-
#
|
658
|
+
# show? "for systemT=#{systemT.name} generating: #{name}"
|
641
659
|
# Open the file for current systemT
|
642
660
|
outfile = File.open(name,"w")
|
643
661
|
# Generate the C code in to.
|
@@ -691,14 +709,26 @@ elsif $options[:verilog] then
|
|
691
709
|
# top_system = $top_system
|
692
710
|
# Make description compatible with verilog generation.
|
693
711
|
$top_system.each_systemT_deep do |systemT|
|
712
|
+
HDLRuby.show "casts_without_expression! step..."
|
694
713
|
systemT.casts_without_expression!
|
714
|
+
HDLRuby.show Time.now
|
715
|
+
HDLRuby.show "to_upper_space! step..."
|
695
716
|
systemT.to_upper_space!
|
717
|
+
HDLRuby.show Time.now
|
718
|
+
HDLRuby.show "to_global_space! step..."
|
696
719
|
systemT.to_global_systemTs!
|
720
|
+
HDLRuby.show Time.now
|
697
721
|
# systemT.break_types!
|
698
722
|
# systemT.expand_types!
|
723
|
+
HDLRuby.show "par_in_seq2seq! step..."
|
699
724
|
systemT.par_in_seq2seq!
|
725
|
+
HDLRuby.show Time.now
|
726
|
+
HDLRuby.show "initial_concat_to_timed! step..."
|
700
727
|
systemT.initial_concat_to_timed!
|
728
|
+
HDLRuby.show Time.now
|
729
|
+
HDLRuby.show "with_port! step..."
|
701
730
|
systemT.with_port!
|
731
|
+
HDLRuby.show Time.now
|
702
732
|
end
|
703
733
|
# # Verilog generation
|
704
734
|
# $output << top_system.to_verilog
|
@@ -788,13 +818,13 @@ elsif $options[:vhdl] then
|
|
788
818
|
end
|
789
819
|
end
|
790
820
|
|
791
|
-
# Apply the post drivers if any.
|
792
|
-
Hdecorator.each_with_property(:post_driver) do |obj, value|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
end
|
821
|
+
# # Apply the post drivers if any.
|
822
|
+
# Hdecorator.each_with_property(:post_driver) do |obj, value|
|
823
|
+
# # Load the driver.
|
824
|
+
# require_relative(value[0].to_s)
|
825
|
+
# # Execute it.
|
826
|
+
# send(value[1].to_sym,obj,$output)
|
827
|
+
# end
|
798
828
|
|
799
829
|
# Dump the properties
|
800
830
|
if $options[:dump] then
|
data/lib/HDLRuby/hruby_high.rb
CHANGED
@@ -763,9 +763,9 @@ module HDLRuby::High
|
|
763
763
|
systemTL = HDLRuby::Low::SystemT.new(HDLRuby.uniq_name(name),
|
764
764
|
self.scope.to_low)
|
765
765
|
# puts "New low from system #{self.name}: #{systemTL.name}"
|
766
|
-
# For debugging: set the source high object
|
767
|
-
systemTL.properties[:low2high] = self.hdr_id
|
768
|
-
self.properties[:high2low] = systemTL
|
766
|
+
# # For debugging: set the source high object
|
767
|
+
# systemTL.properties[:low2high] = self.hdr_id
|
768
|
+
# self.properties[:high2low] = systemTL
|
769
769
|
|
770
770
|
# Fills the interface of the new system
|
771
771
|
# from the included systems.
|
@@ -1311,9 +1311,9 @@ module HDLRuby::High
|
|
1311
1311
|
# Create the resulting low scope.
|
1312
1312
|
# scopeL = HDLRuby::Low::Scope.new()
|
1313
1313
|
scopeL = HDLRuby::Low::Scope.new(self.name)
|
1314
|
-
# For debugging: set the source high object
|
1315
|
-
scopeL.properties[:low2high] = self.hdr_id
|
1316
|
-
self.properties[:high2low] = scopeL
|
1314
|
+
# # For debugging: set the source high object
|
1315
|
+
# scopeL.properties[:low2high] = self.hdr_id
|
1316
|
+
# self.properties[:high2low] = scopeL
|
1317
1317
|
|
1318
1318
|
# Push the private namespace for the low generation.
|
1319
1319
|
High.space_push(@namespace)
|
@@ -1545,9 +1545,9 @@ module HDLRuby::High
|
|
1545
1545
|
def to_low(name = self.name)
|
1546
1546
|
# return HDLRuby::Low::Type.new(name)
|
1547
1547
|
typeL = HDLRuby::Low::Type.new(name)
|
1548
|
-
# For debugging: set the source high object
|
1549
|
-
typeL.properties[:low2high] = self.hdr_id
|
1550
|
-
self.properties[:high2low] = typeL
|
1548
|
+
# # For debugging: set the source high object
|
1549
|
+
# typeL.properties[:low2high] = self.hdr_id
|
1550
|
+
# self.properties[:high2low] = typeL
|
1551
1551
|
return typeL
|
1552
1552
|
end
|
1553
1553
|
end
|
@@ -1699,9 +1699,9 @@ module HDLRuby::High
|
|
1699
1699
|
def to_low(name = self.name)
|
1700
1700
|
# return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1701
1701
|
typeDefL = HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1702
|
-
# For debugging: set the source high object
|
1703
|
-
typeDefL.properties[:low2high] = self.hdr_id
|
1704
|
-
self.properties[:high2low] = typeDefL
|
1702
|
+
# # For debugging: set the source high object
|
1703
|
+
# typeDefL.properties[:low2high] = self.hdr_id
|
1704
|
+
# self.properties[:high2low] = typeDefL
|
1705
1705
|
return typeDefL
|
1706
1706
|
end
|
1707
1707
|
end
|
@@ -1752,9 +1752,9 @@ module HDLRuby::High
|
|
1752
1752
|
def to_low(name = self.name)
|
1753
1753
|
# return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1754
1754
|
typeDefL = HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1755
|
-
# For debugging: set the source high object
|
1756
|
-
typeDefL.properties[:low2high] = self.hdr_id
|
1757
|
-
self.properties[:high2low] = typeDefL
|
1755
|
+
# # For debugging: set the source high object
|
1756
|
+
# typeDefL.properties[:low2high] = self.hdr_id
|
1757
|
+
# self.properties[:high2low] = typeDefL
|
1758
1758
|
return typeDefL
|
1759
1759
|
end
|
1760
1760
|
end
|
@@ -1770,9 +1770,9 @@ module HDLRuby::High
|
|
1770
1770
|
# self.range.to_low)
|
1771
1771
|
typeVectorL = HDLRuby::Low::TypeVector.new(name,self.base.to_low,
|
1772
1772
|
self.range.to_low)
|
1773
|
-
# For debugging: set the source high object
|
1774
|
-
typeVectorL.properties[:low2high] = self.hdr_id
|
1775
|
-
self.properties[:high2low] = typeVectorL
|
1773
|
+
# # For debugging: set the source high object
|
1774
|
+
# typeVectorL.properties[:low2high] = self.hdr_id
|
1775
|
+
# self.properties[:high2low] = typeVectorL
|
1776
1776
|
return typeVectorL
|
1777
1777
|
end
|
1778
1778
|
end
|
@@ -1850,9 +1850,9 @@ module HDLRuby::High
|
|
1850
1850
|
# *@types.map { |type| type.to_low } )
|
1851
1851
|
typeTupleL = HDLRuby::Low::TypeTuple.new(name,self.direction,
|
1852
1852
|
*@types.map { |type| type.to_low } )
|
1853
|
-
# For debugging: set the source high object
|
1854
|
-
typeTupleL.properties[:low2high] = self.hdr_id
|
1855
|
-
self.properties[:high2low] = typeTupleL
|
1853
|
+
# # For debugging: set the source high object
|
1854
|
+
# typeTupleL.properties[:low2high] = self.hdr_id
|
1855
|
+
# self.properties[:high2low] = typeTupleL
|
1856
1856
|
return typeTupleL
|
1857
1857
|
end
|
1858
1858
|
end
|
@@ -1871,9 +1871,9 @@ module HDLRuby::High
|
|
1871
1871
|
# @types.map { |name,type| [name,type.to_low] } )
|
1872
1872
|
typeStructL = HDLRuby::Low::TypeStruct.new(name,self.direction,
|
1873
1873
|
@types.map { |name,type| [name,type.to_low] } )
|
1874
|
-
# For debugging: set the source high object
|
1875
|
-
typeStructL.properties[:low2high] = self.hdr_id
|
1876
|
-
self.properties[:high2low] = typeStructL
|
1874
|
+
# # For debugging: set the source high object
|
1875
|
+
# typeStructL.properties[:low2high] = self.hdr_id
|
1876
|
+
# self.properties[:high2low] = typeStructL
|
1877
1877
|
return typeStructL
|
1878
1878
|
end
|
1879
1879
|
end
|
@@ -2111,9 +2111,9 @@ module HDLRuby::High
|
|
2111
2111
|
# Creates the resulting HDLRuby::Low instance
|
2112
2112
|
systemIL = HDLRuby::Low::SystemI.new(High.names_create(name),
|
2113
2113
|
systemTL)
|
2114
|
-
# For debugging: set the source high object
|
2115
|
-
systemIL.properties[:low2high] = self.hdr_id
|
2116
|
-
self.properties[:high2low] = systemIL
|
2114
|
+
# # For debugging: set the source high object
|
2115
|
+
# systemIL.properties[:low2high] = self.hdr_id
|
2116
|
+
# self.properties[:high2low] = systemIL
|
2117
2117
|
# Adds the other systemTs.
|
2118
2118
|
self.each_systemT do |systemT|
|
2119
2119
|
systemIL.add_systemT(systemT.to_low) unless systemT == self.systemT
|
@@ -2139,9 +2139,9 @@ module HDLRuby::High
|
|
2139
2139
|
lump = lump.respond_to?(:to_low) ? lump.to_low : lump.to_s
|
2140
2140
|
lump
|
2141
2141
|
end)
|
2142
|
-
# For debugging: set the source high object
|
2143
|
-
chunkL.properties[:low2high] = self.hdr_id
|
2144
|
-
self.properties[:high2low] = chunkL
|
2142
|
+
# # For debugging: set the source high object
|
2143
|
+
# chunkL.properties[:low2high] = self.hdr_id
|
2144
|
+
# self.properties[:high2low] = chunkL
|
2145
2145
|
return chunkL
|
2146
2146
|
end
|
2147
2147
|
end
|
@@ -2153,9 +2153,9 @@ module HDLRuby::High
|
|
2153
2153
|
def to_low
|
2154
2154
|
# Create the resulting code.
|
2155
2155
|
codeL = HDLRuby::Low::Code.new
|
2156
|
-
# For debugging: set the source high object
|
2157
|
-
codeL.properties[:low2high] = self.hdr_id
|
2158
|
-
self.properties[:high2low] = codeL
|
2156
|
+
# # For debugging: set the source high object
|
2157
|
+
# codeL.properties[:low2high] = self.hdr_id
|
2158
|
+
# self.properties[:high2low] = codeL
|
2159
2159
|
# Add the low-level events.
|
2160
2160
|
self.each_event { |event| codeL.add_event(event.to_low) }
|
2161
2161
|
# Add the low-level code chunks.
|
@@ -2247,9 +2247,9 @@ module HDLRuby::High
|
|
2247
2247
|
ifL = HDLRuby::Low::If.new(self.condition.to_low,
|
2248
2248
|
self.yes.to_low,noL)
|
2249
2249
|
self.each_noif {|cond,block| ifL.add_noif(cond.to_low,block.to_low)}
|
2250
|
-
# For debugging: set the source high object
|
2251
|
-
ifL.properties[:low2high] = self.hdr_id
|
2252
|
-
self.properties[:high2low] = ifL
|
2250
|
+
# # For debugging: set the source high object
|
2251
|
+
# ifL.properties[:low2high] = self.hdr_id
|
2252
|
+
# self.properties[:high2low] = ifL
|
2253
2253
|
return ifL
|
2254
2254
|
end
|
2255
2255
|
end
|
@@ -2272,9 +2272,9 @@ module HDLRuby::High
|
|
2272
2272
|
# self.statement.to_low)
|
2273
2273
|
whenL = HDLRuby::Low::When.new(self.match.to_low,
|
2274
2274
|
self.statement.to_low)
|
2275
|
-
# For debugging: set the source high object
|
2276
|
-
whenL.properties[:low2high] = self.hdr_id
|
2277
|
-
self.properties[:high2low] = whenL
|
2275
|
+
# # For debugging: set the source high object
|
2276
|
+
# whenL.properties[:low2high] = self.hdr_id
|
2277
|
+
# self.properties[:high2low] = whenL
|
2278
2278
|
return whenL
|
2279
2279
|
end
|
2280
2280
|
end
|
@@ -2320,9 +2320,9 @@ module HDLRuby::High
|
|
2320
2320
|
def to_low
|
2321
2321
|
# Create the low level case.
|
2322
2322
|
caseL = HDLRuby::Low::Case.new(@value.to_low)
|
2323
|
-
# For debugging: set the source high object
|
2324
|
-
caseL.properties[:low2high] = self.hdr_id
|
2325
|
-
self.properties[:high2low] = caseL
|
2323
|
+
# # For debugging: set the source high object
|
2324
|
+
# caseL.properties[:low2high] = self.hdr_id
|
2325
|
+
# self.properties[:high2low] = caseL
|
2326
2326
|
# Add each when case.
|
2327
2327
|
self.each_when do |w|
|
2328
2328
|
caseL.add_when(w.to_low)
|
@@ -2351,9 +2351,9 @@ module HDLRuby::High
|
|
2351
2351
|
def to_low
|
2352
2352
|
# return HDLRuby::Low::Delay.new(self.value, self.unit)
|
2353
2353
|
delayL = HDLRuby::Low::Delay.new(self.value, self.unit)
|
2354
|
-
# For debugging: set the source high object
|
2355
|
-
delayL.properties[:low2high] = self.hdr_id
|
2356
|
-
self.properties[:high2low] = delayL
|
2354
|
+
# # For debugging: set the source high object
|
2355
|
+
# delayL.properties[:low2high] = self.hdr_id
|
2356
|
+
# self.properties[:high2low] = delayL
|
2357
2357
|
return delayL
|
2358
2358
|
end
|
2359
2359
|
end
|
@@ -2367,9 +2367,9 @@ module HDLRuby::High
|
|
2367
2367
|
def to_low
|
2368
2368
|
# return HDLRuby::Low::TimeWait.new(self.delay.to_low)
|
2369
2369
|
timeWaitL = HDLRuby::Low::TimeWait.new(self.delay.to_low)
|
2370
|
-
# For debugging: set the source high object
|
2371
|
-
timeWaitL.properties[:low2high] = self.hdr_id
|
2372
|
-
self.properties[:high2low] = timeWaitL
|
2370
|
+
# # For debugging: set the source high object
|
2371
|
+
# timeWaitL.properties[:low2high] = self.hdr_id
|
2372
|
+
# self.properties[:high2low] = timeWaitL
|
2373
2373
|
return timeWaitL
|
2374
2374
|
end
|
2375
2375
|
end
|
@@ -2386,9 +2386,9 @@ module HDLRuby::High
|
|
2386
2386
|
# self.delay.to_low)
|
2387
2387
|
timeRepeatL = HDLRuby::Low::TimeRepeat.new(self.statement.to_low,
|
2388
2388
|
self.delay.to_low)
|
2389
|
-
# For debugging: set the source high object
|
2390
|
-
timeRepeatL.properties[:low2high] = self.hdr_id
|
2391
|
-
self.properties[:high2low] = timeRepeatL
|
2389
|
+
# # For debugging: set the source high object
|
2390
|
+
# timeRepeatL.properties[:low2high] = self.hdr_id
|
2391
|
+
# self.properties[:high2low] = timeRepeatL
|
2392
2392
|
return timeRepeatL
|
2393
2393
|
end
|
2394
2394
|
end
|
@@ -2746,9 +2746,9 @@ module HDLRuby::High
|
|
2746
2746
|
def to_low
|
2747
2747
|
# return HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
|
2748
2748
|
castL =HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
|
2749
|
-
# For debugging: set the source high object
|
2750
|
-
castL.properties[:low2high] = self.hdr_id
|
2751
|
-
self.properties[:high2low] = castL
|
2749
|
+
# # For debugging: set the source high object
|
2750
|
+
# castL.properties[:low2high] = self.hdr_id
|
2751
|
+
# self.properties[:high2low] = castL
|
2752
2752
|
return castL
|
2753
2753
|
end
|
2754
2754
|
end
|
@@ -2770,9 +2770,9 @@ module HDLRuby::High
|
|
2770
2770
|
# self.child.to_low)
|
2771
2771
|
unaryL = HDLRuby::Low::Unary.new(self.type.to_low, self.operator,
|
2772
2772
|
self.child.to_low)
|
2773
|
-
# For debugging: set the source high object
|
2774
|
-
unaryL.properties[:low2high] = self.hdr_id
|
2775
|
-
self.properties[:high2low] = unaryL
|
2773
|
+
# # For debugging: set the source high object
|
2774
|
+
# unaryL.properties[:low2high] = self.hdr_id
|
2775
|
+
# self.properties[:high2low] = unaryL
|
2776
2776
|
return unaryL
|
2777
2777
|
end
|
2778
2778
|
end
|
@@ -2795,9 +2795,9 @@ module HDLRuby::High
|
|
2795
2795
|
# self.left.to_low, self.right.to_low)
|
2796
2796
|
binaryL = HDLRuby::Low::Binary.new(self.type.to_low, self.operator,
|
2797
2797
|
self.left.to_low, self.right.to_low)
|
2798
|
-
# For debugging: set the source high object
|
2799
|
-
binaryL.properties[:low2high] = self.hdr_id
|
2800
|
-
self.properties[:high2low] = binaryL
|
2798
|
+
# # For debugging: set the source high object
|
2799
|
+
# binaryL.properties[:low2high] = self.hdr_id
|
2800
|
+
# self.properties[:high2low] = binaryL
|
2801
2801
|
return binaryL
|
2802
2802
|
end
|
2803
2803
|
end
|
@@ -2830,9 +2830,9 @@ module HDLRuby::High
|
|
2830
2830
|
*self.each_choice.map do |choice|
|
2831
2831
|
choice.to_low
|
2832
2832
|
end)
|
2833
|
-
# For debugging: set the source high object
|
2834
|
-
selectL.properties[:low2high] = self.hdr_id
|
2835
|
-
self.properties[:high2low] = selectL
|
2833
|
+
# # For debugging: set the source high object
|
2834
|
+
# selectL.properties[:low2high] = self.hdr_id
|
2835
|
+
# self.properties[:high2low] = selectL
|
2836
2836
|
return selectL
|
2837
2837
|
end
|
2838
2838
|
end
|
@@ -2864,9 +2864,9 @@ module HDLRuby::High
|
|
2864
2864
|
expr.to_low
|
2865
2865
|
end
|
2866
2866
|
)
|
2867
|
-
# For debugging: set the source high object
|
2868
|
-
concatL.properties[:low2high] = self.hdr_id
|
2869
|
-
self.properties[:high2low] = concatL
|
2867
|
+
# # For debugging: set the source high object
|
2868
|
+
# concatL.properties[:low2high] = self.hdr_id
|
2869
|
+
# self.properties[:high2low] = concatL
|
2870
2870
|
return concatL
|
2871
2871
|
end
|
2872
2872
|
end
|
@@ -2908,9 +2908,9 @@ module HDLRuby::High
|
|
2908
2908
|
# Create and return the resulting low-level value
|
2909
2909
|
# return HDLRuby::Low::Value.new(self.type.to_low,self.content)
|
2910
2910
|
valueL = HDLRuby::Low::Value.new(self.type.to_low,self.content)
|
2911
|
-
# For debugging: set the source high object
|
2912
|
-
valueL.properties[:low2high] = self.hdr_id
|
2913
|
-
self.properties[:high2low] = valueL
|
2911
|
+
# # For debugging: set the source high object
|
2912
|
+
# valueL.properties[:low2high] = self.hdr_id
|
2913
|
+
# self.properties[:high2low] = valueL
|
2914
2914
|
return valueL
|
2915
2915
|
end
|
2916
2916
|
|
@@ -3016,9 +3016,9 @@ module HDLRuby::High
|
|
3016
3016
|
# puts "to_low with base=#{@base} @object=#{@object}"
|
3017
3017
|
refNameL = HDLRuby::Low::RefName.new(self.type.to_low,
|
3018
3018
|
@base.to_ref.to_low,@object.name)
|
3019
|
-
# For debugging: set the source high object
|
3020
|
-
refNameL.properties[:low2high] = self.hdr_id
|
3021
|
-
self.properties[:high2low] = refNameL
|
3019
|
+
# # For debugging: set the source high object
|
3020
|
+
# refNameL.properties[:low2high] = self.hdr_id
|
3021
|
+
# self.properties[:high2low] = refNameL
|
3022
3022
|
return refNameL
|
3023
3023
|
end
|
3024
3024
|
|
@@ -3056,9 +3056,9 @@ module HDLRuby::High
|
|
3056
3056
|
ref.to_low
|
3057
3057
|
end
|
3058
3058
|
)
|
3059
|
-
# For debugging: set the source high object
|
3060
|
-
refConcatL.properties[:low2high] = self.hdr_id
|
3061
|
-
self.properties[:high2low] = refConcatL
|
3059
|
+
# # For debugging: set the source high object
|
3060
|
+
# refConcatL.properties[:low2high] = self.hdr_id
|
3061
|
+
# self.properties[:high2low] = refConcatL
|
3062
3062
|
return refConcatL
|
3063
3063
|
end
|
3064
3064
|
end
|
@@ -3080,9 +3080,9 @@ module HDLRuby::High
|
|
3080
3080
|
# self.ref.to_low,self.index.to_low)
|
3081
3081
|
refIndexL = HDLRuby::Low::RefIndex.new(self.type.to_low,
|
3082
3082
|
self.ref.to_low,self.index.to_low)
|
3083
|
-
# For debugging: set the source high object
|
3084
|
-
refIndexL.properties[:low2high] = self.hdr_id
|
3085
|
-
self.properties[:high2low] = refIndexL
|
3083
|
+
# # For debugging: set the source high object
|
3084
|
+
# refIndexL.properties[:low2high] = self.hdr_id
|
3085
|
+
# self.properties[:high2low] = refIndexL
|
3086
3086
|
return refIndexL
|
3087
3087
|
end
|
3088
3088
|
end
|
@@ -3104,9 +3104,9 @@ module HDLRuby::High
|
|
3104
3104
|
# self.ref.to_low,self.range.to_low)
|
3105
3105
|
refRangeL = HDLRuby::Low::RefRange.new(self.type.to_low,
|
3106
3106
|
self.ref.to_low,self.range.to_low)
|
3107
|
-
# For debugging: set the source high object
|
3108
|
-
refRangeL.properties[:low2high] = self.hdr_id
|
3109
|
-
self.properties[:high2low] = refRangeL
|
3107
|
+
# # For debugging: set the source high object
|
3108
|
+
# refRangeL.properties[:low2high] = self.hdr_id
|
3109
|
+
# self.properties[:high2low] = refRangeL
|
3110
3110
|
return refRangeL
|
3111
3111
|
end
|
3112
3112
|
end
|
@@ -3127,9 +3127,9 @@ module HDLRuby::High
|
|
3127
3127
|
# self.ref.to_low,self.name)
|
3128
3128
|
refNameL = HDLRuby::Low::RefName.new(self.type.to_low,
|
3129
3129
|
self.ref.to_low,self.name)
|
3130
|
-
# For debugging: set the source high object
|
3131
|
-
refNameL.properties[:low2high] = self.hdr_id
|
3132
|
-
self.properties[:high2low] = refNameL
|
3130
|
+
# # For debugging: set the source high object
|
3131
|
+
# refNameL.properties[:low2high] = self.hdr_id
|
3132
|
+
# self.properties[:high2low] = refNameL
|
3133
3133
|
return refNameL
|
3134
3134
|
end
|
3135
3135
|
end
|
@@ -3164,9 +3164,9 @@ module HDLRuby::High
|
|
3164
3164
|
def to_low
|
3165
3165
|
# return HDLRuby::Low::RefThis.new
|
3166
3166
|
refThisL = HDLRuby::Low::RefThis.new
|
3167
|
-
# For debugging: set the source high object
|
3168
|
-
refThisL.properties[:low2high] = self.hdr_id
|
3169
|
-
self.properties[:high2low] = refThisL
|
3167
|
+
# # For debugging: set the source high object
|
3168
|
+
# refThisL.properties[:low2high] = self.hdr_id
|
3169
|
+
# self.properties[:high2low] = refThisL
|
3170
3170
|
return refThisL
|
3171
3171
|
end
|
3172
3172
|
end
|
@@ -3237,9 +3237,9 @@ module HDLRuby::High
|
|
3237
3237
|
def to_low
|
3238
3238
|
# return HDLRuby::Low::Event.new(self.type,self.ref.to_low)
|
3239
3239
|
eventL = HDLRuby::Low::Event.new(self.type,self.ref.to_low)
|
3240
|
-
# For debugging: set the source high object
|
3241
|
-
eventL.properties[:low2high] = self.hdr_id
|
3242
|
-
self.properties[:high2low] = eventL
|
3240
|
+
# # For debugging: set the source high object
|
3241
|
+
# eventL.properties[:low2high] = self.hdr_id
|
3242
|
+
# self.properties[:high2low] = eventL
|
3243
3243
|
return eventL
|
3244
3244
|
end
|
3245
3245
|
end
|
@@ -3280,9 +3280,9 @@ module HDLRuby::High
|
|
3280
3280
|
# self.right.to_low)
|
3281
3281
|
transmitL = HDLRuby::Low::Transmit.new(self.left.to_low,
|
3282
3282
|
self.right.to_low)
|
3283
|
-
# For debugging: set the source high object
|
3284
|
-
transmitL.properties[:low2high] = self.hdr_id
|
3285
|
-
self.properties[:high2low] = transmitL
|
3283
|
+
# # For debugging: set the source high object
|
3284
|
+
# transmitL.properties[:low2high] = self.hdr_id
|
3285
|
+
# self.properties[:high2low] = transmitL
|
3286
3286
|
return transmitL
|
3287
3287
|
end
|
3288
3288
|
end
|
@@ -3373,9 +3373,9 @@ module HDLRuby::High
|
|
3373
3373
|
# self.right.to_low)
|
3374
3374
|
connectionL = HDLRuby::Low::Connection.new(self.left.to_low,
|
3375
3375
|
self.right.to_low)
|
3376
|
-
# For debugging: set the source high object
|
3377
|
-
connectionL.properties[:low2high] = self.hdr_id
|
3378
|
-
self.properties[:high2low] = connectionL
|
3376
|
+
# # For debugging: set the source high object
|
3377
|
+
# connectionL.properties[:low2high] = self.hdr_id
|
3378
|
+
# self.properties[:high2low] = connectionL
|
3379
3379
|
return connectionL
|
3380
3380
|
end
|
3381
3381
|
end
|
@@ -3487,9 +3487,9 @@ module HDLRuby::High
|
|
3487
3487
|
def to_low(name = self.name)
|
3488
3488
|
# return HDLRuby::Low::SignalI.new(name,self.type.to_low)
|
3489
3489
|
signalIL = HDLRuby::Low::SignalI.new(name,self.type.to_low)
|
3490
|
-
# For debugging: set the source high object
|
3491
|
-
signalIL.properties[:low2high] = self.hdr_id
|
3492
|
-
self.properties[:high2low] = signalIL
|
3490
|
+
# # For debugging: set the source high object
|
3491
|
+
# signalIL.properties[:low2high] = self.hdr_id
|
3492
|
+
# self.properties[:high2low] = signalIL
|
3493
3493
|
return signalIL
|
3494
3494
|
end
|
3495
3495
|
end
|
@@ -3553,9 +3553,9 @@ module HDLRuby::High
|
|
3553
3553
|
# self.value.to_low)
|
3554
3554
|
signalCL = HDLRuby::Low::SignalC.new(name,self.type.to_low,
|
3555
3555
|
self.value.to_low)
|
3556
|
-
# For debugging: set the source high object
|
3557
|
-
signalCL.properties[:low2high] = self.hdr_id
|
3558
|
-
self.properties[:high2low] = signalCL
|
3556
|
+
# # For debugging: set the source high object
|
3557
|
+
# signalCL.properties[:low2high] = self.hdr_id
|
3558
|
+
# self.properties[:high2low] = signalCL
|
3559
3559
|
return signalCL
|
3560
3560
|
end
|
3561
3561
|
end
|
@@ -3766,9 +3766,9 @@ module HDLRuby::High
|
|
3766
3766
|
def to_low
|
3767
3767
|
# Create the resulting block
|
3768
3768
|
blockL = HDLRuby::Low::Block.new(self.mode)
|
3769
|
-
# For debugging: set the source high object
|
3770
|
-
blockL.properties[:low2high] = self.hdr_id
|
3771
|
-
self.properties[:high2low] = blockL
|
3769
|
+
# # For debugging: set the source high object
|
3770
|
+
# blockL.properties[:low2high] = self.hdr_id
|
3771
|
+
# self.properties[:high2low] = blockL
|
3772
3772
|
# Push the namespace for the low generation.
|
3773
3773
|
High.space_push(@namespace)
|
3774
3774
|
# Pushes on the name stack for converting the internals of
|
@@ -3836,9 +3836,9 @@ module HDLRuby::High
|
|
3836
3836
|
def to_low
|
3837
3837
|
# Create the resulting block
|
3838
3838
|
blockL = HDLRuby::Low::TimeBlock.new(self.mode)
|
3839
|
-
# For debugging: set the source high object
|
3840
|
-
blockL.properties[:low2high] = self.hdr_id
|
3841
|
-
self.properties[:high2low] = blockL
|
3839
|
+
# # For debugging: set the source high object
|
3840
|
+
# blockL.properties[:low2high] = self.hdr_id
|
3841
|
+
# self.properties[:high2low] = blockL
|
3842
3842
|
# Add the inner signals
|
3843
3843
|
self.each_inner { |inner| blockL.add_inner(inner.to_low) }
|
3844
3844
|
# Add the statements
|
@@ -3930,9 +3930,9 @@ module HDLRuby::High
|
|
3930
3930
|
eventLs = self.each_event.map { |event| event.to_low }
|
3931
3931
|
# Create and return the resulting low level behavior.
|
3932
3932
|
behaviorL = HDLRuby::Low::Behavior.new(blockL)
|
3933
|
-
# For debugging: set the source high object
|
3934
|
-
behaviorL.properties[:low2high] = self.hdr_id
|
3935
|
-
self.properties[:high2low] = behaviorL
|
3933
|
+
# # For debugging: set the source high object
|
3934
|
+
# behaviorL.properties[:low2high] = self.hdr_id
|
3935
|
+
# self.properties[:high2low] = behaviorL
|
3936
3936
|
eventLs.each(&behaviorL.method(:add_event))
|
3937
3937
|
return behaviorL
|
3938
3938
|
end
|
@@ -3960,9 +3960,9 @@ module HDLRuby::High
|
|
3960
3960
|
eventLs = self.each_event.map { |event| event.to_low }
|
3961
3961
|
# Create and return the resulting low level behavior.
|
3962
3962
|
timeBehaviorL = HDLRuby::Low::TimeBehavior.new(blockL)
|
3963
|
-
# For debugging: set the source high object
|
3964
|
-
timeBehaviorL.properties[:low2high] = self.hdr_id
|
3965
|
-
self.properties[:high2low] = timeBehaviorL
|
3963
|
+
# # For debugging: set the source high object
|
3964
|
+
# timeBehaviorL.properties[:low2high] = self.hdr_id
|
3965
|
+
# self.properties[:high2low] = timeBehaviorL
|
3966
3966
|
eventLs.each(&timeBehaviorL.method(:add_event))
|
3967
3967
|
return timeBehaviorL
|
3968
3968
|
end
|
data/lib/HDLRuby/hruby_low.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "HDLRuby/hruby_bstr"
|
2
2
|
require "HDLRuby/hruby_error"
|
3
|
-
require "HDLRuby/hruby_decorator"
|
3
|
+
# require "HDLRuby/hruby_decorator"
|
4
4
|
require 'forwardable'
|
5
5
|
|
6
6
|
|
@@ -36,7 +36,7 @@ module HDLRuby::Low
|
|
36
36
|
end
|
37
37
|
|
38
38
|
|
39
|
-
Hdecorator = HDLRuby::Hdecorator
|
39
|
+
# Hdecorator = HDLRuby::Hdecorator
|
40
40
|
|
41
41
|
##
|
42
42
|
# Gives parent definition and access properties to an hardware object.
|
@@ -118,8 +118,8 @@ module HDLRuby::Low
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
# Add decorator capability (modifies intialize to put after).
|
122
|
-
include Hdecorator
|
121
|
+
# # Add decorator capability (modifies intialize to put after).
|
122
|
+
# include Hdecorator
|
123
123
|
|
124
124
|
# Comparison for hash: structural comparison.
|
125
125
|
def eql?(obj)
|
@@ -455,8 +455,8 @@ module HDLRuby::Low
|
|
455
455
|
@behaviors = []
|
456
456
|
end
|
457
457
|
|
458
|
-
# Add decorator capability (modifies intialize to put after).
|
459
|
-
include Hdecorator
|
458
|
+
# # Add decorator capability (modifies intialize to put after).
|
459
|
+
# include Hdecorator
|
460
460
|
|
461
461
|
# Comparison for hash: structural comparison.
|
462
462
|
def eql?(obj)
|
@@ -1221,8 +1221,8 @@ module HDLRuby::Low
|
|
1221
1221
|
@name = name.to_sym
|
1222
1222
|
end
|
1223
1223
|
|
1224
|
-
# Add decorator capability (modifies intialize to put after).
|
1225
|
-
include Hdecorator
|
1224
|
+
# # Add decorator capability (modifies intialize to put after).
|
1225
|
+
# include Hdecorator
|
1226
1226
|
|
1227
1227
|
# Comparison for hash: structural comparison.
|
1228
1228
|
def eql?(obj)
|
@@ -2124,8 +2124,8 @@ module HDLRuby::Low
|
|
2124
2124
|
# @block = block
|
2125
2125
|
end
|
2126
2126
|
|
2127
|
-
# Add decorator capability (modifies intialize to put after).
|
2128
|
-
include Hdecorator
|
2127
|
+
# # Add decorator capability (modifies intialize to put after).
|
2128
|
+
# include Hdecorator
|
2129
2129
|
|
2130
2130
|
# Sets the block if not already set.
|
2131
2131
|
def block=(block)
|
@@ -2348,8 +2348,8 @@ module HDLRuby::Low
|
|
2348
2348
|
ref.parent = self
|
2349
2349
|
end
|
2350
2350
|
|
2351
|
-
# Add decorator capability (modifies intialize to put after).
|
2352
|
-
include Hdecorator
|
2351
|
+
# # Add decorator capability (modifies intialize to put after).
|
2352
|
+
# include Hdecorator
|
2353
2353
|
|
2354
2354
|
# Comparison for hash: structural comparison.
|
2355
2355
|
def eql?(obj)
|
@@ -2432,8 +2432,8 @@ module HDLRuby::Low
|
|
2432
2432
|
false
|
2433
2433
|
end
|
2434
2434
|
|
2435
|
-
# Add decorator capability (modifies intialize to put after).
|
2436
|
-
include Hdecorator
|
2435
|
+
# # Add decorator capability (modifies intialize to put after).
|
2436
|
+
# include Hdecorator
|
2437
2437
|
|
2438
2438
|
# Iterates over each object deeply.
|
2439
2439
|
#
|
@@ -2517,8 +2517,8 @@ module HDLRuby::Low
|
|
2517
2517
|
@systemTs = [ @systemT ]
|
2518
2518
|
end
|
2519
2519
|
|
2520
|
-
# Add decorator capability (modifies intialize to put after).
|
2521
|
-
include Hdecorator
|
2520
|
+
# # Add decorator capability (modifies intialize to put after).
|
2521
|
+
# include Hdecorator
|
2522
2522
|
|
2523
2523
|
# Iterates over each object deeply.
|
2524
2524
|
#
|
@@ -2649,8 +2649,8 @@ module HDLRuby::Low
|
|
2649
2649
|
lumps.each { |lump| self.add_lump(lump) }
|
2650
2650
|
end
|
2651
2651
|
|
2652
|
-
# Add decorator capability (modifies intialize to put after).
|
2653
|
-
include Hdecorator
|
2652
|
+
# # Add decorator capability (modifies intialize to put after).
|
2653
|
+
# include Hdecorator
|
2654
2654
|
|
2655
2655
|
# Adds a +lump+ of code, it is ment to become an expression or
|
2656
2656
|
# some text.
|
@@ -2698,8 +2698,8 @@ module HDLRuby::Low
|
|
2698
2698
|
@chunks = HashName.new
|
2699
2699
|
end
|
2700
2700
|
|
2701
|
-
# Add decorator capability (modifies intialize to put after).
|
2702
|
-
include Hdecorator
|
2701
|
+
# # Add decorator capability (modifies intialize to put after).
|
2702
|
+
# include Hdecorator
|
2703
2703
|
|
2704
2704
|
# Adds a +chunk+ to the sensitivity list.
|
2705
2705
|
def add_chunk(chunk)
|
@@ -2810,7 +2810,7 @@ module HDLRuby::Low
|
|
2810
2810
|
# NOTE: this is an abstract class which is not to be used directly.
|
2811
2811
|
class Statement
|
2812
2812
|
include Hparent
|
2813
|
-
include Hdecorator
|
2813
|
+
# include Hdecorator
|
2814
2814
|
|
2815
2815
|
# Clones (deeply)
|
2816
2816
|
def clone
|
@@ -3298,8 +3298,8 @@ module HDLRuby::Low
|
|
3298
3298
|
match.parent = statement.parent = self
|
3299
3299
|
end
|
3300
3300
|
|
3301
|
-
# Add decorator capability (modifies intialize to put after).
|
3302
|
-
include Hdecorator
|
3301
|
+
# # Add decorator capability (modifies intialize to put after).
|
3302
|
+
# include Hdecorator
|
3303
3303
|
|
3304
3304
|
# Iterates over each object deeply.
|
3305
3305
|
#
|
@@ -3623,8 +3623,8 @@ module HDLRuby::Low
|
|
3623
3623
|
@unit = unit.to_sym
|
3624
3624
|
end
|
3625
3625
|
|
3626
|
-
# Add decorator capability (modifies intialize to put after).
|
3627
|
-
include Hdecorator
|
3626
|
+
# # Add decorator capability (modifies intialize to put after).
|
3627
|
+
# include Hdecorator
|
3628
3628
|
|
3629
3629
|
# Iterates over each object deeply.
|
3630
3630
|
#
|
@@ -4333,8 +4333,8 @@ module HDLRuby::Low
|
|
4333
4333
|
end
|
4334
4334
|
end
|
4335
4335
|
|
4336
|
-
# Add decorator capability (modifies intialize to put after).
|
4337
|
-
include Hdecorator
|
4336
|
+
# # Add decorator capability (modifies intialize to put after).
|
4337
|
+
# include Hdecorator
|
4338
4338
|
|
4339
4339
|
# Comparison for hash: structural comparison.
|
4340
4340
|
def eql?(obj)
|
@@ -165,6 +165,30 @@ module HDLRuby::Low
|
|
165
165
|
return false
|
166
166
|
end
|
167
167
|
|
168
|
+
## Gets the systemI the reference comes from if any.
|
169
|
+
def get_systemI
|
170
|
+
# Look for the owner from the name hierarchy.
|
171
|
+
if self.ref.is_a?(RefName) then
|
172
|
+
# Look in the parent hierachy for the sub reference name.
|
173
|
+
parent = self.parent
|
174
|
+
# puts "self.ref.name=#{self.ref.name}"
|
175
|
+
while parent
|
176
|
+
# puts "parent=#{parent}"
|
177
|
+
if parent.respond_to?(:get_by_name) then
|
178
|
+
found = parent.get_by_name(self.ref.name)
|
179
|
+
# puts "found is a :#{found.class}"
|
180
|
+
return found if found.is_a?(SystemI)
|
181
|
+
end
|
182
|
+
parent = parent.parent
|
183
|
+
end
|
184
|
+
# Not found, look further in the reference hierarchy.
|
185
|
+
return self.ref.get_systemI
|
186
|
+
end
|
187
|
+
# Not from a systemI.
|
188
|
+
# puts "Not from systemI for #{self.name}"
|
189
|
+
return nil
|
190
|
+
end
|
191
|
+
|
168
192
|
|
169
193
|
## Resolves the name of the reference and return the
|
170
194
|
# corresponding object.
|
@@ -44,8 +44,10 @@ module HDLRuby::Low
|
|
44
44
|
def to_global_systemTs!
|
45
45
|
# Force a name if not.
|
46
46
|
self.force_name!
|
47
|
+
# puts "to_global_systemTs! for #{self.name}"
|
47
48
|
# For each local systemT
|
48
49
|
self.scope.each_systemT.to_a.each do |systemT|
|
50
|
+
# puts "Processing system: #{systemT}"
|
49
51
|
# Rename it for globalization.
|
50
52
|
former = systemT.name
|
51
53
|
self.extend_name!(systemT)
|
@@ -211,6 +213,7 @@ module HDLRuby::Low
|
|
211
213
|
# Replaces recursively +former+ name by +nname+ until it is redeclared
|
212
214
|
# in the internals.
|
213
215
|
def replace_names_subs!(former,nname)
|
216
|
+
# puts "replace_names_subs! for #{self} with former=#{former} and nname=#{nname}"
|
214
217
|
self.each_type do |type|
|
215
218
|
type.replace_names!(former,nname)
|
216
219
|
end
|
@@ -416,8 +419,9 @@ module HDLRuby::Low
|
|
416
419
|
if self.name == former then
|
417
420
|
self.set_name!(nname)
|
418
421
|
end
|
419
|
-
#
|
420
|
-
|
422
|
+
# Not needed since treated through scope and systemT.
|
423
|
+
# # Recurse on the system type.
|
424
|
+
# self.systemT.replace_names!(former,nname)
|
421
425
|
end
|
422
426
|
end
|
423
427
|
|
data/lib/HDLRuby/hruby_tools.rb
CHANGED
@@ -50,4 +50,28 @@ module HDLRuby
|
|
50
50
|
|
51
51
|
end
|
52
52
|
|
53
|
+
|
54
|
+
# Display some messages depending on the verbosity mode.
|
55
|
+
@@verbosity = 1 # The verbosity level: default 1, only critical messages.
|
56
|
+
|
57
|
+
# Sets the verbosity.
|
58
|
+
def self.verbosity=(val)
|
59
|
+
@@verbosity = val.to_i
|
60
|
+
end
|
61
|
+
|
62
|
+
# Display a critical message.
|
63
|
+
def self.show!(*args)
|
64
|
+
puts(*args) if @@verbosity > 0
|
65
|
+
end
|
66
|
+
|
67
|
+
# Display a common message.
|
68
|
+
def self.show(*args)
|
69
|
+
puts(*args) if @@verbosity > 1
|
70
|
+
end
|
71
|
+
|
72
|
+
# Display a minor message.
|
73
|
+
def self.show?(*args)
|
74
|
+
puts(*args) if @@verbosity > 2
|
75
|
+
end
|
76
|
+
|
53
77
|
end
|
@@ -134,7 +134,7 @@ module HDLRuby::Low
|
|
134
134
|
if self.name && !self.name.empty? then
|
135
135
|
vname = name_to_verilog(self.name)
|
136
136
|
code << " : #{vname}"
|
137
|
-
self.properties[:verilog_name] = vname
|
137
|
+
# self.properties[:verilog_name] = vname
|
138
138
|
end
|
139
139
|
code << "\n" if block.each_inner.any?
|
140
140
|
# Declaration of "inner" part within "always".
|
@@ -1371,7 +1371,7 @@ module HDLRuby::Low
|
|
1371
1371
|
# Converts the system to Verilog code using +renamer+ for producing Verilog-compatible names.
|
1372
1372
|
def to_verilog
|
1373
1373
|
vname = name_to_verilog(self.name)
|
1374
|
-
self.properties[:verilog_name] = vname
|
1374
|
+
# self.properties[:verilog_name] = vname
|
1375
1375
|
return "#{vname}"
|
1376
1376
|
end
|
1377
1377
|
|
@@ -1677,7 +1677,7 @@ module HDLRuby::Low
|
|
1677
1677
|
def to_verilog
|
1678
1678
|
# Convert unusable characters and return them.
|
1679
1679
|
vname = name_to_verilog(self.name)
|
1680
|
-
self.properties[:verilog_name] = vname
|
1680
|
+
# self.properties[:verilog_name] = vname
|
1681
1681
|
return "#{vname}"
|
1682
1682
|
end
|
1683
1683
|
end
|
@@ -1842,7 +1842,7 @@ module HDLRuby::Low
|
|
1842
1842
|
code = "`timescale 1ps/1ps\n\n"
|
1843
1843
|
|
1844
1844
|
vname = name_to_verilog(self.name)
|
1845
|
-
self.properties[:verilog_name] = vname
|
1845
|
+
# self.properties[:verilog_name] = vname
|
1846
1846
|
# Output the module name.
|
1847
1847
|
code << "module #{vname}("
|
1848
1848
|
|
@@ -2007,7 +2007,7 @@ module HDLRuby::Low
|
|
2007
2007
|
systemT = systemI.systemT
|
2008
2008
|
code << name_to_verilog(systemT.name) << " "
|
2009
2009
|
vname = name_to_verilog(systemI.name)
|
2010
|
-
systemI.properties[:verilog_name] = vname
|
2010
|
+
# systemI.properties[:verilog_name] = vname
|
2011
2011
|
code << vname << "("
|
2012
2012
|
# Its ports connections
|
2013
2013
|
# Inputs
|
@@ -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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
37
|
+
return vname
|
66
38
|
end
|
67
39
|
|
68
40
|
#puts ref
|
@@ -107,13 +107,15 @@ module HDLRuby::High::Std
|
|
107
107
|
end
|
108
108
|
|
109
109
|
# Make the interpolation.
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
110
|
+
par do
|
111
|
+
diff <= (next_data-base).as(diff.type) * remaining
|
112
|
+
if(otyp.signed?) then
|
113
|
+
interpolated_value <= base +
|
114
|
+
([[diff[diff.type.width-1]]*shift_bits,
|
115
|
+
diff[diff.type.width-1..shift_bits]]).to_expr
|
116
|
+
else
|
117
|
+
interpolated_value <= base + (diff >> shift_bits)
|
118
|
+
end
|
117
119
|
end
|
118
120
|
end
|
119
121
|
|
data/lib/HDLRuby/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|