diff options
| author | s-ol <s+removethis@s-ol.nu> | 2021-06-08 15:46:37 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2021-06-08 15:46:37 +0000 |
| commit | c2be2195f0fb036a39f8c8842350694309c65922 (patch) | |
| tree | 5a7ba49d2d81f70baada51426ebfe75af4d5644f | |
| parent | fix jalr immediate slice, update example stage results (diff) | |
| download | subv-c2be2195f0fb036a39f8c8842350694309c65922.tar.gz subv-c2be2195f0fb036a39f8c8842350694309c65922.zip | |
new test case for survey.py
| -rwxr-xr-x | survey.py | 42 |
1 files changed, 38 insertions, 4 deletions
@@ -54,13 +54,47 @@ Resolves label references and substitutes them with literal values. 23/7 00/5 02/3 05/5 06/5 00/7 # jump back up to the top 6f/7 00/5 ff/8 1/1 3e6/10 1/1 + +>>> # doctest: +REPORT_NDIFF +... print(subv.join_all(survey(StringIO(''' +... == code 0x80000000 +... # repeatedly print "Hi\\\\n" +... main: +... # load 0x10010000 (UART0) into t0 +... 37/7 05/5 10010/20 +... # store 0x48 (H) in UART0+0 +... 13/7 06/5 0/3 00/5 048/12 +... 23/7 00/5 2/3 05/5 06/5 00/7 +... # store 0x69 (i) in UART0+0 +... 13/7 06/5 0/3 00/5 069/12 +... 23/7 00/5 2/3 05/5 06/5 00/7 +... # store 0x0a (\\\\n) in UART0+0 +... 13/7 06/5 0/3 00/5 00a/12 +... 23/7 00/5 2/3 05/5 06/5 00/7 +... # jump back up to the top +... 17/7 07/5 main/off32/[31:12] +... 67/7 00/5 0/3 07/5 main+4/off32/[11:0] +... '''[1:-1])))) +== code 0x80000000 +# repeatedly print "Hi\\n" +# main: +# load 0x10010000 (UART0) into t0 +37/7 05/5 10010/20 +# store 0x48 (H) in UART0+0 +13/7 06/5 00/3 00/5 48/12 +23/7 00/5 02/3 05/5 06/5 00/7 +# store 0x69 (i) in UART0+0 +13/7 06/5 00/3 00/5 69/12 +23/7 00/5 02/3 05/5 06/5 00/7 +# store 0x0a (\\n) in UART0+0 +13/7 06/5 00/3 00/5 0a/12 +23/7 00/5 02/3 05/5 06/5 00/7 +# jump back up to the top +17/7 07/5 00000/20 +67/7 00/5 00/3 07/5 fe4/12 """ import subv import bits -import re - -slice_re = re.compile(r"^([^\[]+)(?:\[(\d+):(\d+)\])?$") -field_re = re.compile(r"^(imm|off)(\d+)$") def observe(word, pc, map): |
