Bugfix-- registers now appropriately truncated.

git-svn-id: http://www.cdkersey.com/harp/harptool@117 0246edb2-e076-4747-b392-db732a341fa2
This commit is contained in:
chad
2013-01-18 04:32:23 +00:00
parent afe15f4ff1
commit ea03ccb47d
8 changed files with 45 additions and 22 deletions

View File

@@ -24,8 +24,14 @@ namespace Harp {
Reg(Word c, Word n): cpuId(c), regNum(n), val(0) {}
Reg &operator=(T r) { val = r; doWrite(); return *this; }
operator T() { doRead(); return val; }
void trunc(Size s) {
Word mask((~0ull >> (sizeof(Word)-s)*8));
val &= mask;
}
private:
Word cpuId, regNum;
T val;