HDLRuby 2.2.15 → 2.2.16

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: cac7290729b07ecdbbd73528b0807e601c8ba0f04e6d2476bbd075d5c4dbb648
4
- data.tar.gz: b2d244a59dcff8b363e6d1cdd66ff22cca81ffa24b666b97eb46b7b142047787
3
+ metadata.gz: f752aaab90bc0318eadca1d00745607d477bf742a568de5e0c17a64e399327f1
4
+ data.tar.gz: 0d3dc8821a51afa9cbae15a60611beb3b3b3671add3728a5843ad51f42013534
5
5
  SHA512:
6
- metadata.gz: '093bfbd1c000b0d7a4e039d51a8a27da09483ac1b61f0d19d78a3999d9231abe6df0611b720e4d47409b8c9769a31e7f3770f8bd6fa0246b8854ea15f56d1648'
7
- data.tar.gz: fb97205d4d7f542efb02e4951c696783c8d3f99b7f6def0f3a2cfbae27c7ff3d5e72459ba8aa899c6e93241d92302958177be0ee47472f329272f0c5fa2afd09
6
+ metadata.gz: 0116cacdf784719837ede586042b07903ad54540b797549e7731c0a35e7fb9be9ffad241d237c454d6d47dcf94346004a73913610e2dfecb1e3b58b4984ea75c
7
+ data.tar.gz: 233ff279a0c056998ae3b88017d08f2a69986919b4b148058c30e3da8573d96792e103b938a50654b96b75ce17a46ec1d45ec1069e27f56847538e095d4fb00b
@@ -102,6 +102,22 @@ system :linear_test do
102
102
  mac_n1([8],clk.posedge,ack[3],ack[4], mem_macn1_left_inPs,
103
103
  channel_port(5), mem_macn1_outPs)
104
104
 
105
+ # Circuit for testing the linearun with mac.
106
+ # Input memories
107
+ mem_dual([8],8,clk,rst, rinc: :rst, winc: :rst).(:mem_macrn_left_in)
108
+ mem_dual([8],8,clk,rst, rinc: :rst, winc: :rst).(:mem_macrn_right_in)
109
+ # Access ports.
110
+ mem_macrn_left_in.branch(:rinc).inner :mem_macrn_left_in_readP
111
+ mem_macrn_right_in.branch(:rinc).inner :mem_macrn_right_in_readP
112
+ # Output signal.
113
+ [8].inner :accr
114
+
115
+ # Build the linearun mac.
116
+ linearun(8,clk.posedge,ack[4],ack[5]) do |ev,req,ack|
117
+ mac([8],ev,req,ack,mem_macrn_left_in_readP,mem_macrn_right_in_readP,
118
+ channel_port(accr))
119
+ end
120
+
105
121
 
106
122
  # The memory initializer.
107
123
  # Writing ports
@@ -111,6 +127,8 @@ system :linear_test do
111
127
  mem_muln_left_in.branch(:winc).inner :mem_muln_left_in_writeP
112
128
  mem_muln_right_in.branch(:winc).inner :mem_muln_right_in_writeP
113
129
  mem_macn1_left_in.branch(:winc).inner :mem_macn1_left_in_writeP
130
+ mem_macrn_left_in.branch(:winc).inner :mem_macrn_left_in_writeP
131
+ mem_macrn_right_in.branch(:winc).inner :mem_macrn_right_in_writeP
114
132
  # Filling index
115
133
  [8].inner :idx
116
134
  # Filling counter
@@ -127,7 +145,7 @@ system :linear_test do
127
145
  helse do
128
146
  # Step index processing.
129
147
  hif(cnt == 7) do
130
- hif(idx < 6) { idx <= idx + 1 }
148
+ hif(idx < 8) { idx <= idx + 1 }
131
149
  end
132
150
  # Memory filling steps.
133
151
  hcase(idx)
@@ -161,6 +179,16 @@ system :linear_test do
161
179
  cnt <= cnt + 1; val <= val + 1
162
180
  end
163
181
  end
182
+ hwhen(6) do
183
+ mem_macrn_left_in_writeP.write(val-48) do
184
+ cnt <= cnt + 1; val <= val + 1
185
+ end
186
+ end
187
+ hwhen(7) do
188
+ mem_macrn_right_in_writeP.write(val-48) do
189
+ cnt <= cnt + 1; val <= val + 1
190
+ end
191
+ end
164
192
  # Computation steps.
165
193
  helse do
166
194
  hif(start) do
@@ -197,7 +225,7 @@ system :linear_test do
197
225
  start <= 1
198
226
  !10.ns
199
227
  # Run
200
- 64.times do
228
+ 128.times do
201
229
  clk <= 1
202
230
  !10.ns
203
231
  clk <= 0
@@ -1851,16 +1851,18 @@ module HDLRuby::High
1851
1851
  # NOTE: a function is a short-cut for a method that creates a scope.
1852
1852
  def function(name, &ruby_block)
1853
1853
  if HDLRuby::High.in_system? then
1854
- define_singleton_method(name.to_sym) do |*args|
1854
+ define_singleton_method(name.to_sym) do |*args,&other_block|
1855
1855
  sub do
1856
- HDLRuby::High.top_user.instance_exec(*args,&ruby_block)
1856
+ HDLRuby::High.top_user.instance_exec(*args,*other_block,
1857
+ &ruby_block)
1857
1858
  # ruby_block.call(*args)
1858
1859
  end
1859
1860
  end
1860
1861
  else
1861
- define_method(name.to_sym) do |*args|
1862
+ define_method(name.to_sym) do |*args,&other_block|
1862
1863
  sub do
1863
- HDLRuby::High.top_user.instance_exec(*args,&ruby_block)
1864
+ HDLRuby::High.top_user.instance_exec(*args,*other_block,
1865
+ &ruby_block)
1864
1866
  end
1865
1867
  end
1866
1868
  end
@@ -1961,6 +1961,7 @@ module HDLRuby::Low
1961
1961
  # Generates the C text for reference as left value to a signal.
1962
1962
  # +level+ is the hierarchical level of the object.
1963
1963
  def to_c_signal(level = 0)
1964
+ # puts "to_c_signal with self=#{self.name}, resolve=#{self.resolve}"
1964
1965
  return "#{self.resolve.to_c_signal(level+1)}"
1965
1966
  end
1966
1967
  end
@@ -39,6 +39,7 @@ module HDLRuby::Low
39
39
  ## Find an inner object by +name+.
40
40
  # NOTE: return nil if not found.
41
41
  def get_by_name(name)
42
+ # puts "getbyname for name=#{name} with self=#{self}"
42
43
  # Ensure the name is a symbol.
43
44
  name = name.to_sym
44
45
  # Look in the signals.
@@ -114,7 +115,6 @@ module HDLRuby::Low
114
115
 
115
116
  ## Tells if it is a reference to a systemI signal.
116
117
  def from_systemI?
117
- # puts "from_systemI? for #{self.name}"
118
118
  # Look for the owner from the name hierarchy.
119
119
  if self.ref.is_a?(RefName) then
120
120
  # Look in the parent hierachy for the sub reference name.
@@ -151,6 +151,7 @@ module HDLRuby::Low
151
151
  parent = self.parent
152
152
  # puts "parent=#{parent}"
153
153
  while parent
154
+ # puts "parent=#{parent}"
154
155
  if parent.respond_to?(:get_by_name) then
155
156
  found = parent.get_by_name(self.name)
156
157
  return found if found
@@ -8,6 +8,51 @@ module HDLRuby::High::Std
8
8
  #
9
9
  ########################################################################
10
10
 
