HDLRuby 2.4.26 → 2.5.1

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.
@@ -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
- # seq do
237
- # avs[i] <= add.(avs[i],mul.(lvs[i],rv))
238
- # accs[i].write(avs[i]) do
239
- # woks[i] <= 1
240
- # end
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
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.4.26"
2
+ VERSION = "2.5.1"
3
3
  end
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.26
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-01-04 00:00:00.000000000 Z
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