HDLRuby 2.1.6 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a13c2fd9d9add1fb436eeca3bd6ce2e58975ab2de842573fe6a260a74e6a901
4
- data.tar.gz: 04f16871ee7993c16b2419a691308a7ad235b487406ca9243085bcdcff1db8aa
3
+ metadata.gz: e8f74ac40d2f3ddc8ec9eb5a17c8d48b091068288a4bdb37adad8008c9b29e78
4
+ data.tar.gz: '084b85f61816a823c92b736e1d203274f3e1beb2b2278f240bee36218665afe7'
5
5
  SHA512:
6
- metadata.gz: ff99ac90a5f6bcc09896189f9e77f01e5394446efa8a6687f07d710528973ddf4d5397d5163889c9dc18425805f4a61adc30b56d686a9e6187c7b15a423990b4
7
- data.tar.gz: 5cfaa77758b3b15154ebf139fb7bd9f424e41d72c7bd642895dfb6b3929b04f889dba320f4141b55ef554996e28cbd8d5072d7ac7242a395a993cff77d3c2835
6
+ metadata.gz: ef3418dda3d976fe68beb65a305c6163da94cdecf398ddd9bbc06786abc3c130b8df6ecd3a94064ecc0ffc64105a63838c455bd0709c3f64c83f2e40d7406a2b
7
+ data.tar.gz: 8c9284a2c34be1f2e39b55cac6419ea858dd4972f9715bf2e39317bdcc4d7fcdcffae4d5c76ff3bbfabd77acd1a295a2cbba651568c569e144900e47814fc072
@@ -119,6 +119,17 @@ module HDLRuby::Low
119
119
  end
120
120
 
121
121
 
122
+ ## Extends the TimeWait class with functionality for converting booleans
123
+ # in assignments to select operators.
124
+ class TimeWait
125
+ # Converts booleans in assignments to select operators.
126
+ def boolean_in_assign2select!
127
+ # Nothing to do.
128
+ return self
129
+ end
130
+ end
131
+
132
+
122
133
  ## Extends the Block class with functionality for converting booleans
123
134
  # in assignments to select operators.
124
135
  class Block
@@ -247,6 +247,21 @@ module HDLRuby::Low
247
247
 
248
248
  end
249
249
 
250
+
251
+ ## Extends the TimeBlock class with separation between signals and variables.
252
+ class TimeBlock
253
+ # Converts to a variable-compatible block where +upper+ is
254
+ # the upper block if any.
255
+ #
256
+ # NOTE: the result is a new block.
257
+ def with_var(upper = nil)
258
+ # For the specific case of block, the conversion is not
259
+ # done.
260
+ return self
261
+ end
262
+ end
263
+
264
+
250
265
  ## Extends the If class with separation between signals and variables.
251
266
  class If
252
267
  # Converts to a variable-compatible if where +upper+ is
@@ -96,6 +96,19 @@ module HDLRuby::Low
96
96
  end
97
97
  end
98
98
 
99
+
100
+ ## Extends the TimeWait class with functionality for converting booleans
101
+ # in assignments to select operators.
102
+ class TimeWait
103
+ # Extract the Select expressions.
104
+ def extract_selects!
105
+ # Nothing to extract.
106
+ return []
107
+ end
108
+ end
109
+
110
+
111
+
99
112
  ## Extends the Block class with functionality for converting select
100
113
  # expressions to case statements.
101
114
  class Block
@@ -116,7 +116,11 @@ class Block
116
116
  # Process top layer of Block.
117
117
  # Determine whether there is a block under block and convert it.
118
118
  def flatten(mode = nil)
119
- new_block = Block.new(self.mode,"") # A new block to store the converted statement.
119
+ if self.is_a?(TimeBlock) then
120
+ new_block = TimeBlock.new(self.mode,"")
121
+ else
122
+ new_block = Block.new(self.mode,"") # A new block to store the converted statement.
123
+ end
120
124
  list = [] # A list for confirming that variable declarations do not overlap.
121
125
 
122
126
  # Is block in the statement?
@@ -1884,29 +1888,33 @@ class SystemT
1884
1888
 
1885
1889
  # Translation of behavior part (always).
1886
1890
  self.each_behavior do |behavior|
1887
- code << " always @( "
1888
- # If there is no "always" condition, it is always @("*").
1889
- if behavior.each_event.to_a.empty? then
1890
- code << "*"
1891
+ if behavior.block.is_a?(TimeBlock) then
1892
+ code << " initial begin\n"
1891
1893
  else
1892
- event = behavior.each_event.to_a
1893
- event[0..-2].each do |event|
1894
- # If "posedge" or "negedge" does not exist, the variable is set to condition.
1895
- if (event.type.to_s != "posedge" && event.type.to_s != "negedge") then
1896
- code << "#{event.ref.to_verilog}, "
1894
+ code << " always @( "
1895
+ # If there is no "always" condition, it is always @("*").
1896
+ if behavior.each_event.to_a.empty? then
1897
+ code << "*"
1898
+ else
1899
+ event = behavior.each_event.to_a
1900
+ event[0..-2].each do |event|
1901
+ # If "posedge" or "negedge" does not exist, the variable is set to condition.
1902
+ if (event.type.to_s != "posedge" && event.type.to_s != "negedge") then
1903
+ code << "#{event.ref.to_verilog}, "
1904
+ else
1905
+ # Otherwise, it outputs "psoedge" or "negedge" as a condition.
1906
+ code << "#{event.type.to_s} #{event.ref.to_verilog}, "
1907
+ end
1908
+ end
1909
+ # Since no comma is necessary at the end, we try not to separate commas separately at the end.
1910
+ if (event.last.type.to_s != "posedge" && event.last.type.to_s != "negedge") then
1911
+ code << "#{event.last.ref.to_verilog}"
1897
1912
  else
1898
- # Otherwise, it outputs "psoedge" or "negedge" as a condition.
1899
- code << "#{event.type.to_s} #{event.ref.to_verilog}, "
1913
+ code << "#{event.last.type.to_s} #{event.last.ref.to_verilog}"
1900
1914
  end
1901
1915
  end
1902
- # Since no comma is necessary at the end, we try not to separate commas separately at the end.
1903
- if (event.last.type.to_s != "posedge" && event.last.type.to_s != "negedge") then
1904
- code << "#{event.last.ref.to_verilog}"
1905
- else
1906
- code << "#{event.last.type.to_s} #{event.last.ref.to_verilog}"
1907
- end
1916
+ code << " ) begin\n"
1908
1917
  end
1909
- code << " ) begin\n"
1910
1918
 
1911
1919
  # Perform "scheduling" using the method "flatten".
1912
1920
  block = behavior.block.flatten(behavior.block.mode.to_s)
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.1.6"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier