From 492b6f0ea41ee5ef22d4a5771c6142a41cbac6d6 Mon Sep 17 00:00:00 2001 From: Ross Thompson Date: Fri, 13 Aug 2021 14:53:43 -0500 Subject: [PATCH] Fixed bugs with CSR checking. The parsing algorithm was messing up the token order after the CSR token. --- wally-pipelined/testbench/testbench-linux.sv | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wally-pipelined/testbench/testbench-linux.sv b/wally-pipelined/testbench/testbench-linux.sv index 6a47328a1..a7160d808 100644 --- a/wally-pipelined/testbench/testbench-linux.sv +++ b/wally-pipelined/testbench/testbench-linux.sv @@ -210,12 +210,19 @@ module testbench(); MarkerIndex += 4; - // parse CSRs + // parse CSRs, because there are 1 or more CSRs after the CSR token + // we check if the CSR token or the number of CSRs is greater than 0. + // if so then we want to parse for a CSR. end else if(ExpectedTokens[MarkerIndex] == "CSR" || NumCSRM > 0) begin - MarkerIndex++; + if(ExpectedTokens[MarkerIndex] == "CSR") begin + // all additional CSR's won't have this token. + MarkerIndex++; + end matchCount = $sscanf(ExpectedTokens[MarkerIndex], "%s", ExpectedCSRArrayM[NumCSRM]); matchCount = $sscanf(ExpectedTokens[MarkerIndex+1], "%x", ExpectedCSRArrayValueM[NumCSRM]); + MarkerIndex += 2; + // if we get an xcause with the interrupt bit set we must generate an interrupt as interrupts // are imprecise. Forcing the trap at this time will allow wally to track what qemu does. // the msb of xcause will be set.