mirror of
https://github.com/verilator/verilator.git
synced 2026-09-07 01:52:17 +02:00
Support basic constrained random for multi-dimensional dynamic array and queue (#5591)
This commit is contained in:
+7
-3
@@ -618,7 +618,8 @@ class ConstraintExprVisitor final : public VNVisitor {
|
||||
VAccess::READWRITE},
|
||||
"write_var"};
|
||||
uint32_t dimension = 0;
|
||||
if (VN_IS(varp->dtypep(), UnpackArrayDType)) {
|
||||
if (VN_IS(varp->dtypep(), UnpackArrayDType) || VN_IS(varp->dtypep(), DynArrayDType)
|
||||
|| VN_IS(varp->dtypep(), QueueDType)) {
|
||||
const std::pair<uint32_t, uint32_t> dims
|
||||
= varp->dtypep()->dimensions(/*includeBasic=*/true);
|
||||
const uint32_t unpackedDimensions = dims.second;
|
||||
@@ -631,8 +632,11 @@ class ConstraintExprVisitor final : public VNVisitor {
|
||||
varRefp->classOrPackagep(classOrPackagep);
|
||||
methodp->addPinsp(varRefp);
|
||||
size_t width = varp->width();
|
||||
if (VN_IS(varp->dtypep(), DynArrayDType) || VN_IS(varp->dtypep(), QueueDType))
|
||||
width = varp->dtypep()->subDTypep()->width();
|
||||
AstNodeDType* tmpDtypep = varp->dtypep();
|
||||
while (VN_IS(tmpDtypep, UnpackArrayDType) || VN_IS(tmpDtypep, DynArrayDType)
|
||||
|| VN_IS(tmpDtypep, QueueDType))
|
||||
tmpDtypep = tmpDtypep->subDTypep();
|
||||
width = tmpDtypep->width();
|
||||
methodp->addPinsp(
|
||||
new AstConst{varp->dtypep()->fileline(), AstConst::Unsized64{}, width});
|
||||
AstNodeExpr* const varnamep
|
||||
|
||||
Reference in New Issue
Block a user