From 48357c37a91355d92df03dbe46c8273a6e33c98c Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 1 Feb 2021 16:13:16 +0100 Subject: [PATCH] Added DbU::toCeil() & DbU::toFloor() for rounding on a dedicated step. --- hurricane/src/hurricane/hurricane/Cell.h | 9 ++------- hurricane/src/hurricane/hurricane/DbU.h | 8 ++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index fa9c18f7..27819159 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -17,9 +17,7 @@ // not, see . // **************************************************************************************************** -#ifndef HURRICANE_CELL_H -#define HURRICANE_CELL_H - +#pragma once #include #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 // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index be2f830b..23a634f1 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -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.