// -----------
// This file was generated by riscv_ctg (https://gitlab.com/incoresemi/riscv-compliance/riscv_ctg)
// version   : 0.5.1
// timestamp : Mon Aug  2 08:58:53 2021 GMT
// usage     : riscv_ctg \
//                  --cgf /home/bilalsakhawat/riscv-ctg/sample_cgfs/dataset.cgf \
//                  --cgf /home/bilalsakhawat/riscv-ctg/sample_cgfs/rv32e.cgf \
//                  --base-isa rv32e \
//                  --randomize
// -----------
//
// -----------
// Copyright (c) 2020. RISC-V International. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
// -----------
//
// This assembly file tests the lui instruction of the RISC-V E extension for the lui covergroup.
// 
#include "model_test.h"
#include "arch_test.h"
RVTEST_ISA("RV32E")

.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(.*E.*) ;def RVTEST_E = True;def TEST_CASE_1=True;",lui)

RVTEST_SIGBASE( x4,signature_x4_1)

inst_0:
// rd==x3, imm_val == ((2**20)-1), imm_val > 0
// opcode: lui ; dest:x3; immval:0xfffff
TEST_CASE(x5, x3, -0x1000, x4, 0, lui x3,0xfffff)

inst_1:
// rd==x2, imm_val == 524287, 
// opcode: lui ; dest:x2; immval:0x7ffff
TEST_CASE(x5, x2, 0x7ffff000, x4, 4, lui x2,0x7ffff)

inst_2:
// rd==x1, imm_val == 786431, 
// opcode: lui ; dest:x1; immval:0xbffff
TEST_CASE(x5, x1, -0x40001000, x4, 8, lui x1,0xbffff)

inst_3:
// rd==x8, imm_val == 917503, 
// opcode: lui ; dest:x8; immval:0xdffff
TEST_CASE(x5, x8, -0x20001000, x4, 12, lui x8,0xdffff)

inst_4:
// rd==x14, imm_val == 983039, 
// opcode: lui ; dest:x14; immval:0xeffff
TEST_CASE(x5, x14, -0x10001000, x4, 16, lui x14,0xeffff)

inst_5:
// rd==x7, imm_val == 1015807, 
// opcode: lui ; dest:x7; immval:0xf7fff
TEST_CASE(x5, x7, -0x8001000, x4, 20, lui x7,0xf7fff)

inst_6:
// rd==x13, imm_val == 1032191, 
// opcode: lui ; dest:x13; immval:0xfbfff
TEST_CASE(x5, x13, -0x4001000, x4, 24, lui x13,0xfbfff)

inst_7:
// rd==x12, imm_val == 1040383, 
// opcode: lui ; dest:x12; immval:0xfdfff
TEST_CASE(x5, x12, -0x2001000, x4, 28, lui x12,0xfdfff)

inst_8:
// rd==x15, imm_val == 1044479, 
// opcode: lui ; dest:x15; immval:0xfefff
TEST_CASE(x5, x15, -0x1001000, x4, 32, lui x15,0xfefff)

inst_9:
// rd==x10, imm_val == 1046527, 
// opcode: lui ; dest:x10; immval:0xff7ff
TEST_CASE(x5, x10, -0x801000, x4, 36, lui x10,0xff7ff)

inst_10:
// rd==x6, imm_val == 1047551, 
// opcode: lui ; dest:x6; immval:0xffbff
TEST_CASE(x5, x6, -0x401000, x4, 40, lui x6,0xffbff)

inst_11:
// rd==x9, imm_val == 1048063, 
// opcode: lui ; dest:x9; immval:0xffdff
TEST_CASE(x2, x9, -0x201000, x4, 44, lui x9,0xffdff)
RVTEST_SIGBASE( x1,signature_x1_0)

inst_12:
// rd==x4, imm_val == 1048319, 
// opcode: lui ; dest:x4; immval:0xffeff
TEST_CASE(x2, x4, -0x101000, x1, 0, lui x4,0xffeff)

inst_13:
// rd==x0, imm_val == 1048447, 
// opcode: lui ; dest:x0; immval:0xfff7f
TEST_CASE(x2, x0, 0, x1, 4, lui x0,0xfff7f)

inst_14:
// rd==x5, imm_val == 1048511, 
// opcode: lui ; dest:x5; immval:0xfffbf
TEST_CASE(x2, x5, -0x41000, x1, 8, lui x5,0xfffbf)

inst_15:
// rd==x11, imm_val == 1048543, 
// opcode: lui ; dest:x11; immval:0xfffdf
TEST_CASE(x2, x11, -0x21000, x1, 12, lui x11,0xfffdf)

