HDLRuby 2.11.10 → 2.11.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +55 -18
  3. data/ext/hruby_sim/hruby_rcsim_build.c +110 -83
  4. data/ext/hruby_sim/hruby_sim.h +3 -0
  5. data/ext/hruby_sim/hruby_sim_calc.c +14 -6
  6. data/ext/hruby_sim/hruby_sim_core.c +20 -7
  7. data/ext/hruby_sim/hruby_sim_list.c +1 -1
  8. data/ext/hruby_sim/hruby_sim_stack_calc.c +3 -2
  9. data/ext/hruby_sim/hruby_sim_tree_calc.c +8 -1
  10. data/ext/hruby_sim/hruby_sim_vcd.c +24 -7
  11. data/ext/hruby_sim/hruby_sim_vizualize.c +9 -1
  12. data/lib/HDLRuby/hdr_samples/constant_in_function.rb +3 -1
  13. data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +3 -1
  14. data/lib/HDLRuby/hdr_samples/huge_rom.rb +1 -1
  15. data/lib/HDLRuby/hdr_samples/mei8.rb +11 -11
  16. data/lib/HDLRuby/hdr_samples/mei8_bench.rb +11 -11
  17. data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +4 -4
  18. data/lib/HDLRuby/hdr_samples/rom_nest.rb +1 -1
  19. data/lib/HDLRuby/hdr_samples/ruby_fir_hw.rb +4 -4
  20. data/lib/HDLRuby/hdr_samples/struct.rb +44 -10
  21. data/lib/HDLRuby/hdr_samples/with_bram.rb +45 -0
  22. data/lib/HDLRuby/hdr_samples/with_casts.rb +3 -3
  23. data/lib/HDLRuby/hdr_samples/with_concat.rb +6 -6
  24. data/lib/HDLRuby/hdr_samples/with_connector_memory.rb +2 -2
  25. data/lib/HDLRuby/hdr_samples/with_def.rb +10 -3
  26. data/lib/HDLRuby/hdr_samples/with_define_operator.rb +44 -0
  27. data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +12 -12
  28. data/lib/HDLRuby/hdr_samples/with_init.rb +3 -3
  29. data/lib/HDLRuby/hdr_samples/with_leftright.rb +21 -0
  30. data/lib/HDLRuby/hdr_samples/with_reduce.rb +13 -13
  31. data/lib/HDLRuby/hdr_samples/with_ref_array.rb +6 -6
  32. data/lib/HDLRuby/hdr_samples/with_subsums.rb +3 -3
  33. data/lib/HDLRuby/hdr_samples/with_terminate.rb +3 -3
  34. data/lib/HDLRuby/hdr_samples/with_to_a.rb +10 -10
  35. data/lib/HDLRuby/hdr_samples/with_values.rb +3 -3
  36. data/lib/HDLRuby/hdrcc.rb +14 -1
  37. data/lib/HDLRuby/hruby_bstr.rb +10 -5
  38. data/lib/HDLRuby/hruby_high.rb +114 -27
  39. data/lib/HDLRuby/hruby_low.rb +187 -16
  40. data/lib/HDLRuby/hruby_low2c.rb +71 -11
  41. data/lib/HDLRuby/hruby_low2vhd.rb +2 -1
  42. data/lib/HDLRuby/hruby_low_fix_types.rb +1 -0
  43. data/lib/HDLRuby/hruby_low_mutable.rb +30 -1
  44. data/lib/HDLRuby/hruby_low_resolve.rb +15 -2
  45. data/lib/HDLRuby/hruby_low_without_concat.rb +28 -8
  46. data/lib/HDLRuby/hruby_low_without_parinseq.rb +14 -4
  47. data/lib/HDLRuby/hruby_low_without_select.rb +2 -2
  48. data/lib/HDLRuby/hruby_low_without_subsignals.rb +279 -0
  49. data/lib/HDLRuby/hruby_rcsim.rb +99 -87
  50. data/lib/HDLRuby/hruby_rsim.rb +132 -7
  51. data/lib/HDLRuby/hruby_rsim_vcd.rb +99 -27
  52. data/lib/HDLRuby/hruby_values.rb +35 -31
  53. data/lib/HDLRuby/std/bram.rb +22 -0
  54. data/lib/HDLRuby/std/fixpoint.rb +2 -2
  55. data/lib/HDLRuby/std/fsm.rb +20 -3
  56. data/lib/HDLRuby/std/function_generator.rb +2 -2
  57. data/lib/HDLRuby/version.rb +1 -1
  58. metadata +7 -3
  59. data/lib/HDLRuby/hdr_samples/sumprod.rb +0 -29
