Avoid printing field widths in $display/$write output
This removes some unwanted artifacts from the output.
This commit is contained in:
parent
a577ee447b
commit
026d941734
|
|
@ -126,55 +126,59 @@ int draw_stask_display(vhdl_procedural *proc, stmt_container *container,
|
||||||
// the expression will be null
|
// the expression will be null
|
||||||
// The behaviour here seems to be to output a space
|
// The behaviour here seems to be to output a space
|
||||||
ivl_expr_t net = ivl_stmt_parm(stmt, i++);
|
ivl_expr_t net = ivl_stmt_parm(stmt, i++);
|
||||||
if (net) {
|
if (net == NULL) {
|
||||||
if (ivl_expr_type(net) == IVL_EX_STRING) {
|
display_write(container, new vhdl_const_string(" "));
|
||||||
std::ostringstream ss;
|
continue;
|
||||||
for (const char *p = ivl_expr_string(net); *p; p++) {
|
}
|
||||||
if (*p == '\\') {
|
|
||||||
// Octal escape
|
if (ivl_expr_type(net) == IVL_EX_STRING) {
|
||||||
char ch = parse_octal(p+1);
|
ostringstream ss;
|
||||||
if (ch == '\n') {
|
for (const char *p = ivl_expr_string(net); *p; p++) {
|
||||||
flush_string(ss, container);
|
if (*p == '\\') {
|
||||||
display_line(container);
|
// Octal escape
|
||||||
}
|
char ch = parse_octal(p+1);
|
||||||
else
|
if (ch == '\n') {
|
||||||
ss << ch;
|
|
||||||
p += 3;
|
|
||||||
}
|
|
||||||
else if (*p == '%' && *(++p) != '%') {
|
|
||||||
flush_string(ss, container);
|
flush_string(ss, container);
|
||||||
|
display_line(container);
|
||||||
// TODO: This needs to be re-written
|
|
||||||
// ...it does not handle format codes at all!
|
|
||||||
// Unfortunately, there is no printf-like
|
|
||||||
// function in VHDL
|
|
||||||
|
|
||||||
assert(i < count);
|
|
||||||
ivl_expr_t net = ivl_stmt_parm(stmt, i++);
|
|
||||||
assert(net);
|
|
||||||
|
|
||||||
vhdl_expr *base = translate_expr(net);
|
|
||||||
if (NULL == base)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
display_write(container, base);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ss << *p;
|
ss << ch;
|
||||||
|
p += 3;
|
||||||
}
|
}
|
||||||
|
else if (*p == '%' && *(++p) != '%') {
|
||||||
|
flush_string(ss, container);
|
||||||
|
|
||||||
display_write(container, new vhdl_const_string(ss.str().c_str()));
|
// Skip over width for now
|
||||||
}
|
while (isdigit(*p)) ++p;
|
||||||
else {
|
|
||||||
vhdl_expr *base = translate_expr(net);
|
|
||||||
if (NULL == base)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
display_write(container, base);
|
// TODO: This needs to be re-written
|
||||||
|
// ...it does not handle format codes at all!
|
||||||
|
// Unfortunately, there is no printf-like
|
||||||
|
// function in VHDL
|
||||||
|
|
||||||
|
assert(i < count);
|
||||||
|
ivl_expr_t net = ivl_stmt_parm(stmt, i++);
|
||||||
|
assert(net);
|
||||||
|
|
||||||
|
vhdl_expr *base = translate_expr(net);
|
||||||
|
if (NULL == base)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
display_write(container, base);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ss << *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
display_write(container, new vhdl_const_string(ss.str().c_str()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vhdl_expr *base = translate_expr(net);
|
||||||
|
if (NULL == base)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
display_write(container, base);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
display_write(container, new vhdl_const_string(" "));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newline)
|
if (newline)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue