void pushMatrixData(QString matrixName) { QString fileName = "/home/maltanar/spm-data/graph/" + matrixName; // TODO load matrix once & reuse for multiple SpMV iterations CSCGraph matrix(fileName); cout << "Loaded matrix " << matrixName.toStdString() << endl; cout << "Vertex count = " << matrix.rowCount() << endl; cout << "Edge count = " << matrix.nzCount() << endl; cout << "Input vector pointer = " << inpVecPtr << endl; cout << "Result vector pointer = " << resVecPtr << endl; sc_assert(io_state == 0); // make sure we are in idle io_colCount = matrix.colCount(); io_memDump = false; io_memFill = false; io_start = true; wait(2); io_start = false; sc_assert(io_state == 4); // should be in sReadColLen QList<CSCPtr> colLenData = matrix.getColLengths(); QList<CSCPtr> rowIndData = matrix.getRowIndices(); while (!colLenData.empty() || !rowIndData.empty()) { if(!colLenData.empty()) { unsigned int len = colLenData.takeFirst(); // cout << "collen: " << len << endl; colLen.write(len); } if(!rowIndData.empty()) { unsigned int y = rowIndData.takeFirst(); //cout << "yind: " << y << endl; rowInd.write(y); } } cout << "Finished pushing matrix data, waiting for idle @" << NOW << endl; // wait until we go back to idle while(io_state != 0) wait(1); cout << "Column length transfers = " << colLenAdp.getTransferCount() << endl; cout << "Row index transfers = " << rowIndAdp.getTransferCount() << endl; }
void dumpMem(unsigned int * data, unsigned int wordCount) { for(unsigned int i = 0; i < wordCount; i++) { data[i] = memOut.read(); } }
void fillMem(unsigned int * data, unsigned int wordCount) { for(unsigned int i = 0; i < wordCount; i++) { memIn.write(data[i]); } }
virtual void write(sc_uint<8> data) { if (data == 255) eop.notify(0, SC_MS); else write_buf.write(data); }
void printer() { while (tmp_buf.nb_read(tmp_byte)) { cout << tmp_byte << " "; } cout << '\n'; }
void read_data_from_in1() { while (true) { fct_port1->fct(); sc_uint<8> tmp_byte = buf1.read(); cout << this->basename() << " received " << tmp_byte << " at " << sc_time_stamp() << "\n"; } }
void printer() { while (write_buf.nb_read(tmp_byte)) { if (port_is_ready) { out_port->write(tmp_byte); cout << this->basename() << " send " << tmp_byte << " at " <<sc_time_stamp() << "\n"; port_is_ready = false; } } cout << '\n'; }