Merge pull request #1361 from larsclausen/unpacked-lvalue-concat-error
Reject unpacked l-value concatenation operands
This commit is contained in:
commit
1751f4ed0b
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2000-2026 Stephen Williams (steve@icarus.com)
|
||||
* Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
|
|
@ -133,11 +133,13 @@ NetAssign_* PEConcat::elaborate_lval(Design*des,
|
|||
the compiler catch more errors. */
|
||||
if (tmp == 0) continue;
|
||||
|
||||
if (tmp->expr_type() == IVL_VT_REAL) {
|
||||
ivl_type_t tmp_type = tmp->net_type();
|
||||
if (tmp_type && !tmp_type->packed()) {
|
||||
cerr << parms_[idx]->get_fileline() << ": error: "
|
||||
<< "concatenation operand can not be real: "
|
||||
<< "concatenation operand must be packed: "
|
||||
<< *parms_[idx] << endl;
|
||||
des->errors += 1;
|
||||
delete tmp;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
24
elab_net.cc
24
elab_net.cc
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1999-2026 Stephen Williams (steve@icarus.com)
|
||||
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
|
|
@ -83,16 +83,22 @@ NetNet* PEConcat::elaborate_lnet_common_(Design*des, NetScope*scope,
|
|||
}
|
||||
|
||||
if (nets[idx] == 0) {
|
||||
errors += 1;
|
||||
} else if (nets[idx]->data_type() == IVL_VT_REAL) {
|
||||
cerr << parms_[idx]->get_fileline() << ": error: "
|
||||
<< "concatenation operand can no be real: "
|
||||
<< *parms_[idx] << endl;
|
||||
errors += 1;
|
||||
continue;
|
||||
} else {
|
||||
width += nets[idx]->vector_width();
|
||||
}
|
||||
ivl_type_t tmp_type = nets[idx]->array_type();
|
||||
if (!tmp_type)
|
||||
tmp_type = nets[idx]->net_type();
|
||||
|
||||
if (tmp_type && !tmp_type->packed()) {
|
||||
cerr << parms_[idx]->get_fileline() << ": error: "
|
||||
<< "concatenation operand must be packed: "
|
||||
<< *parms_[idx] << endl;
|
||||
errors += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
width += nets[idx]->vector_width();
|
||||
}
|
||||
}
|
||||
|
||||
if (errors) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
// Check that class objects can not be used in l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
endclass
|
||||
|
||||
int x;
|
||||
C c;
|
||||
|
||||
initial begin
|
||||
{x, c} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// Check that class objects can not be used in single operand l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
endclass
|
||||
|
||||
int x;
|
||||
C c;
|
||||
|
||||
initial begin
|
||||
{c} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Check that class objects can not be used in continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
endclass
|
||||
|
||||
int x;
|
||||
C c;
|
||||
int y;
|
||||
|
||||
assign {x, c} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Check that class objects can not be used in single operand continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
endclass
|
||||
|
||||
C c;
|
||||
int y;
|
||||
|
||||
assign {c} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that dynamic arrays can not be used in l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int d[];
|
||||
|
||||
initial begin
|
||||
{x, d} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that dynamic arrays can not be used in single operand l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int d[];
|
||||
|
||||
initial begin
|
||||
{d} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Check that dynamic arrays can not be used in continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int d[];
|
||||
int y;
|
||||
|
||||
assign {x, d} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that dynamic arrays can not be used in single operand continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int d[];
|
||||
int y;
|
||||
|
||||
assign {d} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that queues can not be used in l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int q[$];
|
||||
|
||||
initial begin
|
||||
{x, q} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that queues can not be used in single operand l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int q[$];
|
||||
|
||||
initial begin
|
||||
{q} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Check that queues can not be used in continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int q[$];
|
||||
int y;
|
||||
|
||||
assign {x, q} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that queues can not be used in single operand continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int q[$];
|
||||
int y;
|
||||
|
||||
assign {q} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that strings can not be used in l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
string s;
|
||||
|
||||
initial begin
|
||||
{x, s} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that strings can not be used in single operand l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
string s;
|
||||
|
||||
initial begin
|
||||
{s} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Check that strings can not be used in continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
string s;
|
||||
int y;
|
||||
|
||||
assign {x, s} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that strings can not be used in single operand continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
string s;
|
||||
int y;
|
||||
|
||||
assign {s} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that static unpacked arrays can not be used in l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int u[0:0];
|
||||
|
||||
initial begin
|
||||
{x, u} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that static unpacked arrays can not be used in single operand l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int u[0:0];
|
||||
|
||||
initial begin
|
||||
{u} = x;
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Check that static unpacked arrays can not be used in continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int x;
|
||||
int u[0:0];
|
||||
int y;
|
||||
|
||||
assign {x, u} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that static unpacked arrays can not be used in single operand continuous assignment l-value concatenations.
|
||||
|
||||
module test;
|
||||
|
||||
int u[0:0];
|
||||
int y;
|
||||
|
||||
assign {u} = y;
|
||||
|
||||
endmodule
|
||||
|
|
@ -274,6 +274,26 @@ sv_foreach9 vvp_tests/sv_foreach9.json
|
|||
sv_foreach10 vvp_tests/sv_foreach10.json
|
||||
sv_interface vvp_tests/sv_interface.json
|
||||
sv_literals vvp_tests/sv_literals.json
|
||||
sv_lval_concat_class_fail1 vvp_tests/sv_lval_concat_class_fail1.json
|
||||
sv_lval_concat_class_fail2 vvp_tests/sv_lval_concat_class_fail2.json
|
||||
sv_lval_concat_class_fail3 vvp_tests/sv_lval_concat_class_fail3.json
|
||||
sv_lval_concat_class_fail4 vvp_tests/sv_lval_concat_class_fail4.json
|
||||
sv_lval_concat_darray_fail1 vvp_tests/sv_lval_concat_darray_fail1.json
|
||||
sv_lval_concat_darray_fail2 vvp_tests/sv_lval_concat_darray_fail2.json
|
||||
sv_lval_concat_darray_fail3 vvp_tests/sv_lval_concat_darray_fail3.json
|
||||
sv_lval_concat_darray_fail4 vvp_tests/sv_lval_concat_darray_fail4.json
|
||||
sv_lval_concat_queue_fail1 vvp_tests/sv_lval_concat_queue_fail1.json
|
||||
sv_lval_concat_queue_fail2 vvp_tests/sv_lval_concat_queue_fail2.json
|
||||
sv_lval_concat_queue_fail3 vvp_tests/sv_lval_concat_queue_fail3.json
|
||||
sv_lval_concat_queue_fail4 vvp_tests/sv_lval_concat_queue_fail4.json
|
||||
sv_lval_concat_string_fail1 vvp_tests/sv_lval_concat_string_fail1.json
|
||||
sv_lval_concat_string_fail2 vvp_tests/sv_lval_concat_string_fail2.json
|
||||
sv_lval_concat_string_fail3 vvp_tests/sv_lval_concat_string_fail3.json
|
||||
sv_lval_concat_string_fail4 vvp_tests/sv_lval_concat_string_fail4.json
|
||||
sv_lval_concat_uarray_fail1 vvp_tests/sv_lval_concat_uarray_fail1.json
|
||||
sv_lval_concat_uarray_fail2 vvp_tests/sv_lval_concat_uarray_fail2.json
|
||||
sv_lval_concat_uarray_fail3 vvp_tests/sv_lval_concat_uarray_fail3.json
|
||||
sv_lval_concat_uarray_fail4 vvp_tests/sv_lval_concat_uarray_fail4.json
|
||||
sv_mixed_assign1 vvp_tests/sv_mixed_assign1.json
|
||||
sv_mixed_assign2 vvp_tests/sv_mixed_assign2.json
|
||||
sv_mixed_assign_error1 vvp_tests/sv_mixed_assign_error1.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_class_fail1.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_class_fail2.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_class_fail3.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_class_fail4.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_darray_fail1.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_darray_fail2.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_darray_fail3.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_darray_fail4.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_queue_fail1.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_queue_fail2.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_queue_fail3.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_queue_fail4.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_string_fail1.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_string_fail2.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_string_fail3.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_string_fail4.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_uarray_fail1.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_uarray_fail2.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_uarray_fail3.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_lval_concat_uarray_fail4.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
Loading…
Reference in New Issue