mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Internals: V3Slice style cleanup. No functional change; ignore whitespace
This commit is contained in:
parent
7695687e87
commit
e0ad430cd9
@ -50,8 +50,8 @@ protected:
|
||||
m_inUnpacked = true;
|
||||
if (VN_IS(nodep->dtypep()->skipRefp(), AssocArrayDType)) {
|
||||
// Note the double {{ initializer. The first { starts the initializer of the
|
||||
// VlUnpacked, and the second starts the initializer of m_storage within the
|
||||
// VlUnpacked.
|
||||
// VlAssocArray, and the second starts the initializer of m_storage within the
|
||||
// VlAssocArray.
|
||||
puts("{");
|
||||
ofp()->putsNoTracking("{");
|
||||
puts("\n");
|
||||
|
@ -31,7 +31,7 @@
|
||||
// ARRAYSEL
|
||||
// Modify bitp() for the new value and set ->length(1)
|
||||
//
|
||||
// TODO: This code was written before SLICESEL was a type it might be
|
||||
// TODO: This code was written before SLICESEL was a type, it might be
|
||||
// simplified to look primarily for SLICESELs.
|
||||
//*************************************************************************
|
||||
|
||||
@ -54,13 +54,12 @@ class SliceVisitor final : public VNVisitor {
|
||||
// AstInitItem::user2() -> Corresponding first elemIdx
|
||||
const VNUser2InUse m_inuser2;
|
||||
|
||||
// STATE
|
||||
// STATE - for current visit position (use VL_RESTORER)
|
||||
AstNode* m_assignp = nullptr; // Assignment we are under
|
||||
bool m_assignError = false; // True if the current assign already has an error
|
||||
bool m_okInitArray = false; // Allow InitArray children
|
||||
|
||||
// METHODS
|
||||
|
||||
AstNodeExpr* cloneAndSel(AstNode* nodep, int elements, int elemIdx) {
|
||||
// Insert an ArraySel, except for a few special cases
|
||||
const AstUnpackArrayDType* const arrayp
|
||||
@ -221,10 +220,13 @@ class SliceVisitor final : public VNVisitor {
|
||||
|
||||
void visit(AstNodeAssign* nodep) override {
|
||||
// Called recursively on newly created assignments
|
||||
if (!nodep->user1() && !VN_IS(nodep, AssignAlias)) {
|
||||
nodep->user1(true);
|
||||
m_assignError = false;
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
if (VN_IS(nodep, AssignAlias)) return;
|
||||
if (debug() >= 9) nodep->dumpTree("- Deslice-In: ");
|
||||
VL_RESTORER(m_assignError);
|
||||
VL_RESTORER(m_assignp);
|
||||
m_assignError = false;
|
||||
m_assignp = nodep;
|
||||
AstNodeDType* const dtp = nodep->lhsp()->dtypep()->skipRefp();
|
||||
AstNode* stp = nodep->rhsp();
|
||||
if (const AstUnpackArrayDType* const arrayp = VN_CAST(dtp, UnpackArrayDType)) {
|
||||
@ -251,11 +253,8 @@ class SliceVisitor final : public VNVisitor {
|
||||
return;
|
||||
}
|
||||
}
|
||||
VL_RESTORER(m_assignp);
|
||||
m_assignp = nodep;
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
|
||||
void visit(AstConsPackUOrStruct* nodep) override {
|
||||
VL_RESTORER(m_okInitArray);
|
||||
@ -278,8 +277,7 @@ class SliceVisitor final : public VNVisitor {
|
||||
}
|
||||
|
||||
void expandBiOp(AstNodeBiop* nodep) {
|
||||
if (!nodep->user1()) {
|
||||
nodep->user1(true);
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
// If it's an unpacked array, blow it up into comparing each element
|
||||
AstNodeDType* const fromDtp = nodep->lhsp()->dtypep()->skipRefp();
|
||||
UINFO(9, " Bi-Eq/Neq expansion " << nodep << endl);
|
||||
@ -299,8 +297,8 @@ class SliceVisitor final : public VNVisitor {
|
||||
const int elements = adtypep->rangep()->elementsConst();
|
||||
for (int elemIdx = 0; elemIdx < elements; ++elemIdx) {
|
||||
// EQ(a,b) -> LOGAND(EQ(ARRAYSEL(a,0), ARRAYSEL(b,0)), ...[1])
|
||||
AstNodeBiop* const clonep = VN_AS(
|
||||
nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, elemIdx),
|
||||
AstNodeBiop* const clonep
|
||||
= VN_AS(nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, elemIdx),
|
||||
cloneAndSel(nodep->rhsp(), elements, elemIdx)),
|
||||
NodeBiop);
|
||||
if (!logp) {
|
||||
@ -329,7 +327,6 @@ class SliceVisitor final : public VNVisitor {
|
||||
}
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
void visit(AstEq* nodep) override { expandBiOp(nodep); }
|
||||
void visit(AstNeq* nodep) override { expandBiOp(nodep); }
|
||||
void visit(AstEqCase* nodep) override { expandBiOp(nodep); }
|
||||
|
Loading…
Reference in New Issue
Block a user