HDLRuby 3.1.0 → 3.3.0

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/HDLRuby.gemspec +1 -0
  3. data/README.html +2330 -2670
  4. data/README.md +400 -100
  5. data/ext/hruby_sim/hruby_rcsim_build.c +402 -3
  6. data/ext/hruby_sim/hruby_sim.h +2 -1
  7. data/ext/hruby_sim/hruby_sim_calc.c +34 -7
  8. data/ext/hruby_sim/hruby_sim_core.c +15 -5
  9. data/ext/hruby_sim/hruby_sim_tree_calc.c +112 -23
  10. data/lib/HDLRuby/hdr_samples/c_program/echo.c +33 -0
  11. data/lib/HDLRuby/hdr_samples/comparison_bench.rb +2 -2
  12. data/lib/HDLRuby/hdr_samples/counter_bench.rb +1 -1
  13. data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +8 -7
  14. data/lib/HDLRuby/hdr_samples/dff_properties.rb +2 -0
  15. data/lib/HDLRuby/hdr_samples/enum_as_param.rb +52 -0
  16. data/lib/HDLRuby/hdr_samples/linear_test.rb +2 -0
  17. data/lib/HDLRuby/hdr_samples/logic_bench.rb +6 -0
  18. data/lib/HDLRuby/hdr_samples/mei8.rb +6 -6
  19. data/lib/HDLRuby/hdr_samples/mei8_bench.rb +6 -6
  20. data/lib/HDLRuby/hdr_samples/memory_test.rb +2 -0
  21. data/lib/HDLRuby/hdr_samples/named_sub.rb +9 -5
  22. data/lib/HDLRuby/hdr_samples/ram.rb +7 -6
  23. data/lib/HDLRuby/hdr_samples/ruby_fir_hw.rb +2 -0
  24. data/lib/HDLRuby/hdr_samples/ruby_program/echo.rb +9 -0
  25. data/lib/HDLRuby/hdr_samples/ruby_program/stdrw.rb +6 -0
  26. data/lib/HDLRuby/hdr_samples/ruby_program/sw_cpu_terminal.rb +614 -0
  27. data/lib/HDLRuby/hdr_samples/ruby_program/sw_inc_mem.rb +32 -0
  28. data/lib/HDLRuby/hdr_samples/ruby_program/sw_log.rb +33 -0
  29. data/lib/HDLRuby/hdr_samples/struct.rb +15 -3
  30. data/lib/HDLRuby/hdr_samples/with_board.rb +63 -0
  31. data/lib/HDLRuby/hdr_samples/with_bram.rb +1 -1
  32. data/lib/HDLRuby/hdr_samples/with_bram_frame_stack.rb +1 -1
  33. data/lib/HDLRuby/hdr_samples/with_bram_stack.rb +1 -1
  34. data/lib/HDLRuby/hdr_samples/with_channel.rb +2 -0
  35. data/lib/HDLRuby/hdr_samples/with_channel_other.rb +2 -0
  36. data/lib/HDLRuby/hdr_samples/with_class.rb +3 -1
  37. data/lib/HDLRuby/hdr_samples/with_clocks.rb +42 -0
  38. data/lib/HDLRuby/hdr_samples/with_connector.rb +2 -0
  39. data/lib/HDLRuby/hdr_samples/with_connector_memory.rb +2 -0
  40. data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +6 -0
  41. data/lib/HDLRuby/hdr_samples/with_fixpoint_adv.rb +73 -0
  42. data/lib/HDLRuby/hdr_samples/with_leftright.rb +1 -1
  43. data/lib/HDLRuby/hdr_samples/with_of.rb +1 -1
  44. data/lib/HDLRuby/hdr_samples/with_program_c.rb +28 -0
  45. data/lib/HDLRuby/hdr_samples/with_program_ruby.rb +28 -0
  46. data/lib/HDLRuby/hdr_samples/with_program_ruby_cpu.rb +234 -0
  47. data/lib/HDLRuby/hdr_samples/with_program_ruby_io.rb +23 -0
  48. data/lib/HDLRuby/hdr_samples/with_program_ruby_mem.rb +58 -0
  49. data/lib/HDLRuby/hdr_samples/with_program_ruby_threads.rb +56 -0
  50. data/lib/HDLRuby/hdr_samples/with_sequencer.rb +17 -0
  51. data/lib/HDLRuby/hdr_samples/with_sequencer_channel.rb +58 -0
  52. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +10 -0
  53. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +18 -4
  54. data/lib/HDLRuby/hdr_samples/with_sequencer_func.rb +2 -4
  55. data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +2 -1
  56. data/lib/HDLRuby/hdrcc.rb +72 -21
  57. data/lib/HDLRuby/hruby_error.rb +13 -0
  58. data/lib/HDLRuby/hruby_high.rb +125 -26
  59. data/lib/HDLRuby/hruby_low.rb +171 -3
  60. data/lib/HDLRuby/hruby_low2programs.rb +47 -0
  61. data/lib/HDLRuby/hruby_low_resolve.rb +3 -2
  62. data/lib/HDLRuby/hruby_low_without_namespace.rb +133 -5
  63. data/lib/HDLRuby/hruby_low_without_subsignals.rb +1 -1
  64. data/lib/HDLRuby/hruby_rcsim.rb +113 -6
  65. data/lib/HDLRuby/hruby_serializer.rb +2 -1
  66. data/lib/HDLRuby/hruby_verilog.rb +94 -20
  67. data/lib/HDLRuby/hruby_verilog_name.rb +3 -17
  68. data/lib/HDLRuby/std/clocks.rb +118 -50
  69. data/lib/HDLRuby/std/fixpoint.rb +2 -2
  70. data/lib/HDLRuby/std/function_generator.rb +1 -1
  71. data/lib/HDLRuby/std/linear.rb +7 -7
  72. data/lib/HDLRuby/std/sequencer.rb +263 -13
  73. data/lib/HDLRuby/std/sequencer_channel.rb +90 -0
  74. data/lib/HDLRuby/std/sequencer_func.rb +28 -15
  75. data/lib/HDLRuby/std/std.rb +6 -0
  76. data/lib/HDLRuby/ui/hruby_board.rb +1079 -0
  77. data/lib/HDLRuby/version.rb +1 -1
  78. data/lib/c/Rakefile +8 -0
  79. data/lib/c/cHDL.h +12 -0
  80. data/lib/c/extconf.rb +7 -0
  81. data/lib/rubyHDL.rb +33 -0
  82. data/tuto/gui_accum.png +0 -0
  83. data/tuto/gui_board.png +0 -0
  84. data/tuto/tutorial_sw.html +2263 -1890
  85. data/tuto/tutorial_sw.md +957 -62
  86. metadata +43 -5
  87. data/README.pdf +0 -0
  88. data/tuto/tutorial_sw.pdf +0 -0