@@ -94,9 +94,10 @@ module HDLRuby::High
94
94
 
95
95
  ## Gets the VCD variables with their long name.
96
96
  def get_vars_with_fullname(vars_with_fullname = {})
97
- # Adds the signals of the interface of the system.
97
+ # Recurse on the signals.
98
98
  self.each_signal do |sig|
99
- vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
99
+ sig.get_vars_with_fullname(vars_with_fullname)
100
+ # vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
100
101
  end
101
102
  # Recurse on the scope.
102
103
  return self.scope.get_vars_with_fullname(vars_with_fullname)
@@ -104,9 +105,13 @@ module HDLRuby::High
104
105
 
105
106
  ## Gets the VCD variables with their id string.
106
107
  def get_vars_with_idstr(vars_with_idstr = {})
107
- # Adds the signals of the interface of the system.
108
+ # # Adds the signals of the interface of the system.
109
+ # self.each_signal do |sig|
110
+ # vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig)
111
+ # end
112
+ # Recurse on the signals.
108
113
  self.each_signal do |sig|
109
- vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig)
114
+ sig.get_vars_with_idstr(vars_with_idstr)
110
115
  end
111
116
  # Recurse on the scope.
112
117
  return self.scope.get_vars_with_idstr(vars_with_idstr)
@@ -119,11 +124,11 @@ module HDLRuby::High
119
124
  vcdout << "$scope module #{HDLRuby::High.vcd_name(self.name)} $end\n"
120
125
  # Shows the interface signals.
121
126
  self.each_signal do |sig|
122
- # puts "showing signal #{HDLRuby::High.vcd_name(sig.fullname)}"
123
- vcdout << "$var wire #{sig.type.width} "
124
- # vcdout << "#{HDLRuby::High.vcd_name(sig.fullname)} "
125
- vcdout << "#{HDLRuby::High.vcd_idstr(sig)} "
126
- vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n"
127
+ sig.show_hierarchy(vcdout)
128
+ # # puts "showing signal #{HDLRuby::High.vcd_name(sig.fullname)}"
129
+ # vcdout << "$var wire #{sig.type.width} "
130
+ # vcdout << "#{HDLRuby::High.vcd_idstr(sig)} "
131
+ # vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n"
127
132
  end
128
133
  # Recurse on the scope.
129
134
  self.scope.show_hierarchy(vcdout)
@@ -170,11 +175,12 @@ module HDLRuby::High
170
175
  end
171
176
  # Shows the inner signals.
172
177
  self.each_inner do |sig|
173
- # puts "showing inner signal #{HDLRuby::High.vcd_name(sig.fullname)}"
174
- vcdout << "$var wire #{sig.type.width} "
175
- # vcdout << "#{HDLRuby::High.vcd_name(sig.fullname)} "
176
- vcdout << "#{HDLRuby::High.vcd_idstr(sig)} "
177
- vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n"
178
+ sig.show_hierarchy(vcdout)
179
+ # # puts "showing inner signal #{HDLRuby::High.vcd_name(sig.fullname)}"
180
+ # vcdout << "$var wire #{sig.type.width} "
181
+ # # vcdout << "#{HDLRuby::High.vcd_name(sig.fullname)} "
182
+ # vcdout << "#{HDLRuby::High.vcd_idstr(sig)} "
183
+ # vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n"
178
184
  end
