From de931d6a97930a0ece0294b2b671979e393e489c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 25 Nov 2020 21:09:25 -0500 Subject: [PATCH] Fix LHS is not a lvalue when using tristate with -Oi. --- src/V3Tristate.cpp | 1 + test_regress/t/t_altera_lpm_mult_noinl.pl | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 test_regress/t/t_altera_lpm_mult_noinl.pl diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 237636f14..ca5119846 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -1107,6 +1107,7 @@ class TristateVisitor final : public TristateBaseVisitor { AstVar* enVarp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP, nodep->name() + "__en" + cvtToStr(m_unique++), VFlagBitPacked(), enModVarp->width()); + enModVarp->direction(VDirection::INPUT); UINFO(9, " newenv " << enVarp << endl); AstPin* enpinp = new AstPin(nodep->fileline(), nodep->pinNum(), diff --git a/test_regress/t/t_altera_lpm_mult_noinl.pl b/test_regress/t/t_altera_lpm_mult_noinl.pl new file mode 100755 index 000000000..2eac39a3a --- /dev/null +++ b/test_regress/t/t_altera_lpm_mult_noinl.pl @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +scenarios(vlt_all => 1); + +top_filename("t/t_altera_lpm.v"); +(my $module = $Self->{name}) =~ s/.*t_altera_//; +$module =~ s/_noinl//; + +compile( + verilator_flags2 => ["--top-module ${module}", "-Oi"] + ); + +ok(1); +1;