Increase the thread flag count from 256 to 512

This commit is contained in:
Cary R 2020-05-31 12:36:01 -07:00
parent 1fefa8eb1b
commit 89d3342804
5 changed files with 32 additions and 30 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2018 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -97,7 +97,7 @@ void draw_switch_in_scope(ivl_switch_t sw)
break;
default:
fprintf(stderr, "%s:%u: tgt-vvp error: unrecognised switch type.\n",
fprintf(stderr, "%s:%u: vvp.tgt error: unrecognised switch type.\n",
ivl_switch_file(sw), ivl_switch_lineno(sw));
vvp_errors += 1;
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2017 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -32,13 +32,13 @@ static unsigned long word_alloc_mask = 0x0f;
int allocate_word()
{
int res = 4;
int max = WORD_COUNT;
while (res < max && (1U << res) & word_alloc_mask)
while (res < WORD_COUNT && (1U << res) & word_alloc_mask)
res += 1;
if (res >= max) {
fprintf(stderr, "vvp.tgt error: Thread words exhausted.\n");
if (res >= WORD_COUNT) {
fprintf(stderr, "vvp.tgt error: Thread words (%d) exhausted "
"during VVP code generation.\n", WORD_COUNT);
exit(1);
}
word_alloc_mask |= 1U << res;
@ -47,8 +47,7 @@ int allocate_word()
void clr_word(int res)
{
int max = WORD_COUNT;
assert(res < max);
assert(res < WORD_COUNT);
word_alloc_mask &= ~ (1U << res);
}
@ -109,7 +108,7 @@ static void draw_binary_real(ivl_expr_t expr)
break;
default:
fprintf(stderr, "XXXX draw_binary_real(%c)\n",
fprintf(stderr, "vvp.tgt error: draw_binary_real(%c)\n",
ivl_expr_opcode(expr));
assert(0);
}
@ -538,7 +537,7 @@ void draw_eval_real(ivl_expr_t expr)
fprintf(vvp_out, " %%cvt/rv%s;\n", sign_flag);
} else {
fprintf(stderr, "XXXX Evaluate real expression (%d)\n",
fprintf(stderr, "vvp.tgt error: XXXX Evaluate real expression (%d)\n",
ivl_expr_type(expr));
fprintf(vvp_out, " ; XXXX Evaluate real expression (%d)\n",
ivl_expr_type(expr));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -28,7 +28,7 @@
static const char*version_string =
"Icarus Verilog VVP Code Generator " VERSION " (" VERSION_TAG ")\n\n"
"Copyright (c) 2001-2015 Stephen Williams (steve@icarus.com)\n\n"
"Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)\n\n"
" This program is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 2 of the License, or\n"
@ -50,7 +50,8 @@ unsigned show_file_line = 0;
int debug_draw = 0;
# define FLAGS_COUNT 256
/* This needs to match the actual flag count in the VVP thread. */
# define FLAGS_COUNT 512
static uint32_t allocate_flag_mask[FLAGS_COUNT / 32] = { 0x000000ff, 0 };
@ -109,7 +110,9 @@ int allocate_flag(void)
return idx;
}
return -1;
fprintf(stderr, "vvp.tgt error: Exceeded the maximum flag count of "
"%d during VVP code generation.\n", FLAGS_COUNT);
exit(1);
}
void clr_flag(int idx)
@ -171,20 +174,20 @@ int target_design(ivl_design_t des)
long fl_value = strtol(fileline, &eptr, 0);
/* Nothing usable in the file/line string. */
if (fileline == eptr) {
fprintf(stderr, "vvp error: Unable to extract file/line "
fprintf(stderr, "vvp.tgt error: Unable to extract file/line "
"information from string: %s\n", fileline);
return 1;
}
/* Extra stuff at the end. */
if (*eptr != 0) {
fprintf(stderr, "vvp error: Extra characters '%s' "
fprintf(stderr, "vvp.tgt error: Extra characters '%s' "
"included at end of file/line string: %s\n",
eptr, fileline);
return 1;
}
/* The file/line flag must be positive. */
if (fl_value < 0) {
fprintf(stderr, "vvp error: File/line flag (%ld) must "
fprintf(stderr, "vvp.tgt error: File/line flag (%ld) must "
"be positive.\n", fl_value);
return 1;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -653,7 +653,7 @@ static int show_stmt_case(ivl_statement_t net, ivl_scope_t sscope)
unsigned idx, default_case;
if (qual != IVL_CASE_QUALITY_BASIC && qual != IVL_CASE_QUALITY_PRIORITY) {
fprintf(stderr, "%s:%u: tgt-vvp sorry: "
fprintf(stderr, "%s:%u: vvp.tgt sorry: "
"Case unique/unique0 qualities are ignored.\n",
ivl_stmt_file(net), ivl_stmt_lineno(net));
}
@ -882,7 +882,7 @@ static void force_real_to_lval(ivl_statement_t net)
/* We do not currently support using a word from a variable
array as the L-value (SystemVerilog / Icarus extension). */
if (ivl_signal_type(lsig) == IVL_SIT_REG) {
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s to the "
fprintf(stderr, "%s:%u: vvp.tgt sorry: cannot %s to the "
"word of a variable array (%s[%ld]).\n",
ivl_stmt_file(net), ivl_stmt_lineno(net),
command_name, ivl_signal_basename(lsig),
@ -938,7 +938,7 @@ static void force_vector_to_lval(ivl_statement_t net)
/* We do not currently support using a word from a variable
array as the L-value (SystemVerilog / Icarus extension). */
if (ivl_signal_type(lsig) == IVL_SIT_REG) {
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s to the "
fprintf(stderr, "%s:%u: vvp.tgt sorry: cannot %s to the "
"word of a variable array (%s[%ld]).\n",
ivl_stmt_file(net), ivl_stmt_lineno(net),
command_name, ivl_signal_basename(lsig),
@ -984,7 +984,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
ivl_expr_type(rval) == IVL_EX_REALNUM)
return;
fprintf(stderr, "%s:%u: tgt-vvp sorry: procedural continuous "
fprintf(stderr, "%s:%u: vvp.tgt sorry: procedural continuous "
"assignments are not yet fully supported. The RHS of "
"this assignment will only be evaluated once, at the "
"time the assignment statement is executed.\n",
@ -1028,7 +1028,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
long use_wid = ivl_signal_width(rsig);
long use_lsb, use_msb;
if (ivl_signal_packed_dimensions(lsig) > 1) {
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s part of a "
fprintf(stderr, "%s:%u: vvp.tgt sorry: cannot %s part of a "
"packed array.\n",
ivl_stmt_file(net), ivl_stmt_lineno(net),
command_name);
@ -1043,7 +1043,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
use_msb = use_lsb;
use_msb -= use_wid - 1;
}
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s signal to a ",
fprintf(stderr, "%s:%u: vvp.tgt sorry: cannot %s signal to a ",
ivl_stmt_file(net), ivl_stmt_lineno(net), command_name);
if (use_wid > 1) {
fprintf(stderr, "part select (%s[%ld:%ld]).\n",
@ -1070,7 +1070,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
/* Normalize the array access. */
long real_word = use_lword;
real_word += ivl_signal_array_base(lsig);
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s to the "
fprintf(stderr, "%s:%u: vvp.tgt sorry: cannot %s to the "
"word of a variable array (%s[%ld]).\n",
ivl_stmt_file(net), ivl_stmt_lineno(net),
command_name, ivl_signal_basename(lsig), real_word);
@ -1081,7 +1081,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
if ((rword_idx = ivl_expr_oper1(rval)) != 0) {
assert(ivl_signal_dimensions(rsig) != 0);
if (!number_is_immediate(rword_idx, IMM_WID, 0)) {
fprintf(stderr, "%s:%u: tgt-vvp sorry: procedural continuous "
fprintf(stderr, "%s:%u: vvp.tgt sorry: procedural continuous "
"assignments are not yet fully supported. The RHS of "
"this assignment will only be evaluated once, at the "
"time the assignment statement is executed.\n",
@ -1100,7 +1100,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
/* Normalize the array access. */
long real_word = use_rword;
real_word += ivl_signal_array_base(rsig);
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s from the "
fprintf(stderr, "%s:%u: vvp.tgt sorry: cannot %s from the "
"word of a variable array (%s[%ld]).\n",
ivl_expr_file(rval), ivl_expr_lineno(rval),
command_name, ivl_signal_basename(rsig), real_word);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2019 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -102,7 +102,7 @@ struct vthread_s {
/* This is the program counter. */
vvp_code_t pc;
/* These hold the private thread bits. */
enum { FLAGS_COUNT = 256, WORDS_COUNT = 16 };
enum { FLAGS_COUNT = 512, WORDS_COUNT = 16 };
vvp_bit4_t flags[FLAGS_COUNT];
/* These are the word registers. */