📄 flat.java
字号:
* node references to insure that they have been included in the cross * reference table for the model. Returns true on error. * * Calling Arguments: * cellHead = pointer to the cross reference data structure for the model * that is going to be flattened * modHead = pointer to the dtat structure containing the hierarchical * node references */ private void processGate(ALS.Connect cellHead, ALS.Model modHead) { primPtr2 = new ALS.Model(modHead.name, 'G'); primPtr2.fanOut = modHead.fanOut; primPtr2.priority = modHead.priority; primPtr2.level = als.computePathName(cellHead); als.primList.add(primPtr2); ALS.Row rowHead = (ALS.Row)modHead.ptr; ALS.Row last = null; while (rowHead != null) { ALS.Row rowPtr2 = new ALS.Row(); rowPtr2.inList = new ArrayList<Object>(); rowPtr2.outList = new ArrayList<Object>(); rowPtr2.delta = rowHead.delta; rowPtr2.linear = rowHead.linear; rowPtr2.exp = rowHead.exp; rowPtr2.abs = rowHead.abs; rowPtr2.random = rowHead.random; rowPtr2.delay = rowHead.delay; if (rowHead.delay == null) rowPtr2.delay = null; else rowPtr2.delay = rowHead.delay; rowPtr2.next = null; if (last == null) { primPtr2.ptr = rowPtr2; } else { last.next = rowPtr2; } last = rowPtr2; als.ioPtr1 = rowPtr2.inList; processIOEntry(modHead, cellHead, rowHead.inList, 'I'); als.ioPtr1 = rowPtr2.outList; processIOEntry(modHead, cellHead, rowHead.outList, 'O'); rowHead = rowHead.next; } } /** * Method to step through the node references contained within a * row of a transition table and insures that they are included in the cross * reference table in the event they were not previously specified in a * connection statement. Returns true on error. * * Calling Arguments: * modHead = pointer to model that is being flattened * cellHead = pointer to the cross reference data structure for the model * that is going to be flattened * ioHead = pointer to a row of node references to be checked for * entry into the cross reference table * flag = character indicating if the node is an input or output */ private void processIOEntry(ALS.Model modHead, ALS.Connect cellHead, List<Object> ioList, char flag) { for(Object obj : ioList) { ALS.IO ioHead = (ALS.IO)obj; ALS.ALSExport xRefHead = findXRefEntry(cellHead, (String)ioHead.nodePtr); als.ioPtr2 = new ALS.IO(); als.ioPtr2.nodePtr = xRefHead.nodePtr; als.ioPtr2.operatr = ioHead.operatr; if (als.ioPtr2.operatr > 127) { xRefHead = findXRefEntry(cellHead, (String)ioHead.operand); als.ioPtr2.operand = xRefHead.nodePtr; } else { als.ioPtr2.operand = ioHead.operand; } als.ioPtr2.strength = ioHead.strength; als.ioPtr1.add(als.ioPtr2); switch (flag) { case 'I': createPinEntry(modHead, (String)ioHead.nodePtr, (ALS.Node)als.ioPtr2.nodePtr); break; case 'O': als.ioPtr2.nodePtr = createStatEntry(modHead, (String)ioHead.nodePtr, (ALS.Node)als.ioPtr2.nodePtr); } if (als.ioPtr2.operatr > 127) { createPinEntry(modHead, (String)ioHead.operand, (ALS.Node)als.ioPtr2.operand); } } } /** * Method to make an entry into the primitive input table for the * specified node. This table keeps track of the primitives which use * this node as an input for event driven simulation. Returns true on error. * * Calling Arguments: * modHead = pointer to the model structure from which the primitive * is being created * nodeName = pointer to a char string containing the name of the node * whose input list is being updated * nodeHead = pointer to the node data structure allocated for this node */ private void createPinEntry(ALS.Model modHead, String nodeName, ALS.Node nodeHead) { for(ALS.Load pinPtr1 : nodeHead.pinList) { if (pinPtr1.ptr == primPtr2) return; } ALS.Load pinPtr2 = new ALS.Load(); pinPtr2.ptr = primPtr2; nodeHead.pinList.add(pinPtr2); nodeHead.load += findLoadValue(modHead, nodeName); } /** * Method to make an entry into the database for an output which * is connected to the specified node. Statistics are maintained for each output * that is connected to a node. Returns zero on error. * * Calling Arguments: * modHead = pointer to the model structure from which the primitive * is being created * nodeName = pointer to a char string containing the name of the node * whose output list is being updated * nodeHead = pointer to the node data structure allocated for this node */ private ALS.Stat createStatEntry(ALS.Model modHead, String nodeName, ALS.Node nodeHead) { for(Stat statPtr1 : nodeHead.statList) { if (statPtr1.primPtr == primPtr2) return statPtr1; } ALS.Stat statPtr2 = new ALS.Stat(); statPtr2.primPtr = primPtr2; statPtr2.nodePtr = nodeHead; nodeHead.statList.add(statPtr2); nodeHead.load += findLoadValue(modHead, nodeName); return statPtr2; } /** * Method to return the loading factor for the specified node. If * the node can't be found in the load list it is assumed it has a default value * of 1.0. * * Calling Arguments: * modHead = pointer to the model structure from which the primitive * is being created * nodeName = pointer to a char string containing the name of the node * whose load value is to be determined */ private double findLoadValue(ALS.Model modHead, String nodeName) { for(ALS.Load loadHead : modHead.loadList) { if (loadHead.ptr.equals(nodeName)) return loadHead.load; } if (modHead.type == 'F') return 0; return 1; } /** * Method to go through the set node list for the specified cell * and generates vectors for the node. These vectors are executed at t=0 by * the simulator to initialize the node correctly. Returns true on error. * * Calling Arguments: * cellHead = pointer to the cross reference table where the node locations * are to be found * ioHead = pointer to the set list containing node names and state info */ private void processSetEntry(ALS.Connect cellHead, List<ALS.IO> ioList) { for(ALS.IO ioHead : ioList) { ALS.ALSExport xRefHead = findXRefEntry(cellHead, (String)ioHead.nodePtr); ALS.Link setHead = new ALS.Link(); setHead.type = 'N'; setHead.ptr = xRefHead.nodePtr; setHead.state = ioHead.operand; setHead.strength = ioHead.strength; setHead.priority = 2; setHead.time = 0.0; setHead.right = null; als.insertSetList(setHead); } } /** * Method to step through the event driving input list for a function * and enters the function into the primitive input list for the particular node. * In addition to this task the procedure sets up the calling argument node list * for the function when it is called. Returns true on error. * * Calling Arguments: * cellHead = pointer to the cross reference data structure for the model * that is going to be flattened * modHead = pointer to the data structure containing the hierarchical * node references */ private boolean processFunction(ALS.Connect cellHead, ALS.Model modHead) { primPtr2 = new ALS.Model(modHead.name, 'F'); primPtr2.ptr = new ALS.Func(); primPtr2.priority = modHead.priority; primPtr2.level = als.computePathName(cellHead); als.primList.add(primPtr2); ALS.Func funcHead = (ALS.Func)modHead.ptr; ALS.Func funcPtr2 = (ALS.Func)primPtr2.ptr; funcPtr2.procPtr = ALS.UserProc.getFunctionAddress(modHead.name); if (funcPtr2.procPtr == null) return true; funcPtr2.inList = new ArrayList<ALS.ALSExport>(); funcPtr2.delta = funcHead.delta; funcPtr2.linear = funcHead.linear; funcPtr2.exp = funcHead.exp; funcPtr2.abs = funcHead.abs; funcPtr2.random = funcHead.random; funcPtr2.userPtr = null; for(ALS.ALSExport exHead : modHead.exList) { ALS.ALSExport xRefHead = findXRefEntry(cellHead, (String)exHead.nodeName); als.exPtr2 = new ALS.ALSExport(); if (exHead.nodePtr != null) { als.exPtr2.nodeName = createStatEntry(modHead, (String)exHead.nodeName, xRefHead.nodePtr); } else { als.exPtr2.nodeName = null; } als.exPtr2.nodePtr = xRefHead.nodePtr; primPtr2.exList.add(als.exPtr2); } for(ALS.ALSExport exHead : funcHead.inList) { ALS.ALSExport xRefHead = findXRefEntry(cellHead, (String)exHead.nodeName); als.exPtr2 = new ALS.ALSExport(); als.exPtr2.nodePtr = xRefHead.nodePtr; primPtr2.exList.add(als.exPtr2); createPinEntry(modHead, (String)exHead.nodeName, xRefHead.nodePtr); } return false; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -