Skip to content

Commit 90adcf5

Browse files
committed
Progress on r12 model
1 parent a6132aa commit 90adcf5

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

model.txt

-3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,3 @@ xR12[32,64] = { [xR8==224] [(xR12[15,23]==0) + (xR12[15,23]==9)] [0 ≤ xR12[32,
8787

8888

8989

90-
91-
92-

processor.asm

+40-3
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ _main:
384384
;7; { [(xR8==196) + (xR8==197)] [xR13[0,32]] } +
385385
;8; { ~(xR8==160) ~(xR8==167) ~(xR8==192) ~(xR8==194) ~(xR8==196) ~(xR8==197) ~(xR8==224) ~(xR8==225) (xR12[32,64]) }
386386

387+
; INSTRUCTION_FORMAT_CORRECT =
388+
; [
389+
; [0 ≤ xR11[0,8] ≤ 2] [(xR11[23,27]==1) + (xR11[23,27]==2) + (xR11[23,27]==4) + (xR11[23,27]==8)] [xR11[59,64]==0] +
390+
; [9 ≤ xR11[0,8] ≤ 10] [xR11[50,64]==0] + [17 ≤ xR11[0,8] ≤ 33] [xR11[18,64]==0] + [xR11[0,8]==44] [xR11[45,64]==0] +
391+
; [51 ≤ xR11[0,8] ≤ 53] [xR11[13,64]==0] + [xR11[0,8]==59] [xR11[16,64]==0] + [60 ≤ xR11[0,8] ≤ 67] [xR11[40,64]==0] +
392+
; [76 ≤ xR11[0,8] ≤ 78] [xR11[8,64]==0]
393+
; ]
387394

388395
;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
389396
; (1) { [xR8==224] [(xR12[15,23]==0) + (xR12[15,23]==9)] [0 ≤ xR12[32,64] ≤ 0x2000000] [(0 ≤ xR12[32,64] ≤ 0x2000000) (xR12[32,64])]mem } ;
@@ -399,13 +406,21 @@ _main:
399406
shr rdx, 32 ; rdx = xR12[32,64]
400407
and rcx, 0
401408
or rcx, rdx ; rcx = xR12[32,64]
402-
and rcx, 0xFE000000 ; rcx = (xR12[32,64]) (0xFE000000)
409+
and rdi, 0
410+
or rdi, 0x01FFFFFF
411+
not rdi
412+
and edi, edi ; rdi = 0xFE000000
413+
and rcx, rdi ; rcx = (xR12[32,64]) (0xFE000000)
403414
compare rcx, 0 ; rax = ((xR12[32,64]) (0xFE000000) == 0)
404415
and rcx, 0
405416
or rcx, rax ; rcx = ((xR12[32,64]) (0xFE000000) == 0)
406417
and rsi, 0
407418
or rsi, rdx ; rsi = xR12[32,64]
408-
and rsi, 0xFDFFFFFF ; rsi = (xR12[32,64]) (0xFDFFFFFF)
419+
and rdi, 0
420+
or rdi, 0x02000000
421+
not rdi
422+
and edi, edi ; rdi = 0xFDFFFFFF
423+
and rsi, rdi ; rsi = (xR12[32,64]) (0xFDFFFFFF)
409424
compare rsi, 0 ; rax = ((xR12[32,64]) (0xFDFFFFFF) == 0)
410425
or rcx, rax ; rcx = [((xR12[32,64]) (0xFE000000) == 0) + ((xR12[32,64]) (0xFDFFFFFF) == 0)]
411426
and_64 rcx, rdx ; rax = (xR12[32,64] ≤ 0x2000000) xR12[32,64] (either 0 or xR12[32,64] if within boundary)
@@ -466,7 +481,29 @@ _main:
466481
;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
467482
; (3) { (xR8==160) (INSTRUCTION_FORMAT_CORRECT) (xR11[8,40]) } ;
468483
;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
469-
484+
; INSTRUCTION_FORMAT_CORRECT =
485+
; [
486+
; (a) [0 ≤ xR11[0,8] ≤ 2] [(xR11[23,27]==1) + (xR11[23,27]==2) + (xR11[23,27]==4) + (xR11[23,27]==8)] [xR11[59,64]==0] +
487+
; (b) [9 ≤ xR11[0,8] ≤ 10] [xR11[50,64]==0] + [17 ≤ xR11[0,8] ≤ 33] [xR11[18,64]==0] + [xR11[0,8]==44] [xR11[45,64]==0] +
488+
; (c) [51 ≤ xR11[0,8] ≤ 53] [xR11[13,64]==0] + [xR11[0,8]==59] [xR11[16,64]==0] + [60 ≤ xR11[0,8] ≤ 67] [xR11[40,64]==0] +
489+
; (d) [76 ≤ xR11[0,8] ≤ 78] [xR11[8,64]==0]
490+
; ]
491+
and rcx, 0
492+
or rcx, r11
493+
and rcx, 0xFF ; rcx = xR11[0,8]
494+
compare rcx, 0 ; rax = (xR11[0,8]==0)
495+
and rsi, 0
496+
or rsi, rax ; rsi = (xR11[0,8]==0)
497+
compare rcx, 1
498+
or rsi, rax ; rsi = (xR11[0,8]==0) + (xR11[0,8]==1)
499+
compare rcx, 2
500+
or rsi, rax ; rsi = (xR11[0,8]==0) + (xR11[0,8]==1) + (xR11[0,8]==2)
501+
and rcx, 0
502+
or rcx, r11
503+
shr rcx, 23
504+
and rcx, 0xF ; rcx = xR11[23,27]
505+
506+
470507
;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;
471508
; (3) END { (xR8==160) (INSTRUCTION_FORMAT_CORRECT) (xR11[8,40]) } ;
472509
;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------;

0 commit comments

Comments
 (0)