11
+ # Controller of the linear operator.
12
+ # - +num+: the number of computation cycles.
13
+ # - +ev+: event to synchronize the controller on.
14
+ # - +req+: the request to start the linear computation.
15
+ # - +ack+: the ack signal that is set to 1 when the computation completes.
16
+ # - +ruby_block+: the code of the linear computation kernel, it takes
17
+ # as argument +ev+, and its own req and ack signals
18
+ # (resp. +req_ker+ +ack_ker+).
19
+ function :linearun do |num,ev,req,ack,ruby_block|
20
+ # Ensure ev is really an event.
21
+ ev = ev.posedge unless ev.is_a?(Event)
22
+
23
+ # Creates the kernel.
24
+ inner :req_ker, :ack_ker
25
+
26
+ HDLRuby::High.top_user.instance_exec(ev,req_ker,ack_ker,&ruby_block)
27
+
28
+ # The computation counter.
29
+ [num.width].inner :count
30
+ # Run flag
31
+ inner :run
32
+ par(ev) do
33
+ req_ker <= 0
34
+ ack <= 0
35
+ count <= 1
36
+ run <= 0
37
+ hif(req | run) do
38
+ run <= 1
39
+ req_ker <= 1
40
+ # Is one linear computation completed?
41
+ hif(ack_ker) do
42
+ # Yes.
43
+ count <= count + 1
44
+ end
45
+ # Is the full computation completed?
46
+ hif(count == num) do
47
+ # Yes.
48
+ ack <= 1
49
+ run <= 0
50
+ req_ker <= 0
51
+ end
52
+ end
53
+ end
54
+ end
55
+
11
56
 
12
57
  # Delcares a vector product by a scalar value.
13
58
  #
@@ -111,7 +156,7 @@ module HDLRuby::High::Std
111
156
  mul = proc { |x,y| x*y }, add = proc { |x,y| x+y }|
112
157
  # Ensure ev is really an event.
113
158
  ev = ev.posedge unless ev.is_a?(Event)
114
- # Left value and right value.
159
+ # Left value, right value and computation temp value.
115
160
  typ.inner :lv, :rv, :av
116
161
  # lv and rv are valid.
117
162
  inner :lvok, :rvok
@@ -125,18 +170,21 @@ module HDLRuby::High::Std
125
170
  # Computation request.
126
171
  left.read(lv) { lvok <= 1 }
127
172
  right.read(rv) { rvok <= 1 }
128
- # ( acc <= add.(acc,mul.(lv,rv)) ).hif(lvok & rvok)
129
- acc.read(av)
130
173
  hif(lvok & rvok) do
131
174
  ack <= 1
132
175
  run <= 0
133
- acc.write(add.(av,mul.(lv,rv)))
176
+ # acc.write(add.(av,mul.(lv,rv)))
177
+ seq do
178
+ av <= add.(av,mul.(lv,rv))
179
+ acc.write(av)
180
+ end
134
181
  end
135
182
  end
136
183
  helse do
137
184
  lvok <= 0
138
185
  rvok <= 0
139
- acc.write(0)
186
+ # acc.write(0)
187
+ av <= 0
140
188
  end
141
189
  end
142
190
  end
@@ -172,13 +220,15 @@ module HDLRuby::High::Std
172
220
  right.read(rv) { rvok <= 1 }
173
221
  lefts.each_with_index do |left,i|
174
222
  left.read(lvs[i]) { lvoks[i] <= 1 }
175
- # accs.read(i,avs[i])
176
- accs[i].read(avs[i])
223
+ # accs[i].read(avs[i])
177
224
  hif(lvoks[i] & rvok) do
178
225
  ack <= 1
179
226
  run <= 0
180
- # accs.write(i,add.(avs[i],mul.(lvs[i],rv)))
181
- accs[i].write(add.(avs[i],mul.(lvs[i],rv)))
227
+ # accs[i].write(add.(avs[i],mul.(lvs[i],rv)))
228
+ seq do
229
+ avs[i] <= add.(avs[i],mul.(lvs[i],rv))
230
+ accs[i].write(avs[i])
231
+ end
182
232
  end
183
233
  end
184
234
  end
@@ -186,12 +236,14 @@ module HDLRuby::High::Std
186
236
  rvok <= 0
187
237
  lefts.each_with_index do |left,i|
188
238
  lvoks[i] <= 0
189
- # accs.write(i,0)
190
- accs[i].write(0)
239
+ # accs[i].write(0)
240
+ avs[i] <= 0
191
241
  end
192
242
  end
193
243
  end
194
244
  end
195
245
 
196
246
 
247
+
248
+
197
249
  end
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.2.15"
2
+ VERSION = "2.2.16"
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.2.15
4
+ version: 2.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-29 00:00:00.000000000 Z
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler