
// -----------
// 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.jalr instruction of the RISC-V C extension for the cjalr covergroup.
// 
#include "model_test.h"
#include "arch_test.h"
RVTEST_ISA("RV32IC")

.section .text.init
.org 0x80
.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;",cjalr)

RVTEST_SIGBASE( x10,signature_x10_1)

inst_0:
// rs1==x22, 
// opcode:c.jalr; op1:x22
TEST_CJALR_OP(x11, x22, x10, 0)

inst_1:
// rs1==x30, 
// opcode:c.jalr; op1:x30
TEST_CJALR_OP(x11, x30, x10, 4)

inst_2:
// rs1==x8, 
// opcode:c.jalr; op1:x8
TEST_CJALR_OP(x11, x8, x10, 8)

inst_3:
// rs1==x15, 
// opcode:c.jalr; op1:x15
TEST_CJALR_OP(x11, x15, x10, 12)

inst_4:
// rs1==x17, 
// opcode:c.jalr; op1:x17
TEST_CJALR_OP(x11, x17, x10, 16)

inst_5:
// rs1==x9, 
// opcode:c.jalr; op1:x9
TEST_CJALR_OP(x11, x9, x10, 20)

inst_6:
// rs1==x4, 
// opcode:c.jalr; op1:x4
TEST_CJALR_OP(x11, x4, x10, 24)

inst_7:
// rs1==x5, 
// opcode:c.jalr; op1:x5
TEST_CJALR_OP(x11, x5, x10, 28)

inst_8:
// rs1==x1, 
// opcode:c.jalr; op1:x1
TEST_CJALR_OP(x11, x1, x10, 32)

inst_9:
// rs1==x28, 
// opcode:c.jalr; op1:x28
TEST_CJALR_OP(x11, x28, x10, 36)

inst_10:
// rs1==x31, 
// opcode:c.jalr; op1:x31
TEST_CJALR_OP(x11, x31, x10, 40)

inst_11:
// rs1==x18, 
// opcode:c.jalr; op1:x18
TEST_CJALR_OP(x11, x18, x10, 44)

inst_12:
// rs1==x19, 
// opcode:c.jalr; op1:x19
TEST_CJALR_OP(x11, x19, x10, 48)

inst_13:
// rs1==x7, 
// opcode:c.jalr; op1:x7
TEST_CJALR_OP(x11, x7, x10, 52)

inst_14:
// rs1==x21, 
// opcode:c.jalr; op1:x21
TEST_CJALR_OP(x11, x21, x10, 56)

inst_15:
// rs1==x13, 
// opcode:c.jalr; op1:x13
TEST_CJALR_OP(x11, x13, x10, 60)

inst_16:
// rs1==x29, 
// opcode:c.jalr; op1:x29
TEST_CJALR_OP(x11, x29, x10, 64)

inst_17:
// rs1==x12, 
// opcode:c.jalr; op1:x12
TEST_CJALR_OP(x11, x12, x10, 68)

inst_18:
// rs1==x6, 
// opcode:c.jalr; op1:x6
TEST_CJALR_OP(x11, x6, x10, 72)

inst_19:
// rs1==x20, 
// opcode:c.jalr; op1:x20
TEST_CJALR_OP(x11, x20, x10, 76)

inst_20:
// rs1==x25, 
// opcode:c.jalr; op1:x25
TEST_CJALR_OP(x11, x25, x10, 80)

inst_21:
// rs1==x26, 
// opcode:c.jalr; op1:x26
TEST_CJALR_OP(x11, x26, x10, 84)

inst_22:
// rs1==x24, 
// opcode:c.jalr; op1:x24
TEST_CJALR_OP(x11, x24, x10, 88)

inst_23:
// rs1==x14, 
// opcode:c.jalr; op1:x14
TEST_CJALR_OP(x11, x14, x10, 92)

inst_24:
// rs1==x3, 
// opcode:c.jalr; op1:x3
TEST_CJALR_OP(x11, x3, x10, 96)

inst_25:
// rs1==x27, 
// opcode:c.jalr; op1:x27
TEST_CJALR_OP(x11, x27, x10, 100)

inst_26:
// rs1==x2, 
// opcode:c.jalr; op1:x2
TEST_CJALR_OP(x11, x2, x10, 104)

inst_27:
// rs1==x23, 
// opcode:c.jalr; op1:x23
TEST_CJALR_OP(x3, x23, x10, 108)
RVTEST_SIGBASE( x2,signature_x2_0)

inst_28:
// rs1==x11, 
// opcode:c.jalr; op1:x11
TEST_CJALR_OP(x3, x11, x2, 0)

inst_29:
// rs1==x16, 
// opcode:c.jalr; op1:x16
TEST_CJALR_OP(x3, x16, x2, 4)

inst_30:
// rs1==x10, 
// opcode:c.jalr; op1:x10
TEST_CJALR_OP(x3, x10, x2, 8)
#endif


RVTEST_CODE_END
RVMODEL_HALT

RVTEST_DATA_BEGIN
.align 4

rvtest_data:
.word 0xbabecafe
.word 0xbabecafe
.word 0xbabecafe
.word 0xbabecafe
RVTEST_DATA_END


RVMODEL_DATA_BEGIN
rvtest_sig_begin:
sig_begin_canary:
CANARY;


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


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


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

#ifdef rvtest_mtrap_routine

tsig_begin_canary:
CANARY;
mtrap_sigptr:
    .fill 64*(XLEN/32),4,0xdeadbeef
tsig_end_canary:
CANARY;

#endif

#ifdef rvtest_gpr_save

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

#endif

sig_end_canary:
CANARY;
rvtest_sig_end:
RVMODEL_DATA_END
