mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-24 05:47:35 -04:00
Make byte encoding use 0xff for no predicate, otherwise preg num.
git-svn-id: http://www.cdkersey.com/harp/harptool@122 0246edb2-e076-4747-b392-db732a341fa2
This commit is contained in:
parent
7a688ea6ab
commit
e8ade7e29e
2 changed files with 5 additions and 17 deletions
|
@ -103,8 +103,8 @@ void Decoder::setRefs(const std::vector<Ref*> &refVec) {
|
|||
Instruction *ByteDecoder::decode(const vector<Byte> &v, Size &n) {
|
||||
Instruction &inst = *(new Instruction());
|
||||
|
||||
RegNum pred = readByte(v, n);
|
||||
if (pred) inst.setPred(pred - 1);
|
||||
uint8_t pred = readByte(v, n);
|
||||
if (pred != 0xff) inst.setPred(pred);
|
||||
|
||||
unsigned op = readByte(v, n);
|
||||
inst.setOpcode(Instruction::Opcode(op));
|
||||
|
@ -190,8 +190,8 @@ ByteEncoder::ByteEncoder(const ArchDef &ad) {
|
|||
Size ByteEncoder::encode(Ref *&ref, vector<Byte> &v, Size n0, Instruction &i) {
|
||||
Size n(n0);
|
||||
|
||||
if (i.hasPred()) writeByte(v, n, i.getPred() + 1);
|
||||
else writeByte(v, n, 0);
|
||||
if (i.hasPred()) writeByte(v, n, i.getPred());
|
||||
else writeByte(v, n, 0xff);
|
||||
|
||||
writeByte(v, n, Byte(i.getOpcode()));
|
||||
|
||||
|
|
|
@ -12,26 +12,18 @@
|
|||
.perm x
|
||||
.entry
|
||||
.global
|
||||
entry: ldi %r7, hello; jali %r5, puts;
|
||||
|
||||
entry:
|
||||
ldi %r0, #2; /* i = 2 */
|
||||
loop1: addi %r7, %r0, #0;
|
||||
jali %r5, printdec;
|
||||
|
||||
muli %r1, %r0, __WORD;
|
||||
ldi %r7, wrstr;
|
||||
jali %r5, puts;
|
||||
st %r0, %r1, array;
|
||||
ldi %r7, wrfin;
|
||||
jali %r5, puts;
|
||||
addi %r0, %r0, #1;
|
||||
subi %r1, %r0, SIZE;
|
||||
rtop @p0, %r1;
|
||||
@p0 ? jmpi loop1;
|
||||
|
||||
ldi %r7, xstr;
|
||||
jali %r5, puts;
|
||||
|
||||
ldi %r0, #1;
|
||||
loop2: addi %r0, %r0, #1;
|
||||
muli %r1, %r0, __WORD;
|
||||
|
@ -78,10 +70,6 @@ loop4: ld %r1, %r0, array;
|
|||
trap; /* All traps currently cause a halt. */
|
||||
|
||||
.perm rw /* TODO: How should I write section permissions? */
|
||||
hello: .string "\"Harp!\" is how a harp seal says hello!\n"
|
||||
wrstr: .string "Doing write\n"
|
||||
wrfin: .string "Did write\n"
|
||||
xstr: .string "Exiting loop\n"
|
||||
|
||||
.global
|
||||
array: .space 0x1000 /* SIZE words of space. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue