Skip to content

Commit 20228ba

Browse files
author
phase1geo
committed
Fixing several issues with the new inline generator.
1 parent dce0a90 commit 20228ba

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

diags/regress/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ DIAGS1 += assign4 example2 example2.1 example2.3
577577
EXCLUDE += bug2794588 case4.1 case5 casex2 casez3 \
578578
example1 exclude5.1 exclude5.3 inline3 mem5 \
579579
merge6.1 param10.1 param10.5 sbit_sel3.2 signed4.1 \
580-
static_func4
580+
static_func4 \
581+
generate5 generate5.2 generate5.3 generate8.9
581582
ifdef VPI
582583
EXCLUDE += fork2 generate4 generate4.1 generate8
583584
endif

src/gen_parser.y

+4-1
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,7 @@ generate_item
14571457
func_unit* funit = db_get_tfn_by_position( @1.first_line, @1.first_column );
14581458
assert( funit != NULL );
14591459
generator_push_funit( funit );
1460+
generator_create_tmp_regs();
14601461
}
14611462
generate_item_list_opt K_end
14621463
{
@@ -1481,6 +1482,7 @@ generate_item
14811482
func_unit* funit = db_get_tfn_by_position( @1.first_line, @1.first_column );
14821483
assert( funit != NULL );
14831484
generator_push_funit( funit );
1485+
generator_create_tmp_regs();
14841486
}
14851487
generate_item_list_opt K_end
14861488
{
@@ -1494,11 +1496,13 @@ generate_item
14941496
func_unit* funit = db_get_tfn_by_position( @11.first_line, @11.first_column );
14951497
assert( funit != NULL );
14961498
generator_push_funit( funit );
1499+
generator_create_tmp_regs();
14971500
}
14981501
generate_item_list_opt K_end
14991502
{
15001503
func_unit* funit = db_get_tfn_by_position( @11.first_line, @11.first_column );
15011504
assert( funit != NULL );
1505+
generator_pop_funit();
15021506
$$ = generator_build( 17, strdup_safe( "for(" ), $3, strdup_safe( ";" ), $5, strdup_safe( ";" ), $7, strdup_safe( ")" ), "\n", strdup_safe( "begin : " ), $11, "\n",
15031507
generator_inst_id_reg( funit ), "\n", generator_tmp_regs(), $13, strdup_safe( "end" ), "\n" );
15041508
}
@@ -3858,7 +3862,6 @@ inc_for_depth
38583862
{
38593863
func_unit* funit = db_get_tfn_by_position( @$.first_line, (@$.first_column - 3) );
38603864
assert( funit != NULL );
3861-
printf( "In inc_for_depth, first_line: %d, first_column: %d, funit->name: %s\n", @$.first_line, (@$.first_column - 3), funit->name );
38623865
generator_push_funit( funit );
38633866
}
38643867
;

src/generator.new.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -3289,9 +3289,10 @@ char* generator_fsm_covs() { PROFILE(GENERATOR_FSM_COVS);
32893289

32903290
for( i=0; i<curr_funit->fsm_size; i++ ) {
32913291

3292-
fsm* table = curr_funit->fsms[i];
3293-
char idxstr[30];
3294-
char numstr[30];
3292+
fsm* table = curr_funit->fsms[i];
3293+
char idxstr[30];
3294+
char numstr[30];
3295+
char* tcov_str = cov_str;
32953296

32963297
/* Get the string value of the index */
32973298
rv = snprintf( idxstr, 30, "%d", (i + 1) );
@@ -3331,6 +3332,7 @@ char* generator_fsm_covs() { PROFILE(GENERATOR_FSM_COVS);
33313332
slen = 6 + strlen( numstr ) + 14 + strlen( idxstr ) + 4 + strlen( fexp ) + 1 + strlen( texp ) + 3;
33323333
cov_str = (char*)malloc_safe( slen );
33333334
rv = snprintf( cov_str, slen, "wire [%d:0] \\covered$F%u = {%s,%s};", ((from_number + to_number) - 1), (i + 1), fexp, texp );
3335+
printf( "cov_str: %p, %s\n", cov_str, cov_str );
33343336
} else {
33353337
rv = snprintf( numstr, 30, "%d", from_number ); assert( rv < 30 );
33363338
slen = 7 + strlen( numstr ) + 2 + strlen( (tsize != NULL) ? tsize : "1" ) + 18 + strlen( idxstr ) + 4 + strlen( fexp ) + 1 + strlen( texp ) + 3;
@@ -3357,6 +3359,9 @@ char* generator_fsm_covs() { PROFILE(GENERATOR_FSM_COVS);
33573359

33583360
}
33593361

3362+
/* Concatenate strings */
3363+
cov_str = generator_build( 2, tcov_str, cov_str );
3364+
33603365
}
33613366

33623367
}

src/link.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void funit_link_add(
218218

219219
tmp->funit = funit;
220220
tmp->next = NULL;
221-
221+
222222
if( *head == NULL ) {
223223
*head = *tail = tmp;
224224
} else {

0 commit comments

Comments
 (0)