HDLRuby 2.11.3 → 2.11.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -254,60 +254,62 @@ module HDLRuby::Low
254
254
 
255
255
 
256
256
 
257
- # Extract and convert to verilog the TimeRepeat statements.
258
- # NOTE: work only on the current level of the block (should be called
259
- # through each_block_deep).
260
- def repeat_to_verilog!
261
- code = ""
262
- # Gather the TimeRepeat statements.
263
- repeats = self.each_statement.find_all { |st| st.is_a?(TimeRepeat) }
264
- # Remove them from the block.
265
- repeats.each { |st| self.delete_statement!(st) }
266
- # Generate them separately in timed always processes.
267
- repeats.each do |st|
268
- code << " always #{st.delay.to_verilog} begin\n"
269
-
270
- # Perform "scheduling" using the method "flatten".
271
- block = st.statement.flatten(st.statement.mode.to_s)
272
-
273
- # Declaration of "inner" part within "always".
274
- block.each_inner do |inner|
275
- # if regs.include?(inner.name) then
276
- if HDLRuby::Low::VERILOG_REGS.include?(inner.to_verilog) then
277
- code << " reg"
278
- else
279
- code << " wire"
280
- end
281
-
282
- # Variable has "base", but if there is width etc, it is not in "base".
283
- # It is determined by an if.
284
- if inner.type.base?
285
- if inner.type.base.base?
286
- code << "#{inner.type.base.to_verilog} #{inner.to_verilog} #{inner.type.to_verilog}"
287
- else
288
- code << "#{inner.type.to_verilog} #{inner.to_verilog}"
289
- end
290
- else
291
- code << " #{inner.type.to_verilog}#{inner.to_verilog}"
292
- end
293
- if inner.value then
294
- # There is an initial value.
295
- code << " = #{inner.value.to_verilog}"
296
- end
297
- code << ";\n"
298
- end
299
-
300
- # Translate the block that finished scheduling.
301
- block.each_statement do |statement|
302
- code << "\n #{statement.to_verilog(block.mode.to_s)}"
303
- end
304
-
305
- FmI.fm_par.clear()
306
-
307
- code << "\n end\n\n"
308
- end
309
- return code
310
- end
257
+ # Deprecated with new TimeRepeat!
258
+ #
259
+ # # Extract and convert to verilog the TimeRepeat statements.
260
+ # # NOTE: work only on the current level of the block (should be called
261
+ # # through each_block_deep).
262
+ # def repeat_to_verilog!
263
+ # code = ""
264
+ # # Gather the TimeRepeat statements.
265
+ # repeats = self.each_statement.find_all { |st| st.is_a?(TimeRepeat) }
266
+ # # Remove them from the block.
267
+ # repeats.each { |st| self.delete_statement!(st) }
268
+ # # Generate them separately in timed always processes.
269
+ # repeats.each do |st|
270
+ # code << " always #{st.delay.to_verilog} begin\n"
271
+
272
+ # # Perform "scheduling" using the method "flatten".
273
+ # block = st.statement.flatten(st.statement.mode.to_s)
274
+
275
+ # # Declaration of "inner" part within "always".
276
+ # block.each_inner do |inner|
277
+ # # if regs.include?(inner.name) then
278
+ # if HDLRuby::Low::VERILOG_REGS.include?(inner.to_verilog) then
279
+ # code << " reg"
280
+ # else
281
+ # code << " wire"
282
+ # end
283
+
284
+ # # Variable has "base", but if there is width etc, it is not in "base".
285
+ # # It is determined by an if.
286
+ # if inner.type.base?
287
+ # if inner.type.base.base?
288
+ # code << "#{inner.type.base.to_verilog} #{inner.to_verilog} #{inner.type.to_verilog}"
289
+ # else
290
+ # code << "#{inner.type.to_verilog} #{inner.to_verilog}"
291
+ # end
292
+ # else
293
+ # code << " #{inner.type.to_verilog}#{inner.to_verilog}"
294
+ # end
295
+ # if inner.value then
296
+ # # There is an initial value.
297
+ # code << " = #{inner.value.to_verilog}"
298
+ # end
299
+ # code << ";\n"
300
+ # end
301
+
302
+ # # Translate the block that finished scheduling.
303
+ # block.each_statement do |statement|
304
+ # code << "\n #{statement.to_verilog(block.mode.to_s)}"
305
+ # end
306
+
307
+ # FmI.fm_par.clear()
308
+
309
+ # code << "\n end\n\n"
310
+ # end
311
+ # return code
312
+ # end
311
313
 
312
314
 
313
315
  # Process top layer of Block.
@@ -1814,6 +1816,15 @@ module HDLRuby::Low
1814
1816
  end
1815
1817
  end
1816
1818
 
1819
+
1820
+ # Generate verilog code for the TimeRepeat.
1821
+ class TimeRepeat
1822
+ def to_verilog(spc = 3)
1823
+ result = (" " * spc) + "repeat(#{self.number})" + "\n"
1824
+ result << self.statement.to_verilog(spc+3)
1825
+ end
1826
+ end
1827
+
1817
1828
  # Those who disappeared.
1818
1829
  #class SystemI
1819
1830
  #class TypeTuple
@@ -2137,10 +2148,12 @@ module HDLRuby::Low
2137
2148
  if behavior.block.is_a?(TimeBlock) then
2138
2149
  # Tell it is a time behavior for further processing.
2139
2150
  timebeh = true
2140
- # Extract and translate the TimeRepeat separately.
2141
- behavior.each_block_deep do |blk|
2142
- codeC << blk.repeat_to_verilog!
2143
- end
2151
+ # Deprecated with new TimeRepeat.
2152
+ #
2153
+ # # Extract and translate the TimeRepeat separately.
2154
+ # behavior.each_block_deep do |blk|
2155
+ # codeC << blk.repeat_to_verilog!
2156
+ # end
2144
2157
  # And generate an initial block.
2145
2158
  codeC << " initial "
2146
2159
  else
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.11.3"
2
+ VERSION = "2.11.5"
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.3
4
+ version: 2.11.5
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-10-10 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,6 +148,7 @@ files:
148
148
  - lib/HDLRuby/hdr_samples/ram.rb
149
149
  - lib/HDLRuby/hdr_samples/range_bench.rb
150
150
  - lib/HDLRuby/hdr_samples/register_with_code_bench.rb
151
+ - lib/HDLRuby/hdr_samples/repeat_bench.rb
151
152
  - lib/HDLRuby/hdr_samples/rom.rb
152
153
  - lib/HDLRuby/hdr_samples/rom_nest.rb
153
154
  - lib/HDLRuby/hdr_samples/ruby_fir_hw.rb