HDLRuby 2.11.5 → 2.11.8

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: 450d4465eb4fb71c70d61bdadf5bd0d944b5b8c7f7f9f3d02f847d670eb74f76
4
- data.tar.gz: b3cf3b934d8a50f6d85ffc74f3a34b0cfd2f074d472d2f6a8b93b4324cc2e5bd
3
+ metadata.gz: 7b7d0296f617dc4b015e423c6f5b3e381fc3d91d9537a1bf4adf3fcc8e3a1f3c
4
+ data.tar.gz: 957f7763c2452bc1b96e1301fe2aebadd081a2b4ea6d282ae5907768b28b0e85
5
5
  SHA512:
6
- metadata.gz: 667da8c2f678834407374f739ea4d0094803e82145b1485aa2b53bcef54f04b368668ad62996aaa67ae48b0e80fb9c9c9f731131e3eeb6c69c5c23363b2242e7
7
- data.tar.gz: 39ae4cea2c84140063b601b5c3f171462db40a41b01739894daa95b90cec6dd8c87780cc86f65ff269a0d7fb4478412d06c114d4c3a921ade691c6c3d9868110
6
+ metadata.gz: 28529796983feba1bba6502a63a9ace24e42f08410ba4afe70fc48bba1b36ba17bac3cdde95ef245590e5e3028428a477e59ef311e5eb7c9eaee48b394f01217
7
+ data.tar.gz: 90e23aa3e7cbfa2ac5c397a58a8b06b2f4798a72ca491a6134b4d7c694eba6952e02e8fc0e91b10aca8790129977f893ca67c626c2aa28845596365ad65560f1
@@ -86,6 +86,7 @@ static VALUE RCSimPointer;
86
86
 
87
87
  /* My own realloc. */
