Method: RCSimCinterface.rcsim_add_hif_noifs
- Defined in:
- ext/hruby_sim/hruby_rcsim_build.c
.rcsim_add_hif_noifs(hifV, condVs, stmntVs) ⇒ Object
Adds noifs to a C hardware if.
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 |
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 1331 VALUE rcsim_add_hif_noifs(VALUE mod, VALUE hifV, VALUE condVs, VALUE stmntVs) { /* Get the C hardware if from the Ruby value. */ HIf hif; value_to_rcsim(HIfS,hifV,hif); // printf("rcsim_add_hif_noifs with hif=%p\n",hif); /* Prepare the size for the noifs. */ long num = RARRAY_LEN(condVs); long old_num = hif->num_noifs; hif->num_noifs += num; // printf("first hif->noconds=%p\n",hif->noconds); fflush(stdout); // printf("first hif->nostmnts=%p\n",hif->nostmnts); fflush(stdout); hif->noconds = realloc(hif->noconds,sizeof(Expression[hif->num_noifs])); // hif->noconds = (Expression*)my_realloc(hif->noconds, // sizeof(Expression[old_num]),sizeof(Expression[hif->num_noifs])); // printf("now hif->noconds=%p\n",hif->noconds); fflush(stdout); // printf("access test: %p\n",hif->noconds[0]); fflush(stdout); hif->nostmnts = realloc(hif->nostmnts,sizeof(Statement[hif->num_noifs])); // hif->nostmnts = (Statement*)my_realloc(hif->nostmnts, // sizeof(Statement[old_num]),sizeof(Statement[hif->num_noifs])); // printf("now hif->nostmnts=%p\n",hif->nostmnts); fflush(stdout); // printf("access test: %p\n",hif->nostmnts[0]); fflush(stdout); /* Get and add the noifs from the Ruby value. */ for(long i=0; i< num; ++i) { Expression cond; Statement stmnt; // show_access(hif->noconds,old_num+i); // show_access(hif->nostmnts,old_num+i); value_to_rcsim(ExpressionS,rb_ary_entry(condVs,i),cond); hif->noconds[old_num + i] = cond; value_to_rcsim(StatementS,rb_ary_entry(stmntVs,i),stmnt); hif->nostmnts[old_num + i] = stmnt; } return hifV; } |