Initial testgen checkin

This commit is contained in:
David Harris 2021-01-19 13:09:56 -05:00
parent f9ad54f18c
commit 820312bc87
2 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,38 @@
# testgen-ADD-SUB.py
#
# David_Harris@hmc.edu 19 January 2021
#
# Generate directed and random test vectors for RISC-V Design Validation.
# libraries
#import bitstream as bs
#corners = [0, 1, 2, 0xFF, 0x624B3E97CC52DD14, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF,
# 0x8000000000000000, 0x8000000000000001, 0xC365DDEB9173AB42, 0xFFFFFFFFFFFFFFFE, 0xFFFFFFFFFFFFFFFF]
corners = [0, 1, 2, 255]
testname = "ADD-SUB"
fname = "WALLY-" + testname
testnum = 0;
# Testcase 0: rs1:x31(0x10fd3dedadea5195), rs2:x16(0xdf7f3844121bcc23), result rd:x1(0xf07c7631c0061db8)
# li x16, MASK_XLEN(0xdf7f3844121bcc23)
#li x31, MASK_XLEN(0x10fd3dedadea5195)
# add x1, x31, x16
# sd x1, 0(x6)
#RVTEST_IO_ASSERT_GPR_EQ(x7, x1, 0xf07c7631c0061db8)
f = open(fname, "w")
for a in corners:
for b in corners:
tc = "# Testcase " + str(testnum
f.write(tc)
line = "li x1, MASK_XLEN(" + str(a) + ")"
f.write(line)
testnum = testnum+1
f.close()

View File

@ -0,0 +1,37 @@
//
// Copyright (C) 2021 Harvey Mudd College & Oklahoma State University
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
///////////////////////////////////////////
#include "riscv_test_macros.h"
#include "compliance_test.h"
#include "compliance_io.h"
RV_COMPLIANCE_RV64M
RV_COMPLIANCE_CODE_BEGIN
RVTEST_IO_INIT
RVTEST_IO_ASSERT_GPR_EQ(x31, x0, 0x00000000)
RVTEST_IO_WRITE_STR(x31, "Test Begin\n")
# ---------------------------------------------------------------------------------------------
RVTEST_IO_WRITE_STR(x31, "# Test group 1\n")
# address for test results
la x6, test_1_res