Renamed simX to simx

This commit is contained in:
Santosh Srivatsan
2021-12-10 16:57:29 -05:00
parent be499d6f38
commit e7bc436b52
17 changed files with 3962 additions and 0 deletions

113
sim/simx/warp.h Normal file
View File

@@ -0,0 +1,113 @@
#ifndef __WARP_H
#define __WARP_H
#include <vector>
#include <stack>
#include "types.h"
namespace vortex {
class Core;
class Instr;
class Pipeline;
struct DomStackEntry {
DomStackEntry(const ThreadMask &tmask, DoubleWord PC)
: tmask(tmask)
, PC(PC)
, fallThrough(false)
, unanimous(false)
{}
DomStackEntry(const ThreadMask &tmask)
: tmask(tmask)
, PC(0)
, fallThrough(true)
, unanimous(false)
{}
ThreadMask tmask;
DoubleWord PC;
bool fallThrough;
bool unanimous;
};
struct vtype {
int vill;
int vediv;
int vsew;
int vlmul;
};
class Warp {
public:
Warp(Core *core, Word id);
void clear();
bool active() const {
return active_;
}
void activate() {
active_ = true;
}
std::size_t getActiveThreads() const {
if (active_)
return tmask_.count();
return 0;
}
Word id() const {
return id_;
}
DoubleWord getPC() const {
return PC_;
}
void setPC(DoubleWord PC) {
PC_ = PC;
}
void setTmask(size_t index, bool value) {
tmask_[index] = value;
active_ = tmask_.any();
}
Word getTmask() const {
if (active_)
return tmask_.to_ulong();
return 0;
}
Word getIRegValue(int reg) const {
return iRegFile_[0][reg];
}
void step(Pipeline *);
private:
void execute(const Instr &instr, Pipeline *);
Word id_;
bool active_;
Core *core_;
DoubleWord PC_;
ThreadMask tmask_;
// simx64
std::vector<std::vector<DoubleWord>> iRegFile_;
std::vector<std::vector<DoubleWord>> fRegFile_;
std::vector<std::vector<Byte>> vRegFile_;
std::stack<DomStackEntry> domStack_;
struct vtype vtype_;
int vl_;
};
}
#endif