From 60f79fd74f29a4896f73a99f78bbf12f85f5ba3b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 21 May 2021 15:19:39 +0100 Subject: [PATCH] test with default godbolt.org loop example, slightly modified to run attn in order to halt --- src/openpower/decoder/isa/pypowersim.py | 2 +- src/test/basic_pypowersim/Makefile | 2 +- src/test/basic_pypowersim/square.s | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/test/basic_pypowersim/square.s diff --git a/src/openpower/decoder/isa/pypowersim.py b/src/openpower/decoder/isa/pypowersim.py index 50d58c07..1c631630 100644 --- a/src/openpower/decoder/isa/pypowersim.py +++ b/src/openpower/decoder/isa/pypowersim.py @@ -93,7 +93,7 @@ def run_tst(args, generator, initial_regs, yield pdecode2.dec.bigendian.eq(0) # little / big? pc = simulator.pc.CIA.value index = pc//4 - while index < len(instructions): + while index < len(instructions) and not simulator.halted: print("instr pc", pc) try: yield from simulator.setup_one() diff --git a/src/test/basic_pypowersim/Makefile b/src/test/basic_pypowersim/Makefile index 80870f57..afd15f33 100644 --- a/src/test/basic_pypowersim/Makefile +++ b/src/test/basic_pypowersim/Makefile @@ -11,7 +11,7 @@ sim: kernel.bin clean: rm *.o *.elf *.bin -kernel.elf: testloop.o +kernel.elf: square.o $(TOOLCHAIN)-ld $^ -EL -o $@ -T memmap kernel.bin: kernel.elf diff --git a/src/test/basic_pypowersim/square.s b/src/test/basic_pypowersim/square.s new file mode 100644 index 00000000..38ed5bce --- /dev/null +++ b/src/test/basic_pypowersim/square.s @@ -0,0 +1,18 @@ + std 31,-8(1) + stdu 1,-48(1) + mr 31,1 + li 12,5 +.L3: + mr 9,12 + addi 9,9,-1 + mr 12,9 + mr 9,12 + cmpdi 7,9,0 + beq 7,.L4 + b .L3 +.L4: + addi 1,31,48 + ld 31,-8(1) + attn + .long 0 + .byte 0,9,0,0,128,1,0,1 -- 2.30.2