179
185
  # Recurse on the behaviors' blocks
180
186
  self.each_behavior do |beh|
@@ -196,9 +202,14 @@ module HDLRuby::High
196
202
 
197
203
  ## Gets the VCD variables with their long name.
198
204
  def get_vars_with_fullname(vars_with_fullname = {})
199
- # Adds the inner signals.
205
+ # # Adds the inner signals.
206
+ # self.each_inner do |sig|
207
+ # vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
208
+ # end
209
+ # Recurse on the inner signals.
200
210
  self.each_inner do |sig|
201
- vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
211
+ sig.get_vars_with_fullname(vars_with_fullname)
212
+ # vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
202
213
  end
203
214
  # Recurse on the behaviors' blocks
204
215
  self.each_behavior do |beh|
@@ -217,9 +228,13 @@ module HDLRuby::High
217
228
 
218
229
  ## Gets the VCD variables with their id string.
219
230
  def get_vars_with_idstr(vars_with_idstr = {})
220
- # Adds the inner signals.
231
+ # # Adds the inner signals.
232
+ # self.each_inner do |sig|
233
+ # vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig)
234
+ # end
235
+ # Recurse on the inner signals.
221
236
  self.each_inner do |sig|
222
- vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig)
237
+ sig.get_vars_with_idstr(vars_with_idstr)
223
238
  end
224
239
  # Recurse on the behaviors' blocks
225
240
  self.each_behavior do |beh|
@@ -237,6 +252,53 @@ module HDLRuby::High
237
252
  end
238
253
  end
239
254
 
255
+ ##
256
+ # Enhance the signals class with VCD support.
257
+ module SimSignal
258
+ ## Shows the hierarchy of the variables.
259
+ def show_hierarchy(vcdout)
260
+ # puts "show_hierarcy for signal=#{self.name}"
261
+ if self.each_signal.any? then
262
+ # The signal is hierarchical, recurse on the sub signals.
263
+ vcdout << "$scope module #{HDLRuby::High.vcd_name(self.name)} $end\n"
264
+ self.each_signal { |sig| sig.show_hierarchy(vcdout) }
265
+ vcdout << "$upscope $end\n"
266
+ else
267
+ # This is a signal to show.
268
+ vcdout << "$var wire #{self.type.width} "
269
+ vcdout << "#{HDLRuby::High.vcd_idstr(self)} "
270
+ vcdout << "#{HDLRuby::High.vcd_name(self.name)} $end\n"
271
+ end
272
+ end
273
+
274
+ ## Gets the VCD variables with their long name.
275
+ def get_vars_with_fullname(vars_with_fullname = {})
276
+ if self.each_signal.any? then
277
+ # There are sub signals, recurse on them.
278
+ self.each_signal do |sig|
279
+ sig.get_vars_with_fullname(vars_with_fullname)
280
+ end
281
+ else
282
+ # No add the current signal.
283
+ vars_with_fullname[self] = HDLRuby::High.vcd_name(self.fullname)
284
+ end
285
+ return vars_with_full_name
286
+ end
287
+
288
+ ## Gets the VCD variables with their id string.
289
+ def get_vars_with_idstr(vars_with_idstr = {})
290
+ if self.each_signal.any? then
291
+ # There are sub signals, recurse on them.
292
+ self.each_signal do |sig|
293
+ sig.get_vars_with_idstr(vars_with_idstr)
294
+ end
295
+ else
296
+ # No add the current signal.
297
+ vars_with_idstr[self] = HDLRuby::High.vcd_idstr(self)
298
+ end
299
+ return vars_with_idstr
300
+ end
301
+ end
240
302
 
241
303
  ##
242
304
  # Enhance the Transmit class with VCD support.
@@ -329,11 +391,12 @@ module HDLRuby::High
329
391
  end
