Changed ArchDef

This commit is contained in:
felsabbagh3
2019-02-09 15:57:16 -05:00
parent 6526e0ac1a
commit 8128d2e250
3 changed files with 19 additions and 8 deletions

View File

@@ -249,10 +249,10 @@ static Word mask(Size bits) {
static void getSizes(const ArchDef &arch, Size &n, Size& o, Size &r, Size &p, static void getSizes(const ArchDef &arch, Size &n, Size& o, Size &r, Size &p,
Size &i1, Size &i2, Size &i3) Size &i1, Size &i2, Size &i3)
{ {
n = arch.getWordSize() * 8; n = arch.getWordSize() * 8;
o = 6; o = 7;
r = ceilLog2(arch.getNRegs()); r = ceilLog2(arch.getNRegs());
p = ceilLog2(arch.getNPRegs()); p = 0;
i1 = n - 1 - p - o; i1 = n - 1 - p - o;
i2 = i1 - r; i2 = i1 - r;
i3 = i2 - r; i3 = i2 - r;
@@ -274,7 +274,8 @@ Instruction *WordDecoder::decode(const std::vector<Byte> &v, Size &idx) {
Word code(readWord(v, idx, n/8)); Word code(readWord(v, idx, n/8));
Instruction &inst = * new Instruction(); Instruction &inst = * new Instruction();
bool predicated = (code>>(n-1)); // bool predicated = (code>>(n-1));
bool predicated = false;
if (predicated) { inst.setPred((code>>(n-p-1))&pMask); } if (predicated) { inst.setPred((code>>(n-p-1))&pMask); }
Instruction::Opcode op = (Instruction::Opcode)((code>>i1)&oMask); Instruction::Opcode op = (Instruction::Opcode)((code>>i1)&oMask);

View File

@@ -219,7 +219,6 @@ int emu_main(int argc, char **argv) {
CommandLineArgFlag fi("-i", "--batch", "", batch); CommandLineArgFlag fi("-i", "--batch", "", batch);
CommandLineArg::readArgs(argc, argv); CommandLineArg::readArgs(argc, argv);
if (showHelp) { if (showHelp) {
cout << Help::emuHelp; cout << Help::emuHelp;
return 0; return 0;
@@ -233,6 +232,7 @@ int emu_main(int argc, char **argv) {
switch (arch.getEncChar()) { switch (arch.getEncChar()) {
case 'b': dec = new ByteDecoder(arch); break; case 'b': dec = new ByteDecoder(arch); break;
case 'w': dec = new WordDecoder(arch); break; case 'w': dec = new WordDecoder(arch); break;
case 'r': dec = new WordDecoder(arch); break;
default: default:
cout << "Unrecognized decoder type: '" << arch.getEncChar() << "'.\n"; cout << "Unrecognized decoder type: '" << arch.getEncChar() << "'.\n";
return 1; return 1;

View File

@@ -7,6 +7,8 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <cstdlib>
#include <stdio.h>
#include "types.h" #include "types.h"
namespace Harp { namespace Harp {
@@ -16,8 +18,16 @@ namespace Harp {
ArchDef(const std::string &s) { ArchDef(const std::string &s) {
std::istringstream iss(s.c_str()); std::istringstream iss(s.c_str());
iss >> wordSize; wordSize = 4;
encChar = 'w';
nRegs = 32;
nPRegs = 0;
nThds = 1;
nWarps = 1;
extent = EXT_REGS;
if (!iss) { extent = EXT_NULL; return; } if (!iss) { extent = EXT_NULL; return; }
iss >> encChar; iss >> encChar;
if (!iss) { extent = EXT_WORDSIZE; return; } if (!iss) { extent = EXT_WORDSIZE; return; }