Skip to content

Commit

Permalink
cleaned some code
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwoojun committed Jul 10, 2020
1 parent aca359f commit 68ae227
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
31 changes: 20 additions & 11 deletions examples/streaming/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ int main(int argc, char** argv) {
uint32_t pages = 0;
int sleepcnt = 0;
while (pages < pagecnt) {
usleep(100);
pages = pcie->userReadWord(4);
if ( pages >= pagecnt ) break;

sleepcnt ++;
if ( sleepcnt % 10000 == 0 ) {
printf( "Pages-- %d\n", pages );
printf( "!! %x\n", pcie->readWord(4) );
printf( ">> %x\n", ((uint32_t*)dmabuf)[1024/4*4] );
}
pages = pcie->userReadWord(4);
usleep(10);
}
clock_gettime(CLOCK_REALTIME, & now);
double diff = timespec_diff_sec(start, now);
Expand All @@ -105,29 +107,36 @@ int main(int argc, char** argv) {
printf( "r %x\n", pcie->userReadWord(0) );
printf( "w %x\n", pcie->userReadWord(4) );
/*
for ( int i = 0; i < 32; i++ ) {
printf( "x %x\n", pcie->userReadWord(0) );
}
*/
/*
for ( int i = 0; i < 32; i++ ) {
printf( "-- %d %x\n", i, ((uint32_t*)dmabuf)[i+1024/4*4] );
}
*/


int incorrects = 0;
for ( uint32_t i = 0; i < 1024*4/4; i++ ) {
uint32_t d = ((uint32_t*)dmabuf)[i+1024/4*4];
if ( i%8 == 0 ) {
if (d != 0xdeadbeef) printf ( "XX %x %x\n", i, d );
if (d != 0xdeadbeef) {
printf ( "Data incorrect! %x != %x\n", 0xdeadbeef, d );
incorrects ++;
}
} else {
if (d != i) printf ( "XX %x %x\n", i, d );
if (d != i) {
printf ( "Data incorrect! %x != %x\n", i, d );
incorrects++;
}
}
}

printf( "Incorrect datas: %d\n", incorrects );

/*
for ( int i = 2; i < 16; i++ ) {
printf( "+++ %x\n", pcie->userReadWord(i*4) );
printf( "Data in BRAM: %x\n", pcie->userReadWord(i*4) );
}
*/

printf( "!! %x\n", pcie->readWord(4) );
printf( "DebugCode: %x\n", pcie->readWord(4) );

}
4 changes: 2 additions & 2 deletions src/PcieCtrl.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ module mkPcieCtrl#(PcieImportUser user) (PcieCtrlIfc);
dmaReadBufAddrQ.deq;

dmaReadTagOrderQ.enq(req.tag);
debugCode <= debugCode + zeroExtend(req.words);
//debugCode <= debugCode + zeroExtend(req.words);


let dmaAddr = busAddr + req.addr;
Expand Down Expand Up @@ -889,7 +889,7 @@ module mkPcieCtrl#(PcieImportUser user) (PcieCtrlIfc);
let dmaAddr = busAddr + req.addr;
Bit#(10) dmaWords = req.words;
//let dmaWords = 8;
debugCode <= debugCode + (zeroExtend(req.words)<<16);
//debugCode <= debugCode + (zeroExtend(req.words)<<16);

dmaWriteWordQ.deq;
let data = dmaWriteWordQ.first;
Expand Down

0 comments on commit 68ae227

Please sign in to comment.