HDLRuby 2.4.26 → 2.5.1
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/hdr_samples/dff_unit.rb +54 -0
- data/lib/HDLRuby/hdr_samples/seqpar_bench.rb +59 -0
- data/lib/HDLRuby/hdrcc.rb +104 -22
- data/lib/HDLRuby/hruby_decorator.rb +248 -0
- data/lib/HDLRuby/hruby_high.rb +256 -67
- data/lib/HDLRuby/hruby_low.rb +511 -0
- data/lib/HDLRuby/hruby_low2c.rb +67 -0
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +151 -0
- data/lib/HDLRuby/hruby_unit.rb +43 -0
- data/lib/HDLRuby/hruby_verilog.rb +260 -130
- data/lib/HDLRuby/std/linear.rb +5 -11
- data/lib/HDLRuby/template_expander.rb +61 -0
- data/lib/HDLRuby/version.rb +1 -1
- metadata +11 -2
data/lib/HDLRuby/std/linear.rb
CHANGED
@@ -229,20 +229,14 @@ module HDLRuby::High::Std
|
|
229
229
|
hif(~rvok) { right.read(rv) { rvok <= 1 } }
|
230
230
|
lefts.each_with_index do |left,i|
|
231
231
|
hif(~lvoks[i]) { left.read(lvs[i]) { lvoks[i] <= 1 } }
|
232
|
-
# accs[i].read(avs[i])
|
233
232
|
hif(lvoks[i] & rvok & ~woks[i]) do
|
234
233
|
ack <= 1
|
235
234
|
run <= 0
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
# end
|
242
|
-
# Seems that can do without seq.
|
243
|
-
avs[i] <= add.(avs[i],mul.(lvs[i],rv))
|
244
|
-
accs[i].write(avs[i]) do
|
245
|
-
woks[i] <= 1
|
235
|
+
seq do
|
236
|
+
avs[i] <= add.(avs[i],mul.(lvs[i],rv))
|
237
|
+
accs[i].write(avs[i]) do
|
238
|
+
woks[i] <= 1
|
239
|
+
end
|
246
240
|
end
|
247
241
|
end
|
248
242
|
hif (woks.reduce(:&)) do
|
@@ -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.5.1
|
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-03-16 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
|
@@ -85,6 +87,8 @@ files:
|
|
85
87
|
- lib/HDLRuby/hdr_samples/dff.rb
|
86
88
|
- lib/HDLRuby/hdr_samples/dff_bench.rb
|
87
89
|
- lib/HDLRuby/hdr_samples/dff_counter.rb
|
90
|
+
- lib/HDLRuby/hdr_samples/dff_properties.rb
|
91
|
+
- lib/HDLRuby/hdr_samples/dff_unit.rb
|
88
92
|
- lib/HDLRuby/hdr_samples/include.rb
|
89
93
|
- lib/HDLRuby/hdr_samples/instance_open.rb
|
90
94
|
- lib/HDLRuby/hdr_samples/linear_test.rb
|
@@ -116,6 +120,7 @@ files:
|
|
116
120
|
- lib/HDLRuby/hdr_samples/register_with_code_bench.rb
|
117
121
|
- lib/HDLRuby/hdr_samples/rom.rb
|
118
122
|
- lib/HDLRuby/hdr_samples/ruby_fir_hw.rb
|
123
|
+
- lib/HDLRuby/hdr_samples/seqpar_bench.rb
|
119
124
|
- lib/HDLRuby/hdr_samples/struct.rb
|
120
125
|
- lib/HDLRuby/hdr_samples/sumprod.rb
|
121
126
|
- lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb
|
@@ -198,6 +203,7 @@ files:
|
|
198
203
|
- lib/HDLRuby/hruby_bstr.rb
|
199
204
|
- lib/HDLRuby/hruby_check.rb
|
200
205
|
- lib/HDLRuby/hruby_db.rb
|
206
|
+
- lib/HDLRuby/hruby_decorator.rb
|
201
207
|
- lib/HDLRuby/hruby_error.rb
|
202
208
|
- lib/HDLRuby/hruby_high.rb
|
203
209
|
- lib/HDLRuby/hruby_low.rb
|
@@ -221,10 +227,12 @@ files:
|
|
221
227
|
- lib/HDLRuby/hruby_low_without_connection.rb
|
222
228
|
- lib/HDLRuby/hruby_low_without_namespace.rb
|
223
229
|
- lib/HDLRuby/hruby_low_without_outread.rb
|
230
|
+
- lib/HDLRuby/hruby_low_without_parinseq.rb
|
224
231
|
- lib/HDLRuby/hruby_low_without_select.rb
|
225
232
|
- lib/HDLRuby/hruby_serializer.rb
|
226
233
|
- lib/HDLRuby/hruby_tools.rb
|
227
234
|
- lib/HDLRuby/hruby_types.rb
|
235
|
+
- lib/HDLRuby/hruby_unit.rb
|
228
236
|
- lib/HDLRuby/hruby_values.rb
|
229
237
|
- lib/HDLRuby/hruby_verilog.rb
|
230
238
|
- lib/HDLRuby/hruby_verilog_name.rb
|
@@ -291,6 +299,7 @@ files:
|
|
291
299
|
- lib/HDLRuby/std/pipeline.rb
|
292
300
|
- lib/HDLRuby/std/reconf.rb
|
293
301
|
- lib/HDLRuby/std/task.rb
|
302
|
+
- lib/HDLRuby/template_expander.rb
|
294
303
|
- lib/HDLRuby/test_hruby_bstr.rb
|
295
304
|
- lib/HDLRuby/test_hruby_high.rb
|
296
305
|
- lib/HDLRuby/test_hruby_high_low.rb
|