HDLRuby 2.6.8 → 2.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +11 -0
- data/lib/HDLRuby/hdrcc.rb +64 -34
- data/lib/HDLRuby/hruby_high.rb +130 -114
- data/lib/HDLRuby/hruby_low.rb +27 -27
- data/lib/HDLRuby/hruby_low2c.rb +3 -1
- 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 +50 -32
- data/lib/HDLRuby/sim/hruby_sim_calc.c +168 -8
- 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: 2d49fb40d2d1233c59c0ae1f6d7afea51ab17e70aaac5f605295f4c44e478fa4
|
4
|
+
data.tar.gz: 0b14393197c0af246dae6c221d2beb94580fa9b4c30b234e82efdae4eebf5bca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2c55c6966faa1274aee2ae712b376aec22670e9a574b4d5312e73a8a8a1f85713b8312d6b923e4daef030398667c327245ee8aeb813c3d379d137dd63ec9af8
|
7
|
+
data.tar.gz: a28d25d1a5ff5893e64ede5229a4b53c7ad0c4ff6479807e3f76764c9f464fc5d0b6a41f8cce3ea8b49338895a3d95e8582760c64a0d8df21a5683fd0acba4d3
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# A benchmark for testing the arithmetic with signed values.
|
3
3
|
system :neg_arith_bench do
|
4
4
|
signed[11..0].inner :x,:y,:z
|
5
|
+
inner :cmp
|
5
6
|
|
6
7
|
timed do
|
7
8
|
x <= 10
|
@@ -9,41 +10,51 @@ system :neg_arith_bench do
|
|
9
10
|
z <= 0
|
10
11
|
!10.ns
|
11
12
|
z <= 10 * 10
|
13
|
+
cmp <= (10 < 10)
|
12
14
|
!10.ns
|
13
15
|
z <= x * y
|
16
|
+
cmp <= (x < y)
|
14
17
|
!10.ns
|
15
18
|
x <= 10
|
16
19
|
y <= -10
|
17
20
|
!10.ns
|
18
21
|
z <= 10 * (-10)
|
22
|
+
cmp <= (10 < -10)
|
19
23
|
!10.ns
|
20
24
|
z <= x * y
|
25
|
+
cmp <= (x < y)
|
21
26
|
!10.ns
|
22
27
|
x <= -10
|
23
28
|
y <= 10
|
24
29
|
!10.ns
|
25
30
|
z <= (-10) * 10
|
31
|
+
cmp <= (-10 < 10)
|
26
32
|
!10.ns
|
27
33
|
z <= x * y
|
34
|
+
cmp <= (x < y)
|
28
35
|
!10.ns
|
29
36
|
x <= -10
|
30
37
|
y <= -10
|
31
38
|
!10.ns
|
32
39
|
z <= (-10) * (-10)
|
40
|
+
cmp <= (-10 < -10)
|
33
41
|
!10.ns
|
34
42
|
z <= x * y
|
43
|
+
cmp <= (x < y)
|
35
44
|
!10.ns
|
36
45
|
x <= _000000011010
|
37
46
|
y <= _000011111010
|
38
47
|
z <= 0
|
39
48
|
!10.ns
|
40
49
|
z <= x * y
|
50
|
+
cmp <= (x < y)
|
41
51
|
!10.ns
|
42
52
|
x <= _000000011010
|
43
53
|
y <= _111111111010
|
44
54
|
z <= 0
|
45
55
|
!10.ns
|
46
56
|
z <= x * y
|
57
|
+
cmp <= (x < y)
|
47
58
|
!10.ns
|
48
59
|
end
|
49
60
|
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,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
|