Added DbU::toCeil() & DbU::toFloor() for rounding on a dedicated step.

This commit is contained in:
Jean-Paul Chaput 2021-02-01 16:13:16 +01:00
parent 95d3ca5344
commit 48357c37a9
2 changed files with 10 additions and 7 deletions

View File

@ -17,9 +17,7 @@
// not, see <http://www.gnu.org/licenses/>.
// ****************************************************************************************************
#ifndef HURRICANE_CELL_H
#define HURRICANE_CELL_H
#pragma once
#include <limits>
#include "hurricane/Flags.h"
#include "hurricane/Observer.h"
@ -502,7 +500,7 @@ class Cell : public Entity {
public: void setAbutmentBox(const Box& abutmentBox);
public: void slaveAbutmentBox(Cell*);
public: void unslaveAbutmentBox(Cell*);
public: void setTerminalNetlist(bool isTerminalNetlist) {_flags.set(Flags::TerminalNetlist,isTerminalNetlist);};
public: void setTerminalNetlist(bool isTerminalNetlist) { _flags.set(Flags::TerminalNetlist,isTerminalNetlist); };
public: void setPad(bool isPad) {_flags.set(Flags::Pad,isPad);};
public: void setFeed(bool isFeed) {_flags.set(Flags::Feed,isFeed);};
public: void setRouted(bool isRouted) {_flags.set(Flags::Routed,isRouted);};
@ -589,9 +587,6 @@ INSPECTOR_P_SUPPORT(Hurricane::Cell::MarkerSet);
INSPECTOR_PR_SUPPORT(Hurricane::Cell::SlavedsRelation);
#endif // HURRICANE_CELL_H
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
// ****************************************************************************************************

View File

@ -107,6 +107,8 @@ namespace Hurricane {
static inline void setSymbolicSnapGridStep ( DbU::Unit step );
static DbU::Unit getOnCustomGrid ( DbU::Unit u, DbU::Unit step, SnapMode mode=Nearest );
static inline DbU::Unit getOnPhysicalGrid ( DbU::Unit u, SnapMode mode=Superior );
static inline DbU::Unit toCeil ( DbU::Unit u, DbU::Unit step );
static inline DbU::Unit toFloor ( DbU::Unit u, DbU::Unit step );
// Conversions.
static inline Unit toDb ( Unit u );
static inline double toGrid ( Unit u );
@ -193,6 +195,12 @@ namespace Hurricane {
inline void DbU::setPolygonStep ( DbU::Unit step ) { _polygonStep = step; }
inline DbU::Unit DbU::getOnPhysicalGrid ( DbU::Unit u, SnapMode mode ) { return getOnCustomGrid(u, grid(1), mode); }
inline DbU::Unit DbU::toCeil ( DbU::Unit u, DbU::Unit step )
{ DbU::Unit modulo = u % step; return (modulo) ? (u + step - modulo) : u; }
inline DbU::Unit DbU::toFloor ( DbU::Unit u, DbU::Unit step )
{ DbU::Unit modulo = u % step; return (modulo) ? (u - modulo) : u; }
} // End of Hurricane namespace.