assert dram != null : "Could not find a dram to attach file writer to";
assert dram != null : "Could not find a dram to attach file writer to " + tile;
    private static void fileStuff(Trace[] files, RawChip chip) {        // first go thru the file, reader and writers and assign their        // input->file and file->output buffers        for (int i = 0; i < files.length; i++) {            // these traces should have only one filter, make sure            assert files[i].getHead().getNext().getNext() == files[i].getTail() : "File Trace incorrectly generated";            FilterTraceNode filter = (FilterTraceNode) files[i].getHead()                .getNext();            if (files[i].getHead().isFileWriter()) {                assert files[i].getHead().oneInput() : "buffer assignment of a joined file writer not implemented ";                FileOutputContent fileOC = (FileOutputContent) filter                    .getFilter();                RawTile tile = chip.getTile(filter.getX(), filter.getY());                IntraTraceBuffer buf = IntraTraceBuffer.getBuffer(files[i]                                                                  .getHead(), filter);                // the dram of the tile where we want to add the file writer                StreamingDram dram = null;                // get the correct port if there are two connected                for (int j = 0; j < tile.getIODevices().length; j++) {                    if (!((StreamingDram) tile.getIODevices()[j])                        .isFileWriter()) {                        dram = (StreamingDram) tile.getIODevices()[j];                        break;                    }                }                assert dram != null : "Could not find a dram to attach file writer to";                // set the port for the buffer                buf.setDRAM(dram);                // assign the other buffer to the same port                // this should not affect anything                IntraTraceBuffer.getBuffer(filter, files[i].getTail()).setDRAM(                                                                               dram);                // attach the file writer to the port                dram.setFileWriter(fileOC);            } else if (files[i].getTail().isFileReader()) {                assert files[i].getTail().oneOutput() : "buffer assignment of a split file reader not implemented ";                FileInputContent fileIC = (FileInputContent) filter.getFilter();                RawTile tile = chip.getTile(files[i].getHead().getNextFilter()                                            .getX(), files[i].getHead().getNextFilter().getY());                IntraTraceBuffer buf = IntraTraceBuffer.getBuffer(filter,                                                                  files[i].getTail());                StreamingDram dram = null;                for (int j = 0; j < tile.getIODevices().length; j++) {                    if (!((StreamingDram) tile.getIODevices()[j])                        .isFileReader()) {                        dram = (StreamingDram) tile.getIODevices()[j];                        break;                    }                }                assert dram != null : "Could not find a dram to attach the file Reader to";                buf.setDRAM(dram);                IntraTraceBuffer.getBuffer(files[i].getHead(), filter).setDRAM(dram);                dram.setFileReader(fileIC);            } else                assert false : "File trace is neither reader or writer";        }    }