
#include "model_test.h"
#include "arch_test.h"
RVTEST_ISA("RV64IK")

.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(.*64.*);check ISA:=regex(.*RV64.*I.*K.*);def TEST_CASE_1=True;",sm4ed)

RVTEST_CASE(1,"//check ISA:=regex(.*64.*);check ISA:=regex(.*RV64.*I.*ZKs.*);def TEST_CASE_1=True;",sm4ed)

RVTEST_SIGBASE( x31,signature_x31_1)

inst_0:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x1; op1:x2; op1:x3; op1:x4; dest:x5;
li  x1, 0x08577eb1924770d3;
li  x2, 0x93fdcab87b89296c;
li  x3, 0xd2d6b8777dc59a3a;
li  x4, 0xcf84b683a749f9c5;
li  x5, 0x854a965708ceac39;
sm4ed x5, x5, x1, 0;
sm4ed x5, x5, x2, 1;
sm4ed x5, x5, x3, 2;
sm4ed x5, x5, x4, 3;
RVTEST_SIGUPD(x31,x5,0);

inst_1:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x2; op1:x3; op1:x4; op1:x5; dest:x6;
li  x2, 0x137a977753e8eb43;
li  x3, 0x5c74e45eff1e5bef;
li  x4, 0xdc3383836b9f15c4;
li  x5, 0x5ae6a2289a6ab329;
li  x6, 0x432779eeacca7f0d;
sm4ed x6, x6, x2, 0;
sm4ed x6, x6, x3, 1;
sm4ed x6, x6, x4, 2;
sm4ed x6, x6, x5, 3;
RVTEST_SIGUPD(x31,x6,8);

inst_2:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x3; op1:x4; op1:x5; op1:x6; dest:x7;
li  x3, 0xaf949e5e2cb7362c;
li  x4, 0x5cd2875ea96ec2b3;
li  x5, 0x9d02fc90708cc1b6;
li  x6, 0x953b00b00b54aa22;
li  x7, 0x224c06013c53d0e3;
sm4ed x7, x7, x3, 0;
sm4ed x7, x7, x4, 1;
sm4ed x7, x7, x5, 2;
sm4ed x7, x7, x6, 3;
RVTEST_SIGUPD(x31,x7,16);

inst_3:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x4; op1:x5; op1:x6; op1:x7; dest:x8;
li  x4, 0xe8dac663f0e58650;
li  x5, 0x3d7c95f9e5f0307e;
li  x6, 0x8c8a18b2aaac3142;
li  x7, 0x785036de6f9fb997;
li  x8, 0x95a4d257a7298c66;
sm4ed x8, x8, x4, 0;
sm4ed x8, x8, x5, 1;
sm4ed x8, x8, x6, 2;
sm4ed x8, x8, x7, 3;
RVTEST_SIGUPD(x31,x8,24);

inst_4:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x5; op1:x6; op1:x7; op1:x8; dest:x9;
li  x5, 0x807da245d814d575;
li  x6, 0x3d06143769b1dcbf;
li  x7, 0x7f21682208208d09;
li  x8, 0x14b91c79dae98554;
li  x9, 0xc5ec6148c6880007;
sm4ed x9, x9, x5, 0;
sm4ed x9, x9, x6, 1;
sm4ed x9, x9, x7, 2;
sm4ed x9, x9, x8, 3;
RVTEST_SIGUPD(x31,x9,32);

inst_5:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x6; op1:x7; op1:x8; op1:x9; dest:x10;
li  x6, 0x7213516d6a013380;
li  x7, 0x4652f62dae4839a1;
li  x8, 0x85986adb9e044706;
li  x9, 0x1e9667c2dd68f201;
li  x10, 0x4d753ac174ab0a38;
sm4ed x10, x10, x6, 0;
sm4ed x10, x10, x7, 1;
sm4ed x10, x10, x8, 2;
sm4ed x10, x10, x9, 3;
RVTEST_SIGUPD(x31,x10,40);

inst_6:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x7; op1:x8; op1:x9; op1:x10; dest:x11;
li  x7, 0x53fbff6c58fa6e1c;
li  x8, 0x0b2e2669b66b3284;
li  x9, 0x51c5b8b2e59cf78f;
li  x10, 0x43032e3e1475f78d;
li  x11, 0x9535971c67a07b54;
sm4ed x11, x11, x7, 0;
sm4ed x11, x11, x8, 1;
sm4ed x11, x11, x9, 2;
sm4ed x11, x11, x10, 3;
RVTEST_SIGUPD(x31,x11,48);

inst_7:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x8; op1:x9; op1:x10; op1:x11; dest:x12;
li  x8, 0xe918be9ffe057dc5;
li  x9, 0x1011eeb47ff822ed;
li  x10, 0xac9e90327d486895;
li  x11, 0x66b072b9e5e290be;
li  x12, 0x89e6156b59672bd6;
sm4ed x12, x12, x8, 0;
sm4ed x12, x12, x9, 1;
sm4ed x12, x12, x10, 2;
sm4ed x12, x12, x11, 3;
RVTEST_SIGUPD(x31,x12,56);

inst_8:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x9; op1:x10; op1:x11; op1:x12; dest:x13;
li  x9, 0xb3a63fa37d69ceef;
li  x10, 0x70fc1afc8f0846a2;
li  x11, 0xf956ec0bf7fb4b49;
li  x12, 0x0cf25923109ff475;
li  x13, 0x26ea42ec17be082f;
sm4ed x13, x13, x9, 0;
sm4ed x13, x13, x10, 1;
sm4ed x13, x13, x11, 2;
sm4ed x13, x13, x12, 3;
RVTEST_SIGUPD(x31,x13,64);

inst_9:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x10; op1:x11; op1:x12; op1:x13; dest:x14;
li  x10, 0xccadb61ffe20ce1c;
li  x11, 0x72745307ec325eec;
li  x12, 0xb2a7a18ac9ea3210;
li  x13, 0xbd59213e27541f0b;
li  x14, 0x9e7e1fc352b42eff;
sm4ed x14, x14, x10, 0;
sm4ed x14, x14, x11, 1;
sm4ed x14, x14, x12, 2;
sm4ed x14, x14, x13, 3;
RVTEST_SIGUPD(x31,x14,72);

inst_10:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x11; op1:x12; op1:x13; op1:x14; dest:x15;
li  x11, 0xa0e0bd86d4551408;
li  x12, 0xcebe24d906600792;
li  x13, 0x4bd90a77f65cf3f3;
li  x14, 0xdbdd4dd9d9e93409;
li  x15, 0xf65e7737fbd2570d;
sm4ed x15, x15, x11, 0;
sm4ed x15, x15, x12, 1;
sm4ed x15, x15, x13, 2;
sm4ed x15, x15, x14, 3;
RVTEST_SIGUPD(x31,x15,80);

inst_11:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x12; op1:x13; op1:x14; op1:x15; dest:x16;
li  x12, 0xd1142724fb37bec8;
li  x13, 0xab8534c129a2575f;
li  x14, 0xfc6113a3312529dc;
li  x15, 0x6d3f408b31d4ff08;
li  x16, 0x8e368ce0be5265f3;
sm4ed x16, x16, x12, 0;
sm4ed x16, x16, x13, 1;
sm4ed x16, x16, x14, 2;
sm4ed x16, x16, x15, 3;
RVTEST_SIGUPD(x31,x16,88);

inst_12:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x13; op1:x14; op1:x15; op1:x16; dest:x17;
li  x13, 0x98f7c41c44115b04;
li  x14, 0x01fbbe93a08b84f3;
li  x15, 0x9c1a15286c834752;
li  x16, 0xa6faba7bcfe6bc54;
li  x17, 0xc5b3e01b11f6d600;
sm4ed x17, x17, x13, 0;
sm4ed x17, x17, x14, 1;
sm4ed x17, x17, x15, 2;
sm4ed x17, x17, x16, 3;
RVTEST_SIGUPD(x31,x17,96);

