mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
make villas-fpga-pipe use separat memory segments for reading and writing
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
4ef114fad4
commit
e6f34f83f4
1 changed files with 13 additions and 9 deletions
|
@ -83,23 +83,27 @@ int main(int argc, char* argv[])
|
|||
|
||||
// Configure Crossbar switch
|
||||
#if 1
|
||||
aurora_channels[2]->connect(aurora_channels[2]->getDefaultMasterPort(), dma->getDefaultSlavePort());
|
||||
aurora_channels[3]->connect(aurora_channels[3]->getDefaultMasterPort(), dma->getDefaultSlavePort());
|
||||
dma->connect(dma->getDefaultMasterPort(), aurora_channels[3]->getDefaultSlavePort());
|
||||
#else
|
||||
dma->connectLoopback();
|
||||
#endif
|
||||
auto &alloc = villas::HostRam::getAllocator();
|
||||
std::shared_ptr<villas::MemoryBlock> block = alloc.allocateBlock(0x100 * sizeof(int32_t));
|
||||
villas::MemoryAccessor<int32_t> mem = *block;
|
||||
|
||||
dma->makeAccesibleFromVA(block);
|
||||
const std::shared_ptr<villas::MemoryBlock> block[] = {
|
||||
alloc.allocateBlock(0x200 * sizeof(uint32_t)),
|
||||
alloc.allocateBlock(0x200 * sizeof(uint32_t))
|
||||
};
|
||||
villas::MemoryAccessor<int32_t> mem[] = {*block[0], *block[1]};
|
||||
|
||||
for (auto b : block) {
|
||||
dma->makeAccesibleFromVA(b);
|
||||
}
|
||||
auto &mm = MemoryManager::get();
|
||||
mm.getGraph().dump("graph.dot");
|
||||
|
||||
while (true) {
|
||||
// Setup read transfer
|
||||
dma->read(*block, block->getSize());
|
||||
dma->read(*block[0], block[0]->getSize());
|
||||
|
||||
// Read values from stdin
|
||||
std::string line;
|
||||
|
@ -111,11 +115,11 @@ int main(int argc, char* argv[])
|
|||
if (value.empty()) continue;
|
||||
|
||||
const int32_t number = std::stoi(value);
|
||||
mem[i++] = number;
|
||||
mem[1][i++] = number;
|
||||
}
|
||||
|
||||
// Initiate write transfer
|
||||
bool state = dma->write(*block, i * sizeof(int32_t));
|
||||
bool state = dma->write(*block[1], i * sizeof(int32_t));
|
||||
if (!state)
|
||||
logger->error("Failed to write to device");
|
||||
|
||||
|
@ -127,7 +131,7 @@ int main(int argc, char* argv[])
|
|||
logger->info("Read {} bytes, {} bds, {} interrupts", readComp.bytes, readComp.bds, readComp.interrupts);
|
||||
|
||||
for (size_t i = 0; i < valuesRead; i++)
|
||||
std::cerr << mem[i] << ";";
|
||||
std::cerr << mem[0][i] << ";";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
} catch (const RuntimeError &e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue