From 82516c28e2e293d50c6eb725438e4057aeb91e8d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 28 Jan 2024 14:14:10 +0000 Subject: [PATCH] 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). --- elab_sig.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/elab_sig.cc b/elab_sig.cc index 68818474d..34692f1c1 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -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