inst_13:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x14; op1:x15; op1:x16; op1:x17; dest:x18;
li  x14, 0x5916d2810e24d9cc;
li  x15, 0x74f5add55c37849a;
li  x16, 0x4850e927bfdbb3be;
li  x17, 0x67913217437cbc41;
li  x18, 0x576e3d4fa3b633ab;
sm4ed x18, x18, x14, 0;
sm4ed x18, x18, x15, 1;
sm4ed x18, x18, x16, 2;
sm4ed x18, x18, x17, 3;
RVTEST_SIGUPD(x31,x18,104);

inst_14:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x15; op1:x16; op1:x17; op1:x18; dest:x19;
li  x15, 0x46ed745fb9fef1d6;
li  x16, 0x9651ee657a1d33ca;
li  x17, 0xfe0a9c6c9a592829;
li  x18, 0x9071f3aab87ce2a5;
li  x19, 0x4e6168c8d6220b4f;
sm4ed x19, x19, x15, 0;
sm4ed x19, x19, x16, 1;
sm4ed x19, x19, x17, 2;
sm4ed x19, x19, x18, 3;
RVTEST_SIGUPD(x31,x19,112);

inst_15:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x16; op1:x17; op1:x18; op1:x19; dest:x20;
li  x16, 0x9c3d087c65835bdf;
li  x17, 0x9b11d383484641f5;
li  x18, 0x2b24ced43da82c98;
li  x19, 0xef8c60c0d12f8d4e;
li  x20, 0xf37e27a312ea67e4;
sm4ed x20, x20, x16, 0;
sm4ed x20, x20, x17, 1;
sm4ed x20, x20, x18, 2;
sm4ed x20, x20, x19, 3;
RVTEST_SIGUPD(x31,x20,120);

inst_16:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x17; op1:x18; op1:x19; op1:x20; dest:x21;
li  x17, 0x041bbaab97eb7c0f;
li  x18, 0x93017690e356529c;
li  x19, 0xd5e9d561f46a41bd;
li  x20, 0x9408ad7db13971c0;
li  x21, 0x90af95fe095b6425;
sm4ed x21, x21, x17, 0;
sm4ed x21, x21, x18, 1;
sm4ed x21, x21, x19, 2;
sm4ed x21, x21, x20, 3;
RVTEST_SIGUPD(x31,x21,128);

inst_17:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x18; op1:x19; op1:x20; op1:x21; dest:x22;
li  x18, 0xef677106dc17ae6e;
li  x19, 0xc5d09b942be2d8c9;
li  x20, 0x596f5f89ce334459;
li  x21, 0x5902a9dbe1832ab6;
li  x22, 0xb4dc7dee71dabeac;
sm4ed x22, x22, x18, 0;
sm4ed x22, x22, x19, 1;
sm4ed x22, x22, x20, 2;
sm4ed x22, x22, x21, 3;
RVTEST_SIGUPD(x31,x22,136);

inst_18:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x19; op1:x20; op1:x21; op1:x22; dest:x23;
li  x19, 0x755961a98347ddf5;
li  x20, 0x18d71be431c00570;
li  x21, 0x270e1922a422af66;
li  x22, 0xdc336338eea4dd03;
li  x23, 0xa2460e15a3da90b2;
sm4ed x23, x23, x19, 0;
sm4ed x23, x23, x20, 1;
sm4ed x23, x23, x21, 2;
sm4ed x23, x23, x22, 3;
RVTEST_SIGUPD(x31,x23,144);

inst_19:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x20; op1:x21; op1:x22; op1:x23; dest:x24;
li  x20, 0x8f2248c25c3577f5;
li  x21, 0x2a5dc0a00d453cdf;
li  x22, 0xf3281b8ef4d325c3;
li  x23, 0x947ac00e0caec993;
li  x24, 0xd60235f35c4739b7;
sm4ed x24, x24, x20, 0;
sm4ed x24, x24, x21, 1;
sm4ed x24, x24, x22, 2;
sm4ed x24, x24, x23, 3;
RVTEST_SIGUPD(x31,x24,152);

inst_20:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x21; op1:x22; op1:x23; op1:x24; dest:x25;
li  x21, 0x6dc3cceec36ffd4b;
li  x22, 0xc2713ce25868105b;
li  x23, 0x29ade05f7dddcc72;
li  x24, 0x6baeea37b4c8839b;
li  x25, 0x1e4e0fadd02bad0f;
sm4ed x25, x25, x21, 0;
sm4ed x25, x25, x22, 1;
sm4ed x25, x25, x23, 2;
sm4ed x25, x25, x24, 3;
RVTEST_SIGUPD(x31,x25,160);

inst_21:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x22; op1:x23; op1:x24; op1:x25; dest:x26;
li  x22, 0xe4367ccad9716f2c;
li  x23, 0x9ea76f0885958881;
li  x24, 0xb183406662ebf954;
li  x25, 0x796c1d88c313bc1f;
li  x26, 0xe7e94a5193b3cb9a;
sm4ed x26, x26, x22, 0;
sm4ed x26, x26, x23, 1;
sm4ed x26, x26, x24, 2;
sm4ed x26, x26, x25, 3;
RVTEST_SIGUPD(x31,x26,168);

inst_22:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x23; op1:x24; op1:x25; op1:x26; dest:x27;
li  x23, 0x37c4c6b99530db93;
li  x24, 0x132a717606aec150;
li  x25, 0x08011d17cfac3216;
li  x26, 0xd65358aaa734906b;
li  x27, 0xba1c4b6b2d9da6d7;
sm4ed x27, x27, x23, 0;
sm4ed x27, x27, x24, 1;
sm4ed x27, x27, x25, 2;
sm4ed x27, x27, x26, 3;
RVTEST_SIGUPD(x31,x27,176);

inst_23:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x24; op1:x25; op1:x26; op1:x27; dest:x28;
li  x24, 0x04d3e5f42bccd6b6;
li  x25, 0x339863c4d216eea8;
li  x26, 0x3f13091de7fcc18b;
li  x27, 0xc2cc1d388d15d800;
li  x28, 0x0165f0f02016dc16;
sm4ed x28, x28, x24, 0;
sm4ed x28, x28, x25, 1;
sm4ed x28, x28, x26, 2;
sm4ed x28, x28, x27, 3;
RVTEST_SIGUPD(x31,x28,184);

inst_24:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x25; op1:x26; op1:x27; op1:x28; dest:x29;
li  x25, 0xd6ac851f07155a89;
li  x26, 0x2d885062faa97965;
li  x27, 0x62a12347b17286fd;
li  x28, 0xa97cbf8403beaecd;
li  x29, 0xa9632e3dbd0070ae;
sm4ed x29, x29, x25, 0;
sm4ed x29, x29, x26, 1;
sm4ed x29, x29, x27, 2;
sm4ed x29, x29, x28, 3;
RVTEST_SIGUPD(x31,x29,192);

inst_25:
// Expected use-case sequence -> Aims to test things like pipeline forwarding
// opcode: sm4ed; op1:x26; op1:x27; op1:x28; op1:x29; dest:x30;
li  x26, 0x8d3ba7550c3c31a8;
li  x27, 0xb3e73cbb0d8258c4;
li  x28, 0x7587e11994038f33;
li  x29, 0x2f8d133555f7f60a;
li  x30, 0xa0a1c6ef661a191b;
sm4ed x30, x30, x26, 0;
sm4ed x30, x30, x27, 1;
sm4ed x30, x30, x28, 2;
sm4ed x30, x30, x29, 3;
RVTEST_SIGUPD(x31,x30,200);

#endif

RVTEST_CODE_END
RVMODEL_HALT

RVTEST_DATA_BEGIN
.align 4
rvtest_data:
.word 0xbabecafe
RVTEST_DATA_END

RVMODEL_DATA_BEGIN


signature_x31_1:
    .fill 26*(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
