standard.isa (12695:3df197da6069) standard.isa (12849:7f43ad13ebf0)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2015 RISC-V Foundation
4// Copyright (c) 2016-2017 The University of Virginia
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are

--- 217 unchanged lines hidden (view full) ---

226 olddata = xc->readMiscReg(MISCREG_FFLAGS) |
227 (xc->readMiscReg(MISCREG_FRM) << FRM_OFFSET);
228 break;
229 default:
230 if (CSRData.find(csr) != CSRData.end()) {
231 olddata = xc->readMiscReg(CSRData.at(csr).physIndex);
232 } else {
233 std::string error = csprintf("Illegal CSR index %#x\n", csr);
1// -*- mode:c++ -*-
2
3// Copyright (c) 2015 RISC-V Foundation
4// Copyright (c) 2016-2017 The University of Virginia
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are

--- 217 unchanged lines hidden (view full) ---

226 olddata = xc->readMiscReg(MISCREG_FFLAGS) |
227 (xc->readMiscReg(MISCREG_FRM) << FRM_OFFSET);
228 break;
229 default:
230 if (CSRData.find(csr) != CSRData.end()) {
231 olddata = xc->readMiscReg(CSRData.at(csr).physIndex);
232 } else {
233 std::string error = csprintf("Illegal CSR index %#x\n", csr);
234 fault = make_shared(error);
234 fault = make_shared<IllegalInstFault>(error, machInst);
235 olddata = 0;
236 }
237 break;
238 }
239 auto mask = CSRMasks.find(csr);
240 if (mask != CSRMasks.end())
241 olddata &= mask->second;
242 DPRINTF(RiscvMisc, "Reading CSR %s: %#x\n", CSRData.at(csr).name,

--- 4 unchanged lines hidden (view full) ---

247 %(code)s;
248 if (fault == NoFault) {
249 if (mask != CSRMasks.end())
250 data &= mask->second;
251 if (data != olddata) {
252 if (bits(csr, 11, 10) == 0x3) {
253 std::string error = csprintf("CSR %s is read-only\n",
254 CSRData.at(csr).name);
235 olddata = 0;
236 }
237 break;
238 }
239 auto mask = CSRMasks.find(csr);
240 if (mask != CSRMasks.end())
241 olddata &= mask->second;
242 DPRINTF(RiscvMisc, "Reading CSR %s: %#x\n", CSRData.at(csr).name,

--- 4 unchanged lines hidden (view full) ---

247 %(code)s;
248 if (fault == NoFault) {
249 if (mask != CSRMasks.end())
250 data &= mask->second;
251 if (data != olddata) {
252 if (bits(csr, 11, 10) == 0x3) {
253 std::string error = csprintf("CSR %s is read-only\n",
254 CSRData.at(csr).name);
255 fault = make_shared(error);
255 fault = make_shared<IllegalInstFault>(error, machInst);
256 } else {
257 DPRINTF(RiscvMisc, "Writing %#x to CSR %s.\n", data,
258 CSRData.at(csr).name);
259 switch (csr) {
260 case CSR_FCSR:
261 xc->setMiscReg(MISCREG_FFLAGS, bits(data, 4, 0));
262 xc->setMiscReg(MISCREG_FRM, bits(data, 7, 5));
263 break;

--- 108 unchanged lines hidden ---
256 } else {
257 DPRINTF(RiscvMisc, "Writing %#x to CSR %s.\n", data,
258 CSRData.at(csr).name);
259 switch (csr) {
260 case CSR_FCSR:
261 xc->setMiscReg(MISCREG_FFLAGS, bits(data, 4, 0));
262 xc->setMiscReg(MISCREG_FRM, bits(data, 7, 5));
263 break;

--- 108 unchanged lines hidden ---