From 4801f1538f3b1faa2cba77e8b40f1b37c09fca3c Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 25 Feb 2020 18:52:40 +0000 Subject: [PATCH] add first experimental hierarchical place/route --- experiments5/Makefile | 14 +- experiments5/doAlu16.py | 349 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 356 insertions(+), 7 deletions(-) create mode 100755 experiments5/doAlu16.py diff --git a/experiments5/Makefile b/experiments5/Makefile index e4cb645..ae10a00 100755 --- a/experiments5/Makefile +++ b/experiments5/Makefile @@ -5,7 +5,7 @@ DESIGN_KIT = sxlib # YOSYS_FLATTEN = Yes - USE_CLOCKTREE = Yes + USE_CLOCKTREE = No USE_DEBUG = No USE_KITE = No @@ -18,10 +18,10 @@ blif: alu_hier.blif vst: alu_hier.vst -layout: alu_hier_cts_r.ap -gds: alu_hier_cts_r.gds +layout: alu_hier_r.ap +gds: alu_hier_r.gds -lvx: lvx-alu_hier_cts_r -druc: druc-alu_hier_cts_r -view: cgt-alu_hier_cts_r -sim: asimut-alu_hier_cts_r +lvx: lvx-alu_hier_r +druc: druc-alu_hier_r +view: cgt-alu_hier_r +sim: asimut-alu_hier_r diff --git a/experiments5/doAlu16.py b/experiments5/doAlu16.py new file mode 100755 index 0000000..89968fe --- /dev/null +++ b/experiments5/doAlu16.py @@ -0,0 +1,349 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import re +import traceback +import os.path +import optparse +import Cfg +import Hurricane +from Hurricane import DbU +from Hurricane import DataBase +from Hurricane import UpdateSession +from Hurricane import Breakpoint +from Hurricane import Box +from Hurricane import Transformation +from Hurricane import Instance +from Hurricane import Pin +import Viewer +import CRL +import Etesian +import Anabatic +import Katana +import Unicorn +from helpers import l, u, n +import plugins.RSavePlugin +import symbolic.cmos + +af = CRL.AllianceFramework.get() + +Cfg.Configuration.pushDefaultPriority( Cfg.Parameter.Priority.UserFile ) + +cellsTop = '~/alliance-check-toolkit/cells' +env = af.getEnvironment() +env.addSYSTEM_LIBRARY( library=cellsTop+'/nsxlib', mode=CRL.Environment.Prepend ) +env.addSYSTEM_LIBRARY( library=cellsTop+'/mpxlib', mode=CRL.Environment.Prepend ) + + +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.getParamInt ( 'misc.minTraceLevel' ).setInt ( 159 ) +#Cfg.getParamInt ( 'misc.maxTraceLevel' ).setInt ( 160 ) +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 ( 'METAL4') +Cfg.getParamInt ( 'katana.eventsLimit' ).setInt ( 1000000 ) +Cfg.getParamInt ( 'katana.hTracksReservedLocal' ).setInt ( 7 ) +Cfg.getParamInt ( 'katana.vTracksReservedLocal' ).setInt ( 6 ) +#Cfg.getParamInt ( 'clockTree.minimumSide' ).setInt ( l(1000) ) + +env = af.getEnvironment() +env.setCLOCK( '^clk$|m_clock' ) +env.setPOWER( 'vdd' ) +env.setGROUND( 'vss' ) + +Cfg.Configuration.popDefaultPriority() + + +def add ( **kw ): + editor = None + if kw.has_key('editor') and kw['editor']: + editor = kw['editor'] + + db = DataBase.getDB() + print db, dir(db) + metal2 = DataBase.getDB().getTechnology().getLayer( 'metal2' ) + metal3 = DataBase.getDB().getTechnology().getLayer( 'metal3' ) + + ################### + # add + + cell = af.getCell( 'add', CRL.Catalog.State.Logical ) + print cell.getNet('a(0)') + + if not cell: + print '[ERROR] Unable to load cell "alu16.vst", aborting .' + return False + kw[ 'cell' ] = cell + + ab = Box( l( 0.0 ) + , l( 0.0 ) + , l( 2000.0 ) + , l( 800.0 ) ) + + UpdateSession.open() + cell.setAbutmentBox( ab ) + + for i in range(16): + Pin.create( cell.getNet('a(%d)' % i) + , 'a(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + if False: + Pin.create( cell.getNet('b(%d)' % i) + , 'b(%d).0' % i + , Pin.Direction.EAST + , Pin.PlacementStatus.FIXED + , metal3 + , l( 0.0 ), l( 100.0*i + 50.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + Pin.create( cell.getNet('o(%d)' % i) + , 'o(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 20.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + + if False: + Pin.create( cell.getNet('rst') + , 'p_reset.0' + , Pin.Direction.WEST + , Pin.PlacementStatus.FIXED + , metal2 + , l( 0.0 ) + , l( 140.0 ) + , l( 2.0 ) + , l( 2.0 ) + ) + UpdateSession.close() + + if editor: editor.setCell( cell ) + + etesian = Etesian.EtesianEngine.create(cell) + etesian.place() + + katana = Katana.KatanaEngine.create(cell) + katana.digitalInit () + #katana.runNegociatePreRouted() + print dir(katana) + katana.runGlobalRouter (0) + katana.loadGlobalRouting ( Anabatic.EngineLoadGrByNet ) + katana.layerAssign ( Anabatic.EngineNoNetLayerAssign ) + katana.runNegociate ( Katana.Flags.NoFlags ) + katana.finalizeLayout () + print dir(katana) + success = katana.getSuccessState() + katana.destroy() + + #af.saveCell( cell, CRL.Catalog.State.Views ) + plugins.RSavePlugin.ScriptMain( **kw ) + +def sub(**kw): + + editor = None + if kw.has_key('editor') and kw['editor']: + editor = kw['editor'] + + db = DataBase.getDB() + print db, dir(db) + metal2 = DataBase.getDB().getTechnology().getLayer( 'metal2' ) + metal3 = DataBase.getDB().getTechnology().getLayer( 'metal3' ) + + ################### + # sub + + cell = af.getCell( 'sub', CRL.Catalog.State.Logical ) + print cell.getNet('a(0)') + + if not cell: + print '[ERROR] Unable to load cell "alu16.vst", aborting .' + return False + kw[ 'cell' ] = cell + + ab = Box( l( 0.0 ) + , l( 0.0 ) + , l( 2000.0 ) + , l( 800.0 ) ) + + UpdateSession.open() + cell.setAbutmentBox( ab ) + + for i in range(16): + Pin.create( cell.getNet('a(%d)' % i) + , 'a(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + if False: + Pin.create( cell.getNet('b(%d)' % i) + , 'b(%d).0' % i + , Pin.Direction.EAST + , Pin.PlacementStatus.FIXED + , metal3 + , l( 0.0 ), l( 100.0*i + 50.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + Pin.create( cell.getNet('o(%d)' % i) + , 'o(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 20.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + + if False: + Pin.create( cell.getNet('rst') + , 'p_reset.0' + , Pin.Direction.WEST + , Pin.PlacementStatus.FIXED + , metal2 + , l( 0.0 ) + , l( 140.0 ) + , l( 2.0 ) + , l( 2.0 ) + ) + UpdateSession.close() + + if editor: editor.setCell( cell ) + + etesian = Etesian.EtesianEngine.create(cell) + etesian.place() + + katana = Katana.KatanaEngine.create(cell) + katana.digitalInit () + #katana.runNegociatePreRouted() + print dir(katana) + katana.runGlobalRouter (0) + katana.loadGlobalRouting ( Anabatic.EngineLoadGrByNet ) + katana.layerAssign ( Anabatic.EngineNoNetLayerAssign ) + katana.runNegociate ( Katana.Flags.NoFlags ) + katana.finalizeLayout () + print dir(katana) + success = katana.getSuccessState() + katana.destroy() + + #af.saveCell( cell, CRL.Catalog.State.Views ) + plugins.RSavePlugin.ScriptMain( **kw ) + + print "done with add and sub" + +def alu_hier(**kw): + + editor = None + if kw.has_key('editor') and kw['editor']: + editor = kw['editor'] + + db = DataBase.getDB() + print db, dir(db) + metal2 = DataBase.getDB().getTechnology().getLayer( 'metal2' ) + metal3 = DataBase.getDB().getTechnology().getLayer( 'metal3' ) + + ################# SNX + # + + cell = af.getCell( 'alu_hier', CRL.Catalog.State.Logical ) + if not cell: + print '[ERROR] Unable to load cell "snx.vst", aborting .' + return False + kw[ 'cell' ] = cell + + ab = Box( l( 0.0 ) + , l( 0.0 ) + , l( 3100.0 ) + , l( 4100.0 ) ) + + UpdateSession.open() + cell.setAbutmentBox( ab ) + + for i in range(16): + Pin.create( cell.getNet('a(%d)' % i) + , 'a(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + Pin.create( cell.getNet('b(%d)' % i) + , 'b(%d).0' % i + , Pin.Direction.SOUTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 50.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + Pin.create( cell.getNet('o(%d)' % i) + , 'o(%d).0' % i + , Pin.Direction.NORTH + , Pin.PlacementStatus.FIXED + , metal3 + , l( 100.0*i + 25.0 ) , l( 0.0 ) # Position. + , l( 2.0 ) , l( 2.0 ) # Size. + ) + + Pin.create( cell.getNet('rst') + , 'p_reset.0' + , Pin.Direction.WEST + , Pin.PlacementStatus.FIXED + , metal2 + , l( 0.0 ) + , l( 140.0 ) + , l( 2.0 ) + , l( 2.0 ) + ) + UpdateSession.close() + + if editor: editor.setCell( cell ) + + etesian = Etesian.EtesianEngine.create(cell) + etesian.place() + + katana = Katana.KatanaEngine.create(cell) + katana.digitalInit () + #katana.runNegociatePreRouted() + print dir(katana) + katana.runGlobalRouter (0) + katana.loadGlobalRouting ( Anabatic.EngineLoadGrByNet ) + katana.layerAssign ( Anabatic.EngineNoNetLayerAssign ) + katana.runNegociate ( Katana.Flags.NoFlags ) + katana.finalizeLayout () + print dir(katana) + success = katana.getSuccessState() + katana.destroy() + + #af.saveCell( cell, CRL.Catalog.State.Views ) + plugins.RSavePlugin.ScriptMain( **kw ) + + return success + + +if __name__ == '__main__': + success = sub() + success = add() + success = alu_hier() + shellSuccess = 0 + if not success: shellSuccess = 1 + + sys.exit( shellSuccess ) + -- 2.30.2