diff --git a/ass3/zbirnik/code/directive.go b/ass1/bonus/dijkstra. similarity index 100% rename from ass3/zbirnik/code/directive.go rename to ass1/bonus/dijkstra. diff --git a/ass1/vaje/osnove/arith.asm b/ass1/vaje/osnove/arith.asm index eb0d6c0..8e16cae 100644 --- a/ass1/vaje/osnove/arith.asm +++ b/ass1/vaje/osnove/arith.asm @@ -1,8 +1,7 @@ -arith START 0 - LDA x - ADD y +arith START 0 + LDA x + ADD y STA sum - LDA x SUB y STA diff diff --git a/ass3/zbirnik/code/code.go b/ass3/zbirnik/code/code.go deleted file mode 100644 index 39b8736..0000000 --- a/ass3/zbirnik/code/code.go +++ /dev/null @@ -1,7 +0,0 @@ -package code - -type program struct { - name string - instruction_list - lc uint32 -} diff --git a/ass3/zbirnik/code/comment.go b/ass3/zbirnik/code/comment.go deleted file mode 100644 index acd7d9d..0000000 --- a/ass3/zbirnik/code/comment.go +++ /dev/null @@ -1,11 +0,0 @@ -package comment - -type Comment struct { - value string -} - -func newComment(val string) Comment { - return Comment { - value: val - } -} diff --git a/ass3/zbirnik/code/instruction.go b/ass3/zbirnik/code/instruction.go deleted file mode 100644 index 8d840e0..0000000 --- a/ass3/zbirnik/code/instruction.go +++ /dev/null @@ -1,8 +0,0 @@ -package instruction - -type Instruction interface { - newInstruction() Instruction -} - - -func newInstruction() {} diff --git a/ass3/zbirnik/code/instructionF1.go b/ass3/zbirnik/code/instructionF1.go deleted file mode 100644 index acc61a2..0000000 --- a/ass3/zbirnik/code/instructionF1.go +++ /dev/null @@ -1,11 +0,0 @@ -package instructionF1 - -type InstructionF1 struct { - opcode uint8 -} - -func newInstructionF1(opcode uint8) InstructionF1 { - return InstructionF1 { - opcode: opcode - } -} diff --git a/ass3/zbirnik/code/instructionF2.go b/ass3/zbirnik/code/instructionF2.go deleted file mode 100644 index 875381f..0000000 --- a/ass3/zbirnik/code/instructionF2.go +++ /dev/null @@ -1,7 +0,0 @@ -package instructionF2 - -type InstructionF2 struct { - opcode uint8 - r1 uint8 - r2 uint8 -} diff --git a/ass3/zbirnik/code/instructionF3.go b/ass3/zbirnik/code/instructionF3.go deleted file mode 100644 index 5c8c446..0000000 --- a/ass3/zbirnik/code/instructionF3.go +++ /dev/null @@ -1,25 +0,0 @@ -package instructionF3 - -type InstructionF3 struct { - opcode uint8 - n bool - i bool - x bool - b bool - p bool - e bool - offset uint16 -} - -func newInstructionF3(opcode uint8, n bool, i bool, x bool, b bool, p bool, e bool, offset uint16) InstructionF3 { - return InstructionF3{ - opcode: opcode, - n: n, - i: i, - x: x, - b: b, - p: p, - e: e, - offset: offset - } -} diff --git a/ass3/zbirnik/code/instructionF4.go b/ass3/zbirnik/code/instructionF4.go deleted file mode 100644 index 70b3baf..0000000 --- a/ass3/zbirnik/code/instructionF4.go +++ /dev/null @@ -1,25 +0,0 @@ -package instructionF4 - -type InstructionF4 struct { - opcode uint8, - n bool, - i bool, - x bool, - b bool, - p bool, - e bool, - offset uint32 -} - -func newInstructionF4(opcode uint8, n bool, i bool, x bool, b bool, p bool, e bool, offset uint32) InstructionF4 { - return InstructionF4{ - opcode: opcode, - n: n, - i: i, - x: x, - b: b, - p: p, - e: e, - offset: offset - } -} diff --git a/ass3/zbirnik/code/instructionSIC.go b/ass3/zbirnik/code/instructionSIC.go deleted file mode 100644 index 68bc3c1..0000000 --- a/ass3/zbirnik/code/instructionSIC.go +++ /dev/null @@ -1,26 +0,0 @@ -package instructionSIC - -type InstructionSIC struct { - opcode uint8 - n bool - i bool - x bool - b bool - p bool - e bool - offset uint16 -} - -func newInstructionSIC(opcode uint8, n bool, i bool, x bool, b bool, p bool, e bool, offset uint16) InstructionSIC { - return InstructionSIC{ - opcode: opcode, - n: n, - i: i, - x: x, - b: b, - p: p, - e: e, - offset: offset - } -} - diff --git a/ass3/zbirnik/code/storage.go b/ass3/zbirnik/code/storage.go deleted file mode 100644 index e69de29..0000000 diff --git a/ass3/zbirnik/parsing/input.asm b/ass3/zbirnik/parsing/input.asm index 3062122..34b4541 100644 --- a/ass3/zbirnik/parsing/input.asm +++ b/ass3/zbirnik/parsing/input.asm @@ -1,4 +1,5 @@ arithr START 0 .komentar1 + LDX #10 SHIFTR A, 10, X LDS #11 .komentar2 LDT #5 diff --git a/ass3/zbirnik/parsing/pregledovalnik.go b/ass3/zbirnik/parsing/pregledovalnik.go index 88e01cc..8be54e0 100644 --- a/ass3/zbirnik/parsing/pregledovalnik.go +++ b/ass3/zbirnik/parsing/pregledovalnik.go @@ -125,6 +125,22 @@ type format_F2_rr struct { r2 string } +type format_F3 struct { + oznaka string + opcode int + format int + velikost int +} + +type format_F3_m struct { + oznaka string + opcode int + format int + velikost int + naslov string + x bool +} + func remove_comments_and_empty_lines(el string) bool { match_pure_comment, err := regexp.MatchString(`(?m)^[\t ]*\..*$\n`, el) if err != nil { @@ -187,7 +203,7 @@ func check_F2_n(el string, AST *[]ukaz) bool { nov_ukaz.x = false nov_ukaz.n = temp } - fmt.Println("F2_n ", el[:len(el) - 1], nov_ukaz) + //fmt.Println("F2_n ", el[:len(el) - 1], nov_ukaz) *AST = append(*AST, nov_ukaz) return true } @@ -248,7 +264,7 @@ func check_F2_rn(el string, AST *[]ukaz) bool { nov_ukaz.x = false nov_ukaz.n = temp } - fmt.Println("F2_rn: ", el[:len(el) - 1], nov_ukaz) + //fmt.Println("F2_rn: ", el[:len(el) - 1], nov_ukaz) *AST = append(*AST, nov_ukaz) return true } @@ -305,6 +321,7 @@ func main() { if check_F1(el, &AST) { continue } + // TODO !!! odstrani # in @ in x naslalvljaje od F2 formata, saj nima bitov, da to podpre if check_F2_n(el, &AST) { continue } diff --git a/pk_os_go/g4.go b/pk_os_go/g4.go new file mode 100644 index 0000000..4f8a263 --- /dev/null +++ b/pk_os_go/g4.go @@ -0,0 +1,47 @@ +package main + +import ( + "fmt" + "os" + "runtime" + "runtime/trace" + "time" + debug "runtime/debug" +) + +func child(c chan string) { + for msg := range c { + c <- msg + } +} + +func main() { + f, err := os.Create("trace.out") + if err != nil { + panic(err) + } + defer f.Close() + + if err := trace.Start(f); err != nil { + panic(err) + } + defer trace.Stop() + + runtime.GOMAXPROCS(1) + debug.SetGCPercent(-1) + + c := make(chan string) + go child(c) + + const niters = 2000000 + for i := 0; i < niters; i++ { + c <- "test" + reply := <-c + if len(reply) != 4 { + panic("err") + } + } + + fmt.Println("done") + time.Sleep(1 * time.Second) +} diff --git a/pk_os_go/pk_os_go.pptx b/pk_os_go/pk_os_go.pptx new file mode 100644 index 0000000..dcd16ef Binary files /dev/null and b/pk_os_go/pk_os_go.pptx differ diff --git a/pk_os_go/porocilo.pdf b/pk_os_go/porocilo.pdf new file mode 100644 index 0000000..b4c06b1 Binary files /dev/null and b/pk_os_go/porocilo.pdf differ