From: Luke Kenneth Casson Leighton Date: Fri, 19 Oct 2018 23:51:44 +0000 (+0100) Subject: fixed memory corruption due to use of auto on load_uint64, put elwidth back X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48cc02e725c394816f56230ffbee099fc2b4d7ca;p=riscv-isa-sim.git fixed memory corruption due to use of auto on load_uint64, put elwidth back --- diff --git a/riscv/sv_reg.h b/riscv/sv_reg.h index 8db28da..4e9689e 100644 --- a/riscv/sv_reg.h +++ b/riscv/sv_reg.h @@ -5,14 +5,14 @@ class sv_sreg_t; class sv_reg_t { public: - sv_reg_t(uint64_t _reg) : reg(_reg) /*, elwidth(0)*/ { } // default elwidth - //sv_reg_t(uint64_t _reg, uint8_t _elwidth) : reg(_reg), elwidth(_elwidth) {} + sv_reg_t(uint64_t _reg) : reg(_reg) , elwidth(0) { } // default elwidth + sv_reg_t(uint64_t _reg, uint8_t _elwidth) : reg(_reg), elwidth(_elwidth) {} uint64_t reg; uint8_t elwidth; public: uint64_t get_data() { return reg; } - //uint8_t get_width() { return elwidth; } + uint8_t get_width() { return elwidth; } operator uint64_t() const & { return reg; } operator sv_sreg_t() const &; @@ -20,22 +20,20 @@ public: class sv_sreg_t { public: - sv_sreg_t(int64_t _reg) : reg(_reg) /*, elwidth(0)*/ {} // default elwidth - //sv_sreg_t(int64_t _reg, uint8_t _elwidth) : reg(_reg), elwidth(_elwidth) {} + sv_sreg_t(int64_t _reg) : reg(_reg) , elwidth(0) {} // default elwidth + sv_sreg_t(int64_t _reg, uint8_t _elwidth) : reg(_reg), elwidth(_elwidth) {} int64_t reg; uint8_t elwidth; public: int64_t get_data() { return reg; } - //uint8_t get_width() { return elwidth; } + uint8_t get_width() { return elwidth; } operator int64_t() const& { return reg; } - //operator sv_reg_t() { return sv_reg_t((uint64_t)reg, elwidth); } - operator sv_reg_t() const& { return sv_reg_t((uint64_t)reg); } + operator sv_reg_t() const& { return sv_reg_t((uint64_t)reg, elwidth); } }; -//inline sv_reg_t::operator sv_sreg_t() { return sv_sreg_t((int64_t)reg, elwidth); } inline sv_reg_t::operator sv_sreg_t() const & -{ return sv_sreg_t((int64_t)reg); } +{ return sv_sreg_t((int64_t)reg, elwidth); } #endif