HDLRuby 3.9.3 → 3.9.6
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/README.md +34 -3
- data/ext/hruby_sim/hruby_rcsim_build.c +47 -0
- data/ext/hruby_sim/hruby_sim.h +29 -1
- data/ext/hruby_sim/hruby_sim_calc.c +142 -19
- data/ext/hruby_sim/hruby_sim_tree_calc.c +37 -0
- data/lib/HDLRuby/hdr_samples/case_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/constant_prop_bench.rb +2 -2
- data/lib/HDLRuby/hdr_samples/logic_bench.rb +12 -12
- data/lib/HDLRuby/hdr_samples/with_assign_to_slice.rb +19 -0
- data/lib/HDLRuby/hdr_samples/with_casez.rb +35 -0
- data/lib/HDLRuby/hdr_samples/with_henumerable.rb +1 -1
- data/lib/HDLRuby/hruby_high.rb +122 -13
- data/lib/HDLRuby/hruby_low.rb +50 -46
- data/lib/HDLRuby/hruby_low_split_signals.rb +2 -2
- data/lib/HDLRuby/hruby_rcsim.rb +13 -3
- data/lib/HDLRuby/hruby_verilog.rb +17 -6
- data/lib/HDLRuby/hruby_viz.rb +827 -713
- data/lib/HDLRuby/std/decoder.rb +2 -2
- data/lib/HDLRuby/std/sequencer.rb +6 -7
- data/lib/HDLRuby/verilog_hruby.rb +30 -0
- data/lib/HDLRuby/verilog_parser.rb +1 -1
- data/lib/HDLRuby/version.rb +1 -1
- metadata +4 -2
data/lib/HDLRuby/std/decoder.rb
CHANGED
|
@@ -131,10 +131,10 @@ module HDLRuby::High::Std
|
|
|
131
131
|
format = format.to_s
|
|
132
132
|
width = format.size
|
|
133
133
|
# For that purpose create the regular expression used to process it.
|
|
134
|
-
prs = "([0-1]+)|(a+)|(b+)|(c+)|(d+)|(e+)|(g+)|(h+)|(i+)|(j+)|(k+)|(l+)|(m+)|(n+)|(o+)|(p+)|(q+)|(r+)|(s+)|(t+)|(u+)|(v+)|(w+)|(x+)|(y+)|(z+)"
|
|
134
|
+
prs = "([0-1]+)|(a+)|(b+)|(c+)|(d+)|(e+)|(f+)|(g+)|(h+)|(i+)|(j+)|(k+)|(l+)|(m+)|(n+)|(o+)|(p+)|(q+)|(r+)|(s+)|(t+)|(u+)|(v+)|(w+)|(x+)|(y+)|(z+)"
|
|
135
135
|
# Check if the format is compatible with it.
|
|
136
136
|
unless format =~ Regexp.new("^(#{prs})+$") then
|
|
137
|
-
raise AnyError
|
|
137
|
+
raise AnyError, "Invalid format for a field: #{format}"
|
|
138
138
|
end
|
|
139
139
|
# Split the format in fields.
|
|
140
140
|
format = format.split(Regexp.new(prs)).select {|str| !str.empty?}
|
|
@@ -2266,13 +2266,12 @@ module HDLRuby::High::Std
|
|
|
2266
2266
|
end
|
|
2267
2267
|
# Create the hardware iterator.
|
|
2268
2268
|
this = self
|
|
2269
|
-
size = this.size ? this.size : this.last - this.first + 1
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
# end
|
|
2269
|
+
# size = this.size ? this.size : this.last - this.first + 1
|
|
2270
|
+
if this.last.is_a?(SignalI) or this.first.is_a?(SignalI) then
|
|
2271
|
+
size = this.last.to_expr - this.first.to_expr + 1
|
|
2272
|
+
else
|
|
2273
|
+
size = this.last.to_i - this.first.to_i + 1
|
|
2274
|
+
end
|
|
2276
2275
|
size = size.to_expr.as(typ)
|
|
2277
2276
|
# hw_enum = SEnumeratorBase.new(signed[32],size) do |idx|
|
|
2278
2277
|
hw_enum = SEnumeratorBase.new(typ,size) do |idx|
|
|
@@ -889,6 +889,34 @@ module VerilogTools
|
|
|
889
889
|
state.indent = indent
|
|
890
890
|
state.level = level
|
|
891
891
|
return case_txt
|
|
892
|
+
when :casez
|
|
893
|
+
# Saves the state.
|
|
894
|
+
indent = state.indent
|
|
895
|
+
level = state.level
|
|
896
|
+
# Generate the hcase.
|
|
897
|
+
state.indent += " "
|
|
898
|
+
case_txt = indent + "hcasez(" + ast[1].to_HDLRuby(state) + ")\n"
|
|
899
|
+
# Generate the case items.
|
|
900
|
+
case_txt += ast[2].map do |item|
|
|
901
|
+
res_txt = ""
|
|
902
|
+
if item[0] != "default" then
|
|
903
|
+
# hwhen case.
|
|
904
|
+
res_txt += indent + "hwhen("
|
|
905
|
+
res_txt += item[0].map {|e| e.to_HDLRuby(state) }.join(",")
|
|
906
|
+
res_txt += ") do\n"
|
|
907
|
+
res_txt += item[1].to_HDLRuby(state)
|
|
908
|
+
res_txt += indent + "end\n"
|
|
909
|
+
else
|
|
910
|
+
# helse case.
|
|
911
|
+
res_txt += indent + "helse do\n"
|
|
912
|
+
res_txt += item[1].to_HDLRuby(state) + indent + "end\n"
|
|
913
|
+
end
|
|
914
|
+
res_txt
|
|
915
|
+
end.join
|
|
916
|
+
# Restore the state and return the result.
|
|
917
|
+
state.indent = indent
|
|
918
|
+
state.level = level
|
|
919
|
+
return case_txt
|
|
892
920
|
when :blocking_assignment, :non_blocking_assignment
|
|
893
921
|
return ast[0].to_HDLRuby(state)
|
|
894
922
|
when :statement
|
|
@@ -1094,6 +1122,8 @@ module VerilogTools
|
|
|
1094
1122
|
base = ast[1] ? ast[1].to_HDLRuby(state) : ""
|
|
1095
1123
|
# Get the second number if any.
|
|
1096
1124
|
number1 = ast[2] ? ast[2].to_HDLRuby(state) : ""
|
|
1125
|
+
# In HDLRuby, for now, wildcards work like z.
|
|
1126
|
+
number1 = number1.gsub("?","z")
|
|
1097
1127
|
# Depending on the base.
|
|
1098
1128
|
case base
|
|
1099
1129
|
when "'b"
|
|
@@ -1220,7 +1220,7 @@ module VerilogTools
|
|
|
1220
1220
|
CLOSE_BRA_COLON_TOKS = [ "\\" + CLOSE_BRA_TOK, COLON_TOK ]
|
|
1221
1221
|
CLOSE_BRA_COLON_REX = /\G#{S}(#{CLOSE_BRA_COLON_TOKS.join("|")})/
|
|
1222
1222
|
|
|
1223
|
-
STATEMENT_TOKS = [ IF_TOK,
|
|
1223
|
+
STATEMENT_TOKS = [ IF_TOK, CASEZ_TOK, CASEX_TOK, CASE_TOK,
|
|
1224
1224
|
FOREVER_TOK, REPEAT_TOK, WHILE_TOK, FOR_TOK,
|
|
1225
1225
|
WAIT_TOK, RIGHT_ARROW_TOK, DISABLE_TOK,
|
|
1226
1226
|
ASSIGN_TOK, FORCE_TOK, DEASSIGN_TOK, RELEASE_TOK ]
|
data/lib/HDLRuby/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: HDLRuby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.9.
|
|
4
|
+
version: 3.9.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lovic Gauthier
|
|
@@ -193,11 +193,13 @@ files:
|
|
|
193
193
|
- lib/HDLRuby/hdr_samples/tuple.rb
|
|
194
194
|
- lib/HDLRuby/hdr_samples/type_minmax_bench.rb
|
|
195
195
|
- lib/HDLRuby/hdr_samples/verilog_parser_bench.rb
|
|
196
|
+
- lib/HDLRuby/hdr_samples/with_assign_to_slice.rb
|
|
196
197
|
- lib/HDLRuby/hdr_samples/with_board.rb
|
|
197
198
|
- lib/HDLRuby/hdr_samples/with_board_sequencer.rb
|
|
198
199
|
- lib/HDLRuby/hdr_samples/with_bram.rb
|
|
199
200
|
- lib/HDLRuby/hdr_samples/with_bram_frame_stack.rb
|
|
200
201
|
- lib/HDLRuby/hdr_samples/with_bram_stack.rb
|
|
202
|
+
- lib/HDLRuby/hdr_samples/with_casez.rb
|
|
201
203
|
- lib/HDLRuby/hdr_samples/with_casts.rb
|
|
202
204
|
- lib/HDLRuby/hdr_samples/with_channel.rb
|
|
203
205
|
- lib/HDLRuby/hdr_samples/with_channel_other.rb
|
|
@@ -502,7 +504,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
502
504
|
- !ruby/object:Gem::Version
|
|
503
505
|
version: '0'
|
|
504
506
|
requirements: []
|
|
505
|
-
rubygems_version:
|
|
507
|
+
rubygems_version: 4.0.18
|
|
506
508
|
specification_version: 4
|
|
507
509
|
summary: HDLRuby is a library for describing and simulating digital electronic systems.
|
|
508
510
|
test_files: []
|