
// -----------
// This file was generated by riscv_ctg (https://gitlab.com/incoresemi/riscv-compliance/riscv_ctg)
// version   : 0.4.1
// timestamp : Wed Dec 16 03:37:04 2020 GMT
// usage     : riscv_ctg \
//                  -- cgf ('/scratch/git-repo/incoresemi/riscv-compliance/riscv_ctg/sample_cgfs/dataset.cgf', '/scratch/git-repo/incoresemi/riscv-compliance/riscv_ctg/sample_cgfs/rv32ic.cgf') \
//                  -- xlen 32 \
// -----------
//
// -----------
// Copyright (c) 2020. RISC-V International. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
// -----------
//
// This assembly file tests the c.bnez instruction of the RISC-V C extension for the cbnez covergroup.
// 
#include "model_test.h"
#include "arch_test.h"
RVTEST_ISA("RV32IC")

.section .text.init
.globl rvtest_entry_point
rvtest_entry_point:
RVMODEL_BOOT
RVTEST_CODE_BEGIN

#ifdef TEST_CASE_1

RVTEST_CASE(0,"//check ISA:=regex(.*32.*);check ISA:=regex(.*I.*C.*);def TEST_CASE_1=True;",cbnez)

RVTEST_SIGBASE( x1,signature_x1_1)

inst_0:
// rs1==x10, rs1_val == (-2**(xlen-1)), rs1_val == -2147483648, rs1_val < 0 and imm_val > 0
// opcode: c.bnez; op1:x10; op1val:-0x80000000; immval:0x7e
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x80000000, 0x7e, 3f, x1, 0)

inst_1:
// rs1==x15, rs1_val == 0, rs1_val == 0 and imm_val < 0, rs1_val==0
// opcode: c.bnez; op1:x15; op1val:0x0; immval:0xac
TEST_CBRANCH_OP(c.bnez, x2, x15, 0x0, 0xac, 1b, x1, 4)

inst_2:
// rs1==x11, rs1_val == (2**(xlen-1)-1), rs1_val == 2147483647, rs1_val > 0 and imm_val > 0
// opcode: c.bnez; op1:x11; op1val:0x7fffffff; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x11, 0x7fffffff, 0x80, 3f, x1, 8)

inst_3:
// rs1==x14, rs1_val == 1, 
// opcode: c.bnez; op1:x14; op1val:0x1; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x14, 0x1, 0xe, 3f, x1, 12)

inst_4:
// rs1==x12, rs1_val == 0 and imm_val > 0, 
// opcode: c.bnez; op1:x12; op1val:0x0; immval:0xaa
TEST_CBRANCH_OP(c.bnez, x2, x12, 0x0, 0xaa, 3f, x1, 16)

inst_5:
// rs1==x9, rs1_val > 0 and imm_val < 0, rs1_val==858993459
// opcode: c.bnez; op1:x9; op1val:0x33333333; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x9, 0x33333333, 0x8, 1b, x1, 20)

inst_6:
// rs1==x8, rs1_val < 0 and imm_val < 0, rs1_val == -5
// opcode: c.bnez; op1:x8; op1val:-0x5; immval:0x22
TEST_CBRANCH_OP(c.bnez, x2, x8, -0x5, 0x22, 1b, x1, 24)

inst_7:
// rs1==x13, rs1_val == 2, rs1_val==2
// opcode: c.bnez; op1:x13; op1val:0x2; immval:0x10
TEST_CBRANCH_OP(c.bnez, x2, x13, 0x2, 0x10, 3f, x1, 28)

inst_8:
// rs1_val == 4, rs1_val==4
// opcode: c.bnez; op1:x10; op1val:0x4; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x4, 0x8, 3f, x1, 32)

inst_9:
// rs1_val == 8, 
// opcode: c.bnez; op1:x10; op1val:0x8; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x8, 0x12, 1b, x1, 36)

inst_10:
// rs1_val == 16, 
// opcode: c.bnez; op1:x10; op1val:0x10; immval:0x22
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x10, 0x22, 1b, x1, 40)

inst_11:
// rs1_val == 32, 
// opcode: c.bnez; op1:x10; op1val:0x20; immval:0x7e
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x20, 0x7e, 3f, x1, 44)

inst_12:
// rs1_val == 64, 
// opcode: c.bnez; op1:x10; op1val:0x40; immval:0x20
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x40, 0x20, 3f, x1, 48)

inst_13:
// rs1_val == 128, 
// opcode: c.bnez; op1:x10; op1val:0x80; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x80, 0x8, 1b, x1, 52)

inst_14:
// rs1_val == 256, 
// opcode: c.bnez; op1:x10; op1val:0x100; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x100, 0x8, 1b, x1, 56)

inst_15:
// rs1_val == 512, 
// opcode: c.bnez; op1:x10; op1val:0x200; immval:0xac
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x200, 0xac, 1b, x1, 60)

inst_16:
// rs1_val == 1024, 
// opcode: c.bnez; op1:x10; op1val:0x400; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x400, 0x12, 3f, x1, 64)

inst_17:
// rs1_val == 2048, 
// opcode: c.bnez; op1:x10; op1val:0x800; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x800, 0x80, 3f, x1, 68)

inst_18:
// rs1_val == 4096, 
// opcode: c.bnez; op1:x10; op1val:0x1000; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x1000, 0x12, 1b, x1, 72)

inst_19:
// rs1_val == 8192, 
// opcode: c.bnez; op1:x10; op1val:0x2000; immval:0xa
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x2000, 0xa, 3f, x1, 76)

inst_20:
// rs1_val == 16384, 
// opcode: c.bnez; op1:x10; op1val:0x4000; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x4000, 0x8, 3f, x1, 80)

inst_21:
// rs1_val == 32768, 
// opcode: c.bnez; op1:x10; op1val:0x8000; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x8000, 0x12, 1b, x1, 84)

inst_22:
// rs1_val == 65536, 
// opcode: c.bnez; op1:x10; op1val:0x10000; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x10000, 0x8, 1b, x1, 88)

inst_23:
// rs1_val == 131072, 
// opcode: c.bnez; op1:x10; op1val:0x20000; immval:0x42
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x20000, 0x42, 1b, x1, 92)

inst_24:
// rs1_val == 262144, 
// opcode: c.bnez; op1:x10; op1val:0x40000; immval:0xac
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x40000, 0xac, 1b, x1, 96)

inst_25:
// rs1_val == 524288, 
// opcode: c.bnez; op1:x10; op1val:0x80000; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x80000, 0x12, 1b, x1, 100)

inst_26:
// rs1_val == 1048576, 
// opcode: c.bnez; op1:x10; op1val:0x100000; immval:0x14
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x100000, 0x14, 1b, x1, 104)

inst_27:
// rs1_val == 2097152, 
// opcode: c.bnez; op1:x10; op1val:0x200000; immval:0x4
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x200000, 0x4, 1b, x1, 108)

inst_28:
// rs1_val == 4194304, 
// opcode: c.bnez; op1:x10; op1val:0x400000; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x400000, 0xe, 3f, x1, 112)

inst_29:
// rs1_val == 8388608, 
// opcode: c.bnez; op1:x10; op1val:0x800000; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x800000, 0xe, 1b, x1, 116)

inst_30:
// rs1_val == 16777216, 
// opcode: c.bnez; op1:x10; op1val:0x1000000; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x1000000, 0xe, 3f, x1, 120)

inst_31:
// rs1_val == 33554432, 
// opcode: c.bnez; op1:x10; op1val:0x2000000; immval:0xac
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x2000000, 0xac, 1b, x1, 124)

inst_32:
// rs1_val == 67108864, 
// opcode: c.bnez; op1:x10; op1val:0x4000000; immval:0x6
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x4000000, 0x6, 1b, x1, 128)

inst_33:
// rs1_val == 134217728, 
// opcode: c.bnez; op1:x10; op1val:0x8000000; immval:0xa
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x8000000, 0xa, 1b, x1, 132)

inst_34:
// rs1_val == 268435456, 
// opcode: c.bnez; op1:x10; op1val:0x10000000; immval:0x10
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x10000000, 0x10, 3f, x1, 136)

inst_35:
// rs1_val == 536870912, 
// opcode: c.bnez; op1:x10; op1val:0x20000000; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x20000000, 0x8, 1b, x1, 140)

inst_36:
// rs1_val == 1073741824, 
// opcode: c.bnez; op1:x10; op1val:0x40000000; immval:0xaa
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x40000000, 0xaa, 3f, x1, 144)

inst_37:
// rs1_val == -2, 
// opcode: c.bnez; op1:x10; op1val:-0x2; immval:0x4
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x2, 0x4, 1b, x1, 148)

inst_38:
// rs1_val == -3, 
// opcode: c.bnez; op1:x10; op1val:-0x3; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x3, 0x12, 3f, x1, 152)

inst_39:
// rs1_val == -9, 
// opcode: c.bnez; op1:x10; op1val:-0x9; immval:0x22
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x9, 0x22, 1b, x1, 156)

inst_40:
// rs1_val == -17, 
// opcode: c.bnez; op1:x10; op1val:-0x11; immval:0x6
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x11, 0x6, 3f, x1, 160)

inst_41:
// rs1_val == -33, 
// opcode: c.bnez; op1:x10; op1val:-0x21; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x21, 0x80, 1b, x1, 164)

inst_42:
// rs1_val == -65, 
// opcode: c.bnez; op1:x10; op1val:-0x41; immval:0x6
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x41, 0x6, 1b, x1, 168)

inst_43:
// rs1_val == -129, 
// opcode: c.bnez; op1:x10; op1val:-0x81; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x81, 0x8, 1b, x1, 172)

inst_44:
// rs1_val == -257, 
// opcode: c.bnez; op1:x10; op1val:-0x101; immval:0x14
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x101, 0x14, 1b, x1, 176)

inst_45:
// rs1_val == -513, 
// opcode: c.bnez; op1:x10; op1val:-0x201; immval:0x82
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x201, 0x82, 1b, x1, 180)

inst_46:
// rs1_val == -1025, 
// opcode: c.bnez; op1:x10; op1val:-0x401; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x401, 0x12, 3f, x1, 184)

inst_47:
// rs1_val == -2049, 
// opcode: c.bnez; op1:x10; op1val:-0x801; immval:0xa
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x801, 0xa, 3f, x1, 188)

inst_48:
// rs1_val == -4097, 
// opcode: c.bnez; op1:x10; op1val:-0x1001; immval:0xc
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x1001, 0xc, 1b, x1, 192)

inst_49:
// rs1_val == -8193, 
// opcode: c.bnez; op1:x10; op1val:-0x2001; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x2001, 0xe, 1b, x1, 196)

inst_50:
// rs1_val == -16385, 
// opcode: c.bnez; op1:x10; op1val:-0x4001; immval:0x22
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x4001, 0x22, 1b, x1, 200)

inst_51:
// rs1_val == -32769, 
// opcode: c.bnez; op1:x10; op1val:-0x8001; immval:0xc
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x8001, 0xc, 3f, x1, 204)

inst_52:
// rs1_val == -65537, 
// opcode: c.bnez; op1:x10; op1val:-0x10001; immval:0x14
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x10001, 0x14, 1b, x1, 208)

inst_53:
// rs1_val == -131073, 
// opcode: c.bnez; op1:x10; op1val:-0x20001; immval:0x42
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x20001, 0x42, 1b, x1, 212)

inst_54:
// rs1_val == -262145, 
// opcode: c.bnez; op1:x10; op1val:-0x40001; immval:0x40
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x40001, 0x40, 3f, x1, 216)

inst_55:
// rs1_val == -524289, 
// opcode: c.bnez; op1:x10; op1val:-0x80001; immval:0x8
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x80001, 0x8, 3f, x1, 220)

inst_56:
// rs1_val == -8388609, 
// opcode: c.bnez; op1:x10; op1val:-0x800001; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x800001, 0x80, 1b, x1, 224)

inst_57:
// rs1_val == -16777217, 
// opcode: c.bnez; op1:x10; op1val:-0x1000001; immval:0x4
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x1000001, 0x4, 3f, x1, 228)

inst_58:
// rs1_val == -33554433, 
// opcode: c.bnez; op1:x10; op1val:-0x2000001; immval:0x14
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x2000001, 0x14, 1b, x1, 232)

inst_59:
// rs1_val == -67108865, 
// opcode: c.bnez; op1:x10; op1val:-0x4000001; immval:0x7e
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x4000001, 0x7e, 3f, x1, 236)

inst_60:
// rs1_val == -134217729, 
// opcode: c.bnez; op1:x10; op1val:-0x8000001; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x8000001, 0x80, 3f, x1, 240)

inst_61:
// rs1_val == -268435457, 
// opcode: c.bnez; op1:x10; op1val:-0x10000001; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x10000001, 0x12, 1b, x1, 244)

inst_62:
// rs1_val == -536870913, 
// opcode: c.bnez; op1:x10; op1val:-0x20000001; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x20000001, 0xe, 1b, x1, 248)

inst_63:
// rs1_val == -1073741825, 
// opcode: c.bnez; op1:x10; op1val:-0x40000001; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x40000001, 0xe, 1b, x1, 252)

inst_64:
// rs1_val == 1431655765, rs1_val==1431655765
// opcode: c.bnez; op1:x10; op1val:0x55555555; immval:0xc
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x55555555, 0xc, 1b, x1, 256)

inst_65:
// rs1_val == -1431655766, rs1_val==-1431655766
// opcode: c.bnez; op1:x10; op1val:-0x55555556; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x55555556, 0x80, 3f, x1, 260)

inst_66:
// rs1_val==3, 
// opcode: c.bnez; op1:x10; op1val:0x3; immval:0x10
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x3, 0x10, 1b, x1, 264)

inst_67:
// rs1_val==5, 
// opcode: c.bnez; op1:x10; op1val:0x5; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x5, 0x80, 1b, x1, 268)

inst_68:
// rs1_val==1717986918, 
// opcode: c.bnez; op1:x10; op1val:0x66666666; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x66666666, 0x12, 3f, x1, 272)

inst_69:
// rs1_val==-46340, 
// opcode: c.bnez; op1:x10; op1val:-0xb504; immval:0x7e
TEST_CBRANCH_OP(c.bnez, x2, x10, -0xb504, 0x7e, 3f, x1, 276)

inst_70:
// rs1_val==46341, 
// opcode: c.bnez; op1:x10; op1val:0xb505; immval:0x10
TEST_CBRANCH_OP(c.bnez, x2, x10, 0xb505, 0x10, 1b, x1, 280)

inst_71:
// rs1_val==-46339, 
// opcode: c.bnez; op1:x10; op1val:-0xb503; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, -0xb503, 0xe, 1b, x1, 284)

inst_72:
// rs1_val==46340, 
// opcode: c.bnez; op1:x10; op1val:0xb504; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, 0xb504, 0x80, 3f, x1, 288)

inst_73:
// rs1_val==1431655764, 
// opcode: c.bnez; op1:x10; op1val:0x55555554; immval:0x4
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x55555554, 0x4, 3f, x1, 292)

inst_74:
// rs1_val == -1048577, 
// opcode: c.bnez; op1:x10; op1val:-0x100001; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x100001, 0x12, 1b, x1, 296)

inst_75:
// rs1_val==1717986919, 
// opcode: c.bnez; op1:x10; op1val:0x66666667; immval:0x20
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x66666667, 0x20, 3f, x1, 300)

inst_76:
// rs1_val==858993458, 
// opcode: c.bnez; op1:x10; op1val:0x33333332; immval:0x10
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x33333332, 0x10, 1b, x1, 304)

inst_77:
// rs1_val==1717986917, 
// opcode: c.bnez; op1:x10; op1val:0x66666665; immval:0x40
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x66666665, 0x40, 3f, x1, 308)

inst_78:
// rs1_val==46339, 
// opcode: c.bnez; op1:x10; op1val:0xb503; immval:0x42
TEST_CBRANCH_OP(c.bnez, x2, x10, 0xb503, 0x42, 1b, x1, 312)

inst_79:
// rs1_val==1431655766, 
// opcode: c.bnez; op1:x10; op1val:0x55555556; immval:0x4
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x55555556, 0x4, 3f, x1, 316)

inst_80:
// rs1_val==-1431655765, 
// opcode: c.bnez; op1:x10; op1val:-0x55555555; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x55555555, 0xe, 1b, x1, 320)

inst_81:
// rs1_val==6, 
// opcode: c.bnez; op1:x10; op1val:0x6; immval:0x80
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x6, 0x80, 1b, x1, 324)

inst_82:
// rs1_val==858993460, 
// opcode: c.bnez; op1:x10; op1val:0x33333334; immval:0xe
TEST_CBRANCH_OP(c.bnez, x2, x10, 0x33333334, 0xe, 1b, x1, 328)

inst_83:
// rs1_val == -2097153, 
// opcode: c.bnez; op1:x10; op1val:-0x200001; immval:0xac
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x200001, 0xac, 1b, x1, 332)

inst_84:
// rs1_val == -4194305, 
// opcode: c.bnez; op1:x10; op1val:-0x400001; immval:0x12
TEST_CBRANCH_OP(c.bnez, x2, x10, -0x400001, 0x12, 1b, x1, 336)
#endif


RVTEST_CODE_END
RVMODEL_HALT

RVTEST_DATA_BEGIN
.align 4
rvtest_data:
.word 0xbabecafe
RVTEST_DATA_END

RVMODEL_DATA_BEGIN


signature_x1_0:
    .fill 0*(XLEN/32),4,0xdeadbeef


signature_x1_1:
    .fill 85*(XLEN/32),4,0xdeadbeef

#ifdef rvtest_mtrap_routine

mtrap_sigptr:
    .fill 64*(XLEN/32),4,0xdeadbeef

#endif

#ifdef rvtest_gpr_save

gpr_save:
    .fill 32*(XLEN/32),4,0xdeadbeef

#endif

RVMODEL_DATA_END
