Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter typespec issue #2117

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
# can also be installed on the system. This cmake is largely copied from the
# Surelog cmake

project(SYNLIG VERSION 1.76)
project(SYNLIG VERSION 1.77)

# Detect build type, fallback to release and throw a warning if use didn't
# specify any
Expand Down
20 changes: 20 additions & 0 deletions frontends/systemverilog/uhdm_ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,13 @@ void UhdmAst::visit_default_expr(vpiHandle obj_h)
});
}

void UhdmAst::process_array_expr(const UHDM::BaseClass *object)
{
// Array expr are created in the UHDM elaborated model to model expanded default pattern assigns.
// They are not processed so far by the plugin. The plugin processes the non-expanded version in the non-elab model.
alaindargelas marked this conversation as resolved.
Show resolved Hide resolved
// Creating a function that is a no-op for now to enable traversing UHDM without error
}

AST::AstNode *UhdmAst::process_value(vpiHandle obj_h)
{
s_vpi_value val;
Expand Down Expand Up @@ -4054,6 +4061,11 @@ void UhdmAst::process_assignment_pattern_op()
std::vector<AST::AstNode *> assignments;
visit_one_to_many({vpiOperand}, obj_h, [&](AST::AstNode *node) {
if (node->type == AST::AST_ASSIGN || node->type == AST::AST_ASSIGN_EQ || node->type == AST::AST_ASSIGN_LE) {
if (assign_node == nullptr) {
// Parameter assigns are not assigns per-se, the find_ancestor returns nullptr, but an assign is created in the visit_one_to_many,
// selecting this assign for the downstream processing
assign_node = node;
}
assignments.push_back(node);
} else {
current_node->children.push_back(node);
Expand Down Expand Up @@ -4971,6 +4983,11 @@ void UhdmAst::process_parameter()
auto it = shared.param_types.find(current_node->str);
if (it == shared.param_types.end())
shared.param_types.insert(std::make_pair(current_node->str, node->clone()));
} else {
// parameter type
auto it = shared.param_types.find(current_node->str);
if (it == shared.param_types.end())
shared.param_types.insert(std::make_pair(current_node->str, node->clone()));
}
if (node && node->attributes.count(UhdmAst::packed_ranges())) {
for (auto r : node->attributes[UhdmAst::packed_ranges()]->children) {
Expand Down Expand Up @@ -5445,6 +5462,9 @@ AST::AstNode *UhdmAst::process_object(vpiHandle obj_handle)
case vpiClockingBlock:
process_unsupported_stmt(object);
break;
case vpiArrayExpr:
process_array_expr(object);
break;
case vpiTypeParameter:
process_type_parameter();
break;
Expand Down
1 change: 1 addition & 0 deletions frontends/systemverilog/uhdm_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class UhdmAst
void process_type_parameter();
void simplify_parameter(::Yosys::AST::AstNode *parameter, ::Yosys::AST::AstNode *module_node = nullptr);
void process_unsupported_stmt(const UHDM::BaseClass *object, bool is_error = true);
void process_array_expr(const UHDM::BaseClass *object);

UhdmAst(UhdmAst *p, UhdmAstShared &s, const std::string &i) : parent(p), shared(s), indent(i)
{
Expand Down
1 change: 1 addition & 0 deletions tests/formal/passlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ simple:ParameterPassedToSubmoduleInGenscopeOfSubmodule/top.sv
simple:ParameterPassedToSubmoduleOfSubmodule/top.sv
simple:ParameterRangeUsingDot/top.sv
simple:ParameterSizeOfInstance/top.sv
simple:ParameterType/dut.sv
simple:ParameterUnpackedArray/top.sv
simple:ParameterUnpackedLogicArray/top.sv
simple:ParameterUnsignedInt/top.sv
Expand Down
2 changes: 2 additions & 0 deletions tests/simple_tests/ParameterType/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TEST_FILES := $(TEST_DIR)/dut.sv
TOP_MODULE := dut
6 changes: 6 additions & 0 deletions tests/simple_tests/ParameterType/dut.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

module dut(input logic clk);
alaindargelas marked this conversation as resolved.
Show resolved Hide resolved
alaindargelas marked this conversation as resolved.
Show resolved Hide resolved

localparam int GW_CONFIG2[2:0] = '{default:0} ;
alaindargelas marked this conversation as resolved.
Show resolved Hide resolved
alaindargelas marked this conversation as resolved.
Show resolved Hide resolved

endmodule
6 changes: 6 additions & 0 deletions tests/simple_tests/ParameterType/yosys_script.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source ../yosys_common.tcl

prep -top \\dut
write_verilog
write_verilog yosys.sv
sim -clock clk -rstlen 10 -vcd dump.vcd
2 changes: 1 addition & 1 deletion third_party/surelog
Submodule surelog updated 37 files
+1 −1 .github/workflows/non_vendored.yml
+1 −1 .gitmodules
+1 −1 CMakeLists.txt
+1 −0 include/Surelog/ErrorReporting/ErrorDefinition.h
+29 −0 src/DesignCompile/CompileType.cpp
+49 −0 src/DesignCompile/Elaboration_test.cpp
+2 −0 src/ErrorReporting/ErrorDefinition.cpp
+44 −11 tests/CastTypespec/CastTypespec.log
+192 −17 tests/DollarRoot/DollarRoot.log
+1,295 −0 tests/HierPathUnpacked/HierPathUnpacked.log
+1 −0 tests/HierPathUnpacked/HierPathUnpacked.sl
+36 −0 tests/HierPathUnpacked/dut.sv
+1,299 −0 tests/HierPathUnpackedInPacked/HierPathUnpackedInPacked.log
+1 −0 tests/HierPathUnpackedInPacked/HierPathUnpackedInPacked.sl
+36 −0 tests/HierPathUnpackedInPacked/dut.sv
+4 −4 tests/SimpleClass1/SimpleClass1.log
+4 −4 tests/SimpleInterface/SimpleInterface.log
+62 −14 tests/VirtualClass/VirtualClass.log
+1 −1 third_party/UHDM
+6 −6 third_party/tests/AVLMM/AVLMM.log
+4 −4 third_party/tests/AmiqEth/AmiqEth.log
+4 −4 third_party/tests/AmiqSimpleTestSuite/AmiqSimpleTestSuite.log
+4 −4 third_party/tests/BuildUVMPkg/BuildUVMPkg.log
+8 −8 third_party/tests/CoresSweRV/CoresSweRV.log
+16 −16 third_party/tests/CoresSweRVMP/CoresSweRVMP.log
+4 −4 third_party/tests/Driver/Driver.log
+4 −4 third_party/tests/Ibex/Ibex.log
+4 −4 third_party/tests/IbexGoogle/IbexGoogle.log
+4 −4 third_party/tests/MiniAmiq/MiniAmiq.log
+4 −4 third_party/tests/Monitor/Monitor.log
+8 −8 third_party/tests/Opentitan/Opentitan.log
+4 −4 third_party/tests/Scoreboard/Scoreboard.log
+4 −4 third_party/tests/SeqDriver/SeqDriver.log
+4 −4 third_party/tests/SimpleUVM/SimpleUVM.log
+4 −4 third_party/tests/UVMNestedSeq/UVMNestedSeq.log
+4 −4 third_party/tests/UVMSwitch/UVMSwitch.log
+4 −4 third_party/tests/UnitAmiqEth/UnitAmiqEth.log
Loading