HDLRuby 2.4.27 → 2.6.2
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/adder.rb +1 -1
- data/lib/HDLRuby/hdr_samples/adder_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/adder_gen.rb +1 -1
- data/lib/HDLRuby/hdr_samples/constant_in_function.rb +27 -0
- data/lib/HDLRuby/hdr_samples/dff_properties.rb +19 -0
- data/lib/HDLRuby/hdr_samples/dff_unit.rb +54 -0
- data/lib/HDLRuby/hdr_samples/huge_rom.rb +25 -0
- data/lib/HDLRuby/hdr_samples/logic_bench.rb +21 -0
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/music.rb +79 -0
- data/lib/HDLRuby/hdr_samples/named_sub.rb +42 -0
- data/lib/HDLRuby/hdr_samples/rom.rb +16 -0
- data/lib/HDLRuby/hdr_samples/seqpar_bench.rb +59 -0
- data/lib/HDLRuby/hdr_samples/with_function_generator.rb +25 -0
- data/lib/HDLRuby/hdrcc.rb +140 -24
- data/lib/HDLRuby/hruby_decorator.rb +250 -0
- data/lib/HDLRuby/hruby_high.rb +468 -91
- data/lib/HDLRuby/hruby_low.rb +913 -45
- data/lib/HDLRuby/hruby_low2c.rb +189 -168
- data/lib/HDLRuby/hruby_low2hdr.rb +738 -0
- data/lib/HDLRuby/hruby_low2high.rb +331 -549
- data/lib/HDLRuby/hruby_low2vhd.rb +39 -2
- data/lib/HDLRuby/hruby_low_bool2select.rb +29 -0
- data/lib/HDLRuby/hruby_low_casts_without_expression.rb +27 -0
- data/lib/HDLRuby/hruby_low_fix_types.rb +25 -0
- data/lib/HDLRuby/hruby_low_mutable.rb +70 -0
- data/lib/HDLRuby/hruby_low_resolve.rb +28 -0
- data/lib/HDLRuby/hruby_low_without_connection.rb +6 -3
- data/lib/HDLRuby/hruby_low_without_namespace.rb +7 -4
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +151 -0
- data/lib/HDLRuby/hruby_low_without_select.rb +13 -0
- data/lib/HDLRuby/hruby_tools.rb +11 -1
- data/lib/HDLRuby/hruby_verilog.rb +1602 -1629
- data/lib/HDLRuby/sim/hruby_sim.h +25 -2
- data/lib/HDLRuby/sim/hruby_sim_calc.c +63 -6
- data/lib/HDLRuby/sim/hruby_sim_vcd.c +5 -1
- data/lib/HDLRuby/sim/hruby_sim_vizualize.c +22 -6
- data/lib/HDLRuby/std/fixpoint.rb +9 -0
- data/lib/HDLRuby/std/function_generator.rb +139 -0
- data/lib/HDLRuby/std/hruby_unit.rb +75 -0
- data/lib/HDLRuby/template_expander.rb +61 -0
- data/lib/HDLRuby/version.rb +1 -1
- metadata +22 -5
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'strscan'
|
2
|
+
|
3
|
+
##
|
4
|
+
# Tool for expanding template files.
|
5
|
+
#
|
6
|
+
# Used for generating files like confugaration file for given HW target
|
7
|
+
#
|
8
|
+
########################################################################
|
9
|
+
|
10
|
+
|
11
|
+
class TemplateExpander
|
12
|
+
|
13
|
+
## Describes an expansion rule.
|
14
|
+
Rule = Struct.new(:match,:action)
|
15
|
+
|
16
|
+
# Creates a new template expander with potential list of +rules+.
|
17
|
+
def initialize(rules= [])
|
18
|
+
# Setup the rules.
|
19
|
+
@rules = rules.map do |match,action|
|
20
|
+
# Ensures action is a proc.
|
21
|
+
action = proc { |str| action.to_s } unless action.is_a?(Proc)
|
22
|
+
# Create the rule.
|
23
|
+
Rule.new(Regexp.new(match), action)
|
24
|
+
end
|
25
|
+
# The skip regexp is empty, it has to be built with finalize.
|
26
|
+
@skip = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# Adds a +rule+.
|
30
|
+
def add_rule(*rule)
|
31
|
+
@rules << Rule.new(Regexp.new(rule[0]), rule[1])
|
32
|
+
end
|
33
|
+
|
34
|
+
# Finalize the expander by building the default rule.
|
35
|
+
def finalize
|
36
|
+
# @skip = Regexp.union(*@rules.map { |rule| rule.match })
|
37
|
+
@skip = /(?=#{Regexp.union(*@rules.map { |rule| rule.match }).source})|\z/
|
38
|
+
end
|
39
|
+
|
40
|
+
# Apply the expander to +str+ and put the result in +res+.
|
41
|
+
def expand(str,res = "")
|
42
|
+
# Ensure the default rule is properly set up.
|
43
|
+
self.finalize
|
44
|
+
# Scan the string with each rule.
|
45
|
+
scanner = StringScanner.new(str)
|
46
|
+
until scanner.eos? do
|
47
|
+
@rules.find do |rule|
|
48
|
+
scanned = scanner.scan(rule.match)
|
49
|
+
if scanned then
|
50
|
+
res << rule.action.call(scanned)
|
51
|
+
else
|
52
|
+
false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
res << scanner.scan_until(@skip)
|
56
|
+
end
|
57
|
+
return res
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
end
|
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.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,8 @@ files:
|
|
66
66
|
- lib/HDLRuby/alcc.rb
|
67
67
|
- lib/HDLRuby/backend/hruby_allocator.rb
|
68
68
|
- lib/HDLRuby/backend/hruby_c_allocator.rb
|
69
|
+
- lib/HDLRuby/drivers/xcd.rb
|
70
|
+
- lib/HDLRuby/drivers/xcd/dummy.xcd
|
69
71
|
- lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_hs_32.v
|
70
72
|
- lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_qu_213.v
|
71
73
|
- lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_qu_222.v
|
@@ -81,13 +83,18 @@ files:
|
|
81
83
|
- lib/HDLRuby/hdr_samples/alu.rb
|
82
84
|
- lib/HDLRuby/hdr_samples/bstr_bench.rb
|
83
85
|
- lib/HDLRuby/hdr_samples/calculator.rb
|
86
|
+
- lib/HDLRuby/hdr_samples/constant_in_function.rb
|
84
87
|
- lib/HDLRuby/hdr_samples/counter_bench.rb
|
85
88
|
- lib/HDLRuby/hdr_samples/dff.rb
|
86
89
|
- lib/HDLRuby/hdr_samples/dff_bench.rb
|
87
90
|
- lib/HDLRuby/hdr_samples/dff_counter.rb
|
91
|
+
- lib/HDLRuby/hdr_samples/dff_properties.rb
|
92
|
+
- lib/HDLRuby/hdr_samples/dff_unit.rb
|
93
|
+
- lib/HDLRuby/hdr_samples/huge_rom.rb
|
88
94
|
- lib/HDLRuby/hdr_samples/include.rb
|
89
95
|
- lib/HDLRuby/hdr_samples/instance_open.rb
|
90
96
|
- lib/HDLRuby/hdr_samples/linear_test.rb
|
97
|
+
- lib/HDLRuby/hdr_samples/logic_bench.rb
|
91
98
|
- lib/HDLRuby/hdr_samples/make_multi_channels_v.rb
|
92
99
|
- lib/HDLRuby/hdr_samples/make_multi_channels_vcd.rb
|
93
100
|
- lib/HDLRuby/hdr_samples/mei8.rb
|
@@ -95,6 +102,8 @@ files:
|
|
95
102
|
- lib/HDLRuby/hdr_samples/memory_test.rb
|
96
103
|
- lib/HDLRuby/hdr_samples/multer_gen.rb
|
97
104
|
- lib/HDLRuby/hdr_samples/multer_seq.rb
|
105
|
+
- lib/HDLRuby/hdr_samples/music.rb
|
106
|
+
- lib/HDLRuby/hdr_samples/named_sub.rb
|
98
107
|
- lib/HDLRuby/hdr_samples/neg_arith_bench.rb
|
99
108
|
- lib/HDLRuby/hdr_samples/neural/a.rb
|
100
109
|
- lib/HDLRuby/hdr_samples/neural/a_sub.rb
|
@@ -116,6 +125,7 @@ files:
|
|
116
125
|
- lib/HDLRuby/hdr_samples/register_with_code_bench.rb
|
117
126
|
- lib/HDLRuby/hdr_samples/rom.rb
|
118
127
|
- lib/HDLRuby/hdr_samples/ruby_fir_hw.rb
|
128
|
+
- lib/HDLRuby/hdr_samples/seqpar_bench.rb
|
119
129
|
- lib/HDLRuby/hdr_samples/struct.rb
|
120
130
|
- lib/HDLRuby/hdr_samples/sumprod.rb
|
121
131
|
- lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb
|
@@ -130,6 +140,7 @@ files:
|
|
130
140
|
- lib/HDLRuby/hdr_samples/with_decoder.rb
|
131
141
|
- lib/HDLRuby/hdr_samples/with_fixpoint.rb
|
132
142
|
- lib/HDLRuby/hdr_samples/with_fsm.rb
|
143
|
+
- lib/HDLRuby/hdr_samples/with_function_generator.rb
|
133
144
|
- lib/HDLRuby/hdr_samples/with_linear.rb
|
134
145
|
- lib/HDLRuby/hdr_samples/with_loop.rb
|
135
146
|
- lib/HDLRuby/hdr_samples/with_memory.rb
|
@@ -198,10 +209,12 @@ files:
|
|
198
209
|
- lib/HDLRuby/hruby_bstr.rb
|
199
210
|
- lib/HDLRuby/hruby_check.rb
|
200
211
|
- lib/HDLRuby/hruby_db.rb
|
212
|
+
- lib/HDLRuby/hruby_decorator.rb
|
201
213
|
- lib/HDLRuby/hruby_error.rb
|
202
214
|
- lib/HDLRuby/hruby_high.rb
|
203
215
|
- lib/HDLRuby/hruby_low.rb
|
204
216
|
- lib/HDLRuby/hruby_low2c.rb
|
217
|
+
- lib/HDLRuby/hruby_low2hdr.rb
|
205
218
|
- lib/HDLRuby/hruby_low2high.rb
|
206
219
|
- lib/HDLRuby/hruby_low2seq.rb
|
207
220
|
- lib/HDLRuby/hruby_low2sym.rb
|
@@ -221,6 +234,7 @@ files:
|
|
221
234
|
- lib/HDLRuby/hruby_low_without_connection.rb
|
222
235
|
- lib/HDLRuby/hruby_low_without_namespace.rb
|
223
236
|
- lib/HDLRuby/hruby_low_without_outread.rb
|
237
|
+
- lib/HDLRuby/hruby_low_without_parinseq.rb
|
224
238
|
- lib/HDLRuby/hruby_low_without_select.rb
|
225
239
|
- lib/HDLRuby/hruby_serializer.rb
|
226
240
|
- lib/HDLRuby/hruby_tools.rb
|
@@ -285,12 +299,15 @@ files:
|
|
285
299
|
- lib/HDLRuby/std/decoder.rb
|
286
300
|
- lib/HDLRuby/std/fixpoint.rb
|
287
301
|
- lib/HDLRuby/std/fsm.rb
|
302
|
+
- lib/HDLRuby/std/function_generator.rb
|
303
|
+
- lib/HDLRuby/std/hruby_unit.rb
|
288
304
|
- lib/HDLRuby/std/linear.rb
|
289
305
|
- lib/HDLRuby/std/loop.rb
|
290
306
|
- lib/HDLRuby/std/memory.rb
|
291
307
|
- lib/HDLRuby/std/pipeline.rb
|
292
308
|
- lib/HDLRuby/std/reconf.rb
|
293
309
|
- lib/HDLRuby/std/task.rb
|
310
|
+
- lib/HDLRuby/template_expander.rb
|
294
311
|
- lib/HDLRuby/test_hruby_bstr.rb
|
295
312
|
- lib/HDLRuby/test_hruby_high.rb
|
296
313
|
- lib/HDLRuby/test_hruby_high_low.rb
|
@@ -306,7 +323,7 @@ homepage: https://github.com/civol/HDLRuby
|
|
306
323
|
licenses:
|
307
324
|
- MIT
|
308
325
|
metadata: {}
|
309
|
-
post_install_message:
|
326
|
+
post_install_message:
|
310
327
|
rdoc_options: []
|
311
328
|
require_paths:
|
312
329
|
- lib
|
@@ -323,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
323
340
|
version: '0'
|
324
341
|
requirements: []
|
325
342
|
rubygems_version: 3.0.8
|
326
|
-
signing_key:
|
343
|
+
signing_key:
|
327
344
|
specification_version: 4
|
328
345
|
summary: HDLRuby is a library for describing and simulating digital electronic systems.
|
329
346
|
test_files: []
|