Support multi-dimensional packed vectors as class properties

Currently multi-dimensional packed vector class properties will cause an
assert and only single dimensional or scalar vectors will pass.

But just as for regular vectors there is nothing special about class
property multi-dimensional vectors as they will be represented in vector
form in vvp.

Removing the asserts allows multi-dimensional packed vectors to be used for
class properties. Indexed access to these properties is not supported yet;
that requires follow-up work to elaborate packed property selects and to
support partial stores to vector class properties.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2023-12-27 08:57:20 -08:00
parent 311c22e4de
commit 3e72713971
2 changed files with 3 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2012-2026 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -28,7 +28,6 @@ static void show_prop_type_vector(ivl_type_t ptype)
{
ivl_variable_type_t data_type = ivl_type_base(ptype);
unsigned packed_dimensions = ivl_type_packed_dimensions(ptype);
assert(packed_dimensions < 2);
const char*signed_flag = ivl_type_signed(ptype)? "s" : "";
char code = data_type==IVL_VT_BOOL? 'b' : 'L';
@ -37,12 +36,8 @@ static void show_prop_type_vector(ivl_type_t ptype)
fprintf(vvp_out, "\"%s%c1\"", signed_flag, code);
} else {
assert(packed_dimensions == 1);
assert(ivl_type_packed_lsb(ptype,0) == 0);
assert(ivl_type_packed_msb(ptype,0) >= 0);
fprintf(vvp_out, "\"%s%c%d\"", signed_flag, code,
ivl_type_packed_msb(ptype,0)+1);
ivl_type_packed_width(ptype));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -1319,10 +1319,6 @@ static int show_stmt_assign_sig_cobject(ivl_statement_t net)
if (ivl_type_base(prop_type) == IVL_VT_BOOL ||
ivl_type_base(prop_type) == IVL_VT_LOGIC) {
assert(ivl_type_packed_dimensions(prop_type) == 0 ||
(ivl_type_packed_dimensions(prop_type) == 1 &&
ivl_type_packed_msb(prop_type,0) >= ivl_type_packed_lsb(prop_type, 0)));
if (ivl_stmt_opcode(net) != 0) {
fprintf(vvp_out, " %%prop/v %d;\n", prop_idx);
}