This commit is contained in:
Jaka Furlan 2025-11-30 17:33:10 +01:00
parent 303f5e06a7
commit 7106f34a4e
10 changed files with 91 additions and 16 deletions

22
ass1/arithr.log Normal file
View file

@ -0,0 +1,22 @@
***** Section <default> *****
Stats: size=79 blocks=79 symbols=11 literals=0 relocations=0
Blocks
name start size #ins #dir #sto
<default> 00000 0004F 21 4 6
Symbols
name hex dec scope kind type description
arith 000000 0 exported relative code label
diff 000040 64 local relative data label
halt 000034 52 local relative code label
mod 000049 73 local relative data label
prod 000043 67 local relative data label
quot 000046 70 local relative data label
start 000000 0 local relative code label
sum 00003D 61 local relative data label
x 000037 55 local relative data label
y 00003A 58 local relative data label
z 00004C 76 local relative data label
Literals
label definition
Relocations
address length flag symbol

46
ass1/arithr.lst Normal file
View file

@ -0,0 +1,46 @@
00000 arith START 0
00000 772034 start LDT x
00003 6F2034 LDS y
00006 9054 ADDR T,S . shrani vsoto
00008 7F2032 STS sum
0000B 9454 SUBR T,S . resetiraj S nazaj na y
0000D 9445 SUBR S,T
0000F 87202E STT diff . shrani razliko
00012 9045 ADDR S,T . popravi T
00014 9854 MULR T,S
00016 7F202A STS prod . sharni produkt
00019 77201B LDT x
0001C 6F201B LDS y
0001F 9C45 DIVR S,T
00021 872022 STT quot . shrani kvocient
00024 772010 LDT x
00027 6F2010 LDS y
0002A 6B2019 LDB quot
0002D 9843 MULR S,B
0002F 9435 SUBR B,T
00031 872015 STT mod . shrani modulo
00034 3F2FFD halt J halt
00037 END start
. podatki
00037 000014 x WORD 20
0003A 000003 y WORD 3
. rezultati
0003D 000000 sum RESW 1
00040 000000 diff RESW 1
00043 000000 prod RESW 1
00046 000000 quot RESW 1
00049 000000 mod RESW 1
. za modulo
0004C 000000 z RESW 1

5
ass1/arithr.obj Normal file
View file

@ -0,0 +1,5 @@
Harith 00000000004F
T0000001E7720346F203490547F20329454944587202E904598547F202A77201B6F20
T00001E1E1B9C458720227720106F20106B2019984394358720153F2FFD0000140000
T00003C0103
E000000

View file

@ -1,4 +1,5 @@
poly START 0 poly START 0
LDB x1
END poly END poly
x1 WORD 1 x1 WORD 1

View file

@ -1,12 +1,12 @@
***** Section <default> ***** ***** Section <default> *****
Stats: size=3 blocks=3 symbols=2 literals=0 relocations=0 Stats: size=6 blocks=6 symbols=2 literals=0 relocations=0
Blocks Blocks
name start size #ins #dir #sto name start size #ins #dir #sto
<default> 00000 00003 0 3 0 <default> 00000 00006 1 3 0
Symbols Symbols
name hex dec scope kind type description name hex dec scope kind type description
poly 000000 0 exported relative code label poly 000000 0 exported relative code label
x1 000000 0 local relative data label x1 000003 3 local relative data label
Literals Literals
label definition label definition
Relocations Relocations

View file

@ -1,4 +1,5 @@
00000 poly START 0 00000 poly START 0
00000 END poly 00000 6B2000 LDB x1
00003 END poly
00000 000001 x1 WORD 1 00003 000001 x1 WORD 1

View file

@ -1,3 +1,3 @@
Hpoly 000000000003 Hpoly 000000000006
T00000003000001 T000000066B2000000001
E000000 E000000

View file

@ -8,9 +8,9 @@ let state = Processor.{regs; memory}
(* Test function *) (* Test function *)
let test_runner () = let test_runner () =
let khz = 0.001 in let khz = 0.001 in
Processor.print_memory state 50; Processor.print_memory state 80;
Loader.load_object_file state "/mnt/c/Programiranje/SPO/ass1/horner.obj"; Loader.load_object_file state "/mnt/c/Programiranje/SPO/ass1/arithr.obj";
Processor.print_memory state 50; Processor.print_memory state 80;
Printf.printf "\n\n---Starting execution!---\n\n"; Printf.printf "\n\n---Starting execution!---\n\n";
Pogajalnik.run state khz Pogajalnik.run state khz

View file

@ -195,11 +195,11 @@ let executeFormat3 (state : Processor.state) (nixbpe : nixbpe) (mnemonic: Opcode
| STB -> IzvajalnikF3.stb state operand | STB -> IzvajalnikF3.stb state operand
| STCH -> notImplemented "STCH4" | STCH -> notImplemented "STCH4"
| STF -> notImplemented "STF4" | STF -> notImplemented "STF4"
| STL -> IzvajalnikF3.stl state operand | STL -> IzvajalnikF3.stl state ea
| STS -> IzvajalnikF3.sts state operand | STS -> IzvajalnikF3.sts state ea
| STSW -> IzvajalnikF3.stsw state operand | STSW -> IzvajalnikF3.stsw state ea
| STT -> IzvajalnikF3.stt state operand | STT -> IzvajalnikF3.stt state ea
| STX -> IzvajalnikF3.stx state operand | STX -> IzvajalnikF3.stx state ea
(* Control / IO *) (* Control / IO *)
| TIX -> IzvajalnikF3.tix state operand | TIX -> IzvajalnikF3.tix state operand

View file

@ -10,7 +10,7 @@ let run (state : Processor.state) (khz : float) : unit =
(*printni stanje*) (*printni stanje*)
Printf.printf "After execution:\n"; Printf.printf "After execution:\n";
Processor.print_regs state; Processor.print_regs state;
Processor.print_memory state 50; Processor.print_memory state 80;
flush stdout; flush stdout;
(*spi*) (*spi*)