/** * Completes RegisterRead and RegisterWrite connections passed up to the top-level as side-band * ports and buses. * * @param design the Design which has Registers * @param frame the ConnectionFrame which describes the read/write connections */ private void connectGlobalRegisters(Design design, ConnectionFrame frame) { // boolean isLittleEndian = EngineThread.getGenericJob() // .getUnscopedBooleanOptionValue(OptionRegistry.LITTLE_ENDIAN); for (Register register : design.getRegisters()) { List<Connection> readList = frame.getReadConnections(register); List<Connection> writeList = frame.getWriteConnections(register); if (readList.isEmpty() && writeList.isEmpty()) { continue; } Component regPhys = register.makePhysicalComponent(readList, writeList); if (register.getInputSwapper() != null) { design.getDesignModule().addComponent(register.getInputSwapper()); } design.getDesignModule().addComponent(regPhys); if (register.getOutputSwapper() != null) { design.getDesignModule().addComponent(register.getOutputSwapper()); } assert regPhys != null; if (!writeList.isEmpty()) { final Iterator<Port> writePortIter = regPhys.getDataPorts().iterator(); for (Iterator<Connection> writeListIter = writeList.iterator(); writeListIter.hasNext(); ) { final RegisterWriteConnection writeConn = (RegisterWriteConnection) writeListIter.next(); if (writeConn != null) { assert writePortIter.hasNext() : "Too few ports on register physical (enable)"; final Port enablePort = writePortIter.next(); assert writePortIter.hasNext() : "Too few ports on register physical (data)"; final Port dataPort = writePortIter.next(); enablePort.setBus(writeConn.getEnable()); dataPort.setBus(writeConn.getData()); } } } if (!readList.isEmpty()) { Bus registerResultBus = null; Exit physicalExit = regPhys.getExit(Exit.DONE); registerResultBus = physicalExit.getDataBuses().get(0); for (Connection connection : readList) { RegisterReadConnection rp = (RegisterReadConnection) connection; // The read connetion may be null because we had // to pad out the pairs in the connection list for // the referee. if (rp != null) { rp.getDataPort().setBus(registerResultBus); } } } } }
/** * The Design should be the first Visitable that is visited by the GlobalConnector, indicating the * initialization of processing. * * @param design Description of Parameter */ @Override public void visit(Design design) { if (_schedule.db) { _schedule.ln(_schedule.GVISIT, "visiting design " + design); } final GenericJob job = EngineThread.getGenericJob(); this.design = design; beginFrame(); traverse(design); connectGlobalRegisters(design, getFrame()); generateKickers(); if (job.getUnscopedBooleanOptionValue(OptionRegistry.NO_BLOCK_IO)) { connectTasks(design); } design.accept(new MemoryConnectionVisitor()); // Connect all SimplePinRead and SimplePinWrite accesses to // their targetted pins. design.accept(new SimplePinConnector()); // Connect clock and reset to all design module elements. Do // this last in case any of the other connectors add global // level stuff. for (Component designComp : design.getDesignModule().getComponents()) { // Find the clock domain for each design level element and // connect the clock and/or reset pins. final String domainSpec = (String) ((OptionString) EngineThread.getGenericJob().getOption(OptionRegistry.CLOCK_DOMAIN)) .getValue(designComp.getSearchLabel()); assert domainSpec != null : "No clock domain specifier found for " + designComp; design.getClockDomain(domainSpec).connectComponentToDomain(designComp); } }