@@ -121,6 +121,9 @@ Value calc_expression(Expression expr, Value res) {
121
121
  free_value();
122
122
  /* Performs the access. */
123
123
  res = read_range(value,index,index,rexpr->type,res);
124
+ /* Set the type to the one of the reference since it is
125
+ * an index access and not a range one. */
126
+ res->type = rexpr->type;
124
127
  free_value();
125
128
  break;
126
129
  }
@@ -174,6 +177,82 @@ Value calc_expression(Expression expr, Value res) {
174
177
  }
175
178
 
176
179
 
180
+ /** Calculates a range access from a reference.
181
+ * Recurse over the multiple references.
182
+ * @param ref the reference to work on.
183
+ * @param first the first index of the access.
184
+ * @param last the last index of the access.
185
+ * @param sig the target signal. */
186
+ void calc_ref_rangeS(Reference ref, long long* first, long long *last,
187
+ SignalI* sig) {
188
+ // printf("calc_ref_rangeS with kind=%d\n",ref->kind);
189
+ if (ref->kind == CAST) {
190
+ /* Create a new reference for the computation that changes the type. */
191
+ Cast refc = (Cast)ref;
192
+ /* Compute the range for the child. */
193
+ long long cfirst, clast;
194
+ calc_ref_rangeS(refc->child,&cfirst,&clast,sig);
195
+ /* Update first and last using the cast. */
196
+ /* Both first and last should be equal since the type of the cast sets
197
+ * the width */
198
+ // printf("cfirst=%d clast=%d\n",cfirst,clast);
199
+ *first = *last = cfirst;
200
+ }
201
+ else if (ref->kind == REF_INDEX) {
202
+ RefIndex refi = (RefIndex)ref;
203
+ /* Compute the index of refi. */
204
+ Value indexV = get_value();
205
+ indexV = calc_expression(refi->index,indexV);
206
+ long long index = value2integer(indexV);
207
+ // printf("index=%d\n",index);
208
+ free_value();
209
+ /* Is the reference a signal? */
210
+ if (refi->ref->kind == SIGNALI) {
211
+ /* Yes, end here. */
212
+ *first = index;
213
+ *last = index;
214
+ *sig = (SignalI)(refi->ref);
215
+ } else {
216
+ /* No, need to recurse. */
217
+ long long pfirst, plast;
218
+ calc_ref_rangeS(refi->ref,&pfirst,&plast,sig);
219
+ // printf("pfirst=%d plast=%d\n",pfirst,plast);
220
+ /* Calculate the final first and last. */
221
+ *first = *last = pfirst + index;
222
+ }
223
+ } else if (ref->kind == REF_RANGE) {
224
+ RefRangeE refr = (RefRangeE)ref;
225
+ /* Compute the range of refr */
226
+ Value firstV = get_value();
227
+ firstV = calc_expression(refr->first,firstV);
228
+ long long firstR = value2integer(firstV);
229
+ free_value();
230
+ Value lastV = get_value();
231
+ lastV = calc_expression(refr->last,lastV);
232
+ long long lastR = value2integer(lastV);
233
+ free_value();
234
+ // printf("firstR=%d lastR=%d\n",firstR,lastR);
235
+ /* Is the reference a signal? */
236
+ if (refr->ref->kind == SIGNALI) {
237
+ /* Yes, end here. */
238
+ *first = firstR;
239
+ *last = lastR;
240
+ *sig = (SignalI)(refr->ref);
241
+ } else {
242
+ /* No, need to recurse. */
243
+ long long pfirst, plast;
244
+ calc_ref_rangeS(refr->ref,&pfirst,&plast,sig);
245
+ /* Calculate the final first and last. */
246
+ *first = pfirst + firstR;
247
+ *last = plast + lastR;
248
+ }
249
+ } else {
250
+ perror("Invalid reference for converting to range access.");
251
+ exit(1);
252
+ }
253
+ }
254
+
255
+
177
256
 