inst_16:
// imm_val == 1048559, 
// opcode: lui ; dest:x10; immval:0xfffef
TEST_CASE(x2, x10, -0x11000, x1, 16, lui x10,0xfffef)

inst_17:
// imm_val == 1048567, 
// opcode: lui ; dest:x10; immval:0xffff7
TEST_CASE(x2, x10, -0x9000, x1, 20, lui x10,0xffff7)

inst_18:
// imm_val == 1048571, 
// opcode: lui ; dest:x10; immval:0xffffb
TEST_CASE(x2, x10, -0x5000, x1, 24, lui x10,0xffffb)

inst_19:
// imm_val == 1048573, 
// opcode: lui ; dest:x10; immval:0xffffd
TEST_CASE(x2, x10, -0x3000, x1, 28, lui x10,0xffffd)

inst_20:
// imm_val == 1048574, 
// opcode: lui ; dest:x10; immval:0xffffe
TEST_CASE(x2, x10, -0x2000, x1, 32, lui x10,0xffffe)

inst_21:
// imm_val == 524288, 
// opcode: lui ; dest:x10; immval:0x80000
TEST_CASE(x2, x10, -0x80000000, x1, 36, lui x10,0x80000)

inst_22:
// imm_val == 262144, 
// opcode: lui ; dest:x10; immval:0x40000
TEST_CASE(x2, x10, 0x40000000, x1, 40, lui x10,0x40000)

inst_23:
// imm_val == 131072, 
// opcode: lui ; dest:x10; immval:0x20000
TEST_CASE(x2, x10, 0x20000000, x1, 44, lui x10,0x20000)

inst_24:
// imm_val == 65536, 
// opcode: lui ; dest:x10; immval:0x10000
TEST_CASE(x2, x10, 0x10000000, x1, 48, lui x10,0x10000)

inst_25:
// imm_val == 32768, 
// opcode: lui ; dest:x10; immval:0x8000
TEST_CASE(x2, x10, 0x8000000, x1, 52, lui x10,0x8000)

inst_26:
// imm_val == 16384, 
// opcode: lui ; dest:x10; immval:0x4000
TEST_CASE(x2, x10, 0x4000000, x1, 56, lui x10,0x4000)

inst_27:
// imm_val == 8192, 
// opcode: lui ; dest:x10; immval:0x2000
TEST_CASE(x2, x10, 0x2000000, x1, 60, lui x10,0x2000)

inst_28:
// imm_val == 4096, 
// opcode: lui ; dest:x10; immval:0x1000
TEST_CASE(x2, x10, 0x1000000, x1, 64, lui x10,0x1000)

inst_29:
// imm_val == 2048, 
// opcode: lui ; dest:x10; immval:0x800
TEST_CASE(x2, x10, 0x800000, x1, 68, lui x10,0x800)

inst_30:
// imm_val == 1024, imm_val==1024
// opcode: lui ; dest:x10; immval:0x400
TEST_CASE(x2, x10, 0x400000, x1, 72, lui x10,0x400)

inst_31:
// imm_val == 512, 
// opcode: lui ; dest:x10; immval:0x200
TEST_CASE(x2, x10, 0x200000, x1, 76, lui x10,0x200)

inst_32:
// imm_val == 256, 
// opcode: lui ; dest:x10; immval:0x100
TEST_CASE(x2, x10, 0x100000, x1, 80, lui x10,0x100)

inst_33:
// imm_val == 128, 
// opcode: lui ; dest:x10; immval:0x80
TEST_CASE(x2, x10, 0x80000, x1, 84, lui x10,0x80)

inst_34:
// imm_val == 64, 
// opcode: lui ; dest:x10; immval:0x40
TEST_CASE(x2, x10, 0x40000, x1, 88, lui x10,0x40)

inst_35:
// imm_val == 32, 
// opcode: lui ; dest:x10; immval:0x20
TEST_CASE(x2, x10, 0x20000, x1, 92, lui x10,0x20)

inst_36:
// imm_val == 16, 
// opcode: lui ; dest:x10; immval:0x10
TEST_CASE(x2, x10, 0x10000, x1, 96, lui x10,0x10)

inst_37:
// imm_val==349525, imm_val == 349525
// opcode: lui ; dest:x10; immval:0x55555
TEST_CASE(x2, x10, 0x55555000, x1, 100, lui x10,0x55555)

inst_38:
// imm_val==3, 
// opcode: lui ; dest:x10; immval:0x3
TEST_CASE(x2, x10, 0x3000, x1, 104, lui x10,0x3)

inst_39:
// imm_val == 699050, imm_val==699050
// opcode: lui ; dest:x10; immval:0xaaaaa
TEST_CASE(x2, x10, -0x55556000, x1, 108, lui x10,0xaaaaa)

