Fixes for vlog95 generation and gold file updates

This commit is contained in:
Cary R 2026-01-06 23:00:55 -08:00
parent c3abb84ce6
commit 918976651a
19 changed files with 81 additions and 32 deletions

View File

@ -0,0 +1 @@
VCD info: dumpfile dump.vcd opened for output.

View File

@ -0,0 +1 @@
LXT info: dumpfile dump.lxt opened for output.

View File

@ -0,0 +1 @@
LXT2 info: dumpfile dump.lx2 opened for output.

View File

@ -0,0 +1,12 @@
SDF INFO: Loading ivltests/sdf_header.sdf from work/vlog95.v:11
SDF INFO: ivltests/sdf_header.sdf:2: Version: 3.0
SDF INFO: ivltests/sdf_header.sdf:3: Design: test
SDF INFO: ivltests/sdf_header.sdf:4: Date: Wed Mar 8 12:34:56 2023
SDF INFO: ivltests/sdf_header.sdf:5: Vendor: No Vendor
SDF INFO: ivltests/sdf_header.sdf:6: Program: Human
SDF INFO: ivltests/sdf_header.sdf:7: Program Version: 1.0.0
SDF INFO: ivltests/sdf_header.sdf:8: Divider: "/"
SDF INFO: ivltests/sdf_header.sdf:9: Voltage: 5.000000
SDF INFO: ivltests/sdf_header.sdf:10: Process: best=0.65:nom=1.0:worst=1.8
SDF INFO: ivltests/sdf_header.sdf:11: Temperature: 25.000000
SDF INFO: ivltests/sdf_header.sdf:12: Timescale: 1ps

View File

@ -1110,3 +1110,8 @@ case_unique normal,-g2009 ivltests gold=case_unique-vlog95.gold
# An error is reported for both compiler passes
br_gh377 normal,-Ptest.name= ivltests gold=br_gh377-vlog95.gold
# When the work was done to support timing checks this caused multiple
# names for a single nexus so this test now fails. This needs to be fixed
# or the code needs to be reworked.
pr1520314 NI

View File

@ -35,8 +35,8 @@ br_gh939 vvp_tests/br_gh939.json
br_gh1001 vvp_tests/br_gh1001.json
br_gh1018 vvp_tests/br_gh1018.json
br_gh1029 vvp_tests/br_gh1029.json
br_gh1075a vvp_tests/br_gh1074a.json
br_gh1075b vvp_tests/br_gh1074b.json
br_gh1074a vvp_tests/br_gh1074a.json
br_gh1074b vvp_tests/br_gh1074b.json
br_gh1087a1 vvp_tests/br_gh1087a1.json
br_gh1087a2 vvp_tests/br_gh1087a2.json
br_gh1087a3 vvp_tests/br_gh1087a3.json

View File

@ -116,8 +116,8 @@ def compare_files(log_path, gold_path):
if a != b:
# pylint: disable-next=consider-using-f-string
print("{log} and {gold} differ:".format(log=log_path, gold=gold_path))
sys.stdout.writelines(difflib.unified_diff(a, b, log_path, gold_path))
print("{gold} and {log} differ:".format(gold=gold_path,log=log_path))
sys.stdout.writelines(difflib.unified_diff(b, a, gold_path, log_path))
return False
return True
@ -243,9 +243,7 @@ def do_run_normal(options: dict, cfg: dict, expected_fail: bool,
# Run the vlog95 translation if needed.
if cfg['vlog95']:
options['iverilog_args'].append("-tvlog95")
options['iverilog_args'].append("-pfileline=1")
options['iverilog_args'].append("-pspacing=4")
options['iverilog_args'].extend(["-tvlog95", "-pfileline=1", "-pspacing=4"])
ivl_tcmd = assemble_iverilog_cmd(options, cfg, 'vlog95.v')
ivl_tres = run_cmd(ivl_tcmd)
@ -253,10 +251,13 @@ def do_run_normal(options: dict, cfg: dict, expected_fail: bool,
if ivl_tres.returncode != 0:
return [1, "Failed - vlog95 translation failed."]
enable_specify = "-gspecify" in options['iverilog_args']
if "-pallowsigned=1" in options['iverilog_args']:
options['iverilog_args'] = [ "-g2001-noconfig" ]
else:
options['iverilog_args'] = [ "-g1995" ]
if enable_specify:
options['iverilog_args'].append("-gspecify")
options['source'] = os.path.join("work", "vlog95.v")
# Run the iverilog command

View File

@ -1,5 +1,9 @@
{
"type" : "normal",
"source" : "br_gh1074a.v",
"iverilog-args" : [ "-g2009" ]
"iverilog-args" : [ "-g2009" ],
"vlog95" : {
"__comment" : "two-state variables are not supported",
"type" : "EF"
}
}

View File

@ -1,5 +1,9 @@
{
"type" : "normal",
"source" : "br_gh1074b.v",
"iverilog-args" : [ "-g2009" ]
"iverilog-args" : [ "-g2009" ],
"vlog95" : {
"__comment" : "two-state variables are not supported",
"type" : "EF"
}
}

View File

@ -3,5 +3,9 @@
"source" : "br_gh710.v",
"gold" : "br_gh710a",
"iverilog-args" : [ "-g2009" ],
"vvp-args-extended" : [ "-vcd" ]
"vvp-args-extended" : [ "-vcd" ],
"vlog95" : {
"__comment" : "packages are translated to modules that can be dumped",
"gold" : "br_gh710a-vlog95"
}
}

View File

@ -3,5 +3,9 @@
"source" : "br_gh710.v",
"gold" : "br_gh710b",
"iverilog-args" : [ "-g2009" ],
"vvp-args-extended" : [ "-lxt" ]
"vvp-args-extended" : [ "-lxt" ],
"vlog95" : {
"__comment" : "packages are translated to modules that can be dumped",
"gold" : "br_gh710b-vlog95"
}
}

