commit b8fbe188590994043da98f1228c8ddd735fd641c
parent 488af6f13131fc69092f8d7e68c7250036e79be8
Author: Brian Swetland <swetland@frotz.net>
Date: Wed, 30 Dec 2015 01:02:45 -0800
define a DEBUG instruction in the NOP instruction space
Diffstat:
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/hdl/cpu/isa.txt b/hdl/cpu/isa.txt
@@ -14,7 +14,8 @@ iiii iiii iiii 1100 b si12 PC += si12
iiii iiii iiii 1101 bl si12 R14 = PC, PC += si12,
0000 bbbb xxxx 1110 b Rb PC = Rb
0001 bbbb xxxx 1110 bl Rb R14 = PC, PC = Rb
-0010 xxxx xxxx 1110 nop
+0010 0000 0000 1110 nop
+0010 nnnn aaaa 1110 debug Ra, x4 DEBUG(Ra, n4)
Extended Instructions <--- Not implemented yet.
--------------------- Will likely change during
diff --git a/src/a16.c b/src/a16.c
@@ -203,6 +203,7 @@ enum tokens {
tMOV, tAND, tORR, tXOR, tADD, tSUB, tMUL, tMHI,
tSLT, tSLE, tSHR, tSHL, tBIS, tBIC, tTBS, tBIT,
tLW, tSW, tNOP, tNOT, tB, tBL, tBZ, tBNZ,
+ tDEBUG,
tR0, tR1, tR2, tR3, tR4, tR5, tR6, tR7,
rR8, rR9, rR10, rR11, rR12, tR13, tR14, tR15,
tSP, tLR,
@@ -216,6 +217,7 @@ char *tnames[] = {
"MOV", "AND", "ORR", "XOR", "ADD", "SUB", "MUL", "MHI",
"SLT", "SLE", "SHR", "SHL", "BIS", "BIC", "TBS", "BIT",
"LW", "SW", "NOP", "NOT", "B", "BL", "BZ", "BNZ",
+ "DEBUG",
"R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
"R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15",
"SP", "LR",
@@ -550,6 +552,12 @@ void assemble_line(int n, unsigned *tok, unsigned *num, char **str) {
die("expected register or address");
}
return;
+ case tDEBUG:
+ expect_register(T1);
+ expect(tCOMMA, T2);
+ expect(tNUMBER, T3);
+ emit(OP_NOP | _FLO(num[3]) | _A(to_reg(T1)));
+ return;
case tWORD:
tmp = 1;
for (;;) {
diff --git a/src/d16.c b/src/d16.c
@@ -77,6 +77,9 @@ void printinst(char *buf, unsigned pc, unsigned instr, const char *fmt) {
case 's':
buf = append_int(buf, s12);
break;
+ case 'n':
+ buf = append_int(buf, flo);
+ break;
case 0:
goto done;
}
@@ -96,6 +99,7 @@ struct {
{ 0b1111000000001111, 0b0000000000000010, "MOV @A, @B" },
{ 0b0000000000001111, 0b0000000000000010, "@F @A, @B" },
{ 0b0000111100001111, 0b0000000000000011, "MOV @A, @4" },
+ { 0b1111111100001111, 0b1111001100000011, "NOT @A" },
{ 0b0000000000001111, 0b0000000000000011, "@f @A, @4" },
{ 0b1111000000001100, 0b0000000000000100, "MOV @C, @B" },
{ 0b0000000000001100, 0b0000000000000100, "@F @C, @B, @A" },
@@ -107,7 +111,8 @@ struct {
{ 0b0000000000001111, 0b0000000000001101, "BL @s" },
{ 0b1111000000001111, 0b0000000000001110, "B @B" },
{ 0b1111000000001111, 0b0001000000001110, "BL @B" },
- { 0b1111000000001111, 0b0010000000001110, "NOP" },
+ { 0b1111111111111111, 0b0010000000001110, "NOP" },
+ { 0b1111000000001111, 0b0010000000001110, "DEBUG @A, @n" },
{ 0b0000000000000000, 0b0000000000000000, "UNDEFINED" },
};