HDLRuby 2.6.15 → 2.6.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HDLRuby/hdr_samples/with_reduce.rb +38 -0
- data/lib/HDLRuby/hdrcc.rb +39 -33
- data/lib/HDLRuby/hruby_low2c.rb +7 -5
- data/lib/HDLRuby/hruby_low_without_namespace.rb +6 -2
- data/lib/HDLRuby/hruby_tools.rb +24 -0
- data/lib/HDLRuby/hruby_verilog_name.rb +24 -52
- data/lib/HDLRuby/sim/hruby_sim.h +4 -2
- data/lib/HDLRuby/sim/hruby_sim_calc.c +8 -4
- data/lib/HDLRuby/sim/hruby_sim_core.c +5 -3
- data/lib/HDLRuby/std/function_generator.rb +9 -7
- data/lib/HDLRuby/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1568bd314caee471d78b83b882b7c89ad778642a4a026de691209318bf3f5a00
|
4
|
+
data.tar.gz: 6d1829e1f8d04fb8592d68faf1b12affccf487a94a86275f932bef8676c542a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ded7ab60f18f80344d244274c354e85eda76150804bdb31598d801d803c33e0d63cc4786becdff7a3bff63a93b98d3837256638fe76ed993384998f56484846c
|
7
|
+
data.tar.gz: 52c1fabe48cacabad8692f7eacd00c3ced295e2963ec29c3f5235cf27ff99a8826b12e2d525bc2d4b86703967dcbe2fe10bdb47c20127f84c04ea8875ae39277
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# A benchmark for testing the enumarable properties of expression (reduce).
|
4
|
+
system :with_reduce_bench do
|
5
|
+
[8].inner :val,:res
|
6
|
+
[64].inner :val64
|
7
|
+
|
8
|
+
timed do
|
9
|
+
val <= _01101010
|
10
|
+
res <= val.reduce(_00000000,:+)
|
11
|
+
!10.ns
|
12
|
+
val <= _01010010
|
13
|
+
res <= val.reduce(_00000000,:+)
|
14
|
+
!10.ns
|
15
|
+
val <= _01101111
|
16
|
+
res <= val.reduce(_00000000,:+)
|
17
|
+
!10.ns
|
18
|
+
val64 <= _0110101001101010011010100110101001101010011010100110101001101010
|
19
|
+
res <= val64.reduce(_00000000,:+)
|
20
|
+
!10.ns
|
21
|
+
res <= val64[7..0]
|
22
|
+
!10.ns
|
23
|
+
res <= res.reduce(_00000000,:+)
|
24
|
+
!10.ns
|
25
|
+
res <= val64[63..60]
|
26
|
+
!10.ns
|
27
|
+
res <= res.reduce(_00000000,:+)
|
28
|
+
!10.ns
|
29
|
+
val64 <= ~(val64 ^ val64)
|
30
|
+
res <= val64.reduce(_00000000,:+)
|
31
|
+
!10.ns
|
32
|
+
val64[0] <= _0
|
33
|
+
val64[3] <= _0
|
34
|
+
val64[63] <= _0
|
35
|
+
res <= val64.reduce(_00000000,:+)
|
36
|
+
!10.ns
|
37
|
+
end
|
38
|
+
end
|
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,11 +497,11 @@ end
|
|
491
497
|
|
492
498
|
# Generate the result.
|
493
499
|
# Get the top systemT.
|
494
|
-
|
500
|
+
HDLRuby.show Time.now
|
495
501
|
$top_system = $top_instance.to_low.systemT
|
496
502
|
$top_intance = nil # Free as much memory as possible.
|
497
|
-
|
498
|
-
|
503
|
+
HDLRuby.show "##### Top system built #####"
|
504
|
+
HDLRuby.show Time.now
|
499
505
|
|
500
506
|
|
501
507
|
# # Apply the pre drivers if any.
|
@@ -562,23 +568,23 @@ elsif $options[:clang] then
|
|
562
568
|
# top_system = $top_system
|
563
569
|
# Preprocess the HW description for valid C generation.
|
564
570
|
$top_system.each_systemT_deep do |systemT|
|
565
|
-
|
571
|
+
HDLRuby.show "seq2seq step..."
|
566
572
|
# Coverts the par blocks in seq blocks to seq blocks to match
|
567
573
|
# the simulation engine.
|
568
574
|
systemT.par_in_seq2seq!
|
569
|
-
|
570
|
-
|
575
|
+
HDLRuby.show Time.now
|
576
|
+
HDLRuby.show "connections_to_behaviors step..."
|
571
577
|
# Converts the connections to behaviors.
|
572
578
|
systemT.connections_to_behaviors!
|
573
|
-
|
579
|
+
HDLRuby.show Time.now
|
574
580
|
# Break the RefConcat.
|
575
|
-
|
581
|
+
HDLRuby.show "concat_assigns step..."
|
576
582
|
systemT.break_concat_assigns!
|
577
|
-
|
583
|
+
HDLRuby.show Time.now
|
578
584
|
# Explicits the types.
|
579
|
-
|
585
|
+
HDLRuby.show "explicit_types step..."
|
580
586
|
systemT.explicit_types!
|
581
|
-
|
587
|
+
HDLRuby.show Time.now
|
582
588
|
end
|
583
589
|
# Generate the C.
|
584
590
|
if $options[:multiple] then
|
@@ -649,7 +655,7 @@ elsif $options[:clang] then
|
|
649
655
|
name = $output + "/" +
|
650
656
|
HDLRuby::Low::Low2C.c_name(systemT.name) +
|
651
657
|
".c"
|
652
|
-
#
|
658
|
+
# show? "for systemT=#{systemT.name} generating: #{name}"
|
653
659
|
# Open the file for current systemT
|
654
660
|
outfile = File.open(name,"w")
|
655
661
|
# Generate the C code in to.
|
@@ -703,26 +709,26 @@ elsif $options[:verilog] then
|
|
703
709
|
# top_system = $top_system
|
704
710
|
# Make description compatible with verilog generation.
|
705
711
|
$top_system.each_systemT_deep do |systemT|
|
706
|
-
|
712
|
+
HDLRuby.show "casts_without_expression! step..."
|
707
713
|
systemT.casts_without_expression!
|
708
|
-
|
709
|
-
|
714
|
+
HDLRuby.show Time.now
|
715
|
+
HDLRuby.show "to_upper_space! step..."
|
710
716
|
systemT.to_upper_space!
|
711
|
-
|
712
|
-
|
717
|
+
HDLRuby.show Time.now
|
718
|
+
HDLRuby.show "to_global_space! step..."
|
713
719
|
systemT.to_global_systemTs!
|
714
|
-
|
720
|
+
HDLRuby.show Time.now
|
715
721
|
# systemT.break_types!
|
716
722
|
# systemT.expand_types!
|
717
|
-
|
723
|
+
HDLRuby.show "par_in_seq2seq! step..."
|
718
724
|
systemT.par_in_seq2seq!
|
719
|
-
|
720
|
-
|
725
|
+
HDLRuby.show Time.now
|
726
|
+
HDLRuby.show "initial_concat_to_timed! step..."
|
721
727
|
systemT.initial_concat_to_timed!
|
722
|
-
|
723
|
-
|
728
|
+
HDLRuby.show Time.now
|
729
|
+
HDLRuby.show "with_port! step..."
|
724
730
|
systemT.with_port!
|
725
|
-
|
731
|
+
HDLRuby.show Time.now
|
726
732
|
end
|
727
733
|
# # Verilog generation
|
728
734
|
# $output << top_system.to_verilog
|
data/lib/HDLRuby/hruby_low2c.rb
CHANGED
@@ -1575,9 +1575,10 @@ module HDLRuby::Low
|
|
1575
1575
|
if str =~ /^[01]+$/ && str.length <= 64 then
|
1576
1576
|
# Yes, generate a numeral value.
|
1577
1577
|
res << " " * (level+1)*3
|
1578
|
-
res << "static unsigned long long data[] = { "
|
1578
|
+
# res << "static unsigned long long data[] = { "
|
1579
|
+
res << "static unsigned int data[] = { "
|
1579
1580
|
res << str.scan(/.{1,#{Low2C.int_width}}/m).map do |sub|
|
1580
|
-
sub.to_i(2).to_s + "ULL"
|
1581
|
+
sub.to_i(2).to_s # + "ULL"
|
1581
1582
|
end.join(",")
|
1582
1583
|
res << " };\n"
|
1583
1584
|
# Create the value.
|
@@ -1930,11 +1931,10 @@ module HDLRuby::Low
|
|
1930
1931
|
res << "ref = #{self.ref.to_c(level+2)};\n"
|
1931
1932
|
# Compute the index.
|
1932
1933
|
res << (" " * ((level+1)*3))
|
1933
|
-
# res << "idx = read64(#{self.index.to_c(level+2)});\n"
|
1934
1934
|
res << "idx = value2integer(#{self.index.to_c(level+2)});\n"
|
1935
1935
|
# Make the access.
|
1936
1936
|
res << (" " * ((level+1)*3))
|
1937
|
-
#
|
1937
|
+
# puts "self.type.width=#{self.type.width}"
|
1938
1938
|
res << "dst = read_range(ref,idx,idx,#{self.type.to_c(level)},dst);\n"
|
1939
1939
|
# Restore the state of the value pool.
|
1940
1940
|
res << (" " * ((level+1)*3))
|
@@ -1947,7 +1947,9 @@ module HDLRuby::Low
|
|
1947
1947
|
# Generates the C text for reference as left value to a signal.
|
1948
1948
|
# +level+ is the hierarchical level of the object.
|
1949
1949
|
def to_c_signal(level = 0)
|
1950
|
+
# puts "to_c_signal for RefIndex"
|
1950
1951
|
return "make_ref_rangeS(#{self.ref.to_c_signal(level)}," +
|
1952
|
+
"#{self.type.to_c(level)}," +
|
1951
1953
|
"value2integer(#{self.index.to_c(level)}),value2integer(#{self.index.to_c(level)}))"
|
1952
1954
|
end
|
1953
1955
|
end
|
@@ -1985,7 +1987,7 @@ module HDLRuby::Low
|
|
1985
1987
|
# Make the access.
|
1986
1988
|
res << (" " * ((level+1)*3))
|
1987
1989
|
# res << "dst = #{command}_range(ref,first,last,#{self.ref.type.base.to_c(level)},dst);\n"
|
1988
|
-
# puts "
|
1990
|
+
# puts "#{command}_range with first=#{self.range.first} and last=#{self.range.last}"
|
1989
1991
|
res << "dst = #{command}_range(ref,first,last,#{self.type.base.to_c(level)},dst);\n"
|
1990
1992
|
# Restore the state of the value pool.
|
1991
1993
|
res << (" " * ((level+1)*3))
|
@@ -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
|
@@ -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
|
data/lib/HDLRuby/sim/hruby_sim.h
CHANGED
@@ -101,6 +101,7 @@ typedef struct ValueS_ {
|
|
101
101
|
/* The tructure of a reference to a range in a value. */
|
102
102
|
typedef struct RefRangeS_ {
|
103
103
|
SignalI signal; /* The refered signal. */
|
104
|
+
Type type; /* The tyep of the elements. */
|
104
105
|
unsigned long long first; /* The first index in the range. */
|
105
106
|
unsigned long long last; /* The last index in the range. */
|
106
107
|
} RefRangeS;
|
@@ -308,11 +309,12 @@ extern int same_content_value_range(Value value0, unsigned long long first,
|
|
308
309
|
|
309
310
|
/** Creates a reference to a range inside a signal.
|
310
311
|
* @param signal the signal to refer
|
312
|
+
* @param typ the type of the elements.
|
311
313
|
* @param first the start index of the range
|
312
314
|
* @param last the end index of the range
|
313
315
|
* @return the resulting reference */
|
314
|
-
extern RefRangeS make_ref_rangeS(SignalI signal,
|
315
|
-
unsigned long long last);
|
316
|
+
extern RefRangeS make_ref_rangeS(SignalI signal, Type typ,
|
317
|
+
unsigned long long first, unsigned long long last);
|
316
318
|
|
317
319
|
|
318
320
|
/* The interface for the lists. */
|
@@ -2171,7 +2171,8 @@ Value read_range_numeric(Value value, long long first, long long last,
|
|
2171
2171
|
/* Compute the read mask. */
|
2172
2172
|
// unsigned long long mask = ((-1LL) << first) & (~((-1LL) << (last+1)));
|
2173
2173
|
/* NOTE: once again, << 64 does not work like expected. */
|
2174
|
-
unsigned long long mask =
|
2174
|
+
unsigned long long mask = last+bw < 64 ? (~((-1LL) << (last+bw))) : -1LL;
|
2175
|
+
// printf("mask=%llx\n",mask);
|
2175
2176
|
/* Performs the read. */
|
2176
2177
|
unsigned long long data = (value->data_int & mask) >> first;
|
2177
2178
|
/* Write it to the destination. */
|
@@ -2216,7 +2217,9 @@ Value write_range_numeric(Value src, long long first, long long last,
|
|
2216
2217
|
/* Copy from the source. */
|
2217
2218
|
unsigned long long src_data = src->data_int & ~((-1LL) << (last-first+1));
|
2218
2219
|
/* Cleans the destination where to place the data. */
|
2219
|
-
unsigned long long mask
|
2220
|
+
unsigned long long mask;
|
2221
|
+
if (last<63) mask = ~(((-1LL) << first) & ~((-1LL) << (last+1)));
|
2222
|
+
else mask = ~((-1LL)<<first);
|
2220
2223
|
unsigned long long dst_data = dst->data_int & mask;
|
2221
2224
|
// printf("src_data=%llx mask=%llx dst_data=%llx\n",src_data,mask,dst_data);
|
2222
2225
|
/* Write the data. */
|
@@ -2947,12 +2950,13 @@ int same_content_value_range(Value value0,
|
|
2947
2950
|
|
2948
2951
|
/** Creates a reference to a range inside a signal.
|
2949
2952
|
* @param signal the signal to refer
|
2953
|
+
* @param typ the type of the elements
|
2950
2954
|
* @param first the start index of the range
|
2951
2955
|
* @param last the end index of the range
|
2952
2956
|
* @return the resulting reference */
|
2953
|
-
RefRangeS make_ref_rangeS(SignalI signal, unsigned long long first,
|
2957
|
+
RefRangeS make_ref_rangeS(SignalI signal, Type typ, unsigned long long first,
|
2954
2958
|
unsigned long long last) {
|
2955
|
-
RefRangeS result = { signal, first, last };
|
2959
|
+
RefRangeS result = { signal, typ, first, last };
|
2956
2960
|
return result;
|
2957
2961
|
}
|
2958
2962
|
|
@@ -586,12 +586,14 @@ void transmit_to_signal_range_seq(Value value, RefRangeS ref) {
|
|
586
586
|
SignalI signal = ref.signal;
|
587
587
|
unsigned long long first = ref.first;
|
588
588
|
unsigned long long last = ref.last;
|
589
|
-
// printf("Tansmit to signal range: %s(%p)\n",signal->name,signal);
|
589
|
+
// printf("Tansmit to signal range: %s(%p) [%llu,%llu]\n",signal->name,signal,first,last);
|
590
590
|
/* Can transmit, copy the content. */
|
591
591
|
if (signal->fading)
|
592
|
-
write_range(value,first,last,signal->f_value->type,signal->f_value);
|
592
|
+
// write_range(value,first,last,signal->f_value->type,signal->f_value);
|
593
|
+
write_range(value,first,last,ref.type,signal->f_value);
|
593
594
|
else
|
594
|
-
write_range_no_z(value,first,last,signal->f_value->type,signal->f_value);
|
595
|
+
// write_range_no_z(value,first,last,signal->f_value->type,signal->f_value);
|
596
|
+
write_range_no_z(value,first,last,ref.type,signal->f_value);
|
595
597
|
/* And touch the signal. */
|
596
598
|
touch_signal_seq(signal);
|
597
599
|
}
|
@@ -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.22
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/HDLRuby/hdr_samples/with_memory_rom.rb
|
151
151
|
- lib/HDLRuby/hdr_samples/with_multi_channels.rb
|
152
152
|
- lib/HDLRuby/hdr_samples/with_reconf.rb
|
153
|
+
- lib/HDLRuby/hdr_samples/with_reduce.rb
|
153
154
|
- lib/HDLRuby/hdr_samples/with_to_array.rb
|
154
155
|
- lib/HDLRuby/hdrcc.rb
|
155
156
|
- lib/HDLRuby/high_samples/_adder_fault.rb
|