From 99c712d52e4a9ff932162118677f228a332f1c01 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 12 Feb 2021 15:23:44 +0000 Subject: [PATCH] add one SVP64 ALU test case to get started --- src/soc/fu/alu/svp64_cases.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/soc/fu/alu/svp64_cases.py diff --git a/src/soc/fu/alu/svp64_cases.py b/src/soc/fu/alu/svp64_cases.py new file mode 100644 index 00000000..f6ed2720 --- /dev/null +++ b/src/soc/fu/alu/svp64_cases.py @@ -0,0 +1,30 @@ +import random +from soc.fu.test.common import (TestCase, TestAccumulatorBase) +from soc.config.endian import bigendian +from soc.simulator.program import Program +from soc.decoder.isa.caller import special_sprs +from soc.sv.trans.svp64 import SVP64Asm + + +class ALUTestCase(TestAccumulatorBase): + + def case_1_sv_add(self): + # adds: + # 1 = 5 + 9 => 0x5555 = 0x4321+0x1234 + # 2 = 6 + 10 => 0x3334 = 0x2223+0x1111 + isa = SVP64Asm(['sv.add 1.v, 5.v, 9.v' + ]) + lst = list(isa) + print ("listing", lst) + initial_regs = [0] * 32 + initial_regs[9] = 0x1234 + initial_regs[10] = 0x1111 + initial_regs[5] = 0x4321 + initial_regs[6] = 0x2223 + svstate = SVP64State() + svstate.vl[0:7] = 2 # VL + svstate.maxvl[0:7] = 2 # MAXVL + print ("SVSTATE", bin(svstate.spr.asint())) + + self.add_case(Program(lst, bigendian), initial_regs, + initial_svstate=svstate) -- 2.30.2