HDLRuby 2.7.5 → 2.9.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.
@@ -108,7 +108,7 @@ void register_signal(SignalI signal) {
108
108
  /** Recursively update the signals until no (untimed) behavior are
109
109
  * activated. */
110
110
  void hruby_sim_update_signals() {
111
- // printf("hruby_sim_update_signals...\n");
111
+ // printf("hruby_sim_update_signals...\n");
112
112
  /* As long as the list of touched signals is not empty go on computing. */
113
113
  while(!empty_list(touched_signals) || !empty_list(touched_signals_seq)) {
114
114
  // printf("## Checking touched signals.\n");
@@ -121,7 +121,6 @@ void hruby_sim_update_signals() {
121
121
  /* Is there a change? */
122
122
  if (same_content_value(sig->c_value,sig->f_value)) continue;
123
123
  /* Yes, process the signal. */
124
- // println_signal(sig);
125
124
  printer.print_signal(sig);
126
125
  // printf("c_value="); printer.print_value(sig->c_value);
127
126
  // printf("\nf_value="); printer.print_value(sig->f_value); printf("\n");
@@ -254,8 +253,8 @@ void hruby_sim_update_signals() {
254
253
  if (obj->kind == BEHAVIOR) {
255
254
  /* Behavior case. */
256
255
  Behavior beh = (Behavior)obj;
257
- /* Is the code really activated? */
258
- if (beh->activated) {
256
+ /* Is the code really enabled and activated? */
257
+ if (beh->enabled && beh->activated) {
259
258
  /* Yes, execute it. */
260
259
  beh->block->function();
261
260
  /* And deactivate it. */
@@ -265,7 +264,7 @@ void hruby_sim_update_signals() {
265
264
  /* Other code case. */
266
265
  Code cod = (Code)obj;
267
266
  /* Is the code really activated? */
268
- if (cod->activated) {
267
+ if (cod->enabled && cod->activated) {
269
268
  /* Yes, execute it. */
270
269
  cod->function();
271
270
  /* And deactivate it. */
@@ -295,6 +294,35 @@ void hruby_sim_advance_time() {
295
294
  }
296
295
 
297
296
 
297
+ /** Sets the enamble status of the behaviors of a scope.
298
+ * @param scope the scope to process.
299
+ * @param status the enable status. */
300
+ static void set_enable_scope(Scope scope, int status) {
301
+ int i;
302
+ int num_beh = scope->num_behaviors;
303
+ Behavior* behs = scope->behaviors;
304
+ int num_scp = scope->num_scopes;
305
+ Scope* scps = scope->scopes;
306
+
307
+ /* Enable the behaviors. */
308
+ for(i=0; i<num_beh; ++i) {
309
+ behs[i]->enabled = status;
310
+ }
311
+
312
+ /* Recurse on the sub scopes. */
313
+ for(i=0; i<num_scp; ++i) {
314
+ set_enable_scope(scps[i],status);
315
+ }
316
+ }
317
+
318
+ /** Sets the enable status of the behaviors of a system type.
319
+ * @param systemT the system type to process.
320
+ * @param status the enable status. */
321
+ void set_enable_system(SystemT systemT, int status) {
322
+ set_enable_scope(systemT->scope,status);
323
+ }
324
+
325
+
298
326
  /** Activates a behavior.
299
327
  * @param behavior the behavior to activate. */
300
328
  void activate_behavior(Behavior behavior) {
@@ -360,7 +388,8 @@ void* behavior_run(void* arg) {
360
388
  pthread_mutex_unlock(&hruby_sim_mutex);
361
389
  // printf("#2\n");
362
390
  /* Now can start the execution of the behavior. */
363
- behavior->block->function();
391
+ if (behavior->enabled)
392
+ behavior->block->function();
364
393
  // printf("#3\n");
365
394
  /* Now can start the execution of the behavior. */
366
395
  /* Stops the behavior. */
@@ -441,6 +470,10 @@ void hruby_sim_core(char* name, void (*init_vizualizer)(char*),
441
470
  /* Update the signal values (recursively executing blocks locked
442
471
  * on the signals). */
443
472
  hruby_sim_update_signals();
473
+ if (hruby_sim_time == 0) {
474
+ /* Initially touch all the signals. */
475
+ each_all_signal(&touch_signal);
476
+ }
444
477
  if (num_run_behaviors <= 0) break;
445
478
  /* Advance time to next timestep. */
446
479
  hruby_sim_advance_time();
@@ -632,11 +665,35 @@ unsigned long long make_delay(int value, Unit unit) {
632
665
 
633
666
 
634
667
 
635
- /* Iterate over all the signals.
636
- * @param func function to applie on each signal. */
668
+ /** Iterates over all the signals.
669
+ * @param func function to applie on each signal. */
637
670
  void each_all_signal(void (*func)(SignalI)) {
638
671
  int i;
639
672
  for(i = 0; i<num_all_signals; ++i) {
640
673
  func(all_signals[i]);
641
674
  }
642
675
  }
676
+
677
+
678
+ /** Configure a system instance.
679
+ * @param systemI the system instance to configure.
680
+ * @param idx the index of the target system. */
681
+ void configure(SystemI systemI, int idx) {
682
+ int i;
683
+ // printf("Configure to: %i\n",idx);
684
+ /* Sets the current system type. */
685
+ systemI->system = systemI->systems[idx];
686
+ /* Disable all the behaviors of the system instance. */
687
+ for(i=0; i<systemI->num_systems; ++i) {
688
+ if (i != idx)
689
+ set_enable_system(systemI->systems[i],0);
690
+ }
691
+ /* Enable the current system. */
692
+ set_enable_system(systemI->systems[idx],1);
693
+ }
694
+
695
+
696
+ /** Terminates the simulation. */
697
+ void terminate() {
698
+ exit(0);
699
+ }
@@ -85,7 +85,7 @@ static void vcd_print_name(Object object) {
85
85
  vcd_print("%s",name);
86
86
  } else {
87
87
  /* No name, use the address of the object as name generator.*/
88
- vcd_print("$%p",(void*)object);
88
+ vcd_print("x$%p",(void*)object);
89
89
  }
90
90
  break;
91
91
  default: /* Nothing to do */
@@ -8,6 +8,9 @@ module HDLRuby::High::Std
8
8
  ## Describes a high-level reconfigurable component type.
9
9
  class ReconfT
10
10
 
11
+ extend Gem::Deprecate
12
+ deprecate :initialize, Configure, 2022, 3
13
+
11
14
  # The name of the reconfigurable component type.
12
15
  attr_reader :name
13
16
 
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.7.5"
2
+ VERSION = "2.9.0"
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.7.5
4
+ version: 2.9.0
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-02-11 00:00:00.000000000 Z
11
+ date: 2022-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ files:
76
76
  - lib/HDLRuby/hdr_samples/adder_assign_error.rb
77
77
  - lib/HDLRuby/hdr_samples/adder_bench.rb
78
78
  - lib/HDLRuby/hdr_samples/adder_gen.rb
79
+ - lib/HDLRuby/hdr_samples/adder_gen_gen.rb
79
80
  - lib/HDLRuby/hdr_samples/adder_kadai.rb
80
81
  - lib/HDLRuby/hdr_samples/adder_nodef_error.rb
81
82
  - lib/HDLRuby/hdr_samples/addsub.rb
@@ -125,11 +126,13 @@ files:
125
126
  - lib/HDLRuby/hdr_samples/neural/selector.rb
126
127
  - lib/HDLRuby/hdr_samples/neural/sigmoid.rb
127
128
  - lib/HDLRuby/hdr_samples/neural/z.rb
129
+ - lib/HDLRuby/hdr_samples/parseq_bench.rb
128
130
  - lib/HDLRuby/hdr_samples/prog.obj
129
131
  - lib/HDLRuby/hdr_samples/ram.rb
130
132
  - lib/HDLRuby/hdr_samples/range_bench.rb
131
133
  - lib/HDLRuby/hdr_samples/register_with_code_bench.rb
132
134
  - lib/HDLRuby/hdr_samples/rom.rb
135
+ - lib/HDLRuby/hdr_samples/rom_nest.rb
133
136
  - lib/HDLRuby/hdr_samples/ruby_fir_hw.rb
134
137
  - lib/HDLRuby/hdr_samples/seqpar_bench.rb
135
138
  - lib/HDLRuby/hdr_samples/struct.rb
@@ -142,11 +145,13 @@ files:
142
145
  - lib/HDLRuby/hdr_samples/type_minmax_bench.rb
143
146
  - lib/HDLRuby/hdr_samples/with_casts.rb
144
147
  - lib/HDLRuby/hdr_samples/with_channel.rb
148
+ - lib/HDLRuby/hdr_samples/with_channel_other.rb
145
149
  - lib/HDLRuby/hdr_samples/with_class.rb
146
150
  - lib/HDLRuby/hdr_samples/with_concat.rb
147
151
  - lib/HDLRuby/hdr_samples/with_connector.rb
148
152
  - lib/HDLRuby/hdr_samples/with_connector_memory.rb
149
153
  - lib/HDLRuby/hdr_samples/with_decoder.rb
154
+ - lib/HDLRuby/hdr_samples/with_def.rb
150
155
  - lib/HDLRuby/hdr_samples/with_fixpoint.rb
151
156
  - lib/HDLRuby/hdr_samples/with_fsm.rb
152
157
  - lib/HDLRuby/hdr_samples/with_function_generator.rb
@@ -157,11 +162,13 @@ files:
157
162
  - lib/HDLRuby/hdr_samples/with_memory.rb
158
163
  - lib/HDLRuby/hdr_samples/with_memory_rom.rb
159
164
  - lib/HDLRuby/hdr_samples/with_multi_channels.rb
165
+ - lib/HDLRuby/hdr_samples/with_of.rb
160
166
  - lib/HDLRuby/hdr_samples/with_reconf.rb
161
167
  - lib/HDLRuby/hdr_samples/with_reduce.rb
162
168
  - lib/HDLRuby/hdr_samples/with_ref_array.rb
163
169
  - lib/HDLRuby/hdr_samples/with_str2value.rb
164
170
  - lib/HDLRuby/hdr_samples/with_subsums.rb
171
+ - lib/HDLRuby/hdr_samples/with_terminate.rb
165
172
  - lib/HDLRuby/hdr_samples/with_to_a.rb
166
173
  - lib/HDLRuby/hdr_samples/with_to_array.rb
167
174
  - lib/HDLRuby/hdr_samples/with_values.rb