import Cfg
from Hurricane import Box
from coriolis2.settings import af
-from utils import Module, SessionManager
+from utils import Module, SessionManager, Config
import symbolic.cmos # do not remove
def coriolis_setup():
- Cfg.Configuration.pushDefaultPriority(Cfg.Parameter.Priority.UserFile)
- Cfg.getParamBool('misc.catchCore').setBool(False)
- Cfg.getParamBool('misc.info').setBool(False)
- Cfg.getParamBool('misc.paranoid').setBool(False)
- Cfg.getParamBool('misc.bug').setBool(False)
- Cfg.getParamBool('misc.logMode').setBool(True)
- Cfg.getParamBool('misc.verboseLevel1').setBool(True)
- Cfg.getParamBool('misc.verboseLevel2').setBool(True)
- Cfg.getParamEnumerate('etesian.effort').setInt(2)
- Cfg.getParamPercentage('etesian.spaceMargin').setPercentage(20.0)
- Cfg.getParamPercentage('etesian.aspectRatio').setPercentage(100.0)
- Cfg.getParamBool('etesian.uniformDensity').setBool(True)
- Cfg.getParamInt('anabatic.edgeLenght').setInt(24)
- Cfg.getParamInt('anabatic.edgeWidth').setInt(8)
- Cfg.getParamString('anabatic.topRoutingLayer').setString('METAL5')
- Cfg.getParamInt('katana.searchHalo').setInt(30)
- Cfg.getParamInt('katana.eventsLimit').setInt(1000000)
- Cfg.getParamInt('katana.hTracksReservedLocal').setInt(7)
- Cfg.getParamInt('katana.vTracksReservedLocal').setInt(6)
-
- env = af.getEnvironment()
- env.setCLOCK('^clk$|m_clock')
- env.setPOWER('vdd')
- env.setGROUND('vss')
-
- Cfg.Configuration.popDefaultPriority()
+ with Config(Cfg.Parameter.Priority.UserFile) as cfg:
+ cfg.misc_catchCore = False
+ cfg.misc_info = False
+ cfg.misc_paranoid = False
+ cfg.misc_bug = False
+ cfg.misc_logMode = True
+ cfg.misc_verboseLevel1 = True
+ cfg.misc_verboseLevel2 = True
+ cfg.etesian_effort = 2
+ cfg.etesian_spaceMargin = "20.0%"
+ cfg.etesian_aspectRatio = "100.0%"
+ cfg.etesian_uniformDensity = True
+ cfg.anabatic_edgeLenght = 24
+ cfg.anabatic_edgeWidth = 8
+ cfg.anabatic_topRoutingLayer = 'METAL5'
+ cfg.katana_searchHalo = 30
+ cfg.katana_eventsLimit = 1000000
+ cfg.katana_hTracksReservedLocal = 7
+ cfg.katana_vTracksReservedLocal = 6
+
+ env = af.getEnvironment()
+ env.setCLOCK('^clk$|m_clock')
+ env.setPOWER('vdd')
+ env.setGROUND('vss')
class AddSub(Module):
import Anabatic
import CRL
+import Cfg
import Etesian
import Katana
from Hurricane import (
""" Main routine. """
raise NotImplementedError('You need to implement the `build` method.')
+
+class Config:
+
+ def __init__(self, priority=None):
+ self._priority = priority
+
+ def __enter__(self):
+ if self._priority is not None:
+ Cfg.Configuration.pushDefaultPriority(self._priority)
+ return self
+
+ def __setattr__(self, attr, val):
+ if attr.startswith("_"):
+ self.__dict__[attr] = val
+ return
+ attr = attr.replace("_", ".")
+ if isinstance(val, bool):
+ Cfg.getParamBool(attr).setBool(val)
+ elif isinstance(val, int):
+ p = Cfg.getParamInt(attr) # all params have a type
+ if p.type == 'Enumerate':
+ Cfg.getParamEnumerate(attr).setInt(val)
+ else:
+ Cfg.getParamInt(attr).setInt(val)
+ elif '%' in val:
+ Cfg.getParamPercentage(attr).setPercentage(float(val[:-1]))
+ else:
+ Cfg.getParamString(attr).setString(val)
+
+ def __exit__(self, *args):
+ if self._priority is not None:
+ Cfg.Configuration.popDefaultPriority()
+