Browse Source

Convert vtype to csr_t

Adds commit log events for vtype to many vector instructions.
pull/821/head
Scott Johnson 5 years ago
parent
commit
9ac2dcf9a5
No known key found for this signature in database GPG Key ID: 61C1F01D3D1410C9
  1. 14
      riscv/processor.cc
  2. 6
      riscv/processor.h

14
riscv/processor.cc

@ -557,15 +557,16 @@ void processor_t::vectorUnit_t::reset(){
csrmap[CSR_VSTART] = vstart = std::make_shared<vector_csr_t>(p, CSR_VSTART, /*mask*/ VLEN - 1);
csrmap[CSR_VXRM] = vxrm = std::make_shared<vector_csr_t>(p, CSR_VXRM, /*mask*/ 0x3ul);
csrmap[CSR_VL] = vl = std::make_shared<vector_csr_t>(p, CSR_VL, /*mask*/ 0);
csrmap[CSR_VTYPE] = vtype = std::make_shared<vector_csr_t>(p, CSR_VTYPE, /*mask*/ 0);
vtype = 0;
vtype->write_raw(0);
set_vl(0, 0, 0, -1); // default to illegal configuration
}
reg_t processor_t::vectorUnit_t::set_vl(int rd, int rs1, reg_t reqVL, reg_t newType){
int new_vlmul = 0;
if (vtype != newType){
vtype = newType;
if (vtype->read() != newType){
vtype->write_raw(newType);
vsew = 1 << (extract64(newType, 3, 3) + 3);
new_vlmul = int8_t(extract64(newType, 0, 3) << 5) >> 5;
vflmul = new_vlmul >= 0 ? 1 << new_vlmul : 1.0 / (1 << -new_vlmul);
@ -579,7 +580,7 @@ reg_t processor_t::vectorUnit_t::set_vl(int rd, int rs1, reg_t reqVL, reg_t newT
if (vill) {
vlmax = 0;
vtype = UINT64_MAX << (p->get_xlen() - 1);
vtype->write_raw(UINT64_MAX << (p->get_xlen() - 1));
}
}
@ -1023,11 +1024,6 @@ reg_t processor_t::get_csr(int which, insn_t insn, bool write, bool peek)
if (!extension_enabled('V'))
break;
ret((VU.vxsat->read() << VCSR_VXSAT_SHIFT) | (VU.vxrm->read() << VCSR_VXRM_SHIFT));
case CSR_VTYPE:
require_vector_vs;
if (!extension_enabled('V'))
break;
ret(VU.vtype);
case CSR_VLENB:
require_vector_vs;
if (!extension_enabled('V'))

6
riscv/processor.h

@ -511,8 +511,8 @@ public:
char reg_referenced[NVPR];
int setvl_count;
reg_t vlmax;
reg_t vtype, vlenb;
vector_csr_t_p vxrm, vstart, vxsat, vl;
reg_t vlenb;
vector_csr_t_p vxrm, vstart, vxsat, vl, vtype;
reg_t vma, vta;
reg_t vsew;
float vflmul;
@ -553,12 +553,12 @@ public:
reg_referenced{0},
setvl_count(0),
vlmax(0),
vtype(0),
vlenb(0),
vxrm(0),
vstart(0),
vxsat(0),
vl(0),
vtype(0),
vma(0),
vta(0),
vsew(0),

Loading…
Cancel
Save