178
257
  /** Executes a statement.
179
258
  * @param stmnt the statement to execute.
@@ -205,15 +284,22 @@ void execute_statement(Statement stmnt, int mode, Behavior behavior) {
205
284
  {
206
285
  /* Transmission to sub element. */
207
286
  RefIndex refi = (RefIndex)(trans->left);
208
- /* Compute the index. */
209
- Value indexV = get_value();
210
- indexV = calc_expression(refi->index,indexV);
211
- long long index = value2integer(indexV);
212
- free_value();
213
- /* Generate the reference inside the left value. */
287
+ // /* Compute the index. */
288
+ // Value indexV = get_value();
289
+ // indexV = calc_expression(refi->index,indexV);
290
+ // long long index = value2integer(indexV);
291
+ // free_value();
292
+ // /* Generate the reference inside the left value. */
293
+ // RefRangeS ref =
294
+ // make_ref_rangeS((SignalI)(refi->ref),refi->type,
295
+ // index,index);
296
+ /* Compute the range. */
297
+ long long first,last;
298
+ SignalI sig;
299
+ calc_ref_rangeS((Reference)refi,&first,&last,&sig);
300
+ /* Now can create the range. */
214
301
  RefRangeS ref =
215
- make_ref_rangeS((SignalI)(refi->ref),refi->type,
216
- index,index);
302
+ make_ref_rangeS(sig,refi->type,first,last);
217
303
  /* Perform the transmit. */
218
304
  if(mode)
219
305
  transmit_to_signal_range_seq(right,ref);
@@ -226,21 +312,24 @@ void execute_statement(Statement stmnt, int mode, Behavior behavior) {
226
312
  /* Transmission to range of sub elements. */
227
313
  RefRangeE refr = (RefRangeE)(trans->left);
228
314
  /* Compute the range. */
229
- // Value firstV = calc_expression(refr->first);
230
- Value firstV = get_value();
231
- firstV = calc_expression(refr->first,firstV);
232
- long long first = value2integer(firstV);
233
- free_value();
234
- // Value lastV = calc_expression(refr->last);
235
- Value lastV = get_value();
236
- lastV = calc_expression(refr->last,lastV);
237
- long long last = value2integer(lastV);
238
- free_value();
239
- // printf("firstV=%lld lastV=%lld right=%lld mode=%d\n",firstV->data_int,lastV->data_int,right->data_int,mode);
240
- /* Generate the reference inside the left value. */
315
+ // Value firstV = get_value();
316
+ // firstV = calc_expression(refr->first,firstV);
317
+ // long long first = value2integer(firstV);
318
+ // free_value();
319
+ // Value lastV = get_value();
320
+ // lastV = calc_expression(refr->last,lastV);
321
+ // long long last = value2integer(lastV);
322
+ // free_value();
323
+ // /* Generate the reference inside the left value. */
324
+ // RefRangeS ref =
325
+ // make_ref_rangeS((SignalI)(refr->ref),refr->type,
326
+ // first,last);
327
+ long long first,last;
328
+ SignalI sig;
329
+ calc_ref_rangeS((Reference)refr,&first,&last,&sig);
330
+ /* Now can create the range. */
241
331
  RefRangeS ref =
242
- make_ref_rangeS((SignalI)(refr->ref),refr->type,
243
- first,last);
332
+ make_ref_rangeS(sig,refr->type,first,last);
244
333
  /* Perform the transmit. */
245
334
  if(mode)
246
335
  transmit_to_signal_range_seq(right,ref);
@@ -416,7 +505,7 @@ void execute_statement(Statement stmnt, int mode, Behavior behavior) {
416
505
  }
417
506
 
418
507
  default:
419
- perror("Invalid kind for an expression.");
508
+ perror("Invalid kind for a statement.");
420
509
  }
421
510
  }
422
511
 
@@ -0,0 +1,33 @@
1
+ #include <stdio.h>
2
+ #include "cHDL.h"
3
+
4
+ #if defined(_WIN32) || defined(_WIN64)
5
+ __declspec(dllexport)
6
+ #endif
7
+ void echo(void* code) {
8
+ static void* inP = NULL;
9
+ static void* outP = NULL;
10
+ unsigned long long data;
11
+
12
+ /* Is the input port obtained? */
13
+ if (inP == NULL) {
14
+ /* No, get it. */
15
+ inP = c_get_port("inP");
16
+ }
17
+
18
+ /* Is the input port obtained? */
19
+ if (outP == NULL) {
20
+ /* No, get it. */
21
+ outP = c_get_port("outP");
22
+ }
23
+
24
+ /* Get data from the input port. */
25
+ data = c_read_port(inP);
26
+
27
+ /* Display it. */
28
+ printf("Echoing: %llu\n", data);
29
+
30
+ /* Echoing the data. */
31
+ c_write_port(outP,data);
32
+
33
+ }
@@ -1,7 +1,7 @@
1
1
  # Test the comparison operators.
2
2
 
3
- # A benchmark for the adder.
4
- system :adder_bench do
3
+ # A benchmark for the comparators.
4
+ system :comparison_bench do
5
5
  [8].inner :x, :y
6
6
  signed[8].inner :u,:v
7
7
  inner :ue, :ult, :ule, :ugt, :uge
@@ -19,8 +19,8 @@ system :counter do
19
19
  par do
20
20
  hif(rst) { [cc,qq] <= 0 }
21
21
  helse do
22
- add.(q,1,[cc,qq])
23
22
  hif(ctrl == 1) { add.(q,-1,[cc,qq]) }
23
+ helse { add.(q,1,[cc,qq]) }
24
24
  end
25
25
  end
26
26
 
@@ -1,34 +1,35 @@
1
1
  # A simple D-FF
2
2
  system :dff do
3
- input :clk, :d
3
+ input :clk, :rst, :d
4
4
  output :q
5
5
 
6
- (q <= d).at(clk.posedge)
6
+ (q <= d & ~rst).at(clk.posedge)
7
7
  end
8
8
 
9
9
  # A benchmark for the dff.
10
10
  system :dff_bench do
11
- inner :clk
11
+ inner :clk, :rst
12
12
  inner :d0, :q0, :d1, :q1
13
13
 
14
- dff(:my_dff0).(clk,d0,q0)
15
- dff(:my_dff1).(d0,d1,q1)
14
+ dff(:my_dff0).(clk,rst,d0,q0)
15
+ dff(:my_dff1).(d0,rst,d1,q1)
16
16
 
17
17
  d0 <= ~q0
18
18
  d1 <= ~q1
19
19
 
20
20
  timed do
21
- d0 <= 0
22
- d1 <= 0
23
21
  clk <= 0
22
+ rst <= 0
24
23
  !10.ns
25
24
  clk <= 1
26
25
  !10.ns
27
26
  clk <= 0
27
+ rst <= 1
28
28
  !10.ns
29
29
  clk <= 1
30
30
  !10.ns
31
31
  clk <= 0
32
+ rst <= 0
32
33
  !10.ns
33
34
  clk <= 1
34
35
  !10.ns
@@ -1,3 +1,5 @@
1
+ raise "Properties are deprecated in HDLRuby."
2
+
1
3
  # A simple D-FF
2
4
  system :dff do
3
5
  input :clk, :rst, :d
@@ -0,0 +1,52 @@
1
+ # Check if an enum can be passed as generic parameter.
2
+
3
+
4
+ system :machin do |vals|
5
+ input :clk,:rst
6
+ [8].output :res
7
+ sequencer(clk,rst) do
8
+ vals.seach { |val| res <= val }
9
+ end
10
+ end
11
+
12
+ system :truc do |sig|
13
+ [8].output :res
14
+
15
+ res <= sig
16
+ end
17
+
18
+ system :machin_bench do
19
+ inner :clk,:rst
20
+
21
+ bit[8][-4].inner vals: [ _h01,_h02,_h03,_h05 ]
22
+ [8].inner :res0
23
+
24
+ machin(vals).(:my_machin).(clk,rst,res0)
25
+
26
+ [8].inner :val, :res1
27
+ truc(val).(:my_truc).(res1)
28
+
29
+ timed do
30
+ val <= 10
31
+ clk <= 0
32
+ rst <= 0
33
+ !10.ns
34
+ clk <= 1
35
+ rst <= 0
36
+ !10.ns
37
+ clk <= 0
38
+ rst <= 1
39
+ !10.ns
40
+ clk <= 1
41
+ !10.ns
42
+ clk <= 0
43
+ rst <= 0
44
+ !10.ns
45
+ repeat(15) do
46
+ clk <= 1
47
+ !10.ns
48
+ clk <= 0
49
+ !10.ns
50
+ end
51
+ end
52
+ end
@@ -1,6 +1,8 @@
1
1
  require 'std/memory.rb'
2
2
  require 'std/linear.rb'
3
3
 
4
+ raise "std/memory.rb is deprecated."
5
+
4
6
  include HDLRuby::High::Std
5
7
 
6
8
  # Tries for matrix-vector product.
@@ -3,6 +3,8 @@
3
3
  system :logic_bench do
4
4
  [3].inner :x,:y
5
5
  [3].inner :s_not, :s_and, :s_or, :s_xor, :s_nxor
6
+
7
+ signed[16].inner :a,:b,:shl,:shr
6
8
 
7
9
  timed do
8
10
  8.times do |i|
@@ -15,6 +17,10 @@ system :logic_bench do
15
17
  s_xor <= x ^ y
16
18
  s_nxor <= (x == y)
17
19
  !10.ns
20
+ a <= i
21
+ b <= j
22
+ shl <= (a << b)
23
+ shr <= (a >> b)
18
24
  end
19
25
  end
20
26
  end
@@ -54,7 +54,7 @@ system :mei8 do |prog_file = "./prog.obj"|
54
54
  end
55
55
 
56
56
  # The control part for choosing between 0, add, sub and neg.
57
- par do
57
+ par(opr,x,y) do
58
58
  # Default computations
59
59
  cf <= 0; vf <= 0; zf <= (z == 0); sf <= z[7]
60
60
  add.(0,0,0)
@@ -148,14 +148,14 @@ system :mei8 do |prog_file = "./prog.obj"|
148
148
  end
149
149
  end
150
150
 
151
+ # Handling of the 3-state data bus
152
+ dbus <= mux(io_rwb,io_out,_bzzzzzzzz)
153
+ io_in <= dbus
154
+
151
155
  # The io unit.
152
156
  fsm(clk.posedge,rst,:async) do
153
157
  default { io_done <= 0; req <= 0; rwb <= 0; addr <= 0
154
- io_r_done <= 0
155
- # Default handling of the 3-state data bus
156
- hif(io_rwb) { dbus <= _zzzzzzzz }
157
- helse { dbus <= io_out }
158
- io_in <= dbus }
158
+ io_r_done <= 0 }
159
159
  reset(:sync) { data <= 0; }
160
160
  state(:wait) { goto(io_req,:start,:wait) } # Waiting for an IO