88
88
  static void* my_realloc(void* pointer, size_t old_size, size_t new_size) {
89
+ // printf("my_realloc with old_size=%lu new_size=%lu\n",old_size,new_size);
89
90
  if(old_size >= new_size) { return pointer; }
90
91
  void* new_pointer = malloc(new_size);
91
92
  memcpy(new_pointer,pointer,old_size);
@@ -265,6 +266,8 @@ VALUE rcsim_make_behavior(VALUE mod, VALUE timed) {
265
266
  } else {
266
267
  /* The behavior is not timed. */
267
268
  behavior->timed = 0;
269
+ /* It must be initialized though. */
270
+ register_init_behavior(behavior);
268
271
  }
269
272
  behavior->active_time = 0;
270
273
  behavior->thread = NULL;
@@ -315,7 +318,7 @@ VALUE rcsim_make_signal(VALUE mod, VALUE name, VALUE type) {
315
318
  // printf("signal->name=%p\n",signal->name);
316
319
  // printf("Creating signal named=%s\n",signal->name);
317
320
  value_to_rcsim(TypeS,type,signal->type);
318
- // printf("type width=%llu\n",type_width(signal->type));
321
+ // printf("&type=%p type=%p width=%llu\n",&(signal->type),signal->type,type_width(signal->type));
319
322
  signal->c_value = make_value(signal->type,0);
320
323
  // printf("signal->c_value=%p\n",signal->c_value);
321
324
  signal->c_value->signal = signal;
@@ -378,6 +381,7 @@ VALUE rcsim_make_transmit(VALUE mod, VALUE left, VALUE right) {
378
381
  // printf("transmit=%p\n",transmit);
379
382
  /* Set it up. */
380
383
  transmit->kind = TRANSMIT;
384
+ transmit->owner = NULL;
381
385
  value_to_rcsim(ReferenceS,left,transmit->left);
382
386
  value_to_rcsim(ExpressionS,right,transmit->right);
383
387
  /* Returns the C transmit embedded into a ruby VALUE. */
@@ -395,6 +399,7 @@ VALUE rcsim_make_print(VALUE mod) {
395
399
  // printf("print=%p\n",print);
396
400
  /* Set it up. */
397
401
  print->kind = PRINT;
402
+ print->owner = NULL;
398
403
  print->num_args = 0;
399
404
  print->args = NULL;
400
405
  /* Returns the C print embedded into a ruby VALUE. */
@@ -412,6 +417,7 @@ VALUE rcsim_make_timeWait(VALUE mod, VALUE unitV, VALUE delayV) {
412
417
  // printf("timeWait=%p\n",timeWait);
413
418
  /* Set it up. */
414
419
  timeWait->kind = TIME_WAIT;
420
+ timeWait->owner = NULL;
415
421
  /* Compute the delay. */
416
422
  unsigned long long delay;
417
423
  delay = NUM2LL(delayV);
@@ -441,6 +447,7 @@ VALUE rcsim_make_timeRepeat(VALUE mod, VALUE numberV, VALUE statementV) {
441
447
  // printf("timeRepeat=%p\n",timeRepeat); fflush(stdout);
442
448
  /* Set it up. */
443
449
  timeRepeat->kind = TIME_REPEAT;
450
+ timeRepeat->owner = NULL;
444
451
  /* Get and set the number of repeatition. */
445
452
  long long number;
446
453
  number = NUM2LL(numberV);
@@ -463,6 +470,7 @@ VALUE rcsim_make_timeTerminate(VALUE mod) {
463
470
  // printf("timeTerminate=%p\n",timeTerminate);
464
471
  /* Set it up. */
465
472
  timeTerminate->kind = TIME_TERMINATE;
473
+ timeTerminate->owner = NULL;
466
474
  /* Returns the C time terminate embedded into a ruby VALUE. */
467
475
  VALUE res;
468
476
  rcsim_to_value(TimeTerminateS,timeTerminate,res);
@@ -478,6 +486,7 @@ VALUE rcsim_make_hif(VALUE mod, VALUE conditionV, VALUE yesV, VALUE noV) {
478
486
  // printf("hif=%p\n",hif);
479
487
  /* Set it up. */
480
488
  hif->kind = HIF;
489
+ hif->owner = NULL;
481
490
  value_to_rcsim(ExpressionS,conditionV,hif->condition);
482
491
  value_to_rcsim(StatementS,yesV,hif->yes);
483
492
  if (TYPE(noV) == T_NIL)
@@ -502,6 +511,7 @@ VALUE rcsim_make_hcase(VALUE mod, VALUE valueV, VALUE defoltV) {
502
511
  // printf("hcase=%p\n",hcase);
503
512
  /* Set it up. */
504
513
  hcase->kind = HCASE;
514
+ hcase->owner = NULL;
505
515
  value_to_rcsim(ExpressionS,valueV,hcase->value);
506
516
  hcase->num_whens = 0;
507
517
  hcase->matches = NULL;
@@ -553,6 +563,7 @@ VALUE rcsim_make_value_numeric(VALUE mod, VALUE typeV, VALUE contentV) {
553
563
  value->capacity = 0;
554
564
  value->data_str = NULL;
555
565
  value->data_int = NUM2LL(contentV);
566
+ // printf("value->data_int=%lld\n",value->data_int);
556
567
  /* Returns the C value embedded into a ruby VALUE. */
557
568
  VALUE res;
558
569
  rcsim_to_value(ValueS,value,res);
@@ -594,6 +605,7 @@ VALUE rcsim_make_cast(VALUE mod, VALUE type, VALUE child) {
594
605
  // printf("cast=%p\n",cast);
595
606
  /* Set it up. */
596
607
  cast->kind = CAST;
608
+ cast->owner = NULL;
597
609
  value_to_rcsim(TypeS,type,cast->type);
598
610
  value_to_rcsim(ExpressionS,child,cast->child);
599
611
  /* Returns the C cast embedded into a ruby VALUE. */
@@ -610,6 +622,7 @@ VALUE rcsim_make_unary(VALUE mod, VALUE type, VALUE operator, VALUE child) {
610
622
  // printf("unary=%p\n",unary);
611
623
  /* Set it up. */
612
624
  unary->kind = UNARY;
625
+ unary->owner = NULL;
613
626
  value_to_rcsim(TypeS,type,unary->type);
614
627
  switch(sym_to_char(operator)) {
615
628
  case (unsigned char)'~': unary->oper = not_value; break;
@@ -631,6 +644,7 @@ VALUE rcsim_make_binary(VALUE mod, VALUE type, VALUE operator, VALUE left, VALUE
631
644
  // printf("binary=%p\n",binary);
632
645
  /* Set it up. */
633
646
  binary->kind = BINARY;
647
+ binary->owner = NULL;
634
648
  value_to_rcsim(TypeS,type,binary->type);
635
649
  switch(sym_to_char(operator)) {
636
650
  case (unsigned char)'+': binary->oper = add_value; break;
@@ -667,6 +681,7 @@ VALUE rcsim_make_select(VALUE mod, VALUE type, VALUE sel) {
667
681
  // printf("select=%p\n",select);
668
682
  /* Set it up. */
669
683
  select->kind = SELECT;
684
+ select->owner = NULL;
670
685
  value_to_rcsim(TypeS,type,select->type);
671
686
  value_to_rcsim(ExpressionS,sel,select->select);
672
687
  select->num_choices = 0;
@@ -685,6 +700,7 @@ VALUE rcsim_make_concat(VALUE mod, VALUE type, VALUE dirV) {
685
700
  // printf("concat=%p\n",concat);
686
701
  /* Set it up. */
687
702
  concat->kind = CONCAT;
703
+ concat->owner = NULL;
688
704
  value_to_rcsim(TypeS,type,concat->type);
689
705
  concat->num_exprs = 0;
690
706
  concat->exprs = NULL;
@@ -703,6 +719,7 @@ VALUE rcsim_make_refConcat(VALUE mod, VALUE type, VALUE dirV) {
703
719
  // printf("refConcat=%p\n",refConcat);
704
720
  /* Set it up. */
705
721
  refConcat->kind = REF_CONCAT;
722
+ refConcat->owner = NULL;
706
723
  value_to_rcsim(TypeS,type,refConcat->type);
707
724
  refConcat->num_refs = 0;
708
725
  refConcat->refs = NULL;
@@ -721,6 +738,7 @@ VALUE rcsim_make_refIndex(VALUE mod, VALUE type, VALUE index, VALUE ref) {
721
738
  // printf("refIndex=%p\n",refIndex);
722
739
  /* Set it up. */
723
740
  refIndex->kind = REF_INDEX;
741
+ refIndex->owner = NULL;
724
742
  value_to_rcsim(TypeS,type,refIndex->type);
725
743
  value_to_rcsim(ExpressionS,index,refIndex->index);
726
744
  value_to_rcsim(ReferenceS,ref,refIndex->ref);
@@ -738,6 +756,7 @@ VALUE rcsim_make_refRange(VALUE mod, VALUE type, VALUE first, VALUE last, VALUE
738
756
  // printf("refRange=%p\n",refRange);
739
757
  /* Set it up. */
740
758
  refRange->kind = REF_RANGE;
759
+ refRange->owner = NULL;
741
760
  value_to_rcsim(TypeS,type,refRange->type);
742
761
  value_to_rcsim(ExpressionS,first,refRange->first);
743
762
  value_to_rcsim(ExpressionS,last,refRange->last);
@@ -757,6 +776,7 @@ VALUE rcsim_make_stringE(VALUE mod, VALUE strV) {
757
776
  // printf("stringE=%p\n",stringE);
758
777
  /* Set it up. */
759
778
  stringE->kind = STRINGE;
779
+ stringE->owner = NULL;
760
780
  stringE->str = strdup(StringValueCStr(strV));
761
781
  /* Returns the C character string embedded into a ruby VALUE. */
762
782
  VALUE res;
@@ -780,8 +800,8 @@ VALUE rcsim_add_systemT_inputs(VALUE mod, VALUE systemTV, VALUE sigVs) {
780
800
  // printf("first systemT->inputs=%p\n",systemT->inputs); fflush(stdout);
781
801
  // systemT->inputs=realloc(systemT->inputs,
782
802
  // sizeof(SignalI[systemT->num_inputs]));
783
- systemT->inputs=my_realloc(systemT->inputs,sizeof(SignalI[old_num]),
784
- sizeof(SignalI[systemT->num_inputs]));
803
+ systemT->inputs=(SignalI*)my_realloc(systemT->inputs,
804
+ sizeof(SignalI[old_num]), sizeof(SignalI[systemT->num_inputs]));
785
805
  // printf("now systemT->inputs=%p\n",systemT->inputs); fflush(stdout);
786
806
  // printf("access test: %p\n",systemT->inputs[0]); fflush(stdout);
787
807
  /* Get and add the signals from the Ruby value. */
@@ -807,8 +827,8 @@ VALUE rcsim_add_systemT_outputs(VALUE mod, VALUE systemTV, VALUE sigVs) {
807
827
  // printf("first systemT->outputs=%p\n",systemT->outputs); fflush(stdout);
808
828
  // systemT->outputs =realloc(systemT->outputs,
809
829
  // sizeof(SignalI[systemT->num_outputs]));
810
- systemT->outputs =my_realloc(systemT->outputs,sizeof(SignalI[old_num]),
811
- sizeof(SignalI[systemT->num_outputs]));
830
+ systemT->outputs =(SignalI*)my_realloc(systemT->outputs,
831
+ sizeof(SignalI[old_num]), sizeof(SignalI[systemT->num_outputs]));
812
832
  // printf("now systemT->outputs=%p\n",systemT->outputs); fflush(stdout);
813
833
  // printf("access test: %p\n",systemT->outputs[0]); fflush(stdout);
814
834
  /* Get and add the signals from the Ruby value. */
@@ -834,8 +854,8 @@ VALUE rcsim_add_systemT_inouts(VALUE mod, VALUE systemTV, VALUE sigVs) {
834
854
  // printf("first systemT->inouts=%p\n",systemT->inouts); fflush(stdout);
835
855
  // systemT->inouts =realloc(systemT->inouts,
836
856
  // sizeof(SignalI[systemT->num_inouts]));
837
- systemT->inouts =my_realloc(systemT->inouts,sizeof(SignalI[old_num]),
838
- sizeof(SignalI[systemT->num_inouts]));
857
+ systemT->inouts =(SignalI*)my_realloc(systemT->inouts,
858
+ sizeof(SignalI[old_num]), sizeof(SignalI[systemT->num_inouts]));
839
859
  // printf("now systemT->inouts=%p\n",systemT->inouts); fflush(stdout);
840
860
  // printf("access test: %p\n",systemT->inouts[0]); fflush(stdout);
841
861
  /* Get and add the signals from the Ruby value. */
@@ -861,8 +881,8 @@ VALUE rcsim_add_scope_inners(VALUE mod, VALUE scopeV, VALUE sigVs) {
861
881
  // printf("first scope->inners=%p\n",scope->inners); fflush(stdout);
862
882
  // scope->inners = realloc(scope->inners,
863
883
  // sizeof(SignalI[scope->num_inners]));
864
- scope->inners = my_realloc(scope->inners,sizeof(SignalI[old_num]),
865
- sizeof(SignalI[scope->num_inners]));
884
+ scope->inners = (SignalI*)my_realloc(scope->inners,
885
+ sizeof(SignalI[old_num]), sizeof(SignalI[scope->num_inners]));
866
886
  // printf("now scope->inners=%p\n",scope->inners); fflush(stdout);
867
887
  // printf("access test: %p\n",scope->inners[0]); fflush(stdout);
868
888
  /* Get and add the signals from the Ruby value. */
@@ -891,8 +911,8 @@ VALUE rcsim_add_scope_behaviors(VALUE mod, VALUE scopeV, VALUE behVs) {
891
911
  // printf("first scope->behaviors=%p\n",scope->behaviors); fflush(stdout);
892
912
  // scope->behaviors = realloc(scope->behaviors,
893
913
  // sizeof(Behavior[scope->num_behaviors]));
894
- scope->behaviors = my_realloc(scope->behaviors,sizeof(Behavior[old_num]),
895
- sizeof(Behavior[scope->num_behaviors]));
914
+ scope->behaviors = (Behavior*)my_realloc(scope->behaviors,
915
+ sizeof(Behavior[old_num]), sizeof(Behavior[scope->num_behaviors]));
896
916
  // printf("now scope->behaviors=%p\n",scope->behaviors); fflush(stdout);
897
917
  // printf("access test: %p\n",scope->behaviors[0]); fflush(stdout);
898
918
  /* Get and add the behaviors from the Ruby value. */
@@ -918,8 +938,8 @@ VALUE rcsim_add_scope_systemIs(VALUE mod, VALUE scopeV, VALUE sysVs) {
918
938
  // printf("first scope->systemIs=%p\n",scope->systemIs); fflush(stdout);
919
939
  // scope->systemIs = realloc(scope->systemIs,
920
940
  // sizeof(SystemI[scope->num_systemIs]));
921
- scope->systemIs = my_realloc(scope->systemIs,sizeof(SystemI[old_num]),
922
- sizeof(SystemI[scope->num_systemIs]));
941
+ scope->systemIs = (SystemI*)my_realloc(scope->systemIs,
942
+ sizeof(SystemI[old_num]), sizeof(SystemI[scope->num_systemIs]));
923
943
  // printf("now scope->systemIs=%p\n",scope->systemIs); fflush(stdout);
924
944
  // printf("access test: %p\n",scope->systemIs[0]); fflush(stdout);
925
945
  /* Get and add the system instances from the Ruby value. */
@@ -945,8 +965,8 @@ VALUE rcsim_add_scope_scopes(VALUE mod, VALUE scopeV, VALUE scpVs) {
945
965
  // printf("first scope->scopes=%p\n",scope->scopes); fflush(stdout);
946
966
  // scope->scopes = realloc(scope->scopes,
947
967
  // sizeof(Scope[scope->num_scopes]));
948
- scope->scopes = my_realloc(scope->scopes,sizeof(Scope[old_num]),
949
- sizeof(Scope[scope->num_scopes]));
968
+ scope->scopes = (Scope*)my_realloc(scope->scopes,
969
+ sizeof(Scope[old_num]), sizeof(Scope[scope->num_scopes]));
950
970
  // printf("now scope->scopes=%p\n",scope->scopes); fflush(stdout);
951
971
  // printf("access test: %p\n",scope->scopes[0]); fflush(stdout);
952
972
  /* Get and add the sub scopes from the Ruby value. */
@@ -972,8 +992,8 @@ VALUE rcsim_add_behavior_events(VALUE mod, VALUE behaviorV, VALUE eventVs) {
972
992
  // printf("first behavior->events=%p\n",behavior->events); fflush(stdout);
973
993
  // behavior->events = realloc(behavior->events,
974
994
  // sizeof(Event[behavior->num_events]));
975
- behavior->events = my_realloc(behavior->events,sizeof(Event[old_num]),
976
- sizeof(Event[behavior->num_events]));
995
+ behavior->events = (Event*)my_realloc(behavior->events,
996
+ sizeof(Event[old_num]), sizeof(Event[behavior->num_events]));
977
997
  // printf("now behavior->events=%p\n",behavior->events); fflush(stdout);
978
998
  // printf("access test: %p\n",behavior->events[0]); fflush(stdout);
979
999
  /* Get and add the events from the Ruby value. */
@@ -989,7 +1009,8 @@ VALUE rcsim_add_behavior_events(VALUE mod, VALUE behaviorV, VALUE eventVs) {
989
1009
  sig->num_any++;
990
1010
  // printf("first sig->any=%p\n",sig->any); fflush(stdout);
991
1011
  // sig->any = realloc(sig->any,sizeof(Object[sig->num_any]));
992
- sig->any = my_realloc(sig->any,sizeof(Object[sig->num_any-1]),sizeof(Object[sig->num_any]));
1012
+ sig->any = (Object*)my_realloc(sig->any,
1013
+ sizeof(Object[sig->num_any-1]),sizeof(Object[sig->num_any]));
993
1014
  // printf("now sig->any=%p\n",sig->any); fflush(stdout);
994
1015
  // printf("access test: %p\n",sig->any[0]); fflush(stdout);
995
1016
  // show_access(sig->any,sig->num_any-1);
@@ -1000,7 +1021,8 @@ VALUE rcsim_add_behavior_events(VALUE mod, VALUE behaviorV, VALUE eventVs) {
1000
1021
  sig->num_pos++;
1001
1022
  // printf("first sig->pos=%p\n",sig->pos); fflush(stdout);
1002
1023
  // sig->pos = realloc(sig->pos,sizeof(Object[sig->num_pos]));
1003
- sig->pos = my_realloc(sig->pos,sizeof(Object[sig->num_pos-1]),sizeof(Object[sig->num_pos]));
1024
+ sig->pos = (Object*)my_realloc(sig->pos,
1025
+ sizeof(Object[sig->num_pos-1]),sizeof(Object[sig->num_pos]));
1004
1026
  // printf("now sig->pos=%p\n",sig->pos); fflush(stdout);
1005
1027
  // printf("access test: %p\n",sig->pos[0]); fflush(stdout);
1006
1028
  // show_access(sig->pos,sig->num_pos-1);
@@ -1011,7 +1033,8 @@ VALUE rcsim_add_behavior_events(VALUE mod, VALUE behaviorV, VALUE eventVs) {
1011
1033
  sig->num_neg++;
1012
1034
  // printf("first sig->neg=%p\n",sig->neg); fflush(stdout);
1013
1035
  // sig->neg = realloc(sig->neg,sizeof(Object[sig->num_neg]));
1014
- sig->neg = my_realloc(sig->neg,sizeof(Object[sig->num_neg-1]),sizeof(Object[sig->num_neg]));
1036
+ sig->neg = (Object*)my_realloc(sig->neg,
1037
+ sizeof(Object[sig->num_neg-1]),sizeof(Object[sig->num_neg]));
1015
1038
  // printf("now sig->neg=%p\n",sig->neg); fflush(stdout);
1016
1039
  // printf("access test: %p\n",sig->neg[0]); fflush(stdout);
1017
1040
  // show_access(sig->neg,sig->num_neg-1);
@@ -1038,8 +1061,8 @@ VALUE rcsim_add_systemI_systemTs(VALUE mod, VALUE systemIV, VALUE sysVs) {
1038
1061
  // printf("first systemI->systems=%p\n",systemI->systems); fflush(stdout);
1039
1062
  // systemI->systems=realloc(systemI->systems,
1040
1063
  // sizeof(SystemT[systemI->num_systems]));
1041
- systemI->systems=my_realloc(systemI->systems,sizeof(SystemT[old_num]),
1042
- sizeof(SystemT[systemI->num_systems]));
1064
+ systemI->systems = (SystemT*)my_realloc(systemI->systems,
1065
+ sizeof(SystemT[old_num]), sizeof(SystemT[systemI->num_systems]));
1043
1066
  // printf("now systemI->systems=%p\n",systemI->systems); fflush(stdout);
1044
1067
  // printf("access test: %p\n",systemI->systems[0]); fflush(stdout);
1045
1068
  /* Get and add the alternate system types from the Ruby value. */
@@ -1065,8 +1088,8 @@ VALUE rcsim_add_print_args(VALUE mod, VALUE printV, VALUE argVs) {
1065
1088
  // printf("first print->args=%p\n",print->args); fflush(stdout);
1066
1089
  // print->args = realloc(print->args,
1067
1090
  // sizeof(Expression[print->num_args]));
1068
- print->args = my_realloc(print->args,sizeof(Expression[old_num]),
1069
- sizeof(Expression[print->num_args]));
1091
+ print->args = (Expression*)my_realloc(print->args,
1092
+ sizeof(Expression[old_num]), sizeof(Expression[print->num_args]));
1070
1093
  // printf("now print->args=%p\n",print->args); fflush(stdout);
1071
1094
  // printf("access test: %p\n",print->args[0]); fflush(stdout);
1072
1095
  /* Get and add the arguments from the Ruby value. */
@@ -1092,11 +1115,13 @@ VALUE rcsim_add_hif_noifs(VALUE mod, VALUE hifV, VALUE condVs, VALUE stmntVs) {
1092
1115
  // printf("first hif->noconds=%p\n",hif->noconds); fflush(stdout);
1093
1116
  // printf("first hif->nostmnts=%p\n",hif->nostmnts); fflush(stdout);
1094
1117
  // hif->noconds = realloc(hif->noconds,sizeof(Expression[hif->num_noifs]));
1095
- hif->noconds = my_realloc(hif->noconds,sizeof(Expression[old_num]),sizeof(Expression[hif->num_noifs]));
1118
+ hif->noconds = (Expression*)my_realloc(hif->noconds,
1119
+ sizeof(Expression[old_num]),sizeof(Expression[hif->num_noifs]));
1096
1120
  // printf("now hif->noconds=%p\n",hif->noconds); fflush(stdout);
1097
1121
  // printf("access test: %p\n",hif->noconds[0]); fflush(stdout);
1098
1122
  // hif->nostmnts = realloc(hif->nostmnts,sizeof(Statement[hif->num_noifs]));
1099
- hif->nostmnts = my_realloc(hif->nostmnts,sizeof(Statement[old_num]),sizeof(Statement[hif->num_noifs]));
1123
+ hif->nostmnts = (Statement*)my_realloc(hif->nostmnts,
1124
+ sizeof(Statement[old_num]),sizeof(Statement[hif->num_noifs]));
1100
1125
  // printf("now hif->nostmnts=%p\n",hif->nostmnts); fflush(stdout);
1101
1126
  // printf("access test: %p\n",hif->nostmnts[0]); fflush(stdout);
1102
1127
  /* Get and add the noifs from the Ruby value. */
@@ -1127,14 +1152,14 @@ VALUE rcsim_add_hcase_whens(VALUE mod, VALUE hcaseV, VALUE matchVs, VALUE stmntV
1127
1152
  // printf("first hcase->stmnts=%p\n",hcase->stmnts); fflush(stdout);
1128
1153
  // hcase->matches = realloc(hcase->matches,
1129
1154
  // sizeof(Expression[hcase->num_whens]));
1130
- hcase->matches = my_realloc(hcase->matches,sizeof(Expression[old_num]),
1131
- sizeof(Expression[hcase->num_whens]));
1155
+ hcase->matches = (Expression*)my_realloc(hcase->matches,
1156
+ sizeof(Expression[old_num]), sizeof(Expression[hcase->num_whens]));
1132
1157
  // printf("now hcase->matches=%p\n",hcase->matches); fflush(stdout);
1133
1158
  // printf("access test: %p\n",hcase->matches[0]); fflush(stdout);
1134
1159
  // hcase->stmnts = realloc(hcase->stmnts,
1135
1160
  // sizeof(Statement[hcase->num_whens]));
1136
- hcase->stmnts = my_realloc(hcase->stmnts,sizeof(Statement[old_num]),
1137
- sizeof(Statement[hcase->num_whens]));
1161
+ hcase->stmnts = (Statement*)my_realloc(hcase->stmnts,
1162
+ sizeof(Statement[old_num]), sizeof(Statement[hcase->num_whens]));
1138
1163
  // printf("now hcase->stmnts=%p\n",hcase->stmnts); fflush(stdout);
1139
1164
  // printf("access test: %p\n",hcase->stmnts[0]); fflush(stdout);
1140
1165
  /* Get and add the whens from the Ruby value. */
@@ -1164,8 +1189,8 @@ VALUE rcsim_add_block_inners(VALUE mod, VALUE blockV, VALUE sigVs) {
1164
1189
  // printf("first block->inners=%p\n",block->inners); fflush(stdout);
1165
1190
  // block->inners = realloc(block->inners,
1166
1191
  // sizeof(SignalI[block->num_inners]));
1167
- block->inners = my_realloc(block->inners,sizeof(SignalI[old_num]),
1168
- sizeof(SignalI[block->num_inners]));
1192
+ block->inners = (SignalI*)my_realloc(block->inners,
1193
+ sizeof(SignalI[old_num]), sizeof(SignalI[block->num_inners]));
1169
1194
  // printf("now block->inners=%p\n",block->inners); fflush(stdout);
1170
1195
  // printf("access test: %p\n",block->inners[0]); fflush(stdout);
1171
1196
  /* Get and add the signals from the Ruby value. */
@@ -1191,8 +1216,8 @@ VALUE rcsim_add_block_statements(VALUE mod, VALUE blockV, VALUE stmntVs) {
1191
1216
  // printf("first block->stmnts=%p\n",block->stmnts); fflush(stdout);
1192
1217
  // block->stmnts = realloc(block->stmnts,
1193
1218
  // sizeof(Statement[block->num_stmnts]));
1194
- block->stmnts = my_realloc(block->stmnts,sizeof(Statement[old_num]),
1195
- sizeof(Statement[block->num_stmnts]));
1219
+ block->stmnts = (Statement*)my_realloc(block->stmnts,
1220
+ sizeof(Statement[old_num]), sizeof(Statement[block->num_stmnts]));
1196
1221
  // printf("now block->stmnts=%p\n",block->stmnts); fflush(stdout);
1197
1222
  // printf("access test: %p\n",block->stmnts[0]); fflush(stdout);
1198
1223
  /* Get and add the statements from the Ruby value. */
@@ -1218,8 +1243,8 @@ VALUE rcsim_add_select_choices(VALUE mod, VALUE selectV, VALUE choiceVs) {
1218
1243
  // printf("first select->choices=%p\n",select->choices); fflush(stdout);
1219
1244
  // select->choices = realloc(select->choices,
1220
1245
  // sizeof(Expression[select->num_choices]));
1221
- select->choices = my_realloc(select->choices,sizeof(Expression[old_num]),
1222
- sizeof(Expression[select->num_choices]));
1246
+ select->choices = (Expression*)my_realloc(select->choices,
1247
+ sizeof(Expression[old_num]),sizeof(Expression[select->num_choices]));
1223
1248
  // printf("now select->choices=%p\n",select->choices); fflush(stdout);
1224
1249
  // printf("access test: %p\n",select->choices[0]); fflush(stdout);
1225
1250
  /* Get and add the choices from the Ruby value. */
@@ -1246,8 +1271,8 @@ VALUE rcsim_add_concat_expressions(VALUE mod, VALUE concatV, VALUE exprVs) {
1246
1271
  // printf("first concat->exprs=%p\n",concat->exprs); fflush(stdout);
1247
1272
  // concat->exprs = realloc(concat->exprs,
1248
1273
  // sizeof(Expression[concat->num_exprs]));
1249
- concat->exprs = my_realloc(concat->exprs,sizeof(Expression[old_num]),
1250
- sizeof(Expression[concat->num_exprs]));
1274
+ concat->exprs = (Expression*)my_realloc(concat->exprs,
1275
+ sizeof(Expression[old_num]), sizeof(Expression[concat->num_exprs]));
1251
1276
  // printf("now concat->exprs=%p\n",concat->exprs); fflush(stdout);
1252
1277
  // printf("access test: %p\n",concat->exprs[0]); fflush(stdout);
1253
1278
  /* Get and add the expressions from the Ruby value. */
@@ -1273,8 +1298,8 @@ VALUE rcsim_add_refConcat_refs(VALUE mod, VALUE refConcatV, VALUE refVs) {
1273
1298
  // printf("first refConcat->refs=%p\n",refConcat->refs); fflush(stdout);
1274
1299
  // refConcat->refs = realloc(refConcat->refs,
1275
1300
  // sizeof(Reference[refConcat->num_refs]));
1276
- refConcat->refs = my_realloc(refConcat->refs,sizeof(Reference[old_num]),
1277
- sizeof(Reference[refConcat->num_refs]));
1301
+ refConcat->refs = (Reference*)my_realloc(refConcat->refs,
1302
+ sizeof(Reference[old_num]), sizeof(Reference[refConcat->num_refs]));
1278
1303
  // printf("now refConcat->refs=%p\n",refConcat->refs); fflush(stdout);
1279
1304
  // printf("access test: %p\n",refConcat->refs[0]); fflush(stdout);
1280
1305
  /* Get and add the references from the Ruby value. */
@@ -1283,6 +1308,7 @@ VALUE rcsim_add_refConcat_refs(VALUE mod, VALUE refConcatV, VALUE refVs) {
1283
1308
  // show_access(refConcat->refs,old_num+i);
1284
1309
  value_to_rcsim(ReferenceS,rb_ary_entry(refVs,i),ref);
1285
1310
  refConcat->refs[old_num + i] = ref;
1311
+ // printf("ref=%p ref &type=%p type=%p width=%llu\n",ref,&(ref->type),ref->type,type_width(ref->type));
1286
1312
  }
1287
1313
  return refConcatV;
1288
1314
  }
@@ -1339,11 +1365,11 @@ VALUE rcsim_set_signal_value(VALUE mod, VALUE signalV, VALUE exprV) {
1339
1365
  Expression expr;
1340
1366
  value_to_rcsim(ExpressionS,exprV,expr);
1341
1367
  /* Compute the value from it. */
1342
- // Value value = calc_expression(expr);
1343
1368
  Value value = get_value();
1344
1369
  value = calc_expression(expr,value);
1345
1370
  /* Copies the value. */
1346
1371
  signal->f_value = copy_value(value,signal->f_value);
1372
+ signal->c_value = copy_value(value,signal->c_value);
1347
1373
  free_value();
1348
1374
  return signalV;
1349
1375
  }
@@ -1352,8 +1378,11 @@ VALUE rcsim_set_signal_value(VALUE mod, VALUE signalV, VALUE exprV) {
1352
1378
  /** Starts the C-Ruby hybrid simulation.
1353
1379
  * @param systemTV the top system type.
1354
1380
  * @param name the name of the simulation.
1355
- * @param vcd tells if the vcd generation is used or not. */
1356
- VALUE rcsim_main(VALUE mod, VALUE systemTV, VALUE name, VALUE vcd) {
1381
+ * @param outmode tells which output mode is used:
1382
+ * 0: standard
1383
+ * 1: mute
1384
+ * 2: vcd */
1385
+ VALUE rcsim_main(VALUE mod, VALUE systemTV, VALUE name, VALUE outmodeV) {
1357
1386
  /* Get the C system type from the Ruby value. */
1358
1387
  SystemT systemT;
1359
1388
  value_to_rcsim(SystemTS,systemTV,systemT);
@@ -1361,11 +1390,18 @@ VALUE rcsim_main(VALUE mod, VALUE systemTV, VALUE name, VALUE vcd) {
1361
1390
  top_system = systemT;
1362
1391
  /* Enable it. */
1363
1392
  set_enable_system(systemT,1);
1393
+ /* Get the output mode. */
1394
+ int outmode = NUM2INT(outmodeV);
1364
1395
  /* Starts the simulation. */
1365
- if (TYPE(vcd) == T_TRUE)
1366
- hruby_sim_core(StringValueCStr(name),init_vcd_visualizer,-1);
1367
- else
1368
- hruby_sim_core(StringValueCStr(name),init_default_visualizer,-1);
1396
+ switch(outmode) {
1397
+ case 0: hruby_sim_core(StringValueCStr(name),init_default_visualizer,-1);
1398
+ break;
1399
+ case 1: hruby_sim_core(StringValueCStr(name),init_mute_visualizer,-1);
1400
+ break;
1401
+ case 2: hruby_sim_core(StringValueCStr(name),init_vcd_visualizer,-1);
1402
+ break;
1403
+ default:hruby_sim_core(StringValueCStr(name),init_default_visualizer,-1);
1404
+ }
1369
1405
  return systemTV;
1370
1406
  }
1371
1407
 
@@ -1409,7 +1445,7 @@ void Init_hruby_sim() {
1409
1445
  rb_define_singleton_method(mod,"rcsim_make_binary",rcsim_make_binary,4);
1410
1446
  rb_define_singleton_method(mod,"rcsim_make_select",rcsim_make_select,2);
1411
1447
  rb_define_singleton_method(mod,"rcsim_make_concat",rcsim_make_concat,2);
1412
- rb_define_singleton_method(mod,"rcsim_make_refConcat",rcsim_make_refConcat,1);
1448
+ rb_define_singleton_method(mod,"rcsim_make_refConcat",rcsim_make_refConcat,2);
1413
1449
  rb_define_singleton_method(mod,"rcsim_make_refIndex",rcsim_make_refIndex,3);
1414
1450
  rb_define_singleton_method(mod,"rcsim_make_refRange",rcsim_make_refRange,4);
1415
1451
  rb_define_singleton_method(mod,"rcsim_make_stringE",rcsim_make_stringE,1);