File instr_formosa.h
File List > projects > simtix > src > simtix > sm > instr_formosa.h
Go to the documentation of this file
#pragma once
#include <cstdint>
#include "sm/instr.h"
#include "sm/warp.h"
namespace simtix {
class InstrFormosa : public Instr {
public:
using Op = void (InstrFormosa::*)();
// Implementation of Instr's virtual methods
void Decode() override;
void Issue() override;
void OperandCollect() override;
void Execute() override;
void Commit() override;
void Reset() override;
void Assign(const Instr* other) override;
bool CanIssue() const override;
bool CanExecute() const override { return true; }
bool CanCommit() const override { return true; }
bool CanRetire() const override { return committed_; }
bool may_change_ctrl_flow() const override { return may_change_ctrl_flow_; }
bool barrier_valid() const override { return barrier_valid_; }
protected:
// Protected constructor
InstrFormosa(Warp* warp, uint32_t iword, uint64_t wpc);
// Operation
Op op_ = nullptr;
bool committed_ = false;
private:
// Operations defined in this Opcode
void fsa_pri_raise_() {
for (Thread* t : active_threads_) {
t->RaisePriority();
}
}
void fsa_pri_lower_() {
for (Thread* t : active_threads_) {
t->LowerPriority();
}
}
void fsa_pri_reset_() {
for (Thread* t : active_threads_) {
t->ResetPriority();
}
}
void fsa_pri_set_() {
for (Thread* t : active_threads_) {
t->SetPriority(set_priority_);
}
}
void fsa_pri_raise_f_() {
for (Thread* t : active_threads_) {
t->RaiseFunctPriority();
}
}
void fsa_pri_lower_f_() {
for (Thread* t : active_threads_) {
t->LowerFunctPriority();
}
}
void fsa_bar_() {
warp_->set_bid(bid_);
warp_->set_wc(bar_wc_);
}
void nop_() {}
// Make InstrPool friend so that they can call our protected constructor
template <class InstrType>
friend class InstrPool;
bool barrier_valid_ = false;
bool may_change_ctrl_flow_ = false;
uint8_t bar_wc_ = 0;
uint8_t bid_ = 0;
uint32_t set_priority_ = 0;
};
} // namespace simtix