161
161
  state(:start) { req <= 1; rwb <= io_rwb; addr <= g # Start an IO
@@ -56,7 +56,7 @@ system :mei8 do |prog_file = "./prog.obj"|
56
56
  end
57
57
 
58
58
  # The control part for choosing between 0, add, sub and neg.
59
- par do
59
+ par(opr,x,y) do
60
60
  # Default computations
61
61
  cf <= 0; vf <= 0; zf <= (z == 0); sf <= z[7]
62
62
  add.(0,0,0)
@@ -150,14 +150,14 @@ system :mei8 do |prog_file = "./prog.obj"|
150
150
  end
151
151
  end
152
152
 
153
+ # Handling of the 3-state data bus
154
+ dbus <= mux(io_rwb,io_out,_bzzzzzzzz)
155
+ io_in <= dbus
156
+
153
157
  # The io unit.
154
158
  fsm(clk.posedge,rst,:async) do
155
159
  default { io_done <= 0; req <= 0; rwb <= 0; addr <= 0
156
- io_r_done <= 0
157
- # Default handling of the 3-state data bus
158
- hif(io_rwb) { dbus <= _zzzzzzzz }
159
- helse { dbus <= io_out }
160
- io_in <= dbus }
160
+ io_r_done <= 0 }
161
161
  reset(:sync) { data <= 0; }
162
162
  state(:wait) { goto(io_req,:start,:wait) } # Waiting for an IO
163
163
  state(:start) { req <= 1; rwb <= io_rwb; addr <= g # Start an IO
@@ -1,5 +1,7 @@
1
1
  require 'std/memory.rb'
2
2
 
3
+ raise "std/memory.rb is deprecated."
4
+
3
5
  include HDLRuby::High::Std
4
6
 
5
7
 
@@ -4,9 +4,9 @@
4
4
 
5
5
 
6
6
  # A simple circuit with named sub
7
- system :named_sub do
8
- input :x, :y
9
- output :s
7
+ system :named_sub do |x|
8
+ input :y
9
+ output :s, :z
10
10
 
11
11
  sub :somesub do
12
12
  inner :sig
@@ -17,13 +17,17 @@ system :named_sub do
17
17
  s <= ~somesub.sig
18
18
  end
19
19
 
20
+ z <= s
21
+
20
22
  end
21
23
 
22
24
  # A benchmark for the circuit.
23
25
  system :named_sub_bench do
24
- inner :x, :y, :s
26
+ inner :x, :y, :s, :z
27
+
28
+ named_sub(x).(:my_named_sub).(y,s)
25
29
 
26
- named_sub(:my_named_sub).(x,y,s)
30
+ z <= my_named_sub.z
27
31
 
28
32
  timed do
29
33
  x <= 0
@@ -4,15 +4,16 @@ system :ram8_16 do
4
4
  [7..0].input :addr
5
5
  [7..0].inout :data
6
6
 
7
+ [7..0].inner :data_in
8
+
7
9
  bit[7..0][2**8].inner :content
8
10
 
9
- # Memory enabled?
11
+ data <= mux(en & rwb, _bzzzzzzzz, content[addr])
12
+ data_in <= data
13
+
10
14
  par(clk.posedge) do
11
- hif(en) do
12
- # Read case
13
- hif(rwb) { data <= content[addr] }
14
- helse { content[addr] <= data }
15
+ hif(en & ~rwb) do
16
+ content[addr] <= data_in
15
17
  end
16
- helse { data <= _bZZZZZZZZ }
17
18
  end
18
19
  end
@@ -2,6 +2,8 @@ require 'std/memory.rb'
2
2
  require 'std/linear.rb'
3
3
  # require 'std/timing.rb'
4
4
 
5
+ raise "std/memory.rb is deprecated."
6
+
5
7
  include HDLRuby::High::Std
6
8
 
7
9
 
@@ -0,0 +1,9 @@
1
+ require 'rubyHDL'
2
+
3
+ # Ruby program ment to eb executed within HDLRuby hardware.
4
+
5
+ def echo
6
+ val = RubyHDL.inP
7
+ puts "Echoing: #{val}"
8
+ RubyHDL.outP = val
9
+ end
@@ -0,0 +1,6 @@
1
+ require 'RubyHDL'
2
+
3
+ def stdrw
4
+ RubyHDL.sigI = $stdin.read.to_i
5
+ $stdout.puts(RubyHDL.sigO)
6
+ end