1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
This commit is contained in:
julianb0 2019-07-08 15:01:31 +02:00
parent 785648e3db
commit 972ea65016
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1
2 changed files with 149 additions and 134 deletions

View File

@ -53,7 +53,7 @@ def leave():
pdefs = dict() pdefs = dict()
# registers # registers
pregs = list() pregs = dict()
# instructions # instructions
pinstrs = list() pinstrs = list()
@ -101,8 +101,16 @@ def arith_eval(s):
def parse_lst_regs(): def parse_lst_regs():
global pregs global pregs
i = 0
for _, line in enumerate(lst_regs): for _, line in enumerate(lst_regs):
pregs.append(line.strip()) line = line.strip()
if len(line) == 0:
continue
for reg in line.split():
pregs[reg] = i
i += 1
def parse_lst_instrs(): def parse_lst_instrs():
global pinstrs global pinstrs
@ -636,7 +644,7 @@ def parse_instr(line):
# register index $reg # register index $reg
if len(word) == 4 and word[0] == '$': if len(word) == 4 and word[0] == '$':
if word[1:] in pregs: if word[1:] in pregs:
word = str(pregs.index(word[1:])) word = str(pregs[word[1:]])
# for now every immediate is 64-bit # for now every immediate is 64-bit
if is_number(word): if is_number(word):
@ -747,7 +755,7 @@ def gentext():
continue continue
if word in pregs: if word in pregs:
idx = pregs.index(word) idx = pregs[word]
b_text.write(idx.to_bytes(2, byteorder='little', signed=False)) b_text.write(idx.to_bytes(2, byteorder='little', signed=False))
continue continue
@ -758,8 +766,8 @@ def gentext():
sys.exit(1) sys.exit(1)
reg2, reg1 = word.split(':', 1) reg2, reg1 = word.split(':', 1)
idx1 = pregs.index(reg1) idx1 = pregs[reg1]
idx2 = pregs.index(reg2) idx2 = pregs[reg2]
b_text.write(((idx1 << 8) | idx2).to_bytes(2, byteorder='little', signed=False)) b_text.write(((idx1 << 8) | idx2).to_bytes(2, byteorder='little', signed=False))
continue continue

View File

@ -1,128 +1,135 @@
inv inv x0
flg flg x1
rip rip eip ip x2
rpc rpc epc pc x3
px0
px1 px0 p0 x4
fc1 px1 p1 x5
fx2 fc1 f1 x6
sa0 fc2 f2 x7
sa1
sa2 sa0 k0 x8
sa3 sa1 k1 x9
sa4 sa2 k2 x10
sa5 sa3 k3 x11
sa6 sa4 k4 x12
sa7 sa5 k5 x13
dr0 sa6 k6 x14
dr1 sa7 k7 x15
dr2
dr3 dr0 d0 x16
dr4 dr1 d1 x17
dr5 dr2 d2 x18
dr6 dr3 d3 x19
dr7 dr4 d4 x20
cr0 dr5 d5 x21
cr1 dr6 d6 x22
cr2 dr7 d7 x23
cr3
cr4 cr0 c0 x24
cr5 cr1 c1 x25
cr6 cr2 c2 x26
cr7 cr3 c3 x27
rax cr4 c4 x28
rbx cr5 c5 x29
rcx cr6 c6 x30
rdx cr7 c7 x31
rsi
rdi rax eax ax rx0 r0 x32
rbp rbx ebx bx rx1 r1 x33
rsp rcx ecx cx rx2 r2 x34
rx8 rdx edx dx rx3 r3 x35
rx9 rsi esi si rx4 r4 x36
r10 rdi edi di rx5 r5 x37
r11 rbp ebp bp rx6 r6 x38
r12 rsp esp sp rx7 r7 x39
r13 rx8 r8 x40
r14 rx9 r9 x41
r15 r10 x42
r16 r11 x43
r17 r12 x44
r18 r13 x45
r19 r14 x46
r20 r15 x47
r21 r16 x48
r22 r17 x49
r23 r18 x50
r24 r19 x51
r25 r20 x52
r26 r21 x53
r27 r22 x54
r28 r23 x55
r29 r24 x56
r30 r25 x57
r31 r26 x58
ax0 r27 x59
ax1 r28 x60
ax2 r29 x61
ax3 r30 x62
ax4 r31 x63
ax5
ax6 ax0 a0 x64
ax7 ax1 a1 x65
ax8 ax2 a2 x66
ax9 ax3 a3 x67
a10 ax4 a4 x68
a11 ax5 a5 x69
a12 ax6 a6 x70
a13 ax7 a7 x71
a14 ax8 a8 x72
a15 ax9 a9 x73
a16 a10 x74
a17 a11 x75
a18 a12 x76
a19 a13 x77
a20 a14 x78
a21 a15 x79
a22 a16 x80
a23 a17 x81
a24 a18 x82
a25 a19 x83
a26 a20 x84
a27 a21 x85
a28 a22 x86
a29 a23 x87
a30 a24 x88
a31 a25 x89
nx0 a26 x90
nx1 a27 x91
nx2 a28 x92
nx3 a29 x93
nx4 a30 x94
nx5 a31 x95
nx6
nx7 nx0 n0 x96
nx8 nx1 n1 x97
nx9 nx2 n2 x98
n10 nx3 n3 x99
n11 nx4 n4 x100
n12 nx5 n5 x101
n13 nx6 n6 x102
n14 nx7 n7 x103
n15 nx8 n8 x104
n16 nx9 n9 x105
n17 n10 x106
n18 n11 x107
n19 n12 x108
n20 n13 x109
n21 n14 x110
n22 n15 x111
n23 n16 x112
n24 n17 x113
n25 n18 x114
n26 n19 x115
n27 n20 x116
n28 n21 x117
n29 n22 x118
n30 n23 x119
n31 n24 x120
n25 x121
n26 x122
n27 x123
n28 x124
n29 x125
n30 x126
n31 x127