
// -----------
// 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.jal instruction of the RISC-V C extension for the cjal 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(.*RV32.*I.*C.*);def TEST_CASE_1=True;",cjal)

RVTEST_SIGBASE( x2,signature_x2_1)

inst_0:
// imm_val > 0, 
// opcode:c.jal; immval:0x4
TEST_CJAL_OP(c.jal, x3, 0x4, 3f, x2, 0)

inst_1:
// imm_val < 0, imm_val == -10
// opcode:c.jal; immval:0xa
TEST_CJAL_OP(c.jal, x3, 0xa, 1b, x2, 4)

inst_2:
// imm_val == 16, 
// opcode:c.jal; immval:0x10
TEST_CJAL_OP(c.jal, x3, 0x10, 3f, x2, 8)

inst_3:
// imm_val == 32, 
// opcode:c.jal; immval:0x20
TEST_CJAL_OP(c.jal, x3, 0x20, 3f, x2, 12)

inst_4:
// imm_val == 64, 
// opcode:c.jal; immval:0x40
TEST_CJAL_OP(c.jal, x3, 0x40, 3f, x2, 16)

inst_5:
// imm_val == 128, 
// opcode:c.jal; immval:0x80
TEST_CJAL_OP(c.jal, x3, 0x80, 3f, x2, 20)

inst_6:
// imm_val == 256, 
// opcode:c.jal; immval:0x100
TEST_CJAL_OP(c.jal, x3, 0x100, 3f, x2, 24)

inst_7:
// imm_val == 512, 
// opcode:c.jal; immval:0x200
TEST_CJAL_OP(c.jal, x3, 0x200, 3f, x2, 28)

inst_8:
// imm_val == 1024, 
// opcode:c.jal; immval:0x400
TEST_CJAL_OP(c.jal, x3, 0x400, 3f, x2, 32)

inst_9:
// imm_val == -18, 
// opcode:c.jal; immval:0x12
TEST_CJAL_OP(c.jal, x3, 0x12, 1b, x2, 36)

inst_10:
// imm_val == -34, 
// opcode:c.jal; immval:0x22
TEST_CJAL_OP(c.jal, x3, 0x22, 1b, x2, 40)

inst_11:
// imm_val == -1026, 
// opcode:c.jal; immval:0x402
TEST_CJAL_OP(c.jal, x3, 0x402, 1b, x2, 44)

inst_12:
// imm_val == -1366, 
// opcode:c.jal; immval:0x556
TEST_CJAL_OP(c.jal, x3, 0x556, 1b, x2, 48)

inst_13:
// imm_val == 1364, 
// opcode:c.jal; immval:0x554
TEST_CJAL_OP(c.jal, x3, 0x554, 3f, x2, 52)

inst_14:
// imm_val == -66, 
// opcode:c.jal; immval:0x42
TEST_CJAL_OP(c.jal, x3, 0x42, 1b, x2, 56)

inst_15:
// imm_val == -130, 
// opcode:c.jal; immval:0x82
TEST_CJAL_OP(c.jal, x3, 0x82, 1b, x2, 60)

inst_16:
// imm_val == -258, 
// opcode:c.jal; immval:0x102
TEST_CJAL_OP(c.jal, x3, 0x102, 1b, x2, 64)

inst_17:
// imm_val == -514, 
// opcode:c.jal; immval:0x202
TEST_CJAL_OP(c.jal, x3, 0x202, 1b, x2, 68)
#endif


RVTEST_CODE_END
RVMODEL_HALT

RVTEST_DATA_BEGIN
.align 4
rvtest_data:
.word 0xbabecafe
RVTEST_DATA_END

RVMODEL_DATA_BEGIN


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


signature_x2_1:
    .fill 18*(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
