Skip to content

File instr_lui.h

File List > projects > simtix > src > simtix > sm > instr_lui.h

Go to the documentation of this file

#pragma once

#include <cstdint>

#include "sm/instr.h"
#include "sm/thread.h"
#include "sm/warp.h"

namespace simtix {

class InstrLui : public Instr {
 public:
  using Op = void (InstrLui::*)();

  // 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 executed_; }

  bool CanRetire() const override { return committed_; }

  // Helper functions
  static inline int64_t DecodeImmItype(uint32_t iword) {
    return (int32_t(iword) >> 12);
  }

 protected:
  InstrLui(Warp *warp, uint32_t iword, uint64_t wpc);

  void Reinitialize(Warp *warp, uint32_t iword, uint64_t wpc) override;

  int64_t imm_ = 0;

  Op op_ = nullptr;

  bool executed_ = false;
  bool committed_ = false;

  // Register data
  int64_t rd_data_;

 private:
  // Operations defined in this Opcode
  void lui_() { rd_data_ = (imm_ << 12); }

  // Make InstrPool friend so that they can call our protected constructor
  template <class InstrType>
  friend class InstrPool;
};

}  // namespace simtix