forked from The-OpenROAD-Project/OpenROAD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing port iterator files. Signed-off-by: Andy Fox <andy@rushc.…
…com> Signed-off-by: andyfox-rushc <[email protected]>
- Loading branch information
1 parent
f7fa1c9
commit f34ef08
Showing
2 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// BSD 3-Clause License | ||
// | ||
// Copyright (c) 2019, Nefelus Inc | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// | ||
// * Redistributions of source code must retain the above copyright notice, this | ||
// list of conditions and the following disclaimer. | ||
// | ||
// * Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// | ||
// * Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
|
||
// Generator Code Begin Cpp | ||
#include "dbModulePortItr.h" | ||
|
||
#include "dbBlock.h" | ||
#include "dbBusPort.h" | ||
#include "dbModBTerm.h" | ||
#include "dbModule.h" | ||
#include "dbTable.h" | ||
|
||
namespace odb { | ||
|
||
//////////////////////////////////////////////////////////////////// | ||
// | ||
// dbModulePortItr - Methods | ||
// | ||
//////////////////////////////////////////////////////////////////// | ||
|
||
bool dbModulePortItr::reversible() | ||
{ | ||
return true; | ||
} | ||
|
||
bool dbModulePortItr::orderReversed() | ||
{ | ||
return true; | ||
} | ||
|
||
void dbModulePortItr::reverse(dbObject* parent) | ||
{ | ||
} | ||
|
||
uint dbModulePortItr::sequential() | ||
{ | ||
return 0; | ||
} | ||
|
||
uint dbModulePortItr::size(dbObject* parent) | ||
{ | ||
uint id; | ||
uint cnt = 0; | ||
|
||
for (id = dbModulePortItr::begin(parent); id != dbModulePortItr::end(parent); | ||
id = dbModulePortItr::next(id)) { | ||
++cnt; | ||
} | ||
|
||
return cnt; | ||
} | ||
|
||
uint dbModulePortItr::begin(dbObject* parent) | ||
{ | ||
// User Code Begin begin | ||
_dbModule* _module = (_dbModule*) parent; | ||
return _module->_modbterms; | ||
// User Code End begin | ||
} | ||
|
||
uint dbModulePortItr::end(dbObject* /* unused: parent */) | ||
{ | ||
return 0; | ||
} | ||
|
||
uint dbModulePortItr::next(uint id, ...) | ||
{ | ||
// User Code Begin next | ||
_dbModBTerm* modbterm = _modbterm_tbl->getPtr(id); | ||
if (modbterm->_busPort != 0) { | ||
_dbBlock* block = (_dbBlock*) modbterm->getOwner(); | ||
_dbBusPort* bus_port = block->_busport_tbl->getPtr(modbterm->_busPort); | ||
if (bus_port) { | ||
modbterm = _modbterm_tbl->getPtr(bus_port->_last); | ||
} | ||
} | ||
if (modbterm) { | ||
return modbterm->_next_entry; | ||
} | ||
return 0; | ||
// User Code End next | ||
} | ||
|
||
dbObject* dbModulePortItr::getObject(uint id, ...) | ||
{ | ||
return _modbterm_tbl->getPtr(id); | ||
} | ||
} // namespace odb | ||
// Generator Code End Cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// BSD 3-Clause License | ||
// | ||
// Copyright (c) 2020, The Regents of the University of California | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// | ||
// * Redistributions of source code must retain the above copyright notice, this | ||
// list of conditions and the following disclaimer. | ||
// | ||
// * Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// | ||
// * Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
|
||
// Generator Code Begin Header | ||
#pragma once | ||
|
||
#include "odb/dbIterator.h" | ||
#include "odb/odb.h" | ||
|
||
namespace odb { | ||
class _dbModBTerm; | ||
|
||
template <class T> | ||
class dbTable; | ||
|
||
class dbModulePortItr : public dbIterator | ||
{ | ||
public: | ||
dbModulePortItr(dbTable<_dbModBTerm>* modbterm_tbl) | ||
{ | ||
_modbterm_tbl = modbterm_tbl; | ||
} | ||
|
||
bool reversible() override; | ||
bool orderReversed() override; | ||
void reverse(dbObject* parent) override; | ||
uint sequential() override; | ||
uint size(dbObject* parent) override; | ||
uint begin(dbObject* parent) override; | ||
uint end(dbObject* parent) override; | ||
uint next(uint id, ...) override; | ||
dbObject* getObject(uint id, ...) override; | ||
|
||
private: | ||
dbTable<_dbModBTerm>* _modbterm_tbl; | ||
// User Code Begin Fields | ||
dbModulePortItr* _port_iter = nullptr; | ||
// User Code End Fields | ||
}; | ||
|
||
} // namespace odb | ||
// Generator Code End Header |