Enforce rules for non-4-state wires (issue #1087)

When using the Icarus extension for wire types, only logic (4-state)
wires may have multiple drivers (as documented in extensions.rst).
Other types of wire should be treated as unresolved wires.

When the Icarus extension is disabled, only 4-state wires are
allowed (IEEE 1800-2017 section 6.7.1).
This commit is contained in:
Martin Whitaker 2024-01-28 14:14:10 +00:00
parent 18720fe060
commit 82516c28e2
1 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2023 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2024 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -98,6 +98,17 @@ static void sig_check_data_type(Design*des, NetScope*scope,
if (!type)
return;
if ((sig->type() == NetNet::WIRE) && (sig->data_type() != IVL_VT_LOGIC)) {
if (gn_cadence_types_flag) {
sig->type(NetNet::UNRESOLVED_WIRE);
} else {
cerr << wire->get_fileline() << ": error: Net `"
<< wire->basename() << "` can not be of type `"
<< sig->data_type() << "`." << endl;
des->errors++;
}
}
if (type->packed()) {
switch (type->base_type()) {
case IVL_VT_LOGIC: // 4-state packed is allowed by the standard