Commit 57ea6648 authored by ROKICKI Simon's avatar ROKICKI Simon

Add stuff for reqack extension

parent a2b0a58c
......@@ -25,31 +25,31 @@ protected:
void extend(){};
// Functions for memory accesses
void stb(ac_int<32, false> addr, ac_int<8, true> value);
void sth(ac_int<32, false> addr, ac_int<16, true> value);
void stw(ac_int<32, false> addr, ac_int<32, true> value);
void std(ac_int<32, false> addr, ac_int<64, true> value);
void stb(int coreId, ac_int<32, false> addr, ac_int<8, true> value);
void sth(int coreId, ac_int<32, false> addr, ac_int<16, true> value);
void stw(int coreId, ac_int<32, false> addr, ac_int<32, true> value);
void std(int coreId, ac_int<32, false> addr, ac_int<64, true> value);
ac_int<8, true> ldb(ac_int<32, false> addr);
ac_int<16, true> ldh(ac_int<32, false> addr);
ac_int<32, true> ldw(ac_int<32, false> addr);
ac_int<32, true> ldd(ac_int<32, false> addr);
ac_int<8, true> ldb(int coreId, ac_int<32, false> addr);
ac_int<16, true> ldh(int coreId, ac_int<32, false> addr);
ac_int<32, true> ldw(int coreId, ac_int<32, false> addr);
ac_int<32, true> ldd(int coreId, ac_int<32, false> addr);
// Functions for solving syscalls
void solveSyscall();
ac_int<32, true> doRead(ac_int<32, false> file, ac_int<32, false> bufferAddr, ac_int<32, false> size);
ac_int<32, true> doWrite(ac_int<32, false> file, ac_int<32, false> bufferAddr, ac_int<32, false> size);
ac_int<32, true> doOpen(ac_int<32, false> name, ac_int<32, false> flags, ac_int<32, false> mode);
ac_int<32, true> doOpenat(ac_int<32, false> dir, ac_int<32, false> name, ac_int<32, false> flags,
ac_int<32, true> doRead(int coreId, ac_int<32, false> file, ac_int<32, false> bufferAddr, ac_int<32, false> size);
ac_int<32, true> doWrite(int coreId, ac_int<32, false> file, ac_int<32, false> bufferAddr, ac_int<32, false> size);
ac_int<32, true> doOpen(int coreId, ac_int<32, false> name, ac_int<32, false> flags, ac_int<32, false> mode);
ac_int<32, true> doOpenat(int coreId, ac_int<32, false> dir, ac_int<32, false> name, ac_int<32, false> flags,
ac_int<32, false> mode);
ac_int<32, true> doLseek(ac_int<32, false> file, ac_int<32, false> ptr, ac_int<32, false> dir);
ac_int<32, true> doClose(ac_int<32, false> file);
ac_int<32, true> doStat(ac_int<32, false> filename, ac_int<32, false> ptr);
ac_int<32, true> doSbrk(ac_int<32, false> value);
ac_int<32, true> doGettimeofday(ac_int<32, false> timeValPtr);
ac_int<32, true> doUnlink(ac_int<32, false> path);
ac_int<32, true> doFstat(ac_int<32, false> file, ac_int<32, false> stataddr);
ac_int<32, true> doLseek(int coreId, ac_int<32, false> file, ac_int<32, false> ptr, ac_int<32, false> dir);
ac_int<32, true> doClose(int coreId, ac_int<32, false> file);
ac_int<32, true> doStat(int coreId, ac_int<32, false> filename, ac_int<32, false> ptr);
ac_int<32, true> doSbrk(int coreId, ac_int<32, false> value);
ac_int<32, true> doGettimeofday(int coreId, ac_int<32, false> timeValPtr);
ac_int<32, true> doUnlink(int coreId, ac_int<32, false> path);
ac_int<32, true> doFstat(int coreId, ac_int<32, false> file, ac_int<32, false> stataddr);
};
#endif // __BASIC_SIMULATOR_H__
......@@ -25,6 +25,18 @@ typedef enum { STALL_FETCH = 0, STALL_DECODE = 1, STALL_EXECUTE = 2, STALL_MEMOR
// This is ugly but otherwise with have a dependency : alu.h includes core.h (for pipeline regs) and core.h includes
// alu.h...
#define NB_CORES 8
class ReqAckUnit {
public:
ac_int<NB_CORES, false> status, maskOut;
ac_int<NB_CORES, false> notifyIn, notifyOut, statusIn;
ac_int<3, false> state = 0;
bool process(struct DCtoEx dctoEx, ac_int<32, false>& result, bool& stall);
};
class MultiplicationUnit {
public:
ac_int<32, false> quotient, remainder;
......
......@@ -5,7 +5,7 @@
class Simulator {
protected:
Core core;
Core cores[NB_CORES];
bool exitFlag;
public:
......@@ -13,7 +13,8 @@ public:
{
exitFlag = false;
while (!exitFlag) {
doCycle(core, 0);
for (int oneCore = 0; oneCore < NB_CORES; oneCore++)
doCycle(cores[oneCore], 0);
solveSyscall();
extend();
printCycle();
......
This diff is collapsed.
#include <ac_int.h>
#include <core.h>
bool ReqAckUnit::process(struct DCtoEx dctoEx, ac_int<32, false>& result, bool& stall)
{
ac_int<NB_CORES, false> localStatus = status;
if (state == 0) {
// IDLE
if (dctoEx.opCode == 0x0b) {
// We are handling an extra opcode
if (dctoEx.funct3 == 0) {
// Notify opcode
notifyOut = dctoEx.lhs.slc<NB_CORES>(0) & (!statusIn);
maskOut = dctoEx.lhs.slc<NB_CORES>(0) & statusIn;
if (maskOut != 0) {
state = 1;
}
} else if (dctoEx.funct3 == 1) {
// Check opCode
if ((dctoEx.lhs.slc<NB_CORES>(0) & !status) == 0) {
// Task is ready
localStatus = localStatus ^ dctoEx.lhs.slc<NB_CORES>(0);
} else {
state = 2;
}
}
}
} else if (state == 1) {
// Notifies
notifyOut = maskOut & (!statusIn);
maskOut = maskOut & statusIn;
if (maskOut == 0) {
state = 0;
}
} else if (state == 2) {
// Check
if ((dctoEx.lhs.slc<NB_CORES>(0) & !status) == 0) {
// Task is ready
localStatus = localStatus ^ dctoEx.lhs.slc<NB_CORES>(0);
state = 0;
}
}
status = localStatus | notifyIn;
return false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment