HDLRuby 2.4.29 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HDLRuby/drivers/xcd.rb +79 -0
- data/lib/HDLRuby/drivers/xcd/dummy.xcd +4 -0
- data/lib/HDLRuby/hdr_samples/dff_properties.rb +19 -0
- data/lib/HDLRuby/hdrcc.rb +31 -3
- data/lib/HDLRuby/hruby_decorator.rb +248 -0
- data/lib/HDLRuby/hruby_high.rb +255 -66
- data/lib/HDLRuby/hruby_low.rb +511 -0
- data/lib/HDLRuby/hruby_verilog.rb +25 -6
- data/lib/HDLRuby/template_expander.rb +61 -0
- data/lib/HDLRuby/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c77fd470dae8d84cb066923fc8ed89d18e2aafa8bc826df85e03cae674c4e2
|
4
|
+
data.tar.gz: 4ef6902aec739f56c398bd653dc30f0dc03227799e1f54a9900b762d1a077aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c9972c8567cb1fd496268c4385b7f3caa0bd8718769254542adeceafafdc26ed09d5ce7c47430e0b0732ecbcda4ea5d0220cf4bc7be9721faf5b99bf47057cf
|
7
|
+
data.tar.gz: d300640fdc354ed55f9210c95d4aee10e52768a59ac39a993b402d8da78dd091f31d97fe307fe96b729d9194b532bf958761070224663e3bf2cd37e165877c21
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require "HDLRuby/template_expander"
|
2
|
+
|
3
|
+
##
|
4
|
+
# XCD file generator from 'xcd' properties
|
5
|
+
##########################################
|
6
|
+
|
7
|
+
|
8
|
+
# Generates a xcd file from the HDLRuby objects from +top+ using
|
9
|
+
# their 'xcd' properties.
|
10
|
+
# The file is saved in +path+ directory.
|
11
|
+
def xcd_generator(top, path)
|
12
|
+
# Ensure top is a system.
|
13
|
+
if top.is_a?(HDLRuby::Low::SystemI) then
|
14
|
+
top = top.systemT
|
15
|
+
elsif !top.is_a?(HDLRuby::Low::SystemT) then
|
16
|
+
raise "The 'xcd_generator' driver can only be applied on SystemT objects."
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get the name of the resulting file if any.
|
20
|
+
if (top.properties.key?(:xcd_file)) then
|
21
|
+
xcd_file = top.properties[:xcd_file].join
|
22
|
+
else
|
23
|
+
# Default file name.
|
24
|
+
xcd_file = "default.xcd"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get the target template.
|
28
|
+
xcd_target = top.properties[:xcd_target].join
|
29
|
+
xcd_target_name = xcd_target
|
30
|
+
xcd_target_name += ".xcd" unless xcd_target_name.end_with?(".xcd")
|
31
|
+
xcd_target_tries = [ xcd_target_name,
|
32
|
+
File.join(path,xcd_target_name),
|
33
|
+
File.join(File.dirname(__FILE__),"xcd",xcd_target_name) ]
|
34
|
+
xcd_target_file = xcd_target_tries.find { |fname| File.exist?(fname) }
|
35
|
+
unless xcd_target_file then
|
36
|
+
raise "XCD target template not found for #{xcd_target}."
|
37
|
+
end
|
38
|
+
# Load the template.
|
39
|
+
template = File.read(xcd_target_file)
|
40
|
+
|
41
|
+
# Gather the signals by xcd key.
|
42
|
+
xcd2sig = top.each_signal.reduce([]) do |ar,sig|
|
43
|
+
ar += sig.properties.each_with_key(:xcd).map do |val|
|
44
|
+
[val,sig.name.to_s]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Create the template expander that will generate the xcd file.
|
49
|
+
expander = TemplateExpander.new([
|
50
|
+
[ /^\?.*(\n|\z)/, proc do |str| # Signal link to port
|
51
|
+
if xcd2sig.any? do |match,rep|
|
52
|
+
if str.include?(match) then
|
53
|
+
str = str.gsub("<>",rep)[1..-1]
|
54
|
+
else
|
55
|
+
false
|
56
|
+
end
|
57
|
+
end then
|
58
|
+
str
|
59
|
+
else
|
60
|
+
""
|
61
|
+
end
|
62
|
+
end ]
|
63
|
+
])
|
64
|
+
|
65
|
+
# # Generate the xcd file.
|
66
|
+
# File.open(File.join(path,xcd_file),"w") do |file|
|
67
|
+
# # Generate the signals mapping.
|
68
|
+
# top.each_signal do |signal|
|
69
|
+
# signal.properties.each_with_key(:xcd) do |value|
|
70
|
+
# file << "#{value}\n"
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
|
75
|
+
# Generate the xcd file.
|
76
|
+
File.open(File.join(path,xcd_file),"w") do |file|
|
77
|
+
expander.expand(template,file)
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# A simple D-FF
|
2
|
+
system :dff do
|
3
|
+
input :clk, :rst, :d
|
4
|
+
output :q, :qb
|
5
|
+
|
6
|
+
qb <= ~q
|
7
|
+
|
8
|
+
par(clk.posedge) { q <= d & ~rst }
|
9
|
+
|
10
|
+
clk.properties[:xcd] = "CLK"
|
11
|
+
rst.properties[:xcd] = "RST"
|
12
|
+
d.properties[:xcd] = "PORT0"
|
13
|
+
q.properties[:xcd] = "PORT1"
|
14
|
+
qb.properties[:xcd] = "PORT2"
|
15
|
+
cur_system.properties[:xcd_target] = "dummy"
|
16
|
+
cur_system.properties[:xcd_file] = "dff.xcd"
|
17
|
+
cur_system.properties[:post_driver] = "drivers/xcd.rb", :xcd_generator
|
18
|
+
end
|
19
|
+
|
data/lib/HDLRuby/hdrcc.rb
CHANGED
@@ -316,9 +316,9 @@ $optparse = OptionParser.new do |opts|
|
|
316
316
|
opts.on("-p", "--param x,y,z", "Specify the generic parameters") do |p|
|
317
317
|
$options[:param] = p
|
318
318
|
end
|
319
|
-
opts.on("--
|
320
|
-
|
321
|
-
|
319
|
+
opts.on("--dump","Dump all the properties to yaml files") do |v|
|
320
|
+
$options[:dump] = v
|
321
|
+
$options[:multiple] = v
|
322
322
|
end
|
323
323
|
# opts.on_tail("-h", "--help", "Show this message") do
|
324
324
|
opts.on("-h", "--help", "Show this message") do
|
@@ -678,3 +678,31 @@ elsif $options[:vhdl] then
|
|
678
678
|
end
|
679
679
|
end
|
680
680
|
end
|
681
|
+
|
682
|
+
# Apply the post drivers if any.
|
683
|
+
Hdecorator.each_with_property(:post_driver) do |obj, value|
|
684
|
+
# Load the driver.
|
685
|
+
require_relative(value[0].to_s)
|
686
|
+
# Execute it.
|
687
|
+
send(value[1].to_sym,obj,$output)
|
688
|
+
end
|
689
|
+
|
690
|
+
# Dump the properties
|
691
|
+
if $options[:dump] then
|
692
|
+
# Decorate with the parent ids.
|
693
|
+
Hdecorator.decorate_parent_id
|
694
|
+
|
695
|
+
# Generate the directory for the properties
|
696
|
+
property_dir = $output + "/properties"
|
697
|
+
unless File.directory?(property_dir)
|
698
|
+
FileUtils.mkdir_p(property_dir)
|
699
|
+
end
|
700
|
+
|
701
|
+
# Dump to one file per key
|
702
|
+
Properties.each_key do |key|
|
703
|
+
File.open(property_dir + "/#{key}.yaml", "w") do |f|
|
704
|
+
Hdecorator.dump(key,f)
|
705
|
+
end
|
706
|
+
end
|
707
|
+
|
708
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'set'
|
3
|
+
|
4
|
+
module HDLRuby
|
5
|
+
|
6
|
+
##
|
7
|
+
# Library for describing a decorator used for adding properties to
|
8
|
+
# HDLRuby objects that are persistent and can be used for back annotation
|
9
|
+
########################################################################
|
10
|
+
|
11
|
+
##
|
12
|
+
# Gives a decorator the HDLRuby object.
|
13
|
+
module Hdecorator
|
14
|
+
# The decorator requires that each HDLRuby object has a uniq
|
15
|
+
# persistent id
|
16
|
+
|
17
|
+
# The id
|
18
|
+
attr_reader :hdr_id
|
19
|
+
|
20
|
+
# The id to object table
|
21
|
+
@@id_map = {}
|
22
|
+
|
23
|
+
# Generate the ID
|
24
|
+
@@id_gen = 0
|
25
|
+
|
26
|
+
# Ensures the ID is generated when object is initialized
|
27
|
+
def self.included(base) # built-in Ruby hook for modules
|
28
|
+
base.class_eval do
|
29
|
+
original_method = instance_method(:initialize)
|
30
|
+
define_method(:initialize) do |*args, &block|
|
31
|
+
original_method.bind(self).call(*args, &block)
|
32
|
+
# Generate the id.
|
33
|
+
@hdr_id = @@id_gen
|
34
|
+
@@id_gen += 1
|
35
|
+
# Update the id to object table
|
36
|
+
@@id_map[@hdr_id] = self
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get an object by id.
|
42
|
+
def self.get(id)
|
43
|
+
return @@id_map[id]
|
44
|
+
end
|
45
|
+
|
46
|
+
# Iterate over all the id with their object.
|
47
|
+
#
|
48
|
+
# Returns an enumerator if no ruby block is given.
|
49
|
+
def self.each(&ruby_block)
|
50
|
+
# No ruby block? Return an enumerator.
|
51
|
+
return to_enum(:each) unless ruby_block
|
52
|
+
# A ruby block? Apply it on each object.
|
53
|
+
@@id_map.each(&ruby_block)
|
54
|
+
end
|
55
|
+
|
56
|
+
# The decorator also need to add properties to the HDLRuby objects.
|
57
|
+
|
58
|
+
# Access the set of properties
|
59
|
+
def properties
|
60
|
+
# Create the properties if not present.
|
61
|
+
unless @properties then
|
62
|
+
@properties = Properties.new(self)
|
63
|
+
end
|
64
|
+
return @properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Iterate over all the objects from +top+ with +prop+ property.
|
68
|
+
#
|
69
|
+
# Returns an enumerator if no ruby block is given.
|
70
|
+
# NOTE: if +top+ is not given, iterate over all the objects.
|
71
|
+
def self.each_with_property(prop, top = nil, &ruby_block)
|
72
|
+
# No ruby block? Return an enumerator.
|
73
|
+
return to_enum(:each_with_property) unless ruby_block
|
74
|
+
# A ruby block? Apply the ruby_block...
|
75
|
+
if (top) then
|
76
|
+
# A top... on each object from it.
|
77
|
+
top.each_deep do |obj|
|
78
|
+
if (obj.properties.key?(prop)) then
|
79
|
+
ruby_block.call(obj, *obj.properties[prop])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
else
|
83
|
+
# No top... on all the objects.
|
84
|
+
self.each do |id,obj|
|
85
|
+
if (obj.properties.key?(prop)) then
|
86
|
+
ruby_block.call(obj, *obj.properties[prop])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# # Access the set of properties and the inherited properties from
|
93
|
+
# # the high objects.
|
94
|
+
# def all_properties
|
95
|
+
# high_id = self.properties[:low2high]
|
96
|
+
# if high_id && high_id >= 0 then
|
97
|
+
# return properties.merge(Hdecorator.get(high_id))
|
98
|
+
# else
|
99
|
+
# return properties.clone
|
100
|
+
# end
|
101
|
+
# end
|
102
|
+
|
103
|
+
# Saves properties +key+ of all the object associated with
|
104
|
+
# their id to +target+.
|
105
|
+
def self.dump(key, target = "")
|
106
|
+
# Build the table to dump
|
107
|
+
tbl = {}
|
108
|
+
self.each do |id,obj|
|
109
|
+
value = obj.properties[key]
|
110
|
+
if value.any? then
|
111
|
+
tbl[id] = value
|
112
|
+
end
|
113
|
+
end
|
114
|
+
# Dump the table.
|
115
|
+
target << YAML.dump(tbl)
|
116
|
+
return target
|
117
|
+
end
|
118
|
+
|
119
|
+
# Loads properties to +key+ for all objects from +source+.
|
120
|
+
def self.load(source,key)
|
121
|
+
# Load the id to property table.
|
122
|
+
tbl = YAML.load(source)
|
123
|
+
# Adds the property of each object according to tbl
|
124
|
+
tbl.each do |id,value|
|
125
|
+
@@id_map[id].properties[key] = value
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Some predefined properties to set.
|
130
|
+
|
131
|
+
def self.decorate_parent_id
|
132
|
+
@@id_map.each do |id, obj|
|
133
|
+
parent = obj.parent
|
134
|
+
if parent then
|
135
|
+
obj.properties[:parent_id] = obj.parent.hdr_id
|
136
|
+
else
|
137
|
+
obj.properties[:parent_id] = -1
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
## A HDLRuby set of properties
|
146
|
+
class Properties
|
147
|
+
|
148
|
+
# The set of all the property keys
|
149
|
+
@@property_keys = Set.new
|
150
|
+
|
151
|
+
# The HDLRuby object owning of the set of properties
|
152
|
+
attr_reader :owner
|
153
|
+
|
154
|
+
# Create a new set of properties and attach it to HDLRuby object
|
155
|
+
# +owner+.
|
156
|
+
def initialize(owner)
|
157
|
+
# Attach the owner.
|
158
|
+
@owner = owner
|
159
|
+
# Create the set.
|
160
|
+
@content = {}
|
161
|
+
end
|
162
|
+
|
163
|
+
# Clones the properties: also clone the contents.
|
164
|
+
def clone
|
165
|
+
result = Properties.new(owner)
|
166
|
+
@contents.each do |k,vals|
|
167
|
+
vals.each { |v| result[k] = v }
|
168
|
+
end
|
169
|
+
return result
|
170
|
+
end
|
171
|
+
|
172
|
+
# Create a new set of properties by merging with +prop+
|
173
|
+
def merge(prop)
|
174
|
+
result = self.clone
|
175
|
+
prop.each do |k,vals|
|
176
|
+
vals.each { |v| result[k] = v }
|
177
|
+
end
|
178
|
+
return result
|
179
|
+
end
|
180
|
+
|
181
|
+
# Tells if +key+ is present.
|
182
|
+
def key?(key)
|
183
|
+
@content.key?(key)
|
184
|
+
end
|
185
|
+
|
186
|
+
# Add a property
|
187
|
+
def []=(key,value)
|
188
|
+
@@property_keys << key
|
189
|
+
# Add an entry if not present.
|
190
|
+
@content[key] = [] unless @content.key?(key)
|
191
|
+
# Add the value to the entry.
|
192
|
+
@content[key] << value
|
193
|
+
end
|
194
|
+
|
195
|
+
# Get a property
|
196
|
+
def [](key)
|
197
|
+
return @content[key]
|
198
|
+
end
|
199
|
+
|
200
|
+
# Iterate over each value associated with +key+.
|
201
|
+
def each_with_key(key,&ruby_block)
|
202
|
+
return unless @content.key?(key)
|
203
|
+
@content[key].each(&ruby_block)
|
204
|
+
end
|
205
|
+
|
206
|
+
# Iterate over the properties of the current set.
|
207
|
+
#
|
208
|
+
# Returns an enumerator if no ruby block is given.
|
209
|
+
def each(&ruby_block)
|
210
|
+
# No ruby block? Return an enumerator.
|
211
|
+
return to_enum(:each) unless ruby_block
|
212
|
+
# A ruby block? Apply it on each input signal instance.
|
213
|
+
@content.each(&ruby_block)
|
214
|
+
end
|
215
|
+
|
216
|
+
# Iterator over all the property keys
|
217
|
+
#
|
218
|
+
# Returns an enumerator if no ruby block is given.
|
219
|
+
def self.each_key(&ruby_block)
|
220
|
+
# No ruby block? Return an enumerator.
|
221
|
+
return to_enum(:each_key) unless ruby_block
|
222
|
+
# A ruby block? Apply it on each input signal instance.
|
223
|
+
@@property_keys.each(&ruby_block)
|
224
|
+
end
|
225
|
+
|
226
|
+
# # Iterate over the property set of all the objects from current owner.
|
227
|
+
# #
|
228
|
+
# # Returns an enumerator if no ruby block is given.
|
229
|
+
# def each_properties(&ruby_block)
|
230
|
+
# # No ruby block? Return an enumerator.
|
231
|
+
# return to_enum(:each_properties) unless ruby_block
|
232
|
+
# # A ruby block? Apply it.
|
233
|
+
# # On current property set
|
234
|
+
# ruby_block.call(self)
|
235
|
+
# # And on the properties set of sub objects of the owner.
|
236
|
+
# self.owner.instance_variables.each do |var|
|
237
|
+
# obj = owner.instance_variable_get(var)
|
238
|
+
# if (obj.is_a?(Hproperties)) then
|
239
|
+
# # obj has properties, recurse on them.
|
240
|
+
# obj.properties.each_properties(&ruby_block)
|
241
|
+
# end
|
242
|
+
# end
|
243
|
+
# end
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
|
248
|
+
end
|
data/lib/HDLRuby/hruby_high.rb
CHANGED
@@ -347,6 +347,12 @@ module HDLRuby::High
|
|
347
347
|
end
|
348
348
|
end
|
349
349
|
@to_includes = mixins
|
350
|
+
|
351
|
+
# The list of systems the current system is expanded from if any.
|
352
|
+
# The first one is the main system, the other ones are the
|
353
|
+
# mixins.
|
354
|
+
@generators = []
|
355
|
+
|
350
356
|
# Prepare the instantiation methods
|
351
357
|
make_instantiater(name,SystemI,&ruby_block)
|
352
358
|
end
|
@@ -472,6 +478,24 @@ module HDLRuby::High
|
|
472
478
|
@scope.each_export(&ruby_block)
|
473
479
|
end
|
474
480
|
|
481
|
+
# Adds a generator system.
|
482
|
+
def add_generator(gen)
|
483
|
+
unless gen.is_a?(SystemT) then
|
484
|
+
raise "Invalid class for a generator system"
|
485
|
+
end
|
486
|
+
@generators << gen
|
487
|
+
end
|
488
|
+
|
489
|
+
# Iterates over the origin systems.
|
490
|
+
#
|
491
|
+
# Returns an enumerator if no ruby block is given.
|
492
|
+
def each_generator(&ruby_block)
|
493
|
+
# No ruby block? Return an enumerator.
|
494
|
+
return to_enum(:each_generator) unless ruby_block
|
495
|
+
# A block? Apply it on each generator.
|
496
|
+
@generators.each(&ruby_block)
|
497
|
+
end
|
498
|
+
|
475
499
|
# Gets class containing the extension for the instances.
|
476
500
|
def singleton_instance
|
477
501
|
@singleton_instanceO.singleton_class
|
@@ -527,6 +551,10 @@ module HDLRuby::High
|
|
527
551
|
# Include the mixin systems given when declaring the system.
|
528
552
|
@to_includes.each { |system| expanded.scope.include(system) }
|
529
553
|
|
554
|
+
# Sets the generators of the expanded result.
|
555
|
+
expanded.add_generator(self)
|
556
|
+
@to_includes.each { |system| expanded.add_generator(system) }
|
557
|
+
|
530
558
|
# Fills the scope of the expanded class.
|
531
559
|
# puts "Build top with #{self.name} for #{name}"
|
532
560
|
expanded.scope.build_top(self.scope,*args)
|
@@ -730,13 +758,16 @@ module HDLRuby::High
|
|
730
758
|
"Cannot convert a system without a name to HDLRuby::Low."
|
731
759
|
end
|
732
760
|
# Create the resulting low system type.
|
733
|
-
|
761
|
+
systemTL = HDLRuby::Low::SystemT.new(High.names_create(name),
|
734
762
|
self.scope.to_low)
|
763
|
+
# For debugging: set the source high object
|
764
|
+
systemTL.properties[:low2high] = self.hdr_id
|
765
|
+
|
735
766
|
# Fills the interface of the new system
|
736
767
|
# from the included systems.
|
737
|
-
self.fill_low(
|
768
|
+
self.fill_low(systemTL)
|
738
769
|
# Return theresulting system.
|
739
|
-
return
|
770
|
+
return systemTL
|
740
771
|
end
|
741
772
|
end
|
742
773
|
|
@@ -1213,26 +1244,26 @@ module HDLRuby::High
|
|
1213
1244
|
# Fills a low level scope with self's contents.
|
1214
1245
|
#
|
1215
1246
|
# NOTE: name conflicts are treated in the current NameStack state.
|
1216
|
-
def fill_low(
|
1247
|
+
def fill_low(scopeL)
|
1217
1248
|
# Adds the content of its included systems.
|
1218
|
-
@includes.each_value {|system| system.scope.fill_low(
|
1249
|
+
@includes.each_value {|system| system.scope.fill_low(scopeL) }
|
1219
1250
|
# Adds the declared local system types.
|
1220
1251
|
# NOTE: in the current version of HDLRuby::High, there should not
|
1221
1252
|
# be any of them (only eigen systems are real system types).
|
1222
|
-
self.each_systemT { |systemT|
|
1253
|
+
self.each_systemT { |systemT| scopeL.add_systemT(systemT.to_low) }
|
1223
1254
|
# Adds the local types.
|
1224
|
-
self.each_type { |type|
|
1255
|
+
self.each_type { |type| scopeL.add_type(type.to_low) }
|
1225
1256
|
# Adds the inner scopes.
|
1226
|
-
self.each_scope { |scope|
|
1257
|
+
self.each_scope { |scope| scopeL.add_scope(scope.to_low) }
|
1227
1258
|
# Adds the inner signals.
|
1228
|
-
self.each_inner { |inner|
|
1259
|
+
self.each_inner { |inner| scopeL.add_inner(inner.to_low) }
|
1229
1260
|
# Adds the instances.
|
1230
1261
|
# Single ones.
|
1231
1262
|
self.each_systemI do |systemI|
|
1232
1263
|
# puts "Filling with systemI=#{systemI.name}"
|
1233
|
-
systemI_low =
|
1264
|
+
systemI_low = scopeL.add_systemI(systemI.to_low)
|
1234
1265
|
# Also add the eigen system to the list of local systems.
|
1235
|
-
|
1266
|
+
scopeL.add_systemT(systemI_low.systemT)
|
1236
1267
|
end
|
1237
1268
|
# Grouped ones.
|
1238
1269
|
self.each_groupI do |name,systemIs|
|
@@ -1242,42 +1273,45 @@ module HDLRuby::High
|
|
1242
1273
|
# puts "systemI.respond_to?=#{systemI.respond_to?(:name=)}"
|
1243
1274
|
systemI.name = name.to_s + "[#{i}]"
|
1244
1275
|
# And convert it to low
|
1245
|
-
systemI_low =
|
1276
|
+
systemI_low = scopeL.add_systemI(systemI.to_low())
|
1246
1277
|
# Also add the eigen system to the list of local systems.
|
1247
|
-
|
1278
|
+
scopeL.add_systemT(systemI_low.systemT)
|
1248
1279
|
}
|
1249
1280
|
end
|
1250
1281
|
# Adds the code chunks.
|
1251
|
-
self.each_code { |code|
|
1282
|
+
self.each_code { |code| scopeL.add_code(code.to_low) }
|
1252
1283
|
# Adds the connections.
|
1253
1284
|
self.each_connection { |connection|
|
1254
1285
|
# puts "connection=#{connection}"
|
1255
|
-
|
1286
|
+
scopeL.add_connection(connection.to_low)
|
1256
1287
|
}
|
1257
1288
|
# Adds the behaviors.
|
1258
1289
|
self.each_behavior { |behavior|
|
1259
|
-
|
1290
|
+
scopeL.add_behavior(behavior.to_low)
|
1260
1291
|
}
|
1261
1292
|
end
|
1262
1293
|
|
1263
1294
|
# Converts the scope to HDLRuby::Low.
|
1264
1295
|
def to_low()
|
1265
1296
|
# Create the resulting low scope.
|
1266
|
-
#
|
1267
|
-
|
1297
|
+
# scopeL = HDLRuby::Low::Scope.new()
|
1298
|
+
scopeL = HDLRuby::Low::Scope.new(self.name)
|
1299
|
+
# For debugging: set the source high object
|
1300
|
+
scopeL.properties[:low2high] = self.hdr_id
|
1301
|
+
|
1268
1302
|
# Push the private namespace for the low generation.
|
1269
1303
|
High.space_push(@namespace)
|
1270
1304
|
# Pushes on the name stack for converting the internals of
|
1271
1305
|
# the system.
|
1272
1306
|
High.names_push
|
1273
1307
|
# Adds the content of the actual system.
|
1274
|
-
self.fill_low(
|
1308
|
+
self.fill_low(scopeL)
|
1275
1309
|
# Restores the name stack.
|
1276
1310
|
High.names_pop
|
1277
1311
|
# Restores the namespace stack.
|
1278
1312
|
High.space_pop
|
1279
1313
|
# Return theresulting system.
|
1280
|
-
return
|
1314
|
+
return scopeL
|
1281
1315
|
end
|
1282
1316
|
end
|
1283
1317
|
|
@@ -1493,7 +1527,11 @@ module HDLRuby::High
|
|
1493
1527
|
#
|
1494
1528
|
# NOTE: should be overridden by other type classes.
|
1495
1529
|
def to_low(name = self.name)
|
1496
|
-
return HDLRuby::Low::Type.new(name)
|
1530
|
+
# return HDLRuby::Low::Type.new(name)
|
1531
|
+
typeL = HDLRuby::Low::Type.new(name)
|
1532
|
+
# For debugging: set the source high object
|
1533
|
+
typeL.properties[:low2high] = self.hdr_id
|
1534
|
+
return typeL
|
1497
1535
|
end
|
1498
1536
|
end
|
1499
1537
|
|
@@ -1630,7 +1668,11 @@ module HDLRuby::High
|
|
1630
1668
|
#
|
1631
1669
|
# NOTE: should be overridden by other type classes.
|
1632
1670
|
def to_low(name = self.name)
|
1633
|
-
return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1671
|
+
# return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1672
|
+
typeDefL = HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1673
|
+
# For debugging: set the source high object
|
1674
|
+
typeDefL.properties[:low2high] = self.hdr_id
|
1675
|
+
return typeDefL
|
1634
1676
|
end
|
1635
1677
|
end
|
1636
1678
|
|
@@ -1678,7 +1720,11 @@ module HDLRuby::High
|
|
1678
1720
|
#
|
1679
1721
|
# NOTE: should be overridden by other type classes.
|
1680
1722
|
def to_low(name = self.name)
|
1681
|
-
return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1723
|
+
# return HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1724
|
+
typeDefL = HDLRuby::Low::TypeDef.new(name,self.def.to_low)
|
1725
|
+
# For debugging: set the source high object
|
1726
|
+
typeDefL.properties[:low2high] = self.hdr_id
|
1727
|
+
return typeDefL
|
1682
1728
|
end
|
1683
1729
|
end
|
1684
1730
|
|
@@ -1689,8 +1735,13 @@ module HDLRuby::High
|
|
1689
1735
|
# Converts the type to HDLRuby::Low and set its +name+.
|
1690
1736
|
def to_low(name = self.name)
|
1691
1737
|
# Generate and return the new type.
|
1692
|
-
return HDLRuby::Low::TypeVector.new(name,self.base.to_low,
|
1738
|
+
# return HDLRuby::Low::TypeVector.new(name,self.base.to_low,
|
1739
|
+
# self.range.to_low)
|
1740
|
+
typeVectorL = HDLRuby::Low::TypeVector.new(name,self.base.to_low,
|
1693
1741
|
self.range.to_low)
|
1742
|
+
# For debugging: set the source high object
|
1743
|
+
typeVectorL.properties[:low2high] = self.hdr_id
|
1744
|
+
return typeVectorL
|
1694
1745
|
end
|
1695
1746
|
end
|
1696
1747
|
|
@@ -1763,8 +1814,13 @@ module HDLRuby::High
|
|
1763
1814
|
|
1764
1815
|
# Converts the type to HDLRuby::Low and set its +name+.
|
1765
1816
|
def to_low(name = self.name)
|
1766
|
-
return HDLRuby::Low::TypeTuple.new(name,self.direction,
|
1817
|
+
# return HDLRuby::Low::TypeTuple.new(name,self.direction,
|
1818
|
+
# *@types.map { |type| type.to_low } )
|
1819
|
+
typeTupleL = HDLRuby::Low::TypeTuple.new(name,self.direction,
|
1767
1820
|
*@types.map { |type| type.to_low } )
|
1821
|
+
# For debugging: set the source high object
|
1822
|
+
typeTupleL.properties[:low2high] = self.hdr_id
|
1823
|
+
return typeTupleL
|
1768
1824
|
end
|
1769
1825
|
end
|
1770
1826
|
|
@@ -1778,8 +1834,13 @@ module HDLRuby::High
|
|
1778
1834
|
|
1779
1835
|
# Converts the type to HDLRuby::Low and set its +name+.
|
1780
1836
|
def to_low(name = self.name)
|
1781
|
-
return HDLRuby::Low::TypeStruct.new(name,self.direction,
|
1837
|
+
# return HDLRuby::Low::TypeStruct.new(name,self.direction,
|
1838
|
+
# @types.map { |name,type| [name,type.to_low] } )
|
1839
|
+
typeStructL = HDLRuby::Low::TypeStruct.new(name,self.direction,
|
1782
1840
|
@types.map { |name,type| [name,type.to_low] } )
|
1841
|
+
# For debugging: set the source high object
|
1842
|
+
typeStructL.properties[:low2high] = self.hdr_id
|
1843
|
+
return typeStructL
|
1783
1844
|
end
|
1784
1845
|
end
|
1785
1846
|
|
@@ -2011,15 +2072,17 @@ module HDLRuby::High
|
|
2011
2072
|
def to_low(name = self.name)
|
2012
2073
|
# puts "to_low with #{self} (#{self.name}) #{self.systemT}"
|
2013
2074
|
# Converts the system of the instance to HDLRuby::Low
|
2014
|
-
|
2075
|
+
systemTL = self.systemT.to_low
|
2015
2076
|
# Creates the resulting HDLRuby::Low instance
|
2016
|
-
|
2017
|
-
|
2077
|
+
systemIL = HDLRuby::Low::SystemI.new(High.names_create(name),
|
2078
|
+
systemTL)
|
2079
|
+
# For debugging: set the source high object
|
2080
|
+
systemIL.properties[:low2high] = self.hdr_id
|
2018
2081
|
# Adds the other systemTs.
|
2019
2082
|
self.each_systemT do |systemT|
|
2020
|
-
|
2083
|
+
systemIL.add_systemT(systemT.to_low) unless systemT == self.systemT
|
2021
2084
|
end
|
2022
|
-
return
|
2085
|
+
return systemIL
|
2023
2086
|
end
|
2024
2087
|
end
|
2025
2088
|
|
@@ -2030,11 +2093,19 @@ module HDLRuby::High
|
|
2030
2093
|
class Chunk < HDLRuby::Low::Chunk
|
2031
2094
|
# Converts the if to HDLRuby::Low.
|
2032
2095
|
def to_low
|
2033
|
-
return HDLRuby::Low::Chunk.new(self.name,
|
2096
|
+
# return HDLRuby::Low::Chunk.new(self.name,
|
2097
|
+
# *self.each_lump.map do |lump|
|
2098
|
+
# lump = lump.respond_to?(:to_low) ? lump.to_low : lump.to_s
|
2099
|
+
# lump
|
2100
|
+
# end)
|
2101
|
+
chunkL = HDLRuby::Low::Chunk.new(self.name,
|
2034
2102
|
*self.each_lump.map do |lump|
|
2035
2103
|
lump = lump.respond_to?(:to_low) ? lump.to_low : lump.to_s
|
2036
2104
|
lump
|
2037
2105
|
end)
|
2106
|
+
# For debugging: set the source high object
|
2107
|
+
chunkL.properties[:low2high] = self.hdr_id
|
2108
|
+
return chunkL
|
2038
2109
|
end
|
2039
2110
|
end
|
2040
2111
|
|
@@ -2044,13 +2115,15 @@ module HDLRuby::High
|
|
2044
2115
|
# Converts the if to HDLRuby::Low.
|
2045
2116
|
def to_low
|
2046
2117
|
# Create the resulting code.
|
2047
|
-
|
2118
|
+
codeL = HDLRuby::Low::Code.new
|
2119
|
+
# For debugging: set the source high object
|
2120
|
+
codeL.properties[:low2high] = self.hdr_id
|
2048
2121
|
# Add the low-level events.
|
2049
|
-
self.each_event { |event|
|
2122
|
+
self.each_event { |event| codeL.add_event(event.to_low) }
|
2050
2123
|
# Add the low-level code chunks.
|
2051
|
-
self.each_chunk { |chunk|
|
2124
|
+
self.each_chunk { |chunk| codeL.add_chunk(chunk.to_low) }
|
2052
2125
|
# Return the resulting code.
|
2053
|
-
return
|
2126
|
+
return codeL
|
2054
2127
|
end
|
2055
2128
|
end
|
2056
2129
|
|
@@ -2133,10 +2206,12 @@ module HDLRuby::High
|
|
2133
2206
|
# no may be nil, so treat it appart
|
2134
2207
|
noL = self.no ? self.no.to_low : nil
|
2135
2208
|
# Now generate the low-level if.
|
2136
|
-
|
2209
|
+
ifL = HDLRuby::Low::If.new(self.condition.to_low,
|
2137
2210
|
self.yes.to_low,noL)
|
2138
|
-
self.each_noif {|cond,block|
|
2139
|
-
|
2211
|
+
self.each_noif {|cond,block| ifL.add_noif(cond.to_low,block.to_low)}
|
2212
|
+
# For debugging: set the source high object
|
2213
|
+
ifL.properties[:low2high] = self.hdr_id
|
2214
|
+
return ifL
|
2140
2215
|
end
|
2141
2216
|
end
|
2142
2217
|
|
@@ -2154,8 +2229,13 @@ module HDLRuby::High
|
|
2154
2229
|
|
2155
2230
|
# Converts the if to HDLRuby::Low.
|
2156
2231
|
def to_low
|
2157
|
-
return HDLRuby::Low::When.new(self.match.to_low,
|
2232
|
+
# return HDLRuby::Low::When.new(self.match.to_low,
|
2233
|
+
# self.statement.to_low)
|
2234
|
+
whenL = HDLRuby::Low::When.new(self.match.to_low,
|
2158
2235
|
self.statement.to_low)
|
2236
|
+
# For debugging: set the source high object
|
2237
|
+
whenL.properties[:low2high] = self.hdr_id
|
2238
|
+
return whenL
|
2159
2239
|
end
|
2160
2240
|
end
|
2161
2241
|
|
@@ -2200,6 +2280,8 @@ module HDLRuby::High
|
|
2200
2280
|
def to_low
|
2201
2281
|
# Create the low level case.
|
2202
2282
|
caseL = HDLRuby::Low::Case.new(@value.to_low)
|
2283
|
+
# For debugging: set the source high object
|
2284
|
+
caseL.properties[:low2high] = self.hdr_id
|
2203
2285
|
# Add each when case.
|
2204
2286
|
self.each_when do |w|
|
2205
2287
|
caseL.add_when(w.to_low)
|
@@ -2226,7 +2308,11 @@ module HDLRuby::High
|
|
2226
2308
|
|
2227
2309
|
# Converts the delay to HDLRuby::Low.
|
2228
2310
|
def to_low
|
2229
|
-
return HDLRuby::Low::Delay.new(self.value, self.unit)
|
2311
|
+
# return HDLRuby::Low::Delay.new(self.value, self.unit)
|
2312
|
+
delayL = HDLRuby::Low::Delay.new(self.value, self.unit)
|
2313
|
+
# For debugging: set the source high object
|
2314
|
+
delayL.properties[:low2high] = self.hdr_id
|
2315
|
+
return delayL
|
2230
2316
|
end
|
2231
2317
|
end
|
2232
2318
|
|
@@ -2237,7 +2323,11 @@ module HDLRuby::High
|
|
2237
2323
|
|
2238
2324
|
# Converts the wait statement to HDLRuby::Low.
|
2239
2325
|
def to_low
|
2240
|
-
return HDLRuby::Low::TimeWait.new(self.delay.to_low)
|
2326
|
+
# return HDLRuby::Low::TimeWait.new(self.delay.to_low)
|
2327
|
+
timeWaitL = HDLRuby::Low::TimeWait.new(self.delay.to_low)
|
2328
|
+
# For debugging: set the source high object
|
2329
|
+
timeWaitL.properties[:low2high] = self.hdr_id
|
2330
|
+
return timeWaitL
|
2241
2331
|
end
|
2242
2332
|
end
|
2243
2333
|
|
@@ -2249,8 +2339,13 @@ module HDLRuby::High
|
|
2249
2339
|
|
2250
2340
|
# Converts the repeat statement to HDLRuby::Low.
|
2251
2341
|
def to_low
|
2252
|
-
return HDLRuby::Low::TimeRepeat.new(self.statement.to_low,
|
2342
|
+
# return HDLRuby::Low::TimeRepeat.new(self.statement.to_low,
|
2343
|
+
# self.delay.to_low)
|
2344
|
+
timeRepeatL = HDLRuby::Low::TimeRepeat.new(self.statement.to_low,
|
2253
2345
|
self.delay.to_low)
|
2346
|
+
# For debugging: set the source high object
|
2347
|
+
timeRepeatL.properties[:low2high] = self.hdr_id
|
2348
|
+
return timeRepeatL
|
2254
2349
|
end
|
2255
2350
|
end
|
2256
2351
|
|
@@ -2571,7 +2666,11 @@ module HDLRuby::High
|
|
2571
2666
|
|
2572
2667
|
# Converts the unary expression to HDLRuby::Low.
|
2573
2668
|
def to_low
|
2574
|
-
return HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
|
2669
|
+
# return HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
|
2670
|
+
castL =HDLRuby::Low::Cast.new(self.type.to_low,self.child.to_low)
|
2671
|
+
# For debugging: set the source high object
|
2672
|
+
castL.properties[:low2high] = self.hdr_id
|
2673
|
+
return castL
|
2575
2674
|
end
|
2576
2675
|
end
|
2577
2676
|
|
@@ -2588,8 +2687,13 @@ module HDLRuby::High
|
|
2588
2687
|
|
2589
2688
|
# Converts the unary expression to HDLRuby::Low.
|
2590
2689
|
def to_low
|
2591
|
-
return HDLRuby::Low::Unary.new(self.type.to_low, self.operator,
|
2690
|
+
# return HDLRuby::Low::Unary.new(self.type.to_low, self.operator,
|
2691
|
+
# self.child.to_low)
|
2692
|
+
unaryL = HDLRuby::Low::Unary.new(self.type.to_low, self.operator,
|
2592
2693
|
self.child.to_low)
|
2694
|
+
# For debugging: set the source high object
|
2695
|
+
unaryL.properties[:low2high] = self.hdr_id
|
2696
|
+
return unaryL
|
2593
2697
|
end
|
2594
2698
|
end
|
2595
2699
|
|
@@ -2607,9 +2711,13 @@ module HDLRuby::High
|
|
2607
2711
|
|
2608
2712
|
# Converts the binary expression to HDLRuby::Low.
|
2609
2713
|
def to_low
|
2610
|
-
# return HDLRuby::Low::Binary.new(self.operator,
|
2611
|
-
|
2714
|
+
# return HDLRuby::Low::Binary.new(self.type.to_low, self.operator,
|
2715
|
+
# self.left.to_low, self.right.to_low)
|
2716
|
+
binaryL = HDLRuby::Low::Binary.new(self.type.to_low, self.operator,
|
2612
2717
|
self.left.to_low, self.right.to_low)
|
2718
|
+
# For debugging: set the source high object
|
2719
|
+
binaryL.properties[:low2high] = self.hdr_id
|
2720
|
+
return binaryL
|
2613
2721
|
end
|
2614
2722
|
end
|
2615
2723
|
|
@@ -2631,11 +2739,19 @@ module HDLRuby::High
|
|
2631
2739
|
|
2632
2740
|
# Converts the selection expression to HDLRuby::Low.
|
2633
2741
|
def to_low
|
2634
|
-
return HDLRuby::Low::Select.new(self.type.to_low,"?",
|
2742
|
+
# return HDLRuby::Low::Select.new(self.type.to_low,"?",
|
2743
|
+
# self.select.to_low,
|
2744
|
+
# *self.each_choice.map do |choice|
|
2745
|
+
# choice.to_low
|
2746
|
+
# end)
|
2747
|
+
selectL = HDLRuby::Low::Select.new(self.type.to_low,"?",
|
2635
2748
|
self.select.to_low,
|
2636
2749
|
*self.each_choice.map do |choice|
|
2637
2750
|
choice.to_low
|
2638
2751
|
end)
|
2752
|
+
# For debugging: set the source high object
|
2753
|
+
selectL.properties[:low2high] = self.hdr_id
|
2754
|
+
return selectL
|
2639
2755
|
end
|
2640
2756
|
end
|
2641
2757
|
|
@@ -2656,11 +2772,19 @@ module HDLRuby::High
|
|
2656
2772
|
|
2657
2773
|
# Converts the concatenation expression to HDLRuby::Low.
|
2658
2774
|
def to_low
|
2659
|
-
return HDLRuby::Low::Concat.new(self.type.to_low,
|
2775
|
+
# return HDLRuby::Low::Concat.new(self.type.to_low,
|
2776
|
+
# self.each_expression.map do |expr|
|
2777
|
+
# expr.to_low
|
2778
|
+
# end
|
2779
|
+
# )
|
2780
|
+
concatL = HDLRuby::Low::Concat.new(self.type.to_low,
|
2660
2781
|
self.each_expression.map do |expr|
|
2661
2782
|
expr.to_low
|
2662
2783
|
end
|
2663
2784
|
)
|
2785
|
+
# For debugging: set the source high object
|
2786
|
+
concatL.properties[:low2high] = self.hdr_id
|
2787
|
+
return concatL
|
2664
2788
|
end
|
2665
2789
|
end
|
2666
2790
|
|
@@ -2699,7 +2823,11 @@ module HDLRuby::High
|
|
2699
2823
|
# Clone the content if possible
|
2700
2824
|
content = self.content.frozen? ? self.content : self.content.clone
|
2701
2825
|
# Create and return the resulting low-level value
|
2702
|
-
return HDLRuby::Low::Value.new(self.type.to_low,self.content)
|
2826
|
+
# return HDLRuby::Low::Value.new(self.type.to_low,self.content)
|
2827
|
+
valueL = HDLRuby::Low::Value.new(self.type.to_low,self.content)
|
2828
|
+
# For debugging: set the source high object
|
2829
|
+
valueL.properties[:low2high] = self.hdr_id
|
2830
|
+
return valueL
|
2703
2831
|
end
|
2704
2832
|
|
2705
2833
|
end
|
@@ -2801,9 +2929,13 @@ module HDLRuby::High
|
|
2801
2929
|
|
2802
2930
|
# Converts the name reference to a HDLRuby::Low::RefName.
|
2803
2931
|
def to_low
|
2804
|
-
# return HDLRuby::Low::RefName.new(
|
2805
|
-
|
2932
|
+
# return HDLRuby::Low::RefName.new(self.type.to_low,
|
2933
|
+
# @base.to_ref.to_low,@object.name)
|
2934
|
+
refNameL = HDLRuby::Low::RefName.new(self.type.to_low,
|
2806
2935
|
@base.to_ref.to_low,@object.name)
|
2936
|
+
# For debugging: set the source high object
|
2937
|
+
refNameL.properties[:low2high] = self.hdr_id
|
2938
|
+
return refNameL
|
2807
2939
|
end
|
2808
2940
|
|
2809
2941
|
# Missing methods are looked for into the refered object.
|
@@ -2830,11 +2962,19 @@ module HDLRuby::High
|
|
2830
2962
|
|
2831
2963
|
# Converts the concat reference to HDLRuby::Low.
|
2832
2964
|
def to_low
|
2833
|
-
return HDLRuby::Low::RefConcat.new(self.type.to_low,
|
2965
|
+
# return HDLRuby::Low::RefConcat.new(self.type.to_low,
|
2966
|
+
# self.each_ref.map do |ref|
|
2967
|
+
# ref.to_low
|
2968
|
+
# end
|
2969
|
+
# )
|
2970
|
+
refConcatL = HDLRuby::Low::RefConcat.new(self.type.to_low,
|
2834
2971
|
self.each_ref.map do |ref|
|
2835
2972
|
ref.to_low
|
2836
2973
|
end
|
2837
2974
|
)
|
2975
|
+
# For debugging: set the source high object
|
2976
|
+
refConcatL.properties[:low2high] = self.hdr_id
|
2977
|
+
return refConcatL
|
2838
2978
|
end
|
2839
2979
|
end
|
2840
2980
|
|
@@ -2851,8 +2991,13 @@ module HDLRuby::High
|
|
2851
2991
|
|
2852
2992
|
# Converts the index reference to HDLRuby::Low.
|
2853
2993
|
def to_low
|
2854
|
-
return HDLRuby::Low::RefIndex.new(self.type.to_low,
|
2855
|
-
|
2994
|
+
# return HDLRuby::Low::RefIndex.new(self.type.to_low,
|
2995
|
+
# self.ref.to_low,self.index.to_low)
|
2996
|
+
refIndexL = HDLRuby::Low::RefIndex.new(self.type.to_low,
|
2997
|
+
self.ref.to_low,self.index.to_low)
|
2998
|
+
# For debugging: set the source high object
|
2999
|
+
refIndexL.properties[:low2high] = self.hdr_id
|
3000
|
+
return refIndexL
|
2856
3001
|
end
|
2857
3002
|
end
|
2858
3003
|
|
@@ -2869,8 +3014,13 @@ module HDLRuby::High
|
|
2869
3014
|
|
2870
3015
|
# Converts the range reference to HDLRuby::Low.
|
2871
3016
|
def to_low
|
2872
|
-
return HDLRuby::Low::RefRange.new(self.type.to_low,
|
3017
|
+
# return HDLRuby::Low::RefRange.new(self.type.to_low,
|
3018
|
+
# self.ref.to_low,self.range.to_low)
|
3019
|
+
refRangeL = HDLRuby::Low::RefRange.new(self.type.to_low,
|
2873
3020
|
self.ref.to_low,self.range.to_low)
|
3021
|
+
# For debugging: set the source high object
|
3022
|
+
refRangeL.properties[:low2high] = self.hdr_id
|
3023
|
+
return refRangeL
|
2874
3024
|
end
|
2875
3025
|
end
|
2876
3026
|
|
@@ -2886,9 +3036,13 @@ module HDLRuby::High
|
|
2886
3036
|
|
2887
3037
|
# Converts the name reference to HDLRuby::Low.
|
2888
3038
|
def to_low
|
2889
|
-
#
|
2890
|
-
|
3039
|
+
# return HDLRuby::Low::RefName.new(self.type.to_low,
|
3040
|
+
# self.ref.to_low,self.name)
|
3041
|
+
refNameL = HDLRuby::Low::RefName.new(self.type.to_low,
|
2891
3042
|
self.ref.to_low,self.name)
|
3043
|
+
# For debugging: set the source high object
|
3044
|
+
refNameL.properties[:low2high] = self.hdr_id
|
3045
|
+
return refNameL
|
2892
3046
|
end
|
2893
3047
|
end
|
2894
3048
|
|
@@ -2920,7 +3074,11 @@ module HDLRuby::High
|
|
2920
3074
|
|
2921
3075
|
# Converts the this reference to HDLRuby::Low.
|
2922
3076
|
def to_low
|
2923
|
-
return HDLRuby::Low::RefThis.new
|
3077
|
+
# return HDLRuby::Low::RefThis.new
|
3078
|
+
refThisL = HDLRuby::Low::RefThis.new
|
3079
|
+
# For debugging: set the source high object
|
3080
|
+
refThisL.properties[:low2high] = self.hdr_id
|
3081
|
+
return refThisL
|
2924
3082
|
end
|
2925
3083
|
end
|
2926
3084
|
|
@@ -2954,7 +3112,11 @@ module HDLRuby::High
|
|
2954
3112
|
|
2955
3113
|
# Converts the event to HDLRuby::Low.
|
2956
3114
|
def to_low
|
2957
|
-
return HDLRuby::Low::Event.new(self.type,self.ref.to_low)
|
3115
|
+
# return HDLRuby::Low::Event.new(self.type,self.ref.to_low)
|
3116
|
+
eventL = HDLRuby::Low::Event.new(self.type,self.ref.to_low)
|
3117
|
+
# For debugging: set the source high object
|
3118
|
+
eventL.properties[:low2high] = self.hdr_id
|
3119
|
+
return eventL
|
2958
3120
|
end
|
2959
3121
|
end
|
2960
3122
|
|
@@ -2990,8 +3152,13 @@ module HDLRuby::High
|
|
2990
3152
|
|
2991
3153
|
# Converts the transmit to HDLRuby::Low.
|
2992
3154
|
def to_low
|
2993
|
-
return HDLRuby::Low::Transmit.new(self.left.to_low,
|
3155
|
+
# return HDLRuby::Low::Transmit.new(self.left.to_low,
|
3156
|
+
# self.right.to_low)
|
3157
|
+
transmitL = HDLRuby::Low::Transmit.new(self.left.to_low,
|
2994
3158
|
self.right.to_low)
|
3159
|
+
# For debugging: set the source high object
|
3160
|
+
transmitL.properties[:low2high] = self.hdr_id
|
3161
|
+
return transmitL
|
2995
3162
|
end
|
2996
3163
|
end
|
2997
3164
|
|
@@ -3055,8 +3222,13 @@ module HDLRuby::High
|
|
3055
3222
|
|
3056
3223
|
# Converts the connection to HDLRuby::Low.
|
3057
3224
|
def to_low
|
3058
|
-
return HDLRuby::Low::Connection.new(self.left.to_low,
|
3225
|
+
# return HDLRuby::Low::Connection.new(self.left.to_low,
|
3226
|
+
# self.right.to_low)
|
3227
|
+
connectionL = HDLRuby::Low::Connection.new(self.left.to_low,
|
3059
3228
|
self.right.to_low)
|
3229
|
+
# For debugging: set the source high object
|
3230
|
+
connectionL.properties[:low2high] = self.hdr_id
|
3231
|
+
return connectionL
|
3060
3232
|
end
|
3061
3233
|
end
|
3062
3234
|
|
@@ -3165,7 +3337,11 @@ module HDLRuby::High
|
|
3165
3337
|
|
3166
3338
|
# Converts the system to HDLRuby::Low and set its +name+.
|
3167
3339
|
def to_low(name = self.name)
|
3168
|
-
return HDLRuby::Low::SignalI.new(name,self.type.to_low)
|
3340
|
+
# return HDLRuby::Low::SignalI.new(name,self.type.to_low)
|
3341
|
+
signalIL = HDLRuby::Low::SignalI.new(name,self.type.to_low)
|
3342
|
+
# For debugging: set the source high object
|
3343
|
+
signalIL.properties[:low2high] = self.hdr_id
|
3344
|
+
return signalIL
|
3169
3345
|
end
|
3170
3346
|
end
|
3171
3347
|
|
@@ -3224,8 +3400,13 @@ module HDLRuby::High
|
|
3224
3400
|
|
3225
3401
|
# Converts the system to HDLRuby::Low and set its +name+.
|
3226
3402
|
def to_low(name = self.name)
|
3227
|
-
return HDLRuby::Low::SignalC.new(name,self.type.to_low,
|
3403
|
+
# return HDLRuby::Low::SignalC.new(name,self.type.to_low,
|
3404
|
+
# self.value.to_low)
|
3405
|
+
signalCL = HDLRuby::Low::SignalC.new(name,self.type.to_low,
|
3228
3406
|
self.value.to_low)
|
3407
|
+
# For debugging: set the source high object
|
3408
|
+
signalCL.properties[:low2high] = self.hdr_id
|
3409
|
+
return signalCL
|
3229
3410
|
end
|
3230
3411
|
end
|
3231
3412
|
|
@@ -3436,6 +3617,8 @@ module HDLRuby::High
|
|
3436
3617
|
def to_low
|
3437
3618
|
# Create the resulting block
|
3438
3619
|
blockL = HDLRuby::Low::Block.new(self.mode)
|
3620
|
+
# For debugging: set the source high object
|
3621
|
+
blockL.properties[:low2high] = self.hdr_id
|
3439
3622
|
# Push the namespace for the low generation.
|
3440
3623
|
High.space_push(@namespace)
|
3441
3624
|
# Pushes on the name stack for converting the internals of
|
@@ -3503,6 +3686,8 @@ module HDLRuby::High
|
|
3503
3686
|
def to_low
|
3504
3687
|
# Create the resulting block
|
3505
3688
|
blockL = HDLRuby::Low::TimeBlock.new(self.mode)
|
3689
|
+
# For debugging: set the source high object
|
3690
|
+
blockL.properties[:low2high] = self.hdr_id
|
3506
3691
|
# Add the inner signals
|
3507
3692
|
self.each_inner { |inner| blockL.add_inner(inner.to_low) }
|
3508
3693
|
# Add the statements
|
@@ -3594,6 +3779,8 @@ module HDLRuby::High
|
|
3594
3779
|
eventLs = self.each_event.map { |event| event.to_low }
|
3595
3780
|
# Create and return the resulting low level behavior.
|
3596
3781
|
behaviorL = HDLRuby::Low::Behavior.new(blockL)
|
3782
|
+
# For debugging: set the source high object
|
3783
|
+
behaviorL.properties[:low2high] = self.hdr_id
|
3597
3784
|
eventLs.each(&behaviorL.method(:add_event))
|
3598
3785
|
return behaviorL
|
3599
3786
|
end
|
@@ -3620,9 +3807,11 @@ module HDLRuby::High
|
|
3620
3807
|
# Create the low level events.
|
3621
3808
|
eventLs = self.each_event.map { |event| event.to_low }
|
3622
3809
|
# Create and return the resulting low level behavior.
|
3623
|
-
|
3810
|
+
timeBehaviorL = HDLRuby::Low::TimeBehavior.new(blockL)
|
3811
|
+
# For debugging: set the source high object
|
3812
|
+
timeBehaviorL.properties[:low2high] = self.hdr_id
|
3624
3813
|
eventLs.each(&behaviorL.method(:add_event))
|
3625
|
-
return
|
3814
|
+
return timeBehaviorL
|
3626
3815
|
end
|
3627
3816
|
end
|
3628
3817
|
|