inst_40:
// imm_val == 0, imm_val==0
// opcode: lui ; dest:x10; immval:0x0
TEST_CASE(x2, x10, 0x0, x1, 112, lui x10,0x0)

inst_41:
// imm_val == 8, 
// opcode: lui ; dest:x10; immval:0x8
TEST_CASE(x2, x10, 0x8000, x1, 116, lui x10,0x8)

inst_42:
// imm_val == 4, imm_val==4
// opcode: lui ; dest:x10; immval:0x4
TEST_CASE(x2, x10, 0x4000, x1, 120, lui x10,0x4)

inst_43:
// imm_val == 2, imm_val==2
// opcode: lui ; dest:x10; immval:0x2
TEST_CASE(x2, x10, 0x2000, x1, 124, lui x10,0x2)

inst_44:
// imm_val == 1, imm_val==1
// opcode: lui ; dest:x10; immval:0x1
TEST_CASE(x2, x10, 0x1000, x1, 128, lui x10,0x1)

inst_45:
// imm_val==725, 
// opcode: lui ; dest:x10; immval:0x2d5
TEST_CASE(x2, x10, 0x2d5000, x1, 132, lui x10,0x2d5)

inst_46:
// imm_val==419431, 
// opcode: lui ; dest:x10; immval:0x66667
TEST_CASE(x2, x10, 0x66667000, x1, 136, lui x10,0x66667)

inst_47:
// imm_val==209716, 
// opcode: lui ; dest:x10; immval:0x33334
TEST_CASE(x2, x10, 0x33334000, x1, 140, lui x10,0x33334)

inst_48:
// imm_val==6, 
// opcode: lui ; dest:x10; immval:0x6
TEST_CASE(x2, x10, 0x6000, x1, 144, lui x10,0x6)

inst_49:
// imm_val==699051, 
// opcode: lui ; dest:x10; immval:0xaaaab
TEST_CASE(x2, x10, -0x55555000, x1, 148, lui x10,0xaaaab)

inst_50:
// imm_val==349526, 
// opcode: lui ; dest:x10; immval:0x55556
TEST_CASE(x2, x10, 0x55556000, x1, 152, lui x10,0x55556)

inst_51:
// imm_val==1022, 
// opcode: lui ; dest:x10; immval:0x3fe
TEST_CASE(x2, x10, 0x3fe000, x1, 156, lui x10,0x3fe)

inst_52:
// imm_val==723, 
// opcode: lui ; dest:x10; immval:0x2d3
TEST_CASE(x2, x10, 0x2d3000, x1, 160, lui x10,0x2d3)

inst_53:
// imm_val==419429, 
// opcode: lui ; dest:x10; immval:0x66665
TEST_CASE(x2, x10, 0x66665000, x1, 164, lui x10,0x66665)

inst_54:
// imm_val==209714, 
// opcode: lui ; dest:x10; immval:0x33332
TEST_CASE(x2, x10, 0x33332000, x1, 168, lui x10,0x33332)

inst_55:
// imm_val==699049, 
// opcode: lui ; dest:x10; immval:0xaaaa9
TEST_CASE(x2, x10, -0x55557000, x1, 172, lui x10,0xaaaa9)

inst_56:
// imm_val==349524, 
// opcode: lui ; dest:x10; immval:0x55554
TEST_CASE(x2, x10, 0x55554000, x1, 176, lui x10,0x55554)

inst_57:
// imm_val==1023, 
// opcode: lui ; dest:x10; immval:0x3ff
TEST_CASE(x2, x10, 0x3ff000, x1, 180, lui x10,0x3ff)

inst_58:
// imm_val==724, 
// opcode: lui ; dest:x10; immval:0x2d4
TEST_CASE(x2, x10, 0x2d4000, x1, 184, lui x10,0x2d4)

inst_59:
// imm_val==419430, 
// opcode: lui ; dest:x10; immval:0x66666
TEST_CASE(x2, x10, 0x66666000, x1, 188, lui x10,0x66666)

inst_60:
// imm_val==209715, 
// opcode: lui ; dest:x10; immval:0x33333
TEST_CASE(x2, x10, 0x33333000, x1, 192, lui x10,0x33333)

inst_61:
// imm_val==5, 
// opcode: lui ; dest:x10; immval:0x5
TEST_CASE(x2, x10, 0x5000, x1, 196, lui x10,0x5)

inst_62:
// imm_val == 1048447, 
// opcode: lui ; dest:x10; immval:0xfff7f
TEST_CASE(x2, x10, -0x81000, x1, 200, lui x10,0xfff7f)
#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_x4_0:
    .fill 0*(XLEN/32),4,0xdeadbeef


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


signature_x1_0:
    .fill 51*(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
