HDLRuby 2.3.7 → 2.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/HDLRuby/hdr_samples/bstr_bench.rb +14 -0
- data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +49 -0
- data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +27 -0
- data/lib/HDLRuby/hdr_samples/with_multi_channels.rb +300 -0
- data/lib/HDLRuby/hdrcc.rb +10 -1
- data/lib/HDLRuby/hruby_bstr.rb +7 -2
- data/lib/HDLRuby/hruby_high.rb +8 -0
- data/lib/HDLRuby/hruby_low.rb +107 -8
- data/lib/HDLRuby/hruby_low2c.rb +31 -9
- data/lib/HDLRuby/hruby_low_mutable.rb +90 -2
- data/lib/HDLRuby/hruby_low_resolve.rb +1 -0
- data/lib/HDLRuby/hruby_low_without_connection.rb +1 -0
- data/lib/HDLRuby/sim/hruby_sim.h +82 -39
- data/lib/HDLRuby/sim/hruby_sim_calc.c +89 -5
- data/lib/HDLRuby/sim/hruby_sim_core.c +32 -6
- data/lib/HDLRuby/sim/hruby_sim_vcd.c +380 -0
- data/lib/HDLRuby/sim/hruby_sim_vizualize.c +51 -12
- data/lib/HDLRuby/std/fixpoint.rb +10 -2
- data/lib/HDLRuby/std/linear.rb +33 -13
- data/lib/HDLRuby/std/memory.rb +90 -20
- data/lib/HDLRuby/version.rb +1 -1
- metadata +6 -2
@@ -145,6 +145,7 @@ module HDLRuby::Low
|
|
145
145
|
# puts "Resolve with #{self} and name=#{self.name}"
|
146
146
|
# First resolve the sub reference if possible.
|
147
147
|
if self.ref.is_a?(RefName) then
|
148
|
+
# puts "ref name=#{self.ref.name}"
|
148
149
|
obj = self.ref.resolve
|
149
150
|
# Look into the object for the name.
|
150
151
|
return obj.get_by_name(self.name)
|
@@ -31,6 +31,7 @@ module HDLRuby::Low
|
|
31
31
|
outputs_blk = Block.new(:par)
|
32
32
|
timed_blk = TimeBlock.new(:seq)
|
33
33
|
scope.each_connection do |connection|
|
34
|
+
# puts "For connection: #{connection}"
|
34
35
|
# Check the left and right of the connection
|
35
36
|
# for input or output port.
|
36
37
|
left = connection.left
|
data/lib/HDLRuby/sim/hruby_sim.h
CHANGED
@@ -50,8 +50,9 @@ typedef enum {
|
|
50
50
|
|
51
51
|
/* The interface to the type engine. */
|
52
52
|
typedef struct FlagsS_ {
|
53
|
-
unsigned int all;
|
54
|
-
unsigned int sign : 1; /* Tells if the type is signed or not. */
|
53
|
+
// unsigned int all;
|
54
|
+
// unsigned int sign : 1; /* Tells if the type is signed or not. */
|
55
|
+
unsigned int sign; /* Tells if the type is signed or not. */
|
55
56
|
} FlagsS;
|
56
57
|
|
57
58
|
/** The type structure. */
|
@@ -170,6 +171,12 @@ extern Value mod_value(Value src0, Value src1, Value dst);
|
|
170
171
|
* @return dst */
|
171
172
|
extern Value not_value(Value src, Value dst);
|
172
173
|
|
174
|
+
/** Compute the or of the bits a a value.
|
175
|
+
* @param src the source value
|
176
|
+
* @param dst the destination value
|
177
|
+
* @return dst */
|
178
|
+
extern Value reduce_or_value(Value src, Value dst);
|
179
|
+
|
173
180
|
/** Computes the AND of two values.
|
174
181
|
* @param src0 the first source value of the and
|
175
182
|
* @param src1 the second source value of the and
|
@@ -185,43 +192,43 @@ extern Value and_value(Value src0, Value src1, Value dst);
|
|
185
192
|
extern Value or_value(Value src0, Value src1, Value dst);
|
186
193
|
|
187
194
|
/** Computes the XOR of two values.
|
188
|
-
* @param src0 the first source value of the
|
189
|
-
* @param src1 the second source value of the
|
195
|
+
* @param src0 the first source value of the xor
|
196
|
+
* @param src1 the second source value of the xor
|
190
197
|
* @param dst the destination value
|
191
198
|
* @return dst */
|
192
199
|
extern Value xor_value(Value src0, Value src1, Value dst);
|
193
200
|
|
194
201
|
/** Computes the left shift of two general values.
|
195
|
-
* @param src0 the first source value of the
|
196
|
-
* @param src1 the second source value of the
|
202
|
+
* @param src0 the first source value of the shift
|
203
|
+
* @param src1 the second source value of the shift
|
197
204
|
* @param dst the destination
|
198
205
|
* @return dst */
|
199
206
|
Value shift_left_value(Value src0, Value src1, Value dst);
|
200
207
|
|
201
208
|
/** Computes the right shift of two general values.
|
202
|
-
* @param src0 the first source value of the
|
203
|
-
* @param src1 the second source value of the
|
209
|
+
* @param src0 the first source value of the shift
|
210
|
+
* @param src1 the second source value of the shift
|
204
211
|
* @param dst the destination
|
205
212
|
* @return dst */
|
206
213
|
Value shift_right_value(Value src0, Value src1, Value dst);
|
207
214
|
|
208
215
|
/** Computes the equal (NXOR) of two values.
|
209
|
-
* @param src0 the first source value of the
|
210
|
-
* @param src1 the second source value of the
|
216
|
+
* @param src0 the first source value of the comparison
|
217
|
+
* @param src1 the second source value of the comparison
|
211
218
|
* @param dst the destination value
|
212
219
|
* @return dst */
|
213
220
|
extern Value equal_value(Value src0, Value src1, Value dst);
|
214
221
|
|
215
222
|
/** Computes the lesser comparision of two values.
|
216
|
-
* @param src0 the first source value of the
|
217
|
-
* @param src1 the second source value of the
|
223
|
+
* @param src0 the first source value of the comparison
|
224
|
+
* @param src1 the second source value of the comparison
|
218
225
|
* @param dst the destination value
|
219
226
|
* @return dst */
|
220
227
|
extern Value lesser_value(Value src0, Value src1, Value dst);
|
221
228
|
|
222
229
|
/** Computes the greater comparision of two values.
|
223
|
-
* @param src0 the first source value of the
|
224
|
-
* @param src1 the second source value of the
|
230
|
+
* @param src0 the first source value of the comparison
|
231
|
+
* @param src1 the second source value of the comparison
|
225
232
|
* @param dst the destination value
|
226
233
|
* @return dst */
|
227
234
|
extern Value greater_value(Value src0, Value src1, Value dst);
|
@@ -468,6 +475,7 @@ typedef struct BlockS_ {
|
|
468
475
|
Kind kind; /* The kind of object. */
|
469
476
|
Object owner; /* The owner if any. */
|
470
477
|
|
478
|
+
char* name; /* The name of the block. */
|
471
479
|
int num_inners; /* The number of inners. */
|
472
480
|
SignalI* inners; /* The inners of the scope. */
|
473
481
|
void (*function)(); /* The function to execute for the block. */
|
@@ -490,6 +498,9 @@ typedef struct EventS_ {
|
|
490
498
|
/* The time units. */
|
491
499
|
typedef enum { S, MS, US, NS, PS, FS } Unit;
|
492
500
|
|
501
|
+
/** The top system. */
|
502
|
+
extern SystemT top_system;
|
503
|
+
|
493
504
|
/** Adds a timed behavior for processing.
|
494
505
|
* @param behavior the timed behavior to register */
|
495
506
|
extern void register_timed_behavior(Behavior behavior);
|
@@ -555,39 +566,71 @@ extern unsigned long long make_delay(int value, Unit unit);
|
|
555
566
|
|
556
567
|
|
557
568
|
|
569
|
+
/* Iterate over all the signals.
|
570
|
+
* @param func function to applie on each signal. */
|
571
|
+
extern void each_all_signal(void (*func)(SignalI));
|
558
572
|
|
559
573
|
/* Interface to the visualization engine. */
|
560
574
|
|
561
|
-
|
562
|
-
*
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
* @param
|
575
|
-
extern void
|
576
|
-
|
577
|
-
|
578
|
-
*
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
575
|
+
typedef struct {
|
576
|
+
void (*print_time)(unsigned long long);
|
577
|
+
void (*print_name)(Object);
|
578
|
+
void (*print_value)(Value);
|
579
|
+
void (*print_signal)(SignalI);
|
580
|
+
} PrinterS;
|
581
|
+
|
582
|
+
extern PrinterS printer;
|
583
|
+
|
584
|
+
/** Initializes the visualization printer engine.
|
585
|
+
* @param print_time the time printer
|
586
|
+
* @param print_name the name printer
|
587
|
+
* @param print_value the value printer
|
588
|
+
* @param print_signal the signal state printer. */
|
589
|
+
extern void init_visualizer(void (*print_time)(unsigned long long),
|
590
|
+
void (*print_name)(Object),
|
591
|
+
void (*print_value)(Value),
|
592
|
+
void (*print_signal)(SignalI));
|
593
|
+
|
594
|
+
// /** Prints the time.
|
595
|
+
// * @param time the time to show. */
|
596
|
+
// extern void print_time(unsigned long long time);
|
597
|
+
//
|
598
|
+
// // /** Prints the time and goes to the next line.
|
599
|
+
// // * @param time the time to show. */
|
600
|
+
// // extern void println_time(unsigned long long time);
|
601
|
+
//
|
602
|
+
// /** Prints the name of an object.
|
603
|
+
// * @param object the object to print the name. */
|
604
|
+
// extern void print_name(Object object);
|
605
|
+
//
|
606
|
+
// /** Prints a value.
|
607
|
+
// * @param value the value to print */
|
608
|
+
// extern void print_value(Value value);
|
609
|
+
//
|
610
|
+
// /** Prints a signal.
|
611
|
+
// * @param signal the signal to show */
|
612
|
+
// extern void print_signal(SignalI signal);
|
613
|
+
//
|
614
|
+
// // /** Prints a signal and goes to the next line.
|
615
|
+
// // * @param signal the signal to show */
|
616
|
+
// // extern void println_signal(SignalI signal);
|
617
|
+
|
618
|
+
/** Sets up the default vizualization engine.
|
619
|
+
* @param name the name of the vizualization. */
|
620
|
+
extern void init_default_visualizer(char* name);
|
621
|
+
|
622
|
+
/** Sets up the vcd vizualization engine.
|
623
|
+
* @param name the name of the vizualization. */
|
624
|
+
extern void init_vcd_visualizer(char* name);
|
585
625
|
|
586
626
|
/* The interface to the simulator core. */
|
587
627
|
|
588
628
|
/** The simulation core function.
|
629
|
+
* @param name the name of the simulation.
|
630
|
+
* @param init_vizualizer the vizualizer engine initializer.
|
589
631
|
* @param limit the time limit in fs. */
|
590
|
-
extern void hruby_sim_core(
|
632
|
+
extern void hruby_sim_core(char* name, void (*init_vizualizer)(char*),
|
633
|
+
unsigned long long limit);
|
591
634
|
|
592
635
|
|
593
636
|
|
@@ -70,7 +70,8 @@ static List hash_type[HASH_TYPE_SIZE] = {};
|
|
70
70
|
* @return the resulting type. */
|
71
71
|
static int hash_value(unsigned long long base, unsigned long long number,
|
72
72
|
FlagsS flags) {
|
73
|
-
return ((base+flags.all)^(number)) & 1023;
|
73
|
+
// return ((base+flags.all)^(number)) & 1023;
|
74
|
+
return ((base+flags.sign)^(number)) & 1023;
|
74
75
|
}
|
75
76
|
|
76
77
|
/** Adds a type to the hash of types.
|
@@ -109,7 +110,8 @@ static Type get_hash_type(Type base, unsigned long long number) {
|
|
109
110
|
while(elem) {
|
110
111
|
Type type = elem->data;
|
111
112
|
if ((type->base == bw) && (type->number == number) &&
|
112
|
-
(type->flags.all == flags.all)) {
|
113
|
+
// (type->flags.all == flags.all)) {
|
114
|
+
(type->flags.sign == flags.sign)) {
|
113
115
|
/* The type is found. */
|
114
116
|
return type;
|
115
117
|
}
|
@@ -243,8 +245,10 @@ void resize_value(Value value, int size) {
|
|
243
245
|
void set_value(Value value, int numeric, void* data) {
|
244
246
|
value->numeric = numeric;
|
245
247
|
if (numeric) {
|
248
|
+
// printf("set_value with data=%llx\n",*(unsigned long long*)data);
|
246
249
|
value->data_int = *((unsigned long long*)data);
|
247
250
|
} else {
|
251
|
+
// printf("data=%s\n",(char*)data);
|
248
252
|
memcpy(value->data_str,data,type_width(value->type)*sizeof(char));
|
249
253
|
}
|
250
254
|
}
|
@@ -254,6 +258,7 @@ void set_value(Value value, int numeric, void* data) {
|
|
254
258
|
* @param numeric tell if the value is in numeric form or in bitstring form
|
255
259
|
* @param data the source data */
|
256
260
|
Value make_set_value(Type type, int numeric, void* data) {
|
261
|
+
// printf("make_set_value with type->flags.sign=%x\n",type->flags.sign);
|
257
262
|
Value value = make_value(type,numeric);
|
258
263
|
set_value(value,numeric,data);
|
259
264
|
return value;
|
@@ -307,6 +312,7 @@ Value copy_value(Value src, Value dst) {
|
|
307
312
|
/* Numeric copy. */
|
308
313
|
dst->data_int = fix_numeric_type(dst->type,src->data_int);
|
309
314
|
} else {
|
315
|
+
// printf("copy_value with bit string: %s\n",src->data_str);
|
310
316
|
/* Resize the destination if required. */
|
311
317
|
resize_value(dst,type_width(dst->type));
|
312
318
|
/* Bitstring copy up to the end of dst or src. */
|
@@ -603,12 +609,14 @@ static Value sub_value_bitstring(Value src0, Value src1, Value dst) {
|
|
603
609
|
* @param dst the destination value
|
604
610
|
* @return dst */
|
605
611
|
static Value mul_value_defined_bitstring(Value src0, Value src1, Value dst) {
|
612
|
+
// printf("mul_value_defined_bitstring with src0=%llx src1=%llx\n",value2integer(src0),value2integer(src1));
|
606
613
|
/* Sets state of the destination using the first source. */
|
607
614
|
dst->type = src0->type;
|
608
615
|
dst->numeric = 1;
|
609
616
|
|
610
617
|
/* Perform the multiplication. */
|
611
618
|
dst->data_int = value2integer(src0) * value2integer(src1);
|
619
|
+
// printf("dst->data_int=%llx\n",dst->data_int);
|
612
620
|
return dst;
|
613
621
|
}
|
614
622
|
|
@@ -714,6 +722,45 @@ static Value not_value_bitstring(Value src, Value dst) {
|
|
714
722
|
return dst;
|
715
723
|
}
|
716
724
|
|
725
|
+
/** Compute the or of the bits a bitstring value.
|
726
|
+
* @param src the source value
|
727
|
+
* @param dst the destination value
|
728
|
+
* @return dst */
|
729
|
+
Value reduce_or_value_bitstring(Value src, Value dst) {
|
730
|
+
/* Compute the width of the result in bits. */
|
731
|
+
unsigned long long width = type_width(src->type);
|
732
|
+
|
733
|
+
/* Update the destination capacity if required. */
|
734
|
+
resize_value(dst,width);
|
735
|
+
/* Set the type and size of the destination from the type of the source.*/
|
736
|
+
dst->type = src->type;
|
737
|
+
dst->numeric = 0;
|
738
|
+
|
739
|
+
/* Get access to the source and destination data. */
|
740
|
+
char* src_data = src->data_str;
|
741
|
+
char* dst_data = dst->data_str;
|
742
|
+
|
743
|
+
/* Performs the reduce or. */
|
744
|
+
unsigned long long count;
|
745
|
+
char res;
|
746
|
+
for(count = 0; count < width; ++count) {
|
747
|
+
/* Performs the reduce or. */
|
748
|
+
char d = src_data[count] - '0'; /* Get and convert to bit. */
|
749
|
+
if ((d == (d&1)) && (res != 'x'-'0')) { /* d is defined. */
|
750
|
+
res |= d;
|
751
|
+
} else {
|
752
|
+
/* res is undefined. */
|
753
|
+
res = 'x' - '0';
|
754
|
+
}
|
755
|
+
/* Apart for the first bit, there are only 0, still we are in
|
756
|
+
* the loop, set it. */
|
757
|
+
dst_data[count] = '0';
|
758
|
+
}
|
759
|
+
dst_data[0] = res + '0';
|
760
|
+
/* Return the destination. */
|
761
|
+
return dst;
|
762
|
+
}
|
763
|
+
|
717
764
|
|
718
765
|
/** Computes the and of two bitstring values.
|
719
766
|
* @param src0 the first source value of the and
|
@@ -1133,7 +1180,7 @@ static Value equal_value_bitstring(Value src0, Value src1, Value dst) {
|
|
1133
1180
|
static Value select_value_bitstring(Value cond, Value dst, unsigned int num,
|
1134
1181
|
va_list args)
|
1135
1182
|
{
|
1136
|
-
printf("select_value_bitstring with cond=%s\n",cond->data_str);
|
1183
|
+
// printf("select_value_bitstring with cond=%s\n",cond->data_str);
|
1137
1184
|
/* Get the first alternative for sizing the result. */
|
1138
1185
|
Value src = va_arg(args,Value);
|
1139
1186
|
/* Compute the width of the result in bits. */
|
@@ -1517,6 +1564,7 @@ static Value sub_value_numeric(Value src0, Value src1, Value dst) {
|
|
1517
1564
|
* @param dst the destination value
|
1518
1565
|
* @return dst */
|
1519
1566
|
static Value mul_value_numeric(Value src0, Value src1, Value dst) {
|
1567
|
+
// printf("mul_value_numeric with src0->data_int=%llx src1->data_int=%llx\n",src0->data_int, src1->data_int);
|
1520
1568
|
/* Sets state of the destination using the first source. */
|
1521
1569
|
dst->type = src0->type;
|
1522
1570
|
dst->numeric = 1;
|
@@ -1575,6 +1623,21 @@ static Value not_value_numeric(Value src, Value dst) {
|
|
1575
1623
|
}
|
1576
1624
|
|
1577
1625
|
|
1626
|
+
/** Compute the or of the bits a numeric value.
|
1627
|
+
* @param src the source value
|
1628
|
+
* @param dst the destination value
|
1629
|
+
* @return dst */
|
1630
|
+
Value reduce_or_value_numeric(Value src, Value dst) {
|
1631
|
+
/* Sets state of the destination using the first source. */
|
1632
|
+
dst->type = src->type;
|
1633
|
+
dst->numeric = 1;
|
1634
|
+
|
1635
|
+
/* Perform the reduce or. */
|
1636
|
+
dst->data_int = fix_numeric_type(dst->type, src->data_int != 0);
|
1637
|
+
return dst;
|
1638
|
+
}
|
1639
|
+
|
1640
|
+
|
1578
1641
|
/** Computes the AND of two numeric values.
|
1579
1642
|
* @param src0 the first source value of the addition
|
1580
1643
|
* @param src1 the second source value of the addition
|
@@ -1769,7 +1832,7 @@ static Value concat_value_numeric_array(int num, int dir,
|
|
1769
1832
|
* @param dst the destination value
|
1770
1833
|
* @return dst */
|
1771
1834
|
static Value cast_value_numeric(Value src, Type type, Value dst) {
|
1772
|
-
// printf("cast_value_numeric with src=%llx",src->data_int);
|
1835
|
+
// printf("cast_value_numeric with src=%llx\n",src->data_int);
|
1773
1836
|
/* Copy the source to the destination. */
|
1774
1837
|
dst->data_int = src->data_int;
|
1775
1838
|
/* Update the destination type to the cast. */
|
@@ -2093,6 +2156,21 @@ Value not_value(Value src, Value dst) {
|
|
2093
2156
|
}
|
2094
2157
|
|
2095
2158
|
|
2159
|
+
/** Compute the or of the bits a value.
|
2160
|
+
* @param src the source value
|
2161
|
+
* @param dst the destination value
|
2162
|
+
* @return dst */
|
2163
|
+
Value reduce_or_value(Value src, Value dst) {
|
2164
|
+
if (src->numeric) {
|
2165
|
+
/* The source is numeric. */
|
2166
|
+
return reduce_or_value_numeric(src,dst);
|
2167
|
+
} else {
|
2168
|
+
/* The source cannot be numeric, compute bitsitrings. */
|
2169
|
+
return reduce_or_value_bitstring(src,dst);
|
2170
|
+
}
|
2171
|
+
}
|
2172
|
+
|
2173
|
+
|
2096
2174
|
/** Computes the AND of two general values.
|
2097
2175
|
* @param src0 the first source value of the addition
|
2098
2176
|
* @param src1 the second source value of the addition
|
@@ -2596,6 +2674,7 @@ unsigned long long value2integer(Value value) {
|
|
2596
2674
|
char bit;
|
2597
2675
|
/* Access the bitstring data. */
|
2598
2676
|
char* data_str = value->data_str;
|
2677
|
+
// printf("value2integer with data_str=%s\n",data_str);
|
2599
2678
|
/* Copy the bits. */
|
2600
2679
|
for (i=0; i<width && i<LONG_LONG_BIT; ++i) {
|
2601
2680
|
/* Get the bit. */
|
@@ -2607,12 +2686,17 @@ unsigned long long value2integer(Value value) {
|
|
2607
2686
|
/* Write the bit. */
|
2608
2687
|
res = (res << 1) | bit;
|
2609
2688
|
}
|
2689
|
+
// printf("first res=%llx\n",res);
|
2690
|
+
unsigned long long bit0 = (data_str[width-1]-'0') << i;
|
2610
2691
|
/* Perform the sign extension if required. */
|
2611
2692
|
if (i>=width && value->type->flags.sign) {
|
2612
2693
|
for(; i<LONG_LONG_BIT; ++i) {
|
2613
|
-
res = (res << 1) | bit;
|
2694
|
+
// res = (res << 1) | bit;
|
2695
|
+
res |= bit0;
|
2696
|
+
bit0 <<= 1;
|
2614
2697
|
}
|
2615
2698
|
}
|
2699
|
+
// printf("then res=%llx\n",res);
|
2616
2700
|
return res;
|
2617
2701
|
}
|
2618
2702
|
|
@@ -12,6 +12,9 @@
|
|
12
12
|
* hruby_low2c.
|
13
13
|
* */
|
14
14
|
|
15
|
+
/** The top system. */
|
16
|
+
SystemT top_system;
|
17
|
+
|
15
18
|
/** The number of all the signals. */
|
16
19
|
static int num_all_signals = 0;
|
17
20
|
/** The capacity of the set of signals. */
|
@@ -118,9 +121,10 @@ void hruby_sim_update_signals() {
|
|
118
121
|
/* Is there a change? */
|
119
122
|
if (same_content_value(sig->c_value,sig->f_value)) continue;
|
120
123
|
/* Yes, process the signal. */
|
121
|
-
println_signal(sig);
|
122
|
-
|
123
|
-
// printf("
|
124
|
+
// println_signal(sig);
|
125
|
+
printer.print_signal(sig);
|
126
|
+
// printf("c_value="); printer.print_value(sig->c_value);
|
127
|
+
// printf("\nf_value="); printer.print_value(sig->f_value); printf("\n");
|
124
128
|
// printf("Touched signal: %p (%s)\n",sig,sig->name);
|
125
129
|
/* Update the current value of the signal. */
|
126
130
|
copy_value(sig->f_value,sig->c_value);
|
@@ -185,7 +189,8 @@ void hruby_sim_update_signals() {
|
|
185
189
|
SignalI sig = e->data;
|
186
190
|
delete_element(e);
|
187
191
|
/* Yes, process the signal. */
|
188
|
-
println_signal(sig);
|
192
|
+
// println_signal(sig);
|
193
|
+
printer.print_signal(sig);
|
189
194
|
/* Update the current value of the signal. */
|
190
195
|
/* Mark the corresponding code as activated. */
|
191
196
|
/* Any edge activation. */
|
@@ -284,7 +289,8 @@ void hruby_sim_advance_time() {
|
|
284
289
|
}
|
285
290
|
/* Sets the new activation time. */
|
286
291
|
hruby_sim_time = next_time;
|
287
|
-
println_time(hruby_sim_time);
|
292
|
+
// println_time(hruby_sim_time);
|
293
|
+
printer.print_time(hruby_sim_time);
|
288
294
|
}
|
289
295
|
|
290
296
|
|
@@ -393,9 +399,18 @@ void hruby_sim_end_timed_behaviors() {
|
|
393
399
|
|
394
400
|
|
395
401
|
|
402
|
+
// /** The simulation core function.
|
403
|
+
// * @param limit the time limit in fs. */
|
404
|
+
// void hruby_sim_core(unsigned long long limit) {
|
396
405
|
/** The simulation core function.
|
406
|
+
* @param name the name of the simulation.
|
407
|
+
* @param vizualizer the vizualizer engine initializer.
|
397
408
|
* @param limit the time limit in fs. */
|
398
|
-
void hruby_sim_core(
|
409
|
+
void hruby_sim_core(char* name, void (*init_vizualizer)(char*),
|
410
|
+
unsigned long long limit) {
|
411
|
+
/* Initilize the vizualizer. */
|
412
|
+
init_vizualizer(name);
|
413
|
+
|
399
414
|
/* Initialize the time to 0. */
|
400
415
|
hruby_sim_time = 0;
|
401
416
|
|
@@ -597,3 +612,14 @@ unsigned long long make_delay(int value, Unit unit) {
|
|
597
612
|
return -1;
|
598
613
|
}
|
599
614
|
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
/* Iterate over all the signals.
|
619
|
+
* @param func function to applie on each signal. */
|
620
|
+
void each_all_signal(void (*func)(SignalI)) {
|
621
|
+
int i;
|
622
|
+
for(i = 0; i<num_all_signals; ++i) {
|
623
|
+
func(all_signals[i]);
|
624
|
+
}
|
625
|
+
}
|