View File

@ -3,5 +3,9 @@
"source" : "br_gh710.v",
"gold" : "br_gh710c",
"iverilog-args" : [ "-g2009" ],
"vvp-args-extended" : [ "-lxt2" ]
"vvp-args-extended" : [ "-lxt2" ],
"vlog95" : {
"__comment" : "packages are translated to modules that can be dumped",
"gold" : "br_gh710c-vlog95"
}
}

View File

@ -1,8 +0,0 @@
{
"type" : "normal-vlog95",
"source" : "localparam_type.v",
"gold" : "parameter_type-vlog95",
"strict" : {
"gold" : "parameter_type-vlog95_std"
}
}

View File

@ -4,5 +4,8 @@
"gold" : "parameter_type",
"strict" : {
"gold" : "parameter_type_std"
},
"vlog95" : {
"iverilog-args" : [ "-pallowsigned=1" ]
}
}

View File

@ -1,8 +0,0 @@
{
"type" : "normal-vlog95",
"source" : "parameter_type.v",
"gold" : "parameter_type-vlog95",
"strict" : {
"gold" : "parameter_type-vlog95_std"
}
}

View File

@ -4,5 +4,8 @@
"gold" : "parameter_type",
"strict" : {
"gold" : "parameter_type_std"
},
"vlog95" : {
"iverilog-args" : [ "-pallowsigned=1" ]
}
}

View File

@ -3,5 +3,8 @@
"source" : "sdf_header.v",
"gold" : "sdf_header",
"iverilog-args" : [ "-gspecify" ],
"vvp-args-extended" : [ "-sdf-verbose" ]
"vvp-args-extended" : [ "-sdf-verbose" ],
"vlog95" : {
"gold" : "sdf_header-vlog95"
}
}

View File

@ -1,5 +1,9 @@
{
"type" : "normal",
"source" : "sv_2state_array_init_prop.v",
"iverilog-args" : [ "-g2005-sv" ]
"iverilog-args" : [ "-g2005-sv" ],
"vlog95" : {
"__comment" : "two-state variables are not supported",
"type" : "EF"
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2026 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,6 +68,7 @@ static int32_t get_int32_from_bits(const char *bits, unsigned nbits,
value |= ~(((uint32_t)1 << trim_wid) - (uint32_t)1);
}
*result_type = 0;
if ((msb == 'x') || (msb == 'z')) *result_type = -1;
return value;
}
@ -136,7 +137,17 @@ void emit_number(const char *bits, unsigned nbits, unsigned is_signed,
int rtype;
int32_t value = get_int32_from_bits(bits, nbits, 1, &rtype);
if (rtype != 0) emit_bits(bits, nbits, is_signed);
else fprintf(vlog_out, "%"PRId32, value);
else {
/* Limit the size of the decimal value if needed. */
if (nbits < 32U) {
if (value < 0) {
value *= -1;
fprintf(vlog_out, "-");
}
fprintf(vlog_out, "%u'sd", nbits);
}
fprintf(vlog_out, "%"PRId32, value);
}
/* Otherwise a signed value can only be 32 bits long since it can
* only be represented as an integer. We can trim any matching MSB
* bits to make it fit. We cannot support individual undefined