330
392
  # Shows the inner signals.
331
393
  self.each_inner do |sig|
332
- # puts "showing inner signal #{HDLRuby::High.vcd_name(sig.fullname)}"
333
- vcdout << "$var wire #{sig.type.width} "
334
- # vcdout << "#{HDLRuby::High.vcd_name(sig.fullname)} "
335
- vcdout << "#{HDLRuby::High.vcd_idstr(sig)} "
336
- vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n"
394
+ sig.show_hierarchy(vcdout)
395
+ # # puts "showing inner signal #{HDLRuby::High.vcd_name(sig.fullname)}"
396
+ # vcdout << "$var wire #{sig.type.width} "
397
+ # # vcdout << "#{HDLRuby::High.vcd_name(sig.fullname)} "
398
+ # vcdout << "#{HDLRuby::High.vcd_idstr(sig)} "
399
+ # vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n"
337
400
  end
338
401
  # Recurse on the statements
339
402
  self.each_statement do |stmnt|
@@ -347,9 +410,14 @@ module HDLRuby::High
347
410
 
348
411
  ## Gets the VCD variables with their long name.
349
412
  def get_vars_with_fullname(vars_with_fullname = {})
350
- # Adds the inner signals.
413
+ # # Adds the inner signals.
414
+ # self.each_inner do |sig|
415
+ # vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
416
+ # end
417
+ # Recurse on the inner signals.
351
418
  self.each_inner do |sig|
352
- vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
419
+ sig.get_vars_with_fullname(vars_with_fullname)
420
+ # vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname)
353
421
  end
354
422
  # Recurse on the statements.
355
423
  self.each_statement do |stmnt|
@@ -360,9 +428,13 @@ module HDLRuby::High
360
428
 
361
429
  ## Gets the VCD variables with their id string.
362
430
  def get_vars_with_idstr(vars_with_idstr = {})
363
- # Adds the inner signals.
431
+ # # Adds the inner signals.
432
+ # self.each_inner do |sig|
433
+ # vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig)
434
+ # end
435
+ # Recurse on the inner signals.
364
436
  self.each_inner do |sig|
365
- vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig)
437
+ sif.get_vars_with_idstr(vars_with_idstr)
366
438
  end
367
439
  # Recurse on the statements.
368
440
  self.each_statement do |stmnt|
@@ -13,6 +13,9 @@ module HDLRuby
13
13
 
14
14
  # Truncs integer +val+ to +width+
15
15
  def trunc(val,width)
16
+ if val.is_a?(BitString) then
17
+ return val[(width-1)..0]
18
+ end
16
19
  if val.bit_length > width then
17
20
  if val >= 0 then
18
21
  # return val & (2**width-1)
@@ -38,8 +41,9 @@ module HDLRuby
38
41
  unless val.to_value? then
39
42
  # Not computable, use the former method that generates
40
43
  # HDLRuby code.
41
- return self.send(orig_operator(op),value)
44
+ return self.send(orig_operator(op),val)
42
45
  end
46
+ val = val.to_value unless val.is_a?(Value)
43
47
  # Handle Numeric op BitString case.
44
48
  if self.content.is_a?(Numeric) && val.content.is_a?(BitString)
45
49
  if val.content.specified? then
@@ -80,27 +84,29 @@ module HDLRuby
80
84
  return self.send(orig_operator(op),val)
81
85
  end
82
86
  # Process left.
83
- # unless left.is_a?(Numeric) || left.is_a?(BitString) then
84
- # left = left.to_value.content
85
- # end
86
- left = left.content
87
- if left.is_a?(BitString) && !left.specified? then
88
- return self.class.new(self.type.base,
89
- BitString::UNKNOWN.clone)
87
+ if left.is_a?(Value) then
88
+ left = left.content
89
+ if left.is_a?(BitString) && !left.specified? then
90
+ return self.class.new(self.type.base,
91
+ BitString::UNKNOWN.clone)
92
+ end
93
+ # left = left.to_i
94
+ left = self.trunc(left.to_i,val.first.type.width)
95
+ else
96
+ left = left.to_i
90
97
  end
91
- # left = left.to_i
92
- left = self.trunc(left.to_i,val.first.type.width)
93
98
  # Process right.
94
- # unless right.is_a?(Numeric) || right.is_a?(BitString) then
95
- # right = right.to_value.content
96
- # end
97
- right = right.content
98
- if right.is_a?(BitString) && !right.specified? then
99
- return self.class.new(self.type.base,
100
- BitString::UNKNOWN.clone)
99
+ if right.is_a?(Value) then
100
+ right = right.content
101
+ if right.is_a?(BitString) && !right.specified? then
102
+ return self.class.new(self.type.base,
103
+ BitString::UNKNOWN.clone)
104
+ end
105
+ # right = right.to_i
106
+ right = self.trunc(right.to_i,val.last.type.width)
107
+ else
108
+ right = right.to_i
101
109
  end
102
- # right = right.to_i
103
- right = self.trunc(right.to_i,val.last.type.width)
104
110
  # Generate the resulting type.
105
111
  res_type = self.type.base[(left-right+1).abs]
106
112
  # Generate the resulting value.
@@ -124,18 +130,16 @@ module HDLRuby
124
130
  return self.send(orig_operator(op),val)
125
131
  end
126
132
  # Process val.
127
- index = val.content
128
- if index.is_a?(BitString) && !index.specified? then
129
- return self.class.new(self.type.base,
130
- BitString::UNKNOWN.clone)
133
+ if val.is_a?(Value) then
134
+ index = val.content
135
+ if index.is_a?(BitString) && !index.specified? then
136
+ return self.class.new(self.type.base,
137
+ BitString::UNKNOWN.clone)
138
+ end
139
+ index = self.trunc(index.to_i,val.type.width)
140
+ else
141
+ index = val.to_i
131
142
  end
132
- index = self.trunc(index.to_i,val.type.width)
133
- # index = index.to_i
134
- # if index >= self.type.size then
135
- # # puts "index=#{index}"
136
- # index %= self.type.size
137
- # # puts "now index=#{index}"
138
- # end
139
143
  # Generate the resulting type.
140
144
  res_type = self.type.base
141
145
  # Generate the resulting value.
@@ -308,7 +312,7 @@ module HDLRuby
308
312
  break if count == width
309
313
  end
310
314
  if count < width then
311
- res_content.concat(res_content[-1] * (width-count))
315
+ res_content.concat([res_content[-1]] * (width-count))
312
316
  end
313
317
  else
314
318
  width.times do |p|
@@ -0,0 +1,22 @@
1
+ module HDLRuby::High::Std
2
+
3
+ # Describe a RAM compatibile with BRAM of FPGAs.
4
+ # - 'widthA': address bit width
5
+ # - 'widthD': data bit width
6
+ system :bram do |widthA, widthD|
7
+ input :clk, :rwb
8
+ [widthA].input :addr
9
+ [widthD].input :din
10
+ [widthD].output :dout
11
+
12
+ # puts "widthA=#{widthA} widthD=#{widthD}"
13
+
14
+ bit[widthD][-2**widthA].inner mem: [ :"_b#{"0"*widthD}".to_value ] * 2**widthA
15
+
16
+ par(clk.negedge) do
17
+ hif(rwb == 1) { mem[addr] <= din }
18
+ dout <= mem[addr]
19
+ end
20
+ end
21
+
22
+ end
@@ -55,14 +55,14 @@ module HDLRuby::High::Std
55
55
  if (typ.signed?) then
56
56
  (left.as(signed[isize+fsize*2])*right) >> fsize
57
57
  else
58
- (left.as([isize+fsize*2])*right) >> fsize
58
+ (left.as(bit[isize+fsize*2])*right) >> fsize
59
59
  end
