aboutsummaryrefslogtreecommitdiff
path: root/hwacha/hwacha.cc
blob: bd76f6b9d9ef21e8ef34889b15bf4c98c0a8de63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "hwacha.h"

void ct_state_t::reset()
{
  vl = 0;
  maxvl = 32;
  nxpr = 32;
  nfpr = 32;

  vf_pc = -1;
}

void ut_state_t::reset()
{
  run = false;
  XPR.reset();
  FPR.reset();
}

void hwacha_t::reset()
{
  ct_state.reset();
  for (int i=0; i<max_uts; i++)
    ut_state[i].reset();
}

std::vector<insn_desc_t> hwacha_t::get_instructions()
{
  std::vector<insn_desc_t> insns;
  #define DECLARE_INSN(name, match, mask) \
    extern reg_t hwacha_##name(processor_t*, insn_t, reg_t); \
    insns.push_back((insn_desc_t){match, mask, &::illegal_instruction, hwacha_##name});
  #include "opcodes_hwacha.h"
  #undef DECLARE_INSN
  return insns;
}

bool hwacha_t::vf_active()
{
  for (uint32_t i=0; i<get_ct_state()->vl; i++) {
    if (get_ut_state(i)->run)
      return true;
  }

  return false;
}