60
60
  end
61
61
  typ.define_operator(:/) do |left,right|
62
62
  if (typ.signed?) then
63
63
  (left.as(signed[isize+fsize*2]) << fsize) / right
64
64
  else
65
- (left.as([isize+fsize*2]) << fsize) / right
65
+ (left.as(bit[isize+fsize*2]) << fsize) / right
66
66
  end
67
67
  end
68
68
  # Define the removal of the point.
@@ -38,7 +38,8 @@ module HDLRuby::High::Std
38
38
  @name = name.to_sym
39
39
  # Check and set the type of fsm depending of the options.
40
40
  @dual = false
41
- @type = :sync
41
+ @type = :sync # By default, the FSM is synchronous.
42
+ @sequential = true # By default, the default next state is the next one in the list.
42
43
  options.each do |opt|
43
44
  case opt
44
45
  when :sync,:synchronous then
@@ -47,6 +48,8 @@ module HDLRuby::High::Std
47
48
  @type = :async
48
49
  when :dual then
49
50
  @dual = true
51
+ when :static then
52
+ @sequential = false
50
53
  else
51
54
  raise AnyError, "Invalid option for a fsm: :#{type}"
52
55
  end
@@ -112,6 +115,7 @@ module HDLRuby::High::Std
112
115
  mk_rst = @mk_rst
113
116
  type = @type
114
117
  dual = @dual
118
+ sequential = @sequential
115
119
  extra_syncs = @extra_syncs
116
120
  extra_asyncs = @extra_asyncs
117
121
  default_codes = @default_codes
@@ -238,8 +242,10 @@ module HDLRuby::High::Std
238
242
  else
239
243
  # No gotos, by default the next step is
240
244
  # current + 1
241
- # this.next_state_sig <= mux(mk_rst.call , 0, this.cur_state_sig + 1)
242
- this.next_state_sig <= this.cur_state_sig + 1
245
+ # this.next_state_sig <= this.cur_state_sig + 1
246
+ if sequential then
247
+ this.next_state_sig <= this.cur_state_sig + 1
248
+ end
243
249
  end
244
250
  end
245
251
  end
@@ -406,6 +412,17 @@ module HDLRuby::High::Std
406
412
  return result
407
413
  end
408
414
 
415
+ # Get a state by +name+.
416
+ def get_state(name)
417
+ name = name.to_sym
418
+ (@states.detect { |st| st.name == name }).value
419
+ end
420
+
421
+ # Sets the next state by +name+.
422
+ def next_state(name)
423
+ @next_state_sig <= get_state(name)
424
+ end
425
+
409
426
  # Sets the next state. Arguments can be:
410
427
  #
411
428
  # +name+: the name of the next state.
@@ -75,7 +75,7 @@ module HDLRuby::High::Std
75
75
  base <= lut[address]
76
76
 
77
77
  # Assign the next_data discrete value.
78
- next_data <= lut[address+1]
78
+ next_data <= lut[address+_b1.as(address.type)]
79
79
  end
80
80
 
81
81
 
@@ -107,7 +107,7 @@ module HDLRuby::High::Std
107
107
  end
108
108
 
109
109
  # Make the interpolation.
110
- par do
110
+ seq do
111
111
  diff <= (next_data-base).as(diff.type) * remaining
112
112
  if(otyp.signed?) then
113
113
  interpolated_value <= base +
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.11.10"
2
+ VERSION = "2.11.12"
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.11.10
4
+ version: 2.11.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2023-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -158,13 +158,13 @@ files:
158
158
  - lib/HDLRuby/hdr_samples/seqpar_bench.rb
159
159
  - lib/HDLRuby/hdr_samples/simple_counter_bench.rb
160
160
  - lib/HDLRuby/hdr_samples/struct.rb
161
- - lib/HDLRuby/hdr_samples/sumprod.rb
162
161
  - lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb
163
162
  - lib/HDLRuby/hdr_samples/sw_encrypt_cpu_bench.rb
164
163
  - lib/HDLRuby/hdr_samples/sw_encrypt_cpusim_bench.rb
165
164
  - lib/HDLRuby/hdr_samples/system_open.rb
166
165
  - lib/HDLRuby/hdr_samples/tuple.rb
167
166
  - lib/HDLRuby/hdr_samples/type_minmax_bench.rb
167
+ - lib/HDLRuby/hdr_samples/with_bram.rb
168
168
  - lib/HDLRuby/hdr_samples/with_casts.rb
169
169
  - lib/HDLRuby/hdr_samples/with_channel.rb
170
170
  - lib/HDLRuby/hdr_samples/with_channel_other.rb
@@ -174,6 +174,7 @@ files:
174
174
  - lib/HDLRuby/hdr_samples/with_connector_memory.rb
175
175
  - lib/HDLRuby/hdr_samples/with_decoder.rb
176
176
  - lib/HDLRuby/hdr_samples/with_def.rb
177
+ - lib/HDLRuby/hdr_samples/with_define_operator.rb
177
178
  - lib/HDLRuby/hdr_samples/with_delay.rb
178
179
  - lib/HDLRuby/hdr_samples/with_fixpoint.rb
179
180
  - lib/HDLRuby/hdr_samples/with_fsm.rb
@@ -181,6 +182,7 @@ files:
181
182
  - lib/HDLRuby/hdr_samples/with_handshake.rb
182
183
  - lib/HDLRuby/hdr_samples/with_init.rb
183
184
  - lib/HDLRuby/hdr_samples/with_instance.rb
185
+ - lib/HDLRuby/hdr_samples/with_leftright.rb
184
186
  - lib/HDLRuby/hdr_samples/with_linear.rb
185
187
  - lib/HDLRuby/hdr_samples/with_loop.rb
186
188
  - lib/HDLRuby/hdr_samples/with_memory.rb
@@ -287,6 +289,7 @@ files:
287
289
  - lib/HDLRuby/hruby_low_without_outread.rb
288
290
  - lib/HDLRuby/hruby_low_without_parinseq.rb
289
291
  - lib/HDLRuby/hruby_low_without_select.rb
292
+ - lib/HDLRuby/hruby_low_without_subsignals.rb
290
293
  - lib/HDLRuby/hruby_rcsim.rb
291
294
  - lib/HDLRuby/hruby_rsim.rb
292
295
  - lib/HDLRuby/hruby_rsim_mute.rb
@@ -339,6 +342,7 @@ files:
339
342
  - lib/HDLRuby/low_samples/with_seq.yaml
340
343
  - lib/HDLRuby/low_samples/yaml2hdr.rb
341
344
  - lib/HDLRuby/low_samples/yaml2vhd.rb
345
+ - lib/HDLRuby/std/bram.rb
342
346
  - lib/HDLRuby/std/channel.rb
343
347
  - lib/HDLRuby/std/clocks.rb
344
348
  - lib/HDLRuby/std/connector.rb
@@ -1,29 +0,0 @@
1
- system :sumprod do |typ,coefs|
2
- typ[coefs.size].input :ins
3
- typ.output :o
4
-
5
- o <= coefs.each_with_index.reduce(_0) do |sum,(coef,i)|
6
- sum + ins[i]*coef
7
- end
8
- end
9
-
10
-
11
- typedef :sat do |width, max|
12
- signed[width]
13
- end
14
-
15
-
16
- sat.define_operator(:+) do |width,max, x,y|
17
- [width].inner :res
18
- seq do
19
- res <= x + y
20
- ( res <= max ).hif(res > max)
21
- end
22
- end
23
-
24
-
25
-
26
- system :sumprod_sat_16_1000, sumprod(sat(16,1000),
27
- [3,78,43,246, 3,67,1,8, 47,82,99,13, 5,77,2,4]) do
28
- end
29
-