From 52f483e5db6aa7f734518c6b8e74df01f32f1282 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 3 Oct 2025 18:59:06 +0200 Subject: [PATCH 01/37] [HW] 1. Support reduction operation for integer; 2. Fix single-burst misaligned read issue; 3 Fix vl calculation problem for each cluster. 4. Support running kernel with vector length smaller than NrLane*NrCluster --- apps/common/default_args.mk | 8 +- apps/dotproduct/data.S | 34504 ++++++++++++++++++++--- apps/dotproduct/main.c | 153 +- apps/dotproduct/script/gen_data.py | 2 + apps/fdotproduct/main.c | 88 +- apps/fdotproduct/script/gen_data.py | 2 + apps/fmatmul/main.c | 2 + apps/fmatmul/script/gen_data.py | 1 + hardware/include/ara_pkg.sv | 6 + hardware/src/ara.sv | 5 +- hardware/src/ara_cluster.sv | 6 +- hardware/src/ara_dispatcher.sv | 48 +- hardware/src/ara_macro.sv | 2 + hardware/src/lane/lane_sequencer.sv | 27 + hardware/src/lane/operand_queue.sv | 21 +- hardware/src/lane/operand_requester.sv | 6 +- hardware/src/lane/valu.sv | 25 +- hardware/src/lane/vector_fus_stage.sv | 2 + hardware/src/sldu/sldu.sv | 3 + hardware/src/vlsu/align_stage.sv | 5 + hardware/src/vlsu/global_dispatcher.sv | 13 +- hardware/src/vlsu/global_ldst.sv | 1 + hardware/src/vlsu/shuffle_stage.sv | 1 + 23 files changed, 30970 insertions(+), 3961 deletions(-) diff --git a/apps/common/default_args.mk b/apps/common/default_args.mk index 6aa0edd..07205cf 100644 --- a/apps/common/default_args.mk +++ b/apps/common/default_args.mk @@ -1,16 +1,16 @@ # Default app parameters # Matrix sizes -def_args_imatmul ?= "128 128 128" -def_args_fmatmul ?= "128 128 128" +def_args_imatmul ?= "64 64 64" +def_args_fmatmul ?= "64 64 64" # Matrix size, filter size def_args_iconv2d ?= "112 7" def_args_fconv2d ?= "112 7" def_args_fconv3d ?= "112 7" # Vector size -def_args_fdotproduct ?= "512" +def_args_fdotproduct ?= "8192" # Vector size -def_args_dotproduct ?= "512" +def_args_dotproduct ?= "8192" # Matrix padded size 0, matrix padded size 1, onlyvec def_args_jacobi2d ?= "130 130" # Vector size diff --git a/apps/dotproduct/data.S b/apps/dotproduct/data.S index becdaec..be9fb29 100644 --- a/apps/dotproduct/data.S +++ b/apps/dotproduct/data.S @@ -2,3872 +2,30752 @@ .global vsize .balign 8 vsize: - .word 0x00000200 + .word 0x00001000 .word 0x00000000 .global v64a .balign NR_LANES*4 v64a: - .word 0x1ca63ca2 - .word 0xfffcc727 - .word 0x0580940c - .word 0x0002af2c - .word 0xbb30601c - .word 0x0000ef70 - .word 0x28b6fe63 - .word 0x00015ae9 - .word 0xe9941795 - .word 0x0002abed - .word 0x9514f967 - .word 0x0001227a - .word 0x3ad81fc2 - .word 0xfffdb70b - .word 0xfdfb1a97 - .word 0xffff3608 - .word 0x2c737eaf - .word 0xffff0bc3 - .word 0x2a268b16 - .word 0x00014fd7 - .word 0x3adef3ea - .word 0xfffcaf5f - .word 0x29190131 - .word 0xfffdd1d8 - .word 0xdcb961b5 - .word 0xfffd08da - .word 0xec23f0b8 - .word 0x0002c4fa - .word 0x56cb62b9 - .word 0x0003a643 - .word 0x0c11a110 - .word 0x00038d8c - .word 0xcf5c9a68 - .word 0xffff5139 - .word 0x74843a3b - .word 0xfffca6e5 - .word 0x5ee3ebaa - .word 0xffff405e - .word 0x71c0a238 - .word 0x000048f2 - .word 0x3f092424 - .word 0xfffc16a4 - .word 0x14d11121 - .word 0xfffcfb34 - .word 0x16a77651 - .word 0xfffdc870 - .word 0xc960fde4 - .word 0x0003638d - .word 0x8725b995 - .word 0x0001c122 - .word 0xea6ebe4a - .word 0xfffdcdc6 - .word 0x92225770 - .word 0xfffc8654 - .word 0x8cad32f9 - .word 0xfffcf454 - .word 0x22247c86 - .word 0xfffe1ec3 - .word 0x02802395 - .word 0xfffd8511 - .word 0x5f47507e - .word 0x000033d7 - .word 0xce8c6ad4 - .word 0x0001ea05 - .word 0x1ef763e1 - .word 0xffff3d1d - .word 0xe9bf831b - .word 0x00005920 - .word 0x59fb6b1e - .word 0xfffe73e3 - .word 0x7f50322f - .word 0x000137f0 - .word 0x9482ad0b - .word 0xfffceb0a - .word 0x20d192f0 - .word 0x00033ee8 - .word 0x335ba907 - .word 0xfffe8576 - .word 0x7cf8530c - .word 0x0002a968 - .word 0x8ebaacdf - .word 0xfffd504a - .word 0xd77daa77 - .word 0x00003a49 - .word 0xda5e1bbf - .word 0x0003874d - .word 0x4694fa93 - .word 0xfffe4596 - .word 0xaabb58aa - .word 0x0003b844 - .word 0xdfeddeb9 - .word 0xfffca572 - .word 0xc22e7369 - .word 0x00032031 - .word 0xab2465e8 - .word 0xffff4950 - .word 0xf7067f1a - .word 0x0002b6af - .word 0x68270c5f - .word 0x00024c71 - .word 0xa699fe19 - .word 0x0001d02b - .word 0x02720ae2 - .word 0x000233c4 - .word 0xe035fa55 - .word 0x0000dcf7 - .word 0x24bd0220 - .word 0x0002da39 - .word 0x14cb0d97 - .word 0xfffd2421 - .word 0x379b6df0 - .word 0x0001a3b7 - .word 0xf88ea341 - .word 0x00018656 - .word 0x7304748c - .word 0x00008b60 - .word 0x3583af2e - .word 0xffff8c2e - .word 0x9d7718d0 - .word 0x00023d5d - .word 0x73ed85a8 - .word 0x00006130 - .word 0xd3662779 - .word 0x000346f3 - .word 0xd43f4c00 - .word 0xffff9a0d - .word 0x6909f4c5 - .word 0x00013e95 - .word 0x798aa748 - .word 0xfffe0fc6 - .word 0x4b0dfb6a - .word 0x0002ea3c - .word 0xe779bcb7 - .word 0xffff2e20 - .word 0x683b8ddf - .word 0x0002619d - .word 0x4f8c678d - .word 0x00015549 - .word 0xbc999da3 - .word 0x0003d5a1 - .word 0x7b48d1f1 - .word 0x00006be5 - .word 0x05a7205f - .word 0x0001ba9c - .word 0xd632304e - .word 0x0003762f - .word 0x2e37e6da - .word 0x00015b79 - .word 0xee210158 - .word 0x000173a3 - .word 0xa0112d59 - .word 0xfffe3ed1 - .word 0x3cb84daf - .word 0xfffd7726 - .word 0x2bc0086c - .word 0xffff0120 - .word 0x4140db01 - .word 0xfffc5e95 - .word 0xf0983af5 - .word 0x00023f64 - .word 0x62b1186d - .word 0x0000529c - .word 0x38cf7585 - .word 0x0001ca73 - .word 0x4ebe5910 - .word 0x0003f70d - .word 0xa8a4485a - .word 0xfffcc638 - .word 0xf707a899 - .word 0x0003fd4d - .word 0x41cdd36f - .word 0xfffdec04 - .word 0x8cd8f886 - .word 0xfffc2f54 - .word 0xfe8233f4 - .word 0x00025593 - .word 0x2e5f154f - .word 0xffffb997 - .word 0xdda156c6 - .word 0x00001a81 - .word 0x1eb04ef5 - .word 0xfffd283c - .word 0x1cc8e371 - .word 0x00038b7c - .word 0x22aa443f - .word 0x0000fe5d - .word 0x7f041647 - .word 0x0003a5ab - .word 0xe3a1628f - .word 0x000092ba - .word 0xc8a0b2c9 - .word 0x00003ffc - .word 0x44b13994 - .word 0xfffea040 - .word 0x33ca1236 - .word 0xfffe10e4 - .word 0x98a9cc0a - .word 0x0000b72d - .word 0x9cf6869f - .word 0x00023e59 - .word 0x5a99d44c - .word 0x0001be84 - .word 0xf62cf354 - .word 0x00021c85 - .word 0xadc978fd - .word 0x00002505 - .word 0xae2673e7 - .word 0x000123d0 - .word 0xf5512604 - .word 0x0003d160 - .word 0xb17ea1af - .word 0xfffd1779 - .word 0x5d9b3755 - .word 0x0003b921 - .word 0x90e669ef - .word 0x0001b85a - .word 0xf3179edd - .word 0x00006815 - .word 0xc9f09bcd - .word 0x0003f63d - .word 0x8640d9b1 - .word 0xfffd733c - .word 0xcb800978 - .word 0x000102c4 - .word 0xf672bb91 - .word 0x00038775 - .word 0xd132ed23 - .word 0x0003119c - .word 0x3b7902f3 - .word 0x0002345b - .word 0x335188e3 - .word 0xfffd5c4f - .word 0x9de5c940 - .word 0x00025c8b - .word 0x20ae7fd0 - .word 0x00023e60 - .word 0x6a649603 - .word 0xfffcae3a - .word 0xe2c58c60 - .word 0xffff428d - .word 0x733e0eae - .word 0x0000001d - .word 0xf569bae8 - .word 0x0001a1a8 - .word 0x36e2fcf1 - .word 0x00016c66 - .word 0x98db19be - .word 0xfffdd210 - .word 0x0f781d1f - .word 0x00017391 - .word 0x055cf9f7 - .word 0x0003fefa - .word 0x4db0266b - .word 0x0002ebc7 - .word 0xd0e741bb - .word 0xfffc8e59 - .word 0x4e938f36 - .word 0x0003691b - .word 0x7a79fd66 - .word 0xfffd6e4f - .word 0xe6056f70 - .word 0x0000a34f - .word 0x40d585a3 - .word 0x0001969f - .word 0xaf9e2855 - .word 0x0002d12d - .word 0xad48c2b8 - .word 0x00024d34 - .word 0xa1e5db3c - .word 0x00009437 - .word 0x2df7bdd6 - .word 0x00003567 - .word 0x4f100d26 - .word 0xfffded9e - .word 0x0d6cda59 - .word 0x0001075b - .word 0x06bd97b5 - .word 0xfffc4e00 - .word 0x8b7be77e - .word 0x000213e2 - .word 0x5e398ebc - .word 0x0001c99a - .word 0x1bb0a0f4 - .word 0x00008404 - .word 0xd93516be - .word 0xfffff15d - .word 0x1f0ff5bf - .word 0xfffe923d - .word 0x04ad33d9 - .word 0xfffe8857 - .word 0xeac67131 - .word 0x0003472d - .word 0xbc8dc520 - .word 0x00000bce - .word 0xfb8b2bb9 - .word 0x0003bc58 - .word 0x9f2f873e - .word 0x00009411 - .word 0x4cf3666c - .word 0xfffc6262 - .word 0x531c3469 - .word 0xffff761e - .word 0x80cfd44f - .word 0xfffe74df - .word 0xaac0381d - .word 0xffffb452 - .word 0xac4da324 - .word 0xfffe2cc7 - .word 0x82500114 - .word 0x00039694 - .word 0x8c51623c - .word 0xfffce057 - .word 0x69215099 - .word 0xffffe352 - .word 0x3e97741f - .word 0x00017bae - .word 0xc2e89625 - .word 0xffffd01e - .word 0x6ee40bde - .word 0x0000ac1d - .word 0x91925f51 - .word 0xffffbb7d - .word 0x47f0175b - .word 0xfffdd3a6 - .word 0xad525a33 - .word 0x0003c5f1 - .word 0xd4b0b9d8 - .word 0x00025c81 - .word 0x5b0c05a0 - .word 0xfffc1901 - .word 0xd83dda2d - .word 0x0000744c - .word 0x25d50fe1 - .word 0xfffd49cb - .word 0xe26b9817 - .word 0xfffd46dd - .word 0xdc8770cd - .word 0x00018a4c - .word 0x3a974476 - .word 0xfffdd27f - .word 0x27d32635 - .word 0x00011274 - .word 0xa3eae453 - .word 0x0002725e - .word 0xd795e832 - .word 0x0003bf11 - .word 0x18071e4f - .word 0xfffd3a1b - .word 0x272461e3 - .word 0x0001fea7 - .word 0x6331dcf4 - .word 0x0003c7a1 - .word 0xbf5edef3 - .word 0xfffe5e6d - .word 0xda3284c5 - .word 0x000146c2 - .word 0x796f9f5a - .word 0x0003d9bd - .word 0xc38d012a - .word 0x00030dbd - .word 0xeacf9134 - .word 0x000252b0 - .word 0x227b4c4b - .word 0xfffc01c6 - .word 0x937837d6 - .word 0xfffdb240 - .word 0xa4fdbdc5 - .word 0xffffd94f - .word 0x7b24bd2e - .word 0xfffefc28 - .word 0xb7f527bc - .word 0xfffc90fc - .word 0xca152b8b - .word 0x000365cb - .word 0x8cc79d73 - .word 0xfffe9271 - .word 0x714c6a78 - .word 0xfffdc08f - .word 0xd6f5da2d - .word 0xffffe442 - .word 0x9a7679dd - .word 0x0001e45e - .word 0xcb735fe7 - .word 0x0003d311 - .word 0x00bbb96f - .word 0xffffa158 - .word 0x5649d12b - .word 0x000120a3 - .word 0x1258f763 - .word 0xfffca39d - .word 0x673a65c0 - .word 0x00025edf - .word 0x607d5e7a - .word 0x0003c425 - .word 0x91afcb94 - .word 0xfffd6850 - .word 0x8a4b1e13 - .word 0xfffc3aa8 - .word 0x4a5b2138 - .word 0xffff61a9 - .word 0x72105e27 - .word 0x00027480 - .word 0xc7a31b5a - .word 0xfffc598d - .word 0x84498a8e - .word 0xfffe78ba - .word 0xe3fe3faa - .word 0x00011a5c - .word 0xa1c824c6 - .word 0x0002dde5 - .word 0xa141827b - .word 0x00039b58 - .word 0x58c41769 - .word 0x00023f04 - .word 0xb5bb5817 - .word 0x000200ca - .word 0xf23a812e - .word 0xfffd8d01 - .word 0x65b496eb - .word 0x00033c93 - .word 0x5aa57e76 - .word 0xfffe42b4 - .word 0x725e251c - .word 0xfffd0710 - .word 0x9dc78931 - .word 0xfffc61f6 - .word 0xb6527bb8 - .word 0x0003d120 - .word 0xf026199a - .word 0xfffcc0c5 - .word 0x6e58c4a1 - .word 0xfffe112c - .word 0x3dd5fa67 - .word 0x000291d9 - .word 0x367c8d37 - .word 0xfffcc951 - .word 0x9c581207 - .word 0x0002654c - .word 0x74d86834 - .word 0x00001200 - .word 0x3ad4752e - .word 0xffffa6f6 - .word 0xafb9d543 - .word 0x00038ed7 - .word 0x91be9979 - .word 0xfffd1494 - .word 0x0da1d249 - .word 0x0001b7d0 - .word 0x9e8a9b07 - .word 0x0003b271 - .word 0x45ec97fa - .word 0xffffb76c - .word 0x504eaaf4 - .word 0x00003837 - .word 0x29d800b6 - .word 0xfffc78a3 - .word 0x8a8fe728 - .word 0x0003e794 - .word 0x3ad512e5 - .word 0xfffc8fea - .word 0xcbf81bef - .word 0xfffd1546 - .word 0x6ccea534 - .word 0xfffc9086 - .word 0xeb605089 - .word 0xffff3378 - .word 0xdc0b7830 - .word 0xfffc08ca - .word 0xe1eeb0b4 - .word 0x0002fa9b - .word 0x1e1fd9ab - .word 0xfffe883e - .word 0xf59f9a2a - .word 0xffffe537 - .word 0x651e4b19 - .word 0xffff02bf - .word 0x418b8cda - .word 0xfffd759d - .word 0x8d632ad0 - .word 0x00009709 - .word 0xf92f539e - .word 0xfffc870b - .word 0xa6c1560e - .word 0x0000d27d - .word 0xa674873a - .word 0xfffe7dd1 - .word 0xc9a1f750 - .word 0x00030299 - .word 0x1e456aec - .word 0x0000dc1f - .word 0x17ff86f2 - .word 0x0000964c - .word 0xcb00c071 - .word 0x0003df3e - .word 0xbc4b40d9 - .word 0xfffe7595 - .word 0x9b8f2680 - .word 0x0000bbe1 - .word 0xf68680ae - .word 0x0002941f - .word 0xc012d49c - .word 0xffffb55d - .word 0x7651c7eb - .word 0xffff759c - .word 0x9755c4df - .word 0x00034069 - .word 0xa4d608fa - .word 0xfffcf66e - .word 0xc0f2bec2 - .word 0xfffe5139 - .word 0x8a4fb576 - .word 0x00001197 - .word 0x4b6c4223 - .word 0x0000b506 - .word 0x9e7eabb2 - .word 0xfffcb318 - .word 0x218099c6 - .word 0x0002b1e8 - .word 0x3b5f733b - .word 0xfffe47f4 - .word 0x24cad279 - .word 0xffff95bd - .word 0xad944c22 - .word 0xfffcd37c - .word 0xcce21a84 - .word 0x000012c8 - .word 0x415c5383 - .word 0x00014542 - .word 0xfcbba12b - .word 0x00006419 - .word 0xdb996caf - .word 0x000242e0 - .word 0x80941ceb - .word 0x00032edc - .word 0xe433d2e0 - .word 0x000052ed - .word 0x29a3f8f5 - .word 0x00003e9c - .word 0xd5871756 - .word 0x0001bbe3 - .word 0x4181bcb6 - .word 0xfffe9b41 - .word 0x58736099 - .word 0xfffe3b8b - .word 0x14badfda - .word 0xfffd5692 - .word 0x77820775 - .word 0xfffc9160 - .word 0xc87129db - .word 0xfffd9ea4 - .word 0x1b25c0e5 - .word 0x000046c2 - .word 0x427f7970 - .word 0x00026b32 - .word 0xcfd059a9 - .word 0xfffc8495 - .word 0xa145114d - .word 0x00034b85 - .word 0xbb33b13c - .word 0xfffce614 - .word 0x10bef56f - .word 0xfffcce01 - .word 0x2ce80fc4 - .word 0xfffcbbd4 - .word 0xae050213 - .word 0x00009769 - .word 0x3fb2168d - .word 0x00031998 - .word 0xca33c0fc - .word 0xfffdef57 - .word 0xd3a85164 - .word 0xffff9a0c - .word 0x0ceb32fb - .word 0x0002d54e - .word 0xe1fb86d4 - .word 0x00013c07 - .word 0xbe3ad47f - .word 0xffffa9d8 - .word 0xad471e3a - .word 0xfffc1f22 - .word 0x2fca0ccf - .word 0x0000c182 - .word 0x7e934504 - .word 0xfffff2ac - .word 0x1be9b29c - .word 0x0001a567 - .word 0x747d43f4 - .word 0xfffebcf1 - .word 0xed05baf5 - .word 0xffff5ed0 - .word 0x906c13fa - .word 0x0003fe9c - .word 0x218b9c51 - .word 0xfffcbdc8 - .word 0xea0d2cfb - .word 0x0001bf01 - .word 0x59548fed - .word 0x0000ffbf - .word 0xe7e4ab5b - .word 0xffffe60b - .word 0x78b04457 - .word 0x0003c1c5 - .word 0x2b6d1b84 - .word 0x0001bfbb - .word 0x43a16af8 - .word 0xfffd2226 - .word 0x67e6aea1 - .word 0x00002bce - .word 0x5d0a6f5b - .word 0xfffcdf2b - .word 0x8817a876 - .word 0xfffc3eed - .word 0xb003dd7d - .word 0x000033e0 - .word 0x0e4b21bc - .word 0xfffe81fd - .word 0x09570a32 - .word 0x0003b2c1 - .word 0x9c374cf6 - .word 0x00003452 - .word 0x408b8803 - .word 0xfffdbec3 - .word 0x4b2aaf1d - .word 0xffffd6b9 - .word 0xb299ac3c - .word 0x00019596 - .word 0x68e97eff - .word 0xfffe2874 - .word 0xfdee448e - .word 0x000249e2 - .word 0x4695ac88 - .word 0xfffd5155 - .word 0x82fb8ea7 - .word 0x0001c04b - .word 0x4264ed00 - .word 0xfffd856b - .word 0x740c6632 - .word 0x000292c8 - .word 0x8237ee9f - .word 0xffffb4f6 - .word 0x1a850247 - .word 0x000200af - .word 0x57c67b10 - .word 0x000165ef - .word 0xd5affabf - .word 0x00017e9e - .word 0xf2696377 - .word 0x00034164 - .word 0x4ea084fa - .word 0x0001fab1 - .word 0x328b3c8c - .word 0xfffd9821 - .word 0x1e83f5e4 - .word 0xfffe63dd - .word 0xc8b5b0d7 - .word 0x00039db9 - .word 0x1f215912 - .word 0x000303bf - .word 0x0a48cc33 - .word 0x0002b6ad - .word 0xe66e6e54 - .word 0xfffe394d - .word 0x9302882d - .word 0x0002e8a1 - .word 0x9f0ff4ea - .word 0x0003e4cb - .word 0x218ae3ad - .word 0x0001d1e1 - .word 0x443243f4 - .word 0x00005141 - .word 0x39309bdd - .word 0xfffd205e - .word 0xb2c0e683 - .word 0x0000b816 - .word 0x111b05ac - .word 0x000150a3 - .word 0x63e14ae9 - .word 0xfffc3eba - .word 0xb6f2ea53 - .word 0xfffd8f35 - .word 0x59cedfe6 - .word 0xfffe6909 - .word 0x3d3745cc - .word 0xfffe8cd5 - .word 0x7f77a097 - .word 0xfffee187 - .word 0x04145b1f - .word 0x0000545c - .word 0x87ae4676 - .word 0xfffd4456 - .word 0x4e29b3d8 - .word 0xfffddb7c - .word 0x06530c0a - .word 0x0003b4e0 - .word 0xd92efcdd - .word 0x000124fc - .word 0x25a35fac - .word 0x0001ee4f - .word 0xb50e394b - .word 0xfffff8f9 - .word 0x4ab37765 - .word 0xfffdd826 - .word 0xd02f5051 - .word 0x00005ec8 - .word 0xedfa45dc - .word 0xfffc8d18 - .word 0x1de83c14 - .word 0xfffc65c1 - .word 0x87848e0e - .word 0xfffe3821 - .word 0xa2fee450 - .word 0xffff9236 - .word 0x6c6d925b - .word 0xfffc1c49 - .word 0xfdcbd2da - .word 0x00017012 - .word 0xd3ba5ad0 - .word 0x0001ca4c - .word 0xebd3f20f - .word 0x0003c0c4 - .word 0x9951e2a6 - .word 0x0003e883 - .word 0x3300e557 - .word 0x0001e107 - .word 0x884e16e5 - .word 0x0002ac1b - .word 0x07fdea79 - .word 0xfffcbe6c - .word 0xb200ae5c - .word 0x00003a39 - .word 0x5d88d5f2 - .word 0x00001eed - .word 0x21a868ef - .word 0xffff4a3c - .word 0x8ab3cf1d - .word 0x00028db5 - .word 0x5cf9ecc5 - .word 0xfffc46b6 - .word 0xafa003f9 - .word 0x0002ab30 - .word 0x1064627a - .word 0x0000954c - .word 0x82cbeeac - .word 0x00024c70 - .word 0x22240d06 - .word 0x0003fba3 - .word 0x6ec55b87 - .word 0x000000e9 - .word 0xc99b82d9 - .word 0x00021bcb - .word 0xd1356a44 - .word 0x00004fba - .word 0x83a62136 - .word 0xfffed1f4 - .word 0x492a668b - .word 0x000326de - .word 0xda914456 - .word 0x0003187c - .word 0x3301bf31 - .word 0xfffcf0a1 - .word 0xc0e46ae3 - .word 0xffff0239 - .word 0x1c1ff00b - .word 0x00022a71 - .word 0xe9b89f41 - .word 0xfffe0a7b - .word 0xa74fc282 - .word 0xfffdc088 - .word 0x13663a42 + .word 0xc440c458 + .word 0x00006072 + .word 0x4364f028 + .word 0xfffc766d + .word 0xc49ed875 + .word 0xfffeb640 + .word 0x9ff1a2fc + .word 0xfffc6929 + .word 0xbd2e2e2f + .word 0x00039150 + .word 0x1ceaf6fa + .word 0x00031f95 + .word 0xb8e147f8 + .word 0x0002362a + .word 0x60475fc2 + .word 0xffff7ba4 + .word 0xeb27f07f + .word 0xffff017a + .word 0x3907b9d4 + .word 0xfffd3479 + .word 0x1a7f7806 + .word 0xfffcf476 + .word 0x6db8e71a + .word 0x0001e217 + .word 0x9413c9ac + .word 0xfffec3c2 + .word 0xa2663664 + .word 0x0002b2f3 + .word 0xf94878ab + .word 0x00008a28 + .word 0x97a8aaef + .word 0xfffdaec8 + .word 0xc141816d + .word 0x00029c80 + .word 0x1e3f450c + .word 0x000143fb + .word 0x78019b7f + .word 0xfffed617 + .word 0x82ed6f5c + .word 0xfffc0756 + .word 0xc5cdd11d + .word 0x00011e1f + .word 0x04180ab0 + .word 0xfffc0ef3 + .word 0xf85e51d4 + .word 0xfffdb45f + .word 0xa5a9f4ed + .word 0x000367cf + .word 0x860a5509 + .word 0xffffdc94 + .word 0x6ea48c2e + .word 0xfffc1bc3 + .word 0x1b35accf + .word 0x0002fc2b + .word 0x35172903 + .word 0x00019912 + .word 0x95f767b9 + .word 0x0003bda5 + .word 0x396cb3e7 + .word 0xfffc1458 + .word 0x4bd7ca9a + .word 0x00037160 + .word 0x6095e26f + .word 0xffffbaee + .word 0x88596a14 + .word 0xfffe7d8a + .word 0x6f5f4d6b + .word 0xfffc7811 + .word 0x3d9cfd31 + .word 0xfffc12a6 + .word 0xa8878383 + .word 0x0003ff50 + .word 0x6a2f36ae + .word 0xfffdd0e2 + .word 0x4d78f138 + .word 0x0001dec7 + .word 0x715763cf + .word 0x00005f3a + .word 0xa19ba32e + .word 0xfffc8016 + .word 0x58831f1d + .word 0x00038c48 + .word 0x59904c1e + .word 0x0002b808 + .word 0x78c1badc + .word 0x00025332 + .word 0x435cfd9d + .word 0xfffdd97d + .word 0x5789a3eb + .word 0x0002e251 + .word 0x096c6a01 + .word 0x000020ee + .word 0xec4aabda + .word 0x00024954 + .word 0xa3bfa2b6 + .word 0xffff383d + .word 0x83bf0002 + .word 0xfffcd7b0 + .word 0xbe3bcef5 + .word 0x0000e649 + .word 0x2b4cac5f + .word 0x00000faf + .word 0x06fdcdeb + .word 0xfffeadad + .word 0x29064a00 + .word 0x00008f55 + .word 0x7d348a0e + .word 0x000149d0 + .word 0xd080ae2e + .word 0x00006720 + .word 0xd3986824 + .word 0x00026551 + .word 0xe169fa22 + .word 0xfffc421c + .word 0x450fbcff + .word 0xfffef9b2 + .word 0x13232bcc + .word 0xfffe3e91 + .word 0xb1183937 + .word 0x0001c36b + .word 0x5bf37a5c + .word 0x0002b73d + .word 0x230ac8cc + .word 0x0002b9ce + .word 0x16ed27f4 + .word 0xffffc0f7 + .word 0x4fb13025 + .word 0xfffcc4a2 + .word 0x1defab4d + .word 0xfffd5fd1 + .word 0x35ea7813 + .word 0xfffdd9f2 + .word 0x3070b6a1 + .word 0x0000e48c + .word 0x8be0482e + .word 0xfffd366b + .word 0x2d353201 + .word 0xffffe2d5 + .word 0xa4bbd851 + .word 0x00015877 + .word 0x7c180010 + .word 0x0000427e + .word 0x75cda4c9 + .word 0xfffdd1c2 + .word 0x735b7fc9 + .word 0xfffd7658 + .word 0x55b821e7 + .word 0x0001fb7d + .word 0x4408463b + .word 0xfffc2c60 + .word 0xd11aeebf + .word 0xfffecf0a + .word 0xa6ef17cc + .word 0xfffee80b + .word 0xf56645ad + .word 0xfffd48f5 + .word 0x63cc0f6c + .word 0xfffd0cc9 + .word 0xd76d2047 + .word 0x00036865 + .word 0xeefa3401 + .word 0x0001f098 + .word 0x5fa05873 + .word 0xffff2ede + .word 0xf307ebeb + .word 0xfffca0b3 + .word 0xf490d28e + .word 0x0003da57 + .word 0x6376551a + .word 0x000307a1 + .word 0xe6e7a201 + .word 0x00039b32 + .word 0x48afd141 + .word 0x0002e009 + .word 0x133b6d3c + .word 0xffffe9ba + .word 0x5d223616 + .word 0xfffcdfb6 + .word 0xd48c2cc1 + .word 0x000326cc + .word 0x12740ec3 + .word 0x0000d556 + .word 0x7181c5d3 + .word 0x00033d68 + .word 0x18e58c12 + .word 0xfffd7263 + .word 0x839b86e7 + .word 0xfffc10ec + .word 0xb0bb596a + .word 0xfffc60a4 + .word 0x1269413f + .word 0xfffe6d9b + .word 0x20e28899 + .word 0x0000ea32 + .word 0x69153a41 + .word 0xffffc8f0 + .word 0xfb795939 + .word 0x000356b0 + .word 0x3f184193 + .word 0x000250b9 + .word 0x862c9813 + .word 0xfffe47ad + .word 0x326f3d4c + .word 0x0001bf6f + .word 0xe75b8796 + .word 0xfffdeb5d + .word 0x5f3009f3 + .word 0x00015828 + .word 0x0486ae00 + .word 0xfffe2128 + .word 0x13012543 + .word 0x0000dcb6 + .word 0x9af8b2b2 + .word 0x000316a6 + .word 0xfc3a2f8b + .word 0xfffc7ac8 + .word 0x489d8949 + .word 0xfffc2c26 + .word 0x49a3ecde + .word 0xfffc362d + .word 0x81611ef8 + .word 0xfffdeb90 + .word 0x72f26583 + .word 0xfffe833e + .word 0xf2a181ed + .word 0xfffe25cd + .word 0xd2dbfb3b + .word 0x0001d35c + .word 0xd9a4b847 + .word 0xfffdf691 + .word 0x97c21f05 + .word 0x0001dd70 + .word 0x20dbea0a + .word 0xfffc2fc3 + .word 0x523da7f2 + .word 0xffffe43c + .word 0x7598c91d + .word 0xffffc5c9 + .word 0x04885392 + .word 0xfffe4737 + .word 0xa51dd786 + .word 0x00005ba1 + .word 0x5ac44e5e + .word 0x0003f2ac + .word 0x219aa534 + .word 0x0001f006 + .word 0x66b2afe8 + .word 0xfffe3aa7 + .word 0x75c9acbf + .word 0xffff8074 + .word 0xe29e429c + .word 0xfffc6f49 + .word 0x71d0723b + .word 0x0002f75f + .word 0xca845612 + .word 0x00038a8c + .word 0x54d236ac + .word 0x00003518 + .word 0x9d2580c8 + .word 0xfffcc208 + .word 0x2f9c80cf + .word 0x0003000e + .word 0xc553f7d2 + .word 0xffff5f5c + .word 0x4d45832f + .word 0x00012ccf + .word 0xca6b3781 + .word 0xffff50d9 + .word 0x3dd35262 + .word 0xfffec109 + .word 0x7aec9460 + .word 0xfffe091f + .word 0xff756502 + .word 0xfffe2152 + .word 0xc7bc0b65 + .word 0xfffc387c + .word 0xcf6f71cc + .word 0xfffe6234 + .word 0x793ae70c + .word 0x000206d9 + .word 0x30c2a03c + .word 0xfffc72dd + .word 0xd6e08511 + .word 0xfffd095f + .word 0xa1eb9766 + .word 0x00013649 + .word 0x8e5bc63d + .word 0xfffdb7fc + .word 0x44033c24 + .word 0xfffc15e2 + .word 0xd13674a9 + .word 0x000168e1 + .word 0x269eef7f + .word 0x0001353d + .word 0x66721b86 + .word 0x0001070d + .word 0xb56cccbb + .word 0xffff2382 + .word 0x0100c3ef + .word 0x0001d3f8 + .word 0xd544d674 + .word 0xfffedcef + .word 0x1a7315d9 + .word 0x00005311 + .word 0xf3d876ae + .word 0x0003ef2f + .word 0xe0e3ea88 + .word 0xffff479b + .word 0x4c7fb1f2 + .word 0x0002fcbd + .word 0x37071cf1 + .word 0xfffcd530 + .word 0xdc23b63c + .word 0x00032177 + .word 0xcfecaca9 + .word 0x00012ea8 + .word 0x0484c1ee + .word 0xfffe5118 + .word 0xd89de9fc + .word 0xfffe7413 + .word 0xe8e25d33 + .word 0x0000d747 + .word 0x38077be6 + .word 0x0002e53a + .word 0x8945ce45 + .word 0xfffe896c + .word 0x91e9e4a0 + .word 0xfffc8fd3 + .word 0x88a9dcd7 + .word 0xfffde377 + .word 0x2907cd73 + .word 0xfffe5b15 + .word 0x37fd6400 + .word 0x00009476 + .word 0x3ca4c52c + .word 0x0001209f + .word 0xcda7a17b + .word 0x000182f4 + .word 0xfc4c07fd + .word 0xffff766f + .word 0x6f9569bf + .word 0xfffd8dad + .word 0x6a49a201 + .word 0x0002017f + .word 0x1c9f054d + .word 0xfffe5931 + .word 0x71f5d65d + .word 0x000231e9 + .word 0x0d7b7964 + .word 0x00000d07 + .word 0xbd75279d + .word 0x00013f44 + .word 0xacfa652e + .word 0x00028c06 + .word 0x11099bce + .word 0x0000b8e3 + .word 0x370d774c + .word 0xfffe5ee6 + .word 0xddbd0f94 + .word 0xfffd0d4d + .word 0x7811a93d + .word 0x000313c9 + .word 0x5555b7b5 + .word 0xfffdc04f + .word 0x36bbcbd6 + .word 0xfffe23c4 + .word 0x6b2d806d + .word 0x0001f607 + .word 0x0ce4cf82 + .word 0xfffcc34f + .word 0x7d55004d + .word 0x00027d0a + .word 0x021ff89c + .word 0xffff0e5b + .word 0x8a532d68 + .word 0xffff80d1 + .word 0x4e6bad36 + .word 0xfffedc0f + .word 0x5444de7c + .word 0x000385da + .word 0x5fc247ee + .word 0x00014124 + .word 0x01f9d917 + .word 0xfffca0d5 + .word 0xc47a8c86 + .word 0xfffe5055 + .word 0xb8a6fb70 + .word 0x0001c45e + .word 0x51bd6ea4 + .word 0x00037b99 + .word 0xa098db10 + .word 0x00038db6 + .word 0x1df9999d + .word 0xffffba94 + .word 0xed89b4c0 + .word 0xfffe1b0c + .word 0xb5caa5a0 + .word 0x0000ea45 + .word 0x0d711160 + .word 0xffff2001 + .word 0xa64638b7 + .word 0x00036ca1 + .word 0xe3138727 + .word 0xfffd8760 + .word 0xf5be7a40 + .word 0x00021a2d + .word 0x90de7e54 + .word 0xfffdcca8 + .word 0xc61bbff3 + .word 0xfffc0fe0 + .word 0x61ce69fb + .word 0xfffdbf11 + .word 0xa50d8ada + .word 0xfffc72d1 + .word 0x1439a5d5 + .word 0x0002905e + .word 0x8afacfc9 + .word 0x000223e1 + .word 0x2d1a657b + .word 0x0000563c + .word 0x600c0143 + .word 0x0001c11e + .word 0x3f9025e2 + .word 0xfffe1167 + .word 0xb5b8a1fd + .word 0xfffc1ebb + .word 0xe635dc27 + .word 0x0002a3a9 + .word 0x353bc611 + .word 0x0003c5b5 + .word 0xf1635eef + .word 0xfffd3585 + .word 0x0a84e54d + .word 0xfffd63e3 + .word 0xf283345b + .word 0xfffefc4c + .word 0x5fa5b73a + .word 0x00033805 + .word 0x1444796f + .word 0xffff161f + .word 0x2fd82239 + .word 0x0002ff96 + .word 0x7f591830 + .word 0xfffe4c78 + .word 0x42a78c4f + .word 0x00003378 + .word 0xc2adae03 + .word 0xfffdcc66 + .word 0x12d9548b + .word 0xfffd94d0 + .word 0x944f8898 + .word 0x0001c6a4 + .word 0x2afafff6 + .word 0xfffef417 + .word 0x26b23e2e + .word 0x0003d203 + .word 0x4323c8ad + .word 0xfffd0da3 + .word 0xef597b61 + .word 0x000086b0 + .word 0xdd6e6469 + .word 0xfffd0631 + .word 0x41517580 + .word 0x00009f36 + .word 0x63710cb5 + .word 0xfffd7e19 + .word 0x4d18c9eb + .word 0xffffdd0d + .word 0x44c66c86 + .word 0xffff63c7 + .word 0x03813747 + .word 0x0003301c + .word 0x265e9c04 + .word 0xffffe271 + .word 0x967c7f00 + .word 0xfffe7537 + .word 0xc4c8fbf9 + .word 0xfffdc206 + .word 0x9c10c0ec + .word 0xffff51be + .word 0x91785c8b + .word 0x0000b7ce + .word 0x6069c3b8 + .word 0x0003bd91 + .word 0x384c28f9 + .word 0x00006e80 + .word 0xbd46afd1 + .word 0x0003460a + .word 0xe6725748 + .word 0xffffba86 + .word 0x82d4df72 + .word 0xfffc035e + .word 0x9683182a + .word 0x000353c3 + .word 0x0eb94755 + .word 0xfffcbb11 + .word 0xb8897790 + .word 0x000048c8 + .word 0x74f2ee6b + .word 0xfffea22a + .word 0xf8e72459 + .word 0xfffe284d + .word 0xff81ac16 + .word 0xfffd573b + .word 0x6b67d2e2 + .word 0xfffde19c + .word 0x7ec01c64 + .word 0xffff1324 + .word 0x464dd6c6 + .word 0xfffc3b11 + .word 0x32b8b66d + .word 0xfffc8ade + .word 0x713fcbd9 + .word 0xffff4d09 + .word 0x71489879 + .word 0x0002dce2 + .word 0x51017338 + .word 0x00003c53 + .word 0x7aa7cf8b + .word 0x000385c9 + .word 0x93a8e671 + .word 0x00035456 + .word 0x9e9b6970 + .word 0xffff72f0 + .word 0xb8b0505f + .word 0x00034bef + .word 0x06eed2ba + .word 0xfffdc845 + .word 0x5ebaccdc + .word 0xffff0aa2 + .word 0x36451645 + .word 0x00004d51 + .word 0x1b5ba6b7 + .word 0xffff80f5 + .word 0xf992ce18 + .word 0xffff67e3 + .word 0x23e95902 + .word 0x0003e58a + .word 0x6bd311a5 + .word 0xffff3194 + .word 0x9c96956d + .word 0xfffc255d + .word 0x477f7b43 + .word 0x00004ca0 + .word 0x4f5f5ae8 + .word 0x00033014 + .word 0x49e9de28 + .word 0xfffc8049 + .word 0x5924ab86 + .word 0x0000eee6 + .word 0xdbf10f8c + .word 0xfffe9f2e + .word 0xae002fb4 + .word 0x00038d21 + .word 0x8d3c7df7 + .word 0xfffd4bd1 + .word 0xb303a101 + .word 0x00001509 + .word 0xb78f1345 + .word 0xfffc1447 + .word 0xcc56f02b + .word 0x00025fca + .word 0xfdbd882b + .word 0xfffc6dc6 + .word 0xf35a1cd2 + .word 0x0000734d + .word 0x4e93b6b2 + .word 0x0000640f + .word 0x0c1174f9 + .word 0x0000e100 + .word 0x6bb7257b + .word 0x0003b80b + .word 0x38fd9087 + .word 0xffff5577 + .word 0x4bdf4ff5 + .word 0xfffce46d + .word 0xb9c685af + .word 0xfffd896c + .word 0xcbff8fdf + .word 0xfffc52f9 + .word 0x832ec85f + .word 0x0001f0ef + .word 0xec927573 + .word 0xffff3fb5 + .word 0x6d9d936e + .word 0x0003298a + .word 0x7ae853d9 + .word 0x0002edc5 + .word 0xd47c36bc + .word 0x00011e72 + .word 0x11bdf684 + .word 0xffff73dd + .word 0x1ddd1a91 + .word 0x0001778b + .word 0x8658ccbe + .word 0x00030f3d + .word 0xea2f4d91 + .word 0xfffef4d8 + .word 0x09234c72 + .word 0xfffdb157 + .word 0xe1b26eb3 + .word 0x000170a6 + .word 0x4ecb3c69 + .word 0x0001ec0b + .word 0x471e13f6 + .word 0xfffc88ec + .word 0x6547436e + .word 0x000192e0 + .word 0xb83640b1 + .word 0xfffe31a5 + .word 0xb06a2a5b + .word 0x00013acf + .word 0x80a578dc + .word 0xfffc94e2 + .word 0xcb233e9b + .word 0xfffcccf5 + .word 0x157d23c9 + .word 0xfffe4af8 + .word 0x567fba0e + .word 0x0001f615 + .word 0x5df671d2 + .word 0x0003d2f2 + .word 0x9875c27d + .word 0x0002639a + .word 0xa86bc2c7 + .word 0x000144ac + .word 0x7e16b5d7 + .word 0xfffcaa9f + .word 0xeb6f5ac5 + .word 0xfffcd6de + .word 0xa92b0b89 + .word 0x0000f1bf + .word 0x0861d061 + .word 0xfffc3e35 + .word 0x771d510c + .word 0xffff490b + .word 0x4298e1c4 + .word 0x00029bab + .word 0x82342f21 + .word 0x000276cb + .word 0xc473c448 + .word 0xfffd7e54 + .word 0xae0f7995 + .word 0x0003031e + .word 0xdd722a4b + .word 0xffff4067 + .word 0x48ab939f + .word 0x0002e455 + .word 0xc7deb997 + .word 0x0003cf35 + .word 0x2be7a25e + .word 0x0000217b + .word 0x3675a377 + .word 0x00034cc9 + .word 0x2e9a5b35 + .word 0xfffec1de + .word 0x0efbccff + .word 0x00024428 + .word 0xef32e83f + .word 0x0000ed57 + .word 0x59520b98 + .word 0x0002b581 + .word 0x1d569818 + .word 0x0002f529 + .word 0xaa97e9c3 + .word 0x00019cc4 + .word 0x9c29bcc5 + .word 0x00032d68 + .word 0xcef3f83a + .word 0x000147af + .word 0xed30c982 + .word 0xfffd413e + .word 0xf9cda050 + .word 0xfffe8577 + .word 0x7b8f184a + .word 0x00028504 + .word 0x506b80c0 + .word 0x00024a9a + .word 0x44e1182f + .word 0x00012ce9 + .word 0xcfec3b8c + .word 0xfffc7b42 + .word 0x94f7328c + .word 0x0000eb76 + .word 0x45a182d1 + .word 0x0000dcb6 + .word 0x1389129f + .word 0x000264e4 + .word 0x2b6b1d1e + .word 0xfffcd137 + .word 0x270cfb29 + .word 0xfffffb1c + .word 0x2164099f + .word 0xfffe4270 + .word 0x90471fc4 + .word 0xfffd5f1c + .word 0xe85ed6ef + .word 0xfffeccb5 + .word 0x0881aa63 + .word 0xffff9cab + .word 0xb602df16 + .word 0x0000acf6 + .word 0xf512c663 + .word 0x00002ed3 + .word 0x7f2baa75 + .word 0x00021012 + .word 0xe610817b + .word 0xfffd171a + .word 0xd31bfc94 + .word 0xfffdb821 + .word 0x4cd71b08 + .word 0x0001f528 + .word 0xfb715fea + .word 0x000331ee + .word 0x89a58edc + .word 0x00029e06 + .word 0x1512ad2a .word 0x000300c1 - .word 0x574bc897 - .word 0x0003fb8d - .word 0xfb06b432 - .word 0x00004e3b - .word 0xf718d29d - .word 0xfffc14b0 - .word 0xa59383ee - .word 0x00011fc0 - .word 0xeff7f2d9 - .word 0xfffcf11e - .word 0xddfd5bad - .word 0x00029197 - .word 0x513c028b - .word 0xfffc660a - .word 0xadd539a1 - .word 0x0001ba31 - .word 0x9e33ad48 - .word 0x000082ab - .word 0xbe839edb - .word 0xfffd1e34 - .word 0xbe661ee3 - .word 0xfffdf994 - .word 0x50c995ca - .word 0xfffeb974 - .word 0x2f0eb3b2 - .word 0x000268db - .word 0x1232aa73 - .word 0x00022712 - .word 0xeda71964 - .word 0xfffdb593 - .word 0x442c5296 - .word 0x0001445d - .word 0xa1303046 - .word 0x00018501 - .word 0x9ad64043 - .word 0x0000b8c6 - .word 0x96f1caaf - .word 0xffff6eda - .word 0xa819b97d - .word 0x0003c111 - .word 0x4a0dcd6a - .word 0xfffe23bb - .word 0xf03e606b - .word 0xfffe2d4b - .word 0x6463d6e6 - .word 0x00011452 - .word 0x89e12473 - .word 0xffff0d30 - .word 0xf5d66be5 - .word 0x0001c361 - .word 0x3d8b4770 - .word 0xfffe8ff6 - .word 0x0b6eef81 - .word 0x00022dc0 - .word 0x2c383157 - .word 0x000384f7 - .word 0xc63746f7 - .word 0xfffe1e8a - .word 0xdabe6017 - .word 0xfffe6f59 - .word 0x2dd5a3f3 - .word 0xfffee76d - .word 0xaf55b5b4 - .word 0x0003b2b9 - .word 0xf2851390 - .word 0xfffc723d - .word 0xf5254f23 - .word 0x0000116a - .word 0x2421e09d - .word 0x00002d54 - .word 0x0c9a0ed2 - .word 0x000004b8 - .word 0x3c2d1c86 - .word 0x00012a5b - .word 0xe7196558 - .word 0xfffe870c - .word 0x23114e8e - .word 0xfffd1347 - .word 0xe533bea3 - .word 0xfffff1e5 - .word 0x0750df44 - .word 0xfffcae76 - .word 0x38a0e341 - .word 0xfffdcbed - .word 0xc65e99bc - .word 0x0000b253 - .word 0xec4d0d51 - .word 0x000154cb - .word 0x52cc6cfe - .word 0x0002d79d - .word 0xad0b118d - .word 0xfffc1a1d - .word 0xf317ed04 - .word 0x0001d5df - .word 0x9f275823 - .word 0x0000b12f - .word 0xdce0b710 - .word 0x000376fe - .word 0x238d5dc6 - .word 0x00001495 - .word 0x0acdb1cd - .word 0x0002770d - .word 0x6f5b0b43 - .word 0xfffdf73a - .word 0x549c565e - .word 0xfffecae2 - .word 0x6db351ac - .word 0x00020777 - .word 0x59b9aa2a - .word 0xfffcf329 - .word 0x4513e0ac - .word 0x0000228a - .word 0x9b35ade3 - .word 0x00011ea5 - .word 0xdd0e0ea5 - .word 0x0003f025 - .word 0x2d21a509 - .word 0x00036235 - .word 0x087f9cca - .word 0xfffee1ef - .word 0x13480875 - .word 0xffff770d - .word 0x6e7abd8d - .word 0x000041fc - .word 0x8948990c - .word 0x0002dd5a - .word 0x68b5c06e - .word 0xfffc6bb9 - .word 0xa181617c - .word 0x0000bf6f - .word 0xd06bad86 - .word 0xfffe2842 - .word 0x37549c71 - .word 0x0002a231 - .word 0x345e21db - .word 0x00000282 - .word 0x8835820c - .word 0x0002ade0 - .word 0x8f8656d6 - .word 0xfffc5d22 - .word 0x6ab849ff - .word 0x0001963e - .word 0x35c7eb6e - .word 0xfffeeb4a - .word 0xfb85bed4 - .word 0xfffee543 - .word 0x01a69312 - .word 0xfffe92bc - .word 0xa7db4e11 - .word 0x000392dd - .word 0x3d19de6a - .word 0xfffde736 - .word 0xd009596a - .word 0x0000f822 - .word 0x571e62ca - .word 0xffff81ea - .word 0x303a9b94 - .word 0xffff14ad - .word 0x9014e2f2 - .word 0x0001898f - .word 0x106f112e - .word 0xfffd6270 - .word 0xb6014ef2 - .word 0xfffe0f58 - .word 0xbcd50f47 - .word 0x00033720 - .word 0xfbd0aa1c - .word 0x0001cb21 - .word 0xfebe17d6 - .word 0xffff2826 - .word 0xd3e4c828 - .word 0xffff1436 - .word 0x634b9aa3 - .word 0xfffcf9a1 - .word 0xe92495e4 - .word 0x000017db - .word 0xcf9da5e7 - .word 0x00013a14 - .word 0x8e2d0d53 - .word 0xfffdbe4f - .word 0xc63e0fad - .word 0x000382fc - .word 0xcb169909 - .word 0x0003bccf - .word 0x3dba64bd - .word 0x0002c21d - .word 0x21c218a3 - .word 0x00030d63 - .word 0xb31d0b34 - .word 0xffffd0b7 - .word 0xa7e5bc3d - .word 0x000178cd - .word 0x7dc91638 - .word 0xfffd91b7 - .word 0x405bfd31 - .word 0xfffe17f5 - .word 0x8fd10063 - .word 0x00035cb4 - .word 0xf82861cb - .word 0x00021258 - .word 0x778fdb83 - .word 0x00009817 - .word 0x6672e607 - .word 0xffffe84d - .word 0xc1952b1d - .word 0xfffdbdb2 - .word 0x69d1f546 - .word 0xfffe75a2 - .word 0x6eb04e57 - .word 0xfffff264 - .word 0x6df24bd3 - .word 0xfffdb335 - .word 0xb5092c89 - .word 0x00008a54 - .word 0xd167796d - .word 0x0001e6bc - .word 0x960d61ac - .word 0x0002e095 - .word 0xfdcc83ee - .word 0x0003f7a4 - .word 0xc561eb2e - .word 0x0001317c - .word 0xd2037b9f - .word 0xffff85c4 - .word 0x7ccada0c - .word 0xfffcadf4 - .word 0xe84e9944 - .word 0xfffc0d39 - .word 0xb33ef6fb - .word 0xfffe0316 - .word 0xc9a8d432 - .word 0xfffc8a5c - .word 0x71b00857 - .word 0xffffafe4 - .word 0x9b28f244 - .word 0xfffec5a4 - .word 0x363c3653 - .word 0x0003e137 - .word 0xe2630735 - .word 0xfffede36 - .word 0xfb0264cc - .word 0xffff1875 - .word 0xe2f6a9bc - .word 0xffffe9b9 - .word 0x1d4461b5 - .word 0xfffe62f2 - .word 0xd86c8d85 - .word 0x00001ae4 - .word 0xa999f0ae - .word 0xfffd65f2 - .word 0x49ec3451 - .word 0x000239eb - .word 0xc84ed84e - .word 0xfffe6052 + .word 0x04daeaa8 + .word 0x00012804 + .word 0x1c1d6e06 + .word 0x0001a543 + .word 0x520d7e1e + .word 0x00032bf8 + .word 0xe0d7eb4e + .word 0x00023239 + .word 0xf9b7fe1c + .word 0xffff3e91 + .word 0xca7b8351 + .word 0xffffec97 + .word 0x76cbc8c0 + .word 0x000049e1 + .word 0x3b69ebc5 + .word 0xffff5f03 + .word 0x7027cbb7 + .word 0x00021bac + .word 0x00e2c2e6 + .word 0xfffedef6 + .word 0x38d9be88 + .word 0xfffc2bf7 + .word 0xb7675587 + .word 0xfffeeeb3 + .word 0x610c32a7 + .word 0x0003294b + .word 0xb3593aaf + .word 0x00012b10 + .word 0x2b5c1678 + .word 0xffff9e91 + .word 0x3186eed1 + .word 0x000351df + .word 0x43287538 + .word 0xffff8d68 + .word 0x5450db52 + .word 0xfffcbfc2 + .word 0xb8a468b0 + .word 0xffff8e13 + .word 0xad4ff22f + .word 0x0001a84d + .word 0xc92ee8db + .word 0x0001e8e7 + .word 0xc4588e42 + .word 0x0001ac99 + .word 0x00c1a12a + .word 0x0001b867 + .word 0x33b4a1f7 + .word 0x0001feb7 + .word 0xd740b624 + .word 0x00004ff8 + .word 0x0d67e55c + .word 0x0002653a + .word 0xe58ede1a + .word 0xffff5dba + .word 0x1c08966f + .word 0xfffcc218 + .word 0xf17737e5 + .word 0x00016cfe + .word 0x4bf6f5e7 + .word 0xffffe27b + .word 0xf871caef + .word 0xfffeef1d + .word 0x46abf887 + .word 0x0000bfb7 + .word 0xa83807f2 + .word 0x0003b15b + .word 0x894917b5 + .word 0xfffdfe7a + .word 0xa10d94fd + .word 0x000288cf + .word 0x1107506e + .word 0x00016160 + .word 0xfa9181fc + .word 0x0003a37c + .word 0x1ba5a479 + .word 0xfffe68a1 + .word 0x741d6685 + .word 0xfffdf9b9 + .word 0xe97e10e6 + .word 0x0002ebe5 + .word 0xe7ed7c7f + .word 0x0000e69e + .word 0xeecfff92 + .word 0xfffdd7fd + .word 0x2d477c6e + .word 0xffff2e89 + .word 0x1d5279db + .word 0xffff919f + .word 0xfa4dc2bc + .word 0x0002c3cd + .word 0x48b61b0e + .word 0xfffdc8a4 + .word 0x19c2678c + .word 0xfffc5f00 + .word 0xa206e6a5 + .word 0xfffd42fd + .word 0xe7051be2 + .word 0xfffe7ce4 + .word 0x35587928 + .word 0xfffea1fc + .word 0xf7d033d1 + .word 0x000259e4 + .word 0xe92d4516 + .word 0x0003383f + .word 0x92453200 + .word 0xffffef76 + .word 0xd8717e6b + .word 0x00035a5d + .word 0x781c4dbc + .word 0x00024503 + .word 0x06882150 + .word 0x00018912 + .word 0xbbc90479 + .word 0x000035c7 + .word 0x7fe54d8c + .word 0x0003361a + .word 0x6922007e + .word 0x0003af15 + .word 0x6c9fef9f + .word 0x0000d74e + .word 0x7d8ee3a0 + .word 0x000238f6 + .word 0x0c10b7f4 + .word 0x000324cc + .word 0xfb40611d + .word 0x0001d785 + .word 0x02acc0a3 + .word 0xfffc4d17 + .word 0x238694fe + .word 0x00022450 + .word 0xebbf3e8e + .word 0x0001f8aa + .word 0x8577331c + .word 0xffff6204 + .word 0x3f24a512 + .word 0x00017d52 + .word 0x2719e527 + .word 0xfffc86fe + .word 0x7230b72f + .word 0xfffc5bc3 + .word 0x058f98ab + .word 0x000357d1 + .word 0x0c3941f3 + .word 0x00024498 + .word 0xdf33cabe + .word 0xfffebe22 + .word 0x7022b5fa + .word 0xffffd0ad + .word 0x16463172 + .word 0x00011790 + .word 0x1da09e17 + .word 0x000320c5 + .word 0x3a255d9b + .word 0x00032fcb + .word 0x84e4adb3 + .word 0xfffc7ef8 + .word 0x9de00c9b + .word 0xfffe9962 + .word 0xc1f8ad01 + .word 0xfffe4bb4 + .word 0x5fae760f + .word 0xfffd86c8 + .word 0x744943e6 + .word 0xfffcf6ce + .word 0x39ffa346 + .word 0xfffcf553 + .word 0x72d41651 + .word 0xfffc073c + .word 0x5a65f7d7 + .word 0xfffe1666 + .word 0x079474f6 + .word 0xfffe1afa + .word 0x0c5e67c9 + .word 0x00034a6f + .word 0x6bda3783 + .word 0xfffd3d07 + .word 0x0222d918 + .word 0xfffdd064 + .word 0x6ea28521 + .word 0x00024926 + .word 0x1f213328 + .word 0x0000caee + .word 0x8ea95e2a + .word 0x00030c05 + .word 0x27d3f645 + .word 0x0003ecdc + .word 0x6d93aa4c + .word 0xfffde6f6 + .word 0xb3a21318 + .word 0x00028a4b + .word 0x2da44e51 + .word 0x00029b94 + .word 0x336973a4 + .word 0x00015dca + .word 0xfa29ed42 + .word 0x000085cf + .word 0xb212e919 + .word 0x0000e8cf + .word 0xeb3ee7f8 + .word 0x0003856c + .word 0xedb97c33 + .word 0x00021c77 + .word 0x6e744908 + .word 0xfffe1b82 + .word 0x221e15c7 + .word 0x00020e27 + .word 0x8cf72956 + .word 0x0001ef5f + .word 0x57ccbcb0 + .word 0xfffd6f6b + .word 0x9543194c + .word 0xfffcc346 + .word 0x6f2472ae + .word 0x00033a86 + .word 0x698e275c + .word 0xfffe9002 + .word 0x2f4663b6 + .word 0x00034ae2 + .word 0x0d029a47 + .word 0x000363a3 + .word 0x18951719 + .word 0x00030647 + .word 0xba389e7c + .word 0xfffe1cc9 + .word 0xc874e39d + .word 0xfffefedb + .word 0x30ff909d + .word 0xfffff803 + .word 0xdd0c1321 + .word 0xfffc27e5 + .word 0xbd03d9a1 + .word 0xfffc9fa9 + .word 0x077e5c79 + .word 0x0001bf9d + .word 0x2328aec9 + .word 0xfffff38e + .word 0xfaa9a7ef + .word 0xfffc585a + .word 0xf098e831 + .word 0xfffe614e + .word 0x6304f867 + .word 0xfffeaf1e + .word 0x36a0aa26 + .word 0x00021e83 + .word 0x221b7620 + .word 0x00013bf9 + .word 0x46322976 + .word 0x000046ae + .word 0x52b56f2b + .word 0xffff5899 + .word 0x1fd5fba3 + .word 0xfffcfd93 + .word 0xa0719ebe + .word 0x0000d005 + .word 0xbc31e29a + .word 0xfffea8a8 + .word 0x683ba193 + .word 0xffff4d56 + .word 0x39676521 + .word 0x0001d823 + .word 0x810701a7 + .word 0x0003c5db + .word 0x1ff63072 + .word 0xfffe9986 + .word 0x2b4e6dd6 + .word 0xffff1d0f + .word 0x77f75cda + .word 0x00008ad0 + .word 0xd1a73beb + .word 0x00000ac7 + .word 0x9497d859 + .word 0xfffd5044 + .word 0xcd82f218 + .word 0x00005d08 + .word 0x5543d86f + .word 0xfffcefa3 + .word 0xa0e4832d + .word 0x00005e43 + .word 0x2c42275f + .word 0x00022b29 + .word 0xda543b9a + .word 0x0003d56d + .word 0x012f4a51 + .word 0xfffd90be + .word 0xe37141a5 + .word 0xfffdf1bd + .word 0xf4abb33b + .word 0x00010909 + .word 0x62570f50 + .word 0xfffcbe42 + .word 0xc0386ee3 + .word 0x00032a8f + .word 0x4ad6ccf0 + .word 0xfffcebcd + .word 0x8ee56e77 + .word 0xfffe5a95 + .word 0xd44d67b0 + .word 0x00009bea + .word 0x7914d394 + .word 0xfffdb6b2 + .word 0x1206f970 + .word 0x00031e48 + .word 0x7fc4f360 + .word 0xfffd1bb2 + .word 0x9fcf817c + .word 0x00032d1a + .word 0x61e15269 + .word 0xffff82a1 + .word 0x6111bc05 + .word 0xfffd21b0 + .word 0x1247e19e + .word 0x00026cae + .word 0x53a3d9f0 + .word 0x0001b2d8 + .word 0x669debe6 + .word 0xfffc998d + .word 0xa36614ac + .word 0xfffea969 + .word 0xcc896180 + .word 0x00009420 + .word 0x88b18bc2 + .word 0xfffea5f5 + .word 0xb684c496 + .word 0xffff1f96 + .word 0xf5408d48 + .word 0x000332be + .word 0xb552bb9c + .word 0xffffd867 + .word 0x2fef4236 + .word 0x0000c91c + .word 0xcfc3d499 + .word 0xfffcde97 + .word 0x0e9cdfa5 + .word 0xfffc44ef + .word 0xd297ab4b + .word 0xfffff798 + .word 0xe227a5cd + .word 0x000313da + .word 0x82c29570 + .word 0x0000f89a + .word 0x90e5a527 + .word 0xfffd6e43 + .word 0xc642517e + .word 0xffffb602 + .word 0x24fe4f1c + .word 0x0003219c + .word 0x7eda0832 + .word 0xfffcb6db + .word 0xa239919a + .word 0xffff3c26 + .word 0xc5ae9687 + .word 0xfffc5e65 + .word 0x473a6556 + .word 0x00009ada + .word 0xbeb251a4 + .word 0x000147e5 + .word 0x43e600b6 + .word 0xffff0a80 + .word 0x10f8ae79 + .word 0x0001d2f5 + .word 0x524faf08 + .word 0xfffd88d9 + .word 0xca3d78d7 + .word 0x00025e6e + .word 0x345cad0f + .word 0x0003ba26 + .word 0xbfbe06c5 + .word 0x00001a02 + .word 0x4f9dd8c5 + .word 0xfffe4ae2 + .word 0xf5322ddd + .word 0xfffdf9af + .word 0xe89c1131 + .word 0xffff6d61 + .word 0xa34f7344 + .word 0x0002e1c6 + .word 0xe94ee6ca + .word 0x0003dc0b + .word 0x351f307d + .word 0x000046c8 + .word 0x6752b334 + .word 0x00006306 + .word 0xb1ebc2e4 + .word 0xfffed61b + .word 0xdda47713 + .word 0x0003d6c1 + .word 0xb38cf406 + .word 0xffffa3c9 + .word 0x265ecfcd + .word 0x0003196d + .word 0x3fe7ae04 + .word 0x00035e04 + .word 0x135a01aa + .word 0x0000e5c8 + .word 0x95747ac9 + .word 0x0001f6f2 + .word 0x0ac0a52d + .word 0x0000e538 + .word 0x4ef28b05 + .word 0x0003b7df + .word 0xaf6872bc + .word 0x0002ca7c + .word 0xc143c745 + .word 0xfffcf890 + .word 0x4107964b + .word 0x0002d2d4 + .word 0xd59362a0 + .word 0xffff392f + .word 0xe7308d17 + .word 0xffff7cd8 + .word 0xabd89dd1 + .word 0xffff610c + .word 0xdbfa684a + .word 0x000287fa + .word 0xedc59fe1 + .word 0xfffc1e26 + .word 0x18653d6d + .word 0xffff8650 + .word 0xa613d67c + .word 0xfffd0c20 + .word 0x4e2f1499 + .word 0x00012204 + .word 0xe5cf6b81 + .word 0x00012599 + .word 0x0ba7f045 + .word 0xfffd4a22 + .word 0x67e28ee8 + .word 0x0002b055 + .word 0x654dd70c + .word 0xfffffe70 + .word 0x6c750773 + .word 0xfffe6834 + .word 0xd3b68a11 + .word 0xfffd05b0 + .word 0x15a6f1b8 + .word 0xfffff629 + .word 0x11fd6f80 + .word 0x0002a273 + .word 0x9decc745 + .word 0x0002f779 + .word 0x22b36ebd + .word 0xfffc0c4f + .word 0xba31f285 + .word 0x0002d996 + .word 0xc70ac7a7 + .word 0x00027a2f + .word 0xec0bd2e4 + .word 0xfffdf159 + .word 0x6e104544 + .word 0xfffe433f + .word 0x4c99936c + .word 0x00039cd7 + .word 0x190bbba8 + .word 0x00023b56 + .word 0xc2c5953b + .word 0xfffd72a0 + .word 0xeb5ccd71 + .word 0xfffee426 + .word 0xb8d5884b + .word 0x0002e378 + .word 0x50366275 + .word 0x00026fcb + .word 0xcf2d4db1 + .word 0x0000fb87 + .word 0xd92b6b5b + .word 0x00011171 + .word 0xb8454f54 + .word 0xfffd3f77 + .word 0xc8fa8403 + .word 0xffff7538 + .word 0xc5014bb4 + .word 0xffff6803 + .word 0xa115afc7 + .word 0x0003e242 + .word 0xf5c8b839 + .word 0x0003c785 + .word 0x90dda2ab + .word 0xfffd872b + .word 0x96c12644 + .word 0xfffec449 + .word 0xeffcf8b4 + .word 0x000040f2 + .word 0xae043034 + .word 0xfffe26d4 + .word 0xd8cbb839 + .word 0x000210d4 + .word 0x58b97764 + .word 0x0003162d + .word 0xd8a291d4 + .word 0xfffd292d + .word 0xf65fcfbe + .word 0xfffed84b + .word 0x4046fe1e + .word 0x0003dd46 + .word 0x0913b2c8 + .word 0x0002fcf0 + .word 0xd96bdf97 + .word 0xfffdd9ff + .word 0x9ca5270a + .word 0x0001cde1 + .word 0xb2283b11 + .word 0x0000d749 + .word 0x4b167a1b + .word 0xfffc1490 + .word 0x31a1feeb + .word 0x0000c74f + .word 0xbfe48fca + .word 0x000236b9 + .word 0xf4bf85c1 + .word 0x0003c857 + .word 0xb92ec9fc + .word 0xffff94e3 + .word 0x2ae007e1 + .word 0xfffe26cf + .word 0x51857034 + .word 0x00039c0a + .word 0x9e2e9f87 + .word 0xfffe2c99 + .word 0xecfbf8f1 + .word 0xfffe07ae + .word 0xb422abbf + .word 0xfffd4588 + .word 0xf1e5a7cd + .word 0x0002d94e + .word 0xb00c9053 + .word 0x0000c5d6 + .word 0x90e96ce5 + .word 0xfffd3eed + .word 0xb962ff37 + .word 0xffffda6e + .word 0xd43fee75 + .word 0x00020364 + .word 0xaad522bc + .word 0x00013442 + .word 0x21696333 + .word 0x00003352 + .word 0xb5aea913 + .word 0x000045bb + .word 0x64940723 + .word 0xffff3725 + .word 0x280f6151 + .word 0xfffc8884 + .word 0x68723a4a + .word 0xfffdee1a + .word 0x2f42725e + .word 0x000347f0 + .word 0x7e9b119f + .word 0xfffe1467 + .word 0x1dfe8094 + .word 0xffff067d + .word 0x1ec3426a + .word 0x000173e8 + .word 0x303d5712 + .word 0xfffc0466 + .word 0x9ad32c0e + .word 0x0003e97d + .word 0xf3018be7 + .word 0x0003b869 + .word 0xa3c29d80 + .word 0x0000d79a + .word 0xbf7d1d8e + .word 0x0001f740 + .word 0x4b7004ae + .word 0x0003fd70 + .word 0xfca22741 + .word 0xfffe96a7 + .word 0x1f2dfe99 + .word 0x000331fc + .word 0x4392616e + .word 0xfffe4d69 + .word 0x29ca45e0 + .word 0xfffcc3e3 + .word 0x40f13f54 + .word 0x00021540 + .word 0x93c320df + .word 0x00035231 + .word 0x614130a2 + .word 0x00030fe7 + .word 0x389bf42a + .word 0x0001b01d + .word 0x37af7d87 + .word 0x0001c519 + .word 0xb27c6cd8 + .word 0xffffa6b3 + .word 0x22658900 + .word 0x00022e5a + .word 0xeb355e07 + .word 0x00026306 + .word 0x7c0dcd4e + .word 0x00038809 + .word 0x3c71468b + .word 0xfffdf83e + .word 0x249025ce + .word 0xfffed1ab + .word 0x59e7d91e + .word 0xfffee264 + .word 0xfe811681 + .word 0x000047ad + .word 0x8941354a + .word 0xfffd72ce + .word 0x54116296 + .word 0xfffcd3b8 + .word 0xe42afadd + .word 0xfffddb3c + .word 0x37c6928c + .word 0x00000365 + .word 0x3bffb192 + .word 0x0000a2a9 + .word 0x09df5adb + .word 0xfffca7bd + .word 0x437e210f + .word 0xffff456d + .word 0xbb3f1b8b + .word 0x0000c413 + .word 0xa5d572c3 + .word 0xfffce35f + .word 0x7a782365 + .word 0x00019182 + .word 0x68b57b4b + .word 0x0001ad8a + .word 0xc7824b7f + .word 0xfffc3769 + .word 0x4fff864e + .word 0xfffddf88 + .word 0x5dc46b79 + .word 0x00014126 + .word 0xc1fa353a + .word 0x000252c4 + .word 0x95dca0a1 + .word 0x00023152 + .word 0x166db857 + .word 0x0000659b + .word 0xffdb7ee2 + .word 0x00038982 + .word 0x63ad939f + .word 0xfffc2154 + .word 0x1bac460c + .word 0x0002e426 + .word 0xb3bd1127 + .word 0xfffd36aa + .word 0x69870233 + .word 0xffff334c + .word 0x0f751442 + .word 0xfffdcce1 + .word 0x9886b23c + .word 0x0000edfc + .word 0x6deaf99c + .word 0x0003484a + .word 0x05d24639 + .word 0xfffe10c6 + .word 0x10ce65e4 + .word 0x0003cdd3 + .word 0xd66c211f + .word 0xfffed361 + .word 0x94c86bbd + .word 0xfffe0c0f + .word 0xdeb1997d + .word 0xfffe6267 + .word 0x8789a0d8 + .word 0x00027906 + .word 0x773dba2b + .word 0xfffc8a84 + .word 0x1f13799f + .word 0x00025fc0 + .word 0x93b4d80f + .word 0x00000f4c + .word 0x306ac0e6 + .word 0x0003c8ad + .word 0x640a3b1c + .word 0xfffc1e9f + .word 0xe640a67d + .word 0xfffe16c9 + .word 0x0e53c174 + .word 0x0003ebb2 + .word 0x336c11e5 + .word 0xfffd2360 + .word 0xbf765325 + .word 0x0000b04c + .word 0x98904d97 + .word 0xffff703b + .word 0xdf1ba974 + .word 0xfffd9fdb + .word 0x9e3a107c + .word 0x00017b1b + .word 0xbf7d1054 + .word 0x0003fbbd + .word 0xe370e31d + .word 0xffff3262 + .word 0x5f2eb107 + .word 0x00011001 + .word 0x611c4b20 + .word 0x00037cdd + .word 0xe8905af9 + .word 0xfffe9af0 + .word 0xa49eb36b + .word 0xfffc117f + .word 0x9c48d3cd + .word 0xffffe21a + .word 0xf504a9a4 + .word 0xfffc60a1 + .word 0x60d69115 + .word 0xfffd661f + .word 0xf7bd4b5c + .word 0xfffd9ee3 + .word 0x3d3eb84e + .word 0xfffe405e + .word 0xa7f84c6d + .word 0x0002d1a7 + .word 0x49f18b34 + .word 0xfffe00f0 + .word 0xe8a36f1d + .word 0x00023aa5 + .word 0x1217d6b3 + .word 0xfffda991 + .word 0x8662333a + .word 0xfffc2b97 + .word 0xeb49c545 + .word 0x0002c279 + .word 0x60f2a1dd + .word 0xfffc4aac + .word 0xa0ed86b9 + .word 0xffff8317 + .word 0x498a95e1 + .word 0x00016965 + .word 0x59f0a83d + .word 0x00032115 + .word 0xa107788c + .word 0x0000fd00 + .word 0x9d70c705 + .word 0xfffd5cf4 + .word 0xd8880987 + .word 0x00023051 + .word 0x716c4acd + .word 0xffff8de8 + .word 0x70cd40da + .word 0xffff7d93 + .word 0x6ef66f06 + .word 0xfffd34a5 + .word 0x9fad16d2 + .word 0xfffd50b9 + .word 0x43ae3554 + .word 0xfffdf041 + .word 0x4dd495f8 + .word 0xfffd4336 + .word 0xc138139c + .word 0x0000054f + .word 0x7589be8a + .word 0xfffc5060 + .word 0xf1f031b7 + .word 0xfffdf4fd + .word 0xa6b0bc84 + .word 0xfffff212 + .word 0x6f6cac32 + .word 0xfffcfe93 + .word 0x50289b38 + .word 0xfffd026a + .word 0x0c84d7df + .word 0xfffd711f + .word 0x95b35a37 + .word 0x00007701 + .word 0xf9024073 + .word 0x000033c5 + .word 0x17b2d4b6 + .word 0x0000b458 + .word 0xb3d6b069 + .word 0xffff3b22 + .word 0xaa702bcc + .word 0x00019957 + .word 0xb00e7b36 + .word 0x00030e9f + .word 0xc507da2f + .word 0x00012140 + .word 0x9663448a + .word 0x0002a9b1 + .word 0xf313b8bb + .word 0x000019cb + .word 0x7acec033 + .word 0xfffc478e + .word 0x3a25633f + .word 0x0000fe8b + .word 0x2c9e48f1 + .word 0x00030045 + .word 0xfec9b83a + .word 0x0003f3bd + .word 0xbd0003cf + .word 0xfffc0b64 + .word 0xbf5e0f5c + .word 0x0002fdd4 + .word 0xaa354c4d + .word 0xffff456e + .word 0xbfd41659 + .word 0x0002dfe6 + .word 0xed9fb35c + .word 0x00027fd8 + .word 0xfbb87d96 + .word 0x0000459f + .word 0x863f5424 + .word 0xfffc4331 + .word 0xbbd70940 + .word 0x0003d46a + .word 0x66ffdbac + .word 0x00023ebb + .word 0x97df0608 + .word 0x0003bd41 + .word 0xe5cc1973 + .word 0x00026ed4 + .word 0xbafc7e93 + .word 0x00013175 + .word 0x849de065 + .word 0xfffce400 + .word 0x9328836b + .word 0x0001cb96 + .word 0x1f99142f + .word 0xfffed061 + .word 0xf6ede48e + .word 0xffff082a + .word 0xb44623ad + .word 0x00020109 + .word 0xcbe4583c + .word 0xfffe0184 + .word 0x7c215670 + .word 0x00001ce7 + .word 0xb829bc4a + .word 0x0003da1b + .word 0x98570efc + .word 0x00032975 + .word 0x3ab44139 + .word 0xfffdfa2f + .word 0x3e74ece3 + .word 0xffffe8b9 + .word 0x11d89c1e + .word 0x00009bae + .word 0xa8f093d9 + .word 0x00016a66 + .word 0x8483e825 + .word 0xfffd1f15 + .word 0xd5a42888 + .word 0x000206dc + .word 0x7fb44c92 + .word 0x00026416 + .word 0xa580d3c8 + .word 0xfffcd9cc + .word 0x4888b1ac + .word 0x000357de + .word 0xf6176d6b + .word 0x0003cd6a + .word 0x01997e61 + .word 0xfffed60c + .word 0xd9326473 + .word 0xfffc5671 + .word 0xfcd985f2 + .word 0x00018cda + .word 0xf5c81cce + .word 0xfffe5a39 + .word 0xcead19fb + .word 0xffffd08c + .word 0x2b709bb2 + .word 0x00031049 + .word 0x9099c4a9 + .word 0x00023683 + .word 0x3fbcc174 + .word 0x0000d71b + .word 0x56cfc680 + .word 0xffff3c32 + .word 0x8742e53a + .word 0xfffcfa81 + .word 0x41de1b1c + .word 0xfffff00c + .word 0x3f12618b + .word 0xfffd925b + .word 0x37c65a81 + .word 0xfffe29c6 + .word 0xc9489979 + .word 0x00037fb1 + .word 0x3c7d3a85 + .word 0x000331d2 + .word 0xb3e836cf + .word 0xfffe92f0 + .word 0x7db7e05c + .word 0xfffdf8fa + .word 0x8d00b09d + .word 0xfffd51db + .word 0xcdd51bc9 + .word 0x0001ad48 + .word 0xf63cb1cf + .word 0x0000973c + .word 0xc41b8d49 + .word 0x00000875 + .word 0x6dc65baa + .word 0xfffff660 + .word 0x4c0d850d + .word 0xfffd87c2 + .word 0xb7af7f4b + .word 0x00012844 + .word 0xfa926b55 + .word 0xfffda7cb + .word 0x460b28cc + .word 0x0003317d + .word 0xa7d7db56 + .word 0xfffde55d + .word 0x9b68321a + .word 0x0002fa6b + .word 0x24685888 + .word 0xfffdec52 + .word 0x90cf857f + .word 0xfffce892 + .word 0x1f84465d + .word 0x000232a6 + .word 0x8d574b3c + .word 0xfffeb78b + .word 0xced6fcc4 + .word 0xfffdedcc + .word 0x954360e5 + .word 0xfffc27ba + .word 0x6e19416c + .word 0xfffc354e + .word 0x601fe30b + .word 0xfffd1e7b + .word 0xd8f800ab + .word 0xfffe592f + .word 0xf902789d + .word 0xfffd0fd3 + .word 0x4b8f8736 + .word 0x00014f8a + .word 0xf258a9fb + .word 0xfffe207e + .word 0x92d62b15 + .word 0xfffcd3d1 + .word 0x9f01a96f + .word 0x0003a937 + .word 0xf93858a7 + .word 0x00002c05 + .word 0x167d592d + .word 0xfffd9dec + .word 0x8efa79e0 + .word 0xfffec65a + .word 0xf23493cc + .word 0xfffdf48f + .word 0x1ed4c195 + .word 0xfffe7408 + .word 0xe6f2a679 + .word 0x00000fec + .word 0xbc8c3680 + .word 0xfffd500e + .word 0x90bce0d6 + .word 0xfffe44b2 + .word 0xd61b166f + .word 0x0003a04f + .word 0xda4bcfe3 + .word 0x000238ba + .word 0x7bb2320d + .word 0xfffffbc9 + .word 0x85a84fe0 + .word 0x00007788 + .word 0x64d1ec21 + .word 0x0002c268 + .word 0xe5de205e + .word 0xffff46a7 + .word 0x97b9c24d + .word 0xfffcbad6 + .word 0xc459b33a + .word 0xffff296f + .word 0x1404e615 + .word 0x000053c6 + .word 0x83f1ad5f + .word 0x00022e60 + .word 0x3ca00b27 + .word 0x00013315 + .word 0x261c73c8 + .word 0xfffd3b6a + .word 0xad3d87f3 + .word 0xfffcf9cf + .word 0x306be8ec + .word 0x00007f74 + .word 0x96a650fd + .word 0xfffc5a01 + .word 0x342fd4d9 + .word 0x0002ef1b + .word 0xb5c37b62 + .word 0x0000491e + .word 0xc15f5e3e + .word 0x0002ab1d + .word 0xe1cc6b51 + .word 0xfffc22f4 + .word 0xf4d6d076 + .word 0x00015f6a + .word 0x090bd7eb + .word 0x00003ff7 + .word 0xf020ce00 + .word 0x0003ef11 + .word 0x0c3fc94b + .word 0xfffc6fc8 + .word 0xf6e96786 + .word 0x0001d37b + .word 0xdeeda4cf + .word 0x00011d4b + .word 0xa2e780eb + .word 0xfffcf6d1 + .word 0xf96d5f55 + .word 0x00031bf2 + .word 0xd59f06fe + .word 0xfffe374a + .word 0xfbb12c80 + .word 0x00018d9a + .word 0xaf611d90 + .word 0xfffe4ba1 + .word 0xc2f25cf6 + .word 0xfffc7a10 + .word 0x074b0234 + .word 0xfffc78ed + .word 0x3076c27f + .word 0xffff3211 + .word 0xa942d79a + .word 0x0000b878 + .word 0xa470bb6d + .word 0x000347d3 + .word 0xae876bcb + .word 0xfffee495 + .word 0x8a608520 + .word 0x0002a9da + .word 0xf65f0aa7 + .word 0x000164a5 + .word 0xc112c699 + .word 0x000325f5 + .word 0x506cdaac + .word 0xfffc2e2c + .word 0x42ed0126 + .word 0xffffb48b + .word 0xcf04643f + .word 0x00001133 + .word 0x4610456f + .word 0xfffc061c + .word 0xe4d67dba + .word 0xfffc4e69 + .word 0xad65d9c0 + .word 0xfffd7727 + .word 0xd03252f7 + .word 0xfffc07c7 + .word 0xe13f4da2 + .word 0x00025a5c + .word 0xbd89a6a9 + .word 0x0000fa1a + .word 0x9cd0d553 + .word 0xfffe5a13 + .word 0x59b84527 + .word 0x0001d412 + .word 0x14ee08d0 + .word 0x0003e605 + .word 0x1096b8c4 + .word 0x00004e9c + .word 0xc2104810 + .word 0xffff78f9 + .word 0xb06e66bd + .word 0xfffd390d + .word 0xb7537bef + .word 0x0001cc50 + .word 0x0508acad + .word 0xfffc910c + .word 0x907a303b + .word 0x0003e1e7 + .word 0x9ddca56b + .word 0xfffd4406 + .word 0x6eabe950 + .word 0x00034f74 + .word 0x4a17742b + .word 0x000266db + .word 0xf5f8c763 + .word 0x0002801a + .word 0x803b962a + .word 0xffff771f + .word 0x176d2e2a + .word 0x0002392e + .word 0x4509fbaf + .word 0x00016d01 + .word 0x5cdf1cbc + .word 0x0001b48d + .word 0x74a3fc2e + .word 0x0001cc91 + .word 0x20373859 + .word 0xffff34fb + .word 0x31a51f69 + .word 0x00032c24 + .word 0xd90de73b + .word 0x00013eab + .word 0xd713f1bc + .word 0x0003a22d + .word 0x6e0d153e + .word 0x00028048 + .word 0x9afa04e1 + .word 0x00030d7a + .word 0xe81a4279 + .word 0x00002828 + .word 0x5a172ce1 + .word 0xfffebd14 + .word 0x33b2eab2 + .word 0xfffdb20d + .word 0xe93d2646 + .word 0x00031050 + .word 0xad7af2a6 + .word 0xfffe5983 + .word 0x658845ce + .word 0xffff7c2b + .word 0xb96abe57 + .word 0xfffcdfaa + .word 0x8ee6f17d + .word 0x000210cd + .word 0x9ad6dd79 + .word 0x00014361 + .word 0xed1c0ded + .word 0xfffca211 + .word 0x7692a2c0 + .word 0xfffded2f + .word 0x24d53e64 + .word 0x000342ac + .word 0x1adcfd86 + .word 0x0000417c + .word 0xbdd18b03 + .word 0xfffdddf3 + .word 0x396acf22 + .word 0xfffe9061 + .word 0x14abd44b + .word 0xfffddd66 + .word 0x0f361b99 + .word 0x00032a2a + .word 0x1391d086 + .word 0xffff7c5f + .word 0x16871862 + .word 0xfffff222 + .word 0xce02ed60 + .word 0xfffcde3b + .word 0xd3891585 + .word 0x000204f2 + .word 0x0bf03107 + .word 0xffff7be9 + .word 0xca076378 + .word 0x00024494 + .word 0xc134ca59 + .word 0x0002d8e5 + .word 0x7b27e0f2 + .word 0x00028eb3 + .word 0xbfc1fac8 + .word 0xfffcf7a2 + .word 0xd2128635 + .word 0xfffe09ce + .word 0x19ae4be0 + .word 0xffff9f27 + .word 0x80c33c60 + .word 0xfffe6d24 + .word 0x009f1804 + .word 0x0001eed3 + .word 0x45900647 + .word 0x0000039b + .word 0xeaa89758 + .word 0xfffcb4d8 + .word 0xadfbd02e + .word 0xfffc543c + .word 0xe52ece1b + .word 0x0002c7db + .word 0xcb204d99 + .word 0xfffd6392 + .word 0x584b443f + .word 0x0002030f + .word 0x9f617666 + .word 0x0000808f + .word 0xd4ba890a + .word 0xfffea03d + .word 0xac647bc4 + .word 0x0003276f + .word 0xa70e4b99 + .word 0x00033b82 + .word 0xe1ea9168 + .word 0x0003a2a8 + .word 0xad684d3a + .word 0x00000980 + .word 0x754444d7 + .word 0x0002ec21 + .word 0x123e2114 + .word 0xfffe3ce9 + .word 0xcda17269 + .word 0xfffe635b + .word 0xe1500d8e + .word 0x00022323 + .word 0xf71d9ed3 + .word 0xffff28a4 + .word 0xda0bf57a + .word 0x0000be1e + .word 0x81d6803f + .word 0xfffe31e7 + .word 0x0f5756e2 + .word 0xfffeabfe + .word 0x387913fb + .word 0xffff8aa8 + .word 0x870e6023 + .word 0x00031d7e + .word 0x89997aee + .word 0x0000bbc2 + .word 0x2d9e65ef + .word 0x000298e2 + .word 0x5fdbc63a + .word 0x00013aaa + .word 0x7cafd4c6 + .word 0xfffeb78e + .word 0x97e0a8b9 + .word 0x0003572a + .word 0x635f6bc9 + .word 0xfffd46bc + .word 0x12f8a9d6 + .word 0x00007f1c + .word 0xdb75e336 + .word 0x00020d91 + .word 0x119718fa + .word 0xfffd0e24 + .word 0xf94466c4 + .word 0x0002da77 + .word 0x29e82812 + .word 0x00001cb1 + .word 0x2d7e9ff4 + .word 0xfffed0fb + .word 0x6763621a + .word 0xfffc9d50 + .word 0x1651c4b5 + .word 0xffffaf40 + .word 0xe50222a0 + .word 0x0002ad55 + .word 0x0d2bcafe + .word 0x000094d5 + .word 0xd46e3e39 + .word 0x00017ccc + .word 0x98fbd349 + .word 0x0000c6fb + .word 0xa5a7c900 + .word 0xfffe7b09 + .word 0xec7478e4 + .word 0xfffe77fb + .word 0xab2f1ee6 + .word 0xfffd309e + .word 0xf88bd35a + .word 0x0001c693 + .word 0xcee951b7 + .word 0x0000d0e9 + .word 0xfb291ee8 + .word 0xfffc82f1 + .word 0xbe55aff5 + .word 0xffff739c + .word 0x336211c2 + .word 0x00029265 + .word 0xdef41c85 + .word 0x0000c9ca + .word 0x942de95a + .word 0x00030ddd + .word 0x403af38f + .word 0xfffd484a + .word 0x06b244ae + .word 0x0003e42b + .word 0x408e6fa1 + .word 0x00037ea7 + .word 0xa639bdc6 + .word 0xffff4c87 + .word 0x04d34c8c + .word 0x000231c7 + .word 0xbdedc530 + .word 0xfffd5522 + .word 0xca7fca9f + .word 0xfffd2c1f + .word 0x128790b7 + .word 0xfffc1eb1 + .word 0x3250b072 + .word 0x000341b4 + .word 0xb29ce885 + .word 0xfffc1036 + .word 0x9ec576fd + .word 0x0000952f + .word 0x889d4e5c + .word 0xfffc2c19 + .word 0x2ebd5195 + .word 0xffff9873 + .word 0xc66c16da + .word 0xfffda805 + .word 0x744eb462 + .word 0x00036990 + .word 0x4f7e3a93 + .word 0x0003406c + .word 0xf7595967 + .word 0xffffcfd8 + .word 0xa996521b + .word 0xfffcce10 + .word 0xbd7db757 + .word 0x00018c07 + .word 0x1efc636f + .word 0x0000e0fe + .word 0x89f0ce3f + .word 0x0002686c + .word 0x851cc09a + .word 0x00036f54 + .word 0x95287d1f + .word 0xffffe61d + .word 0x57f5cfd2 + .word 0xfffe4930 + .word 0xbf7a1f2a + .word 0x00004609 + .word 0x4395117d + .word 0xffff3038 + .word 0x4dc78f0d + .word 0x00028704 + .word 0x7020c6ee + .word 0xfffc2063 + .word 0x590dd207 + .word 0xfffd8b34 + .word 0x511ad034 + .word 0xfffdccdb + .word 0xfe8a66b3 + .word 0x0003f933 + .word 0x3de72d02 + .word 0xfffe7675 + .word 0x349ebada + .word 0x00019c52 + .word 0xd7c0680c + .word 0x00030c12 + .word 0x6f816938 + .word 0xfffdf248 + .word 0x4feea8d0 + .word 0xfffdbffe + .word 0x869d8441 + .word 0xfffdb162 + .word 0x94da6e81 + .word 0x00000a66 + .word 0x74ef2771 + .word 0xfffc5897 + .word 0x0ba4c65b + .word 0xfffc9829 + .word 0x61325c96 + .word 0x00012852 + .word 0xdc71d6ae + .word 0x00006b6d + .word 0xae909cb6 + .word 0x0001d1f8 + .word 0xbd9f85b3 + .word 0xfffecfcb + .word 0x0b6a00ac + .word 0xffff92e1 + .word 0x5976037f + .word 0x0002b6d3 + .word 0xef553c0b + .word 0x0003cc4a + .word 0x4f7fc12a + .word 0xfffea1a7 + .word 0xef6ca57f + .word 0x0003d9a2 + .word 0xd111bd42 + .word 0x00027e37 + .word 0xa2498cbc + .word 0x0000b531 + .word 0x45de3c44 + .word 0x0001868d + .word 0x5ad055ba + .word 0x0003a1c5 + .word 0x1d35c607 + .word 0xfffdf95f + .word 0xee85916f + .word 0x00018a64 + .word 0xa7886baa + .word 0xfffcc615 + .word 0x33f7fafd + .word 0xfffe55ba + .word 0x1fedac40 + .word 0x00028288 + .word 0x639878a7 + .word 0xffff40a0 + .word 0x89731827 + .word 0x00027077 + .word 0x2e3d6650 + .word 0xfffdd7d8 + .word 0xc249e24c + .word 0x000039e3 + .word 0xaef0dc0f + .word 0xffff236a + .word 0x9c723c5c + .word 0x0002e431 + .word 0x83fce46b + .word 0x0001c56c + .word 0xc16ecc89 + .word 0xfffc2948 + .word 0xe9175516 + .word 0x000015c6 + .word 0x8a60b45d + .word 0xfffdc413 + .word 0x315b62df + .word 0x00017d3f + .word 0x7c9e43af + .word 0xfffcd280 + .word 0x59c30bc0 + .word 0xfffee2ef + .word 0x113abf5b + .word 0x00030e5c + .word 0x46d0998d + .word 0xffff2841 + .word 0x50993db3 + .word 0x00004c05 + .word 0x51a6131d + .word 0xfffd8964 + .word 0x0cce4d55 + .word 0xfffed2ed + .word 0xd90085e9 + .word 0xfffdb2d1 + .word 0x95c5770b + .word 0xffff8079 + .word 0x3b9ea2f0 + .word 0x0001d6b0 + .word 0x63cc77f6 + .word 0x0000f05d + .word 0x318a67c1 + .word 0x000160e9 + .word 0xa227023e + .word 0x000299fa + .word 0xe5794d8c + .word 0xfffc03b1 + .word 0xe9bd89b2 + .word 0x00029373 + .word 0x1dee05a6 + .word 0xfffd5ef5 + .word 0xe894edb3 + .word 0xfffda84d + .word 0xabe9e4d1 + .word 0xfffc5289 + .word 0x053f04dc + .word 0x0001bd82 + .word 0xa4e7cf5a + .word 0x0002dba9 + .word 0xc78cce9e + .word 0x00023553 + .word 0xca8c56bd + .word 0xfffc6598 + .word 0x9c6a9c42 + .word 0xfffdc5a7 + .word 0xc4c892a7 + .word 0x0000be23 + .word 0x35979940 + .word 0xfffd1729 + .word 0xe1c209ec + .word 0xfffd7418 + .word 0xe46a96ec + .word 0x00039091 + .word 0xcd886664 + .word 0xfffd1040 + .word 0x35d7b25c + .word 0x00039c27 + .word 0x5538d228 + .word 0x0003be37 + .word 0xc7c3aee5 + .word 0xfffc6a61 + .word 0x237f6870 + .word 0x00035eb7 + .word 0x255d7107 + .word 0xffff13fe + .word 0xbdaaac67 + .word 0xfffc7fbe + .word 0x8dd6e857 + .word 0xfffceba5 + .word 0xda500fec + .word 0x00014138 + .word 0xa3a4dd85 + .word 0xffffe104 + .word 0x9fe93188 + .word 0x0003a110 + .word 0xa98e5729 + .word 0xfffd80be + .word 0x88ac58ae + .word 0xffffbdd9 + .word 0xb0030aa9 + .word 0x00005809 + .word 0x9ea853a0 + .word 0xfffe3655 + .word 0xfb5a31eb + .word 0xfffde126 + .word 0x81121e6c + .word 0x000025d6 + .word 0x322247cd + .word 0x0000a1f2 + .word 0xb8faf84d + .word 0x0001a09f + .word 0x1fc4e528 + .word 0x0000b543 + .word 0x7f7e3b19 + .word 0xffffbee3 + .word 0xbc9d160d + .word 0x00022207 + .word 0xbf31dcc7 + .word 0xfffcca75 + .word 0x59d7d6eb + .word 0x0000a8dd + .word 0xec1ed71c + .word 0x00017b4b + .word 0x25fe24e5 + .word 0x00018482 + .word 0xc77766f7 + .word 0xfffc0139 + .word 0xcedfa98c + .word 0x0001290b + .word 0x99038de8 + .word 0x0003b4a2 + .word 0x94bd99a1 + .word 0xfffd87d2 + .word 0xfe74a116 + .word 0xfffcd250 + .word 0x318ded29 + .word 0xfffd3497 + .word 0x09d6da4e + .word 0x0000cc27 + .word 0xed612e0d + .word 0x00018b12 + .word 0x8964431e + .word 0x00038e3d + .word 0x078105ac + .word 0x0002a75f + .word 0xfb7fea6a + .word 0xfffe654b + .word 0xe37cb9d7 + .word 0x00001ecc + .word 0x56051538 + .word 0x00018d7a + .word 0x88cb72a4 + .word 0x0001c7a2 + .word 0x55610bb9 + .word 0x000074ec + .word 0xd11ecf61 + .word 0xfffde5d1 + .word 0x360c6aa0 + .word 0xfffe4a75 + .word 0x5c9517cc + .word 0x00006484 + .word 0x121a221a + .word 0x000333c4 + .word 0xc6e17501 + .word 0x0002903e + .word 0x04521868 + .word 0x000311e0 + .word 0xf8af3665 + .word 0xfffdfac7 + .word 0xd0d18850 + .word 0x0000cd1d + .word 0x088f0409 + .word 0x00007807 + .word 0x8a328ebf + .word 0xfffc46aa + .word 0xf883edef + .word 0x000063ef + .word 0x360e105f + .word 0xfffff000 + .word 0xd7c73fe2 + .word 0xffffaba3 + .word 0x91031f67 + .word 0xffff3a8b + .word 0x09ca51ca + .word 0x00027d88 + .word 0x10907e15 + .word 0xffff322c + .word 0xf5729532 + .word 0xffffb8ba + .word 0x10b46902 + .word 0xfffc4753 + .word 0xfe2bb75b + .word 0xfffde604 + .word 0x57b621d7 + .word 0x00010f5c + .word 0x26f8eddf + .word 0x00018c2d + .word 0x1c239b22 + .word 0xfffda55a + .word 0xc21833da + .word 0x00004cd1 + .word 0xfce72eac + .word 0xfffcf314 + .word 0x187ef69c + .word 0xffffb81e + .word 0x3fc4cdc3 + .word 0xfffc7a3d + .word 0x7a9e6b40 + .word 0x000389aa + .word 0x97de5c71 + .word 0x000014e5 + .word 0xa22986fb + .word 0x00008323 + .word 0xadf49d61 + .word 0x0000e648 + .word 0x9dd47e2b + .word 0x0003d93e + .word 0xb7e927a2 + .word 0xfffe98a8 + .word 0x7f001702 + .word 0xfffefd17 + .word 0x4cdaedc3 + .word 0xfffd2416 + .word 0x1830289f + .word 0xfffcb134 + .word 0xcf7a050e + .word 0xfffd809b + .word 0xda253627 + .word 0xffffe560 + .word 0xc25e79de + .word 0xffff064b + .word 0x02d18dcb + .word 0xfffc5713 + .word 0x767295c5 + .word 0xfffe8ee5 + .word 0xd493c71b + .word 0xfffc418f + .word 0x0174d520 + .word 0x00016b79 + .word 0x47aeb480 + .word 0xfffc37a6 + .word 0xe8cea9c8 + .word 0xfffeee45 + .word 0x3d5db4e1 + .word 0xfffcd491 + .word 0x02d72ffd + .word 0xfffc7a38 + .word 0x17ea0709 + .word 0x0001ed6b + .word 0x6819b403 + .word 0x00037000 + .word 0x8f3df29e + .word 0x00037f15 + .word 0x321a0f93 + .word 0xfffcb7dd + .word 0x841b0bf7 + .word 0xfffec427 + .word 0x030816fe + .word 0x00039e1f + .word 0x07f06f70 + .word 0xfffd2cb1 + .word 0xae4dc85f + .word 0xffff9a26 + .word 0x48f43fc1 + .word 0xfffda4ad + .word 0x52e74911 + .word 0x0003d8f3 + .word 0x489a0089 + .word 0xfffc9be7 + .word 0x3e04c18b + .word 0x000211ba + .word 0x488a6820 + .word 0x0000a9ed + .word 0xa36c9886 + .word 0x0001785b + .word 0xf28c5101 + .word 0xfffd946c + .word 0xb0bdbb96 + .word 0xfffe53cd + .word 0x14c9225f + .word 0x000199b2 + .word 0xb3ad37a8 + .word 0x0001d367 + .word 0xa14e368a + .word 0x00038b34 + .word 0x9efac245 + .word 0x0003e773 + .word 0xd9edc39a + .word 0xfffd2e51 + .word 0x2751f583 + .word 0x000152f6 + .word 0xb6203e8d + .word 0x0003a886 + .word 0xfeb8f3d1 + .word 0x00025498 + .word 0xa9565f7d + .word 0x0002eea8 + .word 0x3b89d5b3 + .word 0xffff7b9f + .word 0x85e595ad + .word 0xfffd2093 + .word 0xa6cd5a57 + .word 0x000130b6 + .word 0xc61c3765 + .word 0xfffd18b2 + .word 0xd30f9fb1 + .word 0x0003c16b + .word 0x8e646b2b + .word 0xfffc4bef + .word 0xc8c30272 + .word 0xfffed9b4 + .word 0x785faa21 + .word 0x0001996f + .word 0xfb54127d + .word 0x0002b89e + .word 0xeaf6bb3f + .word 0xfffe6107 + .word 0x36514f2d + .word 0x00022c5b + .word 0x49928522 + .word 0xfffda644 + .word 0xc239afe2 + .word 0x0001be1c + .word 0x876bace7 + .word 0xfffeb794 + .word 0x5021b6d3 + .word 0x0000ab72 + .word 0x4bdef385 + .word 0xffff35d4 + .word 0x79f0ed1c + .word 0x0001a4c4 + .word 0x604b8e01 + .word 0xfffe8042 + .word 0xc88a439a + .word 0x00008621 + .word 0x040192fa + .word 0xfffc80b9 + .word 0x11709fc0 + .word 0xfffc59df + .word 0xf308c53a + .word 0xfffd269b + .word 0xe1367961 + .word 0xfffc62e1 + .word 0x4c191386 + .word 0x000115ca + .word 0x5ec7061c + .word 0xffffc508 + .word 0x164c212e + .word 0xfffc9357 + .word 0xebaec0b0 + .word 0xfffea238 + .word 0x2d18429b + .word 0xfffea7c2 + .word 0x8bcbd13e + .word 0xffffa669 + .word 0x04b647d5 + .word 0xfffcb2e1 + .word 0x7754d515 + .word 0x0003f6ed + .word 0xbdac6b78 + .word 0x0003e6ff + .word 0xe3c2f2be + .word 0xffff79a6 + .word 0xba760bf7 + .word 0x00000e2d + .word 0xe108a115 + .word 0xffff30aa + .word 0xb42ff410 + .word 0x0003f938 + .word 0x00e8d803 + .word 0xffff9178 + .word 0x40693fd5 + .word 0x0000e9f0 + .word 0xd2a5be63 + .word 0xfffd10fa + .word 0x9b10104b + .word 0x0002eff4 + .word 0xeeb449ff + .word 0x0002d539 + .word 0x56e8c191 + .word 0xffff8479 + .word 0x6d3028aa + .word 0x0003121e + .word 0xc314ff54 + .word 0x0001b3b3 + .word 0x500a3aa1 + .word 0x00027a58 + .word 0x542367f0 + .word 0x000290b8 + .word 0x8846b72c + .word 0x0001c549 + .word 0x1de5c2ec + .word 0xffffd8cc + .word 0x67f8286b + .word 0x0003f32a + .word 0xd2ca8694 + .word 0x00006522 + .word 0x09ff0389 + .word 0x0000c0a9 + .word 0xc6c42d0c + .word 0x00018329 + .word 0xaf25c1c5 + .word 0x000103ec + .word 0x7e45fc5e + .word 0x00027899 + .word 0xad1be516 + .word 0xfffdb844 + .word 0xcf246c5c + .word 0x0001141b + .word 0x01209239 + .word 0xfffc8a9d + .word 0x9b4f48ce + .word 0xfffd7e28 + .word 0x8306466d + .word 0x000231d8 + .word 0x4bb34b53 + .word 0x00021e8f + .word 0xf84d08d8 + .word 0xfffda36a + .word 0x5a697179 + .word 0xfffe33d8 + .word 0x87164e96 + .word 0x0002d594 + .word 0x472c9313 + .word 0xffffd9a6 + .word 0xb38a96b7 + .word 0xfffcb96d + .word 0x57a51508 + .word 0xffffd7af + .word 0x30b40b3f + .word 0xfffdab33 + .word 0x7bcf9b1d + .word 0x00019ced + .word 0xd2e91ff8 + .word 0xffffe25b + .word 0x8ca367f7 + .word 0xfffe2158 + .word 0xbbb2d822 + .word 0x0001cc53 + .word 0xe6e1a7ce + .word 0x0003f049 + .word 0xe846a928 + .word 0xfffc0328 + .word 0x69a45617 + .word 0xfffea16b + .word 0xc6efa13c + .word 0x0002fdd5 + .word 0x3915b345 + .word 0xfffcaf95 + .word 0xdfc043d8 + .word 0x000071be + .word 0x815c9574 + .word 0x00013980 + .word 0x0b663f33 + .word 0x0002a973 + .word 0xb9c97383 + .word 0x0002748c + .word 0x619c02eb + .word 0xffffa962 + .word 0x52b4e666 + .word 0x0000acf6 + .word 0x749fffc5 + .word 0x00008526 + .word 0x126f02d9 + .word 0x00028aba + .word 0xab61b95d + .word 0x00038208 + .word 0x5154eb43 + .word 0xffffa6af + .word 0x874d6865 + .word 0x00015b6d + .word 0x445943cb + .word 0x00011887 + .word 0xfda2fcc1 + .word 0xffff0964 + .word 0xa3f5a96f + .word 0xfffeb599 + .word 0xbec511a4 + .word 0xfffef33d + .word 0x76eca757 + .word 0x00036300 + .word 0xdbbe7428 + .word 0x0003643d + .word 0xdea91188 + .word 0xffffb6a8 + .word 0x39e2cdd1 + .word 0x00000578 + .word 0x5aa32b75 + .word 0xfffdeba1 + .word 0x2d0c5468 + .word 0x00008624 + .word 0xd453d70a + .word 0xfffc7d2f + .word 0x4ae471e2 + .word 0xfffed34a + .word 0x09e9f180 + .word 0x0002b46f + .word 0xefb49639 + .word 0xfffdc355 + .word 0x1aa4da9a + .word 0x00010870 + .word 0x86428c4f + .word 0xfffcf485 + .word 0xfcc83313 + .word 0x0000b7e5 + .word 0xa40ac8a8 + .word 0xfffca8b7 + .word 0x11d82b83 + .word 0xfffc6dbe + .word 0x4ab74ad6 + .word 0xfffc7bc0 + .word 0xe8a6a673 + .word 0xfffeeb23 + .word 0xe7a2c3c5 + .word 0xfffeeec4 + .word 0x1666fabc + .word 0x0002eaf6 + .word 0x368de80b + .word 0x000013e0 + .word 0x5523eafe + .word 0x0002e22d + .word 0x8d439eff + .word 0x000058d0 + .word 0x803dfc63 + .word 0xfffc37e1 + .word 0x8bb39de9 + .word 0x0001cfa5 + .word 0x0d6a96ed + .word 0x00012b90 + .word 0x9e8d88e2 + .word 0xfffe21a4 + .word 0x80de75d2 + .word 0xfffe418c + .word 0xfab312c9 + .word 0xfffd7f81 + .word 0x57141624 + .word 0xfffc1b80 + .word 0x0db8dd6a + .word 0x00005fe2 + .word 0x398211db + .word 0x000070b5 + .word 0x4322e4d2 + .word 0xfffcdd9e + .word 0xc231e32f + .word 0x0000bac3 + .word 0x85ba0acc + .word 0x0000c244 + .word 0x181a63e6 + .word 0xfffd892a + .word 0x62f30007 + .word 0xfffe93ee + .word 0x7d91a1ae + .word 0x00018878 + .word 0x477ce4e5 + .word 0xfffda46b + .word 0x08c96159 + .word 0x0003d858 + .word 0x0d707c84 + .word 0x00000073 + .word 0xe69a87df + .word 0xfffce6a4 + .word 0x75f88db0 + .word 0x0001ac57 + .word 0x0211a027 + .word 0xfffcf0df + .word 0x2bee8f3c + .word 0xffffc53a + .word 0x2a29f518 + .word 0x00034b4e + .word 0xe3f10f88 + .word 0x0000556d + .word 0x0be099cd + .word 0xfffd8ee7 + .word 0x34607c3c + .word 0x00005d25 + .word 0x890f2b41 + .word 0x0002e894 + .word 0x993f7cd4 + .word 0x0002bda8 + .word 0x01a248ce + .word 0xfffe34e4 + .word 0x98861e57 + .word 0x00027674 + .word 0x56283f82 + .word 0x0003f3c5 + .word 0x62d01621 + .word 0x000236c9 + .word 0xbe22e9c3 + .word 0xfffce3bc + .word 0x1cb545a3 + .word 0x0002f37c + .word 0x368dc479 + .word 0x0002e90b + .word 0x6c7526c4 + .word 0x0003609c + .word 0xe729f6d5 + .word 0xffff5ab3 + .word 0x34ff6d7e + .word 0x0003091b + .word 0x8bf2c2c0 + .word 0x00000f89 + .word 0x207ba90b + .word 0x00031eb4 + .word 0x6c6cdbf8 + .word 0x00005cdc + .word 0xb01447a5 + .word 0x00025b97 + .word 0xf44ae397 + .word 0x00025628 + .word 0x2c156786 + .word 0x0002b04d + .word 0x441cf577 + .word 0x000243c9 + .word 0xaf8bfaa8 + .word 0xffffc7c0 + .word 0x6b0e3c9c + .word 0x000364e1 + .word 0x9fb3291a + .word 0xfffe9250 + .word 0x5019371d + .word 0x000162dd + .word 0x2caf063c + .word 0xfffffa16 + .word 0x10c70b4b + .word 0xfffef81e + .word 0x68d4cb04 + .word 0xfffd37d2 + .word 0xb13ba437 + .word 0x0001ef7b + .word 0x260e2c72 + .word 0x0002077b + .word 0x86cec747 + .word 0x00029c90 + .word 0x4649a213 + .word 0xfffc9662 + .word 0x37a3aa39 + .word 0xfffec1c5 + .word 0xe8526149 + .word 0x000150c1 + .word 0x8295edc2 + .word 0xfffddace + .word 0x016f83bf + .word 0xfffdf0ee + .word 0xc0edc5a4 + .word 0x00025aec + .word 0x22ed0d63 + .word 0x00010239 + .word 0xa396fde0 + .word 0xffff417b + .word 0xa55e58df + .word 0x0003f0f3 + .word 0x483ee3b7 + .word 0xfffc8d2f + .word 0x2388b3b3 + .word 0x0000e958 + .word 0x35a450d8 + .word 0xfffd0814 + .word 0x798866f0 + .word 0x00001fcb + .word 0xd4efd7eb + .word 0x0002d561 + .word 0x9ce50239 + .word 0xfffd797f + .word 0x1f3b6dae + .word 0xfffded22 + .word 0x39e4f615 + .word 0xfffe6392 + .word 0x5b85203b + .word 0xfffef6c6 + .word 0xffcc52ca + .word 0x00021ef7 + .word 0xd435b9c2 + .word 0x0003ea0f + .word 0x005ad49e + .word 0xfffe5e6a + .word 0xe0d417e9 + .word 0x000142a1 + .word 0xcae9ae8d + .word 0xfffd7284 + .word 0x1660373a + .word 0x00035fa3 + .word 0xbeb5bde7 + .word 0x0001f0a6 + .word 0xf7c73b57 + .word 0xfffc45c5 + .word 0x4f613bbe + .word 0x00030b20 + .word 0x5e8ef632 + .word 0x0003d0ec + .word 0x4379327a + .word 0xfffd223b + .word 0xdafc1802 + .word 0xfffe2dbb + .word 0xeec40491 + .word 0x0001d3c6 + .word 0xb4f9f11d + .word 0xfffd0eae + .word 0xe8a99f6f + .word 0xfffc07c1 + .word 0x8660ff09 + .word 0x00031625 + .word 0x6d9207c4 + .word 0x0003c24b + .word 0xc9cb0d92 + .word 0x0000ecde + .word 0x2ea6fbc3 + .word 0x0000718e + .word 0xe27fc9d9 + .word 0x00000a51 + .word 0x9c5ae3be + .word 0x0001a15b + .word 0xb22d08d6 + .word 0xfffc149f + .word 0x25d82f0f + .word 0x0000aaa6 + .word 0xf7a8d33d + .word 0xfffc31b9 + .word 0xd79fb2f8 + .word 0xffff3dd1 + .word 0xfdd751da + .word 0xfffd4a84 + .word 0x1e499ae2 + .word 0x00029417 + .word 0x9696e147 + .word 0xfffc7b7e + .word 0x78aae963 + .word 0xfffca83d + .word 0x65590817 + .word 0xfffd4866 + .word 0x549866a2 + .word 0x000263b5 + .word 0xb3de293e + .word 0xfffe4ed7 + .word 0x8f8cae78 + .word 0xffff8b77 + .word 0x9d76851d + .word 0xfffd833c + .word 0x9a430762 + .word 0xfffd6726 + .word 0xc890b47a + .word 0x000195c9 + .word 0x6ce25ee3 + .word 0x00018950 + .word 0x62b068ac + .word 0xfffc20f8 + .word 0x61f3c483 + .word 0x0000b13e + .word 0xa55f7d59 + .word 0x00016d9d + .word 0xb24da8b5 + .word 0x0003a7de + .word 0x39984e18 + .word 0xffffebf4 + .word 0xd5b39ff1 + .word 0xfffc0cbb + .word 0xaaebe4b2 + .word 0x00036deb + .word 0x68a1bb1d + .word 0x0001c879 + .word 0x88fa4fce + .word 0xfffccf58 + .word 0x7a923aab + .word 0xfffd983b + .word 0x8b6b3cab + .word 0xfffdfa67 + .word 0x8d894bef + .word 0xffffa577 + .word 0x18b0ce07 + .word 0xffffa04d + .word 0xba86a16f + .word 0x0003e32e + .word 0x4387c504 + .word 0xfffc38a2 + .word 0xe97d38ae + .word 0x0000b81b + .word 0xb2cc40fa + .word 0xfffefb8d + .word 0x5f304a88 + .word 0xfffdafd1 + .word 0x16986450 + .word 0xfffe7bce + .word 0xec1cbc8b + .word 0x00015dc9 + .word 0xb20b9669 + .word 0xfffff577 + .word 0xcc1fe4ca + .word 0x0003b40a + .word 0xc1b92ace + .word 0xfffdcfbc + .word 0x4b39ddd4 + .word 0x0002d325 + .word 0x3add57d8 + .word 0xfffed38b + .word 0xd2f9fd28 + .word 0x0001565c + .word 0xdb24b7cd + .word 0x00027eac + .word 0xfbca2ce5 + .word 0x00025768 + .word 0x4faff05a + .word 0xfffc240e + .word 0xfaa42b26 + .word 0xfffc1efc + .word 0x2887a976 + .word 0x00016e29 + .word 0xa956ceae + .word 0x000191d1 + .word 0xe581477f + .word 0xffff3142 + .word 0x63f991ce + .word 0xfffc1ade + .word 0xd5f53d63 + .word 0xfffe7921 + .word 0x9d9fddcd + .word 0xfffd45b0 + .word 0x5105e02a + .word 0x0002cba1 + .word 0x2b62dd2a + .word 0xfffe6b79 + .word 0xe3f13d07 + .word 0xfffd8bdc + .word 0x9b95cde0 + .word 0xfffd0903 + .word 0x6bb94b0d + .word 0xfffca17b + .word 0x3e5746c2 + .word 0x00024cef + .word 0x49625c27 + .word 0xfffe74d6 + .word 0x62e27495 + .word 0xfffe19d9 + .word 0x325f14e9 + .word 0xfffebe66 + .word 0x1a0f1a6f + .word 0x0003cdc9 + .word 0xd6c83f9c + .word 0xfffc0d65 + .word 0x2d0ebfbd + .word 0x0001d0d1 + .word 0x8af66392 + .word 0xfffdb5b7 + .word 0xa2c43901 + .word 0xfffd5b78 + .word 0xacd33187 + .word 0x000031c1 + .word 0xb6a8778c + .word 0xfffd77dc + .word 0x6dd45786 + .word 0xfffcfba5 + .word 0xcbe4bbe2 + .word 0x00021116 + .word 0x13e98f10 + .word 0xffff46a8 + .word 0x7c0d2283 + .word 0x000277a7 + .word 0x7edaf8da + .word 0xffffcae3 + .word 0xe117dbd4 + .word 0x0002ae91 + .word 0x5cab1756 + .word 0x0001e51f + .word 0x6d936565 + .word 0x0002be4a + .word 0xd12c8739 + .word 0xffff4b6b + .word 0x295bcc80 + .word 0x0002a8b0 + .word 0x695041c4 + .word 0xffff9acb + .word 0x717c4526 + .word 0x00026823 + .word 0x09c09dcb + .word 0xffff23b5 + .word 0xdbbfb918 + .word 0xfffee5ee + .word 0x7afca702 + .word 0xffffb5c8 + .word 0x4309c895 + .word 0xfffde89f + .word 0xa11082c3 + .word 0xfffeb50b + .word 0x75358bda + .word 0xfffd958f + .word 0x9ac0bbb0 + .word 0xfffc8b84 + .word 0x149c1579 + .word 0x0003ee5f + .word 0xa4b3f1f6 + .word 0x000157aa + .word 0x47ea71b3 + .word 0xffff0837 + .word 0x4da0831a + .word 0x000360d0 + .word 0x633482e8 + .word 0xffff68e0 + .word 0xcf6fca0c + .word 0x0001c933 + .word 0x0e9e5af1 + .word 0x00032f46 + .word 0x53a16fb1 + .word 0xfffde3da + .word 0xdc5f3b9a + .word 0xfffc6916 + .word 0x0b416b5b + .word 0xfffdf2c0 + .word 0x10126875 + .word 0x00017e8f + .word 0x8aecde02 + .word 0xfffd2ad6 + .word 0x6915581a + .word 0xffff571e + .word 0xbe93904a + .word 0x000255f0 + .word 0x09692a0f + .word 0xfffd3e08 + .word 0x68de31c7 + .word 0xfffc6a5c + .word 0x0076ffe9 + .word 0xfffe50c9 + .word 0x42153fb9 + .word 0xfffc9e76 + .word 0x6072281c + .word 0x0002a5c3 + .word 0x4284db4d + .word 0x00021f8e + .word 0x0bc265d1 + .word 0x0002578c + .word 0xfce4f5fc + .word 0xfffd3089 + .word 0x108dd8b5 + .word 0x000067cb + .word 0x426d6d69 + .word 0xfffcdb72 + .word 0xdabffcfc + .word 0xfffca526 + .word 0x55a41287 + .word 0xfffedcde + .word 0x53fe0bbe + .word 0x00012aa0 + .word 0xf0cf0f89 + .word 0x00023cbf + .word 0xbded05a0 + .word 0xffff5b78 + .word 0x60c6b510 + .word 0xfffcea94 + .word 0x2671860b + .word 0x0003ec6f + .word 0x5a2a7d0d + .word 0xfffe1da8 + .word 0xa5babbeb + .word 0x0001509a + .word 0x44c0ea6f + .word 0xfffe3614 + .word 0x0917337e + .word 0x0001350d + .word 0x77f86b7d + .word 0xfffcef6a + .word 0x2e34d625 + .word 0x0002fae8 + .word 0xa95569e8 + .word 0x000178f8 + .word 0x4d661bfb + .word 0x00005671 + .word 0x79271c59 + .word 0x0000a283 + .word 0xb597ba88 + .word 0xfffd6f76 + .word 0x40b96275 + .word 0xffffe2db + .word 0xfdbac17f + .word 0x0003466b + .word 0xd9eae945 + .word 0x0000ac1c + .word 0xf7515109 + .word 0xfffe84e0 + .word 0xa408bb37 + .word 0xffffc9b5 + .word 0xbf18f0c8 + .word 0xfffd1d48 + .word 0xa7f12693 + .word 0xfffcb837 + .word 0x8ec182b6 + .word 0x00001997 + .word 0xef69318c + .word 0x00023a71 + .word 0x10e38793 + .word 0xfffff1fe + .word 0x4e465f80 + .word 0x0002d4e9 + .word 0x6bbac3b2 + .word 0xfffd353c + .word 0x0b5cef92 + .word 0xfffe8f98 + .word 0xe30d590c + .word 0x0000e04b + .word 0xbbe92613 + .word 0x000308b7 + .word 0xa82f427d + .word 0x00026988 + .word 0xc495c476 + .word 0x0002eb39 + .word 0x1ede174f + .word 0xffff3c86 + .word 0x9071b45a + .word 0xfffc092a + .word 0xd2487de0 + .word 0x0002e1ad + .word 0x6ca029c6 + .word 0xffffbdd3 + .word 0x286dbc4a + .word 0x0000448d + .word 0x98b55be2 + .word 0xfffdc394 + .word 0x40758805 + .word 0xfffdffb1 + .word 0x844cd83a + .word 0xfffd68d1 + .word 0x4f1e8a87 + .word 0x00036cc6 + .word 0x60387345 + .word 0x0002d146 + .word 0x6159ef62 + .word 0xffff0b93 + .word 0x1aa4f4c9 + .word 0xfffd9dc2 + .word 0x79a24375 + .word 0x000020a7 + .word 0x46c3bf98 + .word 0xffffb94f + .word 0x8e9003da + .word 0xfffc312c + .word 0xb3971fe3 + .word 0x000119fb + .word 0x3985b913 + .word 0x00015293 + .word 0x7b677b5b + .word 0x00023fd5 + .word 0x0c937c87 + .word 0x000072be + .word 0x14db9ccc + .word 0x0000065b + .word 0x28e6399f + .word 0x00029397 + .word 0xf3963398 + .word 0x0002f7a4 + .word 0x841ae603 + .word 0x0003a310 + .word 0x33f74c29 + .word 0x00008c67 + .word 0xc59e3d04 + .word 0x00038216 + .word 0x5c363bc9 + .word 0xffffee01 + .word 0x3482675a + .word 0xfffd3f0c + .word 0xc86f8cc3 + .word 0x0000e21f + .word 0xd9122d98 + .word 0x0000973b + .word 0xd00a602e + .word 0xffff902f + .word 0x346d2fcd + .word 0xfffcbce2 + .word 0x7dd19548 + .word 0x0003d622 + .word 0x5ccfe42e + .word 0xfffdaac4 + .word 0xad53a80e + .word 0x0000a9a2 + .word 0x49c3ebfa + .word 0x000122c3 + .word 0x636b410e + .word 0x00007843 + .word 0x9f310b3c + .word 0x0003b6c8 + .word 0x9355c9f8 + .word 0xfffe5b20 + .word 0x3291eae1 + .word 0xfffe1f69 + .word 0x8e719e70 + .word 0xffff44de + .word 0x138649bb + .word 0xfffc36ba + .word 0x6281c242 + .word 0xfffcabbf + .word 0xc9feef7c + .word 0x0003d728 + .word 0x5c773a7f + .word 0xffff5ba4 + .word 0xd23c9212 + .word 0x00010ae7 + .word 0x41db4d1c + .word 0xfffdbc05 + .word 0x5ef4e434 + .word 0x0001f247 + .word 0xad07acb1 + .word 0x00023940 + .word 0xab73af2b + .word 0x00014ae2 + .word 0x59430039 + .word 0x00021529 + .word 0x29c9ef1a + .word 0x0001c963 + .word 0x72b97aa7 + .word 0x00023781 + .word 0x6b9d016b + .word 0x0003c1bd + .word 0x357e0099 + .word 0x00000097 + .word 0x4674505f + .word 0xffff6378 + .word 0xc8920930 + .word 0xfffd8c8f + .word 0xdeeeb7d1 + .word 0xfffc6b5f + .word 0xad2902a0 + .word 0xfffcf6e2 + .word 0x41db321e + .word 0x00001413 + .word 0x4db411fd + .word 0xfffc0a09 + .word 0xf02a5bdf + .word 0xfffd8171 + .word 0x5d4ae6ec + .word 0xffff8e18 + .word 0x2415f4fe + .word 0xfffc41a5 + .word 0x44bfe82e + .word 0xfffc91d0 + .word 0x99834db5 + .word 0x0001f7d2 + .word 0x16b94679 + .word 0xfffe3a11 + .word 0xf3debf0e + .word 0x0003e62f + .word 0xbdb2f7ac + .word 0x0002612e + .word 0xeb684863 + .word 0x00033792 + .word 0x5d0a146d + .word 0x00006490 + .word 0xa59c3aba + .word 0xfffc57e4 + .word 0xf85b696f + .word 0xfffc82cb + .word 0xaacee04f + .word 0x00004264 + .word 0x045d3180 + .word 0x000325a8 + .word 0x3be15fac + .word 0xfffc8d46 + .word 0xcfd4cc93 + .word 0xffff1f24 + .word 0xf54c7f7b + .word 0x0002c96e + .word 0x0290fbd5 + .word 0x00014257 + .word 0x7e2fbe71 + .word 0x00036977 + .word 0x75a32cea + .word 0x000300f1 + .word 0xc0e8d3ce + .word 0x00037ceb + .word 0xf7304b2f + .word 0x0000b0fd + .word 0x981bcc26 + .word 0xffff5b28 + .word 0x52dd4653 + .word 0x00039ec8 + .word 0x678bd92b + .word 0xfffe463a + .word 0xcd07b522 + .word 0x00001e27 + .word 0x59b6c0c4 + .word 0x00021b71 + .word 0x1681d6ed + .word 0xfffca8ce + .word 0xb290e48d + .word 0x000365e8 + .word 0x58e21027 + .word 0x00002a53 + .word 0xbb9f5c56 + .word 0x0002bfdb + .word 0x56b7d738 + .word 0xffff35fd + .word 0x90d092e1 + .word 0xfffd8329 + .word 0x8fdcef41 + .word 0x000187ab + .word 0x5575e9ea + .word 0x0003fdb9 + .word 0x88d32d19 + .word 0x00019886 + .word 0xc7ee2c77 + .word 0x0001a621 + .word 0x91cf31b3 + .word 0xfffda5f0 + .word 0xec483e1c + .word 0x00007689 + .word 0x01763a76 + .word 0xfffcfe39 + .word 0x47505517 + .word 0x000331b2 + .word 0xe90fe4be + .word 0xfffeb62a + .word 0x978ecc55 + .word 0xffff183e + .word 0xe7cb9bbd + .word 0xfffce13c + .word 0x20786933 + .word 0x0002ac2f + .word 0x7425d3f8 + .word 0x0003a83b + .word 0xf639ed82 + .word 0x0003ce36 + .word 0x6e3c72b0 + .word 0x0002f26f + .word 0x3c2edb9f + .word 0x00023dd9 + .word 0x0187aa1b + .word 0x00035c23 + .word 0xe325c9d2 + .word 0xfffeef11 + .word 0x4e7c7455 + .word 0xfffe93f0 + .word 0x0af23ab5 + .word 0x0003ec95 + .word 0x2278edc9 + .word 0x00004df0 + .word 0xd3ae9e63 + .word 0x00025615 + .word 0x62824ec3 + .word 0x0003e1b7 + .word 0x93503470 + .word 0x00031713 + .word 0x1b496aed + .word 0xfffe7bb0 + .word 0xd5ff0b4f + .word 0xfffc1fe2 + .word 0xf5f8189e + .word 0xfffc8bb5 + .word 0x17de3699 + .word 0xffff2675 + .word 0x243844c0 + .word 0xffffc6cd + .word 0x36844394 + .word 0x0002446c + .word 0xb9d43019 + .word 0x0001a511 + .word 0x3a477822 + .word 0x0003fe6b + .word 0xa6a3de97 + .word 0x0003393f + .word 0x12d021d5 + .word 0xfffd25e5 + .word 0x03963306 + .word 0xfffde5da + .word 0x96f17472 + .word 0xffff537f + .word 0x44546c1a + .word 0xfffeb31e + .word 0xb2a46dc3 + .word 0x00000c3a + .word 0x095f11e5 + .word 0x0002cbe2 + .word 0x7408833e + .word 0x0001cf3c + .word 0xf5cc4d18 + .word 0x0003dea7 + .word 0x1666dd17 + .word 0x0000d021 + .word 0xea2a83fb + .word 0xffffda2c + .word 0x63f8daed + .word 0x00018446 + .word 0x34473080 + .word 0xffff803d + .word 0x8e1eb4b4 + .word 0x00002950 + .word 0x7a35ef59 + .word 0x00019d86 + .word 0xeac02cfc + .word 0xfffc6279 + .word 0x2f0a0eca + .word 0x00006657 + .word 0x79bdd25d + .word 0x00033928 + .word 0x456e98d2 + .word 0xfffe2071 + .word 0xec04360f + .word 0x00006c89 + .word 0x9360cf12 + .word 0xfffcdf26 + .word 0x55d76ec4 + .word 0xfffc4126 + .word 0x31c784b2 + .word 0x00018891 + .word 0xb6facf45 + .word 0x0002b5d5 + .word 0xf517cf2d + .word 0xfffdddd9 + .word 0xb7c9a245 + .word 0x00012e0b + .word 0x9424c0e3 + .word 0x0001d8f9 + .word 0x33e43bec + .word 0xffff0708 + .word 0xff65d85e + .word 0xffff3aa5 + .word 0x342407b3 + .word 0x0001c836 + .word 0x9a232071 + .word 0xfffee77c + .word 0xb20d9332 + .word 0xffff4c4f + .word 0x8ec5c79e + .word 0x000209f7 + .word 0x8ce42352 + .word 0x0000d65a + .word 0xda5f2500 + .word 0xfffe5666 + .word 0xa59593b2 + .word 0x0002b9a3 + .word 0x58c72bd8 + .word 0xfffdc330 + .word 0x84de418d + .word 0xfffc81a5 + .word 0xeaa7e3f8 + .word 0xffff1cf0 + .word 0x821d1067 + .word 0xfffe9f45 + .word 0x87be97f6 + .word 0xfffc0d59 + .word 0x58024e4f + .word 0xfffc4dd4 + .word 0x46985f26 + .word 0xfffe6b59 + .word 0xc6c850e9 + .word 0x00004f5d + .word 0x713c4420 + .word 0x0002bed7 + .word 0xf5423475 + .word 0xfffff8be + .word 0x86e290dd + .word 0xfffd8473 + .word 0xf3c4f140 + .word 0xfffdbd24 + .word 0x8e8a70cc + .word 0xfffc91c0 + .word 0x5569a3cf + .word 0xfffca8aa + .word 0xb362f4a9 + .word 0x00021da1 + .word 0xf5938185 + .word 0x00036649 + .word 0x1927fd78 + .word 0x00036cb5 + .word 0x2ccc83ca + .word 0x0000a8f4 + .word 0x574ae5db + .word 0x0001ca71 + .word 0x06a428be + .word 0xffff4802 + .word 0x21bded36 + .word 0x0003bac8 + .word 0xef5db71e + .word 0xfffed6c1 + .word 0xff377af7 + .word 0xfffe17bf + .word 0x83b8199c + .word 0xfffee38c + .word 0xf41e1994 + .word 0xfffe1d99 + .word 0x2530cc73 + .word 0x0002f323 + .word 0x0ae09952 + .word 0x00002cd9 + .word 0x57caa574 + .word 0xfffc795b + .word 0x62c51912 + .word 0xffff0f64 + .word 0xba95487b + .word 0x00020f54 + .word 0x664a3f87 + .word 0x00004637 + .word 0x447deb98 + .word 0xfffc7b7c + .word 0x408a0200 + .word 0x00034274 + .word 0xda326438 + .word 0xfffcae19 + .word 0x416377b9 + .word 0xfffe1076 + .word 0x8356a8c9 + .word 0xffffe267 + .word 0x3b42b24c + .word 0x0003e6f5 + .word 0x8d534d19 + .word 0x0002b019 + .word 0xf710b5cb + .word 0x00004f31 + .word 0x773c072c + .word 0xfffe70a8 + .word 0x19f457f4 + .word 0x00037b30 + .word 0x4952a811 + .word 0xfffc2ca2 + .word 0x1d72736d + .word 0xfffe2c8d + .word 0xc8855901 + .word 0xfffdc557 + .word 0xea11773a + .word 0xfffd6f93 + .word 0x7ca6102a + .word 0x0001cf78 + .word 0xada85998 + .word 0x0002cc51 + .word 0xb17c7b8c + .word 0xfffd8443 + .word 0x245237d5 + .word 0xfffc2eb5 + .word 0x02020708 + .word 0x00023b70 + .word 0x698da005 + .word 0x00008f3b + .word 0x8a0c32b5 + .word 0xffff47d5 + .word 0x831802f2 + .word 0x0003781c + .word 0xa3856d3a + .word 0xfffcc15b + .word 0x16a05343 + .word 0xfffc74d2 + .word 0x4027747d + .word 0x00006479 + .word 0x6c0a606f + .word 0x0002355f + .word 0xf2e89955 + .word 0x00018da5 + .word 0xb6c12015 + .word 0xfffcc4db + .word 0x8df25655 + .word 0x0000c026 + .word 0xb9b98bdc + .word 0x00034146 + .word 0xf2a28773 + .word 0x00035327 + .word 0x9cc3da5e + .word 0xffff7dc3 + .word 0x10d8ff72 + .word 0x0002df2e + .word 0xef3dbbd1 + .word 0x0001bf59 + .word 0x4e9d6ee4 + .word 0x0003c0f1 + .word 0x226e09af + .word 0xfffc4c4e + .word 0x534d7860 + .word 0xfffe2db8 + .word 0xed8c933b + .word 0x00014c9f + .word 0x2035efb4 + .word 0x000198f7 + .word 0x06aa6324 + .word 0xffff0a56 + .word 0xd1f39eca + .word 0xfffd4300 + .word 0x8ac7527d + .word 0x0003ad64 + .word 0x4cb43964 + .word 0x0002fae5 + .word 0x65079afc + .word 0x000044de + .word 0xe53a9c83 + .word 0x0003bd96 + .word 0x6acde411 + .word 0x00015feb + .word 0x3aa81318 + .word 0xffffa76d + .word 0x6480aaa6 + .word 0xfffc0878 + .word 0x4b348ce7 + .word 0x0003a39a + .word 0x1bbd05a7 + .word 0x0002a64c + .word 0x0de3d7a9 + .word 0xfffef062 + .word 0x77aad7a2 + .word 0x00027a5d + .word 0x8c13e5c6 + .word 0x00009832 + .word 0x26eafccb + .word 0x0002b3a2 + .word 0x459ed0e5 + .word 0x00032c40 + .word 0xc481e927 + .word 0xfffe66ac + .word 0xec290dae + .word 0xfffda804 + .word 0xfa5d6193 + .word 0xffff8679 + .word 0x3c635db4 + .word 0xffff1cbc + .word 0xc097bac9 + .word 0xffffac9f + .word 0xcaf91e3d + .word 0xfffd60c8 + .word 0x85576795 + .word 0x0003ef4b + .word 0xfc45d352 + .word 0xffff0151 + .word 0xb20fae98 + .word 0x0001f080 + .word 0x9cb5768a + .word 0xfffccb24 + .word 0x2e87c111 + .word 0xfffec744 + .word 0xfa53f0cc + .word 0x00014f37 + .word 0xf746f4b2 + .word 0xfffc5261 + .word 0x3dc79743 + .word 0xfffcd265 + .word 0xde7fe8db + .word 0xfffd6b29 + .word 0x90056067 + .word 0x00026222 + .word 0x77d537f5 + .word 0x0001155c + .word 0x4049ece0 + .word 0x0002bf5c + .word 0x19a215de + .word 0x0000a4e5 + .word 0xf766b2c0 + .word 0x00007e5c + .word 0x5a43a952 + .word 0x000374cd + .word 0x201f19a9 + .word 0xfffc785d + .word 0x6b07e2b4 + .word 0x000187d1 + .word 0xad280086 + .word 0x0002578b + .word 0x334c4bf3 + .word 0x0003c5ef + .word 0xe1daca29 + .word 0xfffefa10 + .word 0x93130bb4 + .word 0x00023a66 + .word 0xcdeeba9e + .word 0x0000f2b8 + .word 0xdf1a8009 + .word 0x00026662 + .word 0xc4bb78c6 + .word 0x000389c4 + .word 0x0678b202 + .word 0xfffcdf39 + .word 0x926ff77b + .word 0x0000dce0 + .word 0x56359ecf + .word 0xfffe1245 + .word 0x23207027 + .word 0xfffcef18 + .word 0x4dbedbc7 + .word 0xffff8e5f + .word 0x0cdc1df2 + .word 0xfffcd7a0 + .word 0x4d43ef05 + .word 0xfffe92a8 + .word 0xfe0b79aa + .word 0x00019a61 + .word 0x52ffc808 + .word 0xffff3f89 + .word 0x9f53d0b5 + .word 0xfffca9d5 + .word 0x8b0e7663 + .word 0xfffea3ce + .word 0x3c385914 + .word 0xfffd97eb + .word 0x44b03c14 + .word 0xfffd2d25 + .word 0x17509486 + .word 0xffff9ad5 + .word 0x8553a0cb + .word 0x0003c22f + .word 0xf95e95b7 + .word 0xfffe7ce5 + .word 0x5934c4ff + .word 0x00015f16 + .word 0xfffce8b2 + .word 0x00029298 + .word 0x433c2890 + .word 0xfffe96f3 + .word 0x18a355ec + .word 0x0002e50a + .word 0x2424322b + .word 0xfffea040 + .word 0xc90c2e89 + .word 0x000380d7 + .word 0xa6344bcb + .word 0xfffcb3ac + .word 0x41d1bdf0 + .word 0xfffc3265 + .word 0x6f59371f + .word 0x0000a6a3 + .word 0x4ecdb05c + .word 0x0000d159 + .word 0x453c60f4 + .word 0x00028205 + .word 0x3309e50d + .word 0xffff116c + .word 0xd99ba6a0 + .word 0xfffcee4a + .word 0x23f31951 + .word 0xfffc1a02 + .word 0x4cbf5f11 + .word 0xfffcd7ed + .word 0xf7f681cd + .word 0x000180e2 + .word 0x8406e893 + .word 0x0001defa + .word 0x3acad0d5 + .word 0xfffdfb2c + .word 0x35b54679 + .word 0xffffe200 + .word 0x5038a647 + .word 0xfffc7891 + .word 0xe7f22c01 + .word 0x0002a212 + .word 0x089c3a4a + .word 0x00024e89 + .word 0xf5b57161 + .word 0xfffeb525 + .word 0x3f69d9d6 + .word 0xfffc76bb + .word 0x4ebed238 + .word 0x00007d6e + .word 0x5be02885 + .word 0xfffd9d4a + .word 0xebb1d898 + .word 0xfffe9241 + .word 0x081ead95 + .word 0x0000e5ad + .word 0xf41ac3cc + .word 0x00020c68 + .word 0x96233be3 + .word 0xfffe21dc + .word 0x07b3a84e + .word 0xfffc60ff + .word 0x75ffbec1 + .word 0x00006ed1 + .word 0xab19d1f1 + .word 0x00025063 + .word 0x90b6c46e + .word 0xfffd2e89 + .word 0x0d626e8a + .word 0xfffef773 + .word 0x5d0adeb5 + .word 0xffffd5ea + .word 0xfa3f5576 + .word 0xffffb116 + .word 0xbf520230 + .word 0xffff636c + .word 0x25a82b78 + .word 0x00021252 + .word 0xf346711c + .word 0xfffee666 + .word 0xa09f21df + .word 0x00014ffc + .word 0x3d184a62 + .word 0xfffd8352 + .word 0x35cdf552 + .word 0x00032e21 + .word 0xac58c174 + .word 0x0003a205 + .word 0xd6b5523b + .word 0xffffd294 + .word 0x24144eb4 + .word 0xfffc0e86 + .word 0x4cdaf4a6 + .word 0xffffa3bb + .word 0x7cebe87a + .word 0xffff1207 + .word 0x12320853 + .word 0xfffe155c + .word 0xd655866b + .word 0x0002eb5b + .word 0x3e312d8f + .word 0xffff7094 + .word 0x11032284 + .word 0x0003734a + .word 0x419d90b2 + .word 0xfffc26b4 + .word 0xa6c62cbc + .word 0x0003deeb + .word 0xfd488ad2 + .word 0xfffe42fd + .word 0x0a4b6234 + .word 0xfffe84b7 + .word 0x1bd18916 + .word 0xfffdc764 + .word 0x52bd5f9f + .word 0x00009655 + .word 0x58f2e72c + .word 0xfffd81c3 + .word 0x86067e65 + .word 0xfffeb65e + .word 0xa0662f24 + .word 0xfffe5155 + .word 0x8e8a0b35 + .word 0x0002684f + .word 0x630fe261 + .word 0x0000ddaa + .word 0xe1f72dfe + .word 0xfffcbde3 + .word 0x23c14313 + .word 0x00012218 + .word 0xde536955 + .word 0x000212f4 + .word 0x6d00a1ff + .word 0xfffea31a + .word 0xd4bcf269 + .word 0x0001ab6d + .word 0xbfca7574 + .word 0xfffc461f + .word 0x16ae8985 + .word 0xfffe6083 + .word 0x4f07c143 + .word 0x000200ae + .word 0x495cf307 + .word 0x0002b14f + .word 0x757ee142 + .word 0x00000a57 + .word 0xa0ee4f5c + .word 0xffff79c8 + .word 0xb52b6dec + .word 0x0002d682 + .word 0x8056c47e + .word 0x00017cec + .word 0xb8306c81 + .word 0xfffd5b54 + .word 0x8c10403a + .word 0x0003280b + .word 0xcc92d75f + .word 0x000212cc + .word 0x14cedbd5 + .word 0xffffa14e + .word 0x15f91698 + .word 0x0002f537 + .word 0xa986ee27 + .word 0x0000e3c5 + .word 0x56e4d4cc + .word 0xfffe42a6 + .word 0x2c8fa5df + .word 0x000060fc + .word 0xd6826f29 + .word 0x0000da16 + .word 0xca26e991 + .word 0x00010f68 + .word 0xb413f0f3 + .word 0xfffd6dea + .word 0x373a4f44 + .word 0xfffd4610 + .word 0x64f7f109 + .word 0xfffc293c + .word 0x02787b8a + .word 0x00006f3d + .word 0x95cdb489 + .word 0x00022122 + .word 0x435a0d4f + .word 0x000381ae + .word 0xc6988b65 + .word 0xfffc0ec4 + .word 0x834b1ba5 + .word 0xfffcd016 + .word 0x523b85a9 + .word 0xfffe1c61 + .word 0x45b43670 + .word 0x000366cb + .word 0x0c516897 + .word 0x0000ad6a + .word 0x655080dd + .word 0x00032c25 + .word 0x3848c6de + .word 0x000280a5 + .word 0xa1cfc040 + .word 0x0002ce1f + .word 0x1d0fe10a + .word 0x0001b384 + .word 0x180c7c4b + .word 0xfffc42b4 + .word 0x09d1a9c7 + .word 0xfffd5724 + .word 0x52309a36 + .word 0xfffdf2c1 + .word 0x1e08cba9 + .word 0x0003e546 + .word 0xe9a370f6 + .word 0xfffc00ac + .word 0xd2c888e0 + .word 0xfffdb61a + .word 0x203f429b + .word 0xfffdbe39 + .word 0xdef59273 + .word 0xfffe7e47 + .word 0xd799d460 + .word 0xfffff912 + .word 0x30a180b3 + .word 0x0002e22d + .word 0xe39dabde + .word 0xfffe335b + .word 0xf7e44eb5 + .word 0x00013596 + .word 0xea4a2236 + .word 0xffff6b15 + .word 0x4e6abafd + .word 0xfffdfd79 + .word 0x45521f4d + .word 0x00037c0b + .word 0xdfc2fd94 + .word 0xffffdb27 + .word 0xf649f545 + .word 0xfffdec5c + .word 0x957bc607 + .word 0xfffecb48 + .word 0xf6fa9e4d + .word 0xffffe832 + .word 0xed6afdd5 + .word 0xffff7c5f + .word 0xe092a7e1 + .word 0xfffd9ceb + .word 0xa6b2cde6 + .word 0x0001efff + .word 0xdc6b5cef + .word 0xfffcd6c7 + .word 0x583deedf + .word 0x00034ca1 + .word 0xace8a910 + .word 0x00001782 + .word 0x2cf8bdef + .word 0xfffeedeb + .word 0xfc8edde6 + .word 0x00028a91 + .word 0x93f67b30 + .word 0x00014d0b + .word 0x1762569b + .word 0x0003c411 + .word 0xbed55885 + .word 0xfffcafa1 + .word 0x6b37d9e4 + .word 0x00020087 + .word 0xdb69027f + .word 0x00007d46 + .word 0xe08a52e5 + .word 0x0001ce92 + .word 0xd7e3eeff + .word 0x0000ef7e + .word 0x85689e86 + .word 0x0001197c + .word 0x767b5289 + .word 0xfffd31aa + .word 0x63d1fc96 + .word 0xfffc5650 + .word 0x4ec3ec64 + .word 0xfffe9f79 + .word 0xb2e8254f + .word 0xfffdbc15 + .word 0x6c11c02b + .word 0x000280e2 + .word 0x0455f339 + .word 0xffff841e + .word 0x546374a7 + .word 0xffffc482 + .word 0x256f03ed + .word 0xffff5723 + .word 0x12fd886b + .word 0xfffcdfd2 + .word 0x09228393 + .word 0x0003caef + .word 0x00f87365 + .word 0xfffe8dc8 + .word 0x73a29508 + .word 0x0003110f + .word 0xd94d29d2 + .word 0x0000d87b + .word 0x204aed80 + .word 0xfffc8e42 + .word 0x84622595 + .word 0x0000997b + .word 0x529c9e20 + .word 0x0002b448 + .word 0x5bc4f168 + .word 0x000235a4 + .word 0x09ede05b + .word 0xfffde109 + .word 0x365ae5dd + .word 0x0000050d + .word 0x85a6a151 + .word 0xfffc23cd + .word 0x55fe1719 + .word 0xfffc227b + .word 0xe3e59f76 + .word 0x0000347f + .word 0x89301065 + .word 0x0001333a + .word 0xa5ebc699 + .word 0xfffe94e4 + .word 0x7ad0651a + .word 0x00039b23 + .word 0x462c10c3 + .word 0x0000d2a5 + .word 0xcf637539 + .word 0x00032c9a + .word 0xc3330cc6 + .word 0xffff3f52 + .word 0x538171d3 + .word 0x0000fc78 + .word 0x08b05855 + .word 0x0002f70b + .word 0x99a9edb7 + .word 0x00007119 + .word 0xca70850a + .word 0xfffcb8c5 + .word 0xcc15f3cc + .word 0xffff406a + .word 0x3a1c14db + .word 0xfffcd605 + .word 0x16a750bf + .word 0x0000439b + .word 0x19996c24 + .word 0xfffe196e + .word 0x451386ef + .word 0x00029e79 + .word 0x8e552a57 + .word 0xfffe5563 + .word 0xc30fb309 + .word 0xffff8435 + .word 0x1ede8c70 + .word 0x00017b03 + .word 0x1a779d84 + .word 0x00000af6 + .word 0x6fc5e93c + .word 0x00010303 + .word 0x39052e5f + .word 0x00005744 + .word 0xe8f46f81 + .word 0xfffd7ab1 + .word 0x3e309c6f + .word 0xfffd643b + .word 0x2dd21326 + .word 0x0003d896 + .word 0x03418b6e + .word 0x0003eee1 + .word 0xad27d2f8 + .word 0x0003f694 + .word 0xd33d0300 + .word 0xffff67b9 + .word 0x168f4ad5 + .word 0x0002e350 + .word 0xdc0a513f + .word 0xfffcef1b + .word 0x8e92935c + .word 0x00022ab9 + .word 0x7fce0bb3 + .word 0x000240ee + .word 0x655f148e + .word 0xffff510e + .word 0x08bbe39c + .word 0xfffc7081 + .word 0x449bf04a + .word 0x000069df + .word 0xb5718512 + .word 0x0002984f + .word 0x301e8114 + .word 0xfffce61f + .word 0x637c86e8 + .word 0xfffdb989 + .word 0x0f0d1378 + .word 0xfffed92b + .word 0x0fbffd2b + .word 0xfffd6899 + .word 0x31b88153 + .word 0x0003eab9 + .word 0x0912e183 + .word 0x00033fee + .word 0xac4d9a32 + .word 0xffff939b + .word 0x6c4a9cb9 + .word 0x0002b5cd + .word 0xb0e58ffb + .word 0x00028749 + .word 0x9bd10345 + .word 0xfffc2dc7 + .word 0xd783963b + .word 0x0001f87b + .word 0x02a5c5c1 + .word 0x0002bbfa + .word 0x30784d68 + .word 0xfffcf001 + .word 0x1ae30784 + .word 0x00017fb6 + .word 0x0fda4b4d + .word 0x00034bab + .word 0xe36181b4 + .word 0x000293d6 + .word 0x7bb2aabb + .word 0x00006dba + .word 0x37e2439e + .word 0xfffd5531 + .word 0xf2b54520 + .word 0x000152c7 + .word 0xe816e802 + .word 0x0001eeee + .word 0x8c0c4e22 + .word 0x00000419 + .word 0xafaaa4bf + .word 0xfffde4d6 + .word 0xc54bcca3 + .word 0xfffc19c6 + .word 0x105c82aa + .word 0xfffc2d2a + .word 0x3c9773a6 + .word 0x0001c734 + .word 0xa4d0f7e0 + .word 0xffffa192 + .word 0xc35179b3 + .word 0xfffca6d4 + .word 0x4b4adfb4 + .word 0x00010438 + .word 0x1a9f6779 + .word 0xfffec9d1 + .word 0xa5ac0ba2 + .word 0xfffc8426 + .word 0x7474e3c4 + .word 0x0002c58a + .word 0x7d64f160 + .word 0x00027eb5 + .word 0xc4cbbd32 + .word 0x0000cb3f + .word 0xdf50b6b5 + .word 0xffffa40c + .word 0x1506e2fb + .word 0x00039e03 + .word 0x62911c05 + .word 0xfffda0bf + .word 0x971c721d + .word 0x0000ba49 + .word 0x8af5b53a + .word 0xfffcef60 + .word 0x7ae4d58a + .word 0xfffef0ce + .word 0x4ff4fa84 + .word 0xfffed9fd + .word 0x94274ea1 + .word 0x0000778f + .word 0xbcb937af + .word 0xfffeceea + .word 0xc5ca9cbc + .word 0x000034ba + .word 0x075e1d92 + .word 0x00008831 + .word 0xa43fbe6a + .word 0xfffd8b39 + .word 0x3caf1118 + .word 0x00020e5d + .word 0xfd86a254 + .word 0xfffde118 + .word 0xd357df99 + .word 0x0003d0f8 + .word 0x66ded498 + .word 0x00023d42 + .word 0xfc14dced + .word 0x0000e6a1 + .word 0x80aab6aa + .word 0x0001506c + .word 0x2184c380 + .word 0x000280f4 + .word 0x4c178847 + .word 0xffff0346 + .word 0xba079af3 + .word 0x00009da7 + .word 0x101d4738 + .word 0xfffef58a + .word 0xffabf35c + .word 0x000049c5 + .word 0x5dab0a0d + .word 0x00021e1b + .word 0xf2e2ecd8 + .word 0xfffc9a8d + .word 0x96fd60a4 + .word 0xfffce6ea + .word 0x7d77f804 + .word 0xfffd50f0 + .word 0xf94e1872 + .word 0xfffc19fb + .word 0xa6aa3dba + .word 0x00034d34 + .word 0x1b0e945e + .word 0xfffdc1d8 + .word 0x95377446 + .word 0xfffc4253 + .word 0xa34d234e + .word 0x00017abe + .word 0x1877ca2e + .word 0xffff78c2 + .word 0xc99eca4f + .word 0x000126d4 + .word 0xddb5488e + .word 0x00028b36 + .word 0x5803150e + .word 0xfffc8655 + .word 0x7ef170b7 + .word 0x0001ae43 + .word 0x28267ab9 + .word 0x0000d63d + .word 0xd948942c + .word 0xffff1e9b + .word 0x2cf198a9 + .word 0x000045cc + .word 0x41cc73ce + .word 0x000301e1 + .word 0x69d2fec3 + .word 0x0003b3ec + .word 0x7cbfee3e + .word 0x00033c10 + .word 0xe637f1c9 + .word 0x000233e3 + .word 0x4a651f7e + .word 0x0002e499 + .word 0xf2bda930 + .word 0xffff0370 + .word 0x486d47f4 + .word 0xffff94c5 + .word 0x7091dbcb + .word 0x0000c404 + .word 0x6f47a0ea + .word 0x00007c47 + .word 0xc4501bd7 + .word 0x0003ca18 + .word 0x3cdd1a60 + .word 0x0002a992 + .word 0x9264ef86 + .word 0x0000c20d + .word 0x0ef13e80 + .word 0x0003921e + .word 0xca6e7af1 + .word 0x0001bacd + .word 0x936523d7 + .word 0x000152f6 + .word 0x6b08f400 + .word 0xffff3b6d + .word 0x53913837 + .word 0x00014e34 + .word 0x0667673c + .word 0xfffd1194 + .word 0xaef029df + .word 0x0000c183 + .word 0xf3597674 + .word 0xffff8705 + .word 0x324394ec + .word 0x0003e0dc + .word 0xd8cb6317 + .word 0x00003951 + .word 0x8c4bac9c + .word 0xffff5bba + .word 0xbb3a530e + .word 0xfffdc1bd + .word 0xb2422ff7 + .word 0x000213d5 + .word 0x51093913 + .word 0x0001a811 + .word 0xaa5e78f7 + .word 0x0001240a + .word 0xa8f7f75a + .word 0xfffc61ac + .word 0xc77d96f5 + .word 0x000090db + .word 0xa532611b + .word 0x0001fd6f + .word 0x43622c42 + .word 0xfffcbda8 + .word 0x49e50fad + .word 0xfffc5ea5 + .word 0x5623a9cc + .word 0xfffe5d11 + .word 0x720dba39 + .word 0xffff91f6 + .word 0x9a274878 + .word 0x000324be + .word 0x74966c0f + .word 0x00039fef + .word 0x0e91060a + .word 0x000302f4 + .word 0x69f30d9d + .word 0xfffe853f + .word 0x6b645d66 + .word 0xffff1e6f + .word 0x1f3611ec + .word 0xfffe4878 + .word 0x7e3c41aa + .word 0xfffd5d27 + .word 0x7ff2cb7e + .word 0x00029dcb + .word 0xf62c1aee + .word 0x0001150d + .word 0x90147912 + .word 0x0002c84c + .word 0xe0f15b45 + .word 0x00009a93 + .word 0x09a9da67 + .word 0xfffe7140 + .word 0x5dd2a8b7 + .word 0xffff4441 + .word 0xb6737539 + .word 0xfffeb421 + .word 0xcf118cea + .word 0xfffface4 + .word 0x8ac8648d + .word 0xfffeb54b + .word 0x1c52e417 + .word 0x0002a32e + .word 0xb6f15546 + .word 0x000387a3 + .word 0xef990a58 + .word 0x0002f5f2 + .word 0x7ede2822 + .word 0x0000123a + .word 0xbd5c2685 + .word 0x00019cc1 + .word 0xba1daa7c + .word 0xfffe385f + .word 0x6a23d3f2 + .word 0xffffe611 + .word 0x0dffb675 + .word 0xfffeeb87 + .word 0x0df97544 + .word 0xfffd4c94 + .word 0xb51d841e + .word 0xfffe534c + .word 0x01d57115 + .word 0xfffd8513 + .word 0xa3478d82 + .word 0xfffd346d + .word 0xa85207ec + .word 0x00038cc7 + .word 0x9084bf4b + .word 0xfffe641d + .word 0xf8c3e2fd + .word 0x0002b2ff + .word 0x9b0a0155 + .word 0x0000fb65 + .word 0x3a83812b + .word 0xffff4da5 + .word 0xee4d45d7 + .word 0x00007d12 + .word 0x4997a20c + .word 0x000088ac + .word 0x097a766e + .word 0x00015032 + .word 0xe6bb6867 + .word 0x00021e09 + .word 0x98f90f2b + .word 0x000015ad + .word 0xc9454895 + .word 0xfffd0421 + .word 0xf94e16ed + .word 0xfffe904d + .word 0xb8b153a1 + .word 0x0003e7e1 + .word 0x765c1d21 + .word 0x000164fe + .word 0xc001bf37 + .word 0xfffebe56 + .word 0x66987948 + .word 0x0002da48 + .word 0x98b7f0ac + .word 0x00023e5b + .word 0x9f9c887f + .word 0xfffc59eb + .word 0x930a7da4 + .word 0x00005f56 + .word 0x43eb0f15 + .word 0xfffe8d22 + .word 0xcc04a9e8 + .word 0x00033355 + .word 0xb1b5b7bd + .word 0x000317a6 + .word 0xe8f9886b + .word 0x00020ebd + .word 0x5de33a1e + .word 0x0003c9c8 + .word 0x4e293aa5 + .word 0x0002c21a + .word 0x4da062c5 + .word 0xffffc361 + .word 0x6139acfa + .word 0x0000e514 + .word 0xaaee3e47 + .word 0xfffcacfe + .word 0x0e6513a0 + .word 0x0000d047 + .word 0x7cd15e56 + .word 0x0000e4fd + .word 0x66c7df6f + .word 0x0001c2f2 + .word 0xcfee5355 + .word 0x0001ceb8 + .word 0xf67448a6 + .word 0x0002674f + .word 0x03773a55 + .word 0xfffef01a + .word 0xf14d2921 + .word 0x00009da1 + .word 0x099ca10b + .word 0x0000758f + .word 0x3a075a2c + .word 0xfffd0682 + .word 0x1c70a310 + .word 0x00031b9e + .word 0x208e9da3 + .word 0xfffff669 + .word 0xb97600b4 + .word 0xfffea7d2 + .word 0x8f76b2a4 + .word 0x0003718b + .word 0xb4c47811 + .word 0xfffdb1fa + .word 0x818b2066 + .word 0x00019313 + .word 0x226cb2f7 + .word 0x00016f56 + .word 0xfe4e4685 + .word 0xfffd8dd9 + .word 0x17316886 + .word 0xffff0682 + .word 0xdcf2145b + .word 0xfffc938e + .word 0x396012ca + .word 0x00033027 + .word 0xc0a7329d + .word 0xffffa622 + .word 0x1d0bef9e + .word 0x0001e9bd + .word 0x3ab73d93 + .word 0xfffc056e + .word 0xc179537d + .word 0x0002bec1 + .word 0x5efb1720 + .word 0x0001a660 + .word 0xfdb25561 + .word 0xfffd4917 + .word 0x2b009852 + .word 0xffffc501 + .word 0xd5e03bc2 + .word 0xfffe3feb + .word 0xc04c87ec + .word 0xfffe839a + .word 0xddd2937c + .word 0xffffce2c + .word 0x9b70f2c1 + .word 0x00023254 + .word 0xb39bc97b + .word 0xfffe818c + .word 0xf3c5fb8e + .word 0x0002a6a4 + .word 0x42f38e1d + .word 0x0001481f + .word 0x9c9cd5b1 + .word 0x0003b298 + .word 0xc1602a04 + .word 0x000377b2 + .word 0xd55f5cdd + .word 0x0000e6d2 + .word 0x445ef1e3 + .word 0x00002a1e + .word 0xfe779f73 + .word 0xfffe2fb8 + .word 0x1872c149 + .word 0xfffc2e08 + .word 0xb4f94e58 + .word 0x0001e5a3 + .word 0x539cf7c1 + .word 0x0001a077 + .word 0x19a07c09 + .word 0xfffd4d7f + .word 0x83152c61 + .word 0xffff8b42 + .word 0xf65c66cb + .word 0x00037345 + .word 0x3c41cf6d + .word 0xfffc0017 + .word 0x4e81e675 + .word 0xfffd004f + .word 0x63604269 + .word 0xfffd2842 + .word 0x499eec1b + .word 0xffffb539 + .word 0xee0a710c + .word 0x00000e9a + .word 0xbcc3b1e2 + .word 0x000110b3 + .word 0x4dbbfc71 + .word 0x00037949 + .word 0x1e6b6e52 + .word 0x00036d22 + .word 0x29030233 + .word 0xfffc68b7 + .word 0x72f28ab9 + .word 0xfffea241 + .word 0xda7a8980 + .word 0xffff0a1a + .word 0xe30557db + .word 0xffff974f + .word 0x445a76db + .word 0x00026ab6 + .word 0x8112b4e7 + .word 0xfffdca0a + .word 0x8399dab3 + .word 0xfffc0983 + .word 0xc7701dc6 + .word 0x00035f04 + .word 0x1c3b89ab + .word 0x000190df + .word 0x0eb5d1eb + .word 0x0002184f + .word 0x7ec6b558 + .word 0x0002948a + .word 0x9f18e110 + .word 0x0003c105 + .word 0xa3741126 + .word 0xfffcb1b2 + .word 0xb715dd46 + .word 0x00010108 + .word 0xcaf6a7b0 + .word 0xfffd035c + .word 0xe909df3b + .word 0x0001df75 + .word 0xa44f12db + .word 0xfffc387e + .word 0xb8eb439c + .word 0xffff5a99 + .word 0x56f8822c + .word 0xffffa096 + .word 0x4c663f35 + .word 0xffffd9ce + .word 0x34ab7dd5 + .word 0xffff9dba + .word 0xe1ac1044 + .word 0xffff5a3d + .word 0xbe20d1d2 + .word 0x0003a5ff + .word 0x28ae3330 + .word 0xfffeaa68 + .word 0xafb44362 + .word 0xffffef9c + .word 0xd927a799 + .word 0x00016488 + .word 0xa6be3bbb + .word 0x000344a4 + .word 0xca4ce68e + .word 0xffff011c + .word 0x051a4306 + .word 0x000004cb + .word 0x61418c1c + .word 0x0002e59c + .word 0xa87ccb62 + .word 0xfffffa49 + .word 0xb4afa588 + .word 0x00010223 + .word 0xce8ce404 + .word 0x0002ddbd + .word 0xa64114ee + .word 0xffff0787 + .word 0xd7a44821 + .word 0xfffcccbd + .word 0x1a3b44e6 + .word 0xfffda3e4 + .word 0xd3447010 + .word 0xffffd2f7 + .word 0xa5d5a43b + .word 0x0002c482 + .word 0xbf083526 + .word 0xfffd9cfd + .word 0x2e10329f + .word 0xfffe8d17 + .word 0x847fdfe7 + .word 0x00016bd7 + .word 0xdacd5f55 + .word 0xfffe1dda + .word 0x8e9e1fed + .word 0xfffe5b05 + .word 0x182f1ba6 + .word 0x0002ec58 + .word 0x5572c7ef + .word 0xfffe3e91 + .word 0x5b0af410 + .word 0xfffe41a1 + .word 0xfb51de7e + .word 0xffff5a06 + .word 0xc319bb2d + .word 0x000396eb + .word 0xbaf7a0ab + .word 0x000153b2 + .word 0xd9836820 + .word 0x0003a50d + .word 0xe1e09586 + .word 0x0003b51f + .word 0x5c256dfb + .word 0x00029007 + .word 0xcdbcad02 + .word 0xfffe0366 + .word 0x52765271 + .word 0xffff61e4 + .word 0x26a808d5 + .word 0x00030613 + .word 0x8e448c7a + .word 0xfffc50f4 + .word 0x1dd16072 + .word 0xfffe2b91 + .word 0x0a72ed0d + .word 0xfffd82dd + .word 0x0b1724cd + .word 0x00030e46 + .word 0xdd43523e + .word 0xfffc536a + .word 0xf6b52f9d + .word 0xfffe60c2 + .word 0xfda962d4 + .word 0xfffeda78 + .word 0x04309fe6 + .word 0x0002e9ae + .word 0x74b66d87 + .word 0xffff6194 + .word 0x153bc737 + .word 0xfffc21b4 + .word 0xa084e6f0 + .word 0xfffe2638 + .word 0x40b3e8c5 + .word 0xffff65ea + .word 0x2f898a49 + .word 0x000219f5 + .word 0x5aee24cb + .word 0xfffea6e0 + .word 0x1d71233d + .word 0xffff295e + .word 0x96d37f77 + .word 0x0001bf00 + .word 0x41e5d795 + .word 0x00007601 + .word 0x6ef7ad33 + .word 0xfffce6f6 + .word 0x8404e930 + .word 0xfffc420c + .word 0xf1cedb14 + .word 0x000121bb + .word 0xc3dc7ac4 + .word 0xfffeb6a1 + .word 0xa99db183 + .word 0xffff97ac + .word 0x29ed457b + .word 0x00020adb + .word 0x6c74099c + .word 0x000154cc + .word 0x9d2af037 + .word 0xfffc495a + .word 0x5e99a48c + .word 0x0000097e + .word 0x0fd10535 + .word 0xfffc93a3 + .word 0x8bad4ecf + .word 0x0000b9d5 + .word 0x2484d4d3 + .word 0x00031474 + .word 0xb0bb6eae + .word 0x0002791d + .word 0x3c19e824 + .word 0xffff5dec + .word 0xc1ed6061 + .word 0xfffc2014 + .word 0x94bdba58 + .word 0x00037408 + .word 0x9f41acde + .word 0x00032773 + .word 0x903b7fae + .word 0xffff4e3e + .word 0x68754d80 + .word 0xfffc19d9 + .word 0x0e9ec98c + .word 0xfffc3a96 + .word 0xb6d7faf7 + .word 0xfffe1d15 + .word 0x3703c306 + .word 0xffffa69d + .word 0x2541dc95 + .word 0x00032256 + .word 0x93ad9a95 + .word 0x000322a2 + .word 0x441ad7ab + .word 0xfffd0771 + .word 0xbc9012b2 + .word 0xfffded98 + .word 0xcaf45c16 + .word 0x00005084 + .word 0x85a3eeb4 + .word 0xffff50c4 + .word 0xa01b6cbe + .word 0xfffde52d + .word 0x9c3a5c87 + .word 0xfffd766d + .word 0x0e683422 + .word 0xfffe4c54 + .word 0x9e320f3c + .word 0xfffe880b + .word 0xe4d4a64e + .word 0x0003834a + .word 0x9ee5e424 + .word 0x00035ace + .word 0xc481e0e3 + .word 0x00004c43 + .word 0xb0743956 + .word 0xffff5319 + .word 0xc1a9ce13 + .word 0x0002e824 + .word 0x5a7682a4 + .word 0x0001e554 + .word 0xe98167e5 + .word 0xfffd5dd7 + .word 0xa2d960cb + .word 0xfffc2532 + .word 0xd3ed9874 + .word 0xfffc773d + .word 0xe25a8e40 + .word 0xfffd55e9 + .word 0xa304d0d3 + .word 0x000111c1 + .word 0x6b0b5e16 + .word 0x0003306e + .word 0xc9515865 + .word 0x0002e9d3 + .word 0x495ad5eb + .word 0x00037aa9 + .word 0x40808812 + .word 0xfffdd0af + .word 0x66127db0 + .word 0x0002139f + .word 0xdb0e0507 + .word 0x00039bf2 + .word 0x5bc2dd6d + .word 0xfffcae99 + .word 0x2e4dc38a + .word 0x0003bc8c + .word 0x5286b6d5 + .word 0xffffedcf + .word 0xb622ec81 + .word 0xffffb1b3 + .word 0x883376a2 + .word 0x0002f00b + .word 0x0de7613a + .word 0xfffc40c3 + .word 0x11cb4fcc + .word 0x00025113 + .word 0xadf15914 + .word 0xfffd7cc3 + .word 0x772108f5 + .word 0xfffdd2af + .word 0xec029e1a + .word 0x0003effb + .word 0x8fe1215b + .word 0xffffd154 + .word 0xca6f2c81 + .word 0x00013ed5 + .word 0x5392419f + .word 0xfffe6654 + .word 0xe14b8495 + .word 0xfffca825 + .word 0x6910e5a1 + .word 0x0003c2e1 + .word 0xd2a0518c + .word 0xfffd246a + .word 0xd16ccd9a + .word 0x00035701 + .word 0xcc6df07b + .word 0x0001aee6 + .word 0x4d243044 + .word 0x000075da + .word 0xbd5bb02c + .word 0x00035dcc + .word 0x60623178 + .word 0x000143f7 + .word 0x47ff4304 + .word 0x000246c1 + .word 0xaf3920ec + .word 0xfffd1abe + .word 0xe4f2a34e + .word 0x00033a78 + .word 0x0781cf2b + .word 0xfffe5192 + .word 0x5ae14d0e + .word 0x00027199 + .word 0xa520ed52 + .word 0x0002dd04 + .word 0x1204d5ac + .word 0xfffe0dd4 + .word 0x2ae87421 + .word 0x0000a4e4 + .word 0xe5850518 + .word 0xfffc6833 + .word 0x69d15efe + .word 0x000361e4 + .word 0x8fd4c592 + .word 0x0002f214 + .word 0x5bd0908d + .word 0x0002b431 + .word 0x70bd50d5 + .word 0x00011266 + .word 0xe3c78f1f + .word 0xfffecfbc + .word 0x9d993e6d + .word 0xfffd2cf2 + .word 0x9026b1ad + .word 0x000220d8 + .word 0xfd4b32da + .word 0xfffcbd23 + .word 0x6b5aca45 + .word 0x0002e8af + .word 0xfe2b53f1 + .word 0xfffc12d0 + .word 0xc33aac4e + .word 0xffff982d + .word 0x3cd9d865 + .word 0x0001008e + .word 0xe2e02f99 + .word 0x00004657 + .word 0xcbcb02e2 + .word 0xfffc57f3 + .word 0x3f703b67 + .word 0xfffc549c + .word 0xfcd41aa0 + .word 0x0000745b + .word 0xdf4d8687 + .word 0xfffccbd2 + .word 0x0321d1f5 + .word 0xfffe432c + .word 0x35e9a218 + .word 0xfffc3cbc + .word 0xaafdd451 + .word 0xfffede0a + .word 0x620d3c85 + .word 0x0002bb57 + .word 0xfbaae9e5 + .word 0xfffc10eb + .word 0x6a694566 + .word 0xfffebfd9 + .word 0x4d4492d8 + .word 0x00028254 + .word 0xbe028f36 + .word 0xfffd7c9c + .word 0x3e4cf00f + .word 0xfffd3115 + .word 0x7c043eaf + .word 0x00003523 + .word 0x34a4c8be + .word 0xfffdca46 + .word 0x8209aa9c + .word 0x000311d7 + .word 0xc5180ca8 + .word 0xfffd09f1 + .word 0x0b824580 + .word 0x00027688 + .word 0x63933b98 + .word 0xffff0345 + .word 0x3c1f3a12 + .word 0x000125aa + .word 0xfdc9753b + .word 0x00012427 + .word 0xb9bce75e + .word 0x0000a179 + .word 0x61cf1503 + .word 0xfffefbed + .word 0x811c0f65 + .word 0x0000f28b + .word 0xb2af19bb + .word 0x0003871a + .word 0xcb86c24b + .word 0xfffe8a1b + .word 0x51a85141 + .word 0xfffd51ea + .word 0x7a102d74 + .word 0x000020ed + .word 0x137b39dc + .word 0xffff7871 + .word 0x5000e26c + .word 0xfffea1b8 + .word 0x0c56c7d0 + .word 0xffff7402 + .word 0xe0d467f9 + .word 0xfffdd944 + .word 0x995decf3 + .word 0xfffe0d76 + .word 0x001a6516 + .word 0x0001a3dd + .word 0x5c98b85f + .word 0x00017d12 + .word 0x03e20b44 + .word 0xfffd1256 + .word 0x23fcf710 + .word 0x00036354 + .word 0xd01f7f42 + .word 0xfffc84ba + .word 0x7df91bab + .word 0x0000b13b + .word 0xacb208b5 + .word 0xfffd0c11 + .word 0x74e26ef4 + .word 0x00021d33 + .word 0x5661b5c6 + .word 0xfffce53b + .word 0xa041da62 + .word 0xfffdc4bf + .word 0x75f4eb6d + .word 0xffff6686 + .word 0x8d770b4e + .word 0x000127ab + .word 0xcdef7fa1 + .word 0xfffca782 + .word 0xc638caae + .word 0xffffa726 + .word 0x8b4d7e97 + .word 0xfffcb42d + .word 0xa7cce5f7 + .word 0xfffd084c + .word 0xbb2e4ccb + .word 0x00033717 + .word 0xd841b93e + .word 0x000084c5 + .word 0x48139098 + .word 0xfffd40ee + .word 0x0aa7b5ff + .word 0xfffea292 + .word 0xccc8f183 + .word 0x0002403d + .word 0xd4006f39 + .word 0x0001891b + .word 0x6298dee9 + .word 0x0000dcd5 + .word 0x9bd79ef8 + .word 0xfffca8b5 + .word 0x7e3da1f2 + .word 0xfffe254b + .word 0xf4fc8951 + .word 0x00007e47 + .word 0x361ae17e + .word 0xfffd0495 + .word 0x923fa513 + .word 0xffffb888 + .word 0x12d91f57 + .word 0xfffd2063 + .word 0x87d0f6e9 + .word 0x0001f61a + .word 0x9c1e6592 + .word 0x0001f1d9 + .word 0x139a1808 + .word 0x00006fd1 + .word 0x325fcbcc + .word 0x00025c34 + .word 0xef7fe4a1 + .word 0x0002d799 + .word 0x999139bd + .word 0xfffe48dc + .word 0xd0483fd9 + .word 0x00036f81 + .word 0xe0f7353e + .word 0xfffcaa28 + .word 0x86470479 + .word 0x00024e56 + .word 0x164f9144 + .word 0x00028ae6 + .word 0x00dbda97 + .word 0xfffc5067 + .word 0xc81cf689 + .word 0xfffe8553 + .word 0xad1e4a9d + .word 0x0000327d + .word 0x89ad0dcb + .word 0x000288bd + .word 0x4a9d18b9 + .word 0xffff4646 + .word 0xc38a4c0b + .word 0x000115e2 + .word 0xeed1207f + .word 0x000297f3 + .word 0x5bbc7ed4 + .word 0x00010105 + .word 0x8358a718 + .word 0xfffdacd7 + .word 0xfc12c379 + .word 0x00028b5f + .word 0xe5efe9ba + .word 0x0001d213 + .word 0x8dbea40d + .word 0xfffdb96d + .word 0x08f7fccb + .word 0xffffbbef + .word 0xa5bc3d8c + .word 0xfffd57eb + .word 0x7681f2c8 + .word 0x0002847e + .word 0xa9274612 + .word 0xffff6d80 + .word 0xe54be206 + .word 0xfffd40a2 + .word 0x7448881c + .word 0x0001f4bc + .word 0x3320cce2 + .word 0xfffd5853 + .word 0xf83aad07 + .word 0x0001cffe + .word 0x21f478fd + .word 0x00021068 + .word 0x3d6d94be + .word 0x0003367a + .word 0x0fb7ca4f + .word 0xfffc9342 + .word 0x5cbd9344 + .word 0x00034f3e + .word 0xe205fe1b + .word 0x00025bdd + .word 0xf53b67b2 + .word 0x000221d4 + .word 0x30ce94a8 + .word 0xfffee2bc + .word 0x650ab27c + .word 0x00022623 + .word 0xa996356f + .word 0xffff5132 + .word 0xec0427f9 + .word 0x00005251 + .word 0x8b966ca2 + .word 0xfffff51d + .word 0x056fbfc0 + .word 0xfffe24f5 + .word 0x25a54def + .word 0xffffedf9 + .word 0xec361f6e + .word 0x00034644 + .word 0xf7b44c15 + .word 0xfffc379d + .word 0x233f5054 + .word 0xfffd9b12 + .word 0x37b9cb9c + .word 0x0002857a + .word 0x3c762d07 + .word 0x00024bd6 + .word 0x16ad8caf + .word 0x00020742 + .word 0x9b36af73 + .word 0xfffef139 + .word 0x07aa344b + .word 0x0000ca5c + .word 0xc0b7173e + .word 0xfffc41c2 + .word 0xf4c2551a + .word 0xfffef5b6 + .word 0x02c0dc04 + .word 0xfffd61aa + .word 0x910b55c5 + .word 0x0002d94e + .word 0x7b787b39 + .word 0xffff7f7f + .word 0xf0461fbf + .word 0x00010a9b + .word 0x1d1398ad + .word 0xfffd3d77 + .word 0xdeb12330 + .word 0x0003c881 + .word 0x9389a25a + .word 0x00028bd7 + .word 0xfa77bd30 + .word 0xffff1375 + .word 0x72ac1762 + .word 0x0001b8af + .word 0x47a513d3 + .word 0xfffe37e0 + .word 0xbeea096a + .word 0x0003f35f + .word 0xb06fcd32 + .word 0x00004b95 + .word 0x7b45922e + .word 0xffff94b3 + .word 0xb582c36b + .word 0x00033792 + .word 0xbeedaf46 + .word 0x00012dfb + .word 0xd238a495 + .word 0x00033aab + .word 0xb4876e40 + .word 0xfffc4f78 + .word 0x6b331999 + .word 0xfffd7b8a + .word 0x74482f6e + .word 0x0001fc9f + .word 0xf7eb6239 + .word 0x00014b74 + .word 0xe6e6355c + .word 0x0002cb0a + .word 0x796bac9b + .word 0xfffc383d + .word 0xf73291ed + .word 0x00021d61 + .word 0x11cc764d + .word 0x00029205 + .word 0xd66232b9 + .word 0x0003aeeb + .word 0xa792d4d3 + .word 0x0001b8fe + .word 0xcb5ea410 + .word 0x0001a20b + .word 0xc37c13d6 + .word 0x00012067 + .word 0xdc3c8775 + .word 0x000357e0 + .word 0x862f4c8e + .word 0xfffcff6c + .word 0x4253b9fa + .word 0x00006311 + .word 0x9181e352 + .word 0x00035930 + .word 0x2b596f14 + .word 0xfffe5479 + .word 0x19a75dd5 + .word 0x000337f1 + .word 0xa1141a97 + .word 0xfffe7bf4 + .word 0xf86f5673 + .word 0x0002e8eb + .word 0x182f4873 + .word 0x00007414 + .word 0x41526338 + .word 0xfffea784 + .word 0x036137eb + .word 0xffff4e34 + .word 0x399ef666 + .word 0xfffda226 + .word 0x510592a4 + .word 0x0003a936 + .word 0xd0270292 + .word 0xfffcc87b + .word 0x26798cfe + .word 0x000314c4 + .word 0xc85af152 + .word 0x00025942 + .word 0xaa47ceb9 + .word 0xfffde254 + .word 0x267a1ba3 + .word 0x0000b624 + .word 0x7ee01950 + .word 0x0003b320 + .word 0x5156dcbe + .word 0x0002dbc3 + .word 0x25ec4447 + .word 0xfffd1933 + .word 0x866caa8f + .word 0xffff82d1 + .word 0x6b8aa251 + .word 0xfffe9d40 + .word 0xc5c92b5b + .word 0x000388fc + .word 0x76a2e78f + .word 0xfffcd1f9 + .word 0xeee7969b + .word 0xfffccd6c + .word 0x313b78fc + .word 0x0001cd5f + .word 0xbe5090b8 + .word 0x00020d60 + .word 0xe6517ad8 + .word 0x0000e65d + .word 0x151f296c + .word 0xfffe5090 + .word 0x2f820eb8 + .word 0xfffe823b + .word 0xf570dc5c + .word 0x00018d2f + .word 0x11b7538c + .word 0xfffe79d9 + .word 0x510482ae + .word 0x0001e0cc + .word 0xaaa83f60 + .word 0xfffc4fba + .word 0x57df92b9 + .word 0xfffd2870 + .word 0x4a787916 + .word 0x0001df16 + .word 0x769d8a7b + .word 0xfffce7b5 + .word 0xa7fe4f8a + .word 0x0002d3d9 + .word 0xcfc49561 + .word 0xfffc6201 + .word 0x404976ea + .word 0xfffe8829 + .word 0x6949e883 + .word 0xfffed091 + .word 0x75933627 + .word 0x00021c81 + .word 0x6b6ba6e6 + .word 0x0000ffca + .word 0xc11712b0 + .word 0xfffea111 + .word 0x2b7db960 + .word 0xfffc67e3 + .word 0xdab741fa + .word 0x00033d15 + .word 0x480bae57 + .word 0x0003cc53 + .word 0x6d75db13 + .word 0xfffd4f9c + .word 0x52438006 + .word 0xffff9011 + .word 0xdb189cdc + .word 0xfffedb81 + .word 0x09ce3b01 + .word 0xfffc4677 + .word 0x65d8a43a + .word 0xffff92d1 + .word 0x98012c8d + .word 0xffff28d6 + .word 0x9f4bec24 + .word 0xfffeed17 + .word 0x8b5cdaf2 + .word 0x00032873 + .word 0x7bccc0b3 + .word 0xfffca66a + .word 0x8b9dd488 + .word 0x00009fc7 + .word 0x8deb0d36 + .word 0x00014182 + .word 0x51160223 + .word 0x00016a95 + .word 0x687ef240 + .word 0xfffc9e31 + .word 0x16db0d00 + .word 0x0002dca3 + .word 0x0757f020 + .word 0x0001a024 + .word 0x25ab9835 + .word 0x0003d8b9 + .word 0x2d35e318 + .word 0xfffea639 + .word 0xbc38e3c2 + .word 0xfffd7142 + .word 0xc3c4d09f + .word 0x000246b7 + .word 0xf88fff36 + .word 0x0003be7c + .word 0xa9b12f5a + .word 0x0003a027 + .word 0xb8a15bcf + .word 0xfffc9676 + .word 0xc8d78fe3 + .word 0xfffd0d2d + .word 0xc741619b + .word 0xfffe1385 + .word 0xa4e14fa8 + .word 0xfffc974d + .word 0x3b1c36c4 + .word 0xfffe9c4a + .word 0x5bc620a7 + .word 0x00032398 + .word 0x4a73d460 + .word 0x0002f56a + .word 0x31390a36 + .word 0x00018326 + .word 0x508396c1 + .word 0x0002b8b8 + .word 0x52784c2b + .word 0xffff0d85 + .word 0x30cb786b + .word 0x0003e7ae + .word 0xf0db5d90 + .word 0xfffdf7d8 + .word 0x60506acb + .word 0xfffc12ea + .word 0x13c4243a + .word 0xfffe7448 + .word 0x54c5e85b + .word 0x0003dbe3 + .word 0x8bb9a0c0 + .word 0xfffcd7e0 + .word 0x8a454864 + .word 0x0002f406 + .word 0xa51adabc + .word 0x0003a63a + .word 0x1efdd233 + .word 0xfffd3648 + .word 0xc98fb203 + .word 0x00004641 + .word 0xb50af92b + .word 0x000042ac + .word 0x2d009306 + .word 0x00031b21 + .word 0xd682083c + .word 0x00007cfb + .word 0x8474e862 + .word 0xfffc09ab + .word 0x990df9f4 + .word 0x000027c5 + .word 0x84d89565 + .word 0xffffe95d + .word 0xe6c353bb + .word 0x000107b0 + .word 0xce56d916 + .word 0x00034014 + .word 0x1e0a93ed + .word 0xffffb1db + .word 0xa99e03e2 + .word 0x0003515f + .word 0x2f26ff8d + .word 0x00009809 + .word 0xce70af16 + .word 0xffffa43b + .word 0xedf14355 + .word 0x0000e666 + .word 0x977494e6 + .word 0xfffc0dc4 + .word 0x75cf57d7 + .word 0xffff288c + .word 0xfcd4405a + .word 0x00028795 + .word 0x95c8d492 + .word 0x00010363 + .word 0x184fb242 + .word 0x00028a9f + .word 0x1b1e53cb + .word 0xffffc1c5 + .word 0xb01de4ae + .word 0x0001bc1e + .word 0xcf8912e0 + .word 0x00038c9b + .word 0xc7080a76 + .word 0xfffe6382 + .word 0x50a182cb + .word 0xfffe7ef6 + .word 0x85e254c3 + .word 0x0000f7ed + .word 0xfad65172 + .word 0x0002fc96 + .word 0xa2e3a83a + .word 0xffffdfca + .word 0xca5b1748 + .word 0xffff5c1c + .word 0xe1520721 + .word 0x0003dcb0 + .word 0xeb72991c + .word 0x00000c7a + .word 0x6f00b11e + .word 0xfffd0d03 + .word 0x509d6497 + .word 0x0000edcf + .word 0x14dce1b0 + .word 0xffff7859 + .word 0xead65005 + .word 0x00023fae + .word 0x93630818 + .word 0xfffca8cf + .word 0x3a931556 + .word 0xffffd186 + .word 0x005b363e + .word 0x00010314 + .word 0x677c4399 + .word 0x00035265 + .word 0x8b35d822 + .word 0xffff84f5 + .word 0xb1927c64 + .word 0xfffc0db2 + .word 0xe5a490e9 + .word 0x0003fbff + .word 0x2686d9a0 + .word 0x000000d4 + .word 0x762e4f74 + .word 0xfffc97fc + .word 0x4873ac12 + .word 0xfffdab8c + .word 0x200cf24e + .word 0x00012561 + .word 0x86d863ce + .word 0xfffd929c + .word 0x351ee263 + .word 0x00026e54 + .word 0xea85f935 + .word 0xfffdaafb + .word 0x313e770b + .word 0x0001f148 + .word 0xc75b590b + .word 0xfffc9d6a + .word 0xa8e04f40 + .word 0xfffc6f9f + .word 0xcb2e571e + .word 0xfffd6461 + .word 0xe2081b65 + .word 0x0003b1c4 + .word 0x905893c6 + .word 0xfffdcef8 + .word 0x90d960cf + .word 0x00015053 + .word 0x98211725 + .word 0x000269f3 + .word 0xbcdb51b7 + .word 0x0002a730 + .word 0xa89db46a + .word 0xffff47f3 + .word 0xed9e8917 + .word 0x00003fd0 + .word 0x58d8fa39 + .word 0xfffcd33f + .word 0xebf31bd4 + .word 0xfffd3528 + .word 0x5891e728 + .word 0xfffcf867 + .word 0xdc7b426d + .word 0x000177b9 + .word 0x4820e5ed + .word 0x0001b74b + .word 0x84e116c7 + .word 0xfffe097e + .word 0xc5830636 + .word 0xfffc6113 + .word 0x746a71f9 + .word 0xffff5ea5 + .word 0x1a0f7630 + .word 0x00016788 + .word 0xad2b23db + .word 0xffff8d80 + .word 0x7d07f533 + .word 0xfffccc35 + .word 0x19b9e09b + .word 0xffff70f9 + .word 0xe3a878f5 + .word 0x00011f51 + .word 0x0213167b + .word 0x0001e7c1 + .word 0x3b64f534 + .word 0x000158b7 + .word 0x2f10e2c1 + .word 0xfffc2d4d + .word 0xedd11cc9 + .word 0xffff8a29 + .word 0xa4ceba73 + .word 0x00021367 + .word 0x9e1a657a + .word 0x00019b8a + .word 0xd0abc105 + .word 0x0003f679 + .word 0x75251f17 + .word 0xfffd8ee6 + .word 0xca7a8dab + .word 0xffff8eac + .word 0x556381bd + .word 0xfffea2ce + .word 0x8eaa1d43 + .word 0x000328f7 + .word 0x39cc861a + .word 0x00017dbd + .word 0x38cca946 + .word 0x00037d52 + .word 0xe02dac2e + .word 0x000071be + .word 0x4fa3322b + .word 0xfffc5696 + .word 0x35befae6 + .word 0xfffd0094 + .word 0x35280076 + .word 0xfffc4c32 + .word 0xc53cfcba + .word 0xfffc6b93 + .word 0x2cc164d5 + .word 0xfffdf94e + .word 0xc50b6edf + .word 0x00011802 + .word 0x84f2177d + .word 0x0003775f + .word 0x7850a6ab + .word 0xfffd371c + .word 0x3d500816 + .word 0x00019dfd + .word 0x45713d17 + .word 0x00027387 + .word 0x9f95c6a5 + .word 0xffffb5d8 + .word 0xc476a1aa + .word 0x000213d1 + .word 0xf1cfe12e + .word 0xfffc1bce + .word 0x220b3977 + .word 0xfffcce69 + .word 0x5de1fd07 + .word 0xffff18e5 + .word 0xbc990dfc + .word 0xfffeb6d1 + .word 0xf7f08f69 + .word 0xfffd1952 + .word 0xec12f66e + .word 0xfffe4fe1 + .word 0x52248ffe + .word 0xffffc2e7 + .word 0x89402555 + .word 0xfffc9b57 + .word 0xa89fb64a + .word 0x0003fdeb + .word 0x63c8bc02 + .word 0xfffffd17 + .word 0x331ba617 + .word 0x000388e1 + .word 0xaa96d806 + .word 0xfffe1a47 + .word 0xab10ded3 + .word 0xfffcdcba + .word 0x196b41db + .word 0xfffcf644 + .word 0x84d8fd2c + .word 0x00006d66 + .word 0x41cbc7bb + .word 0x0003d2a6 + .word 0xe0969ef7 + .word 0x0002daaf + .word 0x336350ba + .word 0xfffcf1c9 + .word 0x4c7e1812 + .word 0xfffd2967 + .word 0x17c936bf + .word 0x000306a0 + .word 0xa03dcea1 + .word 0xfffc3823 + .word 0xbcbf279e + .word 0xffff9886 + .word 0x26fa4387 + .word 0x0001fb94 + .word 0x2ce1e22e + .word 0xffff092b + .word 0xb33f0793 + .word 0x0000f940 + .word 0x358689b5 + .word 0xfffd992f + .word 0x8b7746d3 + .word 0x0003baf7 + .word 0x072b169e + .word 0x000092b1 + .word 0x5105e433 + .word 0x0002d9d1 + .word 0x8616a4b0 + .word 0xfffcaa22 + .word 0xc2c433c8 + .word 0xfffd09ab + .word 0xd96eca90 + .word 0xfffe15a2 + .word 0x516bfcba + .word 0xffff70d9 + .word 0xa7e5cacc + .word 0xffff5d17 + .word 0xb2ca887a + .word 0x0000b005 + .word 0xf94e3314 + .word 0xfffcd5cd + .word 0x342838d2 + .word 0xfffe7e44 + .word 0x3f12f005 + .word 0x00031cbd + .word 0x82eccf1f + .word 0xfffe98f6 + .word 0xba84aded + .word 0x0002b0f5 + .word 0x1a18b0ae + .word 0xffff8937 + .word 0x1b20f96b + .word 0x0002e22e + .word 0xd7113adf + .word 0xfffcc424 + .word 0xf8fcfceb + .word 0x00026608 + .word 0x5349700f + .word 0x0000eb02 + .word 0xa8f01edd + .word 0x0003ae63 + .word 0xcdf5d4fe + .word 0xfffe87f8 + .word 0x54193421 + .word 0xffff57ad + .word 0x79f49d61 + .word 0x00035aaf + .word 0x5abb9f05 + .word 0x0002f4a8 + .word 0xd038ba5c + .word 0xfffe1561 + .word 0x3de70e59 + .word 0x000151e0 + .word 0xc662c25c + .word 0x00012bbb + .word 0x4692af67 + .word 0x0003800b + .word 0x59442a12 + .word 0xfffced5d + .word 0x931ad678 + .word 0x0001bc8b + .word 0x7e3a0c6b + .word 0x00003051 + .word 0x43a5f4da + .word 0xfffe4ab9 + .word 0xd073e1e9 + .word 0xfffe8e9f + .word 0x8d2961f7 + .word 0x0001cf73 + .word 0x75e5d310 + .word 0x0000164b + .word 0xa4f160a7 + .word 0xfffe99a9 + .word 0xd8af7f12 + .word 0x0002d718 + .word 0x445c9d00 + .word 0xfffce1ed + .word 0x07575823 + .word 0xfffc1f5e + .word 0x7ef5501a + .word 0xffff601c + .word 0xd6b2f068 + .word 0x00035ebe + .word 0xbaa843ec + .word 0x00015aa6 + .word 0x50a93894 + .word 0x00022abb + .word 0x52b47fd6 + .word 0x0001c5c0 + .word 0xdcf0eaaa + .word 0x0000e2f7 + .word 0x3ed4e458 + .word 0xffffa8c9 + .word 0xce0fd9da + .word 0xfffda28d + .word 0xcc643ada + .word 0x0001ef47 + .word 0x2e9d4003 + .word 0x00007d54 + .word 0x72e0e9f2 + .word 0xfffee18f + .word 0x566801a2 + .word 0x0002a249 + .word 0x844e0db5 + .word 0xfffc633f + .word 0x18d38e1d + .word 0xfffe7aff + .word 0x5bf4023f + .word 0xfffdd51f + .word 0xd2331e7e + .word 0xffff9b37 + .word 0xc273480a + .word 0xfffe7853 + .word 0x0a8de534 + .word 0x00039512 + .word 0x6fb6385f + .word 0xfffdde1b + .word 0xa570e9f2 + .word 0x00032bea + .word 0xc7270737 + .word 0x0003e590 + .word 0x6dd40f64 + .word 0xfffc2948 + .word 0xcb017a13 + .word 0x00000434 + .word 0x5e13b402 + .word 0x0003cb14 + .word 0x3fd0bd8d + .word 0x00016d5b + .word 0x4822dc7b + .word 0x0002a43a + .word 0xd1c54b23 + .word 0xfffde21a + .word 0xb999b88f + .word 0x0002642f + .word 0xfdf50b3d + .word 0xfffc014b + .word 0x943d3a7d + .word 0x0003d74b + .word 0x8655e29a + .word 0xfffc73da + .word 0x5f69a576 + .word 0xfffe82ef + .word 0x29a9d92a + .word 0xfffc8104 + .word 0x316dc303 + .word 0xfffe906e + .word 0x3e5ebb5d + .word 0xfffc6604 + .word 0x81d9fbb1 + .word 0x00020ae8 + .word 0xa87fc167 + .word 0x0003c0cd + .word 0xa5a8ef36 + .word 0x000342f3 + .word 0xabf7f201 + .word 0x000081dd + .word 0x24ac423e + .word 0x00030370 + .word 0xe7a130cf + .word 0xfffda92c + .word 0x046aff30 + .word 0xfffefa02 + .word 0x604edb13 + .word 0x0001dba5 + .word 0xcbfec9ad + .word 0xffff07e7 + .word 0x0889f5eb + .word 0x0003025a + .word 0x50f3131a + .word 0x0001ff90 + .word 0x614781c6 + .word 0xfffe7b5a + .word 0x604e1886 + .word 0xfffdf52b + .word 0xbc1edd58 + .word 0xfffd1d11 + .word 0xe38caf94 + .word 0xffffeb42 + .word 0x72ec03d6 + .word 0xfffc00b2 + .word 0xb9de0e37 + .word 0x0003291d + .word 0xcd35a241 + .word 0x0002c35e + .word 0xb20616a9 + .word 0xfffc8f2f + .word 0xfa8aede6 + .word 0xfffcfbaf + .word 0xe0e21a01 + .word 0x0003cca6 + .word 0x16acf1da + .word 0x0000ca08 + .word 0x483206a5 + .word 0x0002eaf2 + .word 0x83a36a3f + .word 0x0002b552 + .word 0x4d0ebaa5 + .word 0xfffe0d43 + .word 0xffbb1bbb + .word 0xfffc9f2b + .word 0x83cc8cec + .word 0xfffe80f2 + .word 0x2ab8c604 + .word 0x0003887e + .word 0x64826102 + .word 0xfffe44e9 + .word 0xbf2aee3c + .word 0x0003468d + .word 0x5e2b03df + .word 0xfffe4567 + .word 0x9bbe9b08 + .word 0x00039ab9 + .word 0xf527f95b + .word 0x0003de68 + .word 0xb647b385 + .word 0x0000b4e0 + .word 0xbb457351 + .word 0xffff8a93 + .word 0x6453dd06 + .word 0xfffcac88 + .word 0xa140beee + .word 0x0002bb25 + .word 0x6a932d68 + .word 0x00008e75 + .word 0x26d864b4 + .word 0x0000c041 + .word 0x96c62dec + .word 0xfffd0a07 + .word 0x304913cc + .word 0x00002c4a + .word 0x170fb018 + .word 0xfffccf77 + .word 0xd29a41d1 + .word 0xfffdd22d + .word 0x2483c41b + .word 0x0002a046 + .word 0x474eea5d + .word 0x000005ae + .word 0x7c6755a5 + .word 0x00038af9 + .word 0x33713d63 + .word 0xfffe8b5e + .word 0x2d12ebd1 + .word 0x0000d682 + .word 0xd998048e + .word 0x0002290f + .word 0x151d52ac + .word 0x00036191 + .word 0x3b1830db + .word 0xfffe44ad + .word 0x113a2198 + .word 0xffff5d70 + .word 0xf5dd98af + .word 0xfffea734 + .word 0xae25d354 + .word 0x000392b9 + .word 0x7497e64c + .word 0x0002ad68 + .word 0xa68600fa + .word 0x0001466b + .word 0xd0f41766 + .word 0x00004362 + .word 0x7497013e + .word 0xffff2227 + .word 0xcc78404e + .word 0xfffe9ae5 + .word 0xee54afbc + .word 0xffff4058 + .word 0x516f9f94 + .word 0x00025f7e + .word 0xb067b072 + .word 0xfffc48a9 + .word 0x9b9a2cd6 + .word 0x0001048e + .word 0xe7319953 + .word 0x0003fa53 + .word 0xfd5fef9e + .word 0xfffeb038 + .word 0x5ead6550 + .word 0xfffd732c + .word 0x88c126cb + .word 0xfffe61e0 + .word 0xa617a470 + .word 0x0001b00f + .word 0x9209f23b + .word 0x0003e8b5 + .word 0x8713506b + .word 0xfffc0e22 + .word 0x2b1329d6 + .word 0x00009d18 + .word 0x9bbea1c4 + .word 0xfffd9455 + .word 0x7cf5b5c5 + .word 0xfffec24b + .word 0x1b78603c + .word 0xffffb271 + .word 0x81310e5c + .word 0xfffdf6eb + .word 0x5b6599ad + .word 0x00019413 + .word 0x86ee9b05 + .word 0xfffeec09 + .word 0x4a89d0d8 + .word 0x0001f133 + .word 0x06cd08eb + .word 0xfffc5734 + .word 0x5193a921 + .word 0xfffd09f8 + .word 0xfddafd71 + .word 0x0003afe5 + .word 0x42adfab9 + .word 0xfffeeeb3 + .word 0x1f60c3fa + .word 0x00014ac1 + .word 0xd844b71a + .word 0x00006226 + .word 0xab12973b + .word 0x00025993 + .word 0x0163c14a + .word 0x0002cebb + .word 0xe442e478 + .word 0xfffc6eaf + .word 0x56e68b44 + .word 0xfffd4bc9 + .word 0x1cf863b3 + .word 0x0000235a + .word 0xe5cf9ae4 + .word 0x0003b13b + .word 0xa88908eb + .word 0x0001e1e5 + .word 0xb0581843 + .word 0xfffd4ed6 + .word 0xe9277e5f + .word 0x000314a0 + .word 0x5869f362 + .word 0xfffd6f63 + .word 0x16c31bbc + .word 0x0002dc40 + .word 0x14bb82bd + .word 0xfffeb431 + .word 0x05341400 + .word 0x0002849c + .word 0x9e5e4e4c + .word 0x00028a82 + .word 0xb31192ce + .word 0x00005cad + .word 0x8a585812 + .word 0xffff1f81 + .word 0x6afc1979 + .word 0x0001e428 + .word 0x78262d44 + .word 0x0001ab40 + .word 0xd8fd7438 + .word 0xffff1fda + .word 0x61831400 + .word 0xfffd580f + .word 0x6d840525 + .word 0xfffde263 + .word 0xeedf62bf + .word 0x0000c2b7 + .word 0x8a20868d + .word 0x000161ff + .word 0x96ddc358 + .word 0x0003e52b + .word 0x0dcddf49 + .word 0xfffcf354 + .word 0xe97c2971 + .word 0x00016769 + .word 0x2ad366d2 + .word 0x00006dce + .word 0xfe8d9a3e + .word 0x00006557 + .word 0xd03068c1 + .word 0xffff0142 + .word 0xd64d72d3 + .word 0xfffd0f44 + .word 0xb398b287 + .word 0x000219d8 + .word 0x3830c34e + .word 0x000168b6 + .word 0xdd830d0b + .word 0x00007f01 + .word 0x3dd732fd + .word 0xfffd8c32 + .word 0xaa2804bc + .word 0x00029a7a + .word 0x48053e45 + .word 0x0003720c + .word 0x57bfd318 + .word 0xfffea5dd + .word 0xdf0c2761 + .word 0xfffebad0 + .word 0xf4df7ff5 + .word 0x0003a3d0 + .word 0x323aad34 + .word 0xfffe6ccd + .word 0x570fc374 + .word 0xfffcb6ef + .word 0x61e85a08 + .word 0x0001fbee + .word 0x31747928 + .word 0xffff94f7 + .word 0xf5922d5c + .word 0xffffad5c + .word 0x3cbbb118 + .word 0xfffeb6b8 + .word 0x651b83ce + .word 0x00036ef9 + .word 0xfa8154b0 + .word 0xfffca566 + .word 0xf5701fa6 + .word 0xfffdad8a + .word 0xc0a466e4 + .word 0x0001ef27 + .word 0xc46af708 + .word 0x00008825 + .word 0xae38d291 + .word 0xfffd1abc + .word 0x61813867 + .word 0xfffc13ba + .word 0x0ef2d31c + .word 0xfffd71d1 + .word 0x1f3e7c25 + .word 0xffff848a + .word 0x61cd0327 + .word 0x00003917 + .word 0x824272a9 + .word 0xffff6ffe + .word 0x4eb35988 + .word 0x00016845 + .word 0x68fa18b6 + .word 0xfffc215d + .word 0x91c459bb + .word 0xffffc9db + .word 0xef14b2a2 + .word 0xffffca94 + .word 0x11d32bbf + .word 0x00006b45 + .word 0xa4f27ea9 + .word 0xfffffde6 + .word 0x4b5fa3d2 + .word 0x0003657b + .word 0x4aa28964 + .word 0x00014b42 + .word 0xb2e84faa + .word 0xfffd0ddf + .word 0xe6e9fdc7 + .word 0x000024d0 + .word 0x99648c13 + .word 0xfffec0ff + .word 0x50710e87 + .word 0x00020f30 + .word 0x5ccbad6d + .word 0x00027bdd + .word 0xfede7124 + .word 0x0003377a + .word 0xaba5163b + .word 0xfffd34bc + .word 0x185f78aa + .word 0xffff028c + .word 0x9d033ac5 + .word 0xfffc5994 + .word 0x58520b2f + .word 0xfffd342a + .word 0x695c61e2 + .word 0xffff8670 + .word 0xb88fda48 + .word 0xfffcb069 + .word 0x9d0e6e30 + .word 0xfffed192 + .word 0x24ef379f + .word 0xfffe8164 + .word 0xa235a14c + .word 0xffff99c3 + .word 0x46c428f3 + .word 0x0003ce44 + .word 0x777bcd0e + .word 0xffff99d2 + .word 0x173ecf56 + .word 0xfffc563a + .word 0xf0d1b378 + .word 0xfffcd0c5 + .word 0xce7cbbe7 + .word 0x0001c732 + .word 0x7b459e07 + .word 0xfffc874a + .word 0xb5563149 + .word 0xfffc2280 + .word 0x1c6c6111 + .word 0xffffa891 + .word 0x9736cb48 + .word 0xfffee807 + .word 0xf588d1b0 + .word 0xffff29ae + .word 0xb5db52d9 + .word 0x00001a14 + .word 0xc26af521 + .word 0xfffdbf70 + .word 0x4fd4edd6 + .word 0x00022d2a + .word 0xa8bbed8c + .word 0xfffff911 + .word 0x36646484 + .word 0xfffcbbe3 + .word 0xb86040b7 + .word 0x0001cb08 + .word 0xe3d342ff + .word 0xfffd9bf8 + .word 0x70ce3b87 + .word 0x0002028b + .word 0xb5894103 + .word 0x000011d5 + .word 0xe432a742 + .word 0x0001a913 + .word 0x634f6988 + .word 0xfffd69a1 + .word 0x9aad47ef + .word 0xfffed55c + .word 0x228064e7 + .word 0xfffc47c1 + .word 0xa8c92fed + .word 0xfffd25c3 + .word 0x7c332ee8 + .word 0xfffd5ea0 + .word 0xaa943bb8 + .word 0xfffe1036 + .word 0xea558a05 + .word 0x0003ba2c + .word 0x5a3e42a6 + .word 0x000243ba + .word 0x935d0f48 + .word 0x00020660 + .word 0xeac342e3 + .word 0x000244bf + .word 0xa226a8a5 + .word 0x000001bb + .word 0x8e46cf7e + .word 0x00032367 + .word 0xb9059615 + .word 0xfffefaeb + .word 0x718ff3f0 + .word 0xfffc1a5d + .word 0xfd1b0328 + .word 0x000320f5 + .word 0x7a34d8eb + .word 0xfffda215 + .word 0x7f76de5c + .word 0xffffc53d + .word 0x7b53a601 + .word 0xffff3095 + .word 0xace93cd6 + .word 0xfffdbd53 + .word 0xa7d5a7f1 + .word 0x0000cde5 + .word 0xdcc76d12 + .word 0xfffd5890 + .word 0xf64daa93 + .word 0xfffeff0d + .word 0x713fb1e6 + .word 0x0001392f + .word 0x8ee3c430 + .word 0x00025005 + .word 0x70266574 + .word 0x00029e64 + .word 0x48bb4cb4 + .word 0x00009ac9 + .word 0xfe06a375 + .word 0x0002e30e + .word 0xa000c5c9 + .word 0x00029b1c + .word 0xb965ea66 + .word 0x0003f844 + .word 0x42d9b8de + .word 0x0002c71c + .word 0x2eab5f73 + .word 0xfffcb4c2 + .word 0xc938f3cb + .word 0x000010cf + .word 0x59c250d3 + .word 0xfffd6189 + .word 0x1071a270 + .word 0x0003df21 + .word 0x5bad09b4 + .word 0x0003d3e5 + .word 0x82b145f3 + .word 0xfffd3487 + .word 0xbcd54b5b + .word 0x00020d51 + .word 0x764c7614 + .word 0x00005606 + .word 0x3064c773 + .word 0x0001b0de + .word 0x6653c092 + .word 0xfffde68d + .word 0xbfac21dc + .word 0x00034ec4 + .word 0x63d0f508 + .word 0xfffde08c + .word 0x2a4dc9dc + .word 0x00039dd1 + .word 0x6f95c762 + .word 0xfffe324a + .word 0x882eb7c1 + .word 0x000324c4 + .word 0x766a4b55 + .word 0xfffc3665 + .word 0x010b5d15 + .word 0xffff50e7 + .word 0xcf6380b6 + .word 0xfffc964a + .word 0xdc3dfba2 + .word 0xfffed5a6 + .word 0x2e421b46 + .word 0xfffc2392 + .word 0x40b125c0 + .word 0xffff6f8d + .word 0x2756026f + .word 0xffff24d4 + .word 0x266ec33a + .word 0xffffa929 + .word 0xfc586ca7 + .word 0xfffc6bb3 + .word 0xddfe0070 + .word 0xffff00e7 + .word 0xcc9ef870 + .word 0xfffe9947 + .word 0x59bf8961 + .word 0xfffc9fe4 + .word 0x2e5e1de4 + .word 0xfffe826e + .word 0xb3a7f9c6 + .word 0xffffe0c7 + .word 0x29c53354 + .word 0x0001ebb9 + .word 0x9759dd16 + .word 0x0002f230 + .word 0x2978acd0 + .word 0xfffd5d63 + .word 0x40c90610 + .word 0x00039dc9 + .word 0xed2387d9 + .word 0xfffd333d + .word 0x09bc1d77 + .word 0xfffd5a18 + .word 0x222aa955 + .word 0x00036dd9 + .word 0x6929f1fd + .word 0x0001c22f + .word 0x508c3e7a + .word 0xfffc187d + .word 0x25674c00 + .word 0x000171db + .word 0x9335a32e + .word 0xfffd40ba + .word 0x6b01dba8 + .word 0x0003b664 + .word 0x204f7d3a + .word 0x0001b9b0 + .word 0xa6295770 + .word 0xfffd7582 + .word 0xffa49db1 + .word 0xfffe3a5f + .word 0xb6322b5c + .word 0xffff7f68 + .word 0xa5c8d2ae + .word 0x000254b8 + .word 0x12737278 + .word 0xfffc4d81 + .word 0xc216da4e + .word 0x00037e07 + .word 0x5756d667 + .word 0xfffee8f8 + .word 0x24fd8eff + .word 0x0001cfb3 + .word 0x92dbeb8c + .word 0x0001f5e7 + .word 0x7bd9e140 + .word 0x0000a09f + .word 0x2d0f0ef9 + .word 0x000196e8 + .word 0x8a124918 + .word 0x000047dc + .word 0x197c7346 + .word 0xfffdfe07 + .word 0x5ccb7632 + .word 0xfffd76e6 + .word 0xa275834b + .word 0x000253b0 + .word 0x9eba64bf + .word 0xfffc433a + .word 0x8e93dcd4 + .word 0xffff8759 + .word 0xc5417c3e + .word 0xffff790e + .word 0x8885dff9 + .word 0xfffd2246 + .word 0x6f355bab + .word 0x0003911a + .word 0xf11a7291 + .word 0xfffdb32c + .word 0x7364f08f + .word 0x0002a588 + .word 0x0e19dc43 + .word 0x0001f5a0 + .word 0xab443d17 + .word 0x000024f6 + .word 0x66a6b969 + .word 0x00027818 + .word 0xa2ec7058 + .word 0xfffe042f + .word 0x81a3d67e + .word 0xfffcc59f + .word 0x36d1503a + .word 0x0001786f + .word 0x00ee5dc7 + .word 0x000306e1 + .word 0x48d83f27 + .word 0x0001acd5 + .word 0x6be9c3e5 + .word 0x00029dff + .word 0xb433a505 + .word 0x000111b9 + .word 0x60f2a063 + .word 0x00008590 + .word 0x2dd56576 + .word 0x0001165d + .word 0x8bf9d210 + .word 0x00031a5c + .word 0x27e40124 + .word 0x0003dd82 + .word 0x4ba7979f + .word 0x000247c7 + .word 0xcdd931c2 + .word 0x0003f677 + .word 0x75c4aaa1 + .word 0xfffe0fed + .word 0x71e418e3 + .word 0x0001b788 + .word 0x6496cba2 + .word 0xfffdc43f + .word 0x53fb76e0 + .word 0xffffcee9 + .word 0xffbcb07b + .word 0x000238c0 + .word 0xb1df75d0 + .word 0xffff415a + .word 0xbeca43df + .word 0xfffd041d + .word 0xd25e02a6 + .word 0x000251b4 + .word 0xfd7a8be5 + .word 0x000369a1 + .word 0x0b386b6f + .word 0xffff7f3e + .word 0xa7d7c229 + .word 0xfffd4201 + .word 0x80130f92 + .word 0xfffea161 + .word 0x312fb135 + .word 0xfffc44f8 + .word 0x78052e0c + .word 0x000043a2 + .word 0xeb52e9d3 + .word 0x00013030 + .word 0x5dccb322 + .word 0xffff3601 + .word 0xbf608433 + .word 0xfffd358e + .word 0x7a8b56a1 + .word 0x00037d3e + .word 0x025dfed5 + .word 0x00005e30 + .word 0x57520864 + .word 0xffff4aa7 + .word 0x4835f35b + .word 0x00035a02 + .word 0xa5cb7e05 + .word 0xfffed2d7 + .word 0xcad73b3b + .word 0xfffe34d9 + .word 0x22bd855e + .word 0x0000dead + .word 0x23e2264e + .word 0x00009561 + .word 0x0a8fe031 + .word 0xfffede35 + .word 0x4d5c49bc + .word 0x00035e6f + .word 0x7cbd033d + .word 0xfffefddb + .word 0xbdee9168 + .word 0xfffee685 + .word 0x19137b75 + .word 0x00005be5 + .word 0x9006ddfe + .word 0xfffe3e67 + .word 0x422d11db + .word 0x0001264f + .word 0xfb9d8af1 + .word 0xfffc4f5d + .word 0x067da30a + .word 0x00014365 + .word 0xe155fba1 + .word 0xfffde2f0 + .word 0xa58b8dff + .word 0xfffc2ade + .word 0x155b0448 + .word 0xfffdf979 + .word 0xca480886 + .word 0x000359a8 + .word 0xf89c5e02 + .word 0xfffd0169 + .word 0x6c13922e + .word 0x000052d6 + .word 0x83d64518 + .word 0xfffcf153 + .word 0xf6897369 + .word 0x0001796c + .word 0x927c9299 + .word 0x0001bebf + .word 0x9991a9e1 + .word 0x0003f976 + .word 0xf4c8ab03 + .word 0xffff638a + .word 0x95944ed0 + .word 0x00025a0d + .word 0x74bdbff0 + .word 0xffff834e + .word 0x632d6c47 + .word 0xfffd22f9 + .word 0x0f5ac4c7 + .word 0xfffd6c02 + .word 0x37cf955e + .word 0x000117b3 + .word 0x81aa1b18 + .word 0xfffcaf0d + .word 0xd5b106b7 + .word 0x00007c66 + .word 0x68283e46 + .word 0xfffd224b + .word 0x431bbbbd + .word 0x0001348a + .word 0x2e6dc280 + .word 0xffff3592 + .word 0x3728a348 + .word 0xffff614d + .word 0x667f6f8d + .word 0xfffdd28c + .word 0xafce04cf + .word 0x000214ab + .word 0xcbe7cabb + .word 0x0001efcf + .word 0x7c35f74a + .word 0xfffef565 + .word 0x62ed0f20 + .word 0x0000381c + .word 0x33871b76 + .word 0xfffda713 + .word 0x9390da68 + .word 0xfffc7b30 + .word 0xc7941877 + .word 0x0002e364 + .word 0x80854f37 + .word 0xfffeb443 + .word 0xa7177eb3 + .word 0xfffe9e96 + .word 0x0865b775 + .word 0x0001641f + .word 0x8c5f784b + .word 0xfffc52bc + .word 0x3795ca53 + .word 0xfffec77d + .word 0x867fead0 + .word 0xfffdb7fd + .word 0x2c299e62 + .word 0x00024262 + .word 0xa0d9285e + .word 0x0002af28 + .word 0xe37f68bc + .word 0x00014a41 + .word 0x41e7886a + .word 0x00001420 + .word 0x40b8d85c + .word 0x0000b7e2 + .word 0x7e69bfb6 + .word 0xfffd1ede + .word 0x1bf5eeef + .word 0x0000e35a + .word 0x5d13eff1 + .word 0xffff0aff + .word 0x8cbe473b + .word 0xfffc51ce + .word 0x6a67b73b + .word 0x00004654 + .word 0xae925ba7 + .word 0x00016f11 + .word 0x293bed91 + .word 0xfffe3b28 + .word 0xe01b40ab + .word 0xffff08df + .word 0x6a956035 + .word 0x0001a5b8 + .word 0xd2545128 + .word 0xfffd65f9 + .word 0xdaf88855 + .word 0xfffea750 + .word 0x5979f3b8 + .word 0x0000754e + .word 0xd9a254f4 + .word 0xfffead00 + .word 0x6a47b997 + .word 0x0000a9cd + .word 0xca27ec56 + .word 0x0002ade8 + .word 0xf7d63028 + .word 0x000179bb + .word 0xe5eedc3c + .word 0xfffd68f4 + .word 0x2d0f5b01 + .word 0x0003c052 + .word 0x3d2bdc04 + .word 0xfffc373f + .word 0x7da9a57b + .word 0xfffc7126 + .word 0x956842eb + .word 0xfffee232 + .word 0x3b32bc17 + .word 0xfffea0a2 + .word 0xd34881be + .word 0x00001fb9 + .word 0x745327dd + .word 0xffff417d + .word 0x74dc662a + .word 0xfffc73d5 + .word 0x0229f856 + .word 0xfffd8d44 + .word 0x150a3e2c + .word 0xfffff357 + .word 0x7e04008d + .word 0xfffdf02d + .word 0xb98ce2af + .word 0xfffcb138 + .word 0x581293dd + .word 0x00002ab1 + .word 0xc0524458 + .word 0xffff1f35 + .word 0x12a84cc1 + .word 0x000199e4 + .word 0xb2403be5 + .word 0xfffd78bc + .word 0xbe40521e + .word 0x0003d94c + .word 0xde063b91 + .word 0xfffdf48b + .word 0xb56a8907 + .word 0xfffceef4 + .word 0x26351d58 + .word 0xfffe8f7e + .word 0x1544e8b3 + .word 0xfffce00f + .word 0x5f3825d5 + .word 0xffffa9bc + .word 0x2e964ec9 + .word 0x0001320c + .word 0x68f2236f + .word 0xfffc83cb + .word 0xa6ab7909 + .word 0x0003b539 + .word 0xeb8b4599 + .word 0x00024673 + .word 0x14b3f119 + .word 0x000040d6 + .word 0xdd3afcff + .word 0xfffc0230 + .word 0xd9b1e464 + .word 0x0003d677 + .word 0xa061b964 + .word 0xfffdb9aa + .word 0x7d5dda47 + .word 0x0002e1eb + .word 0x3b866047 + .word 0x00029193 + .word 0x24164545 + .word 0xfffe3a10 + .word 0xb7e0d65d + .word 0x0001b576 + .word 0xc5d70f99 + .word 0x000386a3 + .word 0xd5001e7f + .word 0x0001fc75 + .word 0xf4d0e519 + .word 0xfffe6397 + .word 0x647aac9e + .word 0x0002093f + .word 0xec4664d1 + .word 0xffff326f + .word 0x92e879fe + .word 0x00038be1 + .word 0x88310472 + .word 0x0000e794 + .word 0xbd851577 + .word 0x00006aab + .word 0x3f241ea0 + .word 0xfffc17ce + .word 0xae66a55b + .word 0xfffcf176 + .word 0x0ccfe6ac + .word 0xfffd2247 + .word 0xe8afda68 + .word 0xfffd43bf + .word 0xa6e844c7 + .word 0x00004380 + .word 0x4f176a63 + .word 0x0001068a + .word 0x71bcd42e + .word 0x0001bcbe + .word 0x42ca9710 + .word 0xfffeaabf + .word 0x37915692 + .word 0xfffc5e69 + .word 0xdb560279 + .word 0xfffd967a + .word 0x1e7e83d9 + .word 0xfffd0503 + .word 0x7d5a1ea7 + .word 0xfffe48ce + .word 0x8cafa42d + .word 0xfffcb1be + .word 0x1c9b4efb + .word 0xfffcaf91 + .word 0x9d02e2da + .word 0xfffe3f60 + .word 0x488068fb + .word 0xfffeee8e + .word 0x51998877 + .word 0x00032746 + .word 0x6fcd50ef + .word 0xffff2838 + .word 0x11ef88ca + .word 0xfffedad5 + .word 0x31a8f50d + .word 0xfffc803d + .word 0x8062123b + .word 0xfffc2113 + .word 0x2c78e5ec + .word 0xfffc27c7 + .word 0xc33bed62 + .word 0xfffddcf3 + .word 0xbdb7efc2 + .word 0xfffc43f3 + .word 0x2b18071a + .word 0x0001bff6 + .word 0x0f48caea + .word 0xfffd251e + .word 0xed0d70dd + .word 0xfffcb347 + .word 0x0a11aaf7 + .word 0xfffee62c + .word 0xceef198a + .word 0xfffffec8 + .word 0xaff1b263 + .word 0x00005979 + .word 0x1370011e + .word 0xfffda6cf + .word 0x8ea97806 + .word 0x00039972 + .word 0x719b882d + .word 0xfffe2452 + .word 0xdbd552ac + .word 0x00000883 + .word 0x32ddc42a + .word 0x000023e8 + .word 0x11fa584e + .word 0xfffcf19b + .word 0x418226ae + .word 0xfffdfc17 + .word 0x67d0bafb + .word 0xffff08e8 + .word 0xadceca44 + .word 0x0002d2d4 + .word 0xcb20564b + .word 0xfffd5cc8 + .word 0x80d9f493 + .word 0x0001895a + .word 0xbf19946a + .word 0xfffe1150 + .word 0xcf9f6038 + .word 0xfffc5564 + .word 0xb21ac875 + .word 0x00014bcb + .word 0x3d6cddb1 + .word 0x00016585 + .word 0xbc4a8478 + .word 0x00020bd8 + .word 0x2c33e6e1 + .word 0x0002dcf8 + .word 0xdbd030fb + .word 0xfffc3c41 + .word 0xe4541870 + .word 0x0001b33a + .word 0x984743ba + .word 0x00022ff4 + .word 0xaee75c70 + .word 0x00030700 + .word 0x6249323f + .word 0xfffebfe8 + .word 0x5fca8da2 + .word 0x00030e86 + .word 0x3c27d9ee + .word 0xfffc613e + .word 0xd90adceb + .word 0x0000e09b + .word 0x8ae4baf0 + .word 0xfffc46c6 + .word 0xfd16a6c8 + .word 0xfffe73c3 + .word 0xb5b89e30 + .word 0xfffd83fa + .word 0x541cbd75 + .word 0xfffc8829 + .word 0xc80b2cec + .word 0xfffd5672 + .word 0xaa4e1f24 + .word 0x0001fd78 + .word 0xb3b187ce + .word 0xfffd900b + .word 0xe5f9ea85 + .word 0xfffdf684 + .word 0xa6bfa940 + .word 0x00024e30 + .word 0xe69c5d09 + .word 0xfffc39cb + .word 0x986d28e4 + .word 0xfffed27b + .word 0xd75fd1e2 + .word 0x00034f39 + .word 0xa820a820 + .word 0x0003ce81 + .word 0x35d597e8 + .word 0x00006022 + .word 0xf42c0a57 + .word 0xfffc1365 + .word 0xeb1aea01 + .word 0x000107c9 + .word 0x1a2d9369 + .word 0xfffcffbd + .word 0x927f46d9 + .word 0xfffc43b5 + .word 0xb5c78082 + .word 0xffff5671 + .word 0xdf8309b2 + .word 0x0003773c + .word 0x3ceac8b6 + .word 0xfffc94b4 + .word 0xf6247750 + .word 0xffff6428 + .word 0x482cdb10 + .word 0xfffcff92 + .word 0xb3128c0b + .word 0xfffd4a25 + .word 0xdcbefd5b + .word 0x00000ca1 + .word 0xbc752380 + .word 0xfffffdb9 + .word 0xb826b488 + .word 0x000073cf + .word 0x7f193cfc + .word 0x000152c5 + .word 0x57f5a285 + .word 0x0003b086 + .word 0x0dff3377 + .word 0x00025a3b + .word 0x66e2e92c + .word 0x0000b27b + .word 0xf7e93a11 + .word 0x0001b164 + .word 0x05bc07c0 + .word 0xfffdcc17 + .word 0xbc254f9a + .word 0x00021689 + .word 0xbc5bc492 + .word 0x0003587c + .word 0x589ad34b + .word 0xfffcfc3a + .word 0x7cf6a20d + .word 0x0000a020 + .word 0x67dd153e + .word 0xfffcbba8 + .word 0xefd35cf2 + .word 0xffffa7b6 + .word 0x240d75c9 + .word 0xfffe34d4 + .word 0xa77e07b1 + .word 0x0003c223 + .word 0xf3e3f075 + .word 0x0000b1e1 + .word 0xf0b368ac + .word 0x0001a4fc + .word 0xaaa01054 + .word 0xfffe690f + .word 0x312f243d + .word 0x0003ecde + .word 0xd38ee3fa + .word 0x00032a9f + .word 0x8177bc58 + .word 0x00039e7a + .word 0xded6fae9 + .word 0x00001188 + .word 0x4778aeaa + .word 0x00006141 + .word 0x920bf866 + .word 0xfffe0212 + .word 0x0ccd9571 + .word 0x0001a209 + .word 0xd0c8e306 + .word 0x00033e7e + .word 0x6baf3564 + .word 0xfffe974a + .word 0xbf383b17 + .word 0xfffde9a2 + .word 0xcc8593ee + .word 0xfffe6cf5 + .word 0xeaa293e4 + .word 0xfffdea65 + .word 0x231bd8b2 + .word 0x000240f5 + .word 0xdb598f7f + .word 0xfffddbca + .word 0xf21fdf80 + .word 0x0002cc8f + .word 0x099fcc17 + .word 0x0002fb1b + .word 0x39791f6a + .word 0xfffdfb16 + .word 0x6b35203a + .word 0x0001e995 + .word 0x2cc0aa27 + .word 0xffffc076 + .word 0x67856570 + .word 0x00024987 + .word 0x65b42e8a + .word 0x0001e547 + .word 0x0617cea4 + .word 0xfffdb8d7 + .word 0x3c7648df + .word 0x00010be0 + .word 0xf488c2f4 + .word 0x0003085e + .word 0x20c8b618 + .word 0x000215b8 + .word 0x1dd9ad73 + .word 0x0001d57f + .word 0x22449047 + .word 0xfffd0be0 + .word 0x05f6355f + .word 0xfffed7d8 + .word 0x83d85d10 + .word 0x00016af9 + .word 0x6049dc53 + .word 0xfffff3fd + .word 0x5b793864 + .word 0x00011cc7 + .word 0x18b44142 + .word 0xfffecd81 + .word 0xc19e5c9e + .word 0x00016ace + .word 0x63dcd006 + .word 0xfffc005c + .word 0xfd11ead4 + .word 0xfffcc916 + .word 0x87aa4e2c + .word 0x0002763e + .word 0xa8343dd8 + .word 0xfffccfd4 + .word 0xcd9ed068 + .word 0x00003583 + .word 0x85498706 + .word 0x00016945 + .word 0xf7de56a4 + .word 0xfffc8d02 + .word 0xf747f8f2 + .word 0x00030795 + .word 0x6974bb6b + .word 0x0003e7fc + .word 0x9699754b + .word 0x0003d0a4 + .word 0xd3410f59 + .word 0x0001e567 + .word 0xe701103f + .word 0x00016959 + .word 0xcb53ed65 + .word 0xfffc850a + .word 0xdf28bf61 + .word 0x0003ef7b + .word 0x41f94075 + .word 0x000083ed + .word 0x28b1999b + .word 0xffffce15 + .word 0x668e8bd0 + .word 0x000254d1 + .word 0xf86b3d7c + .word 0x000201d3 + .word 0x8ae84d1b + .word 0x00022a03 + .word 0x7559405f + .word 0x0002d0de + .word 0xa7181011 + .word 0x0000bc26 + .word 0x96c7d3e2 + .word 0xfffe6c1a + .word 0x81629a76 + .word 0xffffb3cf + .word 0x63b0e0a6 + .word 0x000335ba + .word 0xcd3f67ca + .word 0x00030453 + .word 0x10b4ef34 + .word 0xfffd247e + .word 0x2e6b58cb + .word 0xfffc7f0c + .word 0x67ded75a + .word 0xfffd37f9 + .word 0xe5e139f4 + .word 0x000202f8 + .word 0x8e7337e3 + .word 0x00016ca1 + .word 0x729fe934 + .word 0x000076bb + .word 0x6309cc1f + .word 0x0000166d + .word 0xb79070ea + .word 0xffffdf4c + .word 0x70721581 + .word 0x0001244d + .word 0x1ade246c + .word 0x00025420 + .word 0x83648639 + .word 0xffffc607 + .word 0x18081f98 + .word 0x00014a8d + .word 0x18d9ec74 + .word 0xfffd148a + .word 0xa67cd68a + .word 0xfffec08f + .word 0xd7d9221d + .word 0xffff4ddc + .word 0xc90ed642 + .word 0x00012755 + .word 0xb4e259bf + .word 0x00007669 + .word 0x7a9d55ff + .word 0xffffdb7c + .word 0x3a63a64c + .word 0x000081d7 + .word 0xf560cf74 + .word 0x000376b1 + .word 0x3e813995 + .word 0x00022d2c + .word 0x5b9e8680 + .word 0xfffe541e + .word 0xf6985d01 + .word 0xffff3088 + .word 0x66258a3e + .word 0x0001b405 + .word 0x53d663a8 + .word 0x0003cf49 + .word 0x4a56cb6e + .word 0x000096d0 + .word 0x0dc2c45d + .word 0xfffce4c3 + .word 0x0706c3ca + .word 0xffff0862 + .word 0xb7e7c74c + .word 0x0002881f + .word 0xba6a0c68 + .word 0xfffde674 + .word 0x44d9b6f3 + .word 0x00023dd5 + .word 0x2b249cab + .word 0xfffc5ba9 + .word 0x851d9121 + .word 0x00001400 + .word 0x7a30e191 + .word 0xffff21dd + .word 0x9f07eceb + .word 0xfffcb53c + .word 0xf3fbaa48 + .word 0xfffeb19a + .word 0xe6d220f1 + .word 0x0000a4c5 + .word 0x2a48d463 + .word 0x000301c9 + .word 0x874492ef + .word 0xfffd2be8 + .word 0xeba900f7 + .word 0x0001d20a + .word 0x3dc93375 + .word 0x000109b6 + .word 0xf66c2e09 + .word 0xfffca385 + .word 0x9e0cc033 + .word 0xfffe00df + .word 0x5a0c9113 + .word 0x0002159e + .word 0xe7efc61c + .word 0xffff7c42 + .word 0x99430183 + .word 0x000098ae + .word 0x04facf47 + .word 0x0003f895 + .word 0xafa3c3e9 + .word 0x0002e889 + .word 0x55621121 + .word 0xfffdfc6c + .word 0x9a7e1ae0 + .word 0xffff8519 + .word 0x8d499732 + .word 0x000093e9 + .word 0x2a8f3e58 + .word 0x0002a5ed + .word 0x015d20ee + .word 0x0000e01f + .word 0x27e54b9b + .word 0xfffc0354 + .word 0xff980285 + .word 0x000345c4 + .word 0x6ceac27f + .word 0x0003afc5 + .word 0xec334c47 + .word 0x0003c0e3 + .word 0xb3583d8d + .word 0xfffdc3c1 + .word 0xe9461ed9 + .word 0x0000aada + .word 0x1a73a394 + .word 0x00022106 + .word 0x0150e9cc + .word 0x0000ed6b + .word 0x6f3d6460 + .word 0x000274e8 + .word 0xa7740809 + .word 0x0000d577 + .word 0x34e79936 + .word 0xfffc767e + .word 0x59f35f80 + .word 0xffff5678 + .word 0x963b3784 + .word 0xfffc66d9 + .word 0x92e99c19 + .word 0x00033927 + .word 0x04f58ddc + .word 0xfffd7dcf + .word 0xab24e42e + .word 0xffff9675 + .word 0x8ec48476 + .word 0xfffcb175 + .word 0xe61ddd53 + .word 0xffff2d8f + .word 0x3cdaa7b9 + .word 0xffff5f86 + .word 0x02e455ea + .word 0x0001c4aa + .word 0x8d11dbca + .word 0xfffc3edb + .word 0xc17534c0 + .word 0xffff0384 + .word 0x2c0f0143 + .word 0xfffe2245 + .word 0x846c3f4d + .word 0xfffe487a + .word 0xbbce6758 + .word 0xffffb5f9 + .word 0x2e498b37 + .word 0x00021959 + .word 0xe7735363 + .word 0xfffd3797 + .word 0x08fbbd67 + .word 0xfffd5965 + .word 0x2f3dcfa7 + .word 0x00008d54 + .word 0x10477379 + .word 0xfffe5445 + .word 0x481dfedd + .word 0x00015aeb + .word 0x42481e43 + .word 0x00000b34 + .word 0x8cfb9907 + .word 0xffffda33 + .word 0x81c3c664 + .word 0x0003d548 + .word 0xe2d1a4f6 + .word 0xfffc341e + .word 0x6a3582e6 + .word 0x0002af5e + .word 0x4231b005 + .word 0x00008b12 + .word 0x60662ee2 + .word 0xfffeaf6a + .word 0x42949421 + .word 0x0002f2d5 + .word 0x30adf674 + .word 0x00034d59 + .word 0x765662c0 + .word 0xfffd5f06 + .word 0x5dc04693 + .word 0xffffb820 + .word 0xca456516 + .word 0xffffcb3b + .word 0x7d5f45a6 + .word 0x0001d38f + .word 0xfd53865e + .word 0xfffc6b01 + .word 0x6fff15e4 + .word 0xfffc76f8 + .word 0x3b3af482 + .word 0xffff0fa3 + .word 0xc2664985 + .word 0x00037278 + .word 0x8076f490 + .word 0x00010d2a + .word 0xad3bc14b + .word 0xfffc251c + .word 0xb39a2749 + .word 0xfffc1120 + .word 0x18c1d133 + .word 0x00012e88 + .word 0xa794ad2f + .word 0x00023be7 + .word 0x986a7e24 + .word 0x00016106 + .word 0x5ae58338 + .word 0x0001d157 + .word 0xd693c9d8 + .word 0xfffeb620 + .word 0xf2aed2ec + .word 0x000148ce + .word 0xeba1410a + .word 0x0000d992 + .word 0xb8e4f386 + .word 0x0002dcc9 + .word 0x8b5f28b0 + .word 0x0002c782 + .word 0xce0d9159 + .word 0xfffcedbc + .word 0x42f0238b + .word 0xfffc5eca + .word 0x8717e8ad + .word 0xfffdbdfb + .word 0x61a71353 + .word 0xfffd6e0e + .word 0xf3e57ba0 + .word 0x0000674c + .word 0xdca8ec77 + .word 0xfffdf818 + .word 0xc93d6745 + .word 0x00004a30 + .word 0xa41b29e6 + .word 0x00035a65 + .word 0x42e744b1 + .word 0xffffa942 + .word 0x0576ba6f + .word 0xffffb049 + .word 0xa625dc9c + .word 0xfffca706 + .word 0xcb68659a + .word 0xfffdc4ae + .word 0x0583fa3a + .word 0x00011cd7 + .word 0x97aa4db1 + .word 0x00020450 + .word 0x85b4d0d4 + .word 0xfffefe38 + .word 0x199e5e34 + .word 0x00007c28 + .word 0x6407db34 + .word 0xfffe5bb9 + .word 0x53873b2a + .word 0xfffc8b38 + .word 0xb24541ff + .word 0x00011053 + .word 0x251aef4e + .word 0x00000be9 + .word 0x1badc087 + .word 0x000314d3 + .word 0x467303bf + .word 0x0002d686 + .word 0x90bfa10e + .word 0x0000f740 + .word 0xe33245af + .word 0xfffcffef + .word 0xe93ad949 + .word 0xfffc2fc6 + .word 0xf4fba3e6 + .word 0x00019195 + .word 0x52747679 + .word 0x0001d3e5 + .word 0x7ec08d29 + .word 0x00023469 + .word 0x767258df + .word 0x00023534 + .word 0x4508ffb1 + .word 0x000193db + .word 0x419575aa + .word 0x000377ea + .word 0xd0650840 + .word 0xfffdacea + .word 0x75527c54 + .word 0xfffe43c3 + .word 0xd4831d86 + .word 0x0002ac09 + .word 0x62f9a5ab + .word 0x000385dd + .word 0x08d4689c + .word 0xfffcb503 + .word 0xf2b23888 + .word 0x00032a60 + .word 0x9a098058 + .word 0x00030c98 + .word 0x4313c6b2 + .word 0x0002724f + .word 0x5761bdd6 + .word 0xffffd456 + .word 0x27810c69 + .word 0x00008f1f + .word 0x5aaa5a5f + .word 0xffff75b3 + .word 0x416a6f74 + .word 0xfffd88f1 + .word 0x7fa94c87 + .word 0xfffe7bc4 + .word 0x5503d5cf + .word 0xfffde35e + .word 0x3139a861 + .word 0x0003d4fc + .word 0x381b4356 + .word 0x00039ccd + .word 0x26aa520b + .word 0xfffe39ce + .word 0xf7b9106e + .word 0x00038f36 + .word 0x45412c13 + .word 0x00030a1f + .word 0x9db1e2ae + .word 0x00020812 + .word 0x80989494 + .word 0xffffbd22 + .word 0x8ad206ee + .word 0x00028220 + .word 0x27df973d + .word 0xffffa3ba + .word 0xa3c25e50 + .word 0xfffff1f7 + .word 0x378745f6 + .word 0x0001017b + .word 0xbf4785c7 + .word 0xfffc358f + .word 0x694786f6 + .word 0xfffe870b + .word 0x698d12f5 + .word 0xfffeed3b + .word 0x7769b9e6 + .word 0x0003fae9 + .word 0xd585a23b + .word 0xfffe6a10 + .word 0xe17f2337 + .word 0x0003c750 + .word 0x57bae2cd + .word 0x0000628b + .word 0xedfb33b0 + .word 0xfffd9940 + .word 0x640a2711 + .word 0xfffd1f27 + .word 0x766fdeec + .word 0xfffdb015 + .word 0xb6769076 + .word 0xfffc6f04 + .word 0x7cdaa291 + .word 0xffff8ce1 + .word 0xd8a0b783 + .word 0x0000686b + .word 0xdc68b983 + .word 0xfffe3dc8 + .word 0xee2c8717 + .word 0xfffed8ba + .word 0xa67c6ace + .word 0xfffe49b3 + .word 0xc1a40d3c + .word 0xfffecdaa + .word 0xdbb4fea0 + .word 0xffff8961 + .word 0xb22898f4 + .word 0xffffc78c + .word 0x37dec359 + .word 0xffffb955 + .word 0xc5f6b841 + .word 0x0002e351 + .word 0x55b3dfcb + .word 0x00031e0f + .word 0xe7078950 + .word 0xfffd9a9f + .word 0x7c64314b + .word 0xfffcb8d6 + .word 0x8d8b0535 + .word 0xfffd407a + .word 0xf874c897 + .word 0xffff849c + .word 0x2263d8a2 + .word 0x0003d2c4 + .word 0xf774c23c + .word 0xfffcdec8 + .word 0x306f3879 + .word 0x000320be + .word 0x95ff52a9 + .word 0xfffd570e + .word 0xf3cc577c + .word 0x0001d9cd + .word 0x20559a37 + .word 0x0000e0e0 + .word 0xa2e1bcf5 + .word 0x0000cd8c + .word 0xde4ef132 + .word 0x00008f0f + .word 0xed2ccda6 + .word 0xfffef8bb + .word 0xe6c3e85d + .word 0xfffe32ad + .word 0x2accffb5 + .word 0xfffcac1b + .word 0xdf1a209e + .word 0xfffe7423 + .word 0xf071ed34 + .word 0x000137fa + .word 0x0f98f9fb + .word 0xfffe91d2 + .word 0x1d3e000a + .word 0x0001dae9 + .word 0x4ddcc66d + .word 0xfffce4be + .word 0x86ec4862 + .word 0x00007374 + .word 0xc2388085 + .word 0x000237a7 + .word 0xf78d3cb6 + .word 0x00014ccd + .word 0xe9d7d5c1 + .word 0xfffcd1cf + .word 0xf42c4be5 + .word 0xffff5755 + .word 0x34691e92 + .word 0x00028b1a + .word 0x067308a0 + .word 0x00017a70 + .word 0xe17baf6b + .word 0x00033b63 + .word 0xdbf3eb3e + .word 0x000062df + .word 0x33ad3872 + .word 0xfffff44f + .word 0x85ab155d + .word 0x00035562 + .word 0x78952dcd + .word 0xffff8400 + .word 0xd42c5b09 + .word 0xffff2c19 + .word 0xdd87567e + .word 0xfffe19a2 + .word 0xe9b6da94 + .word 0xfffca572 + .word 0xc9ccf06b + .word 0x00027cbc + .word 0x3813b89e + .word 0x0000e8ad + .word 0xdd59df6a + .word 0x0001b639 + .word 0xe8e82f10 + .word 0x0003a26b + .word 0x36e0c4f3 + .word 0xffff3bea + .word 0xa84178bf + .word 0x00029d6b + .word 0x700a5dd3 + .word 0xfffce966 + .word 0x540ebbc5 + .word 0x000115f0 + .word 0x0d5368ab + .word 0x0000b70a + .word 0xb4ad0796 + .word 0xfffec0f8 + .word 0x06d7b791 + .word 0xfffc2e27 + .word 0xcfaf2492 + .word 0x000125b1 + .word 0x8446122f + .word 0xfffd0fbf + .word 0x2ba719f7 + .word 0xffffbe4d + .word 0x299f3189 + .word 0x00022b06 + .word 0x4ade3394 + .word 0x0003f4a8 + .word 0x992a1b4e + .word 0xfffd410c + .word 0xfa0f2069 + .word 0xfffd6be4 + .word 0x537cfa60 + .word 0x00024c6d + .word 0x4d0a0374 + .word 0x0002859c + .word 0x02587a8c + .word 0x0003fce1 + .word 0x6dc06caa + .word 0xfffd5992 + .word 0x7d0cea19 + .word 0x00000c9c + .word 0xf7c3fde1 + .word 0xffff1a32 + .word 0x919d05ff + .word 0x00024b87 + .word 0x89ca3e35 + .word 0xfffc3417 + .word 0x180909ef + .word 0x0001cdf4 + .word 0x2b6be8ff + .word 0xffff46dc + .word 0x20c78156 + .word 0x0003f9e8 + .word 0x68f382f6 + .word 0x00028a25 + .word 0x8949c457 + .word 0x0003cf9f + .word 0x2659aec0 + .word 0xfffd4631 + .word 0xdf19a35b + .word 0x00023f5e + .word 0x4cfb3999 + .word 0x0000ba87 + .word 0x6414408b + .word 0xfffe1b0a + .word 0x160f2da1 + .word 0x00036bcb + .word 0x17cac7a0 + .word 0x000346fa + .word 0x0c3d78d1 + .word 0xfffe278a + .word 0xc81e1d05 + .word 0xfffe7d7f + .word 0x9735bb16 + .word 0x00021c86 + .word 0x24ba0da5 + .word 0xfffd6aa0 + .word 0x5bb871d7 + .word 0x0003b814 + .word 0x19b8d5c0 + .word 0xffff114b + .word 0x9e21e24e + .word 0x0000793c + .word 0x7616b2fa + .word 0x000358dd + .word 0xcd6f8a89 + .word 0xfffda765 + .word 0x58cef236 + .word 0x0000a62d + .word 0xfb34abbe + .word 0xfffc1c4f + .word 0x28f8c5fe + .word 0xfffd01d4 + .word 0x98a5ee78 + .word 0xfffcb2d4 + .word 0x47aa2176 + .word 0xfffe6786 + .word 0xf3da6d2a + .word 0xfffeef85 + .word 0x751a00d3 + .word 0x0002e180 + .word 0x5b132488 + .word 0xfffe3c37 + .word 0xbe66c374 + .word 0x00010365 + .word 0x06d8fd11 + .word 0x0002a1e1 + .word 0x1eec3a2a + .word 0x0003c4ca + .word 0x0a230829 + .word 0xffff6824 + .word 0x60364373 + .word 0xfffedf37 + .word 0x2a9459cd + .word 0xfffdbfea + .word 0xfa5f45bd + .word 0x000360ea + .word 0x406192d7 + .word 0x0001f0ff + .word 0xd9c52bf7 + .word 0x000071b2 + .word 0xf842833b + .word 0x0000ada3 + .word 0x1aea958a + .word 0x00007655 + .word 0xa9bf9702 + .word 0xffffcab3 + .word 0xe874594d + .word 0xfffdf688 + .word 0xdca486a9 + .word 0xfffc3d3b + .word 0x3a564b83 + .word 0xfffd0ed2 + .word 0xcfdd43cf + .word 0xfffc7303 + .word 0x576a3e04 + .word 0x000109aa + .word 0x5b7cd518 + .word 0x00027b73 + .word 0x7a7aeba8 + .word 0x000049e4 + .word 0xc95e0672 + .word 0xffff8a2b + .word 0xc12bef61 + .word 0x0001672e + .word 0x3e562af8 + .word 0x0000195c + .word 0xf37d8651 + .word 0xffff6fc5 + .word 0x8c2e5a54 + .word 0xfffe28f8 + .word 0xa8bb3b0f + .word 0xfffced29 + .word 0x6de85771 + .word 0xfffde9d1 + .word 0xfe8d4b7a + .word 0x000132ca + .word 0x28f52289 + .word 0x0003afc8 + .word 0xdf8754d1 + .word 0xffff24df + .word 0x0ff3e9dd + .word 0xfffd8a21 + .word 0x838a3e49 + .word 0xfffd6d9f + .word 0x31414593 + .word 0xfffdbab0 + .word 0xeddd2871 + .word 0xffff4eba + .word 0x3c607915 + .word 0x000194fa + .word 0xd06f2328 + .word 0xfffdecbc + .word 0x5538a179 + .word 0xfffc2143 + .word 0x94943dd0 + .word 0xfffe50f6 + .word 0x805a4655 + .word 0x00035609 + .word 0x928692f1 + .word 0xfffe39d7 + .word 0x6c0ff744 + .word 0xfffc4038 + .word 0x0d89d6fb + .word 0x000076b5 + .word 0xe9dab25b + .word 0x00011017 + .word 0x10b44878 + .word 0xfffe8321 + .word 0xbb3632f5 + .word 0x000076d9 + .word 0x65155a85 + .word 0xfffe3009 + .word 0x541ff83e + .word 0xfffe8600 + .word 0xa96d27c4 + .word 0xffffa87f + .word 0xc8421f01 + .word 0x00019bd1 + .word 0xe47d50a9 + .word 0xfffc258e + .word 0x8b83dcbb + .word 0xffff70b1 + .word 0x90730cee + .word 0xfffc23bd + .word 0xd8c3239e + .word 0x0001bfb8 + .word 0xf1460226 + .word 0xfffdc688 + .word 0xf188667a + .word 0xfffe59ac + .word 0x7349689b + .word 0xfffc0c2c + .word 0x86b2c9fa + .word 0x00009053 + .word 0x3632422e + .word 0xffff7078 + .word 0x3b54b637 + .word 0xfffd6c89 + .word 0xb4a4e500 + .word 0x000365fa + .word 0xf08ef9e8 + .word 0xfffe6565 + .word 0xe763afe8 + .word 0xfffc28a8 + .word 0x25756f8f + .word 0xfffe9297 + .word 0x0600feb2 + .word 0xffffb73d + .word 0x7eb45d72 + .word 0xfffe7a9d + .word 0x015024ff + .word 0x0003253b + .word 0xc7adfd71 + .word 0x0002523e + .word 0x875c9575 + .word 0x00001436 + .word 0xe0f9c6a3 + .word 0x00024254 + .word 0x171eef5c + .word 0x0002dc99 + .word 0xebb553ff + .word 0x000366a2 + .word 0x5c99dda3 + .word 0x00035713 + .word 0xcc287bc2 + .word 0x0000932e + .word 0x94c0643f + .word 0x000257ed + .word 0x0d41e9bf + .word 0x000143ac + .word 0x74767523 + .word 0xfffeccbf + .word 0x4bc7b11a + .word 0xffffe9b4 + .word 0x7c054e7d + .word 0x0002ac36 + .word 0x0326da0b + .word 0x0001063f + .word 0x3919e1fb + .word 0xfffc48c6 + .word 0xc8f30bd4 + .word 0xfffdc4aa + .word 0xfc788e32 + .word 0x00014939 + .word 0x8def397d + .word 0x0003b381 + .word 0xe2708f4f + .word 0x0003f7e4 + .word 0x3c28e574 + .word 0xfffc4b36 + .word 0xaa22b3c3 + .word 0xfffc71ad + .word 0x3d6234a8 + .word 0x00034a40 + .word 0x4d7d8346 + .word 0x000369bb + .word 0x04866cf6 + .word 0xfffe0906 + .word 0xb3df255e + .word 0xfffdb1ab + .word 0xe44c8e2c + .word 0xffffc727 + .word 0xd28cc6e8 + .word 0xfffee915 + .word 0x8c4866e5 + .word 0x0003eb8c + .word 0x56ffb600 + .word 0xfffc56d0 + .word 0x6ee16e21 + .word 0xfffd0259 + .word 0xc3586fef + .word 0xffff3940 + .word 0x2f9dcd22 + .word 0x0001f544 + .word 0x1815b0c4 + .word 0xffffe0a5 + .word 0xb1fa888d + .word 0xfffce3e3 + .word 0x55c32891 + .word 0xfffcf81b + .word 0xc2ba9e67 + .word 0x00014638 + .word 0xd5aa164e + .word 0x0000ae08 + .word 0xed7285eb + .word 0x0000a092 + .word 0x45843877 + .word 0x0000d4c6 + .word 0xe55065ef + .word 0x0003a3e2 + .word 0x0bcc0a6f + .word 0xfffcf79c + .word 0x7ca4c7b1 + .word 0x0000647e + .word 0x417e63c4 + .word 0x00029671 + .word 0xc9e6d731 + .word 0x0002f353 + .word 0xbe36d224 + .word 0xfffdc949 + .word 0x3d81efa5 + .word 0xfffc896a + .word 0x1db8e9f5 + .word 0xfffc1641 + .word 0x1763de12 + .word 0x0000ff66 + .word 0x8c884e13 + .word 0x00024c63 + .word 0x222ed184 + .word 0x0001dd55 + .word 0x8dfceb7c + .word 0xfffec102 + .word 0x93cab1c8 + .word 0xfffc07ae + .word 0xdfcadec5 + .word 0x00023302 + .word 0x178cce99 + .word 0x00032529 + .word 0xa2be1686 + .word 0x00017c00 + .word 0xabf6db16 + .word 0x00028cec + .word 0x58483d08 + .word 0x00039f52 + .word 0xb1180b70 + .word 0xfffd7dd5 + .word 0x22a24e98 + .word 0x0001cb11 + .word 0x401a167f + .word 0x00023683 + .word 0xe826056b + .word 0xffff6ea9 + .word 0xce908e13 + .word 0x000021ed + .word 0x20b61f3e + .word 0xffffc636 + .word 0xba48a0da + .word 0xfffca2d0 + .word 0x1576fcf2 + .word 0x0003d33f + .word 0x2f63f6e1 + .word 0x0002eeda + .word 0xc09a02f6 + .word 0x00004eaf + .word 0x5d5d258a + .word 0x0001709b + .word 0x7da124f9 + .word 0x0002a00d + .word 0xfe698d00 + .word 0xffffa230 + .word 0xffe6db21 + .word 0x0001286e + .word 0x124ad698 + .word 0x0003b748 + .word 0x19e61aa7 + .word 0x00012792 + .word 0x0191a459 + .word 0xffffd1b9 + .word 0x4998cec7 + .word 0xfffd08a8 + .word 0x367ca28e + .word 0x00012583 + .word 0x246e0820 + .word 0x00004cd7 + .word 0x2835c7bd + .word 0xfffd6e85 + .word 0xbc20bf65 + .word 0x0001b48c + .word 0xacbc78f6 + .word 0x0002d109 + .word 0x1f42e7a2 + .word 0xfffd4f0b + .word 0x20a9df66 + .word 0x00006744 + .word 0x69875d4a + .word 0xfffc4ae1 + .word 0xeb47bc92 + .word 0x00022141 + .word 0xf3f84725 + .word 0x0001249e + .word 0x679aa9f8 + .word 0x00026268 + .word 0xe8599620 + .word 0x00031022 + .word 0xf5f3eb92 + .word 0x00009861 + .word 0x09259f31 + .word 0x0000f2c0 + .word 0x35845a4f + .word 0xffff9e56 + .word 0x8066385f + .word 0x0000f8f7 + .word 0x37bcd088 + .word 0xfffeedf2 + .word 0x1e5e77cd + .word 0x0003ca5d + .word 0xb2a83f47 + .word 0x00024dbb + .word 0xcc539cbe + .word 0x00024cae + .word 0x695df8e8 + .word 0xfffdd691 + .word 0xa9046f93 + .word 0x00001aaf + .word 0xa0650904 + .word 0xffff205e + .word 0x00f91ce7 + .word 0xffff4b6a + .word 0x4c0b52d6 + .word 0xfffe0d10 + .word 0x22faa01e + .word 0x00026da7 + .word 0xce40a4ae + .word 0x0000fcd3 + .word 0x486e4acb + .word 0x0003bf0f + .word 0x9d8cd023 + .word 0xfffc2d3d + .word 0xd475d522 + .word 0xfffe1ffe + .word 0xd9264c16 + .word 0xfffd20c8 + .word 0xb7c1e63b + .word 0x00024f94 + .word 0x7ac4c0cf + .word 0x0003b1c1 + .word 0xfd79ea25 + .word 0x00037d79 + .word 0xe9f0c5df + .word 0x00039f77 + .word 0x4da54c53 + .word 0x000216c9 + .word 0x313c2a93 + .word 0x00029d86 + .word 0x9cdceea0 + .word 0xffff917b + .word 0xab615d5a + .word 0xfffef290 + .word 0xaa6bac6a + .word 0xfffe8442 + .word 0x0a351ffa + .word 0xfffd8fc5 + .word 0xa615ea8c + .word 0x0000beb5 + .word 0xb633eb13 + .word 0xfffdd247 + .word 0x40bba2ce + .word 0xfffde54b + .word 0xb49d991b + .word 0xfffdbb99 + .word 0x8a46ff77 + .word 0xfffe15d0 + .word 0xbfa54ab6 + .word 0xfffcb0fc + .word 0x112088c8 + .word 0x0001bd51 + .word 0x93b06656 + .word 0x0003ad31 + .word 0xf991bfe4 + .word 0x00004e0e + .word 0xd815bc9c + .word 0x00034a49 + .word 0x7fb2439d + .word 0x00035a3f + .word 0x7eacef7d + .word 0xfffedb29 + .word 0x8df3d433 + .word 0xfffd63be + .word 0x06909a56 + .word 0x0001ec2f + .word 0x268c3040 + .word 0x0001bec1 + .word 0x2944b320 + .word 0xfffc7954 + .word 0xcfb70809 + .word 0x0003247e + .word 0x06c7edd8 + .word 0xfffe3d9e + .word 0x807a88d1 + .word 0xfffc8147 + .word 0xabcd7be4 + .word 0xffff15a8 + .word 0x3ea41047 + .word 0xfffd21ce + .word 0xce947db0 + .word 0xfffe9c2c + .word 0x1bbcfb01 + .word 0x0003cfd7 + .word 0xdb7c011d + .word 0x000117c9 + .word 0xa75f6f8d + .word 0xfffeda3c + .word 0xd98589cc + .word 0x0002c961 + .word 0xfe340ccb + .word 0xfffe407b + .word 0xc76f5e44 + .word 0xffffb3d3 + .word 0x96caeeb2 + .word 0xfffd2ee5 + .word 0xcc871531 + .word 0x0002e99f + .word 0x839e4e07 + .word 0x0003198b + .word 0xe26826d6 + .word 0xffffa104 + .word 0x91ac6b57 + .word 0x00011beb + .word 0x911b48f1 + .word 0xfffe80b6 + .word 0x4e1ab3be + .word 0xfffc7ece + .word 0x859c578e + .word 0xffffd5a7 + .word 0xecc5ff87 + .word 0x00025213 + .word 0x9d685fce + .word 0x00010f34 + .word 0x9601e284 + .word 0x00015335 + .word 0xeb0351ba + .word 0x0001b612 + .word 0xaeeada87 + .word 0x0001c474 + .word 0x4d5e9cd2 + .word 0xfffeca7a + .word 0x31bd5269 + .word 0xffffdf19 + .word 0xfe2873bc + .word 0x0002292e + .word 0xc5891ad3 + .word 0x0000c041 + .word 0xd159e58a + .word 0x0000a393 + .word 0x1cbe1a8e + .word 0xfffe2d48 + .word 0xe5ebef35 + .word 0x0000db46 + .word 0xdaa29dd8 + .word 0x0000df24 + .word 0x093284c1 + .word 0xfffedb68 + .word 0xeb7e908d + .word 0xfffc3fe8 + .word 0xb95d4bba + .word 0xfffdba39 + .word 0xf4761b83 + .word 0xffff2ca9 + .word 0x366af613 + .word 0x000302e0 + .word 0xe31e7271 + .word 0xfffc8259 + .word 0xcae46d91 + .word 0x00037467 + .word 0x32c7b7ac + .word 0x0001377c + .word 0x5c119af6 + .word 0xfffee995 + .word 0x13005d39 + .word 0x00036ac7 + .word 0x01dac3f6 + .word 0x0003c22b + .word 0xf7d7ed1b + .word 0x00015008 + .word 0xeb11174d + .word 0xfffd0095 + .word 0xa1527082 + .word 0xffff0935 + .word 0x49e99673 + .word 0xffffaadf + .word 0x0202a4f6 + .word 0xfffdbbc4 + .word 0xda535050 + .word 0xfffd3f3a + .word 0xe98b0ea7 + .word 0xfffe77d4 + .word 0x20b8b260 + .word 0xfffd6b06 + .word 0x11508c03 + .word 0xfffe3d26 + .word 0x8ef26d60 + .word 0x000023eb + .word 0xceb5083d + .word 0x00028d7f + .word 0x8b5cf369 + .word 0x0001f458 + .word 0xb9888c0d + .word 0xfffe5137 + .word 0x3a95cebf + .word 0xffffdc3b + .word 0x4670dcaf + .word 0xffff1124 + .word 0x7361f13f + .word 0x000236c3 + .word 0x2f2795f9 + .word 0xfffd94c7 + .word 0xb26118e6 + .word 0xffff39d9 + .word 0xda1dbd31 + .word 0x00037176 + .word 0x15fdff25 + .word 0xffffda30 + .word 0xdb0e57be + .word 0x00009c70 + .word 0x4fe03428 + .word 0x000024a6 + .word 0xfe539598 + .word 0x00019568 + .word 0x4335395e + .word 0x0000c2d5 + .word 0xa890f03d + .word 0xfffcd6a4 + .word 0xfdd0f614 + .word 0x0003b346 + .word 0x80e04c78 + .word 0xffff6a99 + .word 0xde389e73 + .word 0xfffe19e3 + .word 0x7b02486a + .word 0xffff1711 + .word 0x85be0c49 + .word 0xfffcef48 + .word 0x79de80e0 + .word 0x0003c605 + .word 0x79bd238a + .word 0x0002de0d + .word 0x7606bfcf + .word 0x00037004 + .word 0xe84a624f + .word 0xfffe9694 + .word 0x34eeaf67 + .word 0x0001f3ba + .word 0x2c9d8294 + .word 0xfffc864c + .word 0x8aed367f + .word 0xfffc5bc0 + .word 0xd029b1b4 + .word 0xffff5edf + .word 0x2d1789b0 + .word 0xfffcab4f + .word 0x8555dc07 + .word 0x0000ca20 + .word 0x54391124 + .word 0x000046da + .word 0xb01852d4 + .word 0xfffd1b38 + .word 0xc46d3e07 + .word 0xfffcc73e + .word 0xcf18e6e9 + .word 0x0003af56 + .word 0x76b1fdb8 + .word 0xfffdde68 + .word 0x02ba8f37 + .word 0xfffc2fd8 + .word 0x746bb4d3 + .word 0x0002a71c + .word 0x78f235c9 + .word 0x0000ec7c + .word 0xcd6e25de + .word 0xfffc9db2 + .word 0x862aa62c + .word 0xfffe6e84 + .word 0xa60b5c64 + .word 0x00011e8c + .word 0xcba2a937 + .word 0x0003db2c + .word 0x35893998 + .word 0xfffed577 + .word 0xb4cc49b6 + .word 0x00036976 + .word 0x1a312b4e + .word 0xffff740f + .word 0xc8ce71bb + .word 0xfffe0a20 + .word 0x1ec54a5d + .word 0xfffd0c92 + .word 0xe77dc547 + .word 0x0002bced + .word 0x22f9fa75 + .word 0xffffed9d + .word 0x9133520f + .word 0xfffefb32 + .word 0xd3332012 + .word 0xfffe5894 + .word 0x60896cb5 + .word 0x0002360d + .word 0x3b92fb76 + .word 0x00018226 + .word 0x10cc6a63 + .word 0xffffde01 + .word 0xb882e64b + .word 0x0000282e + .word 0xb0939b09 + .word 0x00012651 + .word 0x6f3991ce + .word 0xfffe03e2 + .word 0xa1114898 + .word 0x00004ea1 + .word 0x09b4a59e + .word 0xffffc8fa + .word 0x82cef9ea + .word 0x0000df5e + .word 0xb4dcb70c + .word 0xfffe9b25 + .word 0xec9209f7 + .word 0x00034e7e + .word 0x5d2bee1f + .word 0xfffef5cd + .word 0x6a1dcf03 + .word 0xfffe3b7a + .word 0xe0b824c9 + .word 0x0000529b + .word 0x3dc541db + .word 0xfffc0fe2 + .word 0x7bfe7696 + .word 0x00037221 + .word 0x824f056b + .word 0x00025bfd + .word 0x17ae7000 + .word 0xfffe8e25 + .word 0x5ddb8c00 + .word 0xffff88d9 + .word 0x9dad9c4a + .word 0xfffe1ac0 + .word 0xb225f465 + .word 0xffff93c9 + .word 0x8fb4462f + .word 0x00001eb0 + .word 0x3f5d1d2e + .word 0xffff9e1e + .word 0x8289c641 + .word 0x0003d588 + .word 0x3acf1773 + .word 0x0001e1a8 + .word 0x1268dafa + .word 0x0001e90f + .word 0x9066476f + .word 0x00022dff + .word 0xcd308239 + .word 0x00031bef + .word 0x607322b1 + .word 0x000089f8 + .word 0x6a4426af + .word 0xfffe3702 + .word 0x1be062c3 + .word 0x00025353 + .word 0x08ea5ac9 + .word 0x0002714e + .word 0xee937bbb + .word 0xfffd3020 + .word 0x0e774fc4 + .word 0xfffcd197 + .word 0x79c939e6 + .word 0x0002c8cb + .word 0x81934e20 + .word 0x000365e4 + .word 0x6114ef11 + .word 0xfffdb3ba + .word 0x20378576 + .word 0xffffaba1 + .word 0xdec6307d + .word 0xffff912f + .word 0x406533d4 + .word 0xfffdf283 + .word 0x1679686b + .word 0x0003ca9d + .word 0x10285178 + .word 0xfffe5568 + .word 0xa84dbac2 + .word 0xfffc6894 + .word 0x815a7dd8 + .word 0x0002828b + .word 0x19db0ad4 + .word 0x000054b2 + .word 0x58e0b3b9 + .word 0x0001eba2 + .word 0xeaecc2d7 + .word 0x0000739e + .word 0x36e7d5cb + .word 0x0000bdbe + .word 0x3d062a2f + .word 0xfffd6fcb + .word 0xf460a28f + .word 0xfffcdbbd + .word 0x991b8d2a + .word 0x0001652c + .word 0x648820ae + .word 0xfffccac1 + .word 0x8ee2885a + .word 0xffff5d59 + .word 0xfb6960bd + .word 0xfffeeae6 + .word 0x9d65e466 + .word 0xffffd838 + .word 0x76ed12ca + .word 0x00034d64 + .word 0x961a8968 + .word 0xfffc19c7 + .word 0x4026d459 + .word 0xffff7a8d + .word 0xc160cc2c + .word 0xffffde99 + .word 0x3834e2ec + .word 0x00011e04 + .word 0xdb39b58e + .word 0x00034dc4 + .word 0x28af2a07 + .word 0xfffced67 + .word 0x22c34127 + .word 0xfffebc53 + .word 0x0a028d29 + .word 0x0002fbb5 + .word 0x54fbc4df + .word 0xfffd2a3d + .word 0x22ab4176 + .word 0x00001842 + .word 0x25a5c3ec + .word 0x000071d1 + .word 0x795266ba + .word 0xffffbcc0 + .word 0xbd6c5a94 + .word 0x0002585c + .word 0xf857068a + .word 0x0003caf1 + .word 0xd386ac1e + .word 0x00022e66 + .word 0x0f6f1e2b + .word 0x0003b980 + .word 0x5599f431 + .word 0xffff58b9 + .word 0xaf1d1d55 + .word 0x00039154 + .word 0xfa4c3c18 + .word 0x00031cce + .word 0x1ef60b44 + .word 0x00004713 + .word 0x4ebd96b7 + .word 0x0001e235 + .word 0x0e33b2cf + .word 0x000281d1 + .word 0xfb557f38 + .word 0xffff0780 + .word 0xea091830 + .word 0x0002d68f + .word 0x172cfdef + .word 0xffffb675 + .word 0xf8b22eec + .word 0xfffe6dd3 + .word 0x48a477b6 + .word 0xfffc0320 + .word 0x04988166 + .word 0x0003fa6d + .word 0x9d9cbc8c + .word 0x0002ea01 + .word 0xf307277e + .word 0xfffe8ba9 + .word 0xfa79d1dc + .word 0x0002115c + .word 0xec17de61 + .word 0xfffd6adc + .word 0x5577b697 + .word 0x0000cda1 + .word 0x5d1179f9 + .word 0xfffd7aa9 + .word 0x00f0ffeb + .word 0x00019f9c + .word 0x86be604a + .word 0x0001438d .global v64b .balign NR_LANES*4 v64b: - .word 0x223ac148 - .word 0xfffead3e - .word 0x4b609796 - .word 0xfffcbe34 - .word 0xb9c02faa + .word 0x486c687e + .word 0xfffd540b + .word 0x2ed432eb + .word 0xfffef0bc + .word 0x567c244a + .word 0x0000f29d + .word 0xed12cb67 + .word 0x00020d9a + .word 0x509105de + .word 0xfffc53be + .word 0x383a3ce5 + .word 0xffff1dd4 + .word 0xf151ef39 + .word 0xfffd2edf + .word 0xa0140599 + .word 0x00026754 + .word 0x3321dbd0 + .word 0xfffd0102 + .word 0x5c8e4359 + .word 0x0003b99e + .word 0xdad95ca3 + .word 0x00003def + .word 0xd10ed2a7 + .word 0x00020af9 + .word 0x0a579b59 + .word 0xfffdbec4 + .word 0xf13cd052 + .word 0x000081c2 + .word 0x721e5415 + .word 0xffff8ca3 + .word 0xb5566e48 + .word 0xffffd7ae + .word 0xe030e4e4 + .word 0xfffcc262 + .word 0x739fcbc3 + .word 0x00028f3f + .word 0xc7a81038 + .word 0x00014578 + .word 0x4d8b4508 + .word 0x0001a272 + .word 0xc8a54a31 + .word 0x00013ec9 + .word 0x5e1e3e3e + .word 0xfffdb9d6 + .word 0x9404b3f5 + .word 0x0003761d + .word 0x41af25d1 + .word 0x000020e2 + .word 0x77648c02 + .word 0xfffc2dfa + .word 0xaaba1745 + .word 0x0002473a + .word 0xa1a15ab2 + .word 0x00034253 + .word 0x0c990b9e + .word 0x00037014 + .word 0x78831d2e + .word 0xfffc9f0e + .word 0xf324dc37 + .word 0xfffd1d5f + .word 0xb7a6201f + .word 0xfffe923f + .word 0x613c5175 + .word 0x0002c284 + .word 0x7d41b1a1 + .word 0x00023d8f + .word 0xbce7d351 + .word 0xfffc4115 + .word 0xaf2575b3 + .word 0xffff1cf2 + .word 0xc3ab49b5 + .word 0x0001f77c + .word 0x9305384e + .word 0xfffebf26 + .word 0xf370b947 + .word 0xffff6771 + .word 0x15e9f153 + .word 0xffffd7fa + .word 0x33b0da43 + .word 0x00002515 + .word 0x421d77bb + .word 0xfffecea9 + .word 0x98713246 + .word 0xfffc8321 + .word 0x459ef299 + .word 0xffff3b11 + .word 0x51436018 + .word 0xfffeeec6 + .word 0x9135c411 + .word 0x0001c2d8 + .word 0x25445838 + .word 0xfffd5e85 + .word 0x6d88c0c2 + .word 0xfffd4196 + .word 0xda166039 + .word 0xfffce337 + .word 0x757b726d + .word 0x00021118 + .word 0x983ff591 + .word 0x00027901 + .word 0x25f0908d + .word 0x00037f53 + .word 0xee01adf3 + .word 0x00010536 + .word 0xef62867d + .word 0xfffcb214 + .word 0x362f2a97 + .word 0x000127fa + .word 0x10dcc0ea + .word 0xfffdebe5 + .word 0xd15ad44c + .word 0x0000af86 + .word 0x84beff6f + .word 0xffff3e2b + .word 0x5d6ca4c9 + .word 0xfffefa2b + .word 0x726091d2 + .word 0xffff3ff7 + .word 0xc9f7d810 + .word 0x0000d013 + .word 0x90dcf227 + .word 0xfffe87a0 + .word 0x44b7e664 + .word 0xffff9d84 + .word 0x6d22bd2c + .word 0xffff1add + .word 0xe6e50e66 + .word 0xfffec4f8 + .word 0x2e3bfa78 + .word 0xfffc0a3d + .word 0xc52ee851 + .word 0x00025de3 + .word 0x76a3f555 + .word 0xfffcd221 + .word 0x2310e1bb + .word 0xfffee874 + .word 0x7b4334d8 + .word 0x0000b052 + .word 0x50b3ca0f + .word 0x00001582 + .word 0x1050e5d5 + .word 0x0002d014 + .word 0xab3b3c93 + .word 0xffffe032 + .word 0x1936b378 + .word 0xfffce59b + .word 0xd26307d0 + .word 0xfffc3ab3 + .word 0x8653eb07 + .word 0x0003a744 + .word 0x44c9cec0 + .word 0x0001a482 + .word 0x517ed5bf + .word 0xfffcbc4f + .word 0xf733868b + .word 0xfffd444d + .word 0x29b3ef67 + .word 0x0002a5a7 + .word 0xf79db36a + .word 0x00034725 + .word 0x705d38e4 + .word 0x00031369 + .word 0x4a70e7c0 + .word 0x00024b54 + .word 0xced34361 + .word 0x00028920 + .word 0x8cf29d7b + .word 0x0003ab82 + .word 0xebde5086 + .word 0xfffd88c7 + .word 0x9cd68d07 + .word 0x00004009 + .word 0x932d19dc + .word 0x0001c182 + .word 0xb98b9934 + .word 0x0000a43e + .word 0x63c23ed8 + .word 0xfffdc556 + .word 0xdf3997d9 + .word 0xfffcfa71 + .word 0xca7a8485 + .word 0xfffd15ac + .word 0x1195a16b + .word 0x0003a503 + .word 0x693ea7c8 + .word 0x0000b865 + .word 0xb5de9a37 + .word 0x000022b9 + .word 0x8354977a + .word 0x00012a9b + .word 0x293f2f3b + .word 0x000013d0 + .word 0x09d77719 + .word 0x0000edad + .word 0xe5292758 + .word 0x0003d3d6 + .word 0x3c378e9e + .word 0xfffc5f1f + .word 0x737a94b7 + .word 0x0002e02f + .word 0x3e3ed39d + .word 0xfffd8e86 + .word 0x47411af9 + .word 0xffff2f1f + .word 0xccad1bcb + .word 0x00032f69 + .word 0x84cb4c56 + .word 0x0001cd0b + .word 0x2d1d8b60 + .word 0x00007050 + .word 0x5543367e + .word 0xfffed146 + .word 0xd2510c8c + .word 0x00037990 + .word 0x5f24abde + .word 0xfffc6e64 + .word 0xb53f6895 + .word 0xfffee4fd + .word 0x5433d70f + .word 0xfffcf50c + .word 0x904ea9b2 + .word 0xffff1f94 + .word 0xa7dee729 + .word 0xfffddbd8 + .word 0xc1a36709 + .word 0x0002f195 + .word 0xbdc639b7 + .word 0x0001f6de + .word 0x807144b7 + .word 0x0003bacd + .word 0x721ba7ef + .word 0x0000f3c3 + .word 0xee8f08e9 + .word 0xfffe20e2 + .word 0x6d2bc684 + .word 0x00009e7d + .word 0x0e7ff3ae + .word 0xfffec43f + .word 0xeedf09e2 + .word 0xffff621a + .word 0x649442ac + .word 0x0000c122 + .word 0x3be6a529 + .word 0xfffd284b + .word 0x6cb63d43 + .word 0x0003a380 + .word 0xc6c290c0 + .word 0xfffe38c6 + .word 0xba0709f4 + .word 0x000335a9 + .word 0x69cbe6a1 + .word 0x00019c92 + .word 0xc73f49ab + .word 0x00037fc4 + .word 0x2c87a200 + .word 0xfffffee5 + .word 0xd039be78 + .word 0xfffdd86e + .word 0x47abfc38 + .word 0xffff4061 + .word 0xc955c5b9 + .word 0x0003c08f + .word 0xc9e2efaa + .word 0xfffd5543 + .word 0xc079a253 + .word 0x00016093 + .word 0x89fb6d53 + .word 0xfffe033c + .word 0xfb15ada6 + .word 0xffff5838 + .word 0xeb16566e + .word 0xfffde82e + .word 0xb12cffa3 + .word 0xfffc6437 + .word 0xb71678c3 + .word 0x0002b99f + .word 0xf6005da4 + .word 0x00009e86 + .word 0x44d9121d + .word 0xfffe2d2f + .word 0xf5895f0f + .word 0x00016c39 + .word 0xbb33755d + .word 0xffff4cd0 + .word 0xc5390a60 + .word 0x0003e74b + .word 0x8bfeffbe + .word 0xfffdf839 + .word 0x3c52e98d + .word 0x00039819 + .word 0xfc0a603b + .word 0x0002e336 + .word 0xb8507dd0 + .word 0x00014481 + .word 0xeb81b898 + .word 0x00033338 + .word 0xe2d77ba7 + .word 0x000112f3 + .word 0x1b5506f5 + .word 0xfffe0148 + .word 0x282cdc0e + .word 0x00012331 + .word 0xa61ca84c + .word 0x0002a3b9 + .word 0x91883ae5 + .word 0x0002d53e + .word 0x3a45297c + .word 0xfffcfe40 + .word 0xcff0f22b + .word 0x00011037 + .word 0x3f8865e2 + .word 0xfffe4951 + .word 0x8f9f80f3 + .word 0xfffc6c37 + .word 0x2c2bf65d + .word 0xfffec3a5 + .word 0xe6ab62ee + .word 0xfffcf94a + .word 0x0a4f8046 + .word 0x0002b107 + .word 0xc1c297fb + .word 0x0001ffc2 + .word 0xf0634638 + .word 0x0003916d + .word 0x3041dfea + .word 0x0003bcda + .word 0xa3a2df9d + .word 0xffffbb51 + .word 0xe2cfe784 + .word 0xfffc1d8f + .word 0x8bdd4093 + .word 0x00011ec8 + .word 0x716f414a + .word 0xfffe043b + .word 0x30874d71 + .word 0x00038465 + .word 0x07b0ff11 + .word 0x00013f1f + .word 0xc61eaece + .word 0x00020a5d + .word 0x90c90470 + .word 0x0001f748 + .word 0x6a28ad5e + .word 0x000211bf + .word 0x0ff7ccd1 + .word 0x00024792 + .word 0xae2bed22 + .word 0x00023932 + .word 0x1364a697 + .word 0x00036fac + .word 0xc3c1e61b + .word 0x0001eadf + .word 0x4a3bae9e + .word 0xfffce2e2 + .word 0x82c4516b + .word 0x0000a1e9 + .word 0x377b3c16 + .word 0xffff00b7 + .word 0xaeafb9a7 + .word 0xffff6981 + .word 0xc8133e13 + .word 0x000393ce + .word 0xa5e69e7a + .word 0xfffe0d5f + .word 0x2d00942f + .word 0xfffc38c0 + .word 0x2e8fd035 + .word 0x0001935a + .word 0xbe373c8c + .word 0xfffedd13 + .word 0x12bc29e1 + .word 0xfffd3beb + .word 0x8afeec5e + .word 0xfffe566e + .word 0xc3ba525f + .word 0x0001c1f3 + .word 0x58af082e + .word 0xfffc647f + .word 0x160d817b + .word 0xfffdabc1 + .word 0x0c8d96e0 + .word 0x0000fa5c + .word 0x2ec72f37 + .word 0xfffde9d4 + .word 0x0937c6f1 + .word 0x0002124f + .word 0xe98095e7 + .word 0xfffc0f1e + .word 0x1f3353a2 + .word 0xfffe5213 + .word 0x17ee15ff + .word 0x00037fb3 + .word 0xa7bd5445 + .word 0x00010102 + .word 0xd80e2162 + .word 0x00004382 + .word 0x6e777f2b + .word 0xfffed21a + .word 0x3af2f830 + .word 0xfffe2c45 + .word 0x962f689c + .word 0x000325ef + .word 0xfe3328dc + .word 0xfffe4f76 + .word 0x98f2d3a4 + .word 0xfffcf25a + .word 0x310fd46c + .word 0x00006b88 + .word 0xd711608f + .word 0x00024193 + .word 0x6aabff83 + .word 0xfffe13e0 + .word 0x9551c105 + .word 0xfffce805 + .word 0x2c3d4e20 + .word 0x0003431c + .word 0x1dbd42b3 + .word 0x00035a34 + .word 0xe5dea43c + .word 0x00001bdf + .word 0xa3962636 + .word 0x0002a39d + .word 0x302d0cb6 + .word 0x000258a7 + .word 0x5df31b06 + .word 0x00034625 + .word 0x9d116e17 + .word 0xfffc6ccc + .word 0xd517939a + .word 0xfffda7e8 + .word 0x722d8f94 + .word 0x000313f3 + .word 0x0b4d9211 + .word 0xfffe3045 + .word 0x7c00ba95 + .word 0xfffc6e14 + .word 0xb9e08137 + .word 0xffffecf9 + .word 0x09386779 + .word 0xfffc7e64 + .word 0x73bdfae6 + .word 0xfffcad89 + .word 0x6d9082b6 + .word 0x00026338 + .word 0x08b34b20 + .word 0x000368a1 + .word 0xd7ecfee0 + .word 0xfffcab52 + .word 0xda6e647b + .word 0xfffdcdf6 + .word 0x796944f0 + .word 0x0003e5ea + .word 0xd1b97501 + .word 0xfffd2d60 + .word 0x6db0e337 + .word 0xfffc0be9 + .word 0xd3df0741 + .word 0x0003ad05 + .word 0xfc80962f + .word 0x00003e1a + .word 0x088e5d52 + .word 0xfffe2deb + .word 0x537efa2c + .word 0xfffd4922 + .word 0xe427d3ef + .word 0x0003a783 + .word 0xfa49f593 + .word 0x0003ff72 + .word 0xf0c34bde + .word 0xffff14f7 + .word 0x5f2d9509 + .word 0x00005cae + .word 0x9cd9ec86 + .word 0x0001fa59 + .word 0xfbd72f97 + .word 0x0001c8bc + .word 0xfc50113c + .word 0x00018c0f + .word 0xc7d749fe + .word 0x00034b4a + .word 0x5598501a + .word 0x000299d9 + .word 0xcef15555 + .word 0xfffe0321 + .word 0xb582ae4d + .word 0x0000f448 + .word 0x8acc48df + .word 0x000316ce + .word 0xbd54e499 + .word 0x0003cec0 + .word 0x2a1beebe + .word 0x0000891b + .word 0xb69b3d96 + .word 0xfffc2fff + .word 0xa37aafba + .word 0xfffd836e + .word 0xf0d2256d + .word 0x00032694 + .word 0xcc5fe8ca + .word 0xffff6e68 + .word 0x552d961b + .word 0xfffcf151 + .word 0x025ad936 + .word 0x00016f18 + .word 0xffe3a21d + .word 0xffff1aa6 + .word 0x8d91d980 + .word 0xffff59b2 + .word 0x9f8ba49f + .word 0xfffcbcf3 + .word 0x80017e81 + .word 0x00021cc5 + .word 0x153abba6 + .word 0x000234a7 + .word 0xb192e612 + .word 0xffff5ab8 + .word 0x090604fe + .word 0xfffc8b9d + .word 0x0faa581e + .word 0x00026a77 + .word 0xfba54ba6 + .word 0xffffb868 + .word 0x936428f3 + .word 0xfffde3b1 + .word 0x8deed148 + .word 0xfffe5aab + .word 0xae4d7ef6 + .word 0x00009e4f + .word 0xfa253cfe + .word 0x00008b76 + .word 0xd20ab562 + .word 0xffff713e + .word 0xac25a35f + .word 0x00014242 + .word 0x52dc7f72 + .word 0xfffccca4 + .word 0xf990c5aa + .word 0xfffe960c + .word 0x342b008c + .word 0x00036836 + .word 0xd12fe30c + .word 0x0002eda2 + .word 0x3eb5c377 + .word 0x0000b904 + .word 0x48b54738 + .word 0x0003ac5b + .word 0x1ff317ff + .word 0x0003d0e4 + .word 0x7ca8c382 + .word 0x00012013 + .word 0xc3b4a7b0 + .word 0x00005776 + .word 0x07be5236 + .word 0x0003b6ea + .word 0x8b60a8a9 + .word 0x0001a65e + .word 0x05a49593 + .word 0xfffc8c5f + .word 0x56f5c1e7 + .word 0xfffee2cf + .word 0x8e3e8302 + .word 0xffffe105 + .word 0x3ce61ac6 + .word 0xfffdd250 + .word 0xa1eb5f39 + .word 0x000227bd + .word 0x3628c9e1 + .word 0xfffe6756 + .word 0x57862f08 + .word 0xffff6b17 + .word 0x8fb7991f + .word 0xfffe43ce + .word 0x409bfcea + .word 0xfffdf68f + .word 0x8df741b1 + .word 0x0002092b + .word 0x6918de25 + .word 0x00002ded + .word 0x5767d6a6 + .word 0x000162e5 + .word 0x7d27c0b7 + .word 0xfffc294e + .word 0xbacf11b8 + .word 0xfffe63bf + .word 0x3af1e5c7 + .word 0x00017539 + .word 0x92d95fdc + .word 0xfffeeebc + .word 0x1aa7a871 + .word 0xfffefaab + .word 0x07165beb + .word 0xffffa5f3 + .word 0x39e3283a + .word 0xfffe027f + .word 0xcf9e2ea1 + .word 0xfffd8bc0 + .word 0x10cd710c + .word 0xffff3f30 + .word 0x21337fd9 + .word 0xffff4508 + .word 0x4ed74898 + .word 0x000067c9 + .word 0x79c1c7d1 + .word 0x0000a969 + .word 0xb383f738 + .word 0xfffc7da8 + .word 0xc2d00acf + .word 0xfffdd340 + .word 0x81a6c221 + .word 0x0002755a + .word 0xd0e53745 + .word 0x0000275f + .word 0xc7ccfd68 + .word 0xfffd7743 + .word 0x6ccfc970 + .word 0xfffe1f3b + .word 0xd09a7618 + .word 0xfffcd15d + .word 0x6143e852 + .word 0x00025da0 + .word 0xd8e2ffd0 + .word 0xfffe7227 + .word 0x0e15fa3c + .word 0xfffc7269 + .word 0xa69576a7 + .word 0x0001a838 + .word 0xf693f681 + .word 0x0003b994 + .word 0x497ed732 + .word 0xffffddde + .word 0x3c027f30 + .word 0x0001b97b + .word 0xa954382d + .word 0xfffdd9f8 + .word 0x278f7c49 + .word 0xfffef724 + .word 0xc52b8247 + .word 0xfffcd51b + .word 0x3dca1c1a + .word 0x00028680 + .word 0x641d4911 + .word 0x000164a0 + .word 0xf4d9c320 + .word 0x0002753b + .word 0x9461240e + .word 0xfffd300f + .word 0x1211b54a + .word 0x00033fe1 + .word 0x6bb2caf4 + .word 0xfffd4b90 + .word 0x2337ad86 + .word 0x00004794 + .word 0xd1d644c5 + .word 0xfffe14b7 + .word 0x94f3c8d6 + .word 0x000334d2 + .word 0xd268f0eb + .word 0x0001ebea + .word 0x37385558 + .word 0xffff3f9b + .word 0xaf189b22 + .word 0xfffe387e + .word 0x3bcd7610 + .word 0x00011765 + .word 0xe0a649a6 + .word 0xffffdd86 + .word 0x5208eddd + .word 0x0002d023 + .word 0x4de2f4ac + .word 0x00016237 + .word 0xe78e491f + .word 0x0000990d + .word 0x9672a2bd + .word 0xfffe891c + .word 0xc1a64a37 + .word 0x00006bd6 + .word 0xc34cdaa3 + .word 0x00011715 + .word 0xfc240530 + .word 0xfffff9b0 + .word 0x6e423a7d + .word 0xfffda266 + .word 0x8498689b + .word 0xfffc5b53 + .word 0x4e8364ec + .word 0xffff64f1 + .word 0x5c3d866f + .word 0x0003142e + .word 0xdb21968b + .word 0xfffcb881 + .word 0xf681f13b + .word 0x00031aea + .word 0x7b781b4b + .word 0x0000898d + .word 0xabaf4f11 + .word 0xffff183a + .word 0x7f12aff7 + .word 0x0001180d + .word 0x95512484 + .word 0x00027f57 + .word 0xa97ac2e8 + .word 0x00010fa5 + .word 0x7bba671f + .word 0x00026b20 + .word 0xf42b1255 + .word 0xffffc866 + .word 0x9113047a + .word 0x000008e0 + .word 0xfd9f1633 + .word 0x0001b789 + .word 0xb905d39e + .word 0x00031f53 + .word 0x779e787c + .word 0x00017dca + .word 0xbb4fbbad + .word 0x00021681 + .word 0x2e03a919 + .word 0xfffee538 + .word 0x4780e527 + .word 0xfffe19e5 + .word 0xf9fdf04b + .word 0x0003087d + .word 0x8e5ce587 + .word 0x0003d3ad + .word 0x7c84e5aa + .word 0x00002aaa + .word 0x9b03da8e + .word 0x0000ea80 + .word 0xb3af1692 + .word 0x00039605 + .word 0x5129ce41 + .word 0xfffc025c + .word 0x56dbc84e + .word 0x00032bc1 + .word 0xc974b5b2 + .word 0x00037fb5 + .word 0xc2a3c6d5 + .word 0xfffd27e8 + .word 0xe26ef0b5 + .word 0xffff53b0 + .word 0x8597aa03 + .word 0xfffcadd7 + .word 0x594681a4 + .word 0x0001d85c + .word 0xd8bfc380 + .word 0xffffa3cc + .word 0xe659e8cd + .word 0x00022c28 + .word 0xae615c51 + .word 0x00012d9a + .word 0xc4a953a2 + .word 0x000029f5 + .word 0xde83e8c7 + .word 0xfffd8329 + .word 0x7002befc + .word 0xffff884f + .word 0x795ec24a + .word 0x000010df + .word 0x1570a195 + .word 0x0001b564 + .word 0x7f36912d + .word 0x00022f11 + .word 0x94359061 + .word 0x0003a6cf + .word 0xdda4a3d3 + .word 0x000310e8 + .word 0xf880dcb6 + .word 0x0000438c + .word 0x0435ba4b + .word 0x000217f1 + .word 0xc7b24898 + .word 0xffffe793 + .word 0xb9657c37 + .word 0xfffea38c + .word 0x85990336 + .word 0x000259a2 + .word 0x804a6a3c + .word 0x0003ef3f + .word 0x62937f7c + .word 0x00022cc9 + .word 0x4badb947 + .word 0xfffc30d1 + .word 0x2d8e8a7a + .word 0xfffebf72 + .word 0x7c5f3965 + .word 0xfffdde16 + .word 0xde94e225 + .word 0x000324a6 + .word 0x2516ad90 + .word 0x0001e833 + .word 0x62b70f32 + .word 0xffffbba9 + .word 0xf4b7acb4 + .word 0x0001b075 + .word 0x19178e9e + .word 0x0001a4d9 + .word 0x20d004cf + .word 0x0003ecb1 + .word 0x9c3ef594 + .word 0x000339bc + .word 0x29d02a47 + .word 0x0001278a + .word 0x64170fd4 + .word 0xfffd566c + .word 0x3314ac50 + .word 0xfffd9e58 + .word 0x98e530a8 + .word 0x00005c8b + .word 0xd1cccb83 + .word 0x0000174f + .word 0xaf9fdf35 + .word 0x0003fa25 + .word 0xe0748f1d + .word 0x00013644 + .word 0x884ee6ad + .word 0xffffaca2 + .word 0x209bc9d0 + .word 0xfffe9937 + .word 0xfcca2520 + .word 0xffff17f8 + .word 0x646c698b + .word 0x00008646 + .word 0x769ba969 + .word 0x0002a078 + .word 0x490d0951 + .word 0xffffd311 + .word 0x1eadb20c + .word 0x00024c8f + .word 0x7e6a45ff + .word 0xfffff873 + .word 0x7366024f + .word 0x0003009e + .word 0x6e5cbc4f + .word 0xffffc1fa + .word 0xf213600d + .word 0x00032c6c + .word 0x51cf1f38 + .word 0xfffc6664 + .word 0x3bf0a46b + .word 0xfffc7477 + .word 0xbfb0c01e + .word 0xfffcdd77 + .word 0xac2b1bb5 + .word 0xfffddde1 + .word 0x8a114e73 + .word 0x000362a3 + .word 0x87b1edf3 + .word 0x000053d9 + .word 0xf873bdc1 + .word 0x0000d0da + .word 0x08e6d017 + .word 0x0003e499 + .word 0x270ab1b7 + .word 0xfffe000c + .word 0xe40cc183 + .word 0x00005498 + .word 0x162eac81 + .word 0xfffd0bf4 + .word 0x7b457d2c + .word 0x0000c6c0 + .word 0x08c589ac + .word 0x0003efd3 + .word 0x69640bfe + .word 0x0001e81d + .word 0x282bc411 + .word 0x00001171 + .word 0xeb2f4623 + .word 0xfffcd9c7 + .word 0xcbe27fa5 + .word 0x00037f82 + .word 0x0c74e7a7 + .word 0xffff2087 + .word 0xd2a6f07a + .word 0xfffc2e3f + .word 0xc3d366e0 + .word 0xfffe562d + .word 0x4dfae103 + .word 0xfffda86b + .word 0xe5236bff + .word 0x00023e6a + .word 0x27ad9b00 + .word 0xfffe5e4e + .word 0x9fd0d2f1 + .word 0xfffc6a39 + .word 0x924dbda7 + .word 0xffff7635 + .word 0x5b46d0b3 + .word 0xfffca392 + .word 0xe6d0e266 + .word 0x00014c05 + .word 0x1c8921be + .word 0x00006a35 + .word 0x2dee0828 + .word 0xffff2605 + .word 0x145da5df + .word 0x00020738 + .word 0x76c7a0eb + .word 0xffff0313 + .word 0xc25c7aa1 + .word 0x00003908 + .word 0x25f9bd0a + .word 0xffff92e9 + .word 0x959b810e + .word 0xfffeb6ad + .word 0x228a1f6d + .word 0x000282c8 + .word 0x740ec2cc + .word 0x0000185d + .word 0x3020667b + .word 0xfffe27b3 + .word 0x245c8dd6 + .word 0xfffeb6c2 + .word 0x2eae6a41 + .word 0xfffdf861 + .word 0xe7c4c77a + .word 0x0002c611 + .word 0x7150809f + .word 0xfffcf7eb + .word 0x38f2c459 + .word 0x0001123e + .word 0x254eff8f + .word 0xfffc0001 + .word 0x973385d4 + .word 0xfffe0a45 + .word 0x3b3053e0 + .word 0xfffe1f16 + .word 0x91b9101c + .word 0x00031ff0 + .word 0x68011bcf + .word 0xfffe20ee + .word 0xc64d4971 + .word 0x00026987 + .word 0xd30dbbcb + .word 0xfffddaf9 + .word 0xb71edc8e + .word 0xfffeeba3 + .word 0xf66cd4c8 + .word 0x0001b921 + .word 0x238c7b2e + .word 0x00036089 + .word 0x51804b37 + .word 0x00035d81 + .word 0xf8e72553 + .word 0xfffea741 + .word 0xfa22c128 + .word 0x000143b8 + .word 0x16dba0ed + .word 0xffff7c5f + .word 0x16fae9c7 + .word 0xfffd7cef + .word 0xe07278f4 + .word 0x0003104e + .word 0x8e07f54d + .word 0xffff887d + .word 0x5a26a0ae + .word 0xffff986d + .word 0x9caa845b + .word 0xfffd303a + .word 0x6a260d3f + .word 0x0002131e + .word 0xcfbe10a6 + .word 0xffff60ef + .word 0x7eaf6bb9 + .word 0xfffdb8f9 + .word 0xef4f560d + .word 0xfffcab11 + .word 0x3838c3e0 + .word 0xfffc0473 + .word 0x2ec06a4e + .word 0x00031d85 + .word 0x2f1e6368 + .word 0x000085bb + .word 0x0e7cb24a + .word 0xffff6ebf + .word 0xfb395f7a + .word 0x0002eeb8 + .word 0xf42d0485 + .word 0x0001461b + .word 0xbdae3587 + .word 0x0003328e + .word 0xb25b6d21 + .word 0x00020ea2 + .word 0x4ceb5ab9 + .word 0x00004205 + .word 0xf33ed6ac + .word 0xfffc4974 + .word 0x3c8b809d + .word 0xffff9096 + .word 0x1f7419be + .word 0x0001b9e6 + .word 0x465c0d48 + .word 0x00013448 + .word 0xd685f67e + .word 0xfffcbfdd + .word 0xd22d453e + .word 0xfffe5afa + .word 0x094780c5 + .word 0xfffce202 + .word 0x34815cd1 + .word 0xffff6f5a + .word 0x7c02ffcf + .word 0xfffdf846 + .word 0x33e210a4 + .word 0x000003e0 + .word 0xb423468f + .word 0x0000dfdc + .word 0x31c3907a + .word 0xfffdda1b + .word 0x6a3f218d + .word 0x0000acf2 + .word 0x6eeaa0a1 + .word 0xfffe75f7 + .word 0xa43c7864 + .word 0x00039e40 + .word 0xb202b486 + .word 0x00013756 + .word 0x1608a7a9 + .word 0xfffe74e8 + .word 0x9524fa17 + .word 0x000397c9 + .word 0x21818c01 + .word 0xfffd28d8 + .word 0x1099637b + .word 0x0003c564 + .word 0x5df1b800 + .word 0xfffcd970 + .word 0x8ec874b8 + .word 0xffff1fdb + .word 0xcda63ee9 + .word 0x000139f6 + .word 0x69387146 + .word 0xffffd9da + .word 0x1436f869 + .word 0xffff89e9 + .word 0x1ab904c4 + .word 0x000363ad + .word 0x0c6da375 + .word 0xfffc2fca + .word 0x72ae4cdd + .word 0x0003f71b + .word 0xfc3716b3 + .word 0xfffcbba1 + .word 0x6a87de03 + .word 0x000020e3 + .word 0xccbb6893 + .word 0xfffd035c + .word 0x656b7cfd + .word 0xfffd8ab0 + .word 0xf7036bf6 + .word 0xffffffb9 + .word 0x8607855c + .word 0x00016571 + .word 0xa7b756e7 + .word 0xffffe0ed + .word 0x6553a4bb + .word 0xfffde375 + .word 0x52276a5e + .word 0x00009f21 + .word 0x2ad50370 + .word 0xffff04c6 + .word 0xe2dd4b56 + .word 0xfffc7be6 + .word 0x3a67a69d + .word 0x0001db0e + .word 0x1e05f434 + .word 0x00023f6f + .word 0x4463515e + .word 0x00028fe5 + .word 0x98b6921d + .word 0x0001d344 + .word 0x554f742b + .word 0x0000c2b0 + .word 0x33d091db + .word 0x000243a6 + .word 0x44290c78 + .word 0xfffc997d + .word 0x134c96b6 + .word 0xfffdbb3d + .word 0x1e217718 + .word 0xfffc8157 + .word 0x8b5ac3f0 + .word 0xfffc65ea + .word 0xd39dea57 + .word 0x0003d14a + .word 0xca417ed5 + .word 0x0003f149 + .word 0x46f5f909 + .word 0x0000384f + .word 0xbe88d2bc + .word 0x00014869 + .word 0x1b0b3d81 + .word 0x00015251 + .word 0x268fce5c + .word 0xffff3406 + .word 0x315f963f + .word 0x0002611d + .word 0x2758bed3 + .word 0x000312cb + .word 0x028bb020 + .word 0xfffccd70 + .word 0xc573ae7a + .word 0x0000d664 + .word 0x5bc771d2 + .word 0x00011bc3 + .word 0xab050c1e + .word 0xffff8ac9 + .word 0xe2c60032 + .word 0x00002637 + .word 0x46f41086 + .word 0xfffe4666 + .word 0xfd6ba7bf + .word 0x0001eed8 + .word 0xaba705e7 + .word 0xffff6a47 + .word 0x33ca3c2f + .word 0x00030d01 + .word 0x4a0c1ef9 + .word 0xfffd618c + .word 0x1a023884 + .word 0xfffecaa7 + .word 0x9fc0c7e9 + .word 0x0002ba17 + .word 0xcc041bb2 + .word 0x00011a1f + .word 0x34e7e9d9 + .word 0x000135af + .word 0xc50deae8 + .word 0x00009834 + .word 0x52a5f16c + .word 0xffff2e24 + .word 0x7c603e8d + .word 0xfffc658c + .word 0x2b82f1ac + .word 0x00016061 + .word 0x11639a60 + .word 0xffffb6ee + .word 0xd5ce49f9 + .word 0x0003160e + .word 0xbd8f58dc + .word 0x00010ece + .word 0xd912f413 + .word 0xfffc40c7 + .word 0x6de22266 + .word 0x0002bd1c + .word 0x63adc32c + .word 0x000083f0 + .word 0x01b8f90b + .word 0xfffecd70 + .word 0xbca48654 + .word 0x00019992 + .word 0xcaf4db42 + .word 0x0000782f + .word 0xa8294d37 + .word 0xfffc08e4 + .word 0x8192e280 + .word 0xffffc765 + .word 0x1f648a34 + .word 0xffff1697 + .word 0x7552af19 + .word 0xfffc3a04 + .word 0x77e14d4a + .word 0x0002810e + .word 0x06230caa + .word 0xfffc00b6 + .word 0x1246e364 + .word 0x00018118 + .word 0x7b2dde05 + .word 0xfffcacc4 + .word 0xe81be225 + .word 0xfffc7b46 + .word 0xbe0cabbc + .word 0x00028ad8 + .word 0xf6d1526b + .word 0x0000a969 + .word 0xc2ed94b4 + .word 0xffff4796 + .word 0x4f1366c0 + .word 0xfffd9f33 + .word 0x119b03f0 + .word 0xffffdd41 + .word 0x4afe4f0d + .word 0x00025e7d + .word 0xd9f6f99d + .word 0x0003ad2e + .word 0x6fa1c8e8 + .word 0x0000e238 + .word 0xa1eb308e + .word 0x00039cc9 + .word 0x9c760d95 + .word 0xffffd7c8 + .word 0xdeb57a25 + .word 0x0000da3d + .word 0xe352e18d + .word 0xfffda64f + .word 0x6164fb5a + .word 0x0001375a + .word 0x20655a33 + .word 0x0002949b + .word 0xe2f48ba5 + .word 0x0000e798 + .word 0x3bf0d2a0 + .word 0x0003296e + .word 0x8c667e62 + .word 0x0003f3d2 + .word 0x93ce19e3 + .word 0xfffdb2af + .word 0x3948f1a4 + .word 0x00001901 + .word 0x6b81f815 + .word 0xfffe30f5 + .word 0x06bf06d4 + .word 0x00018543 + .word 0x05152592 + .word 0xffff1273 + .word 0x1b16ea63 + .word 0x00006b70 + .word 0x7414defd + .word 0xfffe72ff + .word 0x2ed241f8 + .word 0x0003aa46 + .word 0xd0429387 + .word 0x00022929 + .word 0xaec72153 + .word 0xfffd84bf + .word 0x78b0acc5 + .word 0xfffc9e45 + .word 0x7c204268 + .word 0xfffffb3f + .word 0x3c20d801 + .word 0x00017b70 + .word 0x1872b10c + .word 0xffffe77a + .word 0x58b47b97 + .word 0xfffc03b1 + .word 0xdb32a6b0 + .word 0xffff9335 + .word 0x908d9c63 + .word 0x00034fac + .word 0xcbdbbd76 + .word 0x000147a3 + .word 0xa3cbbf19 + .word 0x00005b1d + .word 0xf25f2597 + .word 0x0000997f + .word 0xb7bdbf60 + .word 0x0000640f + .word 0xf1957ce8 + .word 0x00038a62 + .word 0x7d425adc + .word 0x000290a8 + .word 0x19478b52 + .word 0xffffcc93 + .word 0xd4d5c162 + .word 0x000391f1 + .word 0x138cf94a + .word 0x00017087 + .word 0xbe572197 + .word 0x0003d392 + .word 0x5f1a97e1 + .word 0xfffc77b6 + .word 0x55891edd + .word 0x0001a98a + .word 0xfc85f617 + .word 0xffff96c7 + .word 0xad774991 + .word 0x000227aa + .word 0xac4ade53 + .word 0x0001aa12 + .word 0xe1fc5f9c + .word 0x0001064b + .word 0xdbe49fd1 + .word 0xfffd831c + .word 0x734bfee7 + .word 0x00021c86 + .word 0xcd2b06b7 + .word 0x0003092e + .word 0x7af26cdd + .word 0x0000427f + .word 0xcb911fcc + .word 0xffffeee9 + .word 0x7442dd7e + .word 0x00030059 + .word 0xe75df322 + .word 0xfffcba4c + .word 0xb0e1a634 + .word 0x0001f1a5 + .word 0xd6a180db + .word 0xfffd8424 + .word 0x411c8a2d + .word 0x000324fb + .word 0x76e0fee3 + .word 0x0000b928 + .word 0x63a3e6f5 + .word 0xfffdd7c1 + .word 0x423b42ce + .word 0x00029316 + .word 0x09922665 + .word 0x000397ad + .word 0x5e2ffe2e + .word 0x0000bb29 + .word 0xfb2fb3fa + .word 0xfffcd007 + .word 0xb8453946 + .word 0x00012065 + .word 0xb2824a1c + .word 0xffff11ce + .word 0xe7dac0fe + .word 0x0001dd74 + .word 0x2e0078aa + .word 0xfffe3c60 + .word 0x86d0746b + .word 0xffff7aa8 + .word 0x0203482e + .word 0x00024ea0 + .word 0x27450c36 + .word 0x0000fe2f + .word 0xdc0a3bd2 + .word 0x000258bc + .word 0xdb6c316e + .word 0x000334dc + .word 0x4b3403ce + .word 0x00015c34 + .word 0x9caec315 + .word 0xffff7bf2 + .word 0xca4962a3 + .word 0x00011e3a + .word 0xd1e82a66 + .word 0x00033c6c + .word 0xd11a6be9 + .word 0xfffd7ba5 + .word 0xfc58b939 + .word 0xffffed1c + .word 0x7c770b5c + .word 0xfffe20c8 + .word 0x300f25ff + .word 0x00005e86 + .word 0xb4bf1819 + .word 0x00035345 + .word 0xf512d298 + .word 0x0002d23c + .word 0x59248929 + .word 0xfffec2ca + .word 0x8120f892 + .word 0xffff6ee8 + .word 0xf0f0f7a3 + .word 0x0001eb53 + .word 0x97a502e6 + .word 0x0003b4e6 + .word 0x5f1c0a57 + .word 0x00035cc4 + .word 0x17bd02b5 + .word 0xfffd0825 + .word 0x60cbcd8a + .word 0x00024fb7 + .word 0x23fed478 + .word 0xffff2910 + .word 0x7be19b72 + .word 0xfffdbc86 + .word 0x1a9aa954 + .word 0x0000cce8 + .word 0xdcfa535c + .word 0xfffdd081 + .word 0xa4186127 + .word 0x0003cac6 + .word 0xe3ff8828 + .word 0xfffd352e + .word 0xbeed7678 + .word 0x00028443 + .word 0x61c9c0ef + .word 0x000066a7 + .word 0xc485513a + .word 0xfffe991b + .word 0x1fe64ce6 + .word 0xfffeda64 + .word 0x1ea280a4 + .word 0xffff88fc + .word 0xa67ba624 + .word 0x0002148f + .word 0xb45c0689 + .word 0x000357b5 + .word 0x44020944 + .word 0x0002d357 + .word 0xfe3db5c2 + .word 0x000169a6 + .word 0x9000eb4a + .word 0x0001cd06 + .word 0x30ca218e + .word 0xfffd3621 + .word 0xdf921afe + .word 0xfffcfe58 + .word 0x96e43963 + .word 0xfffd9e0c + .word 0x74a3ac9a + .word 0xfffcadb7 + .word 0x5df42de7 + .word 0x00007042 + .word 0x3921ba3a + .word 0x00038d44 + .word 0x0c0f4cdb + .word 0x00003e24 + .word 0xb78b3301 + .word 0x00037fc1 + .word 0x6fbc9510 + .word 0x00038c0f + .word 0x128a3c2d + .word 0x0002cc25 + .word 0x6e5cc9ea + .word 0x0003e04c + .word 0x5c2710d4 + .word 0xfffe3122 + .word 0x875ad31f + .word 0xffff1ba1 + .word 0xe2f69a5e + .word 0x0003ae81 + .word 0x5174a005 + .word 0x0001ffec + .word 0x0c444ac6 + .word 0xfffdb2ac + .word 0xc05605e7 + .word 0x000374b5 + .word 0x235aaaed + .word 0x0000cd31 + .word 0x318beabb + .word 0x0003a5e5 + .word 0x8e517bfa + .word 0xfffd65c5 + .word 0x872f7eb8 + .word 0xffff1e66 + .word 0x570a097c + .word 0x00039609 + .word 0x81b2ec47 + .word 0x000338d3 + .word 0x4b547f0d + .word 0xfffdd6cf + .word 0xcb0b9013 + .word 0x0000f1a3 + .word 0xd1a476b7 + .word 0x00003abf + .word 0xc0be89ba + .word 0x00017db3 + .word 0xff98fa70 + .word 0xfffe4ca5 + .word 0x5b2feaec + .word 0x0001d882 + .word 0x25ab2c6b + .word 0x0002c8f3 + .word 0xb53b1438 + .word 0x000280fe + .word 0x200335f2 + .word 0x0001b1d2 + .word 0x265fc13b + .word 0xfffc8e47 + .word 0x67238629 + .word 0xfffd7f74 + .word 0x1a5309df + .word 0xffff8c1e + .word 0x5bd6d986 + .word 0xfffefb23 + .word 0x358cfeab + .word 0x0002db0a + .word 0xf34b4dfd + .word 0x000250d3 + .word 0x67dfbf2e + .word 0x0001f294 + .word 0x2c699a45 + .word 0xffff89bf + .word 0x405ce234 + .word 0xffff3a17 + .word 0xc31fd7db + .word 0xffffcf51 + .word 0x3d5c7729 + .word 0xfffcd237 + .word 0xf4d43293 + .word 0x0002c4cd + .word 0x5c5684d3 + .word 0xfffce6b3 + .word 0x944838fc + .word 0xfffc1f2a + .word 0x8295020b + .word 0xffffc991 + .word 0x4383a4d0 + .word 0x000327b4 + .word 0x5557e6f9 + .word 0x0000fc7d + .word 0x09a727d4 + .word 0xfffe88c0 + .word 0x824a10d0 + .word 0x00020968 + .word 0x9a4f83a0 + .word 0xfffedc2c + .word 0x9b5c5b6b + .word 0xfffc4cec + .word 0xff9d5f29 + .word 0x0002f34e + .word 0xd8c21bde + .word 0x0000b711 + .word 0xcb17de3a + .word 0xffff0194 + .word 0x00290a03 + .word 0x0003c368 + .word 0x449a4ba0 + .word 0xffffa34f + .word 0xcb10cbc2 + .word 0x0003ae37 + .word 0x342d85eb + .word 0x00008f0f + .word 0x49ac44d3 + .word 0xfffc3d7e + .word 0x992a617c + .word 0xffff53a4 + .word 0x664957bf + .word 0xfffd5aeb + .word 0x07c6c03b + .word 0xfffc6638 + .word 0x416808ee + .word 0x0003d9a7 + .word 0xf10441e2 + .word 0x0003d58e + .word 0x3f14136e + .word 0x00020d88 + .word 0x2517c90b + .word 0x00024f79 + .word 0x5bebaf8a + .word 0xfffe6289 + .word 0x0af6622f + .word 0x00000a07 + .word 0x65211271 + .word 0xfffe36c1 + .word 0xaec4edaa + .word 0xffffe2f6 + .word 0xafbe39ec + .word 0x0002d978 + .word 0x43524dd0 + .word 0x000050b2 + .word 0xcced6736 + .word 0xffff4f7b + .word 0xc3eaefed + .word 0xfffcc6dc + .word 0x722fc43f + .word 0xfffc11c0 + .word 0x5db0dc46 + .word 0xfffd2a31 + .word 0xe894cf1b + .word 0xfffcbf5c + .word 0x9217c52a + .word 0xfffc44b4 + .word 0x1d21eff2 + .word 0xfffde46d + .word 0x326db7a1 + .word 0xfffcb5d4 + .word 0xba8a84c2 + .word 0x00026688 + .word 0xe7bd0e1b + .word 0xfffc91de + .word 0xc41ec690 + .word 0xffff682a + .word 0xc5cf9634 + .word 0xfffd1428 + .word 0x1fe44be3 + .word 0xfffc50fa + .word 0xd652e52b + .word 0xfffcd70f + .word 0x3ebac2a0 + .word 0xfffc4024 + .word 0xd1ba81b3 + .word 0xfffc5613 + .word 0xaec57699 + .word 0xffff37c1 + .word 0x43b7beb8 + .word 0x0003bbdd + .word 0xc78b0a66 + .word 0xfffd605b + .word 0x5cb45979 + .word 0x00006447 + .word 0x5f9718f5 + .word 0x00002076 + .word 0x6beda57c + .word 0xfffd28bf + .word 0xce894d8b + .word 0xfffc93b2 + .word 0x086a0be5 + .word 0x000121a6 + .word 0x9974e5e3 + .word 0x00034876 + .word 0xaf05eca6 + .word 0xfffd0029 + .word 0xc8ecceca + .word 0xfffd2eff + .word 0x59ed681b + .word 0x00016a4f + .word 0x1226df81 + .word 0x00037345 + .word 0x4b1d4f36 + .word 0xfffeccd6 + .word 0x40e9e11a + .word 0x0002979e + .word 0xc2d3729d + .word 0x00013ea5 + .word 0xe7a195cf + .word 0xffff63e2 + .word 0x84b8c73d + .word 0xffff8078 + .word 0xe7ad5de4 + .word 0x0002a48b + .word 0x61f89402 + .word 0x00008b27 + .word 0x2395bbb4 + .word 0xffffc6eb + .word 0x748d3227 + .word 0x00035eea + .word 0x30c82724 + .word 0xfffcfe13 + .word 0x67e4df51 + .word 0x000323af + .word 0x955abea9 + .word 0xffff0033 + .word 0x258f54f6 + .word 0x0001af96 + .word 0xf2aa28c7 + .word 0x0003dcf1 + .word 0x709f0665 + .word 0x0001491d + .word 0x2a1f9505 + .word 0xfffcc540 + .word 0xc3dd4c12 + .word 0xfffdc569 + .word 0xa9e820f5 + .word 0xfffd47a8 + .word 0x99648b77 + .word 0x00023016 + .word 0x5300c90f + .word 0x00035915 + .word 0xd265022a + .word 0xfffc0cb5 + .word 0xb100b0a0 + .word 0xfffc082b + .word 0xbf73eb90 + .word 0x0002b15a + .word 0xd2416cb3 + .word 0x000353ca + .word 0x066b4672 + .word 0x000138f8 + .word 0x00df3192 + .word 0x00026d3d + .word 0xf69e4c8c + .word 0xffff7ce4 + .word 0x77dad5ca + .word 0xfffc27b5 + .word 0x69a07ebf + .word 0x000136e6 + .word 0x8f3b1acb + .word 0xfffc73dd + .word 0x8084715b + .word 0xfffc08a2 + .word 0x1958149c + .word 0x0002f373 + .word 0xc7e00e0d + .word 0x0001fa88 + .word 0x09bc444b + .word 0x000245f5 + .word 0x456fe422 + .word 0x000079c3 + .word 0x7c41203f + .word 0xfffd9d8a + .word 0x9e56c931 + .word 0xfffc8e13 + .word 0xe9d3909a + .word 0xfffe9527 + .word 0x807b9afe + .word 0x0001e1ba + .word 0x461bc729 + .word 0x0000d982 + .word 0xde992d9e + .word 0x000391a5 + .word 0xe02b2043 + .word 0x0001d677 + .word 0x56626279 + .word 0x00010a1b + .word 0xea55ec4c + .word 0x00016296 + .word 0x50c1775c + .word 0xfffccd17 + .word 0x2f5fecc9 + .word 0xfffec32f + .word 0xacbfddb6 + .word 0x0003e24d + .word 0x4711de38 + .word 0x00001bcd + .word 0xbf6f9bd3 + .word 0x0000f160 + .word 0x2f51ef7a + .word 0xfffceed9 + .word 0x0661651a + .word 0x0002cca0 + .word 0xb10c6f10 + .word 0xfffcc76a + .word 0x2d569f1b + .word 0xffff2004 + .word 0x5e605bc1 + .word 0xfffd6c28 + .word 0xb3ea8408 + .word 0xffff4646 + .word 0xd43ceb27 + .word 0x0001d3b8 + .word 0xc81c812e + .word 0xffffd054 + .word 0xf3991d4d + .word 0x0001cb23 + .word 0xf0063834 + .word 0x0003f256 + .word 0x7f656b62 + .word 0x0001ca92 + .word 0x4c663b3a + .word 0xffffce7b + .word 0x57b397e1 + .word 0x0001f7a4 + .word 0xb2995fc4 + .word 0x000133f9 + .word 0xd8b7fee9 + .word 0xfffdae9e + .word 0x99188dbb + .word 0xfffc5f0e + .word 0x8ef9db9e + .word 0xfffc0e96 + .word 0x5510f9aa + .word 0x00016dff + .word 0x9f53c2f7 + .word 0xfffef0da + .word 0x5750771e + .word 0x0001fdf6 + .word 0x06d6c8db + .word 0xfffdc8a3 + .word 0xf1e88ac9 + .word 0xffffcc7d + .word 0x7804f778 + .word 0xfffe9dac + .word 0x80a1c59a + .word 0x00014291 + .word 0x10b69d64 + .word 0x000286ef + .word 0x8f25f8ce + .word 0xfffd3afa + .word 0x9323a130 + .word 0x0001fca0 + .word 0xe667af15 + .word 0xfffc349d + .word 0x297d03df + .word 0x0003ff80 + .word 0x413f6e83 + .word 0x00001005 + .word 0xe2773bc5 + .word 0xfffcf106 + .word 0x29a5c83c + .word 0x0001e29d + .word 0x68a76e03 + .word 0xffff8912 + .word 0xb599b755 + .word 0xfffd023e + .word 0x2d148343 + .word 0xfffded75 + .word 0x89587127 + .word 0xfffca53a + .word 0xe1dc49d2 + .word 0x0003bca5 + .word 0x8c0d6221 + .word 0xfffd4c71 + .word 0xc75daaa7 + .word 0xfffd8ebf + .word 0xab1a2d2b + .word 0xfffe9ce8 + .word 0x563fe7f3 + .word 0xfffff616 + .word 0x9224630c + .word 0xfffec20f + .word 0x6fa187fb + .word 0x0000c2c4 + .word 0xbb262522 + .word 0xffff8857 + .word 0x51c47eb1 + .word 0x000134cc + .word 0xe726bd04 + .word 0x00002883 + .word 0xb18ccc3f + .word 0x0002a4b2 + .word 0xe947bf1f + .word 0xffff2988 + .word 0x6dd1e020 + .word 0xfffc4728 + .word 0xf01865cc + .word 0xffff2f50 + .word 0x243131bb + .word 0xfffef45e + .word 0x1213fa31 + .word 0x00017c9b + .word 0x300d7000 + .word 0xfffdd5f6 + .word 0xa3cbcc3b + .word 0xfffc7fd0 + .word 0xe47df01f + .word 0x0000d762 + .word 0x8993ff33 + .word 0x0000a4bd + .word 0x8c9e5724 + .word 0xfffc3a5c + .word 0xac4ec0bb + .word 0xffff28ad + .word 0x7dd1a3cf + .word 0x0003bc09 + .word 0x4c931318 + .word 0xfffe831d + .word 0x1fdd1f8d + .word 0xfffda827 + .word 0x7cebcf5f + .word 0xffff13ec + .word 0xd4280416 + .word 0x00000a92 + .word 0xac8acfbf + .word 0x00019d5a + .word 0x03fe5f52 + .word 0x0000d9b4 + .word 0x91bef156 + .word 0xfffc0055 + .word 0x12f1a2b4 + .word 0xfffc252d + .word 0x4242d63d + .word 0x00002cc0 + .word 0x89391dae + .word 0xffff2723 + .word 0x63a35eab + .word 0xfffda16f + .word 0x8833dbe5 + .word 0xfffdbe0b + .word 0x04f1e031 + .word 0x0001754d + .word 0xd1ca51c9 + .word 0xfffd9445 + .word 0xbc9f2805 + .word 0xfffea0f7 + .word 0xdd6c3e2c + .word 0xfffc6827 + .word 0x1e7e22df + .word 0x00013dc2 + .word 0xc8f15400 + .word 0xfffcac73 + .word 0x21b84b71 + .word 0x000088aa + .word 0xb6ee844f + .word 0x000078bc + .word 0x179d4935 + .word 0x00034c07 + .word 0xd68ae16f + .word 0xfffe389b + .word 0xbc4962d9 + .word 0xfffe8774 + .word 0x2db03954 + .word 0xfffed8b4 + .word 0x17abd22e + .word 0xfffce065 + .word 0x46e31931 + .word 0x0000b4be + .word 0x87969261 + .word 0x000227ff + .word 0x2513c85f + .word 0xfffccd11 + .word 0x18144761 + .word 0xfffdbdc0 + .word 0x45df9a0a + .word 0x0000b35a + .word 0x1c8054d2 + .word 0x00009d10 + .word 0xfc9a2e9c + .word 0x0000bfa8 + .word 0x31629e0a + .word 0x00023c8a + .word 0x7faacdaa + .word 0x00009673 + .word 0xdbc94e27 + .word 0x0003aa97 + .word 0xb0f77c60 + .word 0xfffcce06 + .word 0x67f20001 + .word 0x0001c520 + .word 0x7db7219d + .word 0xffffad7c + .word 0x59555009 + .word 0x00000ad4 + .word 0x3137f790 + .word 0x00022531 + .word 0x83c7aaec + .word 0x000175c0 + .word 0x76869297 + .word 0x0000277c + .word 0x0f068dc3 + .word 0x0003798d + .word 0x86b1533c + .word 0xffffb9ba + .word 0x0a57596d + .word 0xffff6b66 + .word 0x7c137160 + .word 0xffff2459 + .word 0x1da98bcb + .word 0xfffc2292 + .word 0xd30eef44 + .word 0x000216cb + .word 0xa4cc35ba + .word 0x0001ed54 + .word 0x0dc13f05 + .word 0x00000e1a + .word 0x00955176 + .word 0xfffe904c + .word 0xcf48a1e2 + .word 0x0000b317 + .word 0x1a7ddd69 + .word 0x00007816 + .word 0x7505579b + .word 0x0001ed52 + .word 0x824c4391 + .word 0xfffd4bc2 + .word 0x079f7150 + .word 0x0000493b + .word 0x405e6547 + .word 0x0003bea2 + .word 0x905e6ede + .word 0x0003098f + .word 0xe3db0d26 + .word 0x0003030b + .word 0x64831070 + .word 0x0003adf5 + .word 0xb36ff4b6 + .word 0xfffd7581 + .word 0xddf8a30a + .word 0xffffd074 + .word 0xe909a9fd + .word 0x0000dbaf + .word 0xe4807fc4 + .word 0xffffa609 + .word 0x3a3dc288 + .word 0x00008519 + .word 0x25e87566 + .word 0xfffd758d + .word 0xbe088a13 + .word 0x000115bc + .word 0xd722a433 + .word 0x00030031 + .word 0xd389de63 + .word 0x0000ecdb + .word 0xdda26026 + .word 0x0001a45e + .word 0x7223e297 + .word 0xfffc31ab + .word 0x639fbcef + .word 0xfffece2e + .word 0x23cc09f5 + .word 0xfffd57cc + .word 0x87863c9f + .word 0x0002a3f5 + .word 0x8d6efcee + .word 0xffffd414 + .word 0xfca6f8c6 + .word 0x00022acb + .word 0x95841a2b + .word 0xfffe6036 + .word 0x8b51ce64 + .word 0xfffed295 + .word 0x8164462c + .word 0x000218ea + .word 0xf2d80cf1 + .word 0xfffcd6be + .word 0x8281043d + .word 0xfffefb48 + .word 0x475c8912 + .word 0x0003807b + .word 0x12026995 + .word 0x0003d2b3 + .word 0x66818119 + .word 0x0003cd16 + .word 0xff03b112 + .word 0x0002f927 + .word 0xd3e2efb9 + .word 0xffff550f + .word 0x74682c1c + .word 0x00016c53 + .word 0xfa2c1ccb + .word 0x00006bde + .word 0xafa34ae0 + .word 0xffff6ca3 + .word 0xef404ba0 + .word 0xfffe8fd2 + .word 0x9a69cfae + .word 0x00016bee + .word 0xd1cf0266 + .word 0xfffc9d30 + .word 0x9eab5d21 + .word 0x0002a393 + .word 0xfdcfa726 + .word 0x0000db87 + .word 0xc0e04640 + .word 0xfffdbd87 + .word 0xaf2d68d4 + .word 0x0003fec9 + .word 0xdd576eb4 + .word 0xfffc1fc7 + .word 0xf659686f + .word 0x0003218c + .word 0x9633e853 + .word 0xffffc98e + .word 0x98b8272b + .word 0xfffd97dc + .word 0xf941b0d5 + .word 0xffff4cd1 + .word 0x4441dfd4 + .word 0xfffd70bb + .word 0x73e2a5ea + .word 0x000336bf + .word 0x94f381b6 + .word 0xfffe20a0 + .word 0xf309e23c + .word 0xfffe0a5a + .word 0x76e1e71a + .word 0xfffeeb7b + .word 0x46129371 + .word 0x00030a37 + .word 0xcb238f16 + .word 0x0000b906 + .word 0x2f88e53d + .word 0xffff816d + .word 0xcc1a43f0 + .word 0xffff6b68 + .word 0x7e6bfc41 + .word 0xfffe2c33 + .word 0x04ea7a8c + .word 0x00010d98 + .word 0x82f9f113 .word 0xfffc2338 - .word 0xcbdb0d69 - .word 0xfffe45b4 - .word 0xe4f2d916 - .word 0xfffe9401 - .word 0x0af7044b - .word 0x0000df22 - .word 0xac27b3c4 - .word 0xfffc02a4 - .word 0xd76285c9 - .word 0xffffebac - .word 0x3db2e277 - .word 0xfffd771a - .word 0x4a0dd622 - .word 0xfffef105 - .word 0xb37402e5 - .word 0xffff65b9 - .word 0xd92e3de6 - .word 0xffff32d3 - .word 0xe2645115 - .word 0xfffe96c0 - .word 0x276d3dbc - .word 0xfffd31d7 - .word 0x22c84830 + .word 0x7a357c67 + .word 0xffff3588 + .word 0x4e4496e8 + .word 0x0003ade9 + .word 0x7362e9b0 + .word 0x00008568 + .word 0x74bc9a2c + .word 0x00028161 + .word 0x9cde8c00 + .word 0x00037298 + .word 0xcef81f30 + .word 0xffffa1f6 + .word 0x64f29ba8 + .word 0x0003ae28 + .word 0x4c0bb0ff + .word 0x0001573d + .word 0x554cbd7f + .word 0xfffc4f1b + .word 0xabd4cefb + .word 0xfffcfb3c + .word 0x9a88f2e0 + .word 0xfffe46f5 + .word 0x26d1086b + .word 0xfffcf208 + .word 0x48b3bc3d + .word 0xfffe028d + .word 0x3013cd7a + .word 0xfffd279d + .word 0x1cc755e5 + .word 0x0001b41b + .word 0x082c38d0 + .word 0xfffde342 + .word 0xc1743d98 + .word 0xfffce422 + .word 0x1cd46590 + .word 0x000034e0 + .word 0x0326c37c + .word 0x00007003 + .word 0x93ce489e + .word 0x0003a1f5 + .word 0x1c784448 + .word 0x0001935c + .word 0x4cabc6a0 + .word 0xfffd07ed + .word 0x4566d203 + .word 0x0002d198 + .word 0x7a7558f4 + .word 0xffffa30f + .word 0xc03c8437 + .word 0xfffdc5ed + .word 0x5ea762e3 + .word 0x000326e2 + .word 0x86b06ee3 + .word 0x00030829 + .word 0xc92e74ed + .word 0x0003145e + .word 0x4df60181 + .word 0x0001825f + .word 0x904fcc17 + .word 0x0002e7a3 + .word 0x5a07a85a + .word 0x00028c4b + .word 0x15174ec6 + .word 0x0002d669 + .word 0xca5b2f80 + .word 0xfffc0781 + .word 0xe8511941 + .word 0xfffe1b86 + .word 0x37bb8dd6 + .word 0x0002995f + .word 0x3f43a2a7 + .word 0x0000a2e6 + .word 0x976f9566 + .word 0x0001f83c + .word 0xa80db32d + .word 0x0000e180 + .word 0x06975bbf + .word 0x0001c7ab + .word 0xff87a7ff + .word 0x0002d3e4 + .word 0x8549cbf1 + .word 0xfffd7282 + .word 0x48c91733 + .word 0x0003cf8c + .word 0x43ad4d5b + .word 0xffff34a8 + .word 0x7d73ad9a + .word 0x00018485 + .word 0x861d7191 + .word 0x0003f7fb + .word 0x28f65f56 + .word 0xfffd4d45 + .word 0x9bcb1950 + .word 0x0003b133 + .word 0x472e21aa + .word 0x00016738 + .word 0x812926af + .word 0xffff3bca + .word 0xdfbe5f03 + .word 0x00007433 + .word 0x65344178 + .word 0xfffd6774 + .word 0x3469ba47 + .word 0x00025ed9 + .word 0xf43ddc2b + .word 0x00005236 + .word 0x30bfaae1 + .word 0xfffe64aa + .word 0xff1e6799 + .word 0xfffea958 + .word 0xf4874902 + .word 0x0002b1aa + .word 0xe596681e + .word 0x0000f7fe + .word 0xb68586e8 + .word 0xfffd662b + .word 0xe94baacf + .word 0xfffc82a3 + .word 0x6e3afbe0 + .word 0x00014faa + .word 0x3ae3fef6 + .word 0xffffc7dc + .word 0x1443b585 + .word 0x00019ab8 + .word 0x543870f0 + .word 0x000330d3 + .word 0x54619f78 + .word 0x000048dc + .word 0x9ac80495 + .word 0xfffc80f8 + .word 0x802629a6 + .word 0xfffc1259 + .word 0x4a3bd153 + .word 0x000340f4 + .word 0x4194796e + .word 0xfffe0af0 + .word 0xeb5e051a + .word 0x00006c59 + .word 0x4bfb9526 + .word 0xfffd7668 + .word 0x3fc5255f + .word 0xfffed1c1 + .word 0xdabc0a53 + .word 0x0003de3b + .word 0x00b054e4 + .word 0x0001b192 + .word 0x6b030d3c + .word 0xfffe9fd1 + .word 0x9c903237 + .word 0xfffe1c39 + .word 0xbc51aee0 + .word 0x00014ca2 + .word 0x04e9227c + .word 0x00032f44 + .word 0xd06e8ff1 + .word 0x00003351 + .word 0x0ccbcc21 + .word 0xfffd256e + .word 0x1450a362 + .word 0xfffcbd9d + .word 0xda2f1a1f + .word 0x0002c6ac + .word 0x177bc455 + .word 0xffffd1e8 + .word 0x58ba6ef5 + .word 0x00028227 + .word 0x6a13a449 + .word 0x0003c0f9 + .word 0x369a0372 + .word 0x0003091c + .word 0x7ebc54b7 + .word 0xfffdf39b + .word 0x07d745ff + .word 0x0001cdd9 + .word 0xb8f7505a + .word 0x000076bb + .word 0x84acecc2 + .word 0x000053eb + .word 0x7377b3e9 + .word 0x0003c76b + .word 0x671d91c9 + .word 0x00029362 + .word 0x1ff562fe + .word 0x0002d496 + .word 0xf792dd3e + .word 0x00005b89 + .word 0xddbb79de + .word 0xfffecdcf + .word 0xd05c69d0 + .word 0x000076dd + .word 0xdb5f1659 + .word 0x0003dde9 + .word 0x6c41d43c + .word 0x00013a9a + .word 0x8651ba8e + .word 0x00002f3e + .word 0x71aeed38 + .word 0xfffc0356 + .word 0x3c0a4aa0 + .word 0xfffdc12c + .word 0x2b195357 + .word 0xffff4e68 + .word 0x63cb3cb9 + .word 0xffffe3ff + .word 0xdba69539 + .word 0xffffc773 + .word 0x9e9397f4 + .word 0x00018992 + .word 0x277332b3 + .word 0xfffc459d + .word 0xc40b5fe9 + .word 0xffffa850 + .word 0xab1d7828 + .word 0x0000702e + .word 0x25753149 + .word 0x000309b6 + .word 0x2da6facc + .word 0x0000bf36 + .word 0x1a70fcd7 + .word 0xfffdf7de + .word 0xa4b8e05d + .word 0x0002a7cd + .word 0xb1b8fa26 + .word 0xfffe88a3 + .word 0xa8909b5b + .word 0xfffc3c9a + .word 0xfe22aa9f + .word 0x0002ed5b + .word 0x26ee2f80 + .word 0xfffc3840 + .word 0xba9318ed + .word 0xfffd73bb + .word 0xcbddcc07 + .word 0xffffc83d + .word 0xecb59f6b + .word 0x000021f4 + .word 0xbaa1f7a3 + .word 0x0000da48 + .word 0x379f4925 + .word 0x00012432 + .word 0xaeae7df2 + .word 0x00004deb + .word 0x9bf441d3 + .word 0x0001db47 + .word 0x80890332 + .word 0xfffc85ed + .word 0xa7afc2d8 + .word 0xffffad76 + .word 0xe723993d + .word 0x0003cc81 + .word 0xc1929f90 + .word 0xfffe9e13 + .word 0xdaff0b94 + .word 0x0003a018 + .word 0x26f607ca + .word 0x00007dac + .word 0x3b571395 + .word 0xfffe4f72 + .word 0xf5cbb7a8 + .word 0x000006a5 + .word 0x1807a185 + .word 0xfffcd73a + .word 0x74c3511b + .word 0xfffd24b2 + .word 0x71e78e09 + .word 0xfffd5139 + .word 0x892ea5e4 + .word 0xfffcf722 + .word 0x755943bc + .word 0xfffd5ac7 + .word 0x1e6e5107 + .word 0x0001e724 + .word 0x9d9e39d9 + .word 0xffff8134 + .word 0xfb0026f9 + .word 0x0002b0c8 + .word 0xe7e7c5b9 + .word 0xffff2d2a + .word 0x3e388df2 + .word 0x000372ce + .word 0xfc66f6d8 + .word 0xfffd970c + .word 0xd2f56155 + .word 0x0002f1f8 + .word 0x4beb2f11 + .word 0xffffb776 + .word 0x7aa69f25 + .word 0xfffe4e4e + .word 0x4013e74f + .word 0x00024895 + .word 0x37c5d88b + .word 0xffffdb59 + .word 0xb8795ee1 + .word 0xfffc8d33 + .word 0xfae10c1d + .word 0xfffcd1f6 + .word 0xda4492d8 + .word 0x000365e8 + .word 0x1d47a08c + .word 0xfffe4976 + .word 0x02c4aaa6 + .word 0x0002d164 + .word 0xb5a94823 + .word 0xffff5b2a + .word 0x8d6f17d8 + .word 0xfffc6a8d + .word 0xc7806da7 + .word 0xffff6d0b + .word 0x207f2fe3 + .word 0xfffd16a7 + .word 0xfbb5c71f + .word 0x0001dbc1 + .word 0xf057d5de + .word 0xffff8b5a + .word 0xb80ec57b + .word 0xfffcf85f + .word 0xd7fa71d8 + .word 0x0000d390 + .word 0xaa6e1fb6 + .word 0x00026101 + .word 0x07b18e23 + .word 0xffff1e43 + .word 0xfc61c286 + .word 0xfffda1f1 + .word 0x4b42de7e + .word 0x00012c18 + .word 0xabd2163b + .word 0x000110b1 + .word 0x2ce615d9 + .word 0x00015464 + .word 0x8c28245f + .word 0xfffc3b78 + .word 0xee9d0e3e + .word 0x0003a438 + .word 0xf4613063 + .word 0x00015dcd + .word 0x2f0f91f9 + .word 0x00017416 + .word 0x213c009f + .word 0xfffffe2b + .word 0xecaff72a + .word 0x000245b1 + .word 0xffdf259f + .word 0x00019a91 + .word 0x3c7e9ff8 + .word 0xfffc0278 + .word 0xfd359293 + .word 0xfffc1cd5 + .word 0x9329f861 + .word 0x00017423 + .word 0x65930696 + .word 0xffffeb55 + .word 0x49a42987 + .word 0xfffcd87b + .word 0x725c1734 + .word 0x00036bbc + .word 0xa1f95d05 + .word 0xfffcb3cd + .word 0xb7ebaf9f + .word 0xfffe691b + .word 0x3a569732 + .word 0xfffd0a85 + .word 0x7667753d + .word 0x000330e6 + .word 0x3332730f + .word 0xfffcf27a + .word 0x2ca82370 + .word 0x00013b61 + .word 0x35081106 + .word 0xfffec4e1 + .word 0x5ad34a46 + .word 0x000242b3 + .word 0xcb0a65e8 + .word 0xffff12f6 + .word 0x53a6503b + .word 0x000246e5 + .word 0xf7b79628 + .word 0x0003af68 + .word 0xdb7fdae7 + .word 0x0003f79c + .word 0x83743cf6 + .word 0xfffd7b54 + .word 0x0e6b42a8 + .word 0x000386a2 + .word 0x619d738c + .word 0x000372f3 + .word 0x0e869bc5 + .word 0xfffe8a37 + .word 0xa747100d + .word 0xffffaa9c + .word 0x09cb43b6 + .word 0x00016177 + .word 0x822d4216 + .word 0xfffe883b + .word 0x8760d07d + .word 0xfffd699a + .word 0x6e7674c6 + .word 0x0000edc6 + .word 0xcf407648 + .word 0xfffcc058 + .word 0xeed98ebf + .word 0x0003f0ea + .word 0x231d78e5 + .word 0xffff9c1f + .word 0x87efba28 + .word 0x00018008 + .word 0x7b39165e + .word 0x0003e213 + .word 0x3f3a6994 + .word 0xfffdfacc + .word 0x9730e6fb + .word 0xfffd91d0 + .word 0xfb97b079 + .word 0x0001f0c2 + .word 0x18444597 + .word 0x0000f58a + .word 0xd7e11b8d + .word 0xfffea3cb + .word 0x1f74b692 + .word 0xfffd5510 + .word 0x0ac3a1cc + .word 0x0001b244 + .word 0x4f4b8b78 + .word 0xfffc119c + .word 0x629b8b25 + .word 0xfffc7d0d + .word 0xc4664b35 + .word 0x00018e50 + .word 0xd08586f7 + .word 0x0003e5fa + .word 0xefee33e5 + .word 0xffffabd8 + .word 0x19b8db14 + .word 0x0000ca90 + .word 0xaed29762 + .word 0x00010131 + .word 0xf92f5866 + .word 0x0000dfdd + .word 0x182b7114 + .word 0xffffcce8 + .word 0x92c19d0a + .word 0xfffd0ab9 + .word 0x59270bfe + .word 0xffffef7b + .word 0x9611d335 + .word 0xfffef8a7 + .word 0x69510dbd + .word 0xffff840c + .word 0x8517e323 + .word 0xffff7cad + .word 0xfb3da934 + .word 0x0001071e + .word 0x3b3de15c + .word 0xfffedda1 + .word 0x9ce58393 + .word 0xfffdfee9 + .word 0x13c3b143 + .word 0xfffd6bc6 + .word 0xaf6d9af9 + .word 0xfffcbf71 + .word 0x85ca235b + .word 0xffff715a + .word 0x6dba1c94 + .word 0x00030939 + .word 0xea3a7c7c + .word 0x00008658 + .word 0x87d9d285 + .word 0x0000ffb9 + .word 0xb360d9ec + .word 0xfffcf4a3 + .word 0xabf0ad54 + .word 0xfffe273a + .word 0xc8125868 + .word 0x0000ab51 + .word 0x0f902846 + .word 0x000396b7 + .word 0xcf316ba0 + .word 0xfffcc43c + .word 0xcbcf2192 + .word 0xfffdb0a5 + .word 0xd522e243 + .word 0x0000fc8a + .word 0x0c07afd6 + .word 0xfffc9b7f + .word 0xb341b9ef + .word 0x000057ee + .word 0x913af29d + .word 0xfffd9319 + .word 0xc6b75af9 + .word 0xfffedf3f + .word 0x92ab37b1 + .word 0xfffe5210 + .word 0x29295891 + .word 0x00006bb1 + .word 0x88494490 + .word 0xfffe9f31 + .word 0x76e0fef8 + .word 0xfffd0e55 + .word 0x242f3fc9 + .word 0x000369c1 + .word 0x7d59a441 + .word 0xfffdbbcf + .word 0x7abc0428 + .word 0x00025030 + .word 0x43eb1917 + .word 0xffff492f + .word 0x6ec71527 + .word 0xfffd3c80 + .word 0x5ced4259 + .word 0x000061cd + .word 0x2d166c5d + .word 0xfffde4ff + .word 0x6fc11298 + .word 0x00023fd0 + .word 0xb7cd8194 + .word 0x0003541b + .word 0x7f5a0157 + .word 0xffffeb7a + .word 0x37d07ae9 + .word 0x0002d396 + .word 0xd7744b42 + .word 0x0003ee83 + .word 0xae823262 + .word 0xfffcb970 + .word 0x7379a282 + .word 0xfffe6c5c + .word 0xaf0b80c2 + .word 0xfffe4592 + .word 0x92503c8e + .word 0x00038690 + .word 0x9a40b0ea + .word 0xfffd4769 + .word 0x1e8b0138 + .word 0xfffe07f2 + .word 0x9d7862bb + .word 0xfffd4afc + .word 0xb7757ef0 + .word 0x00037186 + .word 0xae13f2b3 + .word 0xffff05af + .word 0x4cf1f89c + .word 0xfffc3801 + .word 0xc3c8c04f + .word 0x0002773f + .word 0x67165cd7 + .word 0xfffdc30a + .word 0xaa581c4b + .word 0x000210a6 + .word 0x779cf782 + .word 0xffff9034 + .word 0x2940e10b + .word 0x00025d2d + .word 0xec39aede + .word 0xfffff9e1 + .word 0x5ce87a39 + .word 0x0001082c + .word 0x413cc39c + .word 0xffff2775 + .word 0xd4f6861e + .word 0x000195ca + .word 0x1c49a4b8 + .word 0xfffc48f5 + .word 0x07e18e39 + .word 0x00037e08 + .word 0xd96ab417 + .word 0x0002835a + .word 0xf5e1ce4b + .word 0xffffda63 + .word 0x82773eff + .word 0xffff00b2 + .word 0xd4944c44 + .word 0x0001b7ed + .word 0x02a9e338 + .word 0xfffcb15f + .word 0x4f7124f3 + .word 0x00006887 + .word 0x4a6f16ff + .word 0xfffe1ada + .word 0x5b94254b + .word 0xfffca68c + .word 0xade3141f + .word 0x0002ba11 + .word 0x65362fe1 + .word 0x000051b6 + .word 0xef9ab94a + .word 0x00024797 + .word 0x7d32fc52 + .word 0xfffc4b94 + .word 0x8e35708c + .word 0xfffea167 + .word 0xaecbd235 + .word 0x0002b50b + .word 0xdf176ce8 + .word 0x00016fdb + .word 0x52aaddb7 + .word 0xfffd73c2 + .word 0x056000db + .word 0xfffeb1bb + .word 0x2cd98d75 + .word 0xfffc832c + .word 0x9eea22e4 + .word 0x000246ac + .word 0x695a9197 + .word 0xfffd4835 + .word 0xd9c0c30c + .word 0x00026405 + .word 0xe5e3cd7c + .word 0x0000346a + .word 0x159304db + .word 0xfffd2b47 + .word 0xa889a08e + .word 0x00033073 + .word 0x7eb771ee + .word 0xffffddb0 + .word 0x8ffb3511 + .word 0xfffe2660 + .word 0x2aa41ec5 + .word 0xfffce7a2 + .word 0x18eac95e + .word 0x00011ecf + .word 0x3a1e27d4 + .word 0xfffcf645 + .word 0xe47450bf + .word 0xfffe969c + .word 0xe1b00108 + .word 0xffff3801 + .word 0x29e4fa81 + .word 0x00024e71 + .word 0xea959497 + .word 0x000370e7 + .word 0x63cf5a66 + .word 0x00008703 + .word 0xa4606d82 + .word 0xfffc64bb + .word 0xd81fd1d6 + .word 0xfffdf136 + .word 0xa8160d54 + .word 0x000200e7 + .word 0x271a7ce0 + .word 0xfffc6f25 + .word 0x9f7cf809 + .word 0xfffec08c + .word 0x4c6129bc + .word 0xfffceb98 + .word 0x5bd3b4e8 + .word 0x00016563 + .word 0xe7f95c46 + .word 0x00028650 + .word 0x90936324 + .word 0x0000597d + .word 0x7b5f1925 + .word 0x00033f38 + .word 0xdd711b7f + .word 0x000102be + .word 0xb3689f2b + .word 0xfffdbdaa + .word 0x1191a6e2 + .word 0x0000c373 + .word 0x9a97c685 + .word 0xfffec54f + .word 0x8fcc5edf + .word 0x0002cf8d + .word 0x7db58dcd + .word 0xfffd60e1 + .word 0x907d77c8 + .word 0xfffdef3b + .word 0x683d85bf + .word 0xfffd115a + .word 0x579193a1 + .word 0xfffd61d8 + .word 0x399d18d4 + .word 0x00019d46 + .word 0x3a23e9a8 + .word 0xffffbe25 + .word 0x3b5bf7d7 + .word 0xfffec1f8 + .word 0x49fcb609 + .word 0x00008b82 + .word 0x58100e9a + .word 0x00007156 + .word 0xb7f51764 + .word 0xffffce33 + .word 0x98e80857 + .word 0xfffd7734 + .word 0x5aa1eca5 + .word 0xfffdbf31 + .word 0xc4653e51 + .word 0xffffaf8a + .word 0x06232c18 + .word 0xfffcfdea + .word 0xa510a300 + .word 0x0003c9f3 + .word 0xf88640a6 + .word 0xffffa67c + .word 0xe3f9c605 + .word 0xfffc8985 + .word 0xea9b828e + .word 0x0001d6d2 + .word 0xf329dc67 + .word 0xfffeee76 + .word 0xb2eff9ad + .word 0xfffc1fae + .word 0xb3edca85 + .word 0xffff35ae + .word 0xdbf84f94 + .word 0x000381ce + .word 0xd70d0d3e + .word 0xffffe6cf + .word 0xf0ff45fa + .word 0xfffe31e7 + .word 0x5ff1091e + .word 0x0003592f + .word 0xe461702a + .word 0xfffe1072 + .word 0x494fd172 + .word 0xfffdbec6 + .word 0xbf6cd481 + .word 0x00036fc3 + .word 0x3bfc50c5 + .word 0xfffff42e + .word 0x60d3591f + .word 0x0000d48c + .word 0x81c236d5 + .word 0x00017279 + .word 0x55f527da + .word 0x0001d685 + .word 0x37eb98c4 + .word 0x00029b65 + .word 0x440459dd + .word 0x00022d18 + .word 0x8355407b + .word 0x00013e82 + .word 0x7b4f78f5 + .word 0x0000e342 + .word 0x37df286a + .word 0xffff75fa + .word 0x6316d709 + .word 0x0001dec9 + .word 0xa72f15ce + .word 0x0002e727 + .word 0xd894c50f + .word 0x000238b2 + .word 0xd8599f19 + .word 0xfffdc09a + .word 0xd93eb474 + .word 0x000125be + .word 0x37ade937 + .word 0xffff4da4 + .word 0x88426afd + .word 0xfffefd8d + .word 0xdffca79b + .word 0xfffcf216 + .word 0xa7fdb245 + .word 0x00008e1e + .word 0x9195a574 + .word 0x00003ac5 + .word 0x8520a803 + .word 0xfffcbb02 + .word 0x739f514a + .word 0xfffcf2cf + .word 0x0291712d + .word 0x00035a9f + .word 0x55ea97b3 + .word 0xfffde64d + .word 0x3278753c + .word 0xffff3ced + .word 0x30f70f7a + .word 0xfffeeed7 + .word 0xafe67c39 + .word 0x00023bc8 + .word 0x0d8d5743 + .word 0xffffcfd2 + .word 0x2986d2a7 + .word 0x0001f2f7 + .word 0x1f5060bc + .word 0x00019c3c + .word 0xa92d6ccb + .word 0x0002f142 + .word 0x8c7bb9fa + .word 0xfffe1d69 + .word 0xe28bb891 + .word 0x0001ce9b + .word 0x2b8c8fab + .word 0xfffed9ff + .word 0x4dad1f4f + .word 0x00006dbc + .word 0xa54bd2a2 + .word 0x0000d3ee + .word 0x1acde409 + .word 0x00015d51 + .word 0x569e447e + .word 0x0000b313 + .word 0x4c018fc6 + .word 0xfffc96c3 + .word 0x93988e41 + .word 0x000276b9 + .word 0xb1b35d19 + .word 0xffff475a + .word 0x91cd5cc1 + .word 0xffff1775 + .word 0x29f86d71 + .word 0xfffe1db3 + .word 0x2c3a6fca + .word 0x0001ae2e + .word 0xe9acea21 + .word 0x000135af + .word 0xbee227b3 + .word 0x0002eea6 + .word 0x7c078508 + .word 0xfffda41f + .word 0x22e103a3 + .word 0x0001bfe5 + .word 0xaeb79dc1 + .word 0x0003d37c + .word 0x2c204521 + .word 0x00006440 + .word 0xe1d1b0cf + .word 0x0002cb1c + .word 0xcd30f89f + .word 0x000166e9 + .word 0xaeb6879b + .word 0xffffb9a1 + .word 0x6ec65a79 + .word 0xfffc63b3 + .word 0x07b12db4 + .word 0x00013f11 + .word 0x09e6708c + .word 0x0000071f + .word 0xb233e7ff + .word 0xfffefb71 + .word 0x3a7b7b84 + .word 0x00035e46 + .word 0x90d4d479 + .word 0x0001f54d + .word 0xf93b50cc + .word 0xffff919a + .word 0xf27237fe + .word 0x0000a391 + .word 0x1b33eea4 + .word 0x00001b29 + .word 0x1aaea1cd + .word 0x00015eae + .word 0x3a925bcf + .word 0x0002a1cc + .word 0x3d8bdbce + .word 0x00020cf0 + .word 0xf2747938 + .word 0x00029303 + .word 0xc961bc43 + .word 0x0000d588 + .word 0xb3248f5e + .word 0x000393e3 + .word 0x9e09f2e0 + .word 0xffff0cbd + .word 0x9386d20c + .word 0xfffe8cbd + .word 0xfdb048c0 + .word 0xfffeb079 + .word 0xd595dfb9 + .word 0x0000850b + .word 0x780bcd87 + .word 0xfffeda0b + .word 0xcefb5b85 + .word 0x00039cd2 + .word 0x48211328 + .word 0xfffecba0 + .word 0x5f52dcfa + .word 0x0002c4f3 + .word 0xcccffd68 + .word 0x00003691 + .word 0x63c0a70c + .word 0xfffcbbab + .word 0x9d7fbd27 + .word 0x00035015 + .word 0x76673fa3 + .word 0x000352eb + .word 0x1f2e3e2c + .word 0xfffd4a36 + .word 0xdbb65431 + .word 0x0000cbdb + .word 0x2d7d9066 + .word 0xfffcec15 + .word 0xa5253a5d + .word 0x0000b9a4 + .word 0x8a0db5f7 + .word 0x0000d2a8 + .word 0x7bcfd1f2 + .word 0xffffac96 + .word 0xead5c15f + .word 0x000058de + .word 0xd5e0ff27 + .word 0xffffbbcf + .word 0x813b146f + .word 0x000023e2 + .word 0xededb7ab + .word 0x00039c95 + .word 0x9dfd844e + .word 0xfffd96b2 + .word 0x28090c4c + .word 0xffff166d + .word 0x3f826eef + .word 0xfffe2ad8 + .word 0x3c387543 + .word 0xfffebee5 + .word 0xe40a2290 + .word 0x0001b203 + .word 0x7d24ed83 + .word 0xfffed83a + .word 0xb247a385 + .word 0xfffef196 + .word 0x56a1ff80 + .word 0x0001f10f + .word 0x432d9331 + .word 0x000398d6 + .word 0x9d351c43 + .word 0x00006ee7 + .word 0x7cf3efc8 + .word 0x0001411b + .word 0x584b19aa + .word 0x0002d4aa + .word 0x3f332576 + .word 0x00003d84 + .word 0x8ce112e6 + .word 0xfffc814c + .word 0x2fd649d8 + .word 0xfffd1e6e + .word 0x3eb89e85 + .word 0xfffecf1a + .word 0x5ba1f4db + .word 0x00039a17 + .word 0xc9b68d79 + .word 0x0002eb46 + .word 0x7905eb52 + .word 0xfffe9cca + .word 0x42226cc2 + .word 0xfffdbaa0 + .word 0x839d760b + .word 0x0002d2a1 + .word 0x2440b00e + .word 0x0003f0a0 + .word 0x38e05410 + .word 0xfffeab9c + .word 0xdda02f67 + .word 0xfffdb84f + .word 0x34b73e17 + .word 0xfffc87ae + .word 0xf6805605 + .word 0x000020f9 + .word 0x0a0550c2 + .word 0x0002e0fc + .word 0x5ebc86d4 + .word 0xfffc2db0 + .word 0x5d3a0224 + .word 0xfffffcf6 + .word 0x4b3c040b + .word 0x00011f42 + .word 0xad05802c + .word 0x00029409 + .word 0xba46fff8 + .word 0x00006173 + .word 0xaeadaec7 + .word 0xfffd561e + .word 0x9a586ac6 + .word 0x00030a28 + .word 0x27fa06b7 + .word 0xffff0976 + .word 0x0109d520 + .word 0xfffe99e3 + .word 0x9988aea9 + .word 0x00016b2d + .word 0x83b54689 + .word 0x00002f07 + .word 0x7033e8a4 + .word 0x0003aafe + .word 0xf20fd1f8 + .word 0xfffe1803 + .word 0x27189505 + .word 0xffff2be2 + .word 0x373a4207 + .word 0xfffcccdb + .word 0x1f7aac05 + .word 0x00015954 + .word 0xb07c4b9a + .word 0xfffd7dd5 + .word 0xfc22edfa + .word 0xfffc836a + .word 0xdad58042 + .word 0xfffc0f92 + .word 0xcea82f71 + .word 0x0001ca78 + .word 0xd6f2a6c5 + .word 0x00036976 + .word 0x6b47a3f5 + .word 0xfffc9511 + .word 0x1fcec20d + .word 0x00034bcc + .word 0xee68a4d9 + .word 0xffff3bb9 + .word 0xfdb053e2 + .word 0x000183cb + .word 0xd27fc079 + .word 0xfffd9f3f + .word 0x140cf98f + .word 0xfffdb322 + .word 0x698bc319 + .word 0xfffea5c8 + .word 0x2015c2f5 + .word 0x0001a777 + .word 0x95002ab5 + .word 0xfffcba25 + .word 0x0cb577f7 + .word 0xffff038f + .word 0x019f8631 + .word 0x000221c8 + .word 0xecc79f5f + .word 0x00030dd3 + .word 0xf774065b + .word 0x0002424d + .word 0xe1acd628 + .word 0xfffc80ea + .word 0x316cfc67 + .word 0xffff1278 + .word 0x9e227cf4 + .word 0x0000dcae + .word 0x3d199757 + .word 0x0003e54a + .word 0x42423c45 + .word 0xffffcee7 + .word 0x535f8cb6 + .word 0xfffdfe14 + .word 0x8c2c31a4 + .word 0xfffce5aa + .word 0xd760ffb5 + .word 0x0001fe1c + .word 0xa211a585 + .word 0xfffcdff9 + .word 0xa4d6b5f6 + .word 0xffff7cd1 + .word 0xe95e624a + .word 0xfffe6cb0 + .word 0x0ace3fb0 + .word 0x0003e3ee + .word 0x830a167d + .word 0xffff6336 + .word 0xf1327ca8 + .word 0xfffeeaae + .word 0x31e482b7 + .word 0xfffcfefb + .word 0x3fcf4726 + .word 0xffff0ef9 + .word 0xaab971b4 + .word 0x00027487 + .word 0x50c981c5 + .word 0xfffd04f6 + .word 0xa84fba6f + .word 0x0002588f + .word 0xc334b20f + .word 0x00020304 + .word 0x64a51ecc + .word 0xfffefe2c + .word 0x7b33bbfc + .word 0x00019cc4 + .word 0x28a67f85 + .word 0xffff9331 + .word 0x7307c43f + .word 0xffff4582 + .word 0xd8c3c2b4 + .word 0xfffce0cc + .word 0xd3e0cd02 + .word 0xfffe5790 + .word 0xf1733e7b + .word 0x000155f7 + .word 0x46de68d6 + .word 0xfffd2521 + .word 0x0be59761 + .word 0x0002fe73 + .word 0xd41b8cfd + .word 0x0002e8d6 + .word 0xceacf1d4 + .word 0x00025483 + .word 0x22193466 + .word 0xffffa7de + .word 0xdfa38450 + .word 0x000382c6 + .word 0xa9a7c1c5 + .word 0x0001554b + .word 0x1fc4b7fb + .word 0xffff4960 + .word 0xdf904c20 + .word 0x0001176e + .word 0x7b822e86 + .word 0xfffff61e + .word 0x79582e2f + .word 0xfffff3bd + .word 0x45f9965d + .word 0xfffefa96 + .word 0x6aafbd35 + .word 0xfffe2614 + .word 0x8372b0ba + .word 0xfffef471 + .word 0x2f4d9528 + .word 0xfffffc1f + .word 0x476b38ba + .word 0xfffcd9cc + .word 0xe93c44d9 + .word 0xfffcd9d9 + .word 0xfc99420c + .word 0x00014947 + .word 0x23ccb418 + .word 0xfffc0c8c + .word 0xad5d48ac + .word 0x00004566 + .word 0x2abac62b + .word 0x00029bc0 + .word 0xd2dbe5bf + .word 0xfffdddf1 + .word 0xc414a5a7 + .word 0x00017b0a + .word 0xaf8d6fed + .word 0x00004b75 + .word 0x546c9372 + .word 0x0000f8f3 + .word 0x063daeeb + .word 0x0001e75f + .word 0x4321bd2b + .word 0xfffde79d + .word 0x144b26cd + .word 0xfffff06e + .word 0x7c90f148 + .word 0x0000800c + .word 0xb32596b2 + .word 0xffff3103 + .word 0xa813e263 + .word 0xffff0b06 + .word 0x5136fd46 + .word 0xffff810a + .word 0x7dd12b24 + .word 0x00015c4b + .word 0x9db65299 + .word 0xffffc978 + .word 0x6f6a6c04 + .word 0xfffeb2b0 + .word 0xbbfc7e96 + .word 0xfffc7e34 + .word 0x92894929 + .word 0x0002f9f6 + .word 0xc2889031 + .word 0xfffc6ee7 + .word 0x258c91f0 + .word 0xfffcd5bc + .word 0xfa295aa5 + .word 0xfffd6281 + .word 0x6b020460 + .word 0xfffc660c + .word 0xeed449fd + .word 0xffff3647 + .word 0xead97cac + .word 0x00038f54 + .word 0x083f6fb6 + .word 0x00001186 + .word 0xba296ad0 + .word 0x00023568 + .word 0xf06e7895 + .word 0x0000c4a0 + .word 0x9a8d62e4 + .word 0xfffc0669 + .word 0x85c5b6f8 + .word 0x000221c0 + .word 0x71b83fcb + .word 0x0003030c + .word 0xb8f2e5bd + .word 0x0002fe25 + .word 0x054f5e16 + .word 0xfffe789e + .word 0x50d9b6d5 + .word 0xfffdb037 + .word 0x56404dc1 + .word 0xfffe37c4 + .word 0xe99611ba + .word 0x00011b36 + .word 0x7023d678 + .word 0xfffc3dff + .word 0xbd1b54c2 + .word 0x000300ba + .word 0x6c61f79a + .word 0xfffd21a6 + .word 0x8abebb63 + .word 0x000073e6 + .word 0x2ffb5a9e + .word 0xfffdc360 + .word 0x4e6eb043 + .word 0x0000fbba + .word 0x87b44b4d + .word 0xffffa678 + .word 0xe21b833c + .word 0xfffd9742 + .word 0x97705591 + .word 0x0003eb4a + .word 0x7098cfac + .word 0x00008266 + .word 0x7c72438d + .word 0xfffe8655 + .word 0x4519160e + .word 0xffff4e2d + .word 0x45438452 + .word 0x0001b052 + .word 0xead3ca96 + .word 0x0003b135 + .word 0xfdcd7a18 + .word 0xfffd072a + .word 0xc0582517 + .word 0xfffc6fce + .word 0xe80874be + .word 0x0003e3d0 + .word 0x097fbf6c + .word 0xffff17ec + .word 0x008cfd10 + .word 0xfffcdd25 + .word 0xad4add3c + .word 0xfffc9075 + .word 0x3adeee71 + .word 0xfffc11ac + .word 0x71f7f7a1 + .word 0xfffe02eb + .word 0x8818da62 + .word 0x000304b6 + .word 0x6a4f2a77 + .word 0x0003608b + .word 0x84f767a3 + .word 0x00010ede + .word 0x6bdc2d72 + .word 0xffffd771 + .word 0x7878732e + .word 0x000300cf + .word 0x674860df + .word 0xfffe1eb6 + .word 0xf2cc4ec1 + .word 0xfffd86b0 + .word 0x905aeceb + .word 0x00020ca9 + .word 0x40761f96 + .word 0x0000b251 + .word 0x9b2b4279 + .word 0xfffd999c + .word 0x1b81addf + .word 0x00017946 + .word 0xc34ffa02 + .word 0xffff6283 + .word 0x89acaab2 + .word 0xfffc664d + .word 0x806d77d0 + .word 0x00003935 + .word 0xdf21b47e + .word 0xfffea86b + .word 0x0e9a03e9 + .word 0x00035ab7 + .word 0xd620d4c2 + .word 0xffffab2c + .word 0xc91915e0 + .word 0x0003946a + .word 0xa0754bc9 + .word 0xfffc6f54 + .word 0x2f09af89 + .word 0x0001dcc1 + .word 0x59a5aadc + .word 0xfffc680f + .word 0x128c5296 + .word 0xfffe1636 + .word 0xc3a86770 + .word 0x00012cc3 + .word 0x2e05ffd7 + .word 0xfffecb95 + .word 0x582e3bce + .word 0xffff811e + .word 0x5cbfedac + .word 0x0003585a + .word 0x5e2d5478 + .word 0xfffe3f63 + .word 0x3b0a3482 + .word 0x0002a18e + .word 0xe7f59c2c + .word 0x0003afce + .word 0x9bcadf4c + .word 0x000046c3 + .word 0x597276d0 + .word 0xfffdffa6 + .word 0xb7d400c1 + .word 0xfffc0e80 + .word 0x8db2f621 + .word 0x000380eb + .word 0x71b0ab75 + .word 0x0002fd5d + .word 0x159228ff + .word 0xfffdf54d + .word 0xbd22a620 + .word 0xfffd7645 + .word 0x2df08245 + .word 0xfffd5e78 + .word 0xa050bb02 + .word 0xffff4556 + .word 0x775d0676 + .word 0xfffec165 + .word 0x9718792b + .word 0xfffe81b1 + .word 0xcf1eaa51 + .word 0x00033046 + .word 0x4a0824db + .word 0x00003257 + .word 0xf3e61779 + .word 0xfffef4fc + .word 0x0ab0a50c + .word 0xffff643a + .word 0x4e50e6f4 + .word 0xfffc0d26 + .word 0x1604350a + .word 0xfffc3edd + .word 0x49c1c9d2 + .word 0x0003a4e3 + .word 0x2331694e + .word 0xfffcc551 + .word 0xcee91072 + .word 0xfffc0f2c + .word 0x3b61cfe1 + .word 0x00007268 + .word 0xbc662f06 + .word 0xfffef770 + .word 0x4c16b3f5 + .word 0x0002930b + .word 0xec55584f + .word 0xffffd3f4 + .word 0x26d2653f + .word 0x00015dc0 + .word 0xf2d832db + .word 0xfffcbb4a + .word 0x0b920fd8 + .word 0x000017b3 + .word 0x3b6a5cfd + .word 0xfffe49d8 + .word 0xed45b929 + .word 0xfffef13d + .word 0x913028d8 + .word 0xfffec136 + .word 0x3872e126 + .word 0xffffd10a + .word 0x18919740 + .word 0x0001491a + .word 0xbf39cfc2 + .word 0xfffeb603 + .word 0xad32496b + .word 0xfffcc1eb + .word 0xc6b42ad5 + .word 0xfffec99e + .word 0xb5e70c29 + .word 0x0000870e + .word 0xbcb15499 + .word 0xfffcb9e8 + .word 0x6a09f24a + .word 0xfffdad28 + .word 0xff6f29d3 + .word 0xfffca602 + .word 0x8009f93a + .word 0xfffff287 + .word 0xd84704e6 + .word 0xfffe44c7 + .word 0x7bac8dd8 + .word 0xffff0f3f + .word 0xe4d91d3b + .word 0x000239a5 + .word 0x28fa85d1 + .word 0x0002c1af + .word 0xb3e79c96 + .word 0xfffc64e0 + .word 0xefebc393 + .word 0xffff62bb + .word 0xff5c488d + .word 0xfffc26da + .word 0x91b5cc1c + .word 0xffffe7eb + .word 0xac54cfa6 + .word 0xfffc0f7c + .word 0xb2e673b9 + .word 0xfffc2bbf + .word 0x77c0f110 + .word 0x00035b98 + .word 0xcc932ec6 + .word 0xfffdaeb4 + .word 0x87ed85a7 + .word 0x0001ec23 + .word 0x31c4694d + .word 0xfffcfdf8 + .word 0xc25a3de5 + .word 0x0000909c + .word 0x46f074b9 + .word 0x00020312 + .word 0x479c0306 + .word 0xffff209d + .word 0x91e49e0b + .word 0xfffc75a8 + .word 0xb82a4f05 + .word 0x00017fcb + .word 0x191fcdb5 + .word 0x00020257 + .word 0xf59f4424 + .word 0xfffcaa20 + .word 0x7f946aae + .word 0x00024618 + .word 0x028e1cec + .word 0xfffc1ce7 + .word 0x93438cfb + .word 0xfffdaa31 + .word 0xc1149cda + .word 0x0003071e + .word 0x5f9732fb + .word 0xffff0f8f + .word 0x668f4833 + .word 0x0001c6b3 + .word 0xfd296d71 + .word 0xfffcab2b + .word 0xe39ea801 + .word 0x0002121f + .word 0xca6df7ed + .word 0x00036fce + .word 0x85fa010b + .word 0x0000ed29 + .word 0xf46532b0 + .word 0x0001183b + .word 0xdaf7fbf2 + .word 0xffff030f + .word 0x2561680a + .word 0x00003001 + .word 0x2e5763cd + .word 0x0001cacd + .word 0xbf2df1ae + .word 0xfffe467a + .word 0x278da020 + .word 0xfffef9fe + .word 0xfe89844d + .word 0x0003bcd2 + .word 0x0ff023c5 + .word 0xfffe0b45 + .word 0xae526dec + .word 0x0002b108 + .word 0x5cdffa35 + .word 0x000266d8 + .word 0xe065a0ec + .word 0x00035a8a + .word 0x65e4bbb4 + .word 0xfffd9e28 + .word 0x5bd91b3a + .word 0x000396c4 + .word 0x5e8f2db9 + .word 0x00023da4 + .word 0xbd70adc6 + .word 0x00035a24 + .word 0xda53c224 + .word 0xfffd122c + .word 0x76883419 + .word 0xffffc6fd + .word 0x772ac463 + .word 0xffffa66c + .word 0x7cb28c90 + .word 0xffff2ea3 + .word 0x8259532a + .word 0x000071cd + .word 0x2bdb4e33 + .word 0xfffe5edd + .word 0xdf9881cc + .word 0x00006c50 + .word 0x0626d175 + .word 0x0001117f + .word 0xaf5c65ca + .word 0x0003f187 + .word 0x1ee3147a + .word 0xfffc994f + .word 0x5f8df838 + .word 0xfffce6be + .word 0xf915a626 + .word 0xfffc15dc + .word 0xc93a0d07 + .word 0x000317b2 + .word 0x5b079305 + .word 0x000308b8 + .word 0x297de55c + .word 0x0003e9f6 + .word 0x00c38c02 + .word 0x00007a67 + .word 0x327e5fe9 + .word 0x00016dbd + .word 0x11735e3b + .word 0x000192df + .word 0x21f69e7a + .word 0xffffa1c8 + .word 0xd1fcd48e + .word 0xffff883d + .word 0xd0a1f67f + .word 0x0000af7b + .word 0xf2ccf6b8 + .word 0xfffd928a + .word 0x8ca23742 + .word 0x00018159 + .word 0x62bb0d39 + .word 0x0001aa4e + .word 0x6b599553 + .word 0x000238f3 + .word 0x4949a753 + .word 0xfffe17aa + .word 0x5f33713e + .word 0x0001c5ef + .word 0xe876e2af + .word 0x0002219c + .word 0x93c09a4a + .word 0xfffc85b1 + .word 0xf4c6cf56 + .word 0x00012843 + .word 0x413a3920 + .word 0x000083e5 + .word 0x3433bb4e + .word 0xfffcac1e + .word 0x6ff2c7ad + .word 0x00038d4b + .word 0x4785e04b + .word 0xfffc8957 + .word 0x067a0774 + .word 0x00033356 + .word 0x73ab681b + .word 0x0003006c + .word 0xc7252fb1 + .word 0x000385e3 + .word 0x1dc9c690 + .word 0x00024e41 + .word 0x38aeacc3 + .word 0x0001c416 + .word 0xb3ccc042 + .word 0xfffe3338 + .word 0xb53d37b9 + .word 0x00010e79 + .word 0xce3a6c8c + .word 0xffff761a + .word 0x45a1ff3f + .word 0x0002ab91 + .word 0x94ebc35d + .word 0x000029b3 + .word 0xf5846e97 + .word 0xfffc369e + .word 0x7cafdf7e + .word 0x000260d6 + .word 0xcfd2e485 + .word 0x0000ade2 + .word 0xd366a425 + .word 0xffff3c7e + .word 0x76fe388c + .word 0xfffe3a51 + .word 0x3c469d0f + .word 0x0001345c + .word 0x54cbc136 + .word 0x0001708e + .word 0x5c0e9756 + .word 0x00001d91 + .word 0xd7f1b038 + .word 0x00028c86 + .word 0x880ee95a + .word 0xfffc78b8 + .word 0x29db7d70 + .word 0x00013d46 + .word 0x81f8daa7 + .word 0xfffc6ff1 + .word 0xf46989a8 + .word 0x0002becc + .word 0xe9f4cdf7 + .word 0x0003c1e2 + .word 0xf926976d + .word 0x00026246 + .word 0x0974dd09 + .word 0x0000c2df + .word 0xaaebf18f + .word 0x0000209b + .word 0xf1be8a1a + .word 0x00030a0b + .word 0x4d8c258f + .word 0x0000c570 + .word 0x7134e508 + .word 0x00028cb1 + .word 0x835af1d0 + .word 0xfffe590f + .word 0x90799e51 + .word 0x00025623 + .word 0xe9c2d47e + .word 0x00011bf7 + .word 0xeab68175 + .word 0xfffd4f6b + .word 0x6535d3e0 + .word 0xffff9868 + .word 0x4d2dcec8 + .word 0x00012732 + .word 0xd6fbae8e + .word 0xfffe92b9 + .word 0xb75c2d0b + .word 0x0000b10f + .word 0x32833b99 + .word 0x00023551 + .word 0xd6b302be + .word 0xfffe656d + .word 0x98ee359f + .word 0x0000e98e + .word 0x3bf90a68 + .word 0x0002c7ef + .word 0xc7a24901 + .word 0x00004f09 + .word 0xd295c620 + .word 0x0000e19b + .word 0xbd892c4c + .word 0xfffcf6cc + .word 0x89e3097a + .word 0x0002d0c9 + .word 0xf2c7251e + .word 0xfffcb46a + .word 0xaad9f4a9 + .word 0x0000df9f + .word 0xf8aaaea7 + .word 0xfffc3ed2 + .word 0x770a56d2 + .word 0xfffda2a5 + .word 0x4d301595 + .word 0x0003096d + .word 0x4b56f413 + .word 0xfffe4245 + .word 0x8afde134 + .word 0x00031182 + .word 0x6be4f0b2 + .word 0x00007fc0 + .word 0x1bc90ad4 + .word 0xffff8a5f + .word 0x6fddccd5 + .word 0x0000d711 + .word 0x171e8d6d + .word 0x00034862 + .word 0x5b757d28 + .word 0xfffd6918 + .word 0xc5150640 + .word 0xfffd94a1 + .word 0x8ef5dcdc + .word 0xfffda024 + .word 0xd4f0f307 + .word 0xffff267f + .word 0xd6965152 + .word 0x0001c6a3 + .word 0x381edd8c + .word 0x00031e32 + .word 0x126f3660 + .word 0x000319c9 + .word 0xa3d2fc6d + .word 0x00001b80 + .word 0xa169bbf4 + .word 0x000321eb + .word 0x0ee450f7 + .word 0xfffcde7a + .word 0xa65e06d6 + .word 0x0001d7f4 + .word 0xca8b124e + .word 0x0001c801 + .word 0x3cb26fef + .word 0x0000b827 + .word 0xee2cf8f0 + .word 0xfffe4e48 + .word 0x13fd29c4 + .word 0xffff3e8d + .word 0x16daba31 + .word 0xfffc2240 + .word 0x0bbac213 + .word 0x000193fc + .word 0x6278416d + .word 0xfffd6354 + .word 0x54dffcd2 + .word 0x00013110 + .word 0xe664ad0e + .word 0xfffd9197 + .word 0x538ebe38 + .word 0x000366e7 + .word 0x7c3349d2 + .word 0xfffe004b + .word 0x8709e6f7 + .word 0x000108f9 + .word 0x3bf48a2c + .word 0xfffc1bca + .word 0x62cca4b8 + .word 0x00018ecc + .word 0x28bd9095 + .word 0x00034265 + .word 0xf7660e34 + .word 0x000260fe + .word 0x0c724ee2 + .word 0xfffdb5d2 + .word 0x9d74719e + .word 0xfffe924f + .word 0x97195ad4 + .word 0xfffc3285 + .word 0x0e7341f1 + .word 0x00007f12 + .word 0x052ddc1d + .word 0xfffed27f + .word 0x7a5e6925 + .word 0x0003591b + .word 0x19edfb0a + .word 0xfffd4165 + .word 0x7cca6b1c + .word 0xffff01db + .word 0xc29872ba + .word 0xfffc4726 + .word 0x05798c42 + .word 0x00031105 + .word 0x988a5b79 + .word 0xfffc7355 + .word 0x4d76df4e + .word 0xfffcd2da + .word 0x64241f74 + .word 0x00026018 + .word 0xadd93a9e + .word 0xffff7129 + .word 0xe8cc07f9 + .word 0xfffe018a + .word 0x7b530209 + .word 0xfffd8a4d + .word 0xe9fcb553 + .word 0x00027b74 + .word 0x74b66d83 + .word 0x000032bf + .word 0x6c6658da + .word 0x0001fe7d + .word 0xc76678ab + .word 0xfffe184e + .word 0xdf32d250 + .word 0xfffcb9af + .word 0x001ccdd3 + .word 0x0001f44d + .word 0x8a239021 + .word 0x00027fd9 + .word 0x41d12181 + .word 0x00037bf0 + .word 0xbe8158ba + .word 0x000110bd + .word 0xef65da04 + .word 0xffff7abd + .word 0x5756f7e5 + .word 0x0001abc2 + .word 0x4fb566e9 + .word 0x0001fdbb + .word 0x606a4380 + .word 0xfffc9b3c + .word 0xdc31a201 + .word 0xfffc8022 + .word 0x07035eeb + .word 0x00013345 + .word 0xd1aaa974 + .word 0x0003f7df + .word 0x0985d67c + .word 0xfffde8f5 + .word 0xf1256f2b + .word 0xffff0999 + .word 0xa2fb273b + .word 0x00039cda + .word 0xca7b351a + .word 0x00038e3d + .word 0xf0f00575 + .word 0x0000a1f0 + .word 0x1636e983 + .word 0xfffe32f7 + .word 0x58517ff3 + .word 0x0003dab6 + .word 0x11dfb28c + .word 0xfffed679 + .word 0x1064e665 + .word 0x0000045c + .word 0x8d5572f3 + .word 0xfffc7c39 + .word 0x85f107b2 + .word 0xfffcacab + .word 0x65912427 + .word 0x0001aa7b + .word 0x194fcb47 + .word 0xffffc71a + .word 0x864e1f97 + .word 0xfffdcc62 + .word 0xe5de5a8f + .word 0x0001cbae + .word 0x8e557b73 + .word 0x000230eb + .word 0x5218bae7 + .word 0x0003894a + .word 0xfb5c5600 + .word 0x0002a4d6 + .word 0x15c1c413 + .word 0x00022420 + .word 0x85edb770 + .word 0x0001b308 + .word 0x8e98958b + .word 0xfffe8650 + .word 0xa0f0f15d + .word 0x0003d370 + .word 0xd3f38d41 + .word 0x0001af39 + .word 0x21cd69fb + .word 0x00011606 + .word 0xe8dafb8c + .word 0xfffc4a85 + .word 0x737e3e06 + .word 0x0002a1a5 + .word 0x0cf9decd + .word 0xfffef586 + .word 0x2d5c5332 + .word 0xfffdf2fb + .word 0x00dac94d + .word 0x0002e207 + .word 0xe58ec4ce + .word 0xffff8a56 + .word 0xb466a6f0 + .word 0xfffde17a + .word 0xcb471e5e + .word 0x0002af59 + .word 0x63fb2bcd + .word 0x000271c9 + .word 0x89c4ca97 + .word 0x0000d582 + .word 0x73a008fa + .word 0xfffc5b64 + .word 0x2a14ade5 + .word 0xffff1ce0 + .word 0xa9750729 + .word 0x0003db5c + .word 0x57f421a1 + .word 0x00017741 + .word 0xfbbcb898 + .word 0xfffc3084 + .word 0x94bbfa5a + .word 0x0003e5b6 + .word 0x78151a48 + .word 0x000217ce + .word 0xc861e0b9 + .word 0x0002c1f4 + .word 0xd34dab93 + .word 0x00036beb + .word 0x82e1f583 + .word 0xffff252b + .word 0xbfd80527 + .word 0x00009912 + .word 0x87440d12 + .word 0x000387e1 + .word 0x4d02aef6 + .word 0xfffdc678 + .word 0x05202430 + .word 0xfffeecc3 + .word 0x010f0bc3 + .word 0x00029840 + .word 0xd60c2620 + .word 0xfffc56fb + .word 0xb7eae547 + .word 0x00017769 + .word 0x174b9f3a + .word 0x0002bfe0 + .word 0x165ceb6c + .word 0xfffdbb15 + .word 0xacb53c54 + .word 0xfffc2c8e + .word 0x53b4ad94 + .word 0x0000f0ff + .word 0x45965b6a + .word 0x00002b59 + .word 0x2677a4f7 + .word 0x00008803 + .word 0x2846db0d + .word 0xfffe7cec + .word 0x9c50f4db + .word 0xfffd1d61 + .word 0x12e77e28 + .word 0xfffdfde4 + .word 0x360a7b9c + .word 0x0003f356 + .word 0x4dd8fb62 + .word 0x00017626 + .word 0x4675d95b + .word 0xfffd1543 + .word 0x193da59d + .word 0xfffdad4b + .word 0x7de92f38 + .word 0x00024675 + .word 0x55bd207e + .word 0xfffdebfb + .word 0x7e68eeee + .word 0xfffc0f78 + .word 0x8b980a21 + .word 0xfffc5aae + .word 0xa6396302 + .word 0xfffc2254 + .word 0xef0894dc + .word 0xfffe8dcb + .word 0xe836edb5 + .word 0x00017507 + .word 0x4fcfa844 + .word 0xfffd48f2 + .word 0xc66eadeb + .word 0xfffe7fa1 + .word 0x69e74c8c + .word 0x000120f1 + .word 0x0ebda96f + .word 0x00004cc3 + .word 0x5a40d482 + .word 0x0003d641 + .word 0xb66b714b + .word 0x00029e2b + .word 0x0eed4947 + .word 0xfffdeaf5 + .word 0x60207d82 + .word 0xfffdf94d + .word 0xfca91626 + .word 0xffff7aec + .word 0x6ad1f25d + .word 0x000261cc + .word 0x970c51f3 + .word 0x0002abde + .word 0xc111cd49 + .word 0x000295b4 + .word 0xe4753efa + .word 0x0001ba1f + .word 0x7ef2beb9 + .word 0xffff8420 + .word 0xb680a69a + .word 0x0003b200 + .word 0x24ae176f + .word 0x000121aa + .word 0xba05044c + .word 0x0002743a + .word 0x8b5f4517 + .word 0xfffe360e + .word 0xbe30c75e + .word 0x0000e160 + .word 0x1d479eb8 + .word 0x0003bd56 + .word 0xed08397d + .word 0x000244da + .word 0xa71a2091 + .word 0xfffc67a6 + .word 0x0d366ca5 + .word 0xffffb49b + .word 0xacd204bd + .word 0xffff0aa7 + .word 0x5b50ec91 + .word 0x0001eb6b + .word 0x1f3f9fd6 + .word 0xfffca402 + .word 0x5058b63a + .word 0x000134ff + .word 0x500d141b + .word 0x00000f22 + .word 0xcbe3e420 + .word 0x0003675f + .word 0x420cce0c + .word 0x00014db9 + .word 0xb5eceaeb + .word 0x0002846c + .word 0x97c315f4 + .word 0xffff6b71 + .word 0xc12ee651 + .word 0xfffcfadf + .word 0xf0924c09 + .word 0xfffebd50 + .word 0x06bdeb9b + .word 0x00020522 + .word 0xe2391b83 + .word 0x00027e94 + .word 0xb0bd9a2c + .word 0x000062ae + .word 0x0c463677 + .word 0xffff06c8 + .word 0x5e607762 + .word 0xfffe97c0 + .word 0xfb5a1e4b + .word 0xfffddbc7 + .word 0xe058a7d7 + .word 0xfffdb61a + .word 0x9a26445c + .word 0xffff78c4 + .word 0xd2356f1f + .word 0x000040d3 + .word 0xb5230b10 + .word 0x00019c59 + .word 0xebd54275 + .word 0xfffc3857 + .word 0x4ddb5744 + .word 0xfffe529d + .word 0x9697db9d + .word 0x0002dc87 + .word 0x94c4d630 + .word 0x0001bc6e + .word 0xc45aff92 + .word 0xfffcc99b + .word 0x68fa7a0b + .word 0xffffbd46 + .word 0x8dd00e7f + .word 0x00038043 + .word 0xe32d4794 + .word 0xfffd65da + .word 0x03cdfa4b + .word 0xfffdacb4 + .word 0xb6829e2e + .word 0xfffcb018 + .word 0xa16c85c7 + .word 0xfffc755f + .word 0x88ea382f + .word 0xfffe74e1 + .word 0x048bae50 + .word 0x0001ef08 + .word 0xf9d5efe5 + .word 0xfffe52b9 + .word 0xcb5322a8 + .word 0x0001f23c + .word 0xbd16e4a5 + .word 0x00001cce + .word 0x2003ff47 + .word 0x0001371e + .word 0x391557e4 + .word 0x0003fa18 + .word 0x1666a65c + .word 0xfffde16e + .word 0xd4fb9cb9 + .word 0xffff26d5 + .word 0xd779b5ee + .word 0xfffd50b6 + .word 0xd55992ca + .word 0x000262a3 + .word 0x10a9ff4d + .word 0xfffcda12 + .word 0x8dc259a1 + .word 0x0002d74c + .word 0x846231ec + .word 0xfffe3de9 + .word 0xaca53c8b + .word 0xffff795f + .word 0xa39fbbfe + .word 0xfffe847e + .word 0xbf0632bf + .word 0x0002ea53 + .word 0x0698dfc5 + .word 0xfffda009 + .word 0xbaa4c4a1 + .word 0x0003076a + .word 0x2f0dd2ef + .word 0xffff781b + .word 0x9329b4e3 + .word 0xffff12ad + .word 0xcc95be89 + .word 0x00002247 + .word 0x172be54d + .word 0x00036457 + .word 0x7a8be514 + .word 0x0003ae19 + .word 0x47c75408 + .word 0xfffcb228 + .word 0x9c3fafa9 + .word 0xfffdd7be + .word 0x4862af5c + .word 0x0003ee36 + .word 0xd6b7caa7 + .word 0xffff97c0 + .word 0x73ca5a30 + .word 0xfffd10ad + .word 0x7e8e23f4 + .word 0xffff03c6 + .word 0x80a4f8c2 + .word 0xfffc0cb7 + .word 0x09878abc + .word 0x00000b34 + .word 0x5d701bb1 + .word 0x00009353 + .word 0xae223f7c + .word 0x000031ef + .word 0x46543f30 + .word 0x0000c5b7 + .word 0x5d8c5518 + .word 0x00004784 + .word 0x9ed073cc + .word 0xfffee070 + .word 0xa455a477 + .word 0xfffdb59b + .word 0x3784f03b + .word 0xfffe3d7c + .word 0xee08565a + .word 0xfffc5279 + .word 0xdd54c9ae + .word 0x000131b0 + .word 0x3abc889b + .word 0x0002764d + .word 0x3d45ca6b + .word 0xfffcf72a + .word 0xb48e84c2 + .word 0x0003d69f + .word 0xc4ec7418 + .word 0xfffd78fd + .word 0x514778af + .word 0x00032b0c + .word 0xd11425ea + .word 0x0003bebc + .word 0x8af518e4 + .word 0x000397e5 + .word 0x388eef9e + .word 0x0001047b + .word 0xc3dec890 + .word 0x0001b768 + .word 0xb77dcab0 + .word 0x00029a41 + .word 0xc7512150 + .word 0xfffe6b67 + .word 0x04546e1c + .word 0x00009dd7 + .word 0xed66fd37 + .word 0xfffc4e3d + .word 0x1d1f989f + .word 0xfffea4ef + .word 0x78523e3d + .word 0x0001830d + .word 0x6f449374 + .word 0xffff708a + .word 0x1dde7cd3 + .word 0xffff0476 + .word 0xaf34eac4 + .word 0x0003ece6 + .word 0x8ae1fa18 .word 0x000367a1 - .word 0xc144acfd - .word 0xffff9bd0 - .word 0x849d366f - .word 0x00030917 - .word 0xad7804c0 - .word 0xfffffd6e - .word 0x9b33c194 - .word 0x0001f670 - .word 0xc0dfee2b - .word 0x0002a7f0 - .word 0x38f6c756 - .word 0xfffd0f2b - .word 0x6d0b1703 - .word 0xfffdcb14 - .word 0x74401e02 - .word 0x0001c6bb - .word 0x3a6198b1 - .word 0xfffe7b04 - .word 0x433c3f6a - .word 0xfffcdd97 - .word 0x7ed51e4c - .word 0xfffccf1f - .word 0xca86dee5 - .word 0x0003c3ab - .word 0xcfefe5be - .word 0xfffd163d - .word 0x9f6e80b0 - .word 0x000368a1 - .word 0x421e4bca - .word 0xfffe02cf - .word 0x5b1f6a67 - .word 0xfffcb04d - .word 0x2d769e53 - .word 0x0003d274 - .word 0x50e31d4a - .word 0xfffed6a4 - .word 0xf7504db0 - .word 0xfffffa85 - .word 0x65412d09 - .word 0xffff124b - .word 0xa018d8bb - .word 0xffffbcc7 - .word 0xd2d86d86 - .word 0x000023d1 - .word 0xb0b6cb14 - .word 0x00038774 - .word 0x3d2898ae - .word 0xfffcf509 - .word 0x61110cfe - .word 0xfffc70f4 - .word 0x5b2e7fbb - .word 0x00007fe0 - .word 0x74d35e41 - .word 0xfffda9da - .word 0x2f3935f8 - .word 0xfffe8963 - .word 0x420e69d5 - .word 0xfffd3604 - .word 0xf87caa70 - .word 0x0000043e - .word 0xa4441598 - .word 0x00032b9c - .word 0x0620bc4a - .word 0xffffc237 - .word 0x77991e07 - .word 0x0003f467 - .word 0x098846cd - .word 0xfffeee97 - .word 0x64094f85 - .word 0xfffca367 - .word 0xa75bd1f4 - .word 0x0003762f - .word 0x84f9a94d - .word 0xfffd473e - .word 0xdcb0abc6 - .word 0x0002ce99 - .word 0xd70661ef - .word 0xfffd3a18 - .word 0xd3eefa39 - .word 0x00038be1 - .word 0xfdeefb9d - .word 0x0000f0fb - .word 0xc3df1386 - .word 0x00006dcc - .word 0x4fd4a951 - .word 0xffffcbe4 - .word 0x06978343 - .word 0xfffd18f7 - .word 0x77de2101 - .word 0x0002894f - .word 0xfba4b6f0 - .word 0x00024a3a - .word 0xc2af2874 - .word 0x0003ef7e - .word 0x460d9130 - .word 0xfffc4ee9 - .word 0xf4af630e - .word 0xfffe2ae0 - .word 0x8760136e - .word 0xfffca373 - .word 0x8f6c45c9 - .word 0x00002a81 - .word 0xb77b97fc - .word 0x0001d8db - .word 0x459166d0 - .word 0x000198fc - .word 0xf224f389 - .word 0x0001b5af - .word 0x2a69cb33 - .word 0x000040b7 - .word 0xfc2ae0e7 - .word 0x00035412 - .word 0xe3d36059 - .word 0xfffd7a98 - .word 0x985539b7 - .word 0x000298a6 - .word 0xd1908991 - .word 0xfffe52dc - .word 0x7205a9c6 - .word 0x00037a11 - .word 0x9bb11494 - .word 0x0002681b - .word 0xb6fcaaf4 - .word 0xfffdd457 - .word 0xb263c696 - .word 0x0002ec56 - .word 0x98abac87 - .word 0xffff6bee - .word 0xdd1604b8 - .word 0x0001ffc6 - .word 0x0768db97 - .word 0x00011f78 - .word 0xf259be13 - .word 0x0000228b - .word 0x29360c10 - .word 0xfffd772b - .word 0x523685cb - .word 0xfffe7f58 - .word 0xfa3e31e4 - .word 0x000204e0 - .word 0x85527e17 - .word 0xffff8967 - .word 0x4f71e8a4 - .word 0xfffe7a30 - .word 0x0e1f694a - .word 0x0003d831 - .word 0xbe1bf5fd - .word 0x000222f1 - .word 0x2bdc7527 - .word 0x0002c0f4 - .word 0xfb00c06e - .word 0xfffd8286 - .word 0x6edf628c - .word 0xffffd4bf - .word 0xf873727f - .word 0xfffc5569 - .word 0x402518e3 - .word 0x0001a26f - .word 0xd5918280 - .word 0x00031fbc - .word 0x5340a614 - .word 0x0000f235 - .word 0xffe9816a - .word 0xfffe8ad7 - .word 0x00af2734 - .word 0xffff6350 - .word 0xf34bdee8 - .word 0xfffca340 - .word 0x5db8595a - .word 0xfffc9777 - .word 0xf42de050 - .word 0xfffc903e - .word 0xcabd2a8f - .word 0x0001006c - .word 0x92a663fb - .word 0xfffda9e5 - .word 0x9f72e43a - .word 0xfffcccc2 - .word 0x77c81a36 - .word 0xffffd608 - .word 0xe782cd82 - .word 0xfffdec97 - .word 0x8060d2d7 - .word 0xfffc62ce - .word 0xe4d94ab3 - .word 0xfffd200c - .word 0xf7be902f - .word 0xfffdf93f - .word 0xad399bc5 - .word 0x0002499f - .word 0xae9e7d39 - .word 0xffff412a - .word 0x606e198c - .word 0x000004ff - .word 0x3a87528b - .word 0xffff0876 - .word 0x37e9f2b1 - .word 0x00008813 - .word 0xfb92b5b3 - .word 0xfffeb360 - .word 0xebe7a551 - .word 0xfffd02de - .word 0x5797a003 - .word 0x0000007a - .word 0x047eee19 - .word 0x000331ee - .word 0x2ebfb602 - .word 0xfffe884e - .word 0x4b271153 - .word 0x000128d7 - .word 0x0d3bbfe0 - .word 0xffffc755 - .word 0x64c2a3c7 - .word 0xffff84ad - .word 0xc3f3eab6 - .word 0xfffe510b - .word 0x1fe1c23c - .word 0xfffe0057 - .word 0xe383de9c - .word 0xfffc1f03 - .word 0x20f2dccc - .word 0xfffe89d2 - .word 0xbb00291f - .word 0x00009f4b - .word 0x62841efe - .word 0x000035ac - .word 0x8022c8fd - .word 0x0002c322 - .word 0x1afc784a - .word 0xfffec6e2 - .word 0x592bd05e - .word 0x0000a455 - .word 0xe65bb847 - .word 0x0001a6d8 - .word 0xe8d99222 - .word 0xffffa4e5 - .word 0x6623bbb1 - .word 0x00022c67 - .word 0x68fd0ce8 - .word 0x000013a9 - .word 0x9d501553 - .word 0x000333ae - .word 0x2c9cf413 - .word 0xfffd8b34 - .word 0x9b8d3f67 - .word 0xffffa777 - .word 0x52525b07 - .word 0xfffc8f5d - .word 0x520100e1 - .word 0xfffed6bf - .word 0x2377c644 + .word 0xf1ed6a94 + .word 0xfffd1ec2 + .word 0x1e6955c8 + .word 0xffffd069 + .word 0xaad0b2fb + .word 0x0003e7a5 + .word 0x05f5abee + .word 0xfffe470a + .word 0x4acb7099 + .word 0xfffef995 + .word 0x783e64c4 + .word 0x00030656 + .word 0xdf9a0968 + .word 0xfffdda4e + .word 0x171a64ac + .word 0xfffcdbbb + .word 0x5586d929 + .word 0xfffd7c4c + .word 0xb8067625 + .word 0xfffd18a8 + .word 0x57d280b0 + .word 0x0000c40d + .word 0x004235f8 + .word 0x0000a69a + .word 0x109357e4 + .word 0xfffdcd4e + .word 0x3983e129 + .word 0x00003340 + .word 0x6557da6b + .word 0x0002b6c4 + .word 0xb793a4b2 + .word 0x00017faa + .word 0xa473e428 + .word 0x0002c554 + .word 0x72f40b86 + .word 0xfffc7700 + .word 0x43e07690 + .word 0xfffc403c + .word 0x0430b314 + .word 0x0000c12b + .word 0xc94277ed + .word 0xfffeaa6d + .word 0x82c9a9b8 + .word 0xffff5adf + .word 0xbcab2f69 + .word 0x00033116 + .word 0xd028b64e + .word 0x0002a124 + .word 0x0978becb + .word 0x0000d0a7 + .word 0x0d573b58 + .word 0xfffd12ea + .word 0x8e10b6aa + .word 0x00022e42 + .word 0x075893aa + .word 0x0002724a + .word 0xfc933809 + .word 0x00014d14 + .word 0xc555ecc7 + .word 0x0001d56d + .word 0x6837551a + .word 0xfffc2a16 + .word 0xd7129507 + .word 0x00008ac7 + .word 0x75ac7619 + .word 0xfffe874a + .word 0x0eb1749b + .word 0x0003c372 + .word 0xb6be976f .word 0x0002f971 - .word 0xba0d09c5 - .word 0xfffd8cda - .word 0xae01829f - .word 0x00033c81 - .word 0xf1b88adf - .word 0x00019c7c - .word 0x24d8128b - .word 0x00010633 - .word 0x313ce9d8 - .word 0x00026226 - .word 0xe1ec34ad - .word 0xfffe1c9e - .word 0x8452289d - .word 0xfffc076d - .word 0x09d72b41 - .word 0x00026a99 - .word 0x6de63fec - .word 0x0003c43e - .word 0x50656322 - .word 0xfffdaf18 - .word 0x050f2563 - .word 0x00017289 - .word 0xe638c6f9 - .word 0xfffc7ed4 - .word 0x05c2c1fa - .word 0x000276e6 - .word 0x800d6b27 - .word 0xfffca740 - .word 0x599bbb0f - .word 0x000332dd - .word 0xaa540ea2 - .word 0x0001a25d - .word 0x901857fc - .word 0x00021c74 - .word 0x17cbf85b - .word 0xfffd67c3 - .word 0x22fe90b5 - .word 0xffffe668 - .word 0x6c695028 - .word 0x00004688 - .word 0x06908431 - .word 0xfffdc957 - .word 0xc65c8b56 - .word 0xfffe4042 - .word 0x631ff112 - .word 0xffff3e45 - .word 0x70f5438b - .word 0xfffd4ef1 - .word 0x656e82ce - .word 0x00021c5b - .word 0x2d9480c4 - .word 0x0001ad7d - .word 0xbbfb3f8e - .word 0x00021baa - .word 0x943c5e3d - .word 0x00005c8e - .word 0xa6473535 - .word 0xfffcfde4 - .word 0x1f7b1a4c - .word 0x00012ba9 - .word 0xaf49e614 - .word 0x00024bba - .word 0x85b3b0f8 - .word 0x0000f818 - .word 0x7cb8467f - .word 0x00027afb - .word 0xc4073783 - .word 0x00007c2d - .word 0x967cc11d - .word 0x000388d4 - .word 0xf12865c5 - .word 0xffffead2 - .word 0x004f1764 - .word 0xfffe4025 - .word 0x41642017 - .word 0xffff56b2 - .word 0xd7322f20 - .word 0xfffcfa90 - .word 0x9533dcf8 - .word 0xfffc6ab8 - .word 0x251b8338 - .word 0x0003f0f9 - .word 0x5cb03d13 - .word 0x00022559 - .word 0x4f5049e1 - .word 0x0003bdf7 - .word 0xb6383c82 - .word 0x0003da7f - .word 0x3bca2bde - .word 0xfffe05d6 - .word 0x596f8cb9 - .word 0x000393b1 - .word 0x46853bc5 - .word 0xfffe9804 - .word 0xca29f264 - .word 0x00026f85 - .word 0x12b1c064 - .word 0xfffd8c56 - .word 0x250274f6 - .word 0xfffffc57 - .word 0x17193b53 - .word 0xffff1b71 - .word 0xf77d9005 - .word 0x00002618 - .word 0x2c1690bd - .word 0x0000c47a - .word 0x6dd3fcdf - .word 0xfffe8a2b - .word 0xfbe14d6a - .word 0xfffd1abd - .word 0xab0d9fe3 - .word 0x0002a032 - .word 0x4f2ec5ad - .word 0x0003f07f - .word 0xc091c842 - .word 0x000386c2 - .word 0xd1ac75f8 - .word 0x00033b2f - .word 0x93403476 - .word 0xfffebda0 - .word 0x4278fe73 - .word 0xfffe8b95 - .word 0xaeaf09e3 - .word 0x0001ec25 - .word 0x198b22b1 - .word 0x00011585 - .word 0x4d0884d8 - .word 0x000391a1 - .word 0x257f8f49 - .word 0x00003c53 - .word 0x6b3b3b1d - .word 0xfffc9602 - .word 0x1bf302e6 - .word 0x00005bcd - .word 0xf1903057 - .word 0xfffd142d - .word 0xa4b9e096 - .word 0x0003b28d - .word 0x70226e16 - .word 0x0001f9c9 - .word 0xcbf9d6bf - .word 0x00023d09 - .word 0xbd7cc012 - .word 0xfffdf386 - .word 0xd8930f1d - .word 0x00038b16 - .word 0xd9d421be - .word 0xfffd269c - .word 0xeff9d972 - .word 0xffff030e - .word 0x81eada90 - .word 0xfffd7d83 - .word 0x9acda2f5 - .word 0x00020bb7 - .word 0x36ddfdfa - .word 0xfffeb133 - .word 0xcd49a779 - .word 0xfffeb9a5 - .word 0xa0dc8f3e - .word 0xfffe8753 - .word 0x6013f880 - .word 0x0002b8ba - .word 0x988bd869 - .word 0x00013698 - .word 0xff75a4e0 - .word 0xfffd3b54 - .word 0x7b7db36c - .word 0x0002d458 - .word 0x6c3725e8 - .word 0x0003ad81 - .word 0x3ffe468f - .word 0x000167e3 - .word 0x739ba223 - .word 0xffff6b3d - .word 0x702b92d3 - .word 0xffffec27 - .word 0x1724bed1 - .word 0x000149c2 - .word 0xc92a2d6c - .word 0x0002c6d1 - .word 0xa509427d - .word 0x0001533d - .word 0x682eea58 - .word 0x00024aeb - .word 0xa3efd80d - .word 0xfffcbcfd - .word 0x9269808d - .word 0xffffae6d - .word 0x42ec6f79 - .word 0x0002d054 - .word 0x863794a9 - .word 0x0000b012 - .word 0x9d068bb5 - .word 0x0000603e - .word 0xed4ded9e - .word 0xfffc7422 - .word 0x642640e8 - .word 0xfffef27f - .word 0xda6e3902 - .word 0x000273c5 - .word 0x76734a82 - .word 0xfffe72bb - .word 0xa2251340 - .word 0x0002ba93 - .word 0x9f72bdd5 - .word 0x0002bac0 - .word 0x437f9edf - .word 0xffff28d8 - .word 0x5597db85 - .word 0x000085e7 - .word 0x122339b3 - .word 0xfffcdf19 - .word 0x5fb44c77 - .word 0xfffc8f2e - .word 0x98e0c970 - .word 0x0001ca87 - .word 0x6cd5ebe8 - .word 0xfffc3786 - .word 0x3ee568f8 - .word 0xfffda599 - .word 0x68c11e74 - .word 0x00020019 - .word 0x4525af7f - .word 0xfffdb0e8 - .word 0xd3fb92a6 - .word 0x00000905 - .word 0xb98387ba - .word 0x000264f2 - .word 0x580ff079 - .word 0xfffe9c15 - .word 0xa7aaefea - .word 0x00037053 - .word 0xb4116b04 - .word 0xfffc9354 - .word 0xa929369f - .word 0xfffcf693 - .word 0xd087c207 - .word 0x0003f0c2 - .word 0x2ec73e65 - .word 0xfffdbf54 - .word 0x2021bad7 - .word 0xffff1bc2 - .word 0x8867765f - .word 0x00029faa - .word 0xad566d0a - .word 0xfffcf0bf - .word 0x99b82ed7 - .word 0xfffe0cce - .word 0xf51f778a - .word 0x0001fcd3 - .word 0xc7f23ba1 - .word 0x00001115 - .word 0x332d3a82 - .word 0xffffb566 - .word 0x0e3f085d - .word 0x0001046f - .word 0x2128d356 - .word 0xfffe8c41 - .word 0x45fbac11 - .word 0xfffc6af1 - .word 0x9f33af4e - .word 0xfffdb140 - .word 0x62013f64 - .word 0x00011fc5 - .word 0xd758d46d - .word 0xfffc530c - .word 0x6decf9a7 - .word 0xfffdf6ce - .word 0x741752ff - .word 0xfffe533b - .word 0xfb515cf6 - .word 0x00008bb6 - .word 0x47c7ff3f - .word 0xffff451f - .word 0xf3aad237 - .word 0x000382cd - .word 0x46ed474e - .word 0x0000474d - .word 0x59ac9d7c - .word 0x0003141c - .word 0x58475303 - .word 0x0001fa82 - .word 0x15c2739c - .word 0x000119f1 - .word 0x121bdd0f - .word 0x000111b1 - .word 0x920bd698 - .word 0xfffeaa49 - .word 0x50a0c269 - .word 0x000224b9 - .word 0x8224bb38 - .word 0x0000a90c - .word 0x9bb04858 - .word 0xffff6edc - .word 0x43077f48 - .word 0xfffdbbfd - .word 0xce85863b - .word 0xfffca029 - .word 0x5244d2af - .word 0x0003a77e - .word 0x575598eb - .word 0xffffde3a - .word 0x5fbc2d45 - .word 0xfffce884 - .word 0x527aa4d3 - .word 0xfffe78c8 - .word 0x6f190a4c - .word 0xfffe9a8c - .word 0x3a00bc10 - .word 0x000049f0 - .word 0xb85e77ea - .word 0x0002f9ad - .word 0xfd8afd28 - .word 0x0003aa76 - .word 0xf2161ef1 - .word 0xfffe199f - .word 0xd610a3c5 - .word 0x00018360 - .word 0xcc4ef8af - .word 0x0003c7ed - .word 0x6af3782b - .word 0x0002d915 - .word 0x53426422 - .word 0xffff607a - .word 0x1e06bbf3 - .word 0xfffca282 - .word 0x13ab060e - .word 0xfffca506 - .word 0xfea0913c - .word 0x0000d77f - .word 0xfd2a1d19 - .word 0x0002b877 - .word 0x4f8acd5f - .word 0x00019daf - .word 0xb0de99c0 - .word 0x00011fa6 - .word 0xb1403044 - .word 0x0003963f - .word 0x123dd822 - .word 0x000051b7 - .word 0x08a05dcb - .word 0xfffd664d - .word 0x37580f70 - .word 0x0003e294 - .word 0x0e5a8bed - .word 0xfffeab07 - .word 0x1dc66e49 - .word 0x00005cfc - .word 0x9c4073eb - .word 0xfffe37bc - .word 0x205e13c0 - .word 0xfffda5f8 - .word 0x9fee95ae - .word 0x00018e69 - .word 0xdf0adf2a - .word 0x0003a076 - .word 0xd41b0344 - .word 0xfffeefc2 - .word 0xfdaa4128 - .word 0x0000315f - .word 0xc5b65033 - .word 0x0001f1f1 - .word 0xe7b2d123 - .word 0x00003a66 - .word 0x0e66c3d0 - .word 0xfffe41a3 - .word 0x5cc66b08 - .word 0x0000c238 - .word 0x763c74f1 - .word 0x00025477 - .word 0x1239b0fa - .word 0xfffcf110 - .word 0x3f20e27a - .word 0x00019bcb - .word 0xcf2edf88 - .word 0xfffec18b - .word 0x6e9c5391 - .word 0x00015f63 - .word 0x771e8ccc - .word 0x000343b7 - .word 0xfec965b0 - .word 0x0001710f - .word 0xc37ba0d3 - .word 0xffff2687 - .word 0x6852ca33 - .word 0x00021e5c - .word 0x0ccd4b73 - .word 0x000332c2 - .word 0x59e24e55 - .word 0xffff09d4 - .word 0x99b96d81 - .word 0xfffd5b7a - .word 0x3403a14e - .word 0x0000a761 - .word 0x39eed7b8 - .word 0xfffe32de - .word 0x5a6a6fbb - .word 0xfffdf51d - .word 0x227db2c0 - .word 0xfffd4329 - .word 0x1d37cbd3 - .word 0x0003d9e4 - .word 0x793c34a2 - .word 0x00023d48 - .word 0x5f38b531 - .word 0xfffd772e - .word 0x47d2f5da - .word 0x0001d13a - .word 0xf258e228 - .word 0x0003964f - .word 0x617422e1 - .word 0xfffe6dd9 - .word 0x19ad9d9b - .word 0x00028a57 - .word 0xba0c83e3 - .word 0xffffc209 - .word 0x00fceb12 - .word 0x00008374 - .word 0x8d8ebf21 - .word 0x00014594 - .word 0x013c6582 - .word 0x0001fe7b - .word 0xc97ba0a5 - .word 0xffff780a - .word 0x44cebd65 - .word 0xfffe89a9 - .word 0xfbf29fa4 - .word 0xfffe66c3 - .word 0x810b1f65 - .word 0x0000fcb1 - .word 0x418a0f74 - .word 0xfffe7926 - .word 0x76fda527 - .word 0xfffe9593 - .word 0x79950566 - .word 0x0001bcac - .word 0xffbbcd26 - .word 0xffff32cc - .word 0x0b28ce90 - .word 0x0002034b - .word 0xdc52d448 - .word 0xfffdfb6b - .word 0x7ecd42ef - .word 0x00033bf6 - .word 0xb8bce7f4 - .word 0xfffcffbd - .word 0xf5eaf749 - .word 0x0003228f - .word 0xa01dddcf - .word 0xffff2335 - .word 0x9165cf05 - .word 0x00032fbd - .word 0xf437e4aa - .word 0x0001f09a - .word 0x82fbff37 - .word 0xfffc7edc - .word 0x3ff2d86e - .word 0xfffd6539 - .word 0xa81c1829 - .word 0x0003cad3 - .word 0x6a7cb97d - .word 0x0002bdd7 - .word 0xbddec9f5 - .word 0x0001796a - .word 0xd28bebff - .word 0xfffc9eea - .word 0x7dec514e - .word 0x0001ceee - .word 0xd0d27aa1 - .word 0x000106b2 - .word 0xc9a6014e - .word 0xfffe41f7 - .word 0x70057040 - .word 0xffffb2d7 - .word 0xd6996a7d - .word 0x0003fa53 - .word 0xe1e5b889 - .word 0x00014987 - .word 0x646009db - .word 0x0001e587 - .word 0xdd1ed556 - .word 0x000250f3 - .word 0x6c5a711a - .word 0x0002f026 - .word 0x1ef6c27e - .word 0xfffe5f16 - .word 0xef950337 - .word 0x00009ab8 - .word 0x0913ec75 - .word 0xffff51e9 - .word 0x4e4bae5a - .word 0x00014875 - .word 0xd0ffb11f - .word 0x000063e4 - .word 0x8b41a416 - .word 0xfffed383 - .word 0x77c52a77 - .word 0x00019308 - .word 0xf813a764 - .word 0xfffc7c39 - .word 0x5c2f21a4 - .word 0xfffdad88 - .word 0xc116bca6 - .word 0xfffe675a - .word 0x5f0ad407 - .word 0x0003736b - .word 0x56768295 - .word 0x0001667d - .word 0xd1d2f1da - .word 0x00016a9e - .word 0x7bb340cf - .word 0x000338da - .word 0x39f4455b - .word 0x000362d8 - .word 0x8abf0e6e - .word 0x00015745 - .word 0x24a9fe86 - .word 0xffffac8c - .word 0xab2cbfe0 - .word 0x00036b3d - .word 0x18c3d714 - .word 0x0003e0ac - .word 0xe9369d2e - .word 0x000014ef - .word 0x04c2ba0b - .word 0xffffaa22 - .word 0xa57bfdfa - .word 0xfffcbb4e - .word 0x8c01fe8e - .word 0x00012bc6 - .word 0x42f6dd6d - .word 0xfffe73ed - .word 0x634349e5 - .word 0xffffc75d - .word 0xbe3ba36e - .word 0x000006d2 - .word 0xecb8ae9b - .word 0x00018b93 - .word 0x32b13231 - .word 0xfffc7c0f - .word 0x7f9a5b54 - .word 0x000232ae - .word 0xb6475a83 - .word 0x0002b4c0 - .word 0xc3d6f93e - .word 0xffffe4ec - .word 0xa776778b - .word 0xfffda225 - .word 0x463c990e - .word 0xffff4d04 - .word 0x27dd6d83 - .word 0x000322b5 - .word 0x4d66cb74 - .word 0x0003f18e - .word 0x43542866 - .word 0x0001a19d - .word 0xe07fd851 - .word 0xfffeb1c7 - .word 0xd124accb - .word 0x000309a8 - .word 0x4307c40b - .word 0x0002072d - .word 0x61f59c5e - .word 0xffff698b - .word 0xf764a472 - .word 0x00018ad5 - .word 0x4083c5b3 - .word 0xffffb77d - .word 0x7ad9fa0d - .word 0xfffd36a5 - .word 0x72c5f349 - .word 0x00021b96 - .word 0x1dfb259a - .word 0x0000f3cf - .word 0xd755e77e - .word 0xffff2150 - .word 0xf81c95ea - .word 0x00006edb - .word 0x6f8a1451 - .word 0x0001758d - .word 0xf238b0c9 - .word 0x00029ed4 - .word 0x80d17dba - .word 0x00000fee - .word 0xe74769f7 - .word 0x00015e94 - .word 0xed263cc1 - .word 0xfffda74d - .word 0xd31c5f20 - .word 0x0003ee2d - .word 0x9cbae39d - .word 0x00023700 - .word 0x73a01267 - .word 0xffff8617 - .word 0xd78e68f8 - .word 0xffff149e - .word 0x7708e639 - .word 0x00008637 - .word 0x14859ad9 - .word 0xfffc334d - .word 0x911fbdbb - .word 0xfffdf712 - .word 0x164817e1 - .word 0x00020788 - .word 0x6307cd25 - .word 0xfffe2b3f - .word 0x0bf0278d - .word 0x00016794 - .word 0x377a6580 - .word 0xffff6ca9 - .word 0x4831a163 - .word 0x0003ca50 - .word 0xa0866560 - .word 0xffffc6ce - .word 0x7f61a4c2 - .word 0xffff9999 - .word 0x5d5fffb8 - .word 0x0003ade8 - .word 0x7f0efb88 - .word 0x0002393d - .word 0x1831dbfa - .word 0x0000e194 - .word 0x7273ff54 - .word 0xffff153d - .word 0x907216f7 - .word 0x00018309 - .word 0x0a62a676 - .word 0xfffe1dd2 - .word 0x187f9201 - .word 0x0003b4fd - .word 0xcf1b3783 - .word 0x000348ac - .word 0x805070f8 - .word 0xffff9f48 - .word 0x54c29be3 - .word 0x000032fd - .word 0x220ce2cc - .word 0xffff9f0c - .word 0xb0f88d83 - .word 0xfffcf460 - .word 0x0a1c7ec2 - .word 0x00004e28 - .word 0x099b72fb - .word 0xfffe7423 - .word 0xb0600939 - .word 0xffff72c1 - .word 0xcc03c566 - .word 0x00019dc4 - .word 0xeb260972 - .word 0x0001018f - .word 0x9098da95 - .word 0xfffd8adc - .word 0xb7e39578 - .word 0xfffd008e - .word 0xb83c199f - .word 0x00018262 - .word 0x84a0988a - .word 0x0000aaae - .word 0x38e1b066 - .word 0x000194bf - .word 0x9217d9b9 - .word 0xfffcf985 - .word 0x0b547bdd - .word 0x0003f827 - .word 0xcbb195a3 - .word 0x0002e7fd - .word 0x49f929e1 - .word 0x0000ab79 - .word 0x36cb0ee0 - .word 0x0001ab4a - .word 0xb342344d - .word 0x000369df - .word 0x50407e19 - .word 0x0000fa70 - .word 0x30d76bd9 - .word 0x00010905 - .word 0x5f124165 - .word 0xffffeac7 - .word 0xd78f4ed6 - .word 0xfffe5960 - .word 0xb198dc04 - .word 0xfffcbcf0 - .word 0x151793b8 - .word 0x0003d480 - .word 0xf7d23bb7 - .word 0xfffe8fda - .word 0xb7276320 - .word 0x0003429e - .word 0xb4f81ee4 - .word 0x0002e0c3 - .word 0xdcf302f1 - .word 0xfffe9c24 - .word 0xbd028c8a - .word 0x0001bc21 - .word 0xc4a2cbae - .word 0x0000e09c - .word 0x9e8522f6 + .word 0xb2b97304 + .word 0xfffcbba5 + .word 0xee12cada + .word 0xffff7075 + .word 0x1d1c4388 + .word 0x0001c4ac + .word 0xd7ba4b18 + .word 0xfffecaee + .word 0x9fe418e1 + .word 0xfffd8899 + .word 0xb05dc41b + .word 0x0001afe4 + .word 0xc01cf50e + .word 0x00014e07 + .word 0x6943c46d + .word 0xfffd4291 + .word 0x66b16371 + .word 0xfffc7aa8 + .word 0xdbf95dc5 + .word 0x00017dde + .word 0xe277d84d + .word 0x0000bfc3 + .word 0xafb37465 + .word 0x0003511c + .word 0xff857b31 + .word 0xfffdcf18 + .word 0xd976e81b + .word 0xfffc4a8c + .word 0x06b9abe4 + .word 0x0001f091 + .word 0x6d79a32e + .word 0xffff2db7 + .word 0x7a713b77 + .word 0x00007ae2 + .word 0x42284191 + .word 0x0002582e + .word 0xb3f041d8 + .word 0x00036551 + .word 0x4d93b392 + .word 0x0003cfdb + .word 0x8b81a6e6 + .word 0xfffc451d + .word 0x821e8361 + .word 0x00011dd2 + .word 0x8056fc0b + .word 0x00033749 + .word 0x8906b782 + .word 0xfffea7d4 + .word 0x10711f5c + .word 0x000377a5 + .word 0x3ddd710c + .word 0xfffd6fa7 + .word 0x89debf30 + .word 0x0000f8a5 + .word 0x51cbed24 + .word 0xfffefa9b + .word 0x7a5c42df + .word 0x000237c1 + .word 0x428cbf5b + .word 0x00022a72 + .word 0x15a50001 + .word 0xfffca395 + .word 0x503f5543 + .word 0x000323e1 + .word 0xbe8440ad + .word 0x0003cf37 + .word 0x271545a5 + .word 0xfffd3fc3 + .word 0x3cb0bde7 + .word 0xfffcde36 + .word 0x4f6e5ed4 + .word 0xfffe56a5 + .word 0x63ab1c38 + .word 0x0002ebd3 + .word 0xa9b3b78e + .word 0xffffd391 + .word 0x767867b8 + .word 0xfffdbec8 + .word 0xf8027f73 + .word 0xffff111e + .word 0x82e56469 + .word 0xfffc2225 + .word 0x62e19687 + .word 0x00037cce + .word 0x196b9d07 + .word 0xfffd5075 + .word 0x06094787 + .word 0x00002bad + .word 0x4f805a54 + .word 0x0002b8a0 + .word 0x211717fc + .word 0x00036b93 + .word 0xefdbe47d + .word 0xfffcd6bc + .word 0xbfd8378a + .word 0x00005c9a + .word 0xe49c4b79 + .word 0x00027d5a + .word 0x86ba31c9 + .word 0x0002baeb + .word 0x29827ada + .word 0xffff20b3 + .word 0xe7cf2889 + .word 0xfffc924b + .word 0xa5cafc76 + .word 0x00009b3d + .word 0x4e1eccab + .word 0x000376cc + .word 0x6aef05ab + .word 0xfffe0d44 + .word 0x4b88ea0d + .word 0xfffddab7 + .word 0xca0ae9f9 + .word 0x00023a59 + .word 0xecab41b4 + .word 0x000010a6 + .word 0x845af2cc + .word 0x0001cbc6 + .word 0xcc1883e5 + .word 0x0001568a + .word 0xa1c6d1a1 + .word 0xfffd6ca4 + .word 0xe138a394 + .word 0xfffcd6b8 + .word 0x2f8015a5 + .word 0x00023f98 + .word 0xcde64096 + .word 0xfffe3ae5 + .word 0xcbd1c860 + .word 0x00000fc6 + .word 0x945010bd + .word 0xffff77c8 + .word 0x0749978f + .word 0x0002fcf2 + .word 0x41bc56d9 + .word 0x0003d786 + .word 0xc8ec4d1b + .word 0x000156ba + .word 0xda35dee7 + .word 0x00028f7f + .word 0x77096199 + .word 0xffff8062 + .word 0x446c2b34 + .word 0x0000a40d + .word 0xb11cfcdb + .word 0xfffe03b4 + .word 0x894bfa96 + .word 0x00003853 + .word 0x390eba32 + .word 0x0000a952 + .word 0x4ff64d34 + .word 0xfffd8c97 + .word 0x61a70589 + .word 0xffff8a44 + .word 0xdedd11a5 + .word 0xfffc52f9 + .word 0xfa236656 + .word 0x000091f8 + .word 0x818c588c + .word 0x000287b1 + .word 0x739c371d + .word 0xfffc4d22 + .word 0x5f103c33 + .word 0xfffd64cb + .word 0x86895d58 + .word 0x0003a509 + .word 0xa017dd35 + .word 0x00038613 + .word 0x3b22fb41 + .word 0x00022bef + .word 0x8fa2bf17 + .word 0xfffe8719 + .word 0x326d4006 + .word 0xfffdb81e + .word 0xca30b700 + .word 0xfffe4b3e + .word 0x4ee0eacf + .word 0xfffc3445 + .word 0x22e3fa69 + .word 0xfffd6b37 + .word 0xfd0266b2 + .word 0x0003f697 + .word 0x2ea3b2ab + .word 0xffff667d + .word 0x7607b8a7 + .word 0xfffd0168 + .word 0xc12d1a3f + .word 0xfffd015c + .word 0xf878490e + .word 0x00034793 + .word 0x6ecc38df + .word 0x000261ba + .word 0x57ae4c71 + .word 0xffff8357 + .word 0x24d9cbaf + .word 0xffffad77 + .word 0x5ea634fa + .word 0x00008d4d + .word 0x88abf322 + .word 0xfffed23c + .word 0x49cbea7d + .word 0xfffe5419 + .word 0x29c1379d + .word 0xfffe8d6e + .word 0x6175927b + .word 0xfffe6c4b + .word 0x6e3de488 + .word 0xfffc2645 + .word 0x12a69352 + .word 0xffff23b1 + .word 0x1a5d5710 + .word 0xffffda46 + .word 0x641942e3 + .word 0x0002fb65 + .word 0x98573f19 + .word 0x00015d76 + .word 0x47c29fd2 + .word 0x0000c71a + .word 0x4da598f3 + .word 0x0003d44b + .word 0x8cdba1db + .word 0x00005b61 + .word 0x2099fa4e + .word 0x0002cdbc + .word 0x31de9d06 + .word 0x000084d3 + .word 0x4dcb2ba1 + .word 0xfffc272c + .word 0xbc7e894a + .word 0x0003b973 + .word 0x16e24f3a + .word 0xffffe66d + .word 0x6a0f64ff + .word 0xfffca30e + .word 0xea9e44a2 + .word 0xfffcd7eb + .word 0x5ca8c7c5 + .word 0x0002d056 + .word 0xacfbeb59 + .word 0xfffd1c2a + .word 0x59d40e92 + .word 0x00031e21 + .word 0x742b3f22 + .word 0xfffee4b5 + .word 0x1a8fef7f + .word 0xfffdffe4 + .word 0xe713cf86 + .word 0xfffcbbd4 + .word 0x2d25c207 + .word 0xfffd5afa + .word 0x02888e6b + .word 0x00036489 + .word 0x15aeb0c5 + .word 0x00036c09 + .word 0x712d4ee4 + .word 0xffff2a8e + .word 0xa889e6d8 + .word 0xfffd71d9 + .word 0xf03596cf + .word 0x00010a91 + .word 0xd8be80c1 + .word 0x00004edb + .word 0x8c29cb70 + .word 0x0000141f + .word 0x9e8e9f77 + .word 0x0003572e + .word 0xcf187491 + .word 0x00033853 + .word 0x8fe55416 + .word 0x0001283c + .word 0x87fc49b2 + .word 0x0000b5f9 + .word 0x8989dfd8 + .word 0x0002fa58 + .word 0x8f3c653c + .word 0xfffca38c + .word 0x43be4577 + .word 0x00017905 + .word 0xc0e0c15a + .word 0xfffca841 + .word 0x8d959dc7 + .word 0xfffcd938 + .word 0xf642a4ec + .word 0xfffda762 + .word 0x8f191494 + .word 0x00004c0a + .word 0x4a64f8cf + .word 0x0000d2f8 + .word 0xc4d3efb3 + .word 0x00002200 + .word 0x8283f296 + .word 0xffff5704 + .word 0xc71ffd69 + .word 0x000048a8 + .word 0x94b75fdb + .word 0x0000e3a6 + .word 0xfea29242 + .word 0xfffd66a2 + .word 0x6c867eb0 + .word 0xfffca043 + .word 0x6bcb7ecc + .word 0x0002b041 + .word 0xb0728d39 + .word 0xffff9937 + .word 0x3d7e91e8 + .word 0xffff3d46 + .word 0xfdb88b90 + .word 0x00005ea2 + .word 0xded4843f + .word 0xfffc249c + .word 0x1f5bf3dc + .word 0xfffefe67 + .word 0x3943b97f + .word 0x0002a851 + .word 0xa6c696fe + .word 0x00039e13 + .word 0xfc608f15 + .word 0xfffcb1b0 + .word 0x1494e364 + .word 0xfffc96f7 + .word 0xc923cb9f + .word 0x00032a66 + .word 0xd15bd9b4 + .word 0xfffcce1d + .word 0x381ff288 + .word 0x0000e8aa + .word 0x9d836828 + .word 0xffff5d17 + .word 0xb21a741f + .word 0xffff0cdd + .word 0x9fbd17e2 + .word 0xffffe9ba + .word 0xf0fff511 + .word 0xfffd59c4 + .word 0x894d390b + .word 0x000156a3 + .word 0x82d768c9 + .word 0xfffd712d + .word 0xd47956eb + .word 0x000365f8 + .word 0xddae3eb3 + .word 0xfffef384 + .word 0x457d6e25 + .word 0xfffd855c + .word 0x2d8a196e + .word 0xfffcc172 + .word 0x2f8b365c + .word 0xffff1b89 + .word 0x5bdaefed + .word 0xfffef628 + .word 0x81d75a15 .word 0xfffca2a4 - .word 0x5217a94f - .word 0xfffedfb9 - .word 0xf9f2f997 - .word 0x000379fc - .word 0x749b2b28 - .word 0x0003e3e0 - .word 0x140fa898 - .word 0xfffc9cc2 - .word 0x725608cc - .word 0x00030887 - .word 0xab3eed9b - .word 0x000236c9 - .word 0xc7859221 - .word 0x0003361b - .word 0x79170c1b - .word 0x00017a1d - .word 0x415be022 - .word 0x000324b3 - .word 0x619d9421 - .word 0x000183f9 - .word 0xec393db5 - .word 0xfffd8656 - .word 0xf2d4c8f0 - .word 0xfffc9883 - .word 0x2fe55b56 - .word 0x0003c816 - .word 0x4758b541 - .word 0xfffd6eb9 - .word 0xfa7eb2e0 - .word 0x0000e95d - .word 0x482e894c - .word 0xfffe391d - .word 0xabe3bcfe - .word 0xfffcff13 - .word 0x02983d86 - .word 0x0002292b - .word 0xe2cbd19c - .word 0xfffc0fac - .word 0x55a204b6 - .word 0x00008d70 - .word 0x383c04c1 - .word 0x000373de - .word 0x4068a48e - .word 0x00023238 + .word 0x148ed9b6 + .word 0xfffdd99d + .word 0xf32ae118 + .word 0x000193ef + .word 0xa7f4ec00 + .word 0x0003b5a0 + .word 0x6d09a456 + .word 0x0003fedc + .word 0x65f30bcd + .word 0x0003e073 + .word 0xdb81693b + .word 0x0001fba7 + .word 0xbe6bc5f7 + .word 0xfffea75c + .word 0x24d7b5bd + .word 0x0003811a + .word 0x2dfc73bb + .word 0xfffc3621 + .word 0x7a4dd10f + .word 0x00036300 + .word 0x5e4efb25 + .word 0xfffc41f5 + .word 0x005fb650 + .word 0xfffe11d0 + .word 0x06fab9c3 + .word 0x00002589 + .word 0xc2301f53 + .word 0x0000c338 + .word 0xb458761d + .word 0xfffef5f8 + .word 0x37e9184c + .word 0x0003bddb + .word 0x314e8017 + .word 0xfffd4a60 + .word 0x022c9339 + .word 0xffff0f38 + .word 0x2dcf2a46 + .word 0x0003450a + .word 0x6aee710d + .word 0x0003def9 + .word 0xf5a472c5 + .word 0x000348f6 + .word 0x4852cc86 + .word 0x0001c09c + .word 0x26b58e20 + .word 0xffffdf27 + .word 0x612c2e25 + .word 0x00032b30 + .word 0x9cf1e107 + .word 0xfffd626c + .word 0xa345f50c + .word 0x000374e0 + .word 0xccd13510 + .word 0x0002d324 + .word 0x06744f47 + .word 0x0001ecea + .word 0x62405536 + .word 0x00029ca6 + .word 0x9dec2798 + .word 0x000222c2 + .word 0x539b03a1 + .word 0xfffce5fb + .word 0x59bd6331 + .word 0xffff4746 + .word 0xbd37bf13 + .word 0xfffe65c3 + .word 0x8e74167d + .word 0x0002384f + .word 0x63b853bd + .word 0x0003ccb4 + .word 0x32c9db74 + .word 0xfffdd849 + .word 0xa8d7abba + .word 0xffff96fd + .word 0xe589c854 + .word 0xfffe19fb + .word 0x1fde7315 + .word 0x0000e7f5 + .word 0x6a659a54 + .word 0x0002cd10 + .word 0x4be7daf9 + .word 0xffff4431 + .word 0x2ab12090 + .word 0xfffc32d4 + .word 0x67e3bc25 + .word 0xfffeeaef + .word 0x4327c21e + .word 0xffffd8a3 + .word 0x128f1816 + .word 0xfffe02b8 + .word 0x1a8d0250 + .word 0x00020eeb + .word 0x3d53d192 + .word 0x0001d6e5 + .word 0x1a60cac7 + .word 0xfffe88a1 + .word 0x347b70a2 + .word 0x00026039 + .word 0x3d341dcf + .word 0x00037f20 + .word 0xed9a5fd6 + .word 0xfffd9494 + .word 0xf0873054 + .word 0xfffe9d83 + .word 0x44a8730e + .word 0xfffd22f6 + .word 0x5a5af6de + .word 0x000143c5 + .word 0x59ca1a67 + .word 0xffff53a6 + .word 0xd115d453 + .word 0xffff74d5 + .word 0x6541bddc + .word 0x00009d39 + .word 0xfb1e7684 + .word 0xfffc5e9b + .word 0x44c0e499 + .word 0xfffe4e68 + .word 0x38815d44 + .word 0x000081d0 + .word 0x018b2164 + .word 0x0001b92a + .word 0x8bf0c0e6 + .word 0xfffcf795 + .word 0x626def85 + .word 0x00006987 + .word 0x10a35501 + .word 0x00004fbb + .word 0x790d1913 + .word 0x000014bc + .word 0xd9176bb6 + .word 0x00016c63 + .word 0x5d645f9d + .word 0x00011db8 + .word 0x3cec5fef + .word 0x0003ad89 + .word 0xba5d74a2 + .word 0xfffce100 + .word 0xf64a18cc + .word 0x0000f152 + .word 0x5a769862 + .word 0x0002bbfa + .word 0x62ef38a0 + .word 0x0003e88a + .word 0xfa59ae07 + .word 0x00027805 + .word 0xcb042301 + .word 0x00035ea2 + .word 0xceaeb10a + .word 0xfffe1027 + .word 0xd22d9924 + .word 0x0001506e + .word 0x5c3f9658 + .word 0xffffaf44 + .word 0xe2b0e308 + .word 0xffff1c97 + .word 0x6512cdbc + .word 0x000129e6 + .word 0x05bf3565 + .word 0x0002b022 + .word 0xaf528e8a + .word 0xffff43b2 + .word 0x08888cbf + .word 0xfffca50f + .word 0xe15c1591 + .word 0xfffc8737 + .word 0x19ea51e4 + .word 0xfffe99d0 + .word 0x3c789c74 + .word 0x00012184 + .word 0x5b5a20ed + .word 0xfffd2447 + .word 0xa4f8c603 + .word 0xfffdcc02 + .word 0x7550aaf7 + .word 0x0001199f + .word 0x6d1f4857 + .word 0xfffc1855 + .word 0x294acbe1 + .word 0xfffcad13 + .word 0xc32805f4 + .word 0x00010634 + .word 0xb5235ddd + .word 0x00032e12 + .word 0x0e20d4c7 + .word 0x00012419 + .word 0xf6f56abd + .word 0x0000743c + .word 0xfae18855 + .word 0x00021734 + .word 0xe39b04e3 + .word 0x00032156 + .word 0x4b2db06a + .word 0xfffd9eaf + .word 0x0090e3a0 + .word 0x0001b31c + .word 0x8839be68 + .word 0xfffc68b2 + .word 0xd72240d3 + .word 0x00020b70 + .word 0xc4a217c7 + .word 0xfffef92a + .word 0x37d2102e + .word 0xffff28d0 + .word 0xe40bfc69 + .word 0x00010300 + .word 0x8d67d895 + .word 0xfffd922d + .word 0xf008c02d + .word 0xffff37b7 + .word 0x7bde3d5e + .word 0xfffcbbf7 + .word 0x688b3372 + .word 0x000191fb + .word 0xb1605ab3 + .word 0x000375e1 + .word 0xe76eb9dc + .word 0xffff4811 + .word 0xe8c90e66 + .word 0xfffffe31 + .word 0x8f55538c + .word 0x0001c4b4 + .word 0xfac5cd34 + .word 0x0000c242 + .word 0x6e27cb60 + .word 0xffff857d + .word 0xfce85107 + .word 0xfffd41a3 + .word 0x906af1e2 + .word 0x00014548 + .word 0x063bc216 + .word 0xffffb37e + .word 0x8cfb0763 + .word 0x0001aace + .word 0x434fcbaa + .word 0x0003232d + .word 0xf1bb836d + .word 0x00016e59 + .word 0x9f67f409 + .word 0x0002b05b + .word 0x2bcdee80 + .word 0x00039b34 + .word 0x4cebc7b0 + .word 0x00000588 + .word 0xe8f6f7ee + .word 0xfffecb7f + .word 0xb4569ab6 + .word 0x0003ae23 + .word 0xfb946d4d + .word 0xffff938a + .word 0x10eed860 + .word 0x0000ffb4 + .word 0xa99e0e02 + .word 0x0001e827 + .word 0xbcda1f4e + .word 0xfffd34de + .word 0x5d79903d + .word 0x0002ce6f + .word 0xa35954b7 + .word 0x00022f02 + .word 0xba884421 + .word 0x0001c409 + .word 0x907a7272 + .word 0xfffc60c5 + .word 0x89afb3f9 + .word 0x00026535 + .word 0x4e4b138a + .word 0xfffde0f8 + .word 0x850df197 + .word 0x00026037 + .word 0x161645d9 + .word 0x0003b317 + .word 0x236baf65 + .word 0xffff46ba + .word 0x8cebdafe + .word 0xfffc32b7 + .word 0x20699bc9 + .word 0x0002c29d + .word 0x70c21b36 + .word 0x0003ec7b + .word 0xc9f42e09 + .word 0x00016221 + .word 0x5c82eecc + .word 0xfffd9e84 + .word 0xdc5fb497 + .word 0xfffd9897 + .word 0x4dc98eeb + .word 0x000123ab + .word 0x077942c5 + .word 0xffff4dba + .word 0x22c79205 + .word 0xfffc606c + .word 0x003187ac + .word 0xfffc73d6 + .word 0x7da685c4 + .word 0xfffc2f4d + .word 0xb6c62e6b + .word 0xfffd3302 + .word 0x2c4aa785 + .word 0xfffd9c45 + .word 0xcaace74a + .word 0x0002b4be + .word 0xb447563b + .word 0xffff018a + .word 0xe1160056 + .word 0xfffd5558 + .word 0x1ba6704e + .word 0xfffe0963 + .word 0x019c3eab + .word 0x000098d3 + .word 0xa208e0f0 + .word 0xfffe3b02 + .word 0xbce7acbc + .word 0xfffe5fcc + .word 0x44ac248d + .word 0x00023cb6 + .word 0x6ae266b7 + .word 0xffff52ec + .word 0xea84fea3 + .word 0x000216a3 + .word 0x757ad452 + .word 0xfffd01fe + .word 0x92814ab5 + .word 0x0003943c + .word 0x51544d1b + .word 0xfffc9b28 + .word 0x7cdfba59 + .word 0x0002b720 + .word 0xa9c544e2 + .word 0x00026cfd + .word 0xfc6a3663 + .word 0x00030e3e + .word 0xe9f7d3d5 + .word 0xfffe908e + .word 0x4f8bb543 + .word 0x000012d9 + .word 0x76e5e1f0 + .word 0x0000bf9b + .word 0x5e60b722 + .word 0xfffe93e9 + .word 0xa8dd4db7 + .word 0xfffdf63f + .word 0x2df69dce + .word 0x0001db30 + .word 0x8a442032 + .word 0x000292d4 + .word 0x3a04f227 + .word 0xfffef177 + .word 0x93462b38 + .word 0x000018ee + .word 0x01a62ccc + .word 0xfffe5642 + .word 0x76a6491e + .word 0xffff7e7a + .word 0x47b7f557 + .word 0xffff7c73 + .word 0x84403529 + .word 0xfffc4691 + .word 0x1df95394 + .word 0x0001365b + .word 0xeff47825 + .word 0xffff16fe + .word 0xecb18a01 + .word 0x00027e56 + .word 0x7ba0d953 + .word 0xfffefa68 + .word 0x73f9d735 + .word 0xfffd1908 + .word 0x20bd5b24 + .word 0x00019dcb + .word 0x165e9d68 + .word 0x0000d0dc + .word 0x5041d4f5 + .word 0xffff76fd + .word 0x0bc45970 + .word 0xfffc1f1a + .word 0x04f55ed4 + .word 0x00015cf1 + .word 0x9c48ceca + .word 0x00024171 + .word 0xe8e472ab + .word 0x00027c2c + .word 0x1c4b0d76 + .word 0xfffc64b4 + .word 0x57dfa925 + .word 0xfffdcab9 + .word 0xe7929989 + .word 0x0001a284 + .word 0x3b2f2e06 + .word 0xffffbc9f + .word 0x3ae0ca02 + .word 0x0000c11d + .word 0xf1a7697f + .word 0x0002cf8e + .word 0xb0b76471 + .word 0xfffc7a3b + .word 0x155a5011 + .word 0xffff8420 + .word 0xd34f46d5 + .word 0x0003afb6 + .word 0x2c825c60 + .word 0xfffcea9e + .word 0xd708425a + .word 0x00033a4d + .word 0x6988fd89 + .word 0x0002801d + .word 0x0971e9e5 + .word 0x0002273a + .word 0x7a763615 + .word 0x000050ff + .word 0x13219c82 + .word 0x0000741e + .word 0xe278d4cf + .word 0xfffe555a + .word 0xf4a8cf7f + .word 0x00039bdd + .word 0x8733df5c + .word 0x00011955 + .word 0x7b9f7fb4 + .word 0xfffe3424 + .word 0xce96a266 + .word 0xfffd2bb2 + .word 0x55ebfe2b + .word 0xfffdf294 + .word 0x854653ce + .word 0xfffc4b80 + .word 0x2e34b217 + .word 0x0003303e + .word 0x441fbecc + .word 0x0000b355 + .word 0x27fd755a + .word 0xfffcff98 + .word 0x25c894f5 + .word 0xffffb6b8 + .word 0xfca537f7 + .word 0x00037df9 + .word 0x23680d44 + .word 0xfffe531a + .word 0xbd3e4680 + .word 0xfffd802b + .word 0x9b07255c + .word 0xfffe3576 + .word 0x929a6576 + .word 0xfffde5a5 + .word 0x4d702324 + .word 0x000328d2 + .word 0xa339d10c + .word 0x0003f34c + .word 0x1a83adf4 + .word 0x0001b91e + .word 0x856cf3aa + .word 0x0003ca8b + .word 0x7d279ca3 + .word 0xfffcbe42 + .word 0x98c3ee7d + .word 0xfffff26c + .word 0x1d899971 + .word 0xfffc7ec9 + .word 0x9de5762c + .word 0x00018966 + .word 0xfa7c141d + .word 0x0000a68d + .word 0x371dff91 + .word 0x00037829 + .word 0xa159389d + .word 0xfffec92c + .word 0x429b1bf8 + .word 0xfffceb37 + .word 0x78e483ca + .word 0x00016226 + .word 0x38f5e290 + .word 0x0002424d + .word 0x69cc1d5c + .word 0x0003dbc6 + .word 0x612dbb8d + .word 0x00015132 + .word 0xb5907f2f + .word 0x0001896a + .word 0xf5f95fcb + .word 0xffff74fc + .word 0xc22111e0 + .word 0xfffd34da + .word 0x345f5ac1 + .word 0xfffe03b6 + .word 0xaff780ba + .word 0xfffdb82e + .word 0xf255bd8d + .word 0xfffd97d9 + .word 0x7b52fd1e + .word 0xffff36b0 + .word 0x3e8cdf7d + .word 0x0002c75c + .word 0x6e6e4662 + .word 0x000083d8 + .word 0x9cc51148 + .word 0x0003f261 + .word 0xaf34d810 + .word 0x0002ec39 + .word 0x8a53fc7b + .word 0x0001e432 + .word 0xece7be39 + .word 0xfffdfbed + .word 0x1c814520 + .word 0x00032275 + .word 0x09f37fb4 + .word 0x0002da3f + .word 0x32b3931c + .word 0x00021f07 + .word 0xe2d688bc + .word 0xfffd76fd + .word 0x58e36a78 + .word 0x00022198 + .word 0x940bc63b + .word 0x00028906 + .word 0x9b69eed7 + .word 0x00003a18 + .word 0x349e23dc + .word 0xfffde819 + .word 0x1af2f63f + .word 0x000240fa + .word 0x9903c1ed + .word 0x0003e29d + .word 0x2b17284e + .word 0x00032edd + .word 0x47d14f6f + .word 0x0003cad3 + .word 0xdd9f3752 + .word 0x000129a9 + .word 0x9dcdef1c + .word 0x00021a35 + .word 0x36834332 + .word 0x0003b9ca + .word 0x6df9542d + .word 0x0003a6ec + .word 0x32b3bf89 + .word 0xffff7707 + .word 0xf2693176 + .word 0x000071b5 + .word 0x444717eb + .word 0x00027b85 + .word 0xa551665e + .word 0xffff9987 + .word 0xadd4e999 + .word 0x0002ca38 + .word 0xe0f251a2 + .word 0xfffcdec8 + .word 0xa9befef7 + .word 0x0002d320 + .word 0xbce5b4cf + .word 0x000250ac + .word 0x99cc1f07 + .word 0x0002916a + .word 0x555276d9 + .word 0x00008c6e + .word 0x43c09c57 + .word 0xfffd8b84 + .word 0x068c7548 + .word 0x000183b9 + .word 0xf37217ab + .word 0x00034e19 + .word 0x1d19ca70 + .word 0x00011138 + .word 0xda2f293d + .word 0x00037435 + .word 0x2cd1d431 + .word 0xfffd27b4 + .word 0x9d89bb04 + .word 0x000025f6 + .word 0xff1e58b3 + .word 0x000241a0 + .word 0x15086c6f + .word 0xfffded3b + .word 0x108649c2 + .word 0xffff7acd + .word 0xc7253d83 + .word 0x0000c357 + .word 0x09ffc8b0 + .word 0x00024f3d + .word 0x74408f57 + .word 0xfffcbb3f + .word 0x16108259 + .word 0x00004015 + .word 0xaa81f870 + .word 0x0001d5a9 + .word 0x0e043acb + .word 0xfffcbe2a + .word 0x9ea7ead1 + .word 0x00029f39 + .word 0xbb9ead90 + .word 0x00013923 + .word 0x7b09a39d + .word 0x00000457 + .word 0x665350c0 + .word 0xfffd8ac5 + .word 0x020537fa + .word 0xfffda4f1 + .word 0x8a37a78a + .word 0x00026b3a + .word 0xf4fd60d7 + .word 0xfffe8db4 + .word 0xdc05d938 + .word 0x000101f9 + .word 0x20db62f7 + .word 0x00001b2b + .word 0xa45984e4 + .word 0xfffdf5a2 + .word 0xf50c2206 + .word 0xfffc198c + .word 0x797d9234 + .word 0xfffcf8aa + .word 0xe5802976 + .word 0x00012d22 + .word 0x19b9497e + .word 0x0002fd13 + .word 0x6b9ba0b4 + .word 0xfffe5b4c + .word 0x7e0e2f7d + .word 0xffff32d3 + .word 0x8ffc5504 + .word 0xfffe3291 + .word 0xdc7e08e0 + .word 0xffff9a1e + .word 0xfb0083c9 + .word 0x0002e05d + .word 0x7d026147 + .word 0x0001f3c3 + .word 0xbdf1447f + .word 0x0000792a + .word 0xbb4cd5c9 + .word 0xfffea3cb + .word 0x2313b6a9 + .word 0x00003454 + .word 0x305cffb7 + .word 0xfffeaf6a + .word 0xa6dbd08a + .word 0xfffcf84b + .word 0x8fc61311 + .word 0x00033668 + .word 0x17970850 + .word 0x00039e56 + .word 0xbb35b30f + .word 0xfffe12f4 + .word 0xd391a65c + .word 0x00029557 + .word 0x8d2b2f20 + .word 0x00006211 + .word 0x041390ca + .word 0xfffdb020 + .word 0x953085ce + .word 0xffff1d06 + .word 0xfb30141c + .word 0xffff6235 + .word 0xe40fb536 + .word 0x0003ebfe + .word 0x3ce75a32 + .word 0x00016bae + .word 0x75784328 + .word 0xffffc86d + .word 0xe18d0b8e + .word 0xfffc96fd + .word 0xc6210d8b + .word 0xfffe7371 + .word 0xcdba7861 + .word 0xfffea6a4 + .word 0xb07a5cb0 + .word 0xfffd55ec + .word 0x676d87cf + .word 0x0002eade + .word 0xd5294155 + .word 0x00008f0c + .word 0x316f9762 + .word 0x00017a76 + .word 0xcef80340 + .word 0x0000df3c + .word 0xb5703ad5 + .word 0x0000418d + .word 0x1556ec45 + .word 0x0001c012 + .word 0xdb20278c + .word 0x00031cbc + .word 0xf04bd8b9 + .word 0xffff088c + .word 0xa3dcec82 + .word 0xfffe1cc5 + .word 0x2fce8183 + .word 0xfffe98bb + .word 0x8f5f21e0 + .word 0x00028fa1 + .word 0x24cb7be2 + .word 0xfffecc2d + .word 0x89c0e17f + .word 0x000394e3 + .word 0xba59a76b + .word 0xffff5ad0 + .word 0x83f25409 + .word 0x0002b8d0 + .word 0xbb7bf3ea + .word 0xfffde409 + .word 0xac50418d + .word 0x00007527 + .word 0x5e3dc262 + .word 0xffff28ae + .word 0x93d605de + .word 0xfffd9f0b + .word 0x50ad8378 + .word 0xfffd927f + .word 0x0685c3b5 + .word 0xfffd3a6e + .word 0x4f28809f + .word 0xfffe79bf + .word 0xbf72e00d + .word 0xfffd9d79 + .word 0x466b9f03 + .word 0xfffcff36 + .word 0xf769b04c + .word 0x000336be + .word 0xa1c1b2b0 + .word 0x0003f949 + .word 0x49e531de + .word 0x000046a9 + .word 0xb3f7d3ed + .word 0xffff47f6 + .word 0xca141ab9 + .word 0xfffcd11f + .word 0x3a007172 + .word 0xfffe32bc + .word 0x499f9e68 + .word 0x00036b36 + .word 0xbec60ae1 + .word 0xfffea9b8 + .word 0x8063f5f6 + .word 0xffffc54f + .word 0xb218b48c + .word 0x0002984c + .word 0x533535bb + .word 0x00004b68 + .word 0x9999d478 + .word 0x00036416 + .word 0x9bf4d2c5 + .word 0x0002674a + .word 0xe20f447c + .word 0x0000399d + .word 0x8d994dd2 + .word 0xfffc2773 + .word 0x29d8ba45 + .word 0xfffee85c + .word 0xd35dc455 + .word 0xfffd4bfd + .word 0x9acf5156 + .word 0x0003b3dc + .word 0xafe88184 + .word 0xfffd2c00 + .word 0x9d89c34f + .word 0xffffbda7 + .word 0x939cd32f + .word 0x00012e1a + .word 0x6e740fe6 + .word 0xffff3d36 + .word 0xd901ff3c + .word 0xfffc6f0c + .word 0xb3088bd5 + .word 0x000339d3 + .word 0x91a582d9 + .word 0x000011f2 + .word 0xd1cd84b6 + .word 0x000173f6 + .word 0x76d725c3 + .word 0x0000a84e + .word 0x4fb13118 + .word 0x00027f70 + .word 0x9300505f + .word 0xfffd4d3b + .word 0xc3d5aa37 + .word 0x00011505 + .word 0x76731dca + .word 0x0000ae1b + .word 0x4f55f13a + .word 0xfffceab2 + .word 0x68ddf568 + .word 0x00031fc1 + .word 0x4c8a8a3a + .word 0xfffcc50a + .word 0xf1669ff5 + .word 0x00030457 + .word 0xc6329122 + .word 0x0003919a + .word 0x60145220 + .word 0x0002ba59 + .word 0x88b86c25 + .word 0xffff534a + .word 0x825aec63 + .word 0x000348b6 + .word 0x2375b90f + .word 0xfffe26bd + .word 0x42402082 + .word 0xfffcb0c5 + .word 0x074a522a + .word 0xfffeb795 + .word 0x4c2153b0 + .word 0x0003a128 + .word 0xd7056761 + .word 0x0001840e + .word 0xb2c012cd + .word 0xffffc2e8 + .word 0x3c2d0e1c + .word 0x0002ac99 + .word 0xfb933b3b + .word 0x000036d6 + .word 0x19e522c5 + .word 0x00025dce + .word 0xdce25c37 + .word 0x0000ee04 + .word 0xf16acc46 + .word 0xfffe2c0f + .word 0x41b00fd7 + .word 0xfffd4a84 + .word 0x9daca106 + .word 0xfffc4ba5 + .word 0xe596af9a + .word 0x000362a1 + .word 0x5f7a7793 + .word 0xffff7e42 + .word 0xe3d78732 + .word 0x0003b7cc + .word 0x81a823a3 + .word 0x00038053 + .word 0x8583b8bc + .word 0x0001dc91 + .word 0xce5d15c1 + .word 0x0003aa58 + .word 0x46b366c1 + .word 0x000008b1 + .word 0xe8829f1b + .word 0x0002daa8 + .word 0xc345e87c + .word 0x0000942d + .word 0x8fa4f267 + .word 0xfffd9c00 + .word 0x9e61d759 + .word 0x0003c25f + .word 0xb7d8a56d + .word 0x000311ae + .word 0x8a5f1bfe + .word 0x0001ddea + .word 0xd4d10e3b + .word 0xfffc82f8 + .word 0xdbd53ad0 + .word 0xfffc07f6 + .word 0xdb2a7082 + .word 0x0001e634 + .word 0x8bf6cd48 + .word 0x00007e67 + .word 0x20789333 + .word 0xffff7ad7 + .word 0x378ae013 + .word 0x000332fb + .word 0xb11d6a92 + .word 0x0000475f + .word 0xa0015c4c + .word 0x0001deb9 + .word 0x3a7af210 + .word 0xffff55bd + .word 0x326c9edc + .word 0x000040ef + .word 0x2fb48e45 + .word 0x0000d848 + .word 0x24dd536d + .word 0xfffece7a + .word 0x949658ed + .word 0xfffc828d + .word 0x277157dd + .word 0x0001535b + .word 0xd0076d1e + .word 0x0002a360 + .word 0x22820ca4 + .word 0x0001212d + .word 0x7082133a + .word 0xfffd7107 + .word 0x242f93a6 + .word 0x0002c936 + .word 0x1678660b + .word 0xffff2af4 + .word 0x53b054a7 + .word 0x00022205 + .word 0x8ef30efc + .word 0xfffdb9ca + .word 0x10cbe4ec + .word 0x0002e3bd + .word 0xdb9f2948 + .word 0x000176ee + .word 0x626d580c + .word 0x00000b29 + .word 0xfec6b8ce + .word 0x00024854 + .word 0x07a2c1d6 + .word 0xffff9686 + .word 0xf02cd7c5 + .word 0x00023a38 + .word 0xfe750abf + .word 0x0002fc91 + .word 0xcdccd70c + .word 0x00037b1b + .word 0xce4d0148 + .word 0x0003b110 + .word 0x779f7415 + .word 0xfffff0c2 + .word 0x6a6e33f7 + .word 0xfffe31ca + .word 0x2441fa5f + .word 0x00004a16 + .word 0xe4a53500 + .word 0x00024634 + .word 0x7fe718ef + .word 0x00027d72 + .word 0x719fccd1 + .word 0x00001eab + .word 0x37c4f381 + .word 0x0000165e + .word 0x0265d982 + .word 0x00034551 + .word 0x2acd367c + .word 0x0002ce63 + .word 0x8492d8e8 + .word 0xfffc317a + .word 0x3c8c8f92 + .word 0x0001d3cb + .word 0xe428ec9b + .word 0xfffd8966 + .word 0x45e93f3e + .word 0xfffcc4be + .word 0xcd906f2f + .word 0x00002645 + .word 0x6c46c97d + .word 0xfffcb963 + .word 0xa0a5a840 + .word 0xfffc737e + .word 0x1f05e20a + .word 0x0001f40f + .word 0x506ecb5b + .word 0xfffe7ffb + .word 0x46f5e0bc + .word 0x000274c4 + .word 0x8141c54a + .word 0xffffcbc1 + .word 0x55219685 + .word 0x00038135 + .word 0xc94a4777 + .word 0xfffe9707 + .word 0xb5b62741 + .word 0x00028e34 + .word 0x45b621eb + .word 0x000148c1 + .word 0x3ddf6c2f + .word 0x0000e05e + .word 0x379e1df4 + .word 0xffff2c50 + .word 0x649c9f3d + .word 0xfffc4e05 + .word 0xddc29fd6 + .word 0x00020137 + .word 0x58b24060 + .word 0x00038f10 + .word 0xbdfe27ad + .word 0xfffd70ff + .word 0x4ce872b4 + .word 0x00032c69 + .word 0x2eef641b + .word 0x00007afd + .word 0x15c7ff4d + .word 0xfffe9693 + .word 0xddde524c + .word 0xfffc2e53 + .word 0x1475fd06 + .word 0xfffdcc71 + .word 0xf61b5c56 + .word 0xfffe1737 + .word 0xffa06728 + .word 0xfffd68e6 + .word 0xf77f491e + .word 0xfffc9e70 + .word 0x830dbefa + .word 0x0001c15c + .word 0x19cfcb38 + .word 0xfffc64bf + .word 0x84f77185 + .word 0xfffe787f + .word 0x04ddf8a6 + .word 0x000393dc + .word 0x1814a576 + .word 0x0000a2e9 + .word 0xc21877b4 + .word 0xffff1717 + .word 0x2c91064a + .word 0x0000ae1a + .word 0x4d968cec + .word 0x000344c4 + .word 0x780f8155 + .word 0x00030e48 + .word 0x9041a22b + .word 0xfffc0129 + .word 0x1d767fea + .word 0x00016251 + .word 0xb188e719 + .word 0x0002f942 + .word 0x9c82aee2 + .word 0x0002029a + .word 0x063697fe + .word 0xffff7db3 + .word 0xbbc92abb + .word 0x0000b171 + .word 0x9af870ea + .word 0xfffd2071 + .word 0x00f7d21b + .word 0x000023cb + .word 0xe5f6d2db + .word 0xfffc1ef0 + .word 0xf34e93da + .word 0x0002b06d + .word 0x77764569 + .word 0xfffda752 + .word 0xcba629b0 + .word 0xfffddaf7 + .word 0x71e7c805 + .word 0xfffd4af2 + .word 0x8342df53 + .word 0xffff22be + .word 0x96225b95 + .word 0x0002f6ba + .word 0x89f1277f + .word 0xfffd6833 + .word 0x37e598fe + .word 0x0002a578 + .word 0xcb1f9437 + .word 0xffffcd94 + .word 0x0e72d877 + .word 0x00023d8e + .word 0x72b1db33 + .word 0xfffc8747 + .word 0xdc796397 + .word 0x0000d1ad + .word 0x292d6be6 + .word 0x0001358b + .word 0xbbe74d1f + .word 0x00003350 + .word 0x5e2a7c47 + .word 0x0003be05 + .word 0xb66fa3b7 + .word 0xfffef648 + .word 0x95e0562a + .word 0xffffb767 + .word 0x9d0fb773 + .word 0xffff94ee + .word 0x7336d193 + .word 0xfffe5b19 + .word 0xef529c13 + .word 0x00022cdf + .word 0xed814398 + .word 0xfffe0729 + .word 0x5c41e6dc + .word 0x0002fe67 + .word 0xc4dc0477 + .word 0xffffd464 + .word 0x5f4e27fa + .word 0x000279ec + .word 0xf08a0786 + .word 0xfffe0920 + .word 0x90d8fb21 + .word 0x00036127 + .word 0x3609cd57 + .word 0xffff46d2 + .word 0x5132422b + .word 0xfffdaaa8 + .word 0x194c8191 + .word 0xfffc5fc6 + .word 0x5e45bc12 + .word 0xfffcb2ec + .word 0x84ef7252 + .word 0x0002130b + .word 0x1a128483 + .word 0xfffff2f0 + .word 0xed300236 + .word 0xfffe4a94 + .word 0x8506ca32 + .word 0x00010404 + .word 0x15a4a83b + .word 0x0002896c + .word 0xec475dd7 + .word 0xfffeb3d9 + .word 0xedbd6b31 + .word 0xfffd862a + .word 0x78e27ec8 + .word 0xfffd967d + .word 0x7fe13246 + .word 0xfffca9f3 + .word 0xe4020105 + .word 0x0000bca3 + .word 0x793902ad + .word 0xfffd2297 + .word 0xcf15dd26 + .word 0xfffd3ca3 + .word 0xc3408bb6 + .word 0xfffc8e75 + .word 0x16f996ab + .word 0x00007362 + .word 0xaa1e0ef2 + .word 0xfffeea08 + .word 0x02b3c0a4 + .word 0x000164bd + .word 0x80747255 + .word 0x00031144 + .word 0xd2585c21 + .word 0xfffd1906 + .word 0x95e5e23b + .word 0xfffe0d83 + .word 0xbcdc3d02 + .word 0x000357ad + .word 0x59a6b5b5 + .word 0x00026954 + .word 0xe76bef08 + .word 0xffffc86d + .word 0x5ffd90b6 + .word 0xfffd9981 + .word 0x653446e7 + .word 0xfffc201d + .word 0xdbf630c9 + .word 0xfffcbe5d + .word 0x2aa12964 + .word 0x0001ad29 + .word 0x5ddc1f5f + .word 0xfffcfe90 + .word 0xaea537a2 + .word 0xfffe8923 + .word 0xe0a7cc1d + .word 0x000017a7 + .word 0x146b27a8 + .word 0x0001862d + .word 0x60aa809c + .word 0x0003b005 + .word 0x94fb9639 + .word 0x0001094f + .word 0xc0f98f99 + .word 0xfffdebd4 + .word 0xd032ba22 + .word 0xfffd5a56 + .word 0x40112b7d + .word 0x000060d3 + .word 0x266876e8 + .word 0x00024a5d + .word 0xa9df5e40 + .word 0xffff8014 + .word 0xc67e49dc + .word 0x0003840a + .word 0xf0ffa95f + .word 0x0002996a + .word 0xf9f78886 + .word 0x00035879 + .word 0xba0c391b + .word 0x00003057 + .word 0x3e17f4e3 + .word 0x0003196b + .word 0x3d5d111b + .word 0x0002f926 + .word 0x2defde11 + .word 0xfffe0d0a + .word 0x01ae8e6d + .word 0x000339b1 + .word 0xe3041f7f + .word 0x0001b117 + .word 0xffb2e1e6 + .word 0x000058b8 + .word 0x3b3c988d + .word 0x0001747c + .word 0xa41eac1c + .word 0xfffff01b + .word 0xfaabee12 + .word 0xffff38f7 + .word 0x00b19806 + .word 0xfffdb9ef + .word 0x3459a879 + .word 0x000156d2 + .word 0x58d2f7e7 + .word 0xfffd4fd5 + .word 0x175e824f + .word 0x0003bd78 + .word 0x81e5831a + .word 0xfffcc1b6 + .word 0x5d61bd79 + .word 0xfffe6af7 + .word 0x692f6780 + .word 0x0002291c + .word 0x1ecb5fd6 + .word 0x00020a9b + .word 0x89af4d17 + .word 0xfffe0e0a + .word 0xc0b3cc38 + .word 0xfffc056c + .word 0x2fa30d35 + .word 0xfffd723c + .word 0x0f0f4334 + .word 0xfffd24b1 + .word 0x789c4f37 + .word 0xfffd1f68 + .word 0xdfc12df7 + .word 0xfffe0ca1 + .word 0xada132b9 + .word 0x00015d85 + .word 0x7b549613 + .word 0x000048c9 + .word 0xfdf7a9eb + .word 0xfffe2023 + .word 0x173029dd + .word 0x0001b7d1 + .word 0x7fcf35db + .word 0xfffe9b9c + .word 0xa9ba2bc8 + .word 0x00026535 + .word 0x2243cfbc + .word 0xfffe72f3 + .word 0x9a00e7eb + .word 0xfffd63f2 + .word 0x6a0bff8b + .word 0x000047dd + .word 0x2d082654 + .word 0x000190a1 + .word 0x7d7ca94e + .word 0xffff76c2 + .word 0xa16081d1 + .word 0x000227fe + .word 0x4da416e9 + .word 0xffff0223 + .word 0x904cd7e3 + .word 0x00018c5c + .word 0x95e35f57 + .word 0xfffd938a + .word 0x561f0de9 + .word 0xffffa6d4 + .word 0xdfbb889c + .word 0x00000cad + .word 0xfdd79a58 + .word 0x00004e27 + .word 0x38f79d3e + .word 0xfffe37f6 + .word 0x3ad6b275 + .word 0xffff1a68 + .word 0x82d9a792 + .word 0x0002f311 + .word 0x743b9674 + .word 0x00007e43 + .word 0xe9686a75 + .word 0x00001e21 + .word 0xbca5146a + .word 0xfffeea44 + .word 0xad56c985 + .word 0xfffedbe8 + .word 0x98e468f1 + .word 0xfffca9ad + .word 0xb2c049b6 + .word 0x00032f66 + .word 0xaafecaf7 + .word 0x00031694 + .word 0xef2c9f9b + .word 0x0000b5d3 + .word 0x5bb9a3ce + .word 0xfffdf7d8 + .word 0xa64c289f + .word 0xfffd7da2 + .word 0xa894ecb9 + .word 0xfffe5390 + .word 0xdf8545eb + .word 0x00010d2a + .word 0x967f5429 + .word 0xfffc10e2 + .word 0x35985ce3 + .word 0x0001f3d8 + .word 0x89298f01 + .word 0xfffdb976 + .word 0x51e8f999 + .word 0xfffc805c + .word 0xb5fe4da7 + .word 0x0000621a + .word 0x934e944e + .word 0x0001fed2 + .word 0x36b9f4dc + .word 0x00016c1c + .word 0xa24108bd + .word 0xffffe74b + .word 0x2786eb78 + .word 0x0003a69e + .word 0x1d7465f9 + .word 0xfffc1557 + .word 0x5cd8267b + .word 0x0003c496 + .word 0x9c7c8e0c + .word 0x00006ed3 + .word 0xc5d25e08 + .word 0x00028b51 + .word 0x635a95e8 + .word 0xfffcf12a + .word 0xe6fb8c95 + .word 0x0001dd25 + .word 0xdc31f17b + .word 0xfffd881e + .word 0x96262a4c + .word 0x0000e556 + .word 0x5d786217 + .word 0x00016b54 + .word 0x6de48a08 + .word 0xfffdec4b + .word 0x222c7b2d + .word 0xfffd585c + .word 0xc9f953bc + .word 0x000052f7 + .word 0x4b3fbeb2 + .word 0x00011463 + .word 0x1b2c7ff8 + .word 0x000274f0 + .word 0x0a806516 + .word 0x0002fe45 + .word 0x92ff1ab0 + .word 0xfffdb6cf + .word 0xf2660dc7 + .word 0xffff9fde + .word 0x213de8bf + .word 0x0000330c + .word 0x1665b526 + .word 0x0002905a + .word 0xf4084354 + .word 0x0002b8bf + .word 0x24b68b0b + .word 0x0001fff9 + .word 0x27956305 + .word 0x000267be + .word 0x0dd2ef4c + .word 0xfffccb9c + .word 0xca0bcefe + .word 0x0000da07 + .word 0x12b4d2b3 + .word 0x000399b5 + .word 0x8ce43665 + .word 0x0000233e + .word 0x2e768190 + .word 0xfffce34b + .word 0xc4fca81b + .word 0xfffc3d1b + .word 0xbc4e6489 + .word 0xffff336e + .word 0x25845a9f + .word 0xfffd16fb + .word 0x6eaadaa9 + .word 0xffffcd54 + .word 0x714c6f14 + .word 0xfffc89ed + .word 0xcd5ef0ca + .word 0x0002a6b4 + .word 0xe752066a + .word 0xfffd946d + .word 0xd3fd6968 + .word 0x00019e6f + .word 0x3a3ecf5e + .word 0xfffef9ac + .word 0xac774508 + .word 0x0002047c + .word 0x1eb48705 + .word 0xfffebba9 + .word 0x8ac5fa41 + .word 0x0001c5f3 + .word 0x0516db5b + .word 0xfffc1f19 + .word 0xa79ccd7a + .word 0xfffdf866 + .word 0xa379b28d + .word 0x00005fd8 + .word 0xf9f87da2 + .word 0xfffc2d94 + .word 0xfb1bd494 + .word 0xffff2f33 + .word 0x76f07e81 + .word 0x00016a03 + .word 0x74f00011 + .word 0x0003a3a7 + .word 0xba432d34 + .word 0xfffd84fb + .word 0x3f69ba9e + .word 0x0003fefb + .word 0x16dd5c06 + .word 0xfffec9c2 + .word 0x8d47d1a2 + .word 0x0002c526 + .word 0x65fd5230 + .word 0x000119ac + .word 0xb74834f9 + .word 0xffff74c3 + .word 0x45ed85e6 + .word 0x0000c500 + .word 0x79040fc8 + .word 0xfffd10cf + .word 0x7cf3ca89 + .word 0x0001dd07 + .word 0x9a50c881 + .word 0x0003deb7 + .word 0xcf9ff02b + .word 0xfffea339 + .word 0x8c59d0a9 + .word 0x000183d1 + .word 0x6ca932e7 + .word 0x00014b5e + .word 0x62d05e16 + .word 0xffff9427 + .word 0xf9851411 + .word 0x00015bec + .word 0x15ca07b4 + .word 0x0003a79f + .word 0x5a09a8c3 + .word 0xffffa158 + .word 0xc2794ca5 + .word 0xffffd1ed + .word 0x1a7c15aa + .word 0xfffdf7d0 + .word 0xbfdd6c72 + .word 0xfffc87e8 + .word 0x8afb6f7b + .word 0x00021669 + .word 0x7dc47389 + .word 0xfffca245 + .word 0x33174156 + .word 0x00024c23 + .word 0x15543301 + .word 0x0003a97b + .word 0x28f0a0a0 + .word 0xfffc6e42 + .word 0xb920589f + .word 0x0001ea51 + .word 0xe52fc2ae + .word 0x00028dd4 + .word 0xfcafd76d + .word 0xfffd2916 + .word 0x5302d6aa + .word 0xfffc23c9 + .word 0xb095815c + .word 0xfffdb481 + .word 0x45fd1fa2 + .word 0x0003b4fa + .word 0x09989ce8 + .word 0x00005776 + .word 0xa7de6a47 + .word 0x0003e4d5 + .word 0x1bb5d651 + .word 0xfffc6c02 + .word 0xbce67b6b + .word 0x0003a1d0 + .word 0xe029cdc2 + .word 0x0002912f + .word 0xecf68d58 + .word 0xfffcf891 + .word 0x8b23711d + .word 0x0003bc7f + .word 0x4c638b4d + .word 0x0002c437 + .word 0x389f001c + .word 0x00013edb + .word 0x6f184bcb + .word 0x0003a598 + .word 0x80899103 + .word 0xfffc386f + .word 0xe2deae5b + .word 0xfffdfff9 + .word 0xb61875df + .word 0x000198ed + .word 0x6ef6963e + .word 0xffffbf99 + .word 0x10325e1f + .word 0xfffcc935 + .word 0x0afc8d09 + .word 0x0000b937 + .word 0x34d4755b + .word 0x0003b2b7 + .word 0x7a5de3e9 + .word 0xfffc8dcc + .word 0xa54409ac + .word 0xfffdea2a + .word 0xcadc63b0 + .word 0x00017bc1 + .word 0xc3dc9a14 + .word 0x0001d213 + .word 0xd16c17a8 + .word 0xfffdece2 + .word 0xb25f2412 + .word 0xfffdb205 + .word 0xa328d24a + .word 0xfffd47d1 + .word 0x4568b2d8 + .word 0xfffd0c2d + .word 0x886cd4f7 + .word 0x00017d01 + .word 0x6605626b + .word 0xfffd8d3b + .word 0x73f351c8 + .word 0xfffd8bd7 + .word 0xb9374314 + .word 0x0003535b + .word 0xc375ab0b + .word 0xfffce2a1 + .word 0xd62fb268 + .word 0xfffeb09e + .word 0x04888187 + .word 0x00026b3f + .word 0xfef5e7ce + .word 0xfffd8b88 + .word 0xbab1d25d + .word 0x00016e50 + .word 0x6dc6ca40 + .word 0xfffd265b + .word 0x99445b36 + .word 0xfffe23cf + .word 0x7d0806d3 + .word 0xfffebc0f + .word 0xbd404c6e + .word 0xfffe5b63 + .word 0xf82af585 + .word 0x00006f6f + .word 0xa21a5304 + .word 0xfffdbcbc + .word 0x9aec5a5e + .word 0x0003676b + .word 0x84c5ec73 + .word 0xfffdc235 + .word 0x0ee5942f + .word 0x0002d384 + .word 0x11d9d08e + .word 0xfffc2f48 + .word 0xeb371c0d + .word 0xfffe56d7 + .word 0xe6630a90 + .word 0xfffdc622 + .word 0x77693746 + .word 0x0000080e + .word 0xa96b3f60 + .word 0x000154c7 + .word 0x80cee324 + .word 0x000072cb + .word 0xba59f53f + .word 0xffffdafd + .word 0xdf68713b + .word 0x0003354c + .word 0x9874faa1 + .word 0x0001ceb0 + .word 0x557e0db9 + .word 0x00011e64 + .word 0x35d3aabb + .word 0x0000528d + .word 0x06399149 + .word 0x0001e335 + .word 0x31e0ff12 + .word 0xfffe2f7b + .word 0xf9f90bab + .word 0xfffe6391 + .word 0x7406f1a5 + .word 0xffff1e77 + .word 0xee4f308a + .word 0xfffc6605 + .word 0x3e0f9806 + .word 0xfffc569f + .word 0x03a59666 + .word 0x0002e07d + .word 0x2cf1528b + .word 0x00027965 + .word 0xb8844f69 + .word 0x00035171 + .word 0x338c123a + .word 0x000325d2 + .word 0x4986b3a7 + .word 0xfffcd942 + .word 0x1da7b64d + .word 0xfffd9525 + .word 0xe0bfa6e2 + .word 0xfffd97f8 + .word 0x58b68754 + .word 0x0002fb77 + .word 0xb2b24b16 + .word 0xfffcbe35 + .word 0xd535bf09 + .word 0x00008bcd + .word 0x53b32d5b + .word 0x0003991b + .word 0x0ca8340f + .word 0x00017fbe + .word 0x888ccff7 + .word 0xfffc20d9 + .word 0x07388b5d + .word 0xfffe2308 + .word 0x5d5d80c4 + .word 0x000298ce + .word 0xfcb4a64a + .word 0xfffd0b08 + .word 0x70d66148 + .word 0x0001950e + .word 0x9730af46 + .word 0x0003ff8e + .word 0x44aa7d5e + .word 0x00038b63 + .word 0xfd9f20df + .word 0xfffe5dfc + .word 0xe5444b48 + .word 0xffffbfdb + .word 0x53b13895 + .word 0xfffc8cf1 + .word 0x48b5d4bb + .word 0xfffe7559 + .word 0x8b6a76e7 + .word 0x00009d5d + .word 0xd9595300 + .word 0xfffd0c0a + .word 0xeeee2646 + .word 0x000090cc + .word 0x6c895f21 + .word 0x0003bb6d + .word 0x81754561 + .word 0xfffd68eb + .word 0x242fadf0 + .word 0x0002c4c3 + .word 0x5b5db2e0 + .word 0xfffed19b + .word 0x7c1bd7d6 + .word 0xfffcc740 + .word 0x3c773acd + .word 0x0003fe01 + .word 0x3040d682 + .word 0xfffed956 + .word 0xef017ca8 + .word 0x0000f8ac + .word 0xf7dcd20d + .word 0xfffd7f85 + .word 0xd046b7e8 + .word 0x0001903c + .word 0xdaacde6b + .word 0x0002aa08 + .word 0xe6e45946 + .word 0xfffc1e0e + .word 0xd8808206 + .word 0x0001f305 + .word 0xc7051013 + .word 0xffff556c + .word 0x4cc4eec2 + .word 0xfffe8d56 + .word 0x994a6d1a + .word 0xfffd6f57 + .word 0x1c7a68fb + .word 0x00005d33 + .word 0xb3b8c1b1 + .word 0xfffc6fe6 + .word 0xcd7a4d59 + .word 0xfffe6d20 + .word 0x6ecb628b + .word 0x00039f3f + .word 0x3fa19a77 + .word 0x0003b262 + .word 0x90d7168d + .word 0x000089b0 + .word 0x51407b18 + .word 0xffff6350 + .word 0xd8424fce + .word 0xfffe5320 + .word 0x39d1f00f + .word 0x0000b944 + .word 0xaf76475c + .word 0x00011015 + .word 0xf210b2fc + .word 0x000362ab + .word 0x9afbd041 + .word 0x0000b381 + .word 0x7dfb8878 + .word 0x00004059 + .word 0x60ae216f + .word 0x0001e62b + .word 0x0aa802dc + .word 0x00022081 + .word 0x2c116c52 + .word 0x0001a331 + .word 0xe071694c + .word 0x000230d5 + .word 0x03b32852 + .word 0xfffc101d + .word 0x348dcac4 + .word 0xfffecfb1 + .word 0xbec7c8bf + .word 0xfffe0eda + .word 0x102ee8aa + .word 0xfffc2d05 + .word 0xa6bfec18 + .word 0x00022fe4 + .word 0xfc14c0c4 + .word 0x00016b66 + .word 0x61951671 + .word 0x00035eb7 + .word 0x3424b972 + .word 0x0003b1d4 + .word 0x95efa08a + .word 0xfffc9da0 + .word 0x14a4b913 + .word 0xfffeebc6 + .word 0x5f44357c + .word 0xffff76c2 + .word 0xd5b095ae + .word 0xffffdd08 + .word 0xc8034a7f + .word 0x00004d0d + .word 0x30333e98 + .word 0xfffd2d4e + .word 0x864b91cf + .word 0x0003a058 + .word 0x07516e6d + .word 0x00023105 + .word 0x58392d75 + .word 0x00038027 + .word 0xbeb17be9 + .word 0xfffe125d + .word 0xd77e3af4 + .word 0xfffce71a + .word 0xd4d8b4d1 + .word 0xfffe80fe + .word 0x87f3403c + .word 0x00019055 + .word 0xc5898c3e + .word 0xfffe7f42 + .word 0x6305fc57 + .word 0xfffc41cb + .word 0x11931cbb + .word 0x0002e18c + .word 0x2db5249a + .word 0xfffc6b3b + .word 0xa5f3348a + .word 0x00024656 + .word 0x270790bb + .word 0x000141c7 + .word 0x6b6b53b5 + .word 0x0002d3c1 + .word 0x112c90ea + .word 0x0000a272 + .word 0x36bb6c94 + .word 0x0001cdc6 + .word 0x4387298f + .word 0x000192a7 + .word 0x1d44da22 + .word 0xfffde264 + .word 0x56638707 + .word 0x0002ebfb + .word 0xa4792ee0 + .word 0xfffe862c + .word 0x8c4189a5 + .word 0xffffb8ef + .word 0xe613f02c + .word 0xfffe484c + .word 0xd5082585 + .word 0xfffdef9e + .word 0x2a4761c4 + .word 0x00013ee8 + .word 0x3871dec9 + .word 0x00030d6d + .word 0x22cf89b9 + .word 0x000291e4 + .word 0x48a27fd7 + .word 0xfffd622b + .word 0x313c2d93 + .word 0x000183a4 + .word 0x8cfc6419 + .word 0x0000babe + .word 0x41e8c4cc + .word 0xffff7de3 + .word 0xc5871499 + .word 0x00030546 + .word 0x7657bbec + .word 0xfffe0f98 + .word 0xedc448fe + .word 0x00025a30 + .word 0x981c3e86 + .word 0x0000e349 + .word 0xb1e25d2c + .word 0xffffd310 + .word 0x83f71b52 + .word 0xfffdb295 + .word 0x95dc7865 + .word 0x000160fc + .word 0xf78e7213 + .word 0x00026e8a + .word 0x7775f583 + .word 0xffff7e68 + .word 0x5a0ee879 + .word 0x00037750 + .word 0xc7a17c2f + .word 0x000014e4 + .word 0x6cd90eab + .word 0x000121aa + .word 0xd22ed85c + .word 0x0001fca8 + .word 0x91fbd06a + .word 0xfffe11f7 + .word 0x8fec7682 + .word 0xfffcc327 + .word 0x7e4cd72e + .word 0xfffc8221 + .word 0x0bb06752 + .word 0xfffe8838 + .word 0x3790d0fd + .word 0xfffe0742 + .word 0x3356ed8b + .word 0x00006f3e + .word 0xc8bada1a + .word 0xfffd5614 + .word 0xc8ca4861 + .word 0x00030b9a + .word 0x0761314a + .word 0x00022787 + .word 0x424d39f6 + .word 0xfffe249f + .word 0x849054ec + .word 0xfffe4bfa + .word 0x0b185905 + .word 0x0003a6df + .word 0x9def237e + .word 0x0000be59 + .word 0x559c178f + .word 0xfffc227b + .word 0x435f87d9 + .word 0x0000eeef + .word 0xe62b0768 + .word 0xfffed11a + .word 0x49182604 + .word 0x0002345d + .word 0x47fb82b5 + .word 0x00020864 + .word 0x8030d687 + .word 0xfffec83b + .word 0xa7765e4a + .word 0x0003f897 + .word 0x7cfc71cb + .word 0xffffe7d0 + .word 0x5ef4dbc7 + .word 0x0003f368 + .word 0x4add8e1a + .word 0xfffec9b6 + .word 0xa7319a6c + .word 0xfffd6a9a + .word 0xfa001b03 + .word 0x00029120 + .word 0xd39b341a + .word 0x00031fe0 + .word 0xddd34e0e + .word 0xffff1be5 + .word 0x3dd85126 + .word 0x0003e4c8 + .word 0x131722e8 + .word 0xfffddc7e + .word 0xb37c453b + .word 0xfffe961b + .word 0xb01ec25c + .word 0xfffecd32 + .word 0x7ee6ff4a + .word 0x0000021f + .word 0xb2b85b0a + .word 0x00039567 + .word 0xbab85e7c + .word 0xfffeedb3 + .word 0x0a76fd36 + .word 0x000254ab + .word 0x5ade0542 + .word 0x0003dbe5 + .word 0x1eacb535 + .word 0x00022074 + .word 0xd81f645e + .word 0x00034d3e + .word 0x45331dd8 + .word 0xfffcb82d + .word 0xff47fc50 + .word 0x00034132 + .word 0x771bf88c + .word 0xfffe8a98 + .word 0xc3a432aa + .word 0x0003a590 + .word 0xc7a7d5db + .word 0x00019585 + .word 0xc7683ac1 + .word 0x0001c628 + .word 0xc5cac29f + .word 0xfffd044c + .word 0xd637d8f3 + .word 0x00014c09 + .word 0x3f624604 + .word 0x0000e877 + .word 0xe6176c89 + .word 0xfffefdef + .word 0x4bd25d29 + .word 0xfffd493e + .word 0x9ee93554 + .word 0x0000c3bf + .word 0x3f42b3c9 + .word 0xfffe4b11 + .word 0x1843d02a + .word 0x0002977c + .word 0x1567b28d + .word 0x000107a6 + .word 0x38470acf + .word 0xfffc3835 + .word 0x7060089e + .word 0xffff2526 + .word 0x50972c36 + .word 0x0000ea78 + .word 0x9d51de11 + .word 0x00000811 + .word 0xa076bd62 + .word 0xfffe928a + .word 0xdc77272a + .word 0xfffeb89d + .word 0x86b61f5a + .word 0x0000e489 + .word 0x00c381b7 + .word 0xffffa793 + .word 0x84f7af16 + .word 0xfffc2b2d + .word 0x26b7507e + .word 0xfffe8ae5 + .word 0x16835696 + .word 0x00031dbe + .word 0xfa57de1b + .word 0xfffd2806 + .word 0xb294b2e7 + .word 0x00018802 + .word 0xb9611649 + .word 0xffff09b1 + .word 0xb36fa788 + .word 0xfffc4c75 + .word 0x5ce70adb + .word 0x0002b327 + .word 0x8db7413d + .word 0xffffff5f + .word 0x5296db16 + .word 0x0003ea5e + .word 0xa3d2e6bd + .word 0xffff733b + .word 0x3c2e8da7 + .word 0xfffd0242 + .word 0x005acd6a + .word 0xffffb389 + .word 0xf866249d + .word 0xfffe3ae9 + .word 0x2de2f17c + .word 0x0003af48 + .word 0x0ba59517 + .word 0x000196a3 + .word 0x8c13d184 + .word 0xffff6e10 + .word 0xe9a81f07 + .word 0x0001472d + .word 0x2767434c + .word 0x0003a1aa + .word 0x4aa36026 + .word 0xffffb4b3 + .word 0xc417927b + .word 0xfffe5c13 + .word 0xa0e80819 + .word 0x00022136 + .word 0x9d0811f9 + .word 0xfffcd87f + .word 0x498e878f + .word 0xfffff868 + .word 0x60914e71 + .word 0xffff2fe2 + .word 0x346f18f1 + .word 0x00024c11 + .word 0x0da64913 + .word 0xfffda8dc + .word 0xeafb047c + .word 0x00004a9a + .word 0x48e9fb96 + .word 0xfffd7cc7 + .word 0xbbb59196 + .word 0x000241fa + .word 0x7e6d5705 + .word 0x0000434b + .word 0x61b9bd83 + .word 0xfffe7fca + .word 0xd7f7fd7f + .word 0xfffdf86c + .word 0x0ec9fd84 + .word 0x0000594c + .word 0x67a29bc2 + .word 0xfffe9040 + .word 0x92b5915e + .word 0xfffe2d53 + .word 0xcf72c0ed + .word 0xfffd6298 + .word 0x2c1b3010 + .word 0x0003ba2d + .word 0x222bb7bd + .word 0x000334e1 + .word 0x878ee83e + .word 0x0001e57b + .word 0x03c93ac5 + .word 0x00027003 + .word 0x808d0b19 + .word 0xffffbbb5 + .word 0xaec9d542 + .word 0xfffd11bd + .word 0x7b5a6a6e + .word 0xfffca026 + .word 0x4ecd7d86 + .word 0xfffe9b1a + .word 0xc73026ee + .word 0x000140f9 + .word 0xefd06a20 + .word 0x0000b72b + .word 0xff7b30c6 + .word 0x00025919 + .word 0xccd93432 + .word 0x0003ec65 + .word 0x4de301ed + .word 0x00035cbf + .word 0x0eb84b26 + .word 0x000151f1 + .word 0x9bd8c315 + .word 0xffff4485 + .word 0xabd5d34c + .word 0x0001b711 + .word 0x49daba99 + .word 0xffff594d + .word 0x4d94d0b0 + .word 0x00012ed9 + .word 0xbe86a127 + .word 0xfffeb701 + .word 0x3c59b830 + .word 0xfffc7907 + .word 0xacd59cca + .word 0xfffcd3ec + .word 0x526f34c1 + .word 0x0001906c + .word 0xe59be180 + .word 0x0002fbfe + .word 0xbea7b24a + .word 0x0000bc0e + .word 0xddf6bb65 + .word 0x00004325 + .word 0x2a6ca6e6 + .word 0x00024224 + .word 0x098e8a47 + .word 0xfffc44b7 + .word 0x420b4edb + .word 0x0002b114 + .word 0xba39ecec + .word 0x0000f91d + .word 0x244b6234 + .word 0x000220b7 + .word 0x560952c0 + .word 0x000375f6 + .word 0x6b46a1bb + .word 0xffffab51 + .word 0x0e179612 + .word 0x00011e96 + .word 0x7b33edd2 + .word 0xfffcc8ea + .word 0x5781dc7a + .word 0xffffd3e1 + .word 0x56800d1c + .word 0x00033a63 + .word 0x53b6afc6 + .word 0xfffce46a + .word 0x0fa74020 + .word 0x0001421d + .word 0x57b15122 + .word 0xfffee4f8 + .word 0x2667224b + .word 0xfffedea6 + .word 0xa9aa0e84 + .word 0xfffc3646 + .word 0x62484c57 + .word 0xffffe5b6 + .word 0x664fecd5 + .word 0xfffc1a41 + .word 0x304ad794 + .word 0xfffe0aa6 + .word 0x4cc2c323 + .word 0xfffff409 + .word 0x50617981 + .word 0x0001485e + .word 0x8b6fdf7d + .word 0x00037e65 + .word 0x0591086a + .word 0x00000441 + .word 0x7e26bd76 + .word 0xffff1aa9 + .word 0xc7188c98 + .word 0x000232f7 + .word 0x2262e829 + .word 0x0000c41a + .word 0xef6e4379 + .word 0x000327af + .word 0xb10edd03 + .word 0xffff9a8b + .word 0xc3972192 + .word 0xfffd8c23 + .word 0x5e5b61d1 + .word 0xfffe0fa3 + .word 0x6906561c + .word 0x0002697b + .word 0xb08512eb + .word 0xffff3bff + .word 0x7f0e289e + .word 0xffff7ae2 + .word 0xc9b37adb + .word 0xffffb001 + .word 0xeb780bf0 + .word 0x00018ee2 + .word 0x2466812f + .word 0x0002717e + .word 0x3d40a0c7 + .word 0xfffdb394 + .word 0x090a30a7 + .word 0x0002757e + .word 0xdbcd45cc + .word 0xfffc2b72 + .word 0xf46491b6 + .word 0xfffeadc6 + .word 0x702f063b + .word 0x0003c9d5 + .word 0x86de8d6a + .word 0x00036ae0 + .word 0x7330a3ec + .word 0xfffd80d6 + .word 0xb7ad148e + .word 0xfffc1c09 + .word 0xd7b96b07 + .word 0xfffe674e + .word 0x85e48d7f + .word 0xffff0ecc + .word 0xa5f84319 + .word 0x00023273 + .word 0x1a2ff21a + .word 0x0002ef9a + .word 0xe88ff525 + .word 0xfffc1bc5 + .word 0xb8d3ebc5 + .word 0xfffe8724 + .word 0x4ed05953 + .word 0x0000b454 + .word 0x12487ad6 + .word 0xfffe59ef + .word 0x86f1dc98 + .word 0xfffcec6e + .word 0x41b0310e + .word 0xfffe519f + .word 0xd97ac21e + .word 0xffffcb31 + .word 0xa3557558 + .word 0xfffc48db + .word 0x1299f3c7 + .word 0x000051e1 + .word 0x64041316 + .word 0x000167cf + .word 0x9833c4e4 + .word 0xfffd97cc + .word 0x1f1ba698 + .word 0xffff5d99 + .word 0x38124510 + .word 0xfffd6492 + .word 0x1c261f81 + .word 0x0000d73d + .word 0x4fab93d1 + .word 0x000078e4 + .word 0x9ce74718 + .word 0x00015198 + .word 0xffb0c193 + .word 0xfffc6217 + .word 0xf14d1174 + .word 0x0001e291 + .word 0x44e6a79a + .word 0x0001b77f + .word 0x147b7a06 + .word 0xfffc5a63 + .word 0x9afc5898 + .word 0x0000153f + .word 0x9be9b85a + .word 0x00023cf7 + .word 0xc26106d0 + .word 0x0003313c + .word 0x86e1761d + .word 0x00017aaa + .word 0x798ff445 + .word 0xfffd0358 + .word 0x762f2dd8 + .word 0xfffff67a + .word 0xbdc453f5 + .word 0x0003c8a1 + .word 0x922284b3 + .word 0x0000fc3d + .word 0x665ef08d + .word 0x0002ae0b + .word 0x0710748c + .word 0xfffed73a + .word 0x53dc1f41 + .word 0x0000c05f + .word 0x09a3448c + .word 0xfffc0bc3 + .word 0x5f310cf2 + .word 0xfffd043f + .word 0xd2edfc88 + .word 0x00030808 + .word 0x14933c41 + .word 0xffff4165 + .word 0xd1a3303c + .word 0xfffcb3f9 + .word 0xe91f9e8b + .word 0x00016f52 + .word 0x1129d8b5 + .word 0xfffcf77c + .word 0x8cc4a337 + .word 0x00030513 + .word 0x3ee6ca80 + .word 0xfffcd7c1 + .word 0x8da298da + .word 0xffffd114 + .word 0xa9315fe1 + .word 0xfffcbefb + .word 0xa6d7bd93 + .word 0xfffdf588 + .word 0xa6701a54 + .word 0xffff1598 + .word 0xec19da8b + .word 0xfffccac5 + .word 0x38a9590b + .word 0xffff19fc + .word 0xc34440c6 + .word 0x0003644f + .word 0xbdbb5c5d + .word 0xfffe5e8c + .word 0x6b428872 + .word 0x00016bd6 + .word 0x3116a14f + .word 0x00022917 + .word 0x2abbc3db + .word 0xfffc3e28 + .word 0xa1e70dd1 + .word 0xfffc71ea + .word 0x9672a740 + .word 0xfffd2b6b + .word 0xdd4c85a5 + .word 0xfffccf64 + .word 0x1564326a + .word 0xffff894b + .word 0x48fb77ad + .word 0xffff3f9d + .word 0x68319fe6 + .word 0xfffe3347 + .word 0x8e2e01cb + .word 0xffff0be5 + .word 0xed608ebd + .word 0x00003920 + .word 0x8778d11b + .word 0xfffd539e + .word 0x11160164 + .word 0xfffd6f4b + .word 0xc237eaf7 + .word 0xfffdf27f + .word 0x3c8c9253 + .word 0x0003eb53 + .word 0xf91e3412 + .word 0xfffeab1b + .word 0x06db2aa4 + .word 0x000298f0 + .word 0x0bdb3b2c + .word 0xfffeac51 + .word 0x70a9c519 + .word 0xfffffacf + .word 0x75246c03 + .word 0xfffccb16 + .word 0xe374f536 + .word 0xfffc66da + .word 0xc77ba71f + .word 0xfffc231e + .word 0xf2ec0ed4 + .word 0x00035ffc + .word 0xca7f3d25 + .word 0x0000f66a + .word 0x6c78d886 + .word 0xfffd3450 + .word 0x1a1fb242 + .word 0x0001d398 + .word 0x547a2d73 + .word 0xfffe4860 + .word 0xf1ead2a6 + .word 0xfffcd3ca + .word 0x321b3a8b + .word 0xfffd08dc + .word 0x50255944 + .word 0x0003135d + .word 0x457b3a31 + .word 0xfffc4a5b + .word 0xf4159fdc + .word 0xfffe124a + .word 0x482dd184 + .word 0x00009030 + .word 0x978c1ae5 + .word 0xffff01fb + .word 0x1b4f19d5 + .word 0x0001a369 + .word 0xa191fe43 + .word 0x0000fd98 + .word 0x84d8ba68 + .word 0x00005902 + .word 0x2982f430 + .word 0x000165d7 + .word 0x8f0040b1 + .word 0x00003d8e + .word 0xcef1dda6 + .word 0x00015aa2 + .word 0xf29bb14a + .word 0xffffba53 + .word 0x8a44e056 + .word 0xfffd4e3c + .word 0xfdd94f80 + .word 0xfffef8cd + .word 0x5cb9652b + .word 0xffff4323 + .word 0x2d2c9315 + .word 0xfffe3f73 + .word 0xb1e5ebda + .word 0x0001443d + .word 0x905092c5 + .word 0xffffda08 + .word 0xccddb245 + .word 0x0000e57c + .word 0x6dacd394 + .word 0xfffcda52 + .word 0x120db570 + .word 0x00024566 + .word 0x2615614f + .word 0x0002e0d4 + .word 0xd1757d18 + .word 0x00018ea2 + .word 0x2ea26279 + .word 0xfffee99f + .word 0x136b2e66 + .word 0xfffcc0f5 + .word 0xfcf6ed89 + .word 0xfffe02e5 + .word 0x938fac13 + .word 0xfffce2f3 + .word 0xf95005bc + .word 0x000099f8 + .word 0xe25c84a0 + .word 0xfffcf1cc + .word 0x5b23997d + .word 0x000304ad + .word 0x302b0be9 + .word 0x0003ea22 + .word 0x09bd91f0 + .word 0xfffe9b96 + .word 0x3736c665 + .word 0x00003358 + .word 0x47afdd60 + .word 0xffff0fcd + .word 0xac09b825 + .word 0x00018cb9 + .word 0xb7b3874d + .word 0x000236ec + .word 0x94dcd412 + .word 0x00021727 + .word 0x14d9a2b5 + .word 0xfffcebfc + .word 0x8bcc3cf6 + .word 0xfffc2b61 + .word 0xc736e6a0 + .word 0xffff458d + .word 0xf276fe96 + .word 0xfffd9bfb + .word 0xffbae063 + .word 0x00023649 + .word 0x9b7676e1 + .word 0xffffb8b8 + .word 0x5bc76514 + .word 0x0003f606 + .word 0xf10c4845 + .word 0x000273b7 + .word 0x790facfe + .word 0xffffd50a + .word 0x465afee8 + .word 0x0000701c + .word 0x83d751f6 + .word 0xfffe651c + .word 0xd1476c81 + .word 0x000303b2 + .word 0x0f64a14c + .word 0xfffecc26 + .word 0xdac3204e + .word 0x00034474 + .word 0x2897d555 + .word 0xffff935c + .word 0x5103c611 + .word 0xfffc8381 + .word 0xdcc2fc29 + .word 0x0000705e + .word 0x54ed45ca + .word 0x0002f191 + .word 0x4d5f659a + .word 0x00012ec7 + .word 0xa451d2df + .word 0xffff8417 + .word 0x9b5432cc + .word 0x000009bd + .word 0x3c45565e + .word 0xfffcd7f8 + .word 0xbcf2330c + .word 0x0000f84c + .word 0xfb09f190 + .word 0xfffc0ed0 + .word 0xa43b1926 + .word 0xffffca20 + .word 0xa1c572ac + .word 0xfffd0cea + .word 0xf543cd2c + .word 0xffffc0c0 + .word 0x3505b6df + .word 0x0001b1c5 + .word 0x82d55895 + .word 0x0000bd8f + .word 0xd45657c8 + .word 0xfffd169c + .word 0x77bd5e1f + .word 0x000291dd + .word 0x8c44ea0d + .word 0x000154bb + .word 0x470e9917 + .word 0xfffcece6 + .word 0x621678e3 + .word 0xfffc7186 + .word 0xef2d2e6a + .word 0x0003e6ae + .word 0x708d9017 + .word 0x0003af04 + .word 0xefcd0695 + .word 0x00019dd8 + .word 0xa1ae687a + .word 0x000251e7 + .word 0x5ec4d0ea + .word 0x00010ec7 + .word 0x47b27503 + .word 0xfffc5f99 + .word 0x26ec20b0 + .word 0xffff46fd + .word 0x25b77557 + .word 0xfffc2a5b + .word 0x4df686e5 + .word 0xfffc325b + .word 0xa45fcd90 + .word 0x000029c4 + .word 0x8dee7094 + .word 0x0000756d + .word 0xcc177f19 + .word 0xfffd005e + .word 0xbd9d52fb + .word 0x0001dfb2 + .word 0xc9d4d7ca + .word 0x0001a7dd + .word 0xbc1037e2 + .word 0x0002fa4c + .word 0xd0b75a9f + .word 0xffff4fc0 + .word 0x5cb7b3ab + .word 0x0000a307 + .word 0x5379715c + .word 0x00035f88 + .word 0x0cb29751 + .word 0x0001dd4c + .word 0xd074c678 + .word 0xffff4697 + .word 0x8daf3883 + .word 0x00023d3e + .word 0x8ffc948b + .word 0x000237d1 + .word 0xb6682ec0 + .word 0xffff239d + .word 0x2f34d81e + .word 0x0003505e + .word 0x68420969 + .word 0xfffc1243 + .word 0xf91bbe58 + .word 0xfffe45fa + .word 0x17b84f33 + .word 0xfffdc1af + .word 0x62189c3c + .word 0x0002e2d8 + .word 0x92091cf9 + .word 0xfffd0d35 + .word 0x41bcf6a1 + .word 0xfffeb671 + .word 0x26d7be97 + .word 0x00036086 + .word 0xa6608587 + .word 0x0001b52f + .word 0xe6a8bf7e + .word 0x00019cfb + .word 0x7a00ba6d + .word 0xfffdec3b + .word 0x4d731968 + .word 0xfffd141b + .word 0xe17010df + .word 0x0000660d + .word 0x73947851 + .word 0xfffdb18d + .word 0xc58fa11d + .word 0x0000f322 + .word 0x8efddb60 + .word 0xffff8eec + .word 0xafae8352 + .word 0x00022107 + .word 0xb39ccd3e + .word 0xfffcd693 + .word 0xef59eba1 + .word 0x0000a7df + .word 0xe13f9d09 + .word 0x00028b7f + .word 0x522c564a + .word 0x0001e823 + .word 0x517f3ae3 + .word 0xfffd35b5 + .word 0x062e1101 + .word 0xffff1bfd + .word 0x0d9169f5 + .word 0xffff52dc + .word 0xb2e98d9c + .word 0x00012fb6 + .word 0xf9092dbc + .word 0xfffe9939 + .word 0xaaaead4f + .word 0x0001b32f + .word 0x126ffa47 + .word 0x0002a7a6 + .word 0x4ff93387 + .word 0x00005e92 + .word 0x4825f795 + .word 0xffffbc89 + .word 0xd6d55b72 + .word 0x0002be61 + .word 0x5a6979f3 + .word 0x0001b013 + .word 0x8af92ae6 + .word 0x0002ec78 + .word 0x1b8adf70 + .word 0x000194fe + .word 0xf07af8ac + .word 0xffff8d94 + .word 0x6d557320 + .word 0xffff3390 + .word 0xae66269c + .word 0x0000b815 + .word 0x380c5e38 + .word 0x0002c110 + .word 0x46818eb9 + .word 0xffffbe78 + .word 0xfa7c8d6c + .word 0xffff53ed + .word 0xe0faf215 + .word 0x000357e2 + .word 0xbe537b4f + .word 0xfffdfa95 + .word 0x1bdce399 + .word 0x0000ed03 + .word 0xdf986b97 + .word 0xfffc6363 + .word 0x7d9f6543 + .word 0x0000e768 + .word 0x5f92c5d9 + .word 0x000087db + .word 0xca447445 + .word 0x0003df63 + .word 0x575b6b41 + .word 0x00021432 + .word 0x619bf796 + .word 0x000211c9 + .word 0x7500ab25 + .word 0x00031936 + .word 0xbf8428cf + .word 0x0000426c + .word 0xcbf1782b + .word 0xffff0d74 + .word 0xaa4a17b5 + .word 0xfffefcbd + .word 0x4ad3e201 + .word 0x0003fe07 + .word 0x2b910c8d + .word 0xfffc57aa + .word 0xb57d3f87 + .word 0xfffde8da + .word 0xa91e7b0a + .word 0xffff3b56 + .word 0xb9a2e682 + .word 0xffff4725 + .word 0xe4f9595d + .word 0x000044da + .word 0x2cee3cc7 + .word 0x0002b687 + .word 0x57f241fb + .word 0xfffe4342 + .word 0x14aa670a + .word 0x000081d6 + .word 0x4adc73b2 + .word 0xffffed20 + .word 0x5c332d9c + .word 0xfffd44f5 + .word 0x4ddbf21f + .word 0x0003895a + .word 0x564a7102 + .word 0x0002f867 + .word 0xda523aa4 + .word 0x00007656 + .word 0x12aedfdf + .word 0xfffe5769 + .word 0xa0b14c76 + .word 0xfffe5014 + .word 0x74a56eb8 + .word 0x00021d2f + .word 0x762a0e46 + .word 0x0000c09a + .word 0xf0ad7e7a + .word 0xffff984c + .word 0x97729505 + .word 0x0000ef20 + .word 0xdde9939b + .word 0x0003c425 + .word 0xda60c0d2 + .word 0x00007b96 + .word 0xe897a7c1 + .word 0xfffd2e74 + .word 0x1c5c2d7c + .word 0xfffd8038 + .word 0x2c29b1d2 + .word 0xfffd6dd7 + .word 0x14317a53 + .word 0x0002b61c + .word 0x48ef0d59 + .word 0xfffc0e79 + .word 0xb6712e10 + .word 0xfffe9ee3 + .word 0xb4d11825 + .word 0x00012d3f + .word 0x6a921ec0 + .word 0x0002bc1c + .word 0xd4856312 + .word 0x0003460f + .word 0x5058c352 + .word 0xfffff263 + .word 0x98a9e300 + .word 0xfffe5f48 + .word 0xff5ef09f + .word 0x000232ef + .word 0x5d92d561 + .word 0x00032ef1 + .word 0x6b0546ce + .word 0x00008bd5 + .word 0xa383e062 + .word 0xfffee928 + .word 0xe8a1f9b4 + .word 0xfffca253 + .word 0x0f78c140 + .word 0xffff7a53 + .word 0x6a75edf5 + .word 0xfffccd4c + .word 0x87f6626e + .word 0xffffa687 + .word 0x0c6b904d + .word 0x0001ce9f + .word 0x6f7b8974 + .word 0x00037464 + .word 0x014c2508 + .word 0x0002bdeb + .word 0x82c3406c + .word 0xfffed25e + .word 0xced294d1 + .word 0xffff9223 + .word 0x4568bd07 + .word 0x000393c2 + .word 0xfcac3a9b + .word 0xfffd4f28 + .word 0xf8df1caa + .word 0xfffeed82 + .word 0x8743a05d + .word 0xfffddc37 + .word 0xf889f026 + .word 0xfffe6cf8 + .word 0x9354a3a9 + .word 0x0001e295 + .word 0x4339ce2e + .word 0xffffdd9e + .word 0xfaa7f079 + .word 0xfffd1a38 + .word 0x49161a26 + .word 0x0001a55f + .word 0xc5e0be54 + .word 0xfffe900c + .word 0x56a59480 + .word 0xfffc6dd8 + .word 0xdecaf871 + .word 0x00018300 + .word 0x972f168d + .word 0x0002d557 + .word 0xa3ef13c0 + .word 0xfffde1e3 + .word 0x2d7e7cf8 + .word 0x0002e9cd + .word 0x7582e742 + .word 0x0003ab7e + .word 0x4826c109 + .word 0x00021f22 + .word 0x11aff0b8 + .word 0x0001d912 + .word 0x32a216ad + .word 0x00009e88 + .word 0xcfdbd88f + .word 0xfffe08a1 + .word 0x1e53d965 + .word 0xfffff893 + .word 0xac6dee49 + .word 0xfffff54c + .word 0xd82ed0ca + .word 0x00028287 + .word 0xa1fc4d13 + .word 0x0000149d + .word 0xd84316a1 + .word 0x000097d1 + .word 0x1ba11f62 + .word 0xfffc2644 + .word 0x8f0c0ad3 + .word 0x00028b2e + .word 0xb264cece + .word 0xfffd4ae1 + .word 0x80d12d8f + .word 0x0002c015 + .word 0x863249fd + .word 0xfffff831 + .word 0x6b79c6fb + .word 0xfffec512 + .word 0x82b4a47b + .word 0xfffe96e9 + .word 0x30f3fd1a + .word 0x00030809 + .word 0x1f7df5d6 + .word 0xfffcb968 + .word 0x933164be + .word 0xfffdc8db + .word 0xd71460bb + .word 0x000014de + .word 0x1357d29d + .word 0xfffec2b3 + .word 0xa15d0bd1 + .word 0xfffffa82 + .word 0xd86a328d + .word 0xfffc3c54 + .word 0xbf3bd730 + .word 0xfffcddbb + .word 0x878a41a9 + .word 0xfffdff4c + .word 0x41981bec + .word 0x000162e5 + .word 0x90819199 + .word 0x00008607 + .word 0xbc564d4f + .word 0xffff6fec + .word 0x8333b2b8 + .word 0x0002d422 + .word 0x1ef581f8 + .word 0xfffe575f + .word 0x4231d81b + .word 0xfffef4f3 + .word 0x5e72c173 + .word 0xfffd6271 + .word 0xea5caf77 + .word 0xfffc55bf + .word 0xb0721735 + .word 0xffff2f8c + .word 0x1e240637 + .word 0x000205e5 + .word 0x0e777723 + .word 0xffff2a42 + .word 0x2b810d98 + .word 0xfffe4f44 + .word 0x4549504e + .word 0xfffd210c + .word 0xb1837a3f + .word 0x00010def + .word 0x908cae6a + .word 0xfffff83b + .word 0xa75eabee + .word 0x00016474 + .word 0x641dcb54 + .word 0x00034ab5 + .word 0x45c2e711 + .word 0x00031207 + .word 0x62fc383c + .word 0x000170c1 + .word 0x0c7b2fff + .word 0x00026648 + .word 0x886afecc + .word 0x000396e3 + .word 0x5a91bf22 + .word 0xfffda7b3 + .word 0x40ae31fe + .word 0xfffee893 + .word 0xf7912105 + .word 0x0003c663 + .word 0x2e2cfdd5 + .word 0xfffe0c63 + .word 0x65b3e30e + .word 0xfffe665b + .word 0x355b80d9 + .word 0x00025e80 + .word 0x868dabd6 + .word 0x0001069d + .word 0x9db086f6 + .word 0xffff8a85 + .word 0xbf662c69 + .word 0x0000083c + .word 0x07b08a26 + .word 0x00020d8a + .word 0xc22907b1 + .word 0x000077d3 + .word 0xbd8c10dd + .word 0x00020b5f + .word 0xae5b7cde + .word 0x00021541 + .word 0xc3ea424b + .word 0x00014908 + .word 0x0562c7cd + .word 0xfffc890c + .word 0x23f9b95f + .word 0xfffcdd0f + .word 0xca50bfe7 + .word 0xfffe0d93 + .word 0xa2356050 + .word 0x0003ea7c + .word 0xf7f66fa3 + .word 0x0002ffad + .word 0x10084631 + .word 0x00010a8d + .word 0x99ac6d69 + .word 0xfffdc0c5 + .word 0x8aa336d6 + .word 0xfffcb08a + .word 0x2590092a + .word 0xfffc5665 + .word 0x7c224496 + .word 0xfffe5aa0 + .word 0xdf4c6f6d + .word 0xfffcf9bb + .word 0xff8ebcc4 + .word 0xfffd97ae + .word 0xd6cad94b + .word 0x0002946b + .word 0x020e2061 + .word 0x0002d7e3 + .word 0x723133bf + .word 0x0002da4c + .word 0xa15d7811 + .word 0xfffeddcd + .word 0x083345ce + .word 0xffff0296 + .word 0x7c1ed6d5 + .word 0xfffe9f15 + .word 0x6bff3fb3 + .word 0xffff481e + .word 0x29809165 + .word 0xfffe7117 + .word 0xe5b49384 + .word 0x00034207 + .word 0x2d0e344b + .word 0x00001505 + .word 0xd378b449 + .word 0xfffe1159 + .word 0x09926a9e + .word 0x0003c257 + .word 0x256d5cd5 + .word 0x00031ef0 + .word 0xbd29c0c9 + .word 0x000067b8 + .word 0x2c612d7d + .word 0x00025e9b + .word 0xca81fb8f + .word 0x00034224 + .word 0x747a9071 + .word 0x000025ac + .word 0xdc8e275b + .word 0xfffdd4d8 + .word 0xa81c4e26 + .word 0xffff0fe3 + .word 0x2be03105 + .word 0xfffde6b0 + .word 0x748f46eb + .word 0x0000e17b + .word 0x9f57cdb0 + .word 0xfffdea5a + .word 0xc59f0584 + .word 0xffffa5f9 + .word 0xcfec8833 + .word 0x00022f09 + .word 0x9786ff9c + .word 0x00007b50 + .word 0x84abee55 + .word 0x0000a5d2 + .word 0xf23c5793 + .word 0xfffca905 + .word 0x6fad8f97 + .word 0xfffef698 + .word 0x16bd3aa0 + .word 0x0002dc19 + .word 0xd015d299 + .word 0x000232c1 + .word 0x27371608 + .word 0xfffea5ab + .word 0x8269094e + .word 0x0001600b + .word 0x2eb74f73 + .word 0xfffccd2c + .word 0x45546166 + .word 0xfffd2e56 + .word 0xba085c54 + .word 0xfffd8ab2 + .word 0xd0f07b94 + .word 0xfffe2258 + .word 0x6c18f09a + .word 0xfffd55da + .word 0x286ccd95 + .word 0x0000c066 + .word 0xfa8d780e + .word 0x000030a0 + .word 0x80b3c151 + .word 0x0003835b + .word 0x168ff79c + .word 0x0001f60d + .word 0x3ef12f88 + .word 0x00000e8c + .word 0x5759a5b5 + .word 0xfffc7e8a + .word 0x3d5d1eeb + .word 0xffff6ce9 + .word 0x3b713ebc + .word 0xffffa9f6 + .word 0x07c14033 + .word 0xfffd96b6 + .word 0xfe63baf5 + .word 0x00014d5a + .word 0xf03a9843 + .word 0xfffc945c + .word 0x026ccb19 + .word 0x00015707 + .word 0xeb917446 + .word 0xfffd3c86 + .word 0x38df7e9b + .word 0x0001ba90 + .word 0x8fd7d3bf + .word 0xffffa54b + .word 0x133c3482 + .word 0x0000bbac + .word 0x521c7dcd + .word 0xfffed0ec + .word 0xa731632e + .word 0xfffdbaf0 + .word 0xe42f99da + .word 0x00033a8d + .word 0x33920ba9 + .word 0x000388de + .word 0x54342ca4 + .word 0x000158d5 + .word 0x0e10e540 + .word 0x00026426 + .word 0xe56fbddc + .word 0xffff56b7 + .word 0xc813ef36 + .word 0xfffc13cf + .word 0xce3f9b43 + .word 0xfffda3b5 + .word 0x09aa8d79 + .word 0x00007236 + .word 0xdae6f6db + .word 0x00001903 + .word 0xb55e05ee + .word 0xfffc16e5 + .word 0x815e16a1 + .word 0xfffda192 + .word 0x84c97d98 + .word 0x00026643 + .word 0xc7ed5a98 + .word 0x0003236f + .word 0x1af35c14 + .word 0xfffed07d + .word 0x9770e86a + .word 0x0000ac9c + .word 0x16817cd1 + .word 0x00025d6c + .word 0x96977708 + .word 0x0002cf49 + .word 0x1da3fc5a + .word 0xfffc0ba2 + .word 0xe69e2424 + .word 0xffff3d48 + .word 0xe2033e23 + .word 0xfffd833f + .word 0x35d249f0 + .word 0x000134c1 + .word 0xfbfb485d + .word 0x0002da2b + .word 0x7ce858f3 + .word 0x00014c68 + .word 0x30d2c2be + .word 0xfffede53 + .word 0x8c554e82 + .word 0xffff0fc9 + .word 0x75da2070 + .word 0xffffc6f4 + .word 0x670c1d82 + .word 0xfffc1030 + .word 0xc337aa54 + .word 0x0000e907 + .word 0xfb62b0c7 + .word 0x0003d1db + .word 0x306ceadb + .word 0xfffe3f00 + .word 0x3f2d1947 + .word 0xfffd6b38 + .word 0x76b2c1fa + .word 0xfffe42b0 + .word 0x79097591 + .word 0xfffc5bf5 + .word 0xcb9ed9a2 + .word 0x00038703 + .word 0x0da0d953 + .word 0xfffc3b2d + .word 0xce4e1d4a + .word 0x00023060 + .word 0xb7a76e8b + .word 0xfffdb52c + .word 0x134a2556 + .word 0x0002457d + .word 0x82ac33ef + .word 0x00021a82 + .word 0x3fbf792e + .word 0x0002ba41 + .word 0x9f25236f + .word 0x0001174c + .word 0xfdc24a7b + .word 0x0002ba27 + .word 0x8fc77ed9 + .word 0xfffd5bc3 + .word 0xa42aa846 + .word 0x00000499 + .word 0x74e41e3f + .word 0xfffd0914 + .word 0x7da97ccd + .word 0xffff3370 + .word 0xde3613fd + .word 0xfffc534e + .word 0x0a3c2dae + .word 0x00001472 + .word 0xcb9bcda2 + .word 0x00039633 + .word 0x47a77616 + .word 0x000148bf + .word 0xcb509a70 + .word 0xfffdafa2 + .word 0xbb9af6be + .word 0xfffc698f + .word 0xc622e4eb + .word 0xfffc748e + .word 0x1f0a9dbf + .word 0x0003c8c9 + .word 0xbbc50791 + .word 0xfffd6de6 + .word 0x06621f44 + .word 0x0003267d + .word 0xbb90c947 + .word 0xffff6f84 + .word 0xa9e9e621 + .word 0x0001ebb7 + .word 0xc6ef107b + .word 0x0001c841 + .word 0xc9761207 + .word 0xffff1ffd + .word 0x0a397a3d + .word 0x0002f2bd + .word 0x128c5d8a + .word 0xfffe3790 + .word 0x2e1e0753 + .word 0xfffcfae5 + .word 0x528962bd + .word 0x00026003 + .word 0x9cc074c0 + .word 0xfffe1061 + .word 0x545c1e8c + .word 0x00009158 + .word 0x64aa79af + .word 0xfffffb51 + .word 0x4d1bc56d + .word 0xfffd592b + .word 0x7555deb2 + .word 0xfffee5ab + .word 0x750ee7f8 + .word 0x00032314 + .word 0xe7abdc38 + .word 0x00006906 + .word 0x46f80cb2 + .word 0xfffc0bc4 + .word 0xc9c774a4 + .word 0xfffd1b1e + .word 0x6b64b81c + .word 0x0001e745 + .word 0xcd7ab2ac + .word 0x00027628 + .word 0x8730d713 + .word 0xfffc12d8 + .word 0xdf75f811 + .word 0x000286f7 + .word 0xd00ec24e + .word 0xfffc0d79 + .word 0x5d987ed1 + .word 0xfffc9b77 + .word 0xd7685edf + .word 0xfffdf1bf + .word 0xd0e6a98e + .word 0x0002bc04 + .word 0x4f5a18c8 + .word 0xfffd8151 + .word 0x71c772e6 + .word 0x000283c4 + .word 0x7461c80b + .word 0x00022713 + .word 0x96862b47 + .word 0xfffd3062 + .word 0x0321ceeb + .word 0x0001aa36 + .word 0xb7d11b2a + .word 0xffff3e73 + .word 0x520d85d9 + .word 0x00033078 + .word 0x6bca114d + .word 0x00000892 + .word 0xc4ab8094 + .word 0xfffda0f4 + .word 0x7d2dedc1 + .word 0x000300e7 + .word 0x3ee2ae9d + .word 0xfffc2703 + .word 0xfc2fe016 + .word 0x0000b7b6 + .word 0x5da25d65 + .word 0xfffd04cd + .word 0xcb72aa98 + .word 0xfffe102e + .word 0xcca10d37 + .word 0x0002ce75 + .word 0xf099691f + .word 0x000117ba + .word 0x254fe10c + .word 0xfffe5f20 + .word 0x2cb03ebb + .word 0xffff4017 + .word 0x84416197 + .word 0x00039939 + .word 0xa612c2ca + .word 0xfffcb7ef + .word 0xcc275c23 + .word 0xfffc83e0 + .word 0x689383a5 + .word 0x0003b999 + .word 0x396c0948 + .word 0xfffe3d75 + .word 0xd11217c1 + .word 0xfffc1456 + .word 0xaafb392c + .word 0xfffdf5ca + .word 0xc6ca382a + .word 0x00010c85 + .word 0x537b2c2e + .word 0xfffd363a + .word 0x16d76ad9 + .word 0x0003de55 + .word 0x4b05b52a + .word 0xfffeb752 + .word 0xe8d37b72 + .word 0x000358a3 + .word 0xc41b681e + .word 0x00025076 + .word 0x4f6f6e3f + .word 0x00008771 + .word 0x1dd3f340 + .word 0xffff6ce6 + .word 0x080ae0a6 + .word 0x0000de33 + .word 0x5c65efd4 + .word 0xfffd8b00 + .word 0x8c66f47b + .word 0xffff054f + .word 0x0017a093 + .word 0xfffe42dd + .word 0x9bdb3601 + .word 0x000032f6 + .word 0x7ce08d01 + .word 0x00017806 + .word 0x9f484f0c + .word 0x0000ff34 + .word 0x4bf6ec1a + .word 0x00012373 + .word 0xac2cb45b + .word 0x000371db + .word 0x4e91c08c + .word 0x000134e5 + .word 0x17b6fdbe + .word 0xfffd418f + .word 0x3c56c0e5 + .word 0xffffd4d6 + .word 0x03cffe30 + .word 0x0000e291 + .word 0x75746a53 + .word 0xfffc3465 + .word 0xe0348bf6 + .word 0x00006c14 + .word 0xbd0550b3 + .word 0xffff379f + .word 0xfdbffc3b + .word 0x00036685 + .word 0x2254a368 + .word 0x0002e0f9 + .word 0x82a008c5 + .word 0xfffd777d + .word 0xdea7f10d + .word 0x0000bb80 + .word 0x399c3b1a + .word 0x0003e1d5 + .word 0x6b5bd47d + .word 0xfffe62f7 + .word 0x4da43fb4 + .word 0x00036dc2 + .word 0x18ad9116 + .word 0x00013492 + .word 0x3c0e34b1 + .word 0xfffdc9ec + .word 0xf3a5885a + .word 0x0000d821 + .word 0x21b30955 + .word 0x0003ae23 + .word 0x5ece8383 + .word 0xfffecc86 + .word 0x8aa47390 + .word 0xfffc048a + .word 0x3bf9b053 + .word 0x0003f1ba + .word 0x19d1bc95 + .word 0xfffe829e + .word 0x4f8a8afc + .word 0xfffe443e + .word 0xdc869d9b + .word 0xfffea455 + .word 0x5a2562d3 + .word 0x000021cc + .word 0xb193bee9 + .word 0x00030cab + .word 0x5718eab0 + .word 0xffffccd6 + .word 0x221e348e + .word 0x000281cd + .word 0x5ee3ecc2 + .word 0x0002f201 + .word 0xbbeed9c0 + .word 0x0000262f + .word 0xd7c72a39 + .word 0x00023b5a + .word 0x937995bb + .word 0x0003f326 + .word 0x4408b969 + .word 0x0002de27 + .word 0xbc0bba5d + .word 0xfffe6c7a + .word 0xe48572a4 + .word 0x00010d72 + .word 0x96c4230b + .word 0x0001b848 + .word 0xb4b169a4 + .word 0xfffeac0c + .word 0x937d9ff6 + .word 0x0000480a + .word 0x21d1cc9a + .word 0x00016ddd + .word 0x7cece093 + .word 0x000290ba + .word 0x3f216ab1 + .word 0x0003e4f2 + .word 0x9c0f34a2 + .word 0xfffc392b + .word 0x48ac6080 + .word 0x00031a72 + .word 0xf22ef809 + .word 0xfffcbeb8 + .word 0xcb293764 + .word 0x00022c62 + .word 0x73a1f37c + .word 0x00013815 + .word 0x2a20a31a + .word 0x00029a64 + .word 0x3892fc14 + .word 0x00016e29 + .word 0x49673551 + .word 0x000095f3 + .word 0x2023f497 + .word 0xfffc429b + .word 0x9e903de5 + .word 0x00020534 + .word 0xfd0181a1 + .word 0xfffdb20e + .word 0x9538aa96 + .word 0xfffe905f + .word 0x6b8d9a78 + .word 0xfffff8cc + .word 0x0b0419cc + .word 0xfffc74da + .word 0x96d04f0d + .word 0xffff6e60 + .word 0x99fe1acf + .word 0xfffd7fec + .word 0x6c7a1df2 + .word 0x00016aa1 + .word 0xede1671d + .word 0x000137d9 + .word 0xc86d3f83 + .word 0xffffdf0b + .word 0x54240d37 + .word 0x00035556 + .word 0xe32674e0 + .word 0x00037a8b + .word 0xbf35ebd1 + .word 0xffff11d8 + .word 0xbba07e3e + .word 0x000098cf + .word 0x92a6cd6e + .word 0x0002b3ec + .word 0x4a139b27 + .word 0x0002d1ec + .word 0x50a7b801 + .word 0x00030004 + .word 0xda1cce3f + .word 0xfffc8a06 + .word 0x925042d8 + .word 0xfffdab8f + .word 0x2b44012e + .word 0xfffcf3b0 + .word 0xf1530dca + .word 0xfffe0008 + .word 0x14817099 + .word 0x00006b21 + .word 0xc35a01f7 + .word 0x0001894e + .word 0x88c17aab + .word 0xfffc209a + .word 0x50bbbb5c + .word 0x00032a17 + .word 0x381fccde + .word 0xfffd3798 + .word 0x85f3b999 + .word 0xfffdcff2 + .word 0x131e316e + .word 0xfffdb1ac + .word 0xb9de22e0 + .word 0xfffec204 + .word 0x0123d4ac + .word 0x0000f8ee + .word 0x5adb823c + .word 0x0003085c + .word 0x91b1959e + .word 0xfffeaf89 + .word 0xe8f2c476 + .word 0x00028f93 + .word 0xd4b5cb85 + .word 0xfffc3ea0 + .word 0xf9c09ad9 + .word 0x00019a34 + .word 0x5ac2fd71 + .word 0xfffc4db3 + .word 0x690cf780 + .word 0xffffe23f + .word 0x5540bad8 + .word 0x000308f5 + .word 0xd838becb + .word 0xffff5b41 + .word 0xcdf78692 + .word 0xfffcc6c7 + .word 0x88b348c0 + .word 0x00018662 + .word 0x88a02d02 + .word 0xfffd0438 + .word 0xab173321 + .word 0x00034fd7 + .word 0xf6862a35 + .word 0x00001646 + .word 0xddc6e0f1 + .word 0xfffe2d37 + .word 0x53b1e3d4 + .word 0x0002a0d3 + .word 0x56efe41a + .word 0xffffb144 + .word 0x9b70ce00 + .word 0x0000a980 + .word 0x4bd47700 + .word 0x0003fda3 + .word 0xa017d288 + .word 0xfffd5455 + .word 0x3e9fad86 + .word 0x0002e06a + .word 0xa0d461b2 + .word 0x00031fc9 + .word 0xed4b8a30 + .word 0xfffc0404 + .word 0x9b13d099 + .word 0xfffe4360 + .word 0x81d09128 + .word 0xfffeb8a0 + .word 0x598bb30a + .word 0xffff344e + .word 0x4ae2b7d7 + .word 0xfffe6003 + .word 0x0d9235a4 + .word 0xffff7280 + .word 0xe64b0059 + .word 0x000000d4 + .word 0x71c75735 + .word 0xfffd66d7 + .word 0x74ab2f82 + .word 0x0001e965 + .word 0x52097bfc + .word 0xffff11fb + .word 0xf9717fa7 + .word 0xfffeda8f + .word 0x1504bd74 + .word 0xfffe0d47 + .word 0x8b6ff0ae + .word 0xfffc2baa + .word 0xd2bcd143 + .word 0x00012e7e + .word 0x708e6b12 + .word 0xfffda3bc + .word 0x960db06b + .word 0x0001e5b7 + .word 0x325adf34 + .word 0xffff65f2 + .word 0x6dfbe86d + .word 0x0001e045 + .word 0x8ee69bdc + .word 0x00037e54 + .word 0xbe86daea + .word 0xfffd2c9d + .word 0x1d47cc8e + .word 0x00030b87 + .word 0x79857f5c + .word 0xffff5c46 + .word 0x898d481c + .word 0x0002268d + .word 0xaffef2f0 + .word 0x00027751 + .word 0xf4231de6 + .word 0xfffe2ff7 + .word 0x7456ea3a + .word 0xffffde13 + .word 0x865b0503 + .word 0x0002015a + .word 0x0d3754ef + .word 0xfffeb1ab + .word 0xf82377bb + .word 0x0000ae1d + .word 0xac7fdd8c + .word 0x000156a7 + .word 0x6a3cced5 + .word 0xfffc7600 + .word 0x29f13299 + .word 0x000196a0 + .word 0xd2ea263e + .word 0xfffee413 + .word 0x86a9cc1d + .word 0xfffd6bb7 + .word 0x48d49c09 + .word 0x000064b4 + .word 0x0ca20d59 + .word 0x0002f8ab + .word 0x5b95d1fd + .word 0xffff4162 + .word 0xf845337f + .word 0xfffe9b32 + .word 0xef3d0359 + .word 0xfffdc325 + .word 0x2b3164a4 + .word 0x000134b2 + .word 0xf22f6e6f + .word 0x0000436c + .word 0xeec7b7ee + .word 0x0000736b + .word 0x3ce6c30f + .word 0xfffd8e22 + .word 0xe3093a74 + .word 0x0002bd4f + .word 0xdda40cb4 + .word 0x00037a9b + .word 0xcd7d7cd6 + .word 0xfffecbc1 + .word 0xf66c11e7 + .word 0x0000d8dc + .word 0xb8d52763 + .word 0x0003bb96 + .word 0xe3721c19 + .word 0xfffc8c8e + .word 0xba5e5c3b + .word 0x0002a37a + .word 0x75c560ee + .word 0xfffc0e67 + .word 0x341dcbdd + .word 0xffffbcda + .word 0x582176b7 + .word 0x000082ae + .word 0xbb6a1191 + .word 0xfffc207c + .word 0x8061ca0f + .word 0xffffff78 + .word 0xbb783918 + .word 0x00011fb8 + .word 0x3b6d3db1 + .word 0x00014301 + .word 0x2450b167 + .word 0xffff462f + .word 0xb9be3194 + .word 0x0002387a + .word 0x2d03c78d + .word 0xfffd05d6 + .word 0x7ae89d29 + .word 0xfffef295 + .word 0x82b0d6b1 + .word 0xffffd0b4 + .word 0xb0671390 + .word 0x000303e5 + .word 0x98bbae18 + .word 0x000193a7 + .word 0xaca80c68 + .word 0xfffdc1f8 + .word 0xec5fbccb + .word 0xffff84da + .word 0xe230ab10 + .word 0xfffef913 + .word 0x70138517 + .word 0x0001dca1 + .word 0x31dad6f7 + .word 0x00013c83 + .word 0x37cd7e0f + .word 0x00011628 + .word 0x8504509f + .word 0x0002f356 + .word 0x7c9ef0cd + .word 0x000245ec + .word 0xbfbdf2bb + .word 0xfffd17ec + .word 0x5a53fcaa + .word 0x000002c9 + .word 0x9ee94b1a + .word 0xfffd3455 + .word 0x67682522 + .word 0xffffa444 + .word 0x574a072c + .word 0xfffd84dc + .word 0x06c75dd4 + .word 0x0000bf0e + .word 0xb8669fb0 + .word 0x000313d7 + .word 0xe6e53a84 + .word 0x0003795c + .word 0x2ed34ff2 + .word 0xffff80aa + .word 0x803820f0 + .word 0x00029255 + .word 0xf973cdb7 + .word 0x00018d2f + .word 0x16f880db + .word 0x00016394 + .word 0x1a34608f + .word 0xfffec01c + .word 0xe9c2389a + .word 0xfffed2f7 + .word 0x9207f92c + .word 0xfffd0091 + .word 0xe19d15a0 + .word 0x00002010 + .word 0x3e4bd970 + .word 0x00003c87 + .word 0x1b0a4286 + .word 0xfffd8ada + .word 0xedf94708 + .word 0xfffcabae + .word 0x000e9fdd + .word 0xfffec09c + .word 0xd7e293e3 + .word 0xffffdf34 + .word 0x67585f34 + .word 0x00015cdb + .word 0xbb140232 + .word 0xfffdef75 + .word 0x3bcdf951 + .word 0xfffd407a + .word 0x9f4014d0 + .word 0xfffda687 + .word 0xf446e62b + .word 0xfffcfbdc + .word 0x0bceaba3 + .word 0x0001aeb8 .global v32a .balign NR_LANES*4 v32a: - .word 0xfffe3cc9 - .word 0x000a87a8 - .word 0xfff6acfb - .word 0x000a5703 - .word 0x00032bb3 - .word 0xfffcfd8f - .word 0xfffa56b7 - .word 0x000212a6 - .word 0x00096cf9 - .word 0x000534f9 - .word 0xffffb6ba - .word 0x0002d346 - .word 0xfff2298d - .word 0x000a6cab - .word 0xfff3a462 - .word 0xfffd1a53 - .word 0xfff0c9d1 - .word 0x000b40ff - .word 0x0001cd2d - .word 0xfff885b9 - .word 0x00078792 - .word 0x00093f88 - .word 0xfff4740c - .word 0xffffca91 - .word 0x000bc05c - .word 0xfff45265 - .word 0xfffd8b3d - .word 0xfff1489e - .word 0x000adae8 - .word 0xfff05ad5 - .word 0xfff32245 - .word 0xfff68218 - .word 0x000efd1d - .word 0xfff09d42 - .word 0xfffc85c0 - .word 0x0009bd2f - .word 0x0002a336 - .word 0x000e903c - .word 0x000a14d6 - .word 0xfff79699 - .word 0xfffa2035 - .word 0x000c6908 - .word 0xfff0fcdd - .word 0x000895b2 - .word 0xfff36507 - .word 0x000c15b9 - .word 0x000d8c1a - .word 0x00023f01 - .word 0xfff512bb - .word 0xfffaface - .word 0xfffbe102 - .word 0xfffc1715 + .word 0xfffbacaa + .word 0xfff6779a + .word 0x0004d705 + .word 0x0004cfc6 + .word 0x00074998 + .word 0xfff2c228 + .word 0x000da72b + .word 0x0005d110 + .word 0x000aaeea + .word 0x0000d829 + .word 0xfff7459d + .word 0x0009978d + .word 0x000cae33 + .word 0x0001205b + .word 0xfff75298 + .word 0x0007fcc1 + .word 0x0009d204 + .word 0xfff3675d + .word 0x000d95a6 + .word 0xfffbe594 + .word 0xfff36619 + .word 0xfffce3e3 + .word 0xfff0c901 + .word 0x00000138 + .word 0xfffa3f94 + .word 0x000a4a7d + .word 0x0009c24c + .word 0x00041c0c + .word 0x000db619 + .word 0xfff1bae9 + .word 0xfff1a5d7 + .word 0xfff05a5c + .word 0xfff2436b + .word 0x000d4060 + .word 0xfff6f185 + .word 0xfffc2c27 + .word 0x0003d14b + .word 0xfffe2da1 + .word 0x00033f39 + .word 0x000b1ba7 + .word 0x000f391f + .word 0x0008760f + .word 0xfff72060 + .word 0xfffb1e1a + .word 0x000903c7 + .word 0xfff8dffe + .word 0xfff2150c + .word 0x000d1958 + .word 0xfffa8bcd + .word 0x00050be8 + .word 0xfff527a0 + .word 0xfff546ae + .word 0x000beec1 + .word 0x000aaedc + .word 0xfff07d15 + .word 0x0000ea91 + .word 0xfff8a644 + .word 0x000153a5 + .word 0xffff351f + .word 0x00059874 + .word 0x00047f61 + .word 0xfff8d78c + .word 0xfff6c1fd + .word 0x0004a2e0 + .word 0x000f604e + .word 0x000512b2 + .word 0xfffb5764 + .word 0x000ca382 + .word 0x0001fe77 + .word 0x0008243a + .word 0xfffbb81d + .word 0x0006d6e8 + .word 0xfffc3f0d + .word 0xfff2a154 + .word 0xfff3a7e8 + .word 0x000a04eb + .word 0x00026ee0 + .word 0x00067ee1 + .word 0xffff9ef8 + .word 0xfff4bf9e + .word 0x00082459 + .word 0x000d28ac + .word 0xfff955b1 + .word 0x00059f6c + .word 0x000fb2a5 + .word 0x000ed4f3 + .word 0x000aa4da + .word 0x0003bd00 + .word 0xfff7eb7b + .word 0xfff33437 + .word 0x0001c0f2 + .word 0x000f16cc + .word 0x0006c348 + .word 0x000df6f4 + .word 0xfff2e4e0 + .word 0xfff53fca + .word 0x0004a572 + .word 0xfff0867e + .word 0x0000f74c + .word 0xfffdfc0c + .word 0x000a3ddd + .word 0xfffc0dc5 + .word 0xfff3985e + .word 0x0009cf3b + .word 0xfff97b94 + .word 0x000c373a + .word 0x00055086 + .word 0xffffaba3 + .word 0x00054a9f + .word 0x000879d6 + .word 0x000d4a0f + .word 0xfffb1849 + .word 0xfffbd44f + .word 0xfffa0491 + .word 0xfff074aa + .word 0x000f38bf + .word 0xfff76237 + .word 0xfff0bd84 + .word 0x000b77ed + .word 0x000d70ce + .word 0x000c1fc5 + .word 0x00026722 + .word 0xfff8b705 + .word 0xfffb7093 + .word 0x00043802 + .word 0xfff2ce3f + .word 0x00075207 + .word 0x0007509a + .word 0x0000059f + .word 0xfff3de32 + .word 0x000cee4f + .word 0x000da63c + .word 0x00097846 + .word 0x000e77a7 + .word 0xfff9c8b6 + .word 0xfffb26c1 + .word 0x00063025 + .word 0xfffaddfd + .word 0xfffbafda + .word 0x00041776 + .word 0xfff4a314 + .word 0xfff0a5d6 + .word 0x0001846f + .word 0xfff5d852 + .word 0xfff89bfa + .word 0x0008c5f2 + .word 0xfffcfbf9 + .word 0x000924e5 + .word 0x000e5ec5 + .word 0x000f3bd1 + .word 0xfffa21dc + .word 0xfff8a169 + .word 0x0002ba6e + .word 0x00070225 + .word 0x00004ac3 + .word 0x000ad617 + .word 0x00029086 + .word 0x0008555d + .word 0xfff01dc8 + .word 0xfff1657c + .word 0xfff7046b + .word 0x000c95c2 + .word 0xfff2a0c2 + .word 0x0000a209 + .word 0xfff1e6b1 + .word 0x00079da7 + .word 0x000d66b9 + .word 0xfff4b230 + .word 0x000a706f + .word 0xfff9b57c + .word 0x00037e4c + .word 0x000677ab + .word 0xfff3a549 + .word 0x00090a3b + .word 0x000b9d40 + .word 0xfff6b781 + .word 0x00061a9d + .word 0x000d9bdc + .word 0x000f5993 + .word 0xfffbdb83 + .word 0x000c63be + .word 0x000d7fec + .word 0xfff84b1d + .word 0x000d33d8 + .word 0xffff085c + .word 0x0008a6af + .word 0xfff77e19 + .word 0xffff322e + .word 0xfff1b050 + .word 0x0003d48a + .word 0xffff1f64 + .word 0x000ff62f + .word 0xfff8d57a + .word 0xfffa2d0d + .word 0x00015372 + .word 0x00060412 + .word 0x000f9d38 + .word 0xffffac89 + .word 0x000846c9 + .word 0xfffdc586 + .word 0xfff110c1 + .word 0xfff15cb7 + .word 0xfff4d4cf + .word 0x00060399 + .word 0xfffea43f + .word 0x000321b2 + .word 0xfffa1a1e + .word 0x000d9e2b + .word 0x000690a9 + .word 0x000142de + .word 0x00004fd8 + .word 0xffff8f72 + .word 0x0001c0c8 + .word 0xfff744b7 + .word 0xfffefdec + .word 0x00070694 + .word 0xfffcb2c7 + .word 0x00011d83 + .word 0x000c79cb + .word 0x000af032 + .word 0xfff2361b + .word 0xfff50329 + .word 0x000881da + .word 0x0005b3ab + .word 0x0003a80f + .word 0x00053961 + .word 0x0004521c + .word 0x0000a1e2 + .word 0x0003bd76 + .word 0x0009efb0 + .word 0xfff04b15 + .word 0x00000482 + .word 0x000cd782 + .word 0x0007549e + .word 0x00013d50 + .word 0xfff18032 + .word 0x00026c5b + .word 0x0007c6f1 + .word 0x000c923a + .word 0x0001ed61 + .word 0x000a0cff + .word 0xfffc90a6 + .word 0x000ac749 + .word 0x0003e32f + .word 0xfffff579 + .word 0xfff3720d + .word 0x000c235c + .word 0x000a8b97 + .word 0xfffe165c + .word 0xfff017cd + .word 0xfff44712 + .word 0x0000be7f + .word 0xfffb0298 + .word 0x000964a2 + .word 0xfffac332 + .word 0x0005347c + .word 0x00038088 + .word 0xfff5315b + .word 0x000cd91a + .word 0x0009e991 + .word 0x0004c387 + .word 0xfff08591 + .word 0x000bcecc + .word 0xfffc9c6c + .word 0xfffceae9 + .word 0x0002b0a2 + .word 0xfff6d80e + .word 0x00031c0b + .word 0xfffd2237 + .word 0xfffad3ae + .word 0xfff5bfe4 + .word 0x000c5d9d + .word 0xfff0052a + .word 0xfffa4d2b + .word 0x0009e633 + .word 0x00074721 + .word 0xfff00389 + .word 0x000acba0 + .word 0xfffae5f0 + .word 0xfffec747 + .word 0xfff984c5 + .word 0x0004bf71 + .word 0x0006df8d + .word 0x0004227d + .word 0x000cfcb4 + .word 0xfff336f3 + .word 0xfff3ec1c + .word 0xfff5a41a + .word 0xffffbf73 + .word 0x000d6050 + .word 0x00029812 + .word 0x000840c6 + .word 0xfff33eaa + .word 0x000771d8 + .word 0x0003fdf4 + .word 0xfff95183 + .word 0xfff357a1 + .word 0x0009a1c7 + .word 0x000f0ef5 + .word 0x000aec1d + .word 0xfff96c33 + .word 0xfff520e6 + .word 0x00013a5c + .word 0x0003546f + .word 0x0009901a + .word 0x000379e9 + .word 0xfffa9480 + .word 0xfff2cf31 + .word 0x000dae34 + .word 0xfffbd199 + .word 0xfff7aaee + .word 0x000a8d9c + .word 0xfff9638c + .word 0xfffbe4db + .word 0x000da6da + .word 0xfff771fa + .word 0x00066192 + .word 0x000f0dae + .word 0x000338aa + .word 0x0007b917 + .word 0xfffcd0a6 + .word 0xfff251b1 + .word 0x000f23bc + .word 0xfff9157f + .word 0x000d9140 + .word 0xfffb890e + .word 0xffffe240 + .word 0xfff37af4 + .word 0xfffef028 + .word 0x000747c5 + .word 0xfff8ba59 + .word 0xfff8413e + .word 0xfffa2bf3 + .word 0x0008d8e6 + .word 0x00017205 + .word 0xfff16469 + .word 0x000c6c41 + .word 0x0005c421 + .word 0xffff7b2b + .word 0x0009a1d3 + .word 0x00052cf3 + .word 0x000db9ed + .word 0x0005f99b + .word 0x0004a3c6 + .word 0x00018a54 + .word 0xfffbecef + .word 0x000ab5a9 + .word 0x00055b69 + .word 0x0008944a + .word 0xfffb216f + .word 0x0004853e + .word 0xfff83e0e + .word 0x000ebc70 + .word 0x000194bd + .word 0x00097d9c + .word 0x000f5e9a + .word 0xfffba76c + .word 0x000692ea + .word 0x00034df8 + .word 0xfffeb1be + .word 0x000b31a9 + .word 0xfffa33fd + .word 0x000fdfdb + .word 0x000c446e + .word 0x0006023e + .word 0xfffe5c6c + .word 0xfff1706b + .word 0x00005536 + .word 0x000e095c + .word 0xfff97d16 + .word 0xfff1ba6b + .word 0xfffeda05 + .word 0xfffb04fa + .word 0x0001fee3 + .word 0xfffbe30b + .word 0xfff44734 + .word 0x0008448c + .word 0x000b1e70 + .word 0xfff085e0 + .word 0x000b27a0 + .word 0x000008bf + .word 0xfff37975 + .word 0xfff707fd + .word 0x000158cd + .word 0xfffb1469 + .word 0x000534e9 + .word 0xfff21779 + .word 0x000472a8 + .word 0xfffc6b42 + .word 0x00077e48 + .word 0xfff72f09 + .word 0x00006fd9 + .word 0xfffcbf39 + .word 0xfff52bff + .word 0xffff4b4a + .word 0xfffcd9b4 + .word 0xfff448fa + .word 0x000b09be + .word 0x000ee5a2 + .word 0xffffb1f3 + .word 0x0004526e + .word 0x000798dc + .word 0x00043b4b + .word 0x0005fd83 + .word 0x000816a1 + .word 0x000d527e + .word 0x0003043f + .word 0xfff6ba66 + .word 0x0004e875 + .word 0x000ec690 + .word 0x000e3f40 + .word 0x000c041c + .word 0x00040588 + .word 0x000de9dd + .word 0x000f6c6b + .word 0x000ce74c + .word 0x000b79e7 + .word 0xfff9bc1b + .word 0x0007464e + .word 0xfffe2b0e + .word 0xfffd3d03 + .word 0x000d27ef + .word 0x000e0211 + .word 0xfff828ac + .word 0x0006e18c + .word 0x0009444b + .word 0x000f8e4a + .word 0x00095dd5 + .word 0x000a7e3e + .word 0xfff4d135 + .word 0xfffcc9a8 + .word 0xfffa4f78 + .word 0x0006b85f + .word 0x0005c9de + .word 0x0005b1fe + .word 0x00057301 + .word 0x000f874c + .word 0x000704bb + .word 0xfff047a4 + .word 0x0007d2ce + .word 0x0007b409 + .word 0x000c4690 + .word 0xfff56555 + .word 0x000acf33 + .word 0x000d3a86 + .word 0xfffdcb19 + .word 0xfff1e690 + .word 0xfffbf8e3 + .word 0x0008535c + .word 0xfff6ec5c + .word 0xfff755d5 + .word 0x000e61e7 + .word 0x000dea2c + .word 0xfff356e4 + .word 0xfffc1da4 + .word 0xfff5e151 + .word 0x0008aaed + .word 0xfff59119 + .word 0x000d0e28 + .word 0xfff8ad8c + .word 0xfff6fed3 + .word 0x000c00e5 + .word 0x000e3b5e + .word 0x000b9553 + .word 0xfff31c10 + .word 0xfff7c06a + .word 0xfff55013 + .word 0xfff73adb + .word 0x000487a7 + .word 0xfff9404e + .word 0x00025e30 + .word 0xfffca6e4 + .word 0xfff0a923 + .word 0x00084803 + .word 0xfffdc2f4 + .word 0x0002e97d + .word 0xfff2302a + .word 0x0009f8f6 + .word 0xfff7d179 + .word 0x000d79a3 + .word 0x000555c1 + .word 0x000ddaf5 + .word 0xfff510f0 + .word 0xfff67d4e + .word 0x00092644 + .word 0xfff6306e + .word 0x00039ce6 + .word 0xfff82309 + .word 0x000b35d5 + .word 0xfff29922 + .word 0xfff89e5f + .word 0xfff3cfdf + .word 0xfff6db55 + .word 0xfff9cb46 + .word 0x00064b44 + .word 0x000992e3 + .word 0xfffdea27 + .word 0xffffc88e + .word 0xfffaecec + .word 0x00044395 + .word 0xfff383c6 + .word 0x00077c64 + .word 0x0006e592 + .word 0xfffd6066 + .word 0xffff8e98 + .word 0xfffa60ba + .word 0xfff78176 + .word 0xfffb1787 + .word 0x000fac55 + .word 0x00038ae8 + .word 0x00006f47 + .word 0x000a2618 + .word 0xfffd683a + .word 0xfffad899 + .word 0xffff21a7 + .word 0xfff7a4ea + .word 0x0009a3b5 + .word 0x0009906b + .word 0xfff160f6 + .word 0x0007b141 + .word 0x0002987a + .word 0xfffb7f88 + .word 0xfff6a50b + .word 0xfff34973 + .word 0x000f9170 + .word 0x00085f5f + .word 0xffff06f7 + .word 0xfff81749 + .word 0x00003877 + .word 0x00084c88 + .word 0x000ed1ab + .word 0xfffb91bb + .word 0xfff3c639 + .word 0x000b5841 + .word 0xfff2d6c3 + .word 0x0007c410 + .word 0xfffe978b + .word 0xfff16127 + .word 0x000b9db8 + .word 0x0000a027 + .word 0xfffa6f9b + .word 0x000dbc80 + .word 0xfff1d167 + .word 0x00086647 + .word 0x000a27e0 + .word 0x0002e0f4 + .word 0x000870bc + .word 0x000347dd + .word 0xfff8c20c + .word 0xfff70d9e + .word 0x0008c71f + .word 0xfffa91e5 + .word 0xfffea995 + .word 0xfff38a4d + .word 0x000f14d2 + .word 0xfff8fe91 + .word 0xfff5c787 + .word 0x000f010a + .word 0x000a861d + .word 0x0009dbed + .word 0xffff57d2 + .word 0xfffcc595 + .word 0x000e3b36 + .word 0x000aea8d + .word 0x00060a2f + .word 0x000fd157 + .word 0xfff92fe9 + .word 0xfff49099 + .word 0x0000a17b + .word 0xffff0761 + .word 0xfffacbfa + .word 0xfff47acd + .word 0x000d2c05 + .word 0x0004ede5 + .word 0x000c3b42 + .word 0xfff11d80 + .word 0x0006f41d + .word 0xfff77cc5 + .word 0x00082365 + .word 0xfff11c8b + .word 0xfff6eadb + .word 0xfff04424 + .word 0x000388cc + .word 0x000cf4d3 + .word 0x00016fed + .word 0xfff79c87 + .word 0xfff9fe1d + .word 0x000aaed7 + .word 0x000cd236 + .word 0x0006e624 + .word 0xfffa2def + .word 0x000b9137 + .word 0xfffb4b4f + .word 0x000f685b + .word 0x000a62a5 + .word 0x0007de7c + .word 0x00007b25 + .word 0x0002d317 + .word 0xfff19d59 + .word 0xfff51ef9 + .word 0xfffbd287 + .word 0xfffc4ff6 + .word 0xfff9a5be + .word 0xfff9adea + .word 0xffff3897 + .word 0xfff47ede + .word 0x000089f1 + .word 0x000babe3 + .word 0x00037dee + .word 0xfff16e78 + .word 0x00041201 + .word 0xffff6423 + .word 0x000135e9 + .word 0x000343b5 + .word 0xfff6a186 + .word 0xfff490f8 + .word 0x0001f4b0 + .word 0xfff4f34b + .word 0xfff7f0dd + .word 0xfff96824 + .word 0x00082c95 + .word 0x0006880b + .word 0xfff5d44e + .word 0xfff5e88a + .word 0x00064040 + .word 0x000d778f + .word 0xfff3bd85 + .word 0x00074861 + .word 0xfff70085 + .word 0xfff5cbd5 + .word 0xfffc71cf + .word 0x0002127d + .word 0xfff3998e + .word 0xffffe05a + .word 0x0005cb92 + .word 0x000dac29 + .word 0x00077869 + .word 0xfff3976f + .word 0x0004e8dc + .word 0xfff32bb9 + .word 0x000b5812 + .word 0x000dc4f7 + .word 0xfff7fc14 + .word 0xfff4f2c8 + .word 0xfffbceab + .word 0xfffb7745 + .word 0xfff4a233 + .word 0xfff4b05b + .word 0xffffef43 + .word 0xfff76f87 + .word 0x00098a0d + .word 0x000ccbb8 + .word 0x000e235f + .word 0x000be151 + .word 0x0003ef9c + .word 0x0000ee58 + .word 0xfffa85f8 + .word 0x00056529 + .word 0x00035828 + .word 0xfff46f40 + .word 0xfffb1a1d + .word 0x00074608 + .word 0xfffebabb + .word 0x000032af + .word 0x0000a45f + .word 0xfff1a5b0 + .word 0xfff00a23 + .word 0xfffd31a3 + .word 0xfff522a0 + .word 0x0002db93 + .word 0x000a8069 + .word 0x0006a732 + .word 0xfff62ba5 + .word 0xfff76f85 + .word 0x00058386 + .word 0x000f5d27 + .word 0xfff81a2b + .word 0xfff0235e + .word 0x000b3ba8 + .word 0x000ecbd7 + .word 0xfff83c97 + .word 0xfffb1866 + .word 0xfffeff86 + .word 0xfff01a34 + .word 0xfff68482 + .word 0xfff0b454 + .word 0x00085193 + .word 0xfff57a97 + .word 0x000dd3e6 + .word 0x00017537 + .word 0x000ebe9c + .word 0xfff58230 + .word 0x000ca37a + .word 0x00098ba3 + .word 0x000d72cb + .word 0xfffa44d2 + .word 0x000f2801 + .word 0xfffbbeee + .word 0xfff6c3f8 + .word 0xfffb1a9a + .word 0xfffc08d4 + .word 0xfff845b8 + .word 0xfffe278c + .word 0x000cdebf + .word 0xfffcaa17 + .word 0x000caf53 + .word 0xfff67f34 + .word 0x0004d5a8 + .word 0x00001741 + .word 0x0002ab56 + .word 0xfffaa72b + .word 0x000764a7 + .word 0x000b2cef + .word 0x0009c022 + .word 0x0009ad94 + .word 0xfffb709b + .word 0xfff3e622 + .word 0x0009bb83 + .word 0xfffb29ec + .word 0xfff86d5c + .word 0xfffab661 + .word 0x000c3b62 + .word 0x0002493e + .word 0x000ebabe + .word 0x000cd931 + .word 0x000c11f6 + .word 0xfffbe24c + .word 0xfff83a57 + .word 0xffffcd5d + .word 0x000a164c + .word 0x0006b950 + .word 0x00077803 + .word 0x000ba0f7 + .word 0xfff2f01a + .word 0xfff11af9 + .word 0x0004daf4 + .word 0x000af85b + .word 0xfff26d4a + .word 0x00065b86 + .word 0x00046f36 + .word 0x000a78b2 + .word 0xfff68f60 + .word 0x000d438c + .word 0x000db189 + .word 0x000db841 + .word 0xfff59b85 + .word 0xfffc6aeb + .word 0xfff61c41 + .word 0xfffafc0e + .word 0x0000d892 + .word 0x0007d8cd + .word 0x000fdde9 + .word 0x0001dc74 + .word 0x00056b11 + .word 0xfffb7825 + .word 0xfff686de .word 0xfffab151 - .word 0xfff99446 - .word 0xfff0c5d0 - .word 0x0005565e - .word 0xfff9d3af - .word 0x00071fb0 - .word 0x0000fe55 - .word 0xfffa7154 - .word 0x00047b54 - .word 0x000b831d - .word 0x00076687 - .word 0xfffbaaff - .word 0xfff68baa - .word 0xfff1d33a - .word 0xfff2543c - .word 0x000d181b - .word 0x0008ae23 - .word 0xfffc79da - .word 0xfff4c93f - .word 0xfff7da8a - .word 0x0004b4ff - .word 0x000f9df3 - .word 0xfff012dd - .word 0x0000883a - .word 0x0002e9f8 - .word 0x000b30b3 - .word 0x000eaa91 - .word 0x000c3208 - .word 0x000f1850 - .word 0x000c1da6 - .word 0x000be563 - .word 0xffffdc5e - .word 0xfffa951f - .word 0xfffde611 - .word 0xfff33d51 - .word 0x000374bb - .word 0x000dfd24 - .word 0x000590ba - .word 0xfff61a45 - .word 0x00059cb3 - .word 0x0007fd21 - .word 0xfffc1967 - .word 0xfffe1e60 - .word 0xfff27a8c - .word 0x0003bcd7 - .word 0xfff8306f - .word 0xfffe4a3d - .word 0x00030b06 - .word 0x000369be - .word 0x0008423b - .word 0xfff99d6e - .word 0xfff67c20 - .word 0xfffcc9c2 - .word 0x000ea414 - .word 0x000fc92c - .word 0xfffa23f8 - .word 0xfff475bc - .word 0xfffb8cb3 - .word 0xfff9f7f4 - .word 0xfff3f950 - .word 0xfffff42d - .word 0xfff63e6f - .word 0xffff0285 - .word 0x00016da3 - .word 0x000744ab - .word 0xfff09663 - .word 0xfffaaf05 - .word 0xfff6911d - .word 0x000c79be - .word 0xfffcd022 - .word 0x00010e34 - .word 0xfff05eaa - .word 0xfff5fe36 - .word 0x0001e81e - .word 0x000a4e34 - .word 0x000d2faa - .word 0x000696b5 - .word 0x000a10d7 - .word 0xfff35abe - .word 0x000d4930 - .word 0x000a21bf - .word 0xfff2b805 - .word 0x000f4e99 - .word 0xfff9416a - .word 0x00093504 - .word 0xfffd1f43 - .word 0x00076fb2 - .word 0x0006b7c9 - .word 0xfffd6105 - .word 0xfff2565a - .word 0xfffb6bd9 - .word 0xfff9c962 - .word 0xfff780b4 - .word 0x000c8cd7 - .word 0x00083b76 - .word 0xfff8065f - .word 0xfff7170f - .word 0x000a84c2 - .word 0x00045a27 - .word 0xfff21990 - .word 0x000e4660 - .word 0xfff8b606 - .word 0x00042e61 - .word 0xfffa502e - .word 0x0007b3df - .word 0x00082a30 - .word 0x000c1c5d - .word 0x000286bf - .word 0x000e69b8 - .word 0x0008598d - .word 0x00025e7d - .word 0x00075974 - .word 0xffff7a70 - .word 0x0002bdda - .word 0x00089109 - .word 0x000ef01b - .word 0xfffe7a8b - .word 0x000f6f95 - .word 0x000da7a5 - .word 0xfffb209b - .word 0xfffcb493 - .word 0xfffbf82b - .word 0xfff73581 - .word 0xffffd165 - .word 0x000d2d97 - .word 0xfff31b4a - .word 0xfff3deee - .word 0x000d5f4c - .word 0xfff26488 - .word 0xfffd0784 - .word 0xfff09f58 - .word 0x000a1b54 - .word 0x0003b0b3 - .word 0x00098041 - .word 0x0006bed0 - .word 0x000eb0d3 - .word 0x0008093c - .word 0xfff99cf6 - .word 0xfff40e7b - .word 0xfff2787c - .word 0xfff67016 - .word 0x0005ffce - .word 0xfffbb573 - .word 0xffff5e22 - .word 0xfff3b13a - .word 0xfffeb170 - .word 0x000895d9 - .word 0xfffb9eb7 - .word 0xfffc0678 - .word 0xfff098d2 - .word 0xfffef1a7 - .word 0xfff62d8f - .word 0x0004369f - .word 0xfff40876 - .word 0xfffe52de - .word 0x000e2333 - .word 0x00062c91 - .word 0xfff881fb - .word 0x0007fe18 - .word 0x000bf95f - .word 0xfff84375 - .word 0x00077332 - .word 0xfffb096a - .word 0x000aa726 - .word 0x00066e41 - .word 0x000acb81 - .word 0x000735e7 - .word 0xfff1723e - .word 0x0001efe5 - .word 0x0003abf8 - .word 0x0007a323 - .word 0xfff00312 - .word 0xfff13be5 - .word 0x0009dbf6 - .word 0xfff420e9 - .word 0xffffcc05 - .word 0xffffc6e9 - .word 0xfff38e1b - .word 0x0001ae05 - .word 0x000c808a - .word 0xfff4bb16 - .word 0x000d7227 - .word 0x000849de - .word 0xfffe144f - .word 0x000a624e - .word 0xfff9e4e4 - .word 0x000f5354 - .word 0xfff2b153 - .word 0xfffab327 - .word 0xfff74fc6 - .word 0xfff36a7f - .word 0x00044eda - .word 0xfffee374 - .word 0xfff618e2 - .word 0x000bc639 - .word 0x0001c18b - .word 0xfffbce41 - .word 0x000ce122 - .word 0x00095a52 - .word 0x00070c38 - .word 0x0005a613 - .word 0xfff3fc2c - .word 0x00075f72 - .word 0x00009455 - .word 0x000d216b - .word 0xfffe0e82 - .word 0xfff0482b - .word 0xfff606f0 - .word 0xfff85934 - .word 0xfff7f26f - .word 0xffff3f23 - .word 0x0006abbe - .word 0x00025579 - .word 0xfffd0f8e - .word 0xfff7ca7a - .word 0x000a1adc - .word 0xfff8de35 - .word 0xfffac876 - .word 0x000d6014 - .word 0xfffc5cdd - .word 0xfff42b49 - .word 0xfff022c0 - .word 0xfff725f2 - .word 0x000e7179 - .word 0xfff7fee4 - .word 0x0001c636 - .word 0xfffca884 - .word 0xfff4ec69 - .word 0x000787d7 - .word 0x0000fc74 - .word 0xfff1b7c4 - .word 0x0007324d - .word 0x0005c307 - .word 0xfffaf239 - .word 0x000b23df - .word 0xfffc107c - .word 0x000c0962 - .word 0x000c3d66 - .word 0x000f2894 - .word 0xfffc95b7 - .word 0x00033669 - .word 0xfffd5233 - .word 0x000da5d3 - .word 0xfff44e13 - .word 0x000783cd - .word 0xfff01e74 - .word 0xfff507e5 - .word 0x000f226a - .word 0xfffd3a37 - .word 0xfff48e6c - .word 0x000ff237 - .word 0xfff0035a - .word 0x000d34be - .word 0xffffb6f8 - .word 0x000c4c03 - .word 0xfffc0dc1 - .word 0x0006f171 - .word 0xfff93198 - .word 0x000900d8 - .word 0xfff4b43b - .word 0x00007734 - .word 0xffff5234 - .word 0xfffc5b01 - .word 0xfff0d112 - .word 0xfff56b5f - .word 0xfff402ec - .word 0x000fa1ac - .word 0x00062bc6 - .word 0x0001875c - .word 0xfffe8c5c - .word 0xfff1b7ab - .word 0x000db169 - .word 0x0009fedd - .word 0x00029c45 - .word 0xfffccc85 - .word 0x00098d96 - .word 0x000cce4a - .word 0xfff8640f - .word 0x00072029 - .word 0x000c4c61 - .word 0x00032e59 - .word 0xfff756f7 - .word 0x000d6ab7 - .word 0x000fb9aa - .word 0xfff41f4c - .word 0x000916a8 - .word 0x0006dcd4 - .word 0x000246b7 - .word 0xfff11869 - .word 0xfff7acf7 - .word 0x000f61c9 - .word 0xfff7fb93 - .word 0xfff7c4eb - .word 0xfff4c436 - .word 0xfffc1e09 - .word 0x0001f3c3 - .word 0xfffa2ea8 - .word 0x000174cb - .word 0x00064355 - .word 0xfffdc9e2 - .word 0xfff471e1 - .word 0xfffeb56e - .word 0x000d92ca - .word 0x000b3b72 - .word 0x000f105a - .word 0xfff6a128 - .word 0x000bba31 - .word 0xfffc3b11 - .word 0xfff5445c - .word 0x00070bc9 - .word 0x000dd306 - .word 0xfff5633d - .word 0x0003256a - .word 0x0004420f - .word 0xfffa52ae - .word 0xfff46a04 - .word 0x0006d75e - .word 0xfffb3660 - .word 0xfff61571 - .word 0xfff5a1ba - .word 0x0004f930 - .word 0xfff7099a - .word 0xfff87056 - .word 0x0001e507 - .word 0xfffb555d - .word 0x000639c0 - .word 0x0001c6f7 - .word 0x000129bd + .word 0xffff767d + .word 0xfff01fe0 + .word 0xfffedf0a + .word 0x00075605 + .word 0x000efde9 + .word 0xfff7b4b1 + .word 0xfffdaa4d + .word 0xffff8cfa + .word 0x00090c11 + .word 0x00086998 + .word 0xfffe22e2 + .word 0xfff880bb + .word 0xfff86e69 + .word 0xffff3b82 + .word 0xfff50676 + .word 0x000d8081 + .word 0xfff231ed + .word 0xfffaabd7 + .word 0xfff476af + .word 0x000f1d01 + .word 0x000faaa1 + .word 0xfff1c247 + .word 0xfffbcd21 + .word 0x000e1612 + .word 0xfff6e595 + .word 0x00008604 + .word 0x00000d83 + .word 0x00022967 + .word 0x000fa889 + .word 0x00011bc8 + .word 0x0004762d + .word 0xfff8dc5c + .word 0x00066292 + .word 0xfff118ba + .word 0xfff4d5d6 + .word 0x000bcedc + .word 0xfffb3f44 + .word 0xfff959d8 + .word 0xfff97ebd + .word 0x000363d9 + .word 0x000fb001 + .word 0xfff344a8 + .word 0x00078586 + .word 0xfffa7ed7 + .word 0x000163ce + .word 0xfffcf1e7 + .word 0x00034cad + .word 0x00044981 + .word 0x00096136 + .word 0xfff4b6fd + .word 0x000a650f + .word 0x000a3bf2 + .word 0x0005c204 + .word 0xfffe1e21 + .word 0xfffa76ee + .word 0x00050d30 + .word 0x000b101a + .word 0x000b716f + .word 0xfff29805 + .word 0x0002de9a + .word 0x0005b0cf + .word 0xfff073ab + .word 0x0005fbaf + .word 0x00014204 + .word 0xfff2d0b1 + .word 0xfff269b7 + .word 0xfff4e100 + .word 0xfff6cd30 + .word 0x00037c83 + .word 0x000cedb4 + .word 0xfff66b53 + .word 0xfffc9dd1 + .word 0x00001b33 + .word 0x00059a1a + .word 0x000ea004 + .word 0xfff8a724 + .word 0xfff791d6 + .word 0xfff268b5 + .word 0x00071268 + .word 0xfff02076 + .word 0x000dd821 + .word 0x00076b60 + .word 0x00067fc2 + .word 0xfff4c82f + .word 0x000c600b + .word 0xfffac14d + .word 0xfffd5967 + .word 0x0006709f + .word 0x00015a5b + .word 0xfffe84a6 + .word 0x00025c8f + .word 0xfffb577a + .word 0x00085320 + .word 0x00073b0c + .word 0xfffc65e2 + .word 0x0006bf06 + .word 0x00069f42 + .word 0xffffa651 + .word 0xfffdf2ec + .word 0xfff59945 + .word 0xfff3ecea + .word 0x0000acbc + .word 0x000c12b3 + .word 0x000a8a60 + .word 0xfffb3162 + .word 0xfffa399e + .word 0x000c01b3 + .word 0xfff6d530 + .word 0x000b0b21 + .word 0xfff89656 + .word 0xfff144b0 + .word 0xfff8b531 + .word 0x00007ecd + .word 0xfff85e0e + .word 0x0001ed3e + .word 0xfff792c5 + .word 0x0006b86a + .word 0xfff0dd77 + .word 0xfff9df9e + .word 0x00008fdc + .word 0x000b72d4 + .word 0x000a2a4d + .word 0x00073752 + .word 0x0008d501 + .word 0xfff376fb + .word 0xfff285ea + .word 0x000297eb + .word 0x0002be0d + .word 0x000b401e + .word 0xffff0369 + .word 0xfff705bb + .word 0xfffcc58c + .word 0xffff4fa5 + .word 0x000b72bf + .word 0x00051944 + .word 0x00064226 + .word 0x0003b911 + .word 0x0008db9a + .word 0xfff33ba4 + .word 0x000be2a5 + .word 0xfff33f35 + .word 0xfffda667 + .word 0x0003a545 + .word 0x000a9bc8 + .word 0xfffea44d + .word 0xfff48286 + .word 0xfffdcc99 + .word 0x000aa803 + .word 0x000641c3 + .word 0x000aa3e6 + .word 0xfffe2ad7 + .word 0x00012f44 + .word 0xfff1c30a + .word 0x00091fca + .word 0xfffd0f50 + .word 0x00054022 + .word 0xfffc2361 + .word 0xfff2e79f + .word 0xfff7b4ac + .word 0x00063555 + .word 0xfff5620a + .word 0xfff36671 + .word 0x00077e88 + .word 0x000cc223 + .word 0x000b6bae + .word 0x00075aa4 + .word 0x000e6d34 + .word 0xfff41fca + .word 0x00019278 + .word 0xfffcab12 + .word 0x000c19f3 + .word 0x00070600 + .word 0xfff89759 + .word 0xfff3c14c + .word 0xfff9e37e + .word 0xfffb7b6b + .word 0xfffb70d1 + .word 0x00082673 + .word 0xfffe227c + .word 0xfffaa8bd + .word 0x000954c5 + .word 0x0002976b + .word 0x00073e57 + .word 0xfffa0612 + .word 0x000f03f2 + .word 0x00072804 + .word 0xfffee03b + .word 0xfff2f675 + .word 0xfffc9504 + .word 0xfffa0ec7 + .word 0xfffc8472 + .word 0x000aa181 + .word 0x00063347 + .word 0x000bdb00 + .word 0x0007965e + .word 0xffffc6f2 + .word 0x000fe9fc + .word 0x0000dcae + .word 0x000b1861 + .word 0xfffded9c + .word 0xfff6539c + .word 0x0001f13a + .word 0x00089d8c + .word 0xfff76545 + .word 0x00051ae5 + .word 0xffff7590 + .word 0x000551f3 + .word 0x000ab3a5 + .word 0x000274b9 + .word 0xfff59aaa + .word 0x00029e5c + .word 0x000bef90 + .word 0xfffd29e7 + .word 0xfffa55f6 + .word 0xfff6d12d + .word 0xfff73f5b + .word 0xfff056a9 + .word 0x0006d92a + .word 0x000b0968 + .word 0x000bb62d + .word 0x000cdf3b + .word 0xffff50c7 + .word 0xfff94035 + .word 0x0008f974 + .word 0xfff1ec3d + .word 0xfff0f02d + .word 0xfff20870 + .word 0x00009018 + .word 0x00056fc2 + .word 0xfff2d3bd + .word 0xfff80423 + .word 0x0006e920 + .word 0x00069939 + .word 0x000c612d + .word 0x000acb2e + .word 0x00033af0 + .word 0xfffb5150 + .word 0x0000201e + .word 0xfff52b68 + .word 0x000dc583 + .word 0xfffa9b63 + .word 0x000dde83 + .word 0x000ba1dd + .word 0x000ad9a4 + .word 0x00070981 + .word 0xfff9116e + .word 0xfff76fca + .word 0x000eb25a + .word 0x0000b338 + .word 0xfff14e07 + .word 0x00065970 + .word 0x000b3fe0 + .word 0xfff5ffd1 + .word 0xfffa9a3a + .word 0x0005fbab + .word 0xfff4d360 + .word 0xfffabd2e + .word 0xfffd3081 + .word 0xfff136f6 + .word 0xfff438d0 + .word 0x00008d32 + .word 0x00001b79 + .word 0x00081d50 + .word 0xfff0d376 + .word 0xfff718ed + .word 0xfff88521 + .word 0xfff4a0dc + .word 0x000e04cd + .word 0x00023753 + .word 0x000e5857 + .word 0xfffee7fc + .word 0xffffc871 + .word 0xfffecc23 + .word 0x000925ac + .word 0x0009ed9b + .word 0xfff0ece6 + .word 0x000d2b45 + .word 0x0009fb7b + .word 0xfffb5a30 + .word 0x00010d74 + .word 0xfff77890 + .word 0x000dc83f + .word 0x000d1983 + .word 0xfffbb4d6 + .word 0x0008ca76 + .word 0xfffd1d49 + .word 0xfff61697 + .word 0x00028e9b + .word 0xfffe6b9f + .word 0xfffca0a6 + .word 0xfffc6a67 + .word 0xffff7858 + .word 0x00056791 + .word 0xfff9f19b + .word 0x00040365 + .word 0x000c4d16 + .word 0x000344d7 + .word 0x0001645b + .word 0x000e75e9 + .word 0xfff319e7 + .word 0x000adf15 + .word 0x000cf223 + .word 0xfff6ec53 + .word 0xfff96cba + .word 0xfff89d0c + .word 0xfffcb37b + .word 0x000908b7 + .word 0xfff08e35 + .word 0x00037362 + .word 0x00043070 + .word 0x000a10a4 + .word 0x000f01fb + .word 0xfff67b4a + .word 0x0008e6f2 + .word 0xfffe1264 + .word 0xffff5992 + .word 0x00041066 + .word 0x00049d7b + .word 0xfffdc87a + .word 0x00096197 + .word 0x00087844 + .word 0x000b12a6 + .word 0xfff0a32e + .word 0xfff2668b + .word 0x00058731 + .word 0x00032c1d + .word 0x0007553d + .word 0xfff1eb87 + .word 0xfff1c434 + .word 0xfff09e76 + .word 0x00090288 + .word 0xfff2bf6d + .word 0x0006ed4c + .word 0x0007e6a0 + .word 0xfff88976 + .word 0x00051dad + .word 0x000b1409 + .word 0xfff63852 + .word 0x0000d7b2 + .word 0x0004e4e3 + .word 0xffff97ec + .word 0xfff92c49 + .word 0x000f6743 + .word 0xfffc2b10 + .word 0x0008eb84 + .word 0x00025046 + .word 0xfffaac59 + .word 0xfffd813c + .word 0xfff280bf + .word 0x00057149 + .word 0xfff001be + .word 0xfff89f17 + .word 0x0006cb0f + .word 0xfffac578 + .word 0xfffb16de + .word 0x00021fb5 + .word 0xfffc6acb + .word 0x00024b40 + .word 0x00049908 + .word 0x00012da5 + .word 0xfff5ac5d + .word 0xfffae0b9 + .word 0xfff46995 + .word 0x000109bf + .word 0xfff7133f + .word 0x0006c204 + .word 0x00068290 + .word 0x0004de64 + .word 0xfffc3e39 + .word 0xfffbe918 + .word 0xfff2c59a + .word 0x0005b9fb + .word 0x000855c2 + .word 0x000aa05f + .word 0xfffb7e9e + .word 0x0008a69e + .word 0x000d68bb + .word 0x000fc149 + .word 0xfff597d5 + .word 0x0005381f + .word 0x00063ada + .word 0xffff4474 + .word 0x000c4408 + .word 0xfff3b2d8 + .word 0xfff96472 + .word 0xfff752ea + .word 0x00042ed2 + .word 0x00048477 + .word 0x00059de0 + .word 0x000c9d4f + .word 0x000fb409 + .word 0xffff0dc3 + .word 0xfffbcebd + .word 0x0005ee6a + .word 0x00003a6a + .word 0xfff92004 + .word 0x0002976b + .word 0x000c452e + .word 0x00031558 + .word 0x000239c4 + .word 0xfff49bd8 + .word 0x00048cfe + .word 0xfffbce66 + .word 0xfff721b0 + .word 0x000ebc95 + .word 0xfff9c95d + .word 0xfff60873 + .word 0x000d143a + .word 0xfff93b82 + .word 0x000ac2d9 + .word 0x0005a7bf + .word 0xfffa69a7 + .word 0xfffc8222 + .word 0xfff09d15 + .word 0xfff0548f + .word 0xfffd8fd2 + .word 0xfffbccae + .word 0x000ed271 + .word 0x0008a9b2 + .word 0x000b712f + .word 0xffff0343 + .word 0x0002466f + .word 0xfff386cf + .word 0xfff75710 + .word 0xfffdd81c + .word 0xfff25eef + .word 0xfffc2f14 + .word 0x0008e865 + .word 0x00029d0a + .word 0xffffe670 + .word 0xfff63dec + .word 0x0002bdac + .word 0xffffa131 + .word 0xfff0dd5b + .word 0x000bb6c6 + .word 0x0001db34 + .word 0x000967d4 + .word 0xfff7c6ff + .word 0x000aeda0 + .word 0xfff29af5 + .word 0xfff89731 + .word 0x000a78e2 + .word 0x0009f8d9 + .word 0x0000caa3 + .word 0x0004d403 + .word 0x000c5fd5 + .word 0xffff7a50 + .word 0xfff002c3 + .word 0x000cd987 + .word 0xfff219d1 + .word 0x00064f0f + .word 0xfff31986 + .word 0xfff2f3db + .word 0x000d6d7b + .word 0xfffcd6c7 + .word 0x000dc599 + .word 0x000f0d81 + .word 0x0009cd9b + .word 0x0005c98b + .word 0x0001e79f + .word 0x00073102 + .word 0x000d5bb7 + .word 0xfff524ed + .word 0xfffc20e0 + .word 0x0004a433 + .word 0x0001ddd9 + .word 0x000d5229 + .word 0xffffc394 + .word 0x00085fd8 + .word 0xfff6fb03 + .word 0xfff0414c + .word 0xfffdb8dd + .word 0x0005e3b6 + .word 0xfffda49a + .word 0x00037fd4 + .word 0x000bcbe3 + .word 0x0008208b + .word 0xfff61b65 + .word 0xfffa83de + .word 0x0005bb08 + .word 0x00088589 + .word 0xfff3e8d6 + .word 0xffff7934 + .word 0xfff363f8 + .word 0x00027461 + .word 0x00029431 + .word 0xfffdbb62 + .word 0x00010b20 + .word 0x00006a67 + .word 0xfff09c4f + .word 0x000f1316 + .word 0xfff3c160 + .word 0x000b946e + .word 0xfff5bbe7 + .word 0x0006c961 + .word 0xfff46755 + .word 0xfff28f9b + .word 0x00085d84 + .word 0xfff0802c + .word 0x000ed8c6 + .word 0xfffb659e + .word 0x00066017 + .word 0xfff1ff99 + .word 0x000f9ace + .word 0x000bff5f + .word 0x000307eb + .word 0xfffa0a75 + .word 0xfff5f064 + .word 0x0006cb3e + .word 0x0004b3cc + .word 0xfffde14a + .word 0xfff02f67 + .word 0xfff704c6 + .word 0xfff9e400 + .word 0xfff30797 + .word 0xfff0bd27 + .word 0x000a04fe + .word 0x000b0ca1 + .word 0x00098778 + .word 0xfff9a681 + .word 0xfff256b9 + .word 0xfffad529 .word 0x0004ec30 - .word 0xfffac1ee - .word 0x000cef84 - .word 0x000d3f25 - .word 0xfffe90fd - .word 0x000af453 - .word 0xfff69758 - .word 0xfffd2b6d - .word 0x00049e83 - .word 0xfffac273 - .word 0x000f75e9 - .word 0x000964d8 - .word 0xfff9000d - .word 0xfff4aea7 - .word 0x0007a2a2 - .word 0x00065a9f - .word 0x000537a6 - .word 0x0009321b - .word 0xfff946f4 - .word 0x0004036b - .word 0x000a3c6b - .word 0x0001d3fe - .word 0xfff8902f - .word 0x00087f31 - .word 0x0007de0f - .word 0x000cf767 - .word 0x000dbad8 - .word 0xfff965f9 - .word 0x0001e5d9 - .word 0x000256e1 - .word 0x00099d03 - .word 0x000b2f08 - .word 0x00034eba - .word 0xffff9ee8 - .word 0x000a40c0 - .word 0xfff8714d - .word 0xfff64225 - .word 0xfff46989 - .word 0x000b7f70 - .word 0x0005c37f - .word 0x000dbe73 - .word 0xfffd1c6f - .word 0x0009855f - .word 0x00092399 - .word 0xfff6982a - .word 0x000ae0ac - .word 0x0002bc9c - .word 0xfffbf16b - .word 0xfff4a5a0 - .word 0xfffc5e4d - .word 0xfffdaf24 - .word 0x000ba324 - .word 0xfff8799e - .word 0x00004281 - .word 0x0009944d - .word 0x000ab387 - .word 0xfff4bb91 - .word 0x000bfcc4 - .word 0xfffaeea5 - .word 0xfffc3074 - .word 0x00071143 - .word 0x0003e931 - .word 0xfff6acfd - .word 0x00022cc9 - .word 0x000018b2 - .word 0xfff13df8 - .word 0x00015197 - .word 0x000e5076 - .word 0xfffe04d6 - .word 0xfff26769 - .word 0xffff0eed - .word 0xfff8cda8 - .word 0xfffab8ff - .word 0x000d419c - .word 0xfff377e4 - .word 0xfff80ab1 - .word 0xfff6ab9e - .word 0xfff44f0d - .word 0xfffe5491 - .word 0xfff396fa - .word 0xfff1f2d8 - .word 0x0008cbf7 - .word 0xfff14f37 - .word 0x0000ce42 - .word 0x0005cdcd - .word 0x0001d0d3 - .word 0xffffc6b2 - .word 0x00072753 - .word 0x0003c766 - .word 0xfffd87ca - .word 0x0006cb78 - .word 0x000e3d31 - .word 0xffff7459 - .word 0x000dd3b1 - .word 0x0005178c - .word 0xfff29991 - .word 0x000d9d6f - .word 0x00091a0e - .word 0x000ae01f - .word 0x000aafa3 - .word 0x000f6387 - .word 0x000e2395 - .word 0xfff828ed - .word 0xfffc008b - .word 0x000e0ea7 - .word 0xfff9cd63 - .word 0x000368ee - .word 0xfff2eafe - .word 0xfffb91ec - .word 0x00078f06 - .word 0x000cadcb - .word 0x0006c767 - .word 0x0003744f - .word 0x0001007d - .word 0x000b460c - .word 0xfff4b2a6 - .word 0x000c618e - .word 0x000bc292 - .word 0x0000beb5 - .word 0x0007c487 - .word 0x0000b090 - .word 0xfff63761 - .word 0xfff1fad5 - .word 0xfff94580 - .word 0xfff854fc - .word 0xfff7d976 - .word 0xfff23444 - .word 0xfff33fb3 - .word 0x0000863b - .word 0x0002eee2 - .word 0x0002219a - .word 0x0003a0ce + .word 0xfffd422b + .word 0xfff427c5 + .word 0xfff1c92b + .word 0x000a60b3 + .word 0x000de553 + .word 0xfff192d4 + .word 0xfff135fe + .word 0x0006a6e9 + .word 0x00006752 + .word 0xfff8c7ff + .word 0xfffc0b4b + .word 0xfff99a42 + .word 0x0009495f + .word 0xfff5dc5a + .word 0x000dbeaf + .word 0x0003478a + .word 0x0004a0ec + .word 0xfff5fe81 + .word 0x000dd75c + .word 0x0008d862 + .word 0xfff77d99 + .word 0xffffb7ff + .word 0xfff9005e + .word 0x000bafb8 + .word 0x0002a694 + .word 0x000ed4ac + .word 0xfff787b9 + .word 0x0002c817 + .word 0x000136b3 + .word 0xfff1fb36 + .word 0x000d288d + .word 0xfff118f3 + .word 0x0006d95d + .word 0x000dbac8 + .word 0x000d961d + .word 0xfffc667d + .word 0x000f3990 + .word 0x000fd561 + .word 0x000c08d6 + .word 0x0003b8df + .word 0x0003a559 + .word 0x0006c1ab + .word 0x000f4ddd + .word 0xfffa31be + .word 0x000c4648 + .word 0xfff152b4 + .word 0x00051951 + .word 0xfffce8ff + .word 0xfff01289 + .word 0x000c0233 + .word 0xfffa26a6 + .word 0x00030274 + .word 0x000e77cc + .word 0x000047fc + .word 0x0007b956 + .word 0xfff14985 + .word 0xfff53551 + .word 0xfff5f34b + .word 0xffff0892 + .word 0xfffe3076 + .word 0xfff1f34a + .word 0xfffb2e68 + .word 0xfffa5a11 + .word 0x0001e809 + .word 0xfff92cc9 + .word 0x000630f2 + .word 0xfff31164 + .word 0x00002834 + .word 0x000d320d + .word 0xfff3f1ff + .word 0xfffc441d + .word 0x0007e716 + .word 0x000f076c + .word 0xfff7b31d + .word 0x000c4822 + .word 0xfffc3921 + .word 0xfffe849f + .word 0xfff3e404 + .word 0x000903ae + .word 0x00096b75 + .word 0xfff59dc9 + .word 0xfffad575 + .word 0x000846fe + .word 0xfff2e181 + .word 0x00012d07 + .word 0xfff7dc6f + .word 0x000f8b9b + .word 0xfff8706d + .word 0x0002b9ba + .word 0x0002c936 + .word 0x00096151 + .word 0x00088f5e + .word 0xfff774d6 + .word 0xfff497a8 + .word 0x00010e01 + .word 0x000dc937 + .word 0x000c02f2 + .word 0xfff88da7 + .word 0x00061a74 + .word 0xfffa5e51 + .word 0xfff2336c + .word 0xfff865d3 + .word 0xfff397d9 + .word 0xfffe60c2 + .word 0x00031cb3 + .word 0xfffa9e2c + .word 0xfff46b5a + .word 0x00010400 + .word 0x000d7fca + .word 0x0004bb89 + .word 0x00072cab + .word 0x0002b804 + .word 0xfff30429 + .word 0x000eca1d + .word 0x000417dc + .word 0xfff4669e + .word 0x0008d2f1 + .word 0xfff8c31d + .word 0xfff69ae0 + .word 0x00029fc3 + .word 0x000d5044 + .word 0xffff6a06 + .word 0xfff0fcb8 + .word 0xfffa8060 + .word 0x000d25a9 + .word 0x0003c2c6 + .word 0xfffaec56 + .word 0x00043915 + .word 0xfffee50e + .word 0xfffe43a7 + .word 0xfff601c6 + .word 0x000818f7 + .word 0x000b0f5e + .word 0xfff103f2 + .word 0xfff97a50 + .word 0x00035b7d + .word 0x0001296d + .word 0x000237ee + .word 0x000d9a25 + .word 0x0006ae9a + .word 0x0001ee6d + .word 0x00047dc3 + .word 0xfff35f9f + .word 0xfff6b77e + .word 0xfff4660f + .word 0x000101d2 + .word 0x000c402c + .word 0xfff25e84 + .word 0x0005c97e + .word 0x000afd03 + .word 0xfff47afa + .word 0xfff05b99 + .word 0xfff011c0 + .word 0x000779fd + .word 0xfff05790 + .word 0x0000a398 + .word 0x0005f295 + .word 0x00088422 + .word 0x00012d8b + .word 0xfff20384 + .word 0xfff99171 + .word 0xfffe21b2 + .word 0x000f1300 + .word 0x0000e6fa + .word 0xfffa7dbd + .word 0xfff8d5b0 + .word 0x0004b444 + .word 0x000917d1 + .word 0x000c10ce + .word 0xfff05639 + .word 0xfff23777 + .word 0xffffaea9 + .word 0xfff4bd79 + .word 0xfff4c531 + .word 0xfff56af0 + .word 0xfff4ac18 + .word 0xfff114a0 + .word 0xfff1976f + .word 0xfffe17a8 + .word 0xfff37de7 + .word 0xfff5cecb + .word 0xfff0fb76 + .word 0xfff55caf + .word 0x0008c880 + .word 0x000074a8 + .word 0xfff7d804 + .word 0x0008e343 + .word 0x000c0a02 + .word 0x00040ebe + .word 0xfff290c3 + .word 0xfffb2abb + .word 0x0004ac75 + .word 0x0008c4cf + .word 0x00049183 + .word 0x0006b749 + .word 0x000ccfde + .word 0xffffe57c + .word 0x000c3b78 + .word 0xfff5350e + .word 0x00026213 + .word 0xfff8d7fd + .word 0xfff8031c + .word 0xfff45056 + .word 0xfffcaf4d + .word 0x0000858c + .word 0x00043d35 + .word 0x0008becd + .word 0xfff77891 + .word 0xfff8c015 + .word 0xfff5ee69 + .word 0xfff4cd66 + .word 0xfff2764d + .word 0x0000f457 + .word 0xfff8142c + .word 0x000aad27 + .word 0xfff4f72c + .word 0x00097a8e + .word 0x000511cd + .word 0xfff2b0d5 + .word 0x000af501 + .word 0x000988ef + .word 0x00065fbf + .word 0xfffe910b + .word 0x0000b318 + .word 0x0008061b + .word 0xfff595e7 + .word 0x000ac9b4 + .word 0xfffa48ce + .word 0xfff9f222 + .word 0x000e116d + .word 0x00064d70 + .word 0x0008bb8d + .word 0xfff4d31f + .word 0x0006d1cf + .word 0xfff26dc0 + .word 0xfff2a1de + .word 0xfff99978 + .word 0xfffcd0a8 + .word 0x000cf71c + .word 0x00071294 + .word 0xfff09c08 + .word 0x000de034 + .word 0xfff2b98a + .word 0x000d1e1c + .word 0x000ddc1c + .word 0x000107ed + .word 0x0007f69d + .word 0x000723f7 + .word 0xfff2664a + .word 0xfff24ac4 + .word 0x000d9bff + .word 0x00026834 + .word 0x00021ffa + .word 0x0007f032 + .word 0x000c68e9 + .word 0xfff4c47d + .word 0xfff9ea15 + .word 0xfff2c658 + .word 0x000f83ca + .word 0xfff5cb99 + .word 0xfffaa07d + .word 0xfffd9824 + .word 0x0004dc59 + .word 0xfff22241 + .word 0xfff66b9f + .word 0x000e79cb + .word 0x000f45d8 + .word 0xfffdd96b + .word 0xfff35c1c + .word 0x00056057 + .word 0xfffb3508 + .word 0x0004fd6c + .word 0xfffee56b + .word 0xfffc3938 + .word 0x000d2a0d + .word 0xfff3bc11 + .word 0x0007b968 + .word 0x000b2d94 + .word 0x0008b610 + .word 0xfffe5ae3 + .word 0x000157ec + .word 0x00046d7c + .word 0x00096e7f + .word 0xfff01db4 + .word 0x0008e6bb + .word 0xfffaca7b + .word 0xfff9044b + .word 0x000a4177 + .word 0x000a1afb + .word 0x000da2f7 + .word 0x000fcc7e + .word 0x00049c18 + .word 0xfffc84c0 + .word 0xfff7a09a + .word 0x0008170a + .word 0x000730b2 + .word 0xfff3aa9b + .word 0xfff06a9b + .word 0x000d5c9f + .word 0xfff93c9b + .word 0xfff20dd3 + .word 0x00085401 + .word 0xfff5f6d3 + .word 0xfff5b53a + .word 0xfff4c058 + .word 0xfff49518 + .word 0x00093e7b + .word 0x0004ace4 + .word 0xfffa8e0b + .word 0xffff4f57 + .word 0xfff5a5c8 + .word 0x00062cd0 + .word 0x000619dd + .word 0x0007e107 + .word 0x000e631a + .word 0x000ee089 + .word 0xfffb3d4d + .word 0xfff2f111 + .word 0x000a5859 + .word 0x000b6c91 + .word 0x0001f8fb + .word 0x000ff844 + .word 0x000d8891 + .word 0x000bebf7 + .word 0xfff2a39e + .word 0x000abac8 + .word 0x00052086 + .word 0x000f5e69 + .word 0x00044e4e + .word 0x000835c0 + .word 0xfff9adb6 + .word 0x000b254b + .word 0xfff53a38 + .word 0xfffe6255 + .word 0x000649b5 + .word 0x000810b0 + .word 0xfff57b14 + .word 0x000c8c15 + .word 0x0007ec18 + .word 0xfff31e06 + .word 0x0001cec2 + .word 0x0001c39f + .word 0xfff7c0cf + .word 0x000061b3 + .word 0x0005d01d + .word 0xfffaa434 + .word 0x00049276 + .word 0xfffc9be7 + .word 0xfff8485d + .word 0xfff761e6 + .word 0x0006e779 + .word 0x000fa3aa + .word 0xfffefecc + .word 0xfff64fcc + .word 0xfff471f3 + .word 0xfff0fb35 + .word 0xfff7d436 + .word 0x0004ef5b + .word 0x0001a1d2 + .word 0xfffd79ff + .word 0xfff676fc + .word 0xfff47665 + .word 0xfffe1d49 + .word 0xffffc064 + .word 0xfff90d5b + .word 0x0005e82a + .word 0x000de87a + .word 0x0002c874 + .word 0xfff39d7c + .word 0xfffc2c5c + .word 0x0000ad38 + .word 0xfff87ee8 + .word 0xfff9ef4d + .word 0x0001278b + .word 0xfff01da3 + .word 0x000172bd + .word 0x000baf13 + .word 0xfff609ad + .word 0xfffdc33b + .word 0x00074294 + .word 0x000882da + .word 0xfffcc083 + .word 0x000b03d4 + .word 0x0000e5bb + .word 0x000548b8 + .word 0x000a1bd1 + .word 0xfff390de + .word 0x00098002 + .word 0x000bb0b8 + .word 0x000251dd + .word 0xfff1aecc + .word 0x000a7c41 + .word 0xfff4b750 + .word 0x000fa1e3 + .word 0xfffed58d + .word 0xfff795e9 + .word 0xfffc054e + .word 0xfff182c4 + .word 0xfffd95e6 + .word 0xffffb6dd + .word 0x000e0f63 + .word 0xfff23cef + .word 0xfff254ad + .word 0xfffc7a96 + .word 0xfffb0c53 + .word 0x000a631d + .word 0x000fcf78 + .word 0xfff57b7c + .word 0xfff7f851 + .word 0xfff7e6f0 + .word 0xfffff62c + .word 0x000375d7 + .word 0xfff6eb11 + .word 0xfffe77d5 + .word 0x0003bb2b + .word 0xfff0623a + .word 0xfffd4f84 + .word 0xfff1fb73 + .word 0x0005ade0 + .word 0xfff851cb + .word 0x000d3119 + .word 0x000ce8da + .word 0x000e35bc + .word 0x000d1ea8 + .word 0xfff44a89 + .word 0xfffccde4 + .word 0xfff67107 + .word 0x00077ba9 + .word 0x000da98b + .word 0xfff70135 + .word 0x000a8736 + .word 0xfffc8195 + .word 0x000c929a + .word 0x0009aed6 + .word 0x0007f4c2 + .word 0xfffdf0a1 + .word 0xfffe8735 + .word 0x000785fb + .word 0xfffd52c5 + .word 0xfffbab7a + .word 0xfff92c4a + .word 0x0003cc75 + .word 0x0003ec4a + .word 0x00034f1d + .word 0x000cc2bf + .word 0x00007ded + .word 0x00061bf2 + .word 0x000e2eed + .word 0x00042490 + .word 0xfff0bf07 + .word 0x000e4739 + .word 0x0002f17e + .word 0x000576f3 + .word 0xffffd5b8 + .word 0x0002d682 + .word 0x00053370 + .word 0x000d9320 + .word 0xfffdd7d9 + .word 0xfff18d85 + .word 0x000f9ae8 + .word 0x00050e25 + .word 0xfffec007 + .word 0xfffdcd93 + .word 0xfff16373 + .word 0x0005f3a4 + .word 0x00087398 + .word 0x000c9211 + .word 0xfff2e97c + .word 0x00040a96 + .word 0x000f7834 + .word 0xfff82e2c + .word 0xfff1cc15 + .word 0xfffe3e84 + .word 0xfffaf29e + .word 0xfff870bf + .word 0x000b9dad + .word 0x0006737e + .word 0x000b7525 + .word 0x000d8d95 + .word 0x00037b86 + .word 0x000f95e7 + .word 0xfffcc3e2 + .word 0xfff9ab69 + .word 0xfff6129e + .word 0xfff1ce89 + .word 0x000e360f + .word 0xfff2fceb + .word 0x00051a7e + .word 0x000bc0fa + .word 0x00095bdb + .word 0x000d561c + .word 0x000a1ff1 + .word 0xfff10f42 + .word 0x00031e99 + .word 0xfff6ba82 + .word 0x0008c58d + .word 0xfff2abf0 + .word 0xfffc82b0 + .word 0xfff87b61 + .word 0x000b94a6 + .word 0x000dbab5 + .word 0x0000fd0e + .word 0x000b33c1 + .word 0x0003d934 + .word 0x0004526a + .word 0xfff303a5 + .word 0x0004c805 + .word 0xfff2877a + .word 0xfff2e6f1 + .word 0xfff918a4 + .word 0x000aa6ff + .word 0x000e8648 + .word 0xfff73645 + .word 0x0007e16f + .word 0xfff361ae + .word 0x00031f3c + .word 0xffff780d + .word 0xfff258db + .word 0xfff84de4 + .word 0x000d1934 + .word 0x0001cf3a + .word 0xfff6b961 + .word 0xfff84247 + .word 0x00046cbe + .word 0x000db203 + .word 0xfffd71d4 + .word 0xfff07e06 + .word 0xfff9fe95 + .word 0xfff3e211 + .word 0x000671de + .word 0xfff1be65 + .word 0x0007aa28 + .word 0x0000e6d9 + .word 0xfffeafee + .word 0x0001762d + .word 0xfff466d0 + .word 0x00026cc4 + .word 0x000d5649 + .word 0xfff38b1f + .word 0x000bf2e5 + .word 0x000846ac + .word 0x00038eae + .word 0xfff77170 + .word 0xfff3cd29 + .word 0xfffbc180 + .word 0xffffc104 + .word 0x00012be7 + .word 0xfff3c10e + .word 0x000e4c69 + .word 0xfff4c91f + .word 0xfff49c09 + .word 0xfffd8b8f + .word 0x00065373 + .word 0x0009739e + .word 0xfff00b44 + .word 0xfffc0532 + .word 0x0005635d + .word 0xfff84ebc + .word 0x000ac8dc + .word 0x0007fea1 + .word 0x000157c0 + .word 0xfffae76a + .word 0xfff9ed0a + .word 0x00037dbc + .word 0x0003c055 + .word 0xfff197de + .word 0x000111e8 + .word 0xfff0a210 + .word 0xfffd2d4a + .word 0x000b47d0 + .word 0xfff96453 + .word 0xfff46da6 + .word 0x0003dd9a + .word 0xfffe6038 + .word 0x000ef0ca + .word 0xfff755a5 + .word 0xfffdf84b + .word 0xfff94a05 + .word 0xffffe76c + .word 0x00090a87 + .word 0xffff5cd5 + .word 0x000a92ab + .word 0xfff1a17f + .word 0x0009f480 + .word 0x000b48a7 + .word 0xfff1eea4 + .word 0x00084ba3 + .word 0x0007dbae + .word 0x00018064 + .word 0x00015d7d + .word 0x000e5688 + .word 0x0008d247 + .word 0x000e11b4 + .word 0xfffa4bdc + .word 0xfff6f96b + .word 0x000715be + .word 0x00072923 + .word 0xfffeb1e2 + .word 0x0008b0d7 + .word 0xfff0d18b + .word 0x000bf36f + .word 0xfffed93c + .word 0xfff05018 + .word 0x0009a4fa + .word 0x00002745 + .word 0x000567b6 + .word 0xfff73c17 + .word 0xfff29dcf + .word 0xfff24588 + .word 0x000926f0 + .word 0xfff86f19 + .word 0xfffdcdb0 + .word 0xfffac3c6 + .word 0x00056ace + .word 0x000303f3 + .word 0x000ab2fb + .word 0xfffeb7ef + .word 0xfffb67a5 + .word 0x000fafeb + .word 0x000dfb6e + .word 0x0008dade + .word 0x0003beaf + .word 0x0005361a + .word 0xfff52d7d + .word 0xfff09f6a + .word 0x000f6ceb + .word 0x00064f48 + .word 0x000864a9 + .word 0x0007c24c + .word 0x0007a143 + .word 0xfffbc2a4 + .word 0x000c49e1 + .word 0xfff49a85 + .word 0xfff015be + .word 0x0007b454 + .word 0x000752f1 + .word 0x0002d4a5 + .word 0xfff17173 + .word 0x000de9e7 + .word 0x00014409 + .word 0xfff2cf5a + .word 0xfff93d50 + .word 0x0002cce5 + .word 0xfff69ce2 + .word 0xfff32ea5 + .word 0x00047b0e + .word 0x000cad61 + .word 0xffffa3d8 + .word 0xfff78fb5 + .word 0xfffa2824 + .word 0xffff98b4 + .word 0xfff19b0b + .word 0xfff74261 + .word 0xfffcda9c + .word 0x00083726 + .word 0x000757a4 + .word 0x000755a3 + .word 0x0004466c + .word 0xfffbd733 + .word 0x000655eb + .word 0xfff29276 + .word 0xfff42443 + .word 0x00047072 + .word 0xfff9c797 + .word 0xfff1cd5d + .word 0xfff9303c + .word 0x00046a66 + .word 0xfff83631 + .word 0xfff21967 + .word 0x000e29af + .word 0x0005a243 + .word 0xffff7f1e + .word 0x0004fe57 + .word 0xfff836cf + .word 0xfffc2dd4 + .word 0x00035f48 + .word 0x000352de + .word 0x000c51cd + .word 0xfff2b8d1 + .word 0x00001037 + .word 0xfffb6180 + .word 0xfff498ce + .word 0xfffca80d + .word 0x000112d6 + .word 0x00078cbf + .word 0xfff0c630 + .word 0xfff61de8 + .word 0xfff058b8 + .word 0x000cde48 + .word 0xfff6e62e + .word 0x000b12e9 + .word 0xfff157fc + .word 0x0009067e + .word 0x000836aa + .word 0xfff130cd + .word 0xfffe2574 + .word 0xfffdf91e + .word 0x00016bf0 + .word 0xfff624f4 + .word 0xfffe676e + .word 0xfffa26f0 + .word 0x0000ec25 + .word 0xffff7b85 + .word 0x000c9e90 + .word 0xfff6c104 + .word 0xfffc730c + .word 0x000a7860 + .word 0xfff372b1 + .word 0x00045ee7 + .word 0xffff7fc2 + .word 0xfff137f8 + .word 0xfffe1d80 + .word 0xfff11ea5 + .word 0x000f44d3 + .word 0x0005119a + .word 0x000e9541 + .word 0x00012ac1 + .word 0x0004ce54 + .word 0xfff6d8e6 + .word 0xfffa3632 + .word 0xfffbb424 + .word 0xfff46f7f + .word 0x000c25f4 + .word 0xfffb1485 + .word 0x00089a59 + .word 0xfff21ece + .word 0xfff13e05 + .word 0xfff4df39 + .word 0x000b2482 + .word 0x000eb95c + .word 0x00062f7b + .word 0x000da442 + .word 0xfff5fe07 + .word 0xfff5c40f + .word 0xfff215f3 + .word 0xfff2af6c + .word 0xfff7b6bb + .word 0x000d33fb + .word 0x000fbadb + .word 0xfff47da6 + .word 0x000b4eda + .word 0x000c6e71 + .word 0xfffd072c + .word 0x000dbdfc + .word 0x000acc37 + .word 0xfff992d9 + .word 0x00039093 + .word 0xfff385d0 + .word 0xfff95d3f + .word 0x000e3f80 + .word 0x00059b97 + .word 0x000c2d40 + .word 0x000b7463 + .word 0xfffe3592 + .word 0xfffe0c45 + .word 0x000fb8f3 + .word 0x0000e9ba + .word 0x000f311b + .word 0x000ba7da + .word 0x0001b9c4 + .word 0xfff66948 + .word 0xfffa414b + .word 0x0001a303 + .word 0xfff0b578 + .word 0x00086eff + .word 0xfff15aec + .word 0xfff42d48 + .word 0x0006b311 + .word 0x00098c36 + .word 0xfff94a7a + .word 0x000ff980 + .word 0x0002dc8a + .word 0x00005f4c + .word 0x000ef624 + .word 0x0007f9cf + .word 0x000f8a28 + .word 0x0008d6e9 + .word 0x000732a4 + .word 0xfff2f186 + .word 0xfff77c96 + .word 0x00047887 + .word 0x000c3b35 + .word 0xfff7e5ff + .word 0x00044f15 + .word 0x000a982d + .word 0xfffbc9c6 + .word 0xfffcc6c0 + .word 0xfff77ce2 + .word 0xfff2d76d + .word 0x000df92b + .word 0x000528ef + .word 0xfff5b4b8 + .word 0x000c5c6c + .word 0xfffa8f88 + .word 0x000f073e + .word 0x000912b3 + .word 0x0000852b + .word 0xfff64bc5 + .word 0xfff9e044 + .word 0x000901c4 + .word 0x000c0ef2 + .word 0xfff43c48 + .word 0x0001836b + .word 0x0000fc50 + .word 0x00067bad + .word 0xfffe3863 + .word 0xfffde678 + .word 0x000e22c7 + .word 0xfff5dc63 + .word 0x0004b298 + .word 0xfff753e8 + .word 0x0000c6cd + .word 0x0006f2b4 + .word 0x0007bf14 + .word 0xfff9c21d + .word 0x0005b245 + .word 0x00099f49 + .word 0xfff8628b + .word 0xfff5658d + .word 0xffff67d2 + .word 0x000a9e56 + .word 0x000ea65b + .word 0x00076f45 + .word 0x00061588 + .word 0xfff8305d + .word 0xffffcfe1 + .word 0x0009dd36 + .word 0x0008794e + .word 0xfff8f065 + .word 0xfff3870c + .word 0xfffe4057 + .word 0x00051e97 + .word 0x000fe54c + .word 0xfffe0ffe + .word 0x00096f6a + .word 0x000a473b + .word 0xffffe65b + .word 0xfff50fea + .word 0x000a93af + .word 0xfffc7d0b + .word 0xfff635cb + .word 0x000b75b7 + .word 0xfff0d1ce + .word 0xfff195b5 + .word 0xfff5b42e + .word 0x00011265 + .word 0xfff48026 + .word 0xfffc4374 + .word 0x00007584 + .word 0x00063433 + .word 0xfffabc11 + .word 0xfff26b76 + .word 0xfff06d2d + .word 0xfff240d3 + .word 0x0001fe13 + .word 0x0004add3 + .word 0x000d2279 + .word 0xfff37603 + .word 0x000e47b6 + .word 0xfffb9702 + .word 0x000ffa9d + .word 0x000c44ee + .word 0xfffe8093 + .word 0x000d3c8b + .word 0xfff65dd2 + .word 0xfff4f618 + .word 0xfffc46fe + .word 0xfff9c860 + .word 0x0007c02f + .word 0x000b4607 + .word 0xfff6f78a + .word 0xfffd85d6 + .word 0xfffc48ca + .word 0x0007b0b6 + .word 0xfffad4a5 + .word 0xfffa1198 + .word 0xfff8cb87 + .word 0x000cad9b + .word 0x00070799 + .word 0x0008a07d + .word 0xfffdae50 + .word 0xffff06c0 + .word 0xffff92a6 + .word 0xfffd3be2 + .word 0xffffb861 + .word 0xfff8a79d + .word 0xfff33cae + .word 0x000126e0 + .word 0xffff942e + .word 0xfff8eea2 + .word 0x0006b98d + .word 0xfffeb859 + .word 0xffffdb80 + .word 0x00067df2 + .word 0x00078aaf + .word 0x00056d7e + .word 0xffffef07 + .word 0xfffd7f54 + .word 0xfff2e9f5 + .word 0x0007f3a0 + .word 0xfffb82ba + .word 0x000f440b + .word 0xfff633d1 + .word 0xfff1c8e2 + .word 0xfffc397d + .word 0xfff3bd80 + .word 0xfff559ac + .word 0xfff23518 + .word 0x000c5775 + .word 0x0001b343 + .word 0x00080740 + .word 0x0009932a + .word 0x0005ac20 + .word 0xffff81fe + .word 0x000907f4 + .word 0xfffeecb5 + .word 0xfffeebf0 + .word 0xfff216a1 + .word 0xfff7af9e + .word 0xfff2e001 + .word 0xfff23c39 + .word 0xfff7c188 + .word 0xffff6711 + .word 0xfff110ad + .word 0x000b968c + .word 0xfff71960 + .word 0xfffad22e + .word 0x0009a9f5 + .word 0xfff288e5 + .word 0x0005355c + .word 0x00095180 + .word 0x0009856f + .word 0x000ec542 + .word 0xfff6fcc7 + .word 0x00068e9f + .word 0xfffe8e04 + .word 0x00075a90 + .word 0xfffd0099 + .word 0x0009d5db + .word 0xfff3b57a + .word 0xfff9fb13 + .word 0xfff94cc6 + .word 0xfff1fb14 + .word 0x00054c4a + .word 0x0001270c + .word 0xfff73f79 + .word 0xfff60d80 + .word 0x00064c71 + .word 0x00098e02 + .word 0xfff727ce + .word 0x0009d3ca + .word 0xfffec36d + .word 0x00017cbd + .word 0xfffca298 + .word 0x0001fd57 + .word 0x00065178 + .word 0xfff49381 + .word 0x000096a7 + .word 0x0000dfc6 + .word 0x000e3a4f + .word 0x0007cd9e + .word 0x000afddb + .word 0x00019bb2 + .word 0x000a388b + .word 0xfffe63c3 + .word 0xfff4b223 + .word 0x000499cc + .word 0xfff01735 + .word 0xfffe6d1e + .word 0xfffd6d45 + .word 0x00032c64 + .word 0x0001b0ca + .word 0xfff6e138 + .word 0x000204a0 + .word 0x000362e6 + .word 0x000d0e21 + .word 0xfffe2c06 + .word 0x000196f7 + .word 0x0001545d + .word 0xfff1bd02 + .word 0x000ae28d + .word 0x0001c4f9 + .word 0xfffe6385 + .word 0x0009488b + .word 0xfff18f83 + .word 0xfff4da0c + .word 0x000b0d4d + .word 0xfff9780e + .word 0xfff42e26 + .word 0xfffc7a3a + .word 0x0009d622 + .word 0x000e98a4 + .word 0x000bdb78 + .word 0xfff2ed32 + .word 0xfff54e51 + .word 0x000e76c8 + .word 0xfffce868 + .word 0x000e17a8 + .word 0xfff3b137 + .word 0xfff4bd2b + .word 0xfff8f4df + .word 0x0008b871 + .word 0x000e64cc + .word 0xfff3b481 + .word 0x000ca487 + .word 0xfff77a12 + .word 0x000fbbb2 + .word 0x0003b854 + .word 0xfff1bf88 + .word 0xfff571a8 + .word 0xfffa7f71 + .word 0x000bdaab + .word 0xfffaaa0a + .word 0xfff75c60 + .word 0x000d5b7f + .word 0xfff55065 + .word 0x0002a513 + .word 0xfffb6d97 + .word 0x000be5ca + .word 0xfff56800 + .word 0xfff76aad + .word 0xfff0b18f + .word 0x00042106 + .word 0xfff8b1fb + .word 0x000a7685 + .word 0x000fc2ff + .word 0xfff9b1af + .word 0xfff1a53d + .word 0x000d69fb + .word 0xfff693cc + .word 0x0002a40f + .word 0x000de3e7 + .word 0xfff80bdf + .word 0x00076ad5 + .word 0xfffdb692 + .word 0x0007616a + .word 0xfff16c67 + .word 0x0005c403 + .word 0xfff0d8c8 + .word 0x00035aa6 + .word 0x000b0cba + .word 0x00085723 + .word 0x000c4b02 + .word 0x0001a879 + .word 0xfff57222 + .word 0x000a7aa7 + .word 0x000f61fc + .word 0xfff8ef96 + .word 0x000075de + .word 0xfff955fd + .word 0xfffd5359 + .word 0xfffc37bf + .word 0xffff215b + .word 0x0006ca45 + .word 0xfff4a9ff + .word 0x000c1ccb + .word 0x000b5e2e + .word 0xfffd47e1 + .word 0x000a1ef8 + .word 0x000fb5a3 + .word 0xfffd5ad4 + .word 0xfff2de13 + .word 0xfff1e121 + .word 0x000ced9e + .word 0x000a98b9 + .word 0x0005c6d6 + .word 0x0005d165 + .word 0xfff630d7 + .word 0xfff5388c + .word 0x000d7ce3 + .word 0xfffc967f + .word 0xfffd038f + .word 0x00098595 + .word 0x000b7963 + .word 0x000ab299 + .word 0x00042cc7 + .word 0x0005ca5a + .word 0xfff90383 + .word 0x000fed8b + .word 0x000781ef + .word 0x00012c03 + .word 0x0007eb71 + .word 0x00020455 + .word 0x0000424b + .word 0x000ea943 + .word 0xfffd3713 + .word 0xffff78a6 + .word 0xffff7445 + .word 0x0000e7db + .word 0x000203e2 + .word 0xfff6bdba + .word 0x00099761 + .word 0xfffcbc52 + .word 0x0004a316 + .word 0x00079900 + .word 0x000f8a96 + .word 0x00049887 + .word 0x000240b4 + .word 0xfff1d111 + .word 0xfffb4f4a + .word 0x000bedb9 + .word 0xfffe3d75 + .word 0xfff3e12f + .word 0xfff7131c + .word 0xfff08be0 + .word 0xfff61f91 + .word 0x0008f28a + .word 0xfffcacf1 + .word 0xfff2086b + .word 0x00030609 + .word 0xfffe356a + .word 0xfffd4c3f + .word 0x000f4e3e + .word 0x0005edb2 + .word 0x0008d6c0 + .word 0x000f08df + .word 0xfff18a2b + .word 0xfffbc17f + .word 0x00095824 + .word 0xfff2fbd3 + .word 0xfff5e05a + .word 0x000dae40 + .word 0xfff2e9cb + .word 0xfff10149 + .word 0x00037f4e + .word 0x000fb80c + .word 0xfffc0656 + .word 0xfffc945c + .word 0xfff789f3 + .word 0x00062c91 + .word 0x00077ccb + .word 0x000a9fcd + .word 0xfff4264e + .word 0xfff39690 + .word 0xfffe77c0 + .word 0x000a9a7a + .word 0x00000206 + .word 0xfff8a0e3 + .word 0x000e44db + .word 0xfff9639c + .word 0x0002eb2c + .word 0xfffc5792 + .word 0x000bed14 + .word 0xfffebf1e + .word 0xfff6cf99 + .word 0xfff4ccf0 + .word 0x00051520 + .word 0x000dddb0 + .word 0xfff5839e + .word 0xfff5b5e9 + .word 0x00048fff + .word 0xfffdb3cc + .word 0xfffe37f3 + .word 0x000ae5bd + .word 0x0008bb2e + .word 0xfffb9281 + .word 0xfffc9a69 + .word 0x00061eba + .word 0x0003f605 + .word 0x00046d69 + .word 0xfff713f4 + .word 0xfff5ad81 + .word 0xfff88ded + .word 0x0007081d + .word 0x00057257 + .word 0x00038b60 + .word 0xfff991a5 + .word 0xfff3fb4d + .word 0xfff5893e + .word 0x000f40be + .word 0x000c7652 + .word 0xffff340c + .word 0xfffdfb45 + .word 0x000634c0 + .word 0x000e76dc + .word 0xfff5d1c2 + .word 0x00099e05 + .word 0xfff28926 + .word 0xfff09e32 + .word 0xfff60935 + .word 0xfff40b70 + .word 0xfff49c0b + .word 0x000978e8 + .word 0xfffd7c25 + .word 0xfffa271c + .word 0x0009d4a1 + .word 0xfffa1bd7 + .word 0x0001f93e + .word 0x000c9b40 + .word 0xfff3b8e9 + .word 0x00079329 + .word 0xfff8e2ae + .word 0x0004627c + .word 0xfff9acc6 + .word 0x00095674 + .word 0x000ef7e1 + .word 0x00087265 + .word 0x000d36a5 + .word 0xfff0c451 + .word 0xfff3f9fc + .word 0xfffba731 + .word 0xfff3b265 + .word 0xfff820c9 + .word 0x000141f7 + .word 0x000c6f23 + .word 0x0008b1bc + .word 0xfffe2512 + .word 0xfffc9f9d + .word 0xfff19106 + .word 0x000d57db + .word 0xfff0e824 + .word 0xfff0e39a + .word 0x00084abf + .word 0xfff2a815 + .word 0x00072fe5 + .word 0x000c9ca8 + .word 0xfff5d042 + .word 0xfff14504 + .word 0xfff5278f + .word 0x00071ed8 + .word 0xfffdbb61 + .word 0x000a8bdb + .word 0xfffdff34 + .word 0x00095b79 + .word 0x0007bfac + .word 0x0005df72 + .word 0x00009231 + .word 0xfff50a59 + .word 0x00064d77 + .word 0x00010b15 + .word 0x000e5ef8 + .word 0x0001e6a8 + .word 0x0008eefa + .word 0x0005c46d + .word 0xfff9289b + .word 0xfff1acca + .word 0x0009ded2 + .word 0x00030edd + .word 0x000dcab4 + .word 0xfffa9894 + .word 0xfff3f60e + .word 0xfffdcda1 + .word 0xfff79199 + .word 0x000103de + .word 0x0007645c + .word 0x000b90fc + .word 0xfffc907c + .word 0xfff88aa2 + .word 0xfff5fbb1 + .word 0x00080c4f + .word 0x000db931 + .word 0xfff5890a + .word 0x00049587 + .word 0xfff7618f + .word 0x000d5434 + .word 0x0003ff9f + .word 0x00047862 + .word 0xfff0ceaa + .word 0x0004eeda + .word 0xfff4c1c5 + .word 0x0006179d + .word 0x0000dc00 + .word 0xfff2d7ad + .word 0xfff7f85a + .word 0x00030efb + .word 0xfff78ddd + .word 0x000809e5 + .word 0x0003dd82 + .word 0x0009fb97 + .word 0xfff51eeb + .word 0x00002e68 + .word 0x000bba53 + .word 0xfff3df2b + .word 0xfff05cb9 + .word 0xfff2120d + .word 0x0003e04a + .word 0x000e6bab + .word 0xfff91ac8 + .word 0x0001a480 + .word 0xfffba67d + .word 0x000ae03e + .word 0xfffb3600 + .word 0x000dbae5 + .word 0x000ed78d + .word 0xffff5c90 + .word 0xfff8b232 + .word 0xfff1e4cf + .word 0x000e83be + .word 0x000088b1 + .word 0xfffdfd8f + .word 0x000efad3 + .word 0xfffccb73 + .word 0xfff7280f + .word 0x000ff53d + .word 0x000b0f57 + .word 0x0006dc94 + .word 0xfffe288d + .word 0xfffe0dad + .word 0xfff5888f + .word 0xfff1ede3 + .word 0xfff123dc + .word 0xfff3f81f + .word 0xfff18066 + .word 0x0001ba4f + .word 0x000bacd5 + .word 0x00091f34 + .word 0xffff2298 + .word 0x000d36c8 + .word 0x0003a324 + .word 0xfff54944 + .word 0xfff1c6be + .word 0xffffc770 + .word 0x00056bfe + .word 0x0009aba4 + .word 0xfff8d8b2 + .word 0xfffbda48 + .word 0x000eff56 + .word 0x00050418 + .word 0x00046800 + .word 0xfffee3f9 + .word 0xfffe830b + .word 0xfffe47f1 + .word 0xfff1914f + .word 0x00021b2e + .word 0xfff7d48c + .word 0xfff71b67 + .word 0xfff80291 + .word 0xfffa2632 + .word 0x0006f9cd + .word 0x000b86e6 + .word 0x0008e027 + .word 0x00011268 + .word 0xfff98a1e + .word 0xfff98e9b + .word 0x0004012b + .word 0xfffe329f + .word 0xfff1ff87 + .word 0x000bb030 + .word 0x0008a508 + .word 0x000d5db9 + .word 0xfff40a7f + .word 0x0000d5c9 + .word 0x000e0c67 + .word 0x000cb562 + .word 0x00031ab7 + .word 0x0004e527 + .word 0xfff027a8 + .word 0xfff37385 + .word 0xfff05079 + .word 0xfff775cc + .word 0xfff4b5b5 + .word 0x0001846c + .word 0xfffd41b0 + .word 0xfff5b3ba + .word 0xfff523bc + .word 0xfff1fa00 + .word 0x0009c785 + .word 0xfffbaaa8 + .word 0xfff0b55d + .word 0xfffd8a69 + .word 0xfffc4ea1 + .word 0xfff6c088 + .word 0x000dd938 + .word 0xfff6d44d + .word 0x00040a6e + .word 0x0001ba17 + .word 0xfffdfdf0 + .word 0x000e52fe + .word 0xffff36c2 + .word 0x000a8642 + .word 0xfff4acbd + .word 0xfff36906 + .word 0xfff71566 + .word 0x00002c1d + .word 0xfff0fac4 + .word 0xfffecd63 + .word 0x00016329 + .word 0xfff29bed + .word 0x0006f43d + .word 0x000361f3 + .word 0xfffa4d5f + .word 0xfff5ef06 + .word 0xfffeb605 + .word 0x000a3dcd + .word 0x0006ec1f + .word 0x000054da + .word 0xfffe699f + .word 0xfffab0aa + .word 0xfffa56b0 + .word 0x00016f6e + .word 0x000f44bd + .word 0x000246a7 + .word 0x000d749b + .word 0x000f2753 + .word 0x000babf4 + .word 0xfffbabdd + .word 0xfff7bef8 + .word 0x000b8106 + .word 0x0003c3a4 + .word 0x00030908 + .word 0x000feeb6 + .word 0x000266ac + .word 0x0008ba1b + .word 0x000c49b0 + .word 0xfffce4a0 + .word 0x000e7572 + .word 0xfffda456 + .word 0xffff6197 + .word 0x00046a89 + .word 0xfff88e7c + .word 0x00036b06 + .word 0xfffa0f4e + .word 0x0009b81a + .word 0xfff8cd32 + .word 0x000315ee + .word 0x000ecb25 + .word 0x00050fb8 + .word 0x0009ba33 + .word 0x000b25f0 + .word 0x0006e456 + .word 0xfff61fee + .word 0x00014164 + .word 0xfff9d4fc + .word 0x00089fba + .word 0x000e8ae8 + .word 0xfffd5739 + .word 0xfff290d6 + .word 0x000374ee + .word 0x00034914 + .word 0xfffecbad + .word 0x0004567a + .word 0xffff696f + .word 0x000a48df + .word 0xfffa0b2a + .word 0xfff97651 + .word 0xfff08d7a + .word 0x000b37d3 + .word 0x0007457e + .word 0xfffa32f0 + .word 0x000dc109 + .word 0xfff6d99c + .word 0x000f6948 + .word 0xfff4a1c3 + .word 0xfff772ef + .word 0xfff73d4f + .word 0xfff6fe8b + .word 0x0002d516 + .word 0xfff771f9 + .word 0xfffd70d7 + .word 0x00070eae + .word 0x00076656 + .word 0xfff2e5ca + .word 0x0002d37c + .word 0x000886b1 + .word 0xffffdc0e + .word 0x0003e2eb + .word 0xfffb6d41 + .word 0xfffc20eb + .word 0xfff98318 + .word 0x000721f5 + .word 0xfff3334d + .word 0x000fff03 + .word 0x0003a286 + .word 0x000d5267 + .word 0xfffc8aaa + .word 0x000aac0e + .word 0xfff36d40 + .word 0x00078e69 + .word 0xfff2943b + .word 0x000d7bf9 + .word 0x00021c39 + .word 0xfff2c1f4 + .word 0xfffe6f7b + .word 0xfff67e2a + .word 0x0003024e + .word 0x000cefa9 + .word 0xfffe9376 + .word 0x00021721 + .word 0x00008f74 + .word 0x00028bc4 + .word 0xfffcaf3c + .word 0x0009b660 + .word 0xffffc955 + .word 0x00085131 + .word 0x0006ee13 + .word 0xffffa838 + .word 0xfffb4680 + .word 0xfffec8ab + .word 0xffff74ea + .word 0xfff86c7c + .word 0xfff125ba + .word 0x0002961e + .word 0xfffdf112 + .word 0x00048ff6 + .word 0xfff81caa + .word 0xfff19e7d + .word 0xfffb2920 + .word 0x00045d8e + .word 0x00077c00 + .word 0x000093ed + .word 0xfff366ff + .word 0xfffaac21 + .word 0xfff80188 + .word 0x000d12b3 + .word 0xfff73233 + .word 0xfff4b09e + .word 0xfffd6f04 + .word 0x0006f6d9 + .word 0xfff2265d + .word 0xfffcc023 + .word 0x0000a81d + .word 0xfff7eba4 + .word 0x00011b01 + .word 0xfffea5ec + .word 0x0001b464 + .word 0x00053209 + .word 0xfff01f26 + .word 0xfffd46fe + .word 0xfff7c33d + .word 0x00060700 + .word 0x000464c8 + .word 0xfff7444a + .word 0xfff6336e + .word 0x000a3495 + .word 0xfffae5c2 + .word 0xfff568e6 + .word 0xfff296e3 + .word 0x000a6ab1 + .word 0x0005aad7 + .word 0x0001e4d1 + .word 0xfffb6b00 + .word 0xfffdaa75 + .word 0xffff3e67 + .word 0x0005de88 + .word 0xfff0ccd5 + .word 0x000de358 + .word 0x000fb998 + .word 0x000c91f9 + .word 0x000c0ff6 + .word 0xfff82af0 + .word 0xfff4b293 + .word 0x00087d8d + .word 0x000f7140 + .word 0x00027d40 + .word 0xfff6cf38 + .word 0x000fd33f + .word 0x0002fe89 + .word 0x0006b919 + .word 0x0005bdab + .word 0x000fb9ba + .word 0x000ac585 + .word 0x0009f41d + .word 0xfff3c48e + .word 0x00001ca9 + .word 0xfff088c4 + .word 0x000ac604 + .word 0x000c2cd5 + .word 0xfff7fa11 + .word 0x000b2715 + .word 0xfff0875b + .word 0x000edaea + .word 0xfffa30a3 + .word 0xfff81576 + .word 0xfff88328 + .word 0xfffbdb3b + .word 0xfffade6f + .word 0xfffb182e + .word 0xfff8f4f4 + .word 0x0006eaf5 + .word 0x000c82ae + .word 0x0006dfb2 + .word 0xfff91a9e + .word 0xffffee5b + .word 0xfff1f78e + .word 0x000efe20 + .word 0xfff576c9 + .word 0x00089d7f + .word 0x000bc666 + .word 0x0005af73 + .word 0x0006b7db + .word 0x0007e8f7 + .word 0x000af723 + .word 0x00092927 + .word 0x000e4c7d + .word 0xfff1ecac + .word 0xffff1b91 + .word 0xfff39f08 + .word 0x000485c6 + .word 0xfff2fb00 + .word 0xffffe95c + .word 0xfff00cb3 + .word 0xfff01b4d + .word 0xfffb820f + .word 0x000bdf40 + .word 0x000e1f60 + .word 0x000fef5b + .word 0xfffd0390 + .word 0xfffc8c1b + .word 0xfff8f00b + .word 0xfffcde23 + .word 0x00028ef4 + .word 0x0005d0c4 + .word 0xfffc7676 + .word 0x000dbe3a + .word 0xffff4e54 + .word 0x000358e6 + .word 0xfff6cfb8 + .word 0xfffb516f + .word 0xfffc968a + .word 0x000a8bf8 + .word 0xfffa34e2 + .word 0x000b8757 + .word 0xfffdeb68 + .word 0xfffe4d2c + .word 0x000810e6 + .word 0xffff51df + .word 0xfffc6948 + .word 0x000e6cf0 + .word 0x000ba09f + .word 0xfffb1b7b + .word 0x000d5530 + .word 0x00053c90 + .word 0x000ff451 + .word 0x000f44b1 + .word 0x0008aa61 + .word 0xfffce83e + .word 0x00090e07 + .word 0x0007a67c + .word 0x0009d297 + .word 0x00099ecc + .word 0x0009aa31 + .word 0x00004ca3 + .word 0xfffd23cb + .word 0xfff0f19c + .word 0x000e1688 + .word 0xfffa840b + .word 0xfff6c04e + .word 0xfffc44d0 + .word 0xfffe4c98 + .word 0x00020d82 + .word 0x0005fc7a + .word 0x0003eee8 + .word 0xfffdbb88 + .word 0x0009a5c9 + .word 0x000ccba9 + .word 0xfffa8a04 + .word 0x0006d7aa + .word 0x000e87bc + .word 0x000f281a + .word 0xfff47129 + .word 0x000575a7 + .word 0xfffe96bf + .word 0x000f31ff + .word 0x000d8ce0 + .word 0xfff21433 + .word 0xfffa55b0 + .word 0x00092420 + .word 0x0004e83e + .word 0x0006280b + .word 0x0001907e + .word 0xfff4575b + .word 0xfff2af16 + .word 0x0002f532 + .word 0x0005afae + .word 0xfff61bec + .word 0xfff4b99c + .word 0xfff86ef6 + .word 0xfff07f9c + .word 0x000476f6 + .word 0x0002a52e + .word 0x000c3927 + .word 0x000f60b8 + .word 0x0004eb45 + .word 0x0003c542 + .word 0xfffe18a9 + .word 0xfff2f994 + .word 0xfff9cf8c + .word 0x00018a11 + .word 0x0005936d + .word 0xfff34dc0 + .word 0xfff80154 + .word 0x0004456e + .word 0x0002b630 + .word 0x0008af36 + .word 0xfffb67db + .word 0xfff37c02 + .word 0xfff72d71 + .word 0x000555a3 + .word 0xfff1317d + .word 0x000338b6 + .word 0x000b4d7d + .word 0xfff6dc87 + .word 0xfffec594 + .word 0xfff99e55 + .word 0x000201a2 + .word 0xfff46763 + .word 0xfff27409 + .word 0x0001fd6b + .word 0xfff971e6 + .word 0xfffa4cec + .word 0xfffeec6c + .word 0x0007ce69 + .word 0x000f05e4 + .word 0x000adb01 + .word 0x0002d0f7 + .word 0xfffe3eda + .word 0xfff47e1f + .word 0x00068f78 + .word 0x0004dcca + .word 0x00077de9 + .word 0xfffeaee7 + .word 0x000661c5 + .word 0xfff38534 + .word 0x000e6560 + .word 0x000526ca + .word 0xfffd2ac2 + .word 0xfffbbf88 + .word 0x00042238 + .word 0xfffc98d8 + .word 0x00085aab + .word 0x000bb1c5 + .word 0x000f334a + .word 0x00098c52 + .word 0xfffbda0b + .word 0xfffe7f87 + .word 0xfff392ee + .word 0xfff662ca + .word 0x000ceea5 + .word 0xfff41aab + .word 0x000ad0e3 + .word 0x00077010 + .word 0x000fdddd + .word 0xfffd8a13 + .word 0x000a5b99 + .word 0x00056203 + .word 0x00087a8e + .word 0xfff688c3 + .word 0x000dd6a1 + .word 0x000fc187 + .word 0x000637e4 + .word 0xfff46c38 + .word 0x000713ac + .word 0xfffd82fb + .word 0xfff2f653 + .word 0x000cf74d + .word 0x000f71cf + .word 0xfff96e0e + .word 0x000c697a + .word 0xfff481f3 + .word 0xffff0542 + .word 0x000ac5c7 + .word 0x00036e41 + .word 0xfffb73cf + .word 0xfff27b7c + .word 0x0000b607 + .word 0xfff4bae4 + .word 0x00027a71 + .word 0x0005ae7f + .word 0xfff040cd + .word 0xfffcfddb + .word 0x000bb537 + .word 0x00032a3e + .word 0xfffbb723 + .word 0x0004ae2e + .word 0x0002ab32 + .word 0x0007e78d + .word 0xfff997b3 + .word 0x00042b92 + .word 0xfffc2a7c + .word 0x000d617b + .word 0xfffb9981 + .word 0xfffd28e9 + .word 0xfff95d4e + .word 0xfffed0a3 + .word 0x00056be2 + .word 0xfff8b230 + .word 0xfffd2efe + .word 0x0004ccd6 + .word 0xfffdcd4c + .word 0x000e70cd + .word 0xfff9cd2d + .word 0x00032cac + .word 0x00001355 + .word 0xfffd13a6 + .word 0xfff2a8f9 + .word 0x00080eb2 + .word 0xfff4e45b + .word 0xfff5b078 + .word 0x000ad479 + .word 0x000187fb + .word 0xfff665a9 + .word 0xfff25eb6 + .word 0xfff507d0 + .word 0x0001e12b + .word 0xfffa6dc7 + .word 0xfff37487 + .word 0xfff3554a + .word 0x000e49cc + .word 0xfff05284 + .word 0x00075084 + .word 0xfff25088 + .word 0x000d51c0 + .word 0x00034572 + .word 0x0000aa0d + .word 0x000180f9 + .word 0xfff5973d + .word 0xfffcfcf3 + .word 0xfff23524 + .word 0xfffae649 + .word 0x000b60a9 + .word 0x00069cb2 + .word 0x000ce3d0 + .word 0xfff935a5 + .word 0x0004be9a + .word 0x000656fd + .word 0x00055950 + .word 0x0007c519 + .word 0xfff74b3e + .word 0x000a588c + .word 0xfff1b9e0 + .word 0x0006ef6f + .word 0xfff7c163 + .word 0x0000d327 + .word 0x0008fe74 + .word 0x000014c6 + .word 0xfffb4317 + .word 0xfff7b6a5 + .word 0x00083d0d + .word 0xfff1fa4c + .word 0xfffac43a + .word 0xfffe8ead + .word 0xfff88c8e + .word 0x000d0822 + .word 0x000d8aa8 + .word 0xfffead1e + .word 0xfffb237a + .word 0x000a8a5e + .word 0xffffb233 + .word 0x0004bf53 + .word 0x000095bf + .word 0xfffddee6 + .word 0x00061a5f + .word 0x00087139 + .word 0xfff2b522 + .word 0xfff20f31 + .word 0x0005c33e + .word 0xfff68fd7 + .word 0x000ef784 + .word 0x00090d51 + .word 0x000d386a + .word 0x00022e33 + .word 0x000c4fc0 + .word 0x00026a31 + .word 0xfffed6e8 + .word 0x00045daa + .word 0x00093244 + .word 0xfff96578 + .word 0x0008f054 + .word 0x000d70f0 + .word 0x000d690c + .word 0xfff8ec37 + .word 0x0000ba4a + .word 0xfff5621a + .word 0x00059d98 + .word 0x0008a2d0 + .word 0x000e345d + .word 0xfffb0390 + .word 0xfff62d76 + .word 0xfffff2c3 + .word 0x0006c0a5 + .word 0xfff5c0d2 + .word 0x0007b592 + .word 0xfffec329 + .word 0xfff30fe8 + .word 0xfffa3c68 + .word 0xfff34b80 + .word 0x0006965a + .word 0x00063d43 + .word 0x000aebe6 + .word 0xfffdda71 + .word 0xfffe5d44 + .word 0x000119c4 + .word 0xffff111f + .word 0x00024c02 + .word 0x00023590 + .word 0x000db196 + .word 0xfffe22a4 + .word 0xfff2d491 + .word 0xfff1d6bd + .word 0x00037576 + .word 0x000cf9b2 + .word 0x0004d6ec + .word 0xfffa13b6 + .word 0xfff69d62 + .word 0xfffc9519 + .word 0x000bc0d4 + .word 0x000f301c + .word 0xfff04806 + .word 0xfffd98ef + .word 0xfffe9df9 + .word 0x0006dc57 + .word 0xfff5ffed + .word 0x00002457 + .word 0xfff8bf3c + .word 0x000fe28e + .word 0xfff0b428 + .word 0xfff98a96 + .word 0xfff0384e + .word 0x00079353 + .word 0x000c92e1 + .word 0xfff5ff09 + .word 0xfffbfaac + .word 0xfff8e346 + .word 0x00094e38 + .word 0x000eb4b4 + .word 0x000fcb45 + .word 0x0008a255 + .word 0xfff75393 + .word 0x000de2a5 + .word 0xfffc8c2f + .word 0xfff3957c + .word 0xfff663dd + .word 0xfff8d4c9 + .word 0x000e1d45 + .word 0x00032fd0 + .word 0xfffca700 + .word 0xfffb1af8 + .word 0x00017af6 + .word 0x000b61af + .word 0xfff1757f + .word 0x0002c85d + .word 0xfff0d222 + .word 0x0001ffbb + .word 0xfffb92d3 + .word 0xfff75f79 + .word 0xfff64927 + .word 0x000a4682 + .word 0xfff8f1b2 + .word 0x0003a15d + .word 0x00032615 + .word 0x00062845 + .word 0xfffa6c0b + .word 0x000e2303 + .word 0x00073dca + .word 0x00011ab4 + .word 0x000d5e2f + .word 0xfffb4082 + .word 0xfff140e5 + .word 0xfffc1368 + .word 0xfff787c0 + .word 0x0001575c + .word 0xfffce02e + .word 0xfff5f21a + .word 0xfffbdffc + .word 0x000afb33 + .word 0x000a15cf + .word 0xffff8d83 + .word 0x000a3b54 + .word 0xfff7f6fd + .word 0xffffb769 + .word 0x000f1e56 + .word 0xfff650dc + .word 0x00078a4a + .word 0x0001c92d + .word 0x000eaa0f + .word 0x00069e95 + .word 0x000ad3f8 + .word 0x000198d8 + .word 0x0009686e + .word 0x000a444f + .word 0x00078e11 + .word 0x0001351f + .word 0xfff1ee0a + .word 0x0000729e + .word 0x000a93c7 + .word 0x000c3238 + .word 0xfffe092e + .word 0xfff7399e + .word 0x00086622 + .word 0xffffd39b + .word 0x000fcf12 + .word 0xfff63e45 + .word 0x0001b7a5 + .word 0xfffddf56 + .word 0xfff0869e + .word 0x000c6564 + .word 0xfffc8c9d + .word 0xfff5ba55 + .word 0xfff98ce5 + .word 0xffff674f + .word 0xfff9d9fd + .word 0xfffc8118 + .word 0xffffb089 + .word 0x00010146 + .word 0xfffe8d2b + .word 0xfff6be75 + .word 0xfffaaf93 + .word 0x000effa2 + .word 0xfffc5135 + .word 0x000e9695 + .word 0xfff72e56 + .word 0xfffbb7f0 + .word 0xffff86db + .word 0xfffeb411 + .word 0x000d050f + .word 0x00080d5b + .word 0xfff51892 + .word 0xfffd0170 + .word 0xfff66496 + .word 0xfff7e453 + .word 0xfff99c3a + .word 0x000620f8 + .word 0x000ae99f + .word 0x000cb41d + .word 0x000ed55b + .word 0x000d783e + .word 0x000b61b3 + .word 0xfff995ab + .word 0x00028029 + .word 0x000b362e + .word 0x00000f4f + .word 0x000a3c1a + .word 0xfffa4cc2 + .word 0xfffac078 + .word 0xfff52b72 + .word 0xfff0822b + .word 0xfff9caad + .word 0xfff3ccec + .word 0x000e8837 + .word 0xfff68c59 + .word 0x000479a2 + .word 0x00029a7b + .word 0xfff2bf9b + .word 0x00030f85 + .word 0xfff1a703 + .word 0x00055f8c + .word 0x00055fbe + .word 0xfff56b7b + .word 0x0003d37e + .word 0x000b429e + .word 0x0000f8ac + .word 0x000d0299 + .word 0xffffc722 + .word 0xfff06c3a + .word 0xfffa5f24 + .word 0x0009e463 + .word 0x000f4554 + .word 0xfff30684 + .word 0x000934a5 + .word 0x000f4dda + .word 0x00016b37 + .word 0xfffe6044 + .word 0xfff11c72 + .word 0x00076427 + .word 0x0001113c + .word 0xfff49701 + .word 0x000982ce + .word 0x0005d977 + .word 0x000d798b + .word 0x0003c0e3 + .word 0xfffc5e29 + .word 0x000dfe9b + .word 0xfffccd20 + .word 0xfff4d077 + .word 0x000b3365 + .word 0x0008bc29 + .word 0x000f80d2 + .word 0xfffb153c + .word 0x0002ff86 + .word 0x000d194d + .word 0x000a8119 + .word 0x00039b13 + .word 0xfff3ba3f + .word 0x000d2f8c + .word 0xffffda1d + .word 0x0000520f + .word 0x000637ef + .word 0xfff6ed5c + .word 0x000b6aa3 + .word 0x000787ad + .word 0x000ccb10 + .word 0x00090991 + .word 0x0009323d + .word 0x000a5b9b + .word 0xfffa3d76 + .word 0xfff4ea4b + .word 0xfff9b9f5 + .word 0xfffb6c4e + .word 0xfff1d2aa + .word 0x0003767e + .word 0xfffcd2e9 + .word 0x00001092 + .word 0x000c4f57 + .word 0xfff4bd08 + .word 0x0008032f + .word 0x0008b816 + .word 0xfffbb70f + .word 0xfff220c6 + .word 0xfff336f5 + .word 0xfff4e1b1 + .word 0xfffae431 + .word 0xfffa3914 + .word 0xfff79624 + .word 0x000a6677 + .word 0xfffdfeea + .word 0xfffb979c + .word 0x000acff7 + .word 0x000008b0 + .word 0x000b008a + .word 0xfffa8e2b + .word 0xfffea454 + .word 0xfffe2426 + .word 0x0002f7fe + .word 0xfffcfd69 + .word 0xfff27b09 + .word 0xfffcac93 + .word 0xfff16593 + .word 0x0004c968 + .word 0x0002817e + .word 0x0001e495 + .word 0x000d24d8 + .word 0x000bc8db + .word 0xfffe6c8c + .word 0x000055b1 + .word 0xffff3668 + .word 0x000b86b7 + .word 0x000cde82 + .word 0x000d4cf0 + .word 0x00010f1e + .word 0xfffa03a7 + .word 0x00049371 + .word 0x000f8d44 + .word 0x00093497 + .word 0x000c287a + .word 0xfff57318 + .word 0x00099c7b + .word 0xfff6f968 + .word 0xfff2bbd1 + .word 0x000a6fe6 + .word 0x00022eaa + .word 0xfff4aa49 + .word 0x00020249 + .word 0x000bb62e + .word 0x000660d1 + .word 0xfff95364 + .word 0x0008230a + .word 0x00081732 + .word 0x0000f1f0 + .word 0xfff01e9e + .word 0x000ba684 + .word 0xfff3bd0c + .word 0xfffdaea2 + .word 0xfff9436f + .word 0x000d6a61 + .word 0x000f42fb + .word 0xfff81f50 + .word 0xfffb041e + .word 0xfffb9cbd + .word 0xfffe87f7 + .word 0xfffc8d26 + .word 0x00031c5b + .word 0xfffccd2a + .word 0xffffc4ed + .word 0xfff3c530 + .word 0x00050bc9 + .word 0xffff2d4d + .word 0xfffd2450 + .word 0xfff0d71d + .word 0x000de876 + .word 0x00083660 + .word 0xfff0d00c + .word 0xfff6c276 + .word 0xfff044b3 + .word 0xfffa153b + .word 0xfff6735c + .word 0xfff4d711 + .word 0xfff30cf2 + .word 0xfff7e596 + .word 0xfffa2e7f + .word 0x000385ae + .word 0xfff18bb7 + .word 0xfff6e16c + .word 0xfff9c053 + .word 0xfff3efde + .word 0x000b2120 + .word 0x000b5ae9 + .word 0x00080c48 + .word 0xfffc88e2 + .word 0x0009bce0 + .word 0xfffd04be + .word 0xfff2b7c6 + .word 0xfff8403b + .word 0x000522ec + .word 0xfffebe9a + .word 0x000c7799 + .word 0xfff680a1 + .word 0xfff234f7 + .word 0xfffbe6b9 + .word 0xfffa355c + .word 0x00006c57 + .word 0xfffbcf40 + .word 0xfff0a00b + .word 0xfffe61e3 + .word 0x0003b2a4 + .word 0xfff95627 + .word 0x0000a334 + .word 0x0008a15f + .word 0xfff007cb + .word 0xfffa281e + .word 0xfffdb967 + .word 0xfff41308 + .word 0x000e1050 + .word 0x000b6513 + .word 0xfff0e29f + .word 0x0000fe76 + .word 0x000b2bc3 + .word 0xfffe7ffd + .word 0xfffa099b + .word 0x000ffbbb + .word 0x0002f57a + .word 0xfffcee60 + .word 0x0006a2e5 + .word 0xfff74b08 + .word 0xfff3db8d + .word 0xfffde267 + .word 0xfffe9b62 + .word 0x00035a88 + .word 0xffffca8f + .word 0xfff398d6 + .word 0x0005478c + .word 0x000dc2ea + .word 0xfffcbcaa + .word 0x0003dd73 + .word 0x000e4940 + .word 0x0000a737 + .word 0xfff3781b + .word 0xfffdae36 + .word 0x000675a4 + .word 0xfffb2e50 + .word 0xfff73c48 + .word 0xfffe9eda + .word 0x00049418 + .word 0xfff6f864 + .word 0x000f6914 + .word 0xfffa47a5 + .word 0x000830bc + .word 0x00002b62 + .word 0xfff0ef01 + .word 0xfffd498d + .word 0x0008a68a + .word 0x000944a8 + .word 0x000a2a9c + .word 0xfff99e79 + .word 0xfffe16a7 + .word 0xfff1590e + .word 0xfffd827e + .word 0x000a1279 + .word 0xfffc759f + .word 0x000c4f71 + .word 0x000ca987 + .word 0xfff97b72 + .word 0x0001059f + .word 0xfff17f72 + .word 0xfffcc417 + .word 0x0009bf2e + .word 0x000cb4c9 + .word 0xfffedca8 + .word 0xfffa6388 + .word 0xfff75520 + .word 0xfffc6060 + .word 0xfff8ecb8 + .word 0x00089002 + .word 0x0000311c + .word 0x00020cf3 + .word 0x000f0af1 + .word 0xfff5555b + .word 0x000f08d8 + .word 0x000f8878 + .word 0x000739ab + .word 0x000f249f + .word 0xfffadc40 + .word 0x0000c426 + .word 0x000be28a + .word 0xfff9cb37 + .word 0x00024a68 + .word 0xfff913ad + .word 0x0002934b + .word 0x0007e854 + .word 0xfff34e77 + .word 0x0009e593 + .word 0x000a5453 + .word 0xfff15b4e + .word 0xffff9c45 + .word 0x0007adc0 + .word 0xfff7a31c + .word 0x00093889 + .word 0xfff5bd50 + .word 0x00005c93 + .word 0x000e5097 + .word 0xfffe2867 + .word 0xfffaaf0b + .word 0xfffaffc1 + .word 0x00038c07 + .word 0x0008cf36 + .word 0x00036b55 + .word 0xfff0dab2 + .word 0x000e131e + .word 0xfff97a1d + .word 0xfff0ca26 + .word 0xfff6a026 + .word 0xfff40ef2 + .word 0xfffbe90c + .word 0xfffb4e2d + .word 0xfff9a595 + .word 0xfffb3b3d + .word 0x000045f8 + .word 0xfffd6427 + .word 0xfff15264 + .word 0x0009ef18 + .word 0x0002a35d + .word 0x000b53e8 + .word 0xfff9f315 + .word 0xfff2cb57 + .word 0x00067ae2 + .word 0xfff55bf0 + .word 0xfff4cabd + .word 0x000cb808 + .word 0xfff5ad73 + .word 0xfffd225d + .word 0xffff7c1c + .word 0xfffa2129 + .word 0x000175bb + .word 0xfff72d4d + .word 0xfff8c661 + .word 0xfffad917 + .word 0x00002bdb + .word 0x000b0ac5 + .word 0x000ed206 + .word 0xfff356e0 + .word 0xfff71b02 + .word 0xffffbbf3 + .word 0xfffa7aba + .word 0x000461a6 + .word 0x000d6f60 + .word 0xfff7ec8b + .word 0xfff5405d + .word 0x000a3837 + .word 0x000932b3 + .word 0xfff523d7 + .word 0x0007039b + .word 0xfff1b35d + .word 0xfff96d60 + .word 0xfff64383 + .word 0xfff3a486 + .word 0x000d424c + .word 0x000e6530 + .word 0x000209d6 + .word 0xfff3536b + .word 0x000e2fe9 + .word 0x000ba42f + .word 0xfffc1394 + .word 0xfff6e8b8 + .word 0x000f024f + .word 0x00049cf4 + .word 0x0000aa8c + .word 0xfff3717d + .word 0xfff14bb7 + .word 0xfff31190 + .word 0xfffddd0a + .word 0xfffff24c + .word 0x000eb0cc + .word 0x0002bd6a + .word 0x00005161 + .word 0x00053475 + .word 0x00041133 + .word 0xfff76738 + .word 0xfffa42b3 + .word 0x000820b2 + .word 0x0008c651 + .word 0xfffcb659 + .word 0xfff99e09 + .word 0xfff00bd2 + .word 0x00085dbc + .word 0xfff34045 + .word 0xfff39dbf + .word 0x000ced26 + .word 0x000e8c23 + .word 0xfff967fa + .word 0x0006f5e1 + .word 0x000f6eb5 + .word 0xfff1538e + .word 0x000c7320 + .word 0x00037995 + .word 0x0000ffa2 + .word 0xfff9be9b + .word 0x000ba1f8 + .word 0xfffb2c10 + .word 0x000f2aac + .word 0xfffce979 + .word 0x00001068 + .word 0xffffb62a + .word 0xfff9b46c + .word 0xfff40de1 + .word 0x0004befc + .word 0xfff608a2 + .word 0xfff7ea3d + .word 0xfff62f39 + .word 0xfff4efea + .word 0x00003e16 + .word 0x0001c020 + .word 0x00088f8d + .word 0xfffcaacb + .word 0x000106e5 + .word 0xfff6cbd6 + .word 0xfffb6fe1 + .word 0x0000da63 + .word 0xfff6e3f3 + .word 0xfff2f544 + .word 0xfff342eb + .word 0x0006f971 + .word 0xfff626a0 + .word 0xfffad6bf + .word 0x0006b0e0 + .word 0xfff6c0fb + .word 0xfffa5f46 + .word 0x00012130 + .word 0xfff7c1f3 + .word 0x00001cbc + .word 0xfff7351c + .word 0xfff9ad7b + .word 0xfff59117 + .word 0x00040db5 + .word 0x000c729c + .word 0xfffcc979 + .word 0x000f1d7b + .word 0xfff26efa + .word 0xfffe8bb4 + .word 0xfffb6193 + .word 0x00086616 + .word 0xfff7ab3e + .word 0x000c0e73 + .word 0xfff7f14a + .word 0xfff5d7b8 + .word 0xfff36f77 + .word 0xfffff4d7 + .word 0xfff1a83d + .word 0xfff6b592 + .word 0x0004ef53 + .word 0xfffc238d + .word 0xfff0325e + .word 0x00003cb1 + .word 0x0001c363 + .word 0x000607b1 + .word 0xfffab0c4 + .word 0x0000f24e + .word 0xfffff362 + .word 0xfffcbd09 + .word 0x0005e08a + .word 0xfff9053b + .word 0x0008b2b9 + .word 0x0005efb2 + .word 0x000ffdc7 + .word 0xfff29b3b + .word 0x000e560c + .word 0xfff2cf55 + .word 0x00067c9c + .word 0xfff07ca0 + .word 0x000e3287 + .word 0x000a3b92 + .word 0x00012f97 + .word 0xfffbd9cd + .word 0x00087bbb + .word 0xfffc422e + .word 0x000a07c3 + .word 0xfffe3c1c + .word 0x00050435 + .word 0xfff033e8 + .word 0xfff3dc80 + .word 0xffff0fcd + .word 0xfff10f52 + .word 0xffffc3f3 + .word 0xfff55949 + .word 0xfff35764 + .word 0x0004e585 + .word 0xfff95dad + .word 0xfff1538e + .word 0xfff4ba2a + .word 0x0005a42f + .word 0x0009d9ad + .word 0x000ccf04 + .word 0xfff0841b + .word 0xfff63b21 + .word 0x0003b5fa + .word 0x00064817 + .word 0x0007629d + .word 0xfff41f05 + .word 0xfff1b83b + .word 0xfffa251c + .word 0x00015ba4 + .word 0xfffa16cd + .word 0xfff3d14d + .word 0x000a106c + .word 0xfff461d3 + .word 0xfffea1a6 + .word 0xfff09b3a + .word 0xfff026a9 + .word 0x000d23e4 + .word 0xfffd2306 + .word 0xfffe73e1 + .word 0xffff82ac + .word 0xfff74575 + .word 0xffffdd31 + .word 0xfffc8ae1 + .word 0x00022bf8 + .word 0x000995eb + .word 0x00029f6c + .word 0xfff9757f + .word 0x0003e069 + .word 0x0006b2da + .word 0x0007a45f + .word 0xfff2f01a + .word 0xfff3ac4e + .word 0xfffc084d + .word 0xfff938eb + .word 0xfffe0e87 + .word 0xfff01729 + .word 0xfff951e1 + .word 0xfff57ce8 + .word 0xfff2e41f + .word 0x000868cb + .word 0x00080f60 + .word 0x00025967 + .word 0x000a1936 + .word 0xfff6a518 + .word 0xfff5b375 + .word 0xfff45268 + .word 0x0001452c + .word 0x00048ff6 + .word 0xfff44912 + .word 0x0008c639 + .word 0x00098849 + .word 0x000bb4f0 + .word 0xfff8f6c5 + .word 0xfffdbdbd + .word 0xfff123ae + .word 0xfffa3b88 + .word 0xfff5bfcd + .word 0xfff19220 + .word 0xfff65ba6 + .word 0x0008f235 + .word 0xfffb19ad + .word 0xfffd42a7 + .word 0x00030893 + .word 0x00080ce0 + .word 0xfff06852 + .word 0x0008eb17 + .word 0x000732f7 + .word 0x00038df3 + .word 0xfff12950 + .word 0xffff7525 + .word 0xfffac2f9 + .word 0xfffb04d7 + .word 0x00006156 + .word 0x00000d87 + .word 0xfffff962 + .word 0xfffccba0 + .word 0xfff1add0 + .word 0xfffccc4a + .word 0xfffb278b + .word 0x000c75ed + .word 0xfff6b150 + .word 0xffff81a4 + .word 0xfff51f30 + .word 0xfff0919d + .word 0x00083ae1 + .word 0x000e05e1 + .word 0xfffc6d37 + .word 0xfffe3401 + .word 0x000a332c + .word 0xfff65aca + .word 0xfff17632 + .word 0xfff82932 + .word 0xfff382f2 + .word 0xffff9fd5 + .word 0xfff336e9 + .word 0xfffe8872 + .word 0xfff322bd + .word 0x000cc099 + .word 0x0001c1d9 + .word 0x0002a062 + .word 0x00075f12 + .word 0x00066eb1 + .word 0xfff78695 + .word 0xfff5cfd8 + .word 0xfff78804 + .word 0x00008dbd + .word 0x0005e397 + .word 0xfff06422 + .word 0x0001cead + .word 0x000d8a31 + .word 0x0007d48e + .word 0xfff164a4 + .word 0x000558f9 + .word 0x00011d3e + .word 0xfff5a3d2 + .word 0xfff1fc22 + .word 0xfff6c014 + .word 0xfff15af1 + .word 0xffffef1d + .word 0xfff2db88 + .word 0xfffeeca8 + .word 0xfff7fabc + .word 0xfff3dc86 + .word 0xfffb4005 + .word 0x0008a4ca + .word 0xfff0da7c + .word 0x0005d00a + .word 0x0005e55e + .word 0x0003e750 + .word 0x000a06bf + .word 0xfff8d996 + .word 0x000d3934 + .word 0xfffac985 + .word 0x000a3ca2 + .word 0xfffc8b21 + .word 0xfffd6131 + .word 0x000b4f9b + .word 0x0007642c + .word 0x00009908 + .word 0x00029871 + .word 0x00046ad1 + .word 0x000fd1b6 + .word 0xfff5b1c5 + .word 0xfffb6783 + .word 0xfff29ffd + .word 0x000acc11 + .word 0xfff42a95 + .word 0x0006b100 + .word 0xfffc0757 + .word 0xffffda10 + .word 0x000a7fc1 + .word 0xfff56194 + .word 0xfff6c2fb + .word 0xfffaee01 + .word 0x0005188a + .word 0xfff3ba02 + .word 0xfffa115e + .word 0x000539ac + .word 0xfffb241b + .word 0x0006fc8e + .word 0xfff1b741 + .word 0xfff8e117 + .word 0xffff9d56 + .word 0x000adcff + .word 0xfff40172 + .word 0x000054ac + .word 0x000f8af3 + .word 0x00069e2b + .word 0x000afeb2 + .word 0xfffe9f51 + .word 0xfffa7f91 + .word 0xfffa8cbb + .word 0x000c11b0 + .word 0xffff1f4d + .word 0x0004c243 + .word 0x000fc5e3 + .word 0x00045196 + .word 0x0009e334 + .word 0xfffc2b3e + .word 0xfff6726d + .word 0xfff3c415 + .word 0x000ae6be + .word 0xfff73f32 + .word 0x000001da + .word 0xfff30aec + .word 0xfff96584 + .word 0x00018037 + .word 0xfff6b7a0 + .word 0x00043ecb + .word 0xfff4871d + .word 0x000fe58d + .word 0x0008d5af + .word 0x000d2769 + .word 0xfff549ab + .word 0x000bbce6 + .word 0x0006b79c + .word 0xfff58651 + .word 0x00065abb + .word 0xfff0820f + .word 0x000640f0 + .word 0x000d39ce + .word 0x000df56b + .word 0xfffaf4e6 + .word 0xfff3d532 + .word 0xfffcc47c + .word 0x0001015e + .word 0x00000a6b + .word 0xfffb22b2 + .word 0xfffd8ace + .word 0xfff30d24 + .word 0x000c7548 + .word 0xffff788f + .word 0x000e9dcb + .word 0xfff90f39 + .word 0x00058cb3 + .word 0xfff008aa + .word 0xfff14e70 + .word 0x000bfd64 + .word 0xfffca11f + .word 0x00069542 + .word 0x00007e86 + .word 0xfff3b46a + .word 0xffff28a9 + .word 0xfff55862 + .word 0x000f5c97 + .word 0x00041163 + .word 0x000148a2 + .word 0x000a8005 + .word 0xfff7ff00 + .word 0x0009791e + .word 0xffffee27 + .word 0xfff1cdc2 + .word 0x000a6592 + .word 0xfffb4539 + .word 0xffffd7cb + .word 0x00058dd7 + .word 0xfffad5f8 + .word 0x0005077c + .word 0xfff2bd19 + .word 0x000d224d + .word 0x000a349c + .word 0xfff9d3f3 + .word 0x0000a530 + .word 0x0000ce9d + .word 0xfff88590 + .word 0xfff35923 + .word 0xfff9e9c4 + .word 0x00023410 + .word 0x0005a7f3 + .word 0xfff1c016 + .word 0xffff7cc9 + .word 0x00089562 + .word 0x0003c94d + .word 0xffff7ca4 + .word 0xfffcb741 + .word 0xfff96043 + .word 0x0000dc84 + .word 0xfff2e836 + .word 0xfff447b7 + .word 0x00012b04 + .word 0x0002da0e + .word 0xfff2add9 + .word 0xfff827dd + .word 0xfff9c3f2 + .word 0x0000a1b4 + .word 0x00080351 + .word 0xfff5173e + .word 0x000f0740 + .word 0x000c43bb + .word 0x000acf8b + .word 0xfff9b61f + .word 0xfff353cd + .word 0xfff414cf + .word 0xffff5d8f + .word 0x00051759 + .word 0x000e6ccd + .word 0x00096a16 + .word 0x0005d10c + .word 0x00074a94 + .word 0x000d8552 + .word 0x00049005 + .word 0xfff5be11 + .word 0x00062f93 + .word 0xfffd32a1 + .word 0xfffeac52 + .word 0xfff7bd10 + .word 0xfffb249e + .word 0xfff7bb74 + .word 0xfffac6fe + .word 0xfff2389c + .word 0x000cafc2 + .word 0xfff42501 + .word 0xffffb944 + .word 0xfff3f6a1 + .word 0x0005fae2 + .word 0xfffe6279 + .word 0x0002f612 + .word 0x00012e5d + .word 0xffffb4cd + .word 0x0004baa6 + .word 0xfffd418e + .word 0x000d235e + .word 0xfffa63af + .word 0x00097cb9 + .word 0xfff53666 + .word 0xfff2f0a1 + .word 0xfffebd34 + .word 0xfff314fe + .word 0xfff1a0a3 + .word 0x000d7e56 + .word 0xfffc1aad + .word 0xfff66574 + .word 0xfff8786c + .word 0xfff1e23f + .word 0xfffe7b1f + .word 0xfffadd40 + .word 0x0008c256 + .word 0xfffd9712 + .word 0xfffcb538 + .word 0xfff6bf04 + .word 0x0003996a + .word 0xfffee101 + .word 0xfff974a9 + .word 0xfff30166 + .word 0x000e90c5 + .word 0x00077128 .global v32b .balign NR_LANES*4 v32b: - .word 0xfff1a0f0 - .word 0x00079ade - .word 0xfffd374a - .word 0xffff0110 - .word 0x000b66a6 - .word 0x000cdfa9 - .word 0xfff9c0c9 - .word 0xfffe2bc5 - .word 0xfff3999f - .word 0x000de31a - .word 0xfff96532 - .word 0x00026d53 - .word 0x0008a1a4 - .word 0x0001e826 - .word 0x000f7032 - .word 0x000637b4 - .word 0x000c4061 - .word 0x00012970 - .word 0x000f5498 - .word 0xffff961a - .word 0xfffa0ec9 - .word 0xfff31bb4 - .word 0x00000f77 - .word 0xfff9cffe - .word 0x00049c76 - .word 0xfff2d43e - .word 0xfffe9fa8 - .word 0xffff2c13 - .word 0x00088a9e - .word 0x000130c8 - .word 0xfffb84cf - .word 0x000d4a1d - .word 0x000445c4 - .word 0xffff5040 - .word 0xfff04265 - .word 0x000385f9 - .word 0x000576f5 - .word 0x0001edb1 - .word 0xfffb8644 - .word 0xfff969c6 - .word 0x000ca208 - .word 0x000530da - .word 0xfff46a34 - .word 0xfff5bf38 - .word 0xfff2844b - .word 0xfffecb63 - .word 0xfff555bf - .word 0xfff69423 - .word 0xffffb3ff - .word 0x000277ca - .word 0xfff3cbb4 - .word 0xfff7d668 - .word 0x0007e595 - .word 0x000801b2 - .word 0xfffb5d98 - .word 0x0005a50a - .word 0x0009cd25 - .word 0xfff1a53a - .word 0xffff89bc - .word 0x0002ab03 - .word 0xfffbc70a - .word 0x000e6632 - .word 0x0007029e - .word 0x000f8dd1 - .word 0xfffb226e - .word 0x00090e11 - .word 0xfff5ec62 - .word 0x00074359 - .word 0x000f2dbf - .word 0xfff527c7 - .word 0xfffdfb63 - .word 0x0006e4c0 - .word 0xfffa164c - .word 0xfff77764 - .word 0x00025f02 - .word 0x000de37c - .word 0xfff01cc8 - .word 0xfff2b290 - .word 0xffff4e9d - .word 0xfff8d4d9 - .word 0x00012cb7 - .word 0xfff86c89 - .word 0xfff2eaba - .word 0xffff4bf5 - .word 0xfffc20b2 - .word 0x000763f9 - .word 0x000f925e - .word 0x00095e00 - .word 0x000fae59 - .word 0x000ae675 - .word 0x000280f5 - .word 0xfff1edb1 - .word 0xfff2725b - .word 0x00024425 - .word 0xffffaf20 - .word 0x000d8990 - .word 0x000d594d - .word 0xfffa6f11 - .word 0x0001017d - .word 0xfff3f0e1 - .word 0x000dc5f8 - .word 0x000ab6a1 - .word 0x000c9c80 - .word 0xfff8d598 - .word 0x00044803 - .word 0xffffa6f2 - .word 0xfff2f690 - .word 0xffff4721 - .word 0xfff1aa99 - .word 0x000c16e6 - .word 0x000f3f5f - .word 0xfff44173 - .word 0xffff7ef9 - .word 0x0004497e - .word 0xffff8d66 - .word 0x000a9d84 - .word 0x00073754 - .word 0x00033db6 - .word 0x0005181f - .word 0x000fc08f - .word 0xfffad6f9 - .word 0xfffba3c8 - .word 0x00021c6a - .word 0x0001f4b7 - .word 0x0001fc3a - .word 0x0005a664 - .word 0xfff7a463 - .word 0xfff3515a - .word 0xfff59057 - .word 0x00072ffe - .word 0x0001f5e3 - .word 0xfff48d12 - .word 0xfffbf111 - .word 0xfff3d595 - .word 0x000594a7 - .word 0xfff9f7ce - .word 0x000fdeb8 - .word 0xfff1b637 - .word 0x000147ad - .word 0x000c90e3 - .word 0xfff45aa4 - .word 0x0007baba - .word 0x00071969 - .word 0x00062f30 - .word 0xfffa2ab5 - .word 0xfff9c658 - .word 0x000d563d - .word 0x00089c92 - .word 0x000ec202 - .word 0x000a8709 - .word 0xfff2a140 - .word 0x000eccbc - .word 0x000d6f7f - .word 0x00039181 - .word 0xfff547a4 - .word 0xfff01fdc - .word 0xfff6b4ff - .word 0xfffacc51 - .word 0x000df341 - .word 0xfff36652 - .word 0x0006d6de - .word 0xfff5699b - .word 0xfff2da0f - .word 0x000ec06e - .word 0x000a376c - .word 0xfff12046 - .word 0x000652da - .word 0x00093b6d - .word 0x000dd52e - .word 0x0006e9a8 - .word 0x000e786f - .word 0x0008e139 - .word 0x00067fdd - .word 0xfff9a4a9 - .word 0x000737a9 - .word 0xfffea6b2 - .word 0xfffe0d3b - .word 0xfff72100 - .word 0xfff08621 - .word 0xfffa8a50 - .word 0xfffc5411 - .word 0x000e83f1 - .word 0x000ce120 - .word 0x000d8980 - .word 0xfff97c99 - .word 0x0003e39f - .word 0x0006c419 - .word 0xfff96d06 - .word 0x00055201 - .word 0xfff2fc13 - .word 0xfff03f23 - .word 0xfff2fad2 - .word 0xfff31658 - .word 0xfff5c0e7 - .word 0xfff99948 - .word 0xfff08f8b - .word 0x000f0a2d - .word 0xfffde62c - .word 0xfff575c7 - .word 0x000ca6ae - .word 0x000461a3 - .word 0x00089b8f - .word 0xfffcbf5f - .word 0xfff11b50 - .word 0x0004a5b8 - .word 0xfffff94e - .word 0xfff29b88 - .word 0x000553fa - .word 0xfff1c56e - .word 0xfff2eb88 - .word 0x000aea35 - .word 0x0003d968 - .word 0xfff343a3 - .word 0x000776c6 - .word 0xfffd2e18 - .word 0xfff565d8 - .word 0xfff33e19 - .word 0xfff067b4 - .word 0xfff663ce - .word 0x0004f140 - .word 0xfff9a2ac - .word 0xfff64e0f - .word 0xfff10696 - .word 0xfff9f573 - .word 0xfff35108 - .word 0x000f1107 - .word 0x0009beae - .word 0x0006c57f - .word 0xffffc7fd - .word 0xfff558f7 - .word 0x000a8fda - .word 0xfffef356 - .word 0xfff8c930 - .word 0x00097e5d - .word 0xfff78fa7 - .word 0xfffe1cdf - .word 0x000e886a - .word 0xfff9877e - .word 0x000bf48f - .word 0xfffe7874 - .word 0xfff164c7 - .word 0x00002577 - .word 0xfffddc31 - .word 0x00013eda - .word 0xfffd379d - .word 0xffffaf6f - .word 0x000c878b - .word 0x0007003a - .word 0x000de517 - .word 0x0002c21c - .word 0x00066d1e - .word 0x00049680 - .word 0x0005d96a - .word 0xfffe8398 - .word 0x0005c5ed - .word 0xfff5f38a - .word 0x0006d184 - .word 0xfff04c58 - .word 0xfffc197b - .word 0x000b441d - .word 0xfffcbeeb - .word 0x00044061 - .word 0xfff2911d - .word 0xfff4e19b - .word 0xfff4d7fa - .word 0xfff4bff9 - .word 0x000aeb55 - .word 0xfff11b12 - .word 0x000791fc - .word 0x000bd9a7 - .word 0xfff921f7 - .word 0x00033fc5 - .word 0x00014494 - .word 0x000be481 - .word 0xfff4d59a - .word 0x000dbddb - .word 0xffffba3f - .word 0x00032c0e - .word 0xfffa3268 - .word 0x000e9d77 - .word 0xfff87ea2 - .word 0xfff04f7e - .word 0xfffa45ed - .word 0x000e40c9 - .word 0xfffa0308 - .word 0x00064d52 - .word 0xfff1c6a1 - .word 0x000af66f - .word 0xfff21249 - .word 0x000dcf5b - .word 0xfffac984 - .word 0x0001b561 - .word 0xfff33965 - .word 0xffff94c4 - .word 0x000599ed - .word 0x0009e199 - .word 0xfff0ba35 - .word 0x000d8729 - .word 0xfffb2ee0 - .word 0x00044e82 - .word 0x000504fb - .word 0x000bdbcc - .word 0xfff23c08 - .word 0xfff59b13 - .word 0xfffe2e22 - .word 0xfff6ad47 - .word 0x000c8ac9 - .word 0xfff6a49f - .word 0xfff50d43 - .word 0xfff1acc9 - .word 0xfffbf982 - .word 0x00086356 - .word 0x000c86eb - .word 0x000bb02d - .word 0xfff34a35 - .word 0x0002692a - .word 0xfff80bfb - .word 0x0008ef35 - .word 0xfff5820a - .word 0x00062f3c - .word 0xfffc0d5a - .word 0x00014749 - .word 0xfffd9f39 - .word 0xfff1b744 - .word 0x0006f639 - .word 0xfff296a9 - .word 0x000cd796 - .word 0x00042651 - .word 0x0002ee98 - .word 0xffff3dc1 - .word 0x000ed47f - .word 0xfff50396 - .word 0x000cfb45 - .word 0xffff8a19 - .word 0x00068817 - .word 0xfffc04ec - .word 0x000b05b2 - .word 0x0008b4c7 - .word 0xfffb556e - .word 0x00034a1e - .word 0x00003063 - .word 0x0004be49 - .word 0xfffdd8c3 - .word 0xfff0130e - .word 0x0009feec - .word 0xffff4a39 - .word 0xfff034eb - .word 0x0003ad77 - .word 0xfff5adc9 - .word 0xfffdd4b0 - .word 0xfff2f76e - .word 0x00000025 - .word 0xfffab255 - .word 0xfff2bb00 - .word 0xfffbbd4a - .word 0xfffbb957 - .word 0x00058396 - .word 0x0008efab - .word 0x000f3bcf - .word 0x00006d86 - .word 0xfff1252e - .word 0x00019325 - .word 0x000a8115 - .word 0xfff9968b - .word 0xfff73f4c - .word 0x000be1a4 - .word 0x00032325 - .word 0xfff38893 - .word 0xfffd42fd - .word 0xfff680c1 - .word 0x000aae4e - .word 0xfffb667a - .word 0x0006e2bd - .word 0x000567ae - .word 0xfff9e1bf - .word 0x0002b6d3 - .word 0x000c83a7 - .word 0x00092d47 - .word 0x00084341 - .word 0x000673fe - .word 0x000fda98 - .word 0x000bff7e - .word 0xfff2f546 - .word 0x000758b6 - .word 0xfff49f72 - .word 0x0009bb2c - .word 0xfffed8fb - .word 0xfffdb42b - .word 0x000c5371 - .word 0xfffa473f - .word 0xfff9523a - .word 0xfff1c673 - .word 0x0006fc5e - .word 0xfffc295f - .word 0x000e8624 - .word 0xfffb6dbe - .word 0x000648e0 - .word 0x000faa2b - .word 0xfff3e29c - .word 0x0008ab45 - .word 0x000e6071 - .word 0xfffc8a1a - .word 0xfff9df6d - .word 0xfff319cb - .word 0x00062bf1 - .word 0xfffce561 - .word 0x0005182f - .word 0xfff59153 - .word 0x00004865 - .word 0xfff13091 - .word 0xfff53e5c - .word 0xfffe928e - .word 0x00072d09 - .word 0x00073821 - .word 0xfffec857 - .word 0x0003ced8 - .word 0x000b5350 - .word 0x0002d788 - .word 0xfff2d723 - .word 0x0002c16f - .word 0xfffb14b9 - .word 0x0005d459 - .word 0xfff71cae - .word 0xfffd6a71 - .word 0x000f730b - .word 0x0007035e - .word 0x000edfbb - .word 0xfff3dd99 - .word 0x000fb0fc - .word 0xfff31279 - .word 0x00062504 - .word 0x0000005d - .word 0x00000cbf - .word 0xfff65000 - .word 0xfff758f8 - .word 0x000d5a58 - .word 0xfff82067 - .word 0x00021509 - .word 0x000d5a6b - .word 0xfff7a5ad - .word 0x000ffc63 - .word 0x0003f121 - .word 0x000c64fd - .word 0xfffe363d - .word 0x0007481b - .word 0xfff13e7e - .word 0x000bfe54 - .word 0x0004a0c1 - .word 0x000c032b - .word 0xfffbd775 - .word 0xfff920fb - .word 0xfff3b2b4 - .word 0x0005d74a - .word 0xfff51cf2 - .word 0xfff2d8e6 - .word 0x00045936 - .word 0x000053f5 - .word 0x000eb642 - .word 0xfff90be0 - .word 0x000617fb - .word 0x000d048a - .word 0x0002c866 - .word 0xfff9074b - .word 0x000360fc - .word 0xfffd9e25 - .word 0x0002186b - .word 0xfff34000 - .word 0x0007bb0c - .word 0xfffcee21 - .word 0x000b53db - .word 0x000d4cc0 - .word 0xfff77a50 - .word 0xfff3716a - .word 0x000a14ce - .word 0x000c852e - .word 0x00052552 - .word 0xfffae203 - .word 0xfff7c941 - .word 0xfff1dbcf - .word 0xfff553d2 - .word 0xfff573db - .word 0x00015319 - .word 0xfff569c7 - .word 0xfff99219 - .word 0x00047201 - .word 0xfff33a56 - .word 0xfff5bf0b - .word 0x00005eb7 - .word 0xfff3fa07 - .word 0x00086f72 - .word 0xfff015ce - .word 0x0003b665 - .word 0x000ab56c - .word 0xfff0c94e - .word 0x000002f2 - .word 0x000fd035 - .word 0x000fe2e4 - .word 0xfff062f9 - .word 0xfffd7c80 - .word 0xfffc610c - .word 0x0002f21f - .word 0xfff5edf8 - .word 0x000dc201 - .word 0x0003e242 - .word 0x000e0b46 - .word 0x00054ca5 - .word 0xfff788cc - .word 0xfffd6e0b - .word 0xfff62398 - .word 0x000e24ee - .word 0x0003432d - .word 0x000be3bb + .word 0xfff9c58c + .word 0xfffb81ab + .word 0xfffceaea + .word 0x0007939a + .word 0x00038e51 + .word 0x00042e36 + .word 0xfff8c086 + .word 0xfff784eb + .word 0xfffa6db9 + .word 0xfffb63d6 + .word 0xfffdf7a8 + .word 0x0000601d + .word 0xffff3ebb + .word 0x000d0257 + .word 0x0008cde0 + .word 0x000f9772 + .word 0xfff608d9 + .word 0xfffd227b + .word 0x00048d42 + .word 0x000ca356 + .word 0x00018c13 + .word 0xfff75122 + .word 0xfffebb59 + .word 0x000a18e2 + .word 0x0009940c + .word 0x000228fa + .word 0xfff2a33f + .word 0xfffff361 + .word 0xfff4f10a + .word 0xfff1ec19 + .word 0xfff11972 + .word 0x0000c20b + .word 0xfffa0065 + .word 0x000606e8 + .word 0x000cf709 + .word 0xfff7ce11 + .word 0x000bb474 + .word 0x0008dba5 + .word 0x000ee3db + .word 0x000c4384 + .word 0xfff52a4e + .word 0xfff66998 + .word 0x00023044 + .word 0xfffc23d1 + .word 0xfff20bb1 + .word 0xfffea78a + .word 0xfff51a52 + .word 0x000b6916 + .word 0x00059c82 + .word 0x00018da3 + .word 0x000a02e4 + .word 0xfff1808d + .word 0xfff75815 + .word 0x000a4d76 + .word 0xfffb27a4 + .word 0xfff6a695 + .word 0x000c8443 + .word 0xfff0427e + .word 0x00063c9d + .word 0xfff8021b + .word 0xfffedd3e + .word 0xfff782b2 + .word 0xfff4a50b + .word 0x000a3efd + .word 0xfff1b7b7 + .word 0xfffa8fb3 + .word 0xfff3bb89 + .word 0xffff3ecf + .word 0x000a367d + .word 0xfff9dffe + .word 0x000db517 + .word 0xfff0980f + .word 0xfffdf445 + .word 0xfff56ed3 + .word 0x000448be + .word 0xfff8f59d + .word 0x00061b6d + .word 0x00020716 + .word 0x000a927e + .word 0xfff7e811 + .word 0x000652e2 + .word 0x000351d2 + .word 0xfff46504 + .word 0x000c4fc6 + .word 0x00075cf9 + .word 0xfff99e89 + .word 0x000d74c8 + .word 0x00017187 + .word 0xfff681ed + .word 0xfff93f43 + .word 0xfff9214c + .word 0x000652bc + .word 0xffff762d + .word 0x0002df1c + .word 0xfff8e6e8 + .word 0xfff08342 + .word 0xfffedfb1 + .word 0x00047736 + .word 0x00000e68 + .word 0x0005c6b8 + .word 0x000490b2 + .word 0x00000b8e + .word 0x000b9e18 + .word 0xfff9faa3 + .word 0xfff94906 + .word 0xfffc5dbd + .word 0x000ac563 + .word 0x0006b3e3 + .word 0xfffdb7cb + .word 0xfff3cfdd + .word 0x000b30b2 + .word 0xfff42f63 + .word 0x000ac3ea + .word 0xfffa7a0f + .word 0x0002e124 + .word 0xfff77791 + .word 0x00061004 + .word 0xfffd251e + .word 0xfffacf72 + .word 0xfff80575 + .word 0xfff8fafb + .word 0x000d624f + .word 0x00036cbd + .word 0xfff711dc + .word 0xfff32174 + .word 0xfffb6b28 + .word 0xffff61ed + .word 0x00027b80 + .word 0x000c88fa + .word 0xfff3cf9e + .word 0x000b2e11 + .word 0xfffd2a5f + .word 0xfffec153 + .word 0x000b6505 + .word 0xfff65ff6 + .word 0xfff47276 + .word 0xfffb7aeb + .word 0xfff84cb4 + .word 0x0007369e + .word 0xfffe3bdc + .word 0x0000afca + .word 0xffff8d9e + .word 0xfff8e248 + .word 0x000d462a + .word 0x00026e14 + .word 0xfffeb464 + .word 0x000b32f5 + .word 0x00003c9a + .word 0xfffb412a + .word 0xfff0315e + .word 0xfff8073b + .word 0x000954dc + .word 0x000ef3a8 + .word 0xfffad57f + .word 0xfff8af77 + .word 0xfffcc49b + .word 0xffffb5bd + .word 0xfff713e7 + .word 0xfff5e8ff + .word 0xfff4b1ef + .word 0xfff24b92 + .word 0x000607ba + .word 0xfffef9fd + .word 0xfffa9be5 + .word 0x00005879 + .word 0xfff2807f + .word 0x00082c08 + .word 0xfff47161 + .word 0xfff65e3a + .word 0x000fc773 + .word 0xfffd7d13 + .word 0xfffe7d73 + .word 0xfffdc190 + .word 0x000c2d27 + .word 0xfff9124b + .word 0x000e7b36 + .word 0x0006e49c + .word 0x0003966c + .word 0xfff7db0f + .word 0xfff630ea + .word 0x000b412b + .word 0x000bc6cd + .word 0x00023060 + .word 0x000f3a65 + .word 0x000b80db + .word 0x0005dc23 + .word 0xfff842cb + .word 0xfff38145 + .word 0xffffffc3 + .word 0xfff6fe78 + .word 0x0006fe1f + .word 0xfff985cd + .word 0x000780f8 + .word 0x000819de + .word 0xfffd7f9a + .word 0xfff00a9c + .word 0x00067cfb + .word 0x00056980 + .word 0x0009c0f1 + .word 0x000a07e8 + .word 0x000003c5 + .word 0x000268e0 + .word 0xfff4633a + .word 0x000fd61b + .word 0xfff8cc14 + .word 0xfff10b46 + .word 0xfffc5eb5 + .word 0xfff57e0e + .word 0x0003043c + .word 0xfff40373 + .word 0x000747a4 + .word 0xfff10307 + .word 0x00095de4 + .word 0x0006cc32 + .word 0x000d965d + .word 0xfff1c228 + .word 0xfff15410 + .word 0x0006f50c + .word 0x000a759e + .word 0x0007e36f + .word 0xfff29916 + .word 0xfff3de0a + .word 0xfffb83eb + .word 0xfff238a2 + .word 0x000759a5 + .word 0x000d1c40 + .word 0xffff56bc + .word 0x000a8134 + .word 0xfffa6a30 + .word 0xfff49036 + .word 0xfffeb819 + .word 0xfff63877 + .word 0x00027200 + .word 0xfff4b3ed + .word 0x00022217 + .word 0xfff29f9d + .word 0xfff59fa9 + .word 0x000e14f7 + .word 0x0001fce4 + .word 0xfffef9c7 + .word 0x00075534 + .word 0xffffd652 + .word 0x000ad33a + .word 0x0000593f + .word 0xfff94673 + .word 0xfffcbf4c + .word 0xfffa2d78 + .word 0x000b00ca + .word 0xfff2aaf2 + .word 0xfffe3e41 + .word 0x00095f84 + .word 0x0006e524 + .word 0xfffc550a + .word 0xfffdc945 + .word 0xfff97a76 + .word 0xfffc5c3e + .word 0x000b2c45 + .word 0x000bb2c3 + .word 0xfffce082 + .word 0xfff5e97d + .word 0x00085bbc + .word 0x00035752 + .word 0xfff3d469 + .word 0x000a6788 + .word 0xfff6a958 + .word 0xfffc3703 + .word 0xfffb624a + .word 0xfff2c040 + .word 0xfff47139 + .word 0x0004b545 + .word 0xfff28cca + .word 0x000a5431 + .word 0xfff383e5 + .word 0x000afee4 + .word 0xfff59554 + .word 0x000616c5 + .word 0x00016cfe + .word 0xfffccbba + .word 0x000736bf + .word 0xfffe23cd + .word 0x0008733c + .word 0x0002e2bc + .word 0x00059360 + .word 0xfff4fd35 + .word 0x00062d72 + .word 0x0002a547 + .word 0xffff620e + .word 0xfffecc47 + .word 0x000124df + .word 0x000988f3 + .word 0x00065072 + .word 0xfffbff5f + .word 0x000b38a0 + .word 0xfff3bc40 + .word 0x0005c700 + .word 0xfff4df33 + .word 0x00065f49 + .word 0x000018a8 + .word 0xffff9b30 + .word 0xfffb464f + .word 0xfffbcf4c + .word 0x000c1ef5 + .word 0xffffde12 + .word 0x0001144c + .word 0xfff02725 + .word 0xfffbb60b + .word 0x00086c20 + .word 0x0000bb61 + .word 0x0005f0bb + .word 0x000d935a + .word 0x00087d39 + .word 0x00053d7c + .word 0xfff9da55 + .word 0x00020403 + .word 0xffff286f + .word 0x000ba167 + .word 0x00025b4b + .word 0x00024a7d + .word 0x0005d699 + .word 0xfff695e7 + .word 0xfffeecc1 + .word 0xfffc863e + .word 0xfff7bc5f + .word 0x000cd92e + .word 0x00017788 + .word 0x000c4af8 + .word 0xfff79100 + .word 0xfff05e63 + .word 0xfff14830 + .word 0x0008f7e3 + .word 0xfff95413 + .word 0xfff0a947 + .word 0xfff5d682 + .word 0xfff3d4a1 + .word 0xffffa474 + .word 0xfff82790 + .word 0xfff4befa + .word 0x00079133 + .word 0xfff4e7cf + .word 0x0001f5dc + .word 0xfff8b90e + .word 0xfff7119b + .word 0xfff90366 + .word 0x000efc96 + .word 0xfff33974 + .word 0x000b0b06 + .word 0x0008855f + .word 0xfffcae6c + .word 0x000f9800 + .word 0xfffc4105 + .word 0x0008de14 + .word 0x0009629c + .word 0x000baf30 + .word 0xfff13d6d + .word 0xfff968f7 + .word 0xfffd2f38 + .word 0xfffe3afd + .word 0xfff07a5d + .word 0xfff310ab + .word 0xfff07aef + .word 0xfff46fa9 + .word 0x000249ca + .word 0xfff1e216 + .word 0x000d7202 + .word 0xfff08ef1 + .word 0xfffe7f19 + .word 0x00014099 + .word 0xfffc7a6d + .word 0x00010d9f + .word 0x0002e937 + .word 0x000d07b3 + .word 0x000b8302 + .word 0x000c8fed + .word 0x00040abb + .word 0xfffd82d4 + .word 0x00013865 + .word 0x0009d15c + .word 0xfff5583c + .word 0xfffe5f5f + .word 0x0007e05b + .word 0xffffce30 + .word 0xfff7f3d3 + .word 0xfff487da + .word 0xfff941cf + .word 0x00063316 + .word 0x00028c57 + .word 0x00065157 + .word 0x0004af12 + .word 0xfff2332f + .word 0xfffea4d1 + .word 0xfff1b5d5 + .word 0xfff3f3e9 + .word 0xfff20d4a + .word 0x000ef173 + .word 0x000d64bc + .word 0xfffc44f3 + .word 0x0009de39 + .word 0xfff42307 + .word 0x000daba0 + .word 0x000d1db2 + .word 0xfff68141 + .word 0xfffbbbe9 + .word 0x00098e46 + .word 0xfff607c9 + .word 0x00083a86 + .word 0x000af7b1 + .word 0x0009c526 + .word 0x00097ffb + .word 0xfff5f6f9 + .word 0xfff1b856 + .word 0x00080b84 + .word 0x000cc482 + .word 0x000d57ec + .word 0x0005ae4b + .word 0x0008ef12 + .word 0x00055172 + .word 0xfff9ef53 + .word 0x0001b27f + .word 0xfffeb217 + .word 0x000f62c5 + .word 0xfff88fed + .word 0x0005f69b + .word 0x00009703 + .word 0xfffbbf6b + .word 0xfff78bb5 + .word 0xfffb59b7 + .word 0x00053e5f + .word 0xfff5414e + .word 0xfffcc0ee + .word 0xfff7ab2c + .word 0x00044f0a + .word 0xfff2dc13 + .word 0xfffa4468 + .word 0x0000a118 + .word 0xfff3375a + .word 0x0009a25d + .word 0xfffa6926 + .word 0x0000504b + .word 0x000d0099 + .word 0xfffb39af + .word 0x00094151 + .word 0x000df7cf + .word 0x000ff894 + .word 0x000a0a14 + .word 0xfff74943 + .word 0xfffec6d4 + .word 0x000e0e1c + .word 0x0008bd4b + .word 0xfff07540 + .word 0xfffb5d0b + .word 0x000b4399 + .word 0x000cc038 + .word 0x0004e87b + .word 0xfff2c21c + .word 0xfff3f347 + .word 0x00021ef7 + .word 0x0003f9ca + .word 0x0003dfd7 + .word 0x000a8657 + .word 0x00016bab + .word 0x000393f4 + .word 0xfffc0175 + .word 0xfffc900e + .word 0x0004bcd6 + .word 0xfff44b9a + .word 0x000989d0 + .word 0xfff7c518 + .word 0x00065fc1 + .word 0xfffcad22 + .word 0xfffbd4b5 + .word 0x00034445 + .word 0xfff1ab63 + .word 0xfff8669f + .word 0x000bd54c + .word 0xfff381cd + .word 0xfff7e6e5 + .word 0x00041bd1 + .word 0xfff9ffa6 + .word 0x0001fc95 + .word 0xfff82007 + .word 0x000d7cd7 + .word 0x000a6c8d + .word 0x0009a368 + .word 0xfff5b843 + .word 0xfff4f23c + .word 0x0007e5b7 + .word 0xfffafef8 + .word 0xfffbf089 + .word 0x000b6b8c + .word 0x00024c4e + .word 0x0000ed8b + .word 0xfff34681 + .word 0xfff54f6d + .word 0xfff9b3e6 + .word 0x00075687 + .word 0x00051dee + .word 0xfffa9b10 + .word 0xfff405e7 + .word 0x000bd98b + .word 0x000b8a75 + .word 0x000917c1 + .word 0xfffa9db0 + .word 0x00057fd9 + .word 0x000a315f + .word 0xfff1210d + .word 0x000b7d37 + .word 0x000139dd + .word 0x0004f9a9 + .word 0x000d9d3c + .word 0xfffa43cc + .word 0xfffdae93 + .word 0xfffc7c5e + .word 0xfffb07a1 + .word 0x000a0112 + .word 0xfffeb767 + .word 0xfff3b438 + .word 0x00086c4d + .word 0x000620e7 + .word 0x0005e930 + .word 0x00088209 + .word 0x00057ea0 + .word 0xfff1b74c + .word 0xffffb6d2 + .word 0xfff44e23 + .word 0x000ac33a + .word 0x0003f2f6 + .word 0xfff1a6c9 + .word 0xfffae313 + .word 0x000d3369 + .word 0x000e415d + .word 0x000579c1 + .word 0x000198ad + .word 0xfff14374 + .word 0xfffd226c + .word 0x000d99bb + .word 0xfffcb199 + .word 0xfff72ce1 + .word 0x000517cb + .word 0x0001a6cd + .word 0x0006b088 + .word 0x0007c82b + .word 0xfff56bb0 + .word 0xfff47fc9 + .word 0x0007a3f5 + .word 0xfff4091a + .word 0x000c32f8 + .word 0x0000c7dc + .word 0xfffaa57c + .word 0x0001d4c7 + .word 0x0000711e + .word 0xfffc1701 + .word 0xffff17b2 + .word 0xfff8e295 + .word 0x0008352e + .word 0xfff06d48 + .word 0x000fcf9d + .word 0x00065920 + .word 0x0008556a + .word 0xfffc2929 + .word 0xfff693f9 + .word 0x000f101a + .word 0xfffdfae4 + .word 0x000f17e2 + .word 0xfffd357f + .word 0xfff0e9c8 + .word 0x00098ed6 + .word 0x00079473 + .word 0x000b1d4c + .word 0xfff7a991 + .word 0xfffa2891 + .word 0xfff7f317 + .word 0x000aaed8 + .word 0xfffa6917 + .word 0xfffa2cdf + .word 0x000e652c + .word 0xfff5880b + .word 0xfffc0a02 + .word 0x00093ff1 + .word 0xfff23873 + .word 0x000f8806 + .word 0x0003b860 + .word 0x00003031 + .word 0x0006b79e + .word 0xffff0af2 + .word 0x00029acb + .word 0xffff25b6 + .word 0xfffe76ce + .word 0x000eb7e4 + .word 0x0000500a + .word 0xfff929c7 + .word 0x00015918 + .word 0xfff4b636 + .word 0xfffb6591 + .word 0x0003622e + .word 0xfffafb44 + .word 0x00078dc1 + .word 0x000f4c94 + .word 0xfffae7b8 + .word 0xfff718e5 + .word 0x0004a399 + .word 0xfff5c0f8 + .word 0x0003bcd1 + .word 0xfff66010 + .word 0x000bdd77 + .word 0xfff5c97f + .word 0xfff8989f + .word 0xfffb4bbc + .word 0x00015495 + .word 0xfff7ecc5 + .word 0xfff47614 + .word 0x00033227 + .word 0x0007cd51 + .word 0xfff6536a + .word 0x000bcb5d + .word 0x0005a4b7 + .word 0xfffc3ead + .word 0x000cedb3 + .word 0x000f7b19 + .word 0x0000aad8 + .word 0x00097a60 + .word 0xfffdca1d + .word 0x0007adca + .word 0xfffad884 + .word 0xfff410a1 + .word 0xfff9fc70 + .word 0x0009935d + .word 0x0003b68e + .word 0xfffb8ba9 + .word 0x0005efab + .word 0x000efd45 + .word 0x00006d28 + .word 0x00068745 + .word 0x000a573f + .word 0xfff51928 + .word 0x0004bc99 + .word 0xfff1e3e5 + .word 0x0004d21e + .word 0xfffcb54b + .word 0x00025057 + .word 0xfff7848f + .word 0x000ea5d4 + .word 0x00059ee2 + .word 0xfffd5c94 + .word 0x0009c125 + .word 0x000664df + .word 0x00081b2e + .word 0x0004a174 + .word 0xfff19edf + .word 0xfffe7bb7 + .word 0x00091443 + .word 0x000bccc7 + .word 0x00063049 + .word 0xffff80fe + .word 0x000be9f9 + .word 0x00099833 + .word 0x000307cb + .word 0x000b9db1 + .word 0xfff70e5d + .word 0xfffcae15 + .word 0x00066b47 + .word 0xffff1533 + .word 0x00051055 + .word 0xfff462ae + .word 0x00059756 + .word 0x000356e7 + .word 0xfffa6398 + .word 0xfff707d5 + .word 0x000404e2 + .word 0x0006cd25 + .word 0x000d0069 + .word 0xfff4625a + .word 0x000ecc5e + .word 0xffff66d7 + .word 0x000d7d9d + .word 0x000084ae + .word 0x0002afe2 + .word 0x000e55da + .word 0xfff07659 + .word 0x0002e499 + .word 0xfff9a65e + .word 0xfff3dc7b + .word 0xfff90b44 + .word 0xfff1a61e + .word 0xfff02611 + .word 0x0001dfd3 + .word 0xfffb1d27 + .word 0xffffc1cc + .word 0x0009ce1c + .word 0xfff6e662 + .word 0xfffd63ea + .word 0x000c50d2 + .word 0x0008d3b1 + .word 0x0003ae0d + .word 0x0000c074 + .word 0xfff71e16 + .word 0xffff66d1 + .word 0xfffadda9 + .word 0xfff2f8a5 + .word 0x000ece7b + .word 0x000e9227 + .word 0xfffcefb8 + .word 0x000976f6 + .word 0x00042ccd + .word 0x00066ade + .word 0xfff911f5 + .word 0x0004d61a + .word 0xfff219e5 + .word 0xfffddacd + .word 0x0006a65b + .word 0xfff3c1bc + .word 0x000774d2 + .word 0xfffb518c + .word 0xffff3151 + .word 0xfff8926e + .word 0xfff32a9a + .word 0xfffa514e + .word 0xfff713af + .word 0x0006b76f + .word 0x0000ddd5 + .word 0x00062348 + .word 0xfff44d8d + .word 0x00019f11 + .word 0xffff431b + .word 0x00084376 + .word 0xfff84ebd + .word 0xfffaf59d + .word 0xfff2fd8e + .word 0x000ce486 + .word 0xfff80e9a + .word 0xfff12d8e + .word 0x000002d6 + .word 0x0002134c + .word 0xffffbd7c + .word 0xfff26fca + .word 0xfff773a9 + .word 0x000c6a8b + .word 0x0005ffc8 + .word 0xfff700c0 + .word 0xfff8441e + .word 0xfffbb124 + .word 0x0007e917 + .word 0x0005be7d + .word 0xfff3007a + .word 0x0003dc5a + .word 0xfff0cc46 + .word 0xfffba36e + .word 0xfffa0503 + .word 0x0007c07a + .word 0xfff47e6c + .word 0xfff11352 + .word 0x000c2447 + .word 0xfff18f46 + .word 0xffff7646 + .word 0x00011b7a + .word 0xffff787c + .word 0x0003b303 + .word 0xfffe6bcd + .word 0x00095549 + .word 0x000b6725 + .word 0x00048e2d + .word 0xfffbf103 + .word 0x0007a361 + .word 0x000f496f + .word 0xfff0681f + .word 0xffff90a7 + .word 0xfff7b439 + .word 0xfffca9bd + .word 0xfff124ab + .word 0x0009507c + .word 0x0001ea45 + .word 0x000f1205 + .word 0x0007a6aa + .word 0x00074dc5 + .word 0xfff760e8 + .word 0xfff58167 + .word 0xfffb91aa + .word 0xfff59468 + .word 0x000f4537 + .word 0xfff769bc + .word 0xfff5f310 + .word 0xfff52b8f + .word 0x000387e7 + .word 0xfffa95f3 + .word 0x0006a6f0 + .word 0x0007dbef + .word 0x000e1f6a + .word 0x0000eeb7 + .word 0xfffb8d88 + .word 0x000a6287 + .word 0x00001eba + .word 0xfff51445 + .word 0x00067f09 + .word 0x0008b76d + .word 0xfffb72fc + .word 0x0004079f + .word 0xfffd5e8e + .word 0x00022f43 + .word 0x000d16b9 + .word 0xfffa1541 + .word 0x000968f3 + .word 0xfff7994c + .word 0x0000fa98 + .word 0xfff933e4 + .word 0x000acd35 + .word 0xfff88b6c + .word 0xffff820f + .word 0xfff40bc9 + .word 0x00094620 + .word 0xffffffb1 + .word 0xfff0e37b + .word 0x000a4d1c + .word 0xfffb3885 + .word 0xfff46a60 + .word 0x000f23bf + .word 0xffff0e9f + .word 0x00016d75 + .word 0x0000f688 + .word 0xfffe70f6 + .word 0x00063299 + .word 0xfff8a277 + .word 0x000556cc + .word 0x00009644 + .word 0x000855e8 + .word 0xfff10b3f + .word 0xfffb330f + .word 0x000f7d66 + .word 0x000444f7 + .word 0x000cd6ed + .word 0x00059782 + .word 0xfff52c5f + .word 0xfff879ac + .word 0x0003ed6f + .word 0x0006e4b5 + .word 0xfff4fd4f + .word 0xffff5f6c + .word 0xfff16bed + .word 0x00046d7b + .word 0x00038a9e + .word 0x000f7b4b + .word 0xffff5bc9 + .word 0x000f771d + .word 0x000f4470 + .word 0x000c2109 + .word 0xfff2c84f + .word 0x000cfeac + .word 0x000f6883 + .word 0x0004024e + .word 0xfff048aa + .word 0xfffe6ff3 + .word 0x00081427 + .word 0xfff7408c + .word 0x000e9b1c + .word 0x000afe1a + .word 0x000f3059 + .word 0x0007fdad + .word 0x00099f82 + .word 0x00023159 + .word 0xfff0dff4 + .word 0x000743c6 + .word 0x0008b1e3 + .word 0x000c787e + .word 0xfffdfac6 + .word 0x0009f3a9 + .word 0xfff4f14b + .word 0x0008a4a7 + .word 0x000a3067 + .word 0xfffe1e21 + .word 0xfff389ce + .word 0x00048455 + .word 0xfffc3fd9 + .word 0x000d3122 + .word 0xfff4eabf + .word 0x00032131 + .word 0x0003d8cd + .word 0xfff10706 + .word 0x000ff61e + .word 0xfffd1e10 + .word 0x0004117a + .word 0x000ecaf4 + .word 0xfffbbd07 + .word 0x00037135 + .word 0x00061495 + .word 0xfff37718 + .word 0xfff672d6 + .word 0xfffb9e81 + .word 0x000b47c4 + .word 0xfff23575 + .word 0xfff59110 + .word 0x000883bb + .word 0x0000324e + .word 0x00068f16 + .word 0x00057d3e + .word 0x000c4dfd + .word 0xfffb89a6 + .word 0x000fc36a + .word 0x000c1e39 + .word 0xfff80225 + .word 0xfffd8032 + .word 0xfff2307c + .word 0xfffc555f + .word 0x00075c47 + .word 0x000ed6e1 + .word 0x00010c58 + .word 0xfffc721f + .word 0xfffb0ceb + .word 0x0007106a + .word 0x0006d18b + .word 0xfff46658 + .word 0x0005cfbb + .word 0xfffe9896 + .word 0xfffdadb1 + .word 0xfff37526 + .word 0x00073033 + .word 0xfff04329 + .word 0xffff3dd7 + .word 0xfff199ad + .word 0x00031840 + .word 0xfffa13b8 + .word 0x000eb6b5 + .word 0x000dda80 + .word 0xfffdfa6d + .word 0x0004bb7f + .word 0x0005ac99 + .word 0xfff7f890 + .word 0xfff35ba1 + .word 0x00068538 + .word 0xfff7e620 + .word 0x00044781 + .word 0x0002b090 + .word 0xfffd3384 + .word 0xfff29200 + .word 0xfff12e15 + .word 0x000eb1d7 + .word 0xfffd5865 + .word 0xfffb3c38 + .word 0xfffd0a2a + .word 0xfffa21e4 + .word 0x0001ba45 + .word 0xfff0cf1e + .word 0x0006ab69 + .word 0x000bf8be + .word 0x000c8b5b + .word 0xffff84a5 + .word 0x00061872 + .word 0x00023851 + .word 0xfffa234c + .word 0xfff80c9b + .word 0xfff1fc02 + .word 0xfff0823e + .word 0xfff2c778 + .word 0xfff3a5b4 + .word 0x000355c2 + .word 0x000a34c6 + .word 0xfff1c027 + .word 0xfff9b8f8 + .word 0x000523ad + .word 0xfff6be3b + .word 0xffff5073 + .word 0xfff00359 + .word 0xfff00d73 + .word 0x00072b45 + .word 0x00044f52 + .word 0x0008b06a + .word 0xfff6fb86 + .word 0xfff684fd + .word 0x000a098d + .word 0xfff75e6a + .word 0xffff6703 + .word 0x000daa32 + .word 0xfffb2b54 + .word 0xfff16c10 + .word 0x0003dfd8 + .word 0x000d4899 + .word 0x000e355b + .word 0x00008e43 + .word 0xfff8f200 + .word 0x000d5942 + .word 0x0009d87c + .word 0x000d0100 + .word 0x000ed6e4 + .word 0x0003fdf9 + .word 0xfff89750 + .word 0xfffacc6a + .word 0xffff98f0 + .word 0xfff0cb79 + .word 0xfff70910 + .word 0x0006cf0e + .word 0x0008129a + .word 0xfffef9d6 + .word 0x0002b7ee + .word 0xfff4b850 + .word 0xfff6cc1d + .word 0xfff09819 + .word 0xfff09045 + .word 0x00080d2e + .word 0x000f1410 + .word 0xfffd12e4 + .word 0x0003041c + .word 0xfff30a5f + .word 0x00067155 + .word 0x00070ddb + .word 0xfff7cc2d + .word 0x00090ef5 + .word 0xfffff826 + .word 0x00036fcc + .word 0x000f5303 + .word 0x00080bf9 + .word 0xfffddd5d + .word 0xfff558d2 + .word 0xffffabe3 + .word 0xfff63dca + .word 0x00087b22 + .word 0xfff35978 + .word 0x0008c572 + .word 0x000599ba + .word 0xfff48a70 + .word 0xfff9afc3 + .word 0xfff25a68 + .word 0x000a2636 + .word 0x000570e9 + .word 0xfff9e50e + .word 0x000d969e + .word 0xfff571f3 + .word 0x00055146 + .word 0x0004fb32 + .word 0xfff6c16a + .word 0xfff5ad95 + .word 0xfffc59ef + .word 0xfff8eeb5 + .word 0x000fa0f5 + .word 0xfff6c7a9 + .word 0xfff40753 + .word 0x0004213e + .word 0x0007c0b9 + .word 0xfffa282a + .word 0x0001161b + .word 0xfffaabe7 + .word 0x00014e54 + .word 0xfffb1883 + .word 0xfff768e1 + .word 0xfff6703d + .word 0xfff548ff + .word 0xfff49ced + .word 0x0002198e + .word 0xfff3adea + .word 0xfff28d66 + .word 0x000510a0 + .word 0x000df63c + .word 0x0009e011 + .word 0x00055cfb + .word 0x0002e3c4 + .word 0xfff805b1 + .word 0xfffbc511 + .word 0x000eb74f + .word 0xfff5995e + .word 0xfff8a9c0 + .word 0x00026d54 + .word 0x000c3391 + .word 0x00028173 + .word 0xfffce541 + .word 0xfff1caf9 + .word 0xfff2fb70 + .word 0xfff18c5f + .word 0x00080822 + .word 0xffff3bf9 + .word 0xfff57d15 + .word 0x0004263e + .word 0xfffacc89 + .word 0xfff6ea80 + .word 0xfff2ae52 + .word 0x000dfda6 + .word 0xfff89c45 + .word 0x000b0a4b + .word 0x000d0b5e + .word 0xfffeb54f + .word 0xfff2d8be + .word 0xfff23507 + .word 0x000c0874 + .word 0xfffc723c + .word 0xfff8618d + .word 0xfff31fe6 + .word 0xfffb1fcb + .word 0xfff81049 + .word 0xfff1a509 + .word 0x000b8add + .word 0x000e3d42 + .word 0x00097a7b + .word 0x00058ccc + .word 0x000dc4d4 + .word 0x000a104d + .word 0xffff15ae + .word 0xfff12814 + .word 0x000486cb + .word 0x0009862c + .word 0x000330ef + .word 0x000e12f8 + .word 0x000e0e61 + .word 0x00018b2b + .word 0x00059f0c + .word 0xfffd8579 + .word 0xfff99770 + .word 0x000a78e9 + .word 0xfff743fb + .word 0x00023152 + .word 0xfff15482 + .word 0xfff906d6 + .word 0xfffcc312 + .word 0x000d938d + .word 0xfff5e9fc + .word 0xfff43298 + .word 0x00023607 + .word 0xfff1d913 + .word 0xfff7b5fb + .word 0xfff893c9 + .word 0x000a287f + .word 0xfff543ca + .word 0x0009ccfa + .word 0xfff94dec + .word 0xfff7b453 + .word 0xfffc91ad + .word 0x00050a2b + .word 0x000f4b84 + .word 0x000df370 + .word 0xfff5e71d + .word 0x0000ec5c + .word 0xfffe2f78 + .word 0x000d661b + .word 0x0002cc04 + .word 0xfffd5119 + .word 0xfff07911 + .word 0xfff6ef26 + .word 0xfff395a8 + .word 0x00031eb8 + .word 0xfff5b7ea + .word 0x000b18f5 + .word 0xfffd99bd + .word 0xfffd6f11 + .word 0xfff81647 + .word 0x0004f41f + .word 0x000b47c9 + .word 0xfffe8ac6 + .word 0x0001706b + .word 0x0004c4fb + .word 0x000574b2 + .word 0xfffc1cb6 + .word 0xfff4b19e + .word 0x000e4ca4 + .word 0x0009c752 + .word 0x000ca195 + .word 0xfff4869c + .word 0x00032790 + .word 0x0006f4cb + .word 0x0000640d + .word 0x00022e47 + .word 0x00013f39 + .word 0xfff29bc3 + .word 0xfffb434b + .word 0x000a8039 + .word 0x000295a1 + .word 0x0004b864 + .word 0xfffaed5f + .word 0x0009ed10 + .word 0x0000b12e + .word 0x000f572f + .word 0xfff109d1 + .word 0xfff8d9b0 + .word 0xfff0b219 + .word 0x00099aa7 + .word 0x0007d1fe + .word 0xfff7f30b + .word 0x000a227a + .word 0xfff0f468 + .word 0xfff1dfb6 + .word 0xfff798e8 + .word 0x000ba291 + .word 0xfff5882c + .word 0x000af822 + .word 0xfff18398 + .word 0xffff05d1 + .word 0x0003e297 + .word 0x0006d158 + .word 0xfffffe7c + .word 0x000a4efa + .word 0xfffc5c5f + .word 0xfff54c3b + .word 0x000a830d + .word 0x000fcf42 + .word 0x0008cc4f + .word 0x000880fd + .word 0xfffbbe04 + .word 0xfff283f3 + .word 0xfffafcf3 + .word 0x000f72f1 + .word 0x000e22fe + .word 0x0000c9b6 + .word 0xfff21cb6 + .word 0x000d7713 + .word 0x00060578 + .word 0x000cc0ab + .word 0xfffce430 + .word 0x000d9e74 + .word 0xffff9ccd + .word 0x0005256f + .word 0xfff67cb7 + .word 0x000efd23 + .word 0x00005e32 + .word 0xfffeb9d9 + .word 0xfffc638c + .word 0xfffe09ef + .word 0x0009378d + .word 0x000d551c + .word 0xfff3abe6 + .word 0x000d4e19 + .word 0xfff4a725 + .word 0x00096351 + .word 0xfff310ec + .word 0xfff77642 + .word 0x000ee28d + .word 0xfffdf5b4 + .word 0xfff378ac + .word 0x00025bc9 + .word 0xfff969d1 + .word 0x000de33b + .word 0x00018353 + .word 0xfff82e35 + .word 0x000e71f4 + .word 0xfff262e5 + .word 0xfff90cda + .word 0x000328cf + .word 0xfffdc693 + .word 0x000f09ee + .word 0xffffe781 + .word 0x0001e2e7 + .word 0xfff9ef50 + .word 0xfffd4a1b + .word 0x000b9075 + .word 0xfff65138 + .word 0x000330a7 + .word 0xfff4a48b + .word 0x00039c43 + .word 0xffffe125 + .word 0xfff76ebd + .word 0x000cf038 + .word 0x000a0ad0 + .word 0xfff37352 + .word 0x000bfd64 + .word 0x000b7e36 + .word 0x0008ac8a + .word 0x0007312d + .word 0x000d5fad + .word 0x0003020f + .word 0xffff21fb + .word 0xfffc1198 + .word 0x000d7b64 + .word 0x00032428 + .word 0x0001d007 + .word 0x0002e4cb + .word 0x0005f3e3 + .word 0xfff229c5 + .word 0x000e78e9 + .word 0x0009b316 + .word 0x000a9792 + .word 0xffff896b + .word 0x000d9fb3 + .word 0xfff30356 + .word 0x0008f054 + .word 0xfff1bde9 + .word 0x00033c69 + .word 0xfffb30a4 + .word 0x00093cbb + .word 0xfff1c771 + .word 0x000dcc9b + .word 0xfff684ac + .word 0x00069624 + .word 0x0003f375 + .word 0xfff4d42d + .word 0x0001903d + .word 0x000b6f9c + .word 0xfff0e2ec + .word 0xfffee1d6 + .word 0x00098ae1 + .word 0xfff73c2c + .word 0x000fbfd8 + .word 0xfff1abec + .word 0xffff15d4 + .word 0xffffb23b + .word 0xfff84375 + .word 0x00045439 + .word 0x0007e684 + .word 0xfff6c6f5 + .word 0xfff4dbeb + .word 0x0009d9e9 + .word 0x0004fc32 + .word 0xffffd120 + .word 0xfff65363 + .word 0xfffbb4ac + .word 0xfff9b568 + .word 0x0005d6a9 + .word 0xfffd5262 + .word 0xfff54086 + .word 0x000d28f2 + .word 0xfffb3e45 + .word 0x000eb476 + .word 0x000fd48d + .word 0xfffe5ae6 + .word 0x00006909 + .word 0x0005bf2f + .word 0x000ef4da + .word 0xfffe0311 + .word 0x000eb05b + .word 0xfffaf3b7 + .word 0xfff6bb9b + .word 0x000d44d7 + .word 0xfff9ff30 + .word 0xfffb2fa1 + .word 0x00018d9e + .word 0xfff5e157 + .word 0x0000157f + .word 0xfffead06 + .word 0x000263c6 + .word 0x00047ab4 + .word 0x000cde53 + .word 0xfff3574f + .word 0x00039aca + .word 0xfffd0d98 + .word 0x0007bb68 + .word 0xfff93e04 + .word 0xfff067d1 + .word 0xfffcc912 + .word 0x00096ae2 + .word 0x00084386 + .word 0xfff119d5 + .word 0xfff3eee6 + .word 0xfffdf9e4 + .word 0x000a97d2 + .word 0x000d8cca + .word 0xfff6ad07 + .word 0x00018dfa + .word 0x00023bb0 + .word 0xfff53d1c + .word 0x000663ea + .word 0x0004371c + .word 0x00011605 + .word 0xfff74756 + .word 0xfffc80a7 + .word 0x0001e417 + .word 0x00008c5e + .word 0x00085e67 + .word 0x00010efc + .word 0x00087ae7 + .word 0xffffd957 + .word 0x00074a30 + .word 0xfffff06f + .word 0xfffb342f + .word 0x0005bf01 + .word 0xfff5b958 + .word 0xfff0cc61 + .word 0x000f2fd8 + .word 0x000560ca + .word 0xfff530f6 + .word 0x000e2060 + .word 0x000e3f32 + .word 0x0002a3f8 + .word 0x00069f2a + .word 0xfff4c0fc + .word 0x000325df + .word 0x000bbc16 + .word 0x000da5f5 + .word 0x00059234 + .word 0x000f82d1 + .word 0xfff67a14 + .word 0xfff2d162 + .word 0x000183c7 + .word 0xfff84f05 + .word 0x000404a6 + .word 0xfff00d14 + .word 0xfff8abd1 + .word 0x0002653e + .word 0xfff03339 + .word 0x0006769f + .word 0xfff9e7be + .word 0xfff500f4 + .word 0xffff693d + .word 0x00031240 + .word 0xfff01b21 + .word 0x0006d45d + .word 0x0003fd3a + .word 0xfff1f58a + .word 0x000662a7 + .word 0x00040789 + .word 0xffff98a2 + .word 0xfffe249a + .word 0x0004591b + .word 0x000efd0a + .word 0xfff7488f + .word 0x000bd6d8 + .word 0x0003ef73 + .word 0xfff5ff1e + .word 0x0004d3b4 + .word 0x0004dde2 + .word 0xfff3cc34 + .word 0xfff70eac + .word 0xfff0ef4c + .word 0x0005723a + .word 0x00019078 + .word 0x000c2205 + .word 0xfffffc02 + .word 0xfffc9632 + .word 0x00061301 + .word 0xfff3ce98 + .word 0xfff272cc + .word 0x0002091a + .word 0x0003a6cc + .word 0xfff5d8c3 + .word 0xfff3014e + .word 0xfffcaf99 + .word 0xfff4912d + .word 0xfff379cf + .word 0xfffd1b38 + .word 0x0000ecc8 + .word 0xfff87d9d + .word 0x0001c923 + .word 0x000dd743 + .word 0xfff5b01b + .word 0x0004fe5b + .word 0xfff14a8b + .word 0xfffdcf9d + .word 0x00057bf4 + .word 0x000d486f + .word 0x0006dcaa + .word 0xfff3b971 + .word 0xfff2f664 + .word 0x0002199b + .word 0x0009d4e1 + .word 0xfffd2b5a + .word 0x000e52df + .word 0xfffaa2b1 + .word 0x000e68d3 + .word 0xfff14312 + .word 0x00027290 + .word 0x0004acff + .word 0x000cdd13 + .word 0x0001f17b + .word 0x000c6a49 + .word 0xfff6e367 + .word 0x000312b9 + .word 0x000761cb + .word 0xffff2205 + .word 0xfff4c302 + .word 0x000deb96 + .word 0xffffdeb9 + .word 0x0001fca8 + .word 0x00021865 + .word 0xfff2b0cb + .word 0xfff714f9 + .word 0xfff3be9a + .word 0xfffca2e4 + .word 0xfff5aa6b + .word 0xfffe4a3b + .word 0x000d45a2 + .word 0x0003a946 + .word 0x0002263b + .word 0x000442e7 + .word 0xfff9bd8e + .word 0xfffdca6f + .word 0xfffa01be + .word 0x000c2f72 + .word 0xfff861c4 + .word 0xfffdc395 + .word 0xffff1324 + .word 0xfff783bf + .word 0x000a4940 + .word 0xfffe77dc + .word 0xfffde051 + .word 0x000e289b + .word 0x0000eb6f + .word 0xfff78bf0 + .word 0x000ce4f8 + .word 0x0000a97e + .word 0xfff633dc + .word 0xfffa409f + .word 0xffff2217 + .word 0xfff4bd74 + .word 0xfffb5c14 + .word 0xfff671c9 + .word 0x000a4069 + .word 0xfff5ebf3 + .word 0xfffa3227 + .word 0x000fc8cb + .word 0x000101e8 + .word 0xfffcef4d + .word 0x000eeed8 + .word 0xfffec4a4 + .word 0x00058a9f + .word 0x000c6069 + .word 0xfff38d18 + .word 0xfff487b4 + .word 0x000a09ac + .word 0xfffa673e + .word 0xfff4123d + .word 0x000043e3 + .word 0x000e9bbb + .word 0x00024382 + .word 0x00018f64 + .word 0x000bffd5 + .word 0xfff6bae8 + .word 0x000ce14d + .word 0x000dfd70 + .word 0x0000fcf4 + .word 0x000e3e67 + .word 0x000eb706 + .word 0xfffdc4a7 + .word 0x000dfd02 + .word 0xfff2dca3 + .word 0xfff8f9f7 + .word 0xfff5b0ed + .word 0xffff90e0 + .word 0xfff228f8 + .word 0xfff96b0b + .word 0x000034d9 + .word 0x0006b257 + .word 0xfff47efd + .word 0x000722e4 + .word 0xfff42f3e + .word 0xfffc64c5 + .word 0xfffb0a20 + .word 0xfffc2742 + .word 0x00012f8c + .word 0x000dcd87 + .word 0x0004f34f + .word 0x0007936f + .word 0x0005a2eb + .word 0xfff85bad + .word 0xfff106af + .word 0xfff6037f + .word 0xfff8ed7b + .word 0x0008b842 + .word 0xfffdcad1 + .word 0x0000a56d + .word 0xfff83af9 + .word 0xfffb63b0 + .word 0x0001e463 + .word 0x0009bcea + .word 0x000f8893 + .word 0xfff064da + .word 0x0002bd2e + .word 0x000c74c8 + .word 0xfffe15a7 + .word 0x000f05c0 + .word 0xfffd0c55 + .word 0x000acb82 + .word 0xfffe8f1b + .word 0x000e76f1 + .word 0x000dfe80 + .word 0x0009a51d + .word 0x0005b2dc + .word 0x00075fe7 + .word 0x0005b424 + .word 0xfffbb547 + .word 0x000bc1ab + .word 0xfff6902b + .word 0x00084520 + .word 0xfff7da96 + .word 0x00092a74 + .word 0xfff353bd + .word 0xfff09f17 + .word 0x000f2e91 + .word 0x000e2866 + .word 0xfff1f1ab + .word 0x00057e0c + .word 0x000c27e4 + .word 0xfff7eca2 + .word 0x0006c98a + .word 0x0007e900 + .word 0xfffc8efd + .word 0x000f9592 + .word 0xfff1d222 + .word 0xfffeeed3 + .word 0xfff5b1a4 + .word 0xfffc9506 + .word 0x000f0b13 + .word 0x000c774a + .word 0xfffc3dd6 + .word 0xfff927af + .word 0x000bdc03 + .word 0x000c45fa + .word 0xfff8a1a3 + .word 0x00004db5 + .word 0xfff3448c + .word 0x000f0532 + .word 0xfff33443 + .word 0x0000e046 + .word 0xfffbec86 + .word 0x000ab237 + .word 0x000750f5 + .word 0x000a69e0 + .word 0x0007c3d1 + .word 0xfffeae44 + .word 0xfff943dc + .word 0xfff024a9 + .word 0x00015647 + .word 0x0001c5b0 + .word 0x000ee173 + .word 0xfff799e5 + .word 0x000da5ed + .word 0x0002fe80 + .word 0xfff79d1a + .word 0x000be446 + .word 0x000b4036 + .word 0xfffc048c + .word 0xfff9bc21 + .word 0xfff87fa1 + .word 0x000b929f + .word 0x000013ff + .word 0xfffbbfa6 + .word 0x000071a6 + .word 0x00074467 + .word 0xfff46315 + .word 0x000ef865 + .word 0x000d8e32 + .word 0x000d51a6 + .word 0x00042ab9 + .word 0x000967b9 + .word 0x000d2e2f + .word 0xfffae40a + .word 0x000c4717 + .word 0x000bf4b6 + .word 0xfffa6e76 + .word 0xfffa38a4 + .word 0x00002f4a + .word 0xfffb0f67 + .word 0xfffeeeaf + .word 0x0007f153 + .word 0x000a941e + .word 0xfffbe1e9 + .word 0xffffd297 + .word 0xfff3504f + .word 0xfff24a22 + .word 0x00024fe2 + .word 0x000ac583 + .word 0x0002a3d2 + .word 0x000a4db4 + .word 0xfff940ea + .word 0xfff8cb05 + .word 0xfffa6aec + .word 0xfff58897 + .word 0xfffe133a + .word 0x00075f91 + .word 0xfff30543 + .word 0x000869cc + .word 0xfff2c9a8 + .word 0x000da796 + .word 0x000511aa + .word 0x000081a6 + .word 0xfff4faac + .word 0xfff6a205 + .word 0xfffda7b7 + .word 0xfff50ea9 + .word 0xfffc8e5d + .word 0x000061c9 + .word 0xfff2ad2e + .word 0x0006a970 + .word 0xfff3c988 + .word 0x000702a5 + .word 0xfff3c837 + .word 0x000e08e3 + .word 0xfffefc8b + .word 0xfffcfd91 + .word 0x0008f555 + .word 0xfff05aed + .word 0xfff0dc43 + .word 0x0006b399 + .word 0xfffce5d1 + .word 0xfffe6d05 + .word 0xfff4daab + .word 0xfff36d7e + .word 0xfff6a694 + .word 0x0003f8a8 + .word 0x000c4cf3 + .word 0xfffc8547 + .word 0xfffe59b2 + .word 0xfff13bbf + .word 0x0009cc29 + .word 0xffffe5bd + .word 0x000f519c + .word 0x0007898a + .word 0xfff1add2 + .word 0xfff82bc9 + .word 0xfffdcaf6 + .word 0xfff61f2e + .word 0x0000df31 + .word 0x000e8f8b + .word 0x000e8c4f + .word 0x000f538b + .word 0xfff6f319 + .word 0x000f631b + .word 0xfffc79e1 + .word 0xfff2399d + .word 0x00086c63 + .word 0xfff39ac9 + .word 0x0005ea3e + .word 0xfff92195 + .word 0xfff038d9 + .word 0x00089391 + .word 0x00088b14 + .word 0x0000988f + .word 0xfff10038 + .word 0x00058c41 + .word 0xfff37d92 + .word 0xfff6f5ab + .word 0x00002ad3 + .word 0x0004dfb4 + .word 0x000af799 + .word 0xfff50c8d + .word 0x000c6bc1 + .word 0x000eb6b8 + .word 0xfffa6e86 + .word 0x00037083 + .word 0x0002ce9c + .word 0x00054bc8 + .word 0xfff02615 + .word 0xfff8ab2c + .word 0x000ef79f + .word 0x0003a435 + .word 0x0009a2c6 + .word 0x000422d5 + .word 0x0005ec0b + .word 0xfffb0699 + .word 0xfff74c13 + .word 0x0009936d + .word 0xfff28d14 + .word 0xfff811a3 + .word 0x000d4243 + .word 0xfffc09d5 + .word 0xfffa9401 + .word 0x0002e3dc + .word 0x0005c4f1 + .word 0xfff81532 + .word 0xfffb3193 + .word 0x0005ce53 + .word 0x000362cc + .word 0xfff97ce6 + .word 0xfff9500c + .word 0xfff9850b + .word 0x0009f84b + .word 0xffff6788 + .word 0x0007c49a + .word 0x000ce5b5 + .word 0x000130b9 + .word 0x000d1c0d + .word 0x00030c53 + .word 0x00093b3c + .word 0x000e9f44 + .word 0xfff63aa7 + .word 0x000d145e + .word 0xfff563b7 + .word 0x00067d6a + .word 0xfffc29a0 + .word 0x000e2aae + .word 0xfff4b573 + .word 0xfff00409 + .word 0x0001964e + .word 0x000672af + .word 0x0002ae4e + .word 0xfff44338 + .word 0x000071af + .word 0x000de1b3 + .word 0x0007ba40 + .word 0xfff8e57e + .word 0xfff4c508 + .word 0xfff7a416 + .word 0x00005587 + .word 0xfff9d0ae + .word 0x0002962d + .word 0x000a323d + .word 0x0008d268 + .word 0x000da9ed + .word 0x000edb34 + .word 0x000dd346 + .word 0x000c32d8 + .word 0xfff1bba0 + .word 0xfff7f02c + .word 0x00002c0c + .word 0xfffb6b22 + .word 0x000846bc + .word 0x000e7c26 + .word 0xfffd8a3b + .word 0x000254ca + .word 0x000c04e8 + .word 0x0007fe16 + .word 0xfff43f86 + .word 0xfff11599 + .word 0x000707e3 + .word 0xfff9584e + .word 0x000c5a52 + .word 0xffffcc02 + .word 0xffff29fb + .word 0xfff0c9d0 + .word 0x00067338 + .word 0x0006afb8 + .word 0x000556c4 + .word 0xfffd5fe8 + .word 0xfff82622 + .word 0xffffa42b + .word 0xfff9ff34 + .word 0xfff63e53 + .word 0xfffc5a41 + .word 0xffffb4da + .word 0x000948fe + .word 0xfff30532 + .word 0x000f1e82 + .word 0xfffbbf2e + .word 0xfff5426e + .word 0xfff853c7 + .word 0x000a8446 + .word 0xfffd920c + .word 0xfff43ce4 + .word 0x0004a92a + .word 0x000e8da2 + .word 0x000252c6 + .word 0xfffb7ec0 + .word 0x00024162 + .word 0x00020223 + .word 0x000f2bf6 + .word 0xfff78678 + .word 0x0001ac37 + .word 0x0001c567 + .word 0x000b2337 + .word 0x0008d7b1 + .word 0xfff07108 + .word 0x000cddb0 + .word 0x0001bcb4 + .word 0xfff840df + .word 0x000af5a9 + .word 0x00013d03 + .word 0x0008dfed + .word 0xfff6daf5 + .word 0xfff87816 + .word 0xfff37698 + .word 0xfffdb0ee + .word 0xfff4e6aa + .word 0x00039046 + .word 0x000553b8 + .word 0xfffb47e2 + .word 0xfff2c2a1 + .word 0x000a87d7 + .word 0xfff1d1ab + .word 0x0006536b + .word 0x0007143c + .word 0x00057028 + .word 0xfffc5162 + .word 0xfffd3516 + .word 0x0004d85d + .word 0xffffaf46 + .word 0x00079744 + .word 0xfffae941 + .word 0xfff68bbe + .word 0x000dc422 + .word 0xfffabd0a + .word 0x000953c1 + .word 0xfffaffd6 + .word 0xfff2589b + .word 0xfff54d4a + .word 0x0001abec + .word 0x00035339 + .word 0xfff6be49 + .word 0x000d7238 + .word 0xfffd56c0 + .word 0xfff9a4f9 + .word 0x000d563a + .word 0xfff409a9 + .word 0x0003a416 + .word 0xfff76eda + .word 0xfff64124 + .word 0xfff2c3cc + .word 0xfff5439b + .word 0xfff3068e + .word 0xfffc3b1d + .word 0x0006fdac + .word 0xfff68254 + .word 0x0002eae8 + .word 0xfffafa65 + .word 0x0006c086 + .word 0x000691d8 + .word 0xfffd70c9 + .word 0xfffca420 + .word 0xfff7c656 + .word 0x000466f8 + .word 0xfff73fe4 + .word 0xfff8e0d3 + .word 0x00006e5b + .word 0x0002e279 + .word 0x00046e9a + .word 0xfff472f5 + .word 0x000ad33f + .word 0xfffee76e + .word 0xfff0a670 + .word 0x0005619e + .word 0xfffe4eac + .word 0x000bfda1 + .word 0x00007dde + .word 0xfff9aa9e + .word 0xfff8c5d3 + .word 0xfff49856 + .word 0xfff0beb7 + .word 0x0001248e + .word 0x000aa659 + .word 0x0000b66e + .word 0xfff8ca05 + .word 0x000d1262 + .word 0xfff28068 + .word 0xfffb2f98 + .word 0xffff895e + .word 0xfffbe579 + .word 0xfff617c4 + .word 0x00076816 + .word 0xfffff489 + .word 0x0008401b + .word 0x00082829 + .word 0x0008422f + .word 0x00037bf3 + .word 0xfff5e108 + .word 0xfffb0fa4 + .word 0x000840b3 + .word 0x000f3fa4 + .word 0xfff686d5 + .word 0x0007859c + .word 0x0003d621 + .word 0x00082e9f + .word 0x0000d098 + .word 0x000b70fa + .word 0xfffc404d + .word 0xfffccf0a + .word 0xfff52a8b + .word 0xfff0ba79 + .word 0x000f977d + .word 0x000661ae + .word 0xfff62096 + .word 0x00067e61 + .word 0xfffead42 + .word 0xfff2fe04 + .word 0x00024160 + .word 0x000bae60 + .word 0x0008409e + .word 0xfff62da4 + .word 0xfff444c6 + .word 0xfff47ab6 + .word 0x0006cf8d + .word 0x000c63fb + .word 0xfff4c4af + .word 0x000a02be + .word 0x000dc3cb + .word 0x000b94ec + .word 0xfff41b22 + .word 0x0008f33b + .word 0x00024630 + .word 0xfffc3907 + .word 0x000aeb14 + .word 0xfff7ba06 + .word 0x00089ad8 + .word 0xfff00cd0 + .word 0x000acb77 + .word 0xfffd0ed9 + .word 0x000e0899 + .word 0x00059f98 + .word 0x00062d75 + .word 0x000494e5 + .word 0x00085e98 + .word 0xfff7b5f4 + .word 0x0003137b + .word 0x000c3457 + .word 0x000c9757 + .word 0x00095c39 + .word 0x000ad6fe + .word 0x0001bded + .word 0xfffd91ac + .word 0x0007e171 + .word 0xfff135f8 + .word 0xfff029f3 + .word 0x0004c7fe + .word 0x000898bf + .word 0xfff2e3aa + .word 0xfffad357 + .word 0x0005fb8c + .word 0x0004135c + .word 0x0003eb9a + .word 0x000b27ba + .word 0x000b05fd + .word 0xfffc7dd8 + .word 0x000e1c2c + .word 0x00059a83 + .word 0x000921ce + .word 0xfff4dcbd + .word 0xfff6627a + .word 0xfff6bf4d + .word 0xfff3f8e0 + .word 0x000bc558 + .word 0xfff796d3 + .word 0xffff5942 + .word 0xfff02b34 + .word 0xfff25fa9 + .word 0xfff862a9 + .word 0xfff3dddf + .word 0xffffebd2 + .word 0x000b6ecb + .word 0xfff6d34e + .word 0xfffd4f3b + .word 0xfffc0116 + .word 0xfffced22 + .word 0xfffcc16c + .word 0x000d9d7a + .word 0xfff890b4 + .word 0x000ca0c1 + .word 0x000c504b + .word 0x00096f6c + .word 0xfffb2372 + .word 0x000a609a + .word 0xfff71b14 + .word 0x000c74e4 + .word 0x000a4a4e + .word 0x0006a996 + .word 0xfff1b720 + .word 0x000685eb + .word 0xfff06523 + .word 0x000e6fe1 + .word 0x0006f533 + .word 0xfff0cedb + .word 0x000f7d51 + .word 0xfff54dfb + .word 0x0009bac6 + .word 0x0006365c + .word 0xfffc5236 + .word 0xfff19ebe + .word 0x000b90a3 + .word 0xfffc39c4 + .word 0xfff3029d + .word 0xfff6092f + .word 0x000466fa + .word 0x0008489a + .word 0xfff3bb9c + .word 0x00013a3f + .word 0x000416cc + .word 0x00056685 + .word 0x000109fa + .word 0xfff316ac + .word 0x00072ace + .word 0xfff8cbdd + .word 0xfff3ded0 + .word 0xfff57bdb + .word 0xfff1ef70 + .word 0xfffe3d63 + .word 0x00033a45 + .word 0x000e223a + .word 0x00021a7f + .word 0x0006b587 + .word 0xfff506a4 + .word 0x0009a761 + .word 0xfffd90b9 + .word 0x000ccf7f + .word 0x000961b6 + .word 0xfff15d04 + .word 0x000b869c + .word 0xfff0804d + .word 0xfff757f1 + .word 0xfff6977e + .word 0xfff3199e + .word 0xfff71072 + .word 0x000746c4 + .word 0x0006f490 + .word 0xfff476c6 + .word 0x000034be + .word 0xfff8f9f6 + .word 0x00040814 + .word 0xfffe50c5 + .word 0xfff86f13 + .word 0x000fb2c7 + .word 0xfff7dc90 + .word 0x00087e52 + .word 0xfff13081 + .word 0xfff1da73 + .word 0xfff0aa05 + .word 0x00068eb0 + .word 0xfff8d032 + .word 0xfff76fa7 + .word 0xfff1e4c6 + .word 0xfff93d4e + .word 0xfff2f7cd + .word 0xfff6e782 + .word 0xffff9ccb + .word 0x000bb9d6 + .word 0x0002fc9b + .word 0x000ca421 + .word 0xfffde10d + .word 0xffffa3d3 + .word 0x0006fbb4 + .word 0x00062804 + .word 0x000c05a2 + .word 0xfff63147 + .word 0xfffc6dd5 + .word 0x000578af + .word 0x00095840 + .word 0x00010d08 + .word 0xfff16490 + .word 0xfff4c74c + .word 0xfff6e675 + .word 0x0009c295 + .word 0x000be585 + .word 0x000795a9 + .word 0xfffd5982 + .word 0xfffa02ac + .word 0x000e936c + .word 0x0009a40e + .word 0x00077ad8 + .word 0x00029360 + .word 0xffff93c0 + .word 0x0008f2a1 + .word 0xfff5f1a8 + .word 0xfff33db4 + .word 0x000a8af2 + .word 0x000148cd + .word 0xfffee8b3 + .word 0x000376a6 + .word 0xfffdf6bc + .word 0xfff5a052 + .word 0xfff16a69 + .word 0x000794f8 + .word 0x000ea3f5 + .word 0xfff5e98e + .word 0x000ae3ca + .word 0x000766c8 + .word 0xfff57435 + .word 0x0002c003 + .word 0xfff1cf7f + .word 0xfffbb379 + .word 0xfffd567f + .word 0x000f4d82 + .word 0x00003a48 + .word 0xfff9a418 + .word 0x000b250b + .word 0x0008245e + .word 0xfff5044b + .word 0xfffafb8f + .word 0x0005ed91 + .word 0x000d4275 + .word 0xfffa850c + .word 0x000a62d0 + .word 0x000ef148 + .word 0xfff9a62b + .word 0x0007f908 + .word 0xfff0dbe3 + .word 0x00094116 + .word 0x000a2c44 + .word 0x00015980 + .word 0x000e099f + .word 0xfffbeea1 + .word 0xffff4dd9 + .word 0xfffcd779 + .word 0x000eafd9 + .word 0x000fc8d8 + .word 0x000faa20 + .word 0xfffbc2b1 + .word 0x0000858d + .word 0x00080778 + .word 0xfff2732f + .word 0x0004295c + .word 0xfff464fe + .word 0x000fce8d + .word 0x000315d0 + .word 0x000af32e + .word 0xfffac41b + .word 0xfff830ac + .word 0xfff682bf + .word 0x000c5c52 + .word 0x00087b5b + .word 0x0003c468 + .word 0xfff20dbb + .word 0xffff6776 + .word 0x000e8e6e + .word 0xfffd7367 + .word 0xfff9ebc8 + .word 0x00010212 + .word 0xfff78797 + .word 0x0000acc2 + .word 0xfff09e48 + .word 0x0001fd11 + .word 0xffff02fb + .word 0x000e0030 + .word 0xfff37503 + .word 0xfff7866f + .word 0x0004248d + .word 0x00090a80 + .word 0x00015ad4 + .word 0x000b0d9f + .word 0xfffd16af + .word 0xfff98c71 + .word 0xfffe3aa8 + .word 0xfff45631 + .word 0xfffae69c + .word 0x000269f2 + .word 0xfff4125a + .word 0xfff1e2f8 + .word 0x000d9ddd + .word 0x000eca22 + .word 0xfffd73d9 + .word 0xfff5bf7e + .word 0x0009295f + .word 0x000cf1cf + .word 0x0007f4b7 + .word 0x0009b79a + .word 0x000f1027 + .word 0x000c0a37 + .word 0x0002dc7f + .word 0x0006e648 + .word 0xfffcd862 + .word 0x0008992d + .word 0x0004c2f8 + .word 0xfff5429a + .word 0xfff18233 + .word 0x00070646 + .word 0xfffe1035 + .word 0xfffbf047 + .word 0xfff3727b + .word 0xfff63cd0 + .word 0x0000d6ca + .word 0xfff22cc4 + .word 0xfff73f5a + .word 0xfff75cc2 + .word 0xfff96d2b + .word 0x0003c368 + .word 0x00007e2e + .word 0xfffe51d2 + .word 0x00014618 + .word 0x000da1df + .word 0xfff82b5a + .word 0x000e155b + .word 0x000ac1ee + .word 0x000d4b24 + .word 0x0004e3ef + .word 0x00016bd2 + .word 0x0000c826 + .word 0x00090d48 + .word 0xfff9c1c0 + .word 0x000a9a24 + .word 0xfff120a9 + .word 0xfffbb0e4 + .word 0xfffe218a + .word 0x000f3f76 + .word 0x000a431c + .word 0xfff06d01 + .word 0x000755df + .word 0x000e187e + .word 0xfff594a1 + .word 0xfff250e8 + .word 0x0003d020 + .word 0xfffcfd46 + .word 0xfffb966f + .word 0xfff4b22d + .word 0xfff98292 + .word 0xfff5717f + .word 0xffff5c26 + .word 0x0004bb85 + .word 0xfff58660 + .word 0x0001497b + .word 0x000fbed3 + .word 0xfff72f1b + .word 0x00071fc4 + .word 0x0008cc09 + .word 0x000b2bbe + .word 0xfff98310 + .word 0xfff02d70 + .word 0x0001ded4 + .word 0x00070159 + .word 0xffff07b1 + .word 0x000fb9a4 + .word 0xfff53bd5 + .word 0x000af1db + .word 0xfff9d6bb + .word 0x0001273e + .word 0xfffcba81 + .word 0x00002c46 + .word 0x00050747 + .word 0xffffa27e + .word 0xfff061c3 + .word 0x0007a0cd + .word 0xfffbff22 + .word 0x00069d38 + .word 0xfff733a8 + .word 0x0009c825 + .word 0xfff022a1 + .word 0x000daeaa + .word 0xfff2d444 + .word 0xfff90421 + .word 0xfff1a709 + .word 0x000d6309 + .word 0xfff30c6f + .word 0xfffa8766 + .word 0xfff6103d + .word 0xfff5a017 + .word 0x0005b11f + .word 0xfffbbf1c + .word 0x00036291 + .word 0x000ee8c1 + .word 0x0002eda2 + .word 0xfffd1b87 + .word 0xfffc66f5 + .word 0xfff36a23 + .word 0xfffa84f3 + .word 0xfff55db5 + .word 0x000df9a4 + .word 0x000055cd + .word 0xfff5071a + .word 0xfffba2db + .word 0xfffd7ce0 + .word 0x00027f7e + .word 0xfffeb1ae + .word 0x000ce64b + .word 0xfffb6cf4 + .word 0xfff222da + .word 0xfff7e1a8 + .word 0xfff1bf67 + .word 0xfffbccb4 + .word 0x000e3fe5 + .word 0x00006420 + .word 0x000766c4 + .word 0x000f8216 + .word 0xfffde1dc + .word 0xfff43274 + .word 0xfffc8bfd + .word 0x0006fabd + .word 0x000643a0 + .word 0x00050f6a + .word 0x00029e28 + .word 0x0000f032 + .word 0xfff690f5 + .word 0x000e21d6 + .word 0x00068f56 + .word 0xfffa3547 + .word 0x000201b5 + .word 0xfffc7801 + .word 0x000704b2 + .word 0x00058e7f + .word 0xfff0e82f + .word 0xfff49a69 + .word 0xfff4c526 + .word 0x000a0675 + .word 0x000f8b13 + .word 0x00013b58 + .word 0x00005414 + .word 0x0000c963 + .word 0x00059588 + .word 0xfff1eb4b + .word 0xfff149b5 + .word 0x0002f7fd + .word 0x00036f75 + .word 0x00004a76 + .word 0xfffcc20c + .word 0xfffa2df0 + .word 0xfff41d88 + .word 0xfff5f60e + .word 0x000fdaeb + .word 0x000bec21 + .word 0xfffc9fdf + .word 0x00070cd6 + .word 0xfffe20aa + .word 0xfff7bc80 + .word 0xfff6dadb + .word 0x00092a37 + .word 0x00093f4b + .word 0x00013d78 + .word 0x00049e8b + .word 0xfff70af2 + .word 0x0000faf9 + .word 0x000302a6 + .word 0x00025f18 + .word 0x00032aa8 + .word 0xfffca417 + .word 0x000d0a62 + .word 0x0000125d + .word 0xfff5ee48 + .word 0x0002e02a + .word 0x00023d59 + .word 0x00030a3e + .word 0xfff75a7a + .word 0xffff6958 + .word 0x0009aac4 + .word 0xffff4414 + .word 0x0004e8f3 + .word 0x0009e82d + .word 0x0008f506 + .word 0x00082483 + .word 0xfffa9da3 + .word 0xfff2e4ce + .word 0x000b9dd0 + .word 0x000d407a + .word 0xfff92043 + .word 0xfff0d2d7 + .word 0x0004458d + .word 0x000edfa9 + .word 0xfff99b9b + .word 0xfff2c2fc + .word 0xfffebb9a + .word 0xfff8a7a3 + .word 0xfff4cf60 + .word 0x000bbe23 + .word 0x00006113 + .word 0xfffc8902 + .word 0x000c537d + .word 0x00055f16 + .word 0xfffe9aa9 + .word 0x000e1399 + .word 0xfffe88d8 + .word 0xfffb3391 + .word 0x0004b488 + .word 0xfff71f25 + .word 0xfffbf009 + .word 0xfffab20e + .word 0xfff5aa23 + .word 0xfffa1ba6 + .word 0xfff6bdf1 + .word 0x0002e34d + .word 0xfffe8eea + .word 0xfffc0b6f + .word 0xfff3a438 + .word 0x0004f251 + .word 0x000666ba + .word 0x00005022 + .word 0x0005ca66 + .word 0xfffa43b1 + .word 0x0008f989 + .word 0x00008b14 + .word 0x000d0ab8 + .word 0x00028fa6 + .word 0x000c9577 + .word 0x00058d46 + .word 0x00055a89 + .word 0xfff64abe + .word 0x000bfc69 + .word 0x000ac313 + .word 0x00095666 + .word 0x000ff83c + .word 0xfff39cea + .word 0x000cd452 + .word 0xfff47b0c + .word 0x0006f90f + .word 0x000dcafb + .word 0xfffebd4e + .word 0x000c5304 + .word 0x0005a5f9 + .word 0x00098db0 + .word 0xfff48bf9 + .word 0xfff7063b + .word 0xfff530ca + .word 0x000c8135 + .word 0xfff65041 + .word 0x000877d6 + .word 0x0002864a + .word 0x00078e21 + .word 0xfff874e9 + .word 0x0006e295 + .word 0x000268ab + .word 0xffff3dd5 + .word 0xfff6241c + .word 0x000af039 + .word 0xfff95164 + .word 0xfff90479 + .word 0x0002b2cc + .word 0xfffcabd0 + .word 0xfff188df + .word 0x0002ee06 + .word 0x000847a9 + .word 0x000ea444 + .word 0xfffa5950 + .word 0x000dc2d0 + .word 0xfff52804 + .word 0xffff829f + .word 0xfff2452d + .word 0xfff0383d + .word 0xfff65c11 + .word 0xfff775d5 + .word 0x0006420a + .word 0xfff99059 + .word 0xfff26b04 + .word 0xfff39eff + .word 0xfffcfda9 + .word 0x0007024d + .word 0x000bca49 + .word 0xffffc09a + .word 0xfffe0cf5 + .word 0xfff14d8c + .word 0x000a977a + .word 0xfff53260 + .word 0xfff5897a + .word 0x0007437b + .word 0xfffc91dc + .word 0x000f5b2f + .word 0xfff3c02e + .word 0xfff61143 + .word 0xfff7a39f + .word 0x00081ce2 + .word 0xffff9406 + .word 0xfff534d8 + .word 0xfff442a9 + .word 0x0007517f + .word 0xfff1ffe3 + .word 0x0004c699 + .word 0x0005cf7a + .word 0xfff983eb + .word 0xfffbeab5 + .word 0x00022491 + .word 0x000b6633 + .word 0xfffaaaf0 + .word 0xfffd63b5 + .word 0x000f1cf7 + .word 0xfff01756 + .word 0x000c295f + .word 0x000ecf90 + .word 0x00010f7a + .word 0x000bb27e + .word 0x000aae1e + .word 0xfff84156 + .word 0x000b8559 + .word 0x000ceee6 + .word 0x000a2e8d + .word 0xfffde0a7 + .word 0x000dcf72 + .word 0xfff386f2 + .word 0xfffa8a67 + .word 0x000fc138 + .word 0xfff5f8bb + .word 0x000f3753 + .word 0xfffb282b + .word 0x00054c6c + .word 0x000136b4 + .word 0x000e6783 + .word 0xfff48488 + .word 0xfffccc07 + .word 0x00002c25 + .word 0x0000ce70 + .word 0xfff2126c + .word 0x000909b5 + .word 0x0006b0d0 + .word 0x0007b5af + .word 0xfff13171 + .word 0xfff3b17d + .word 0xffff3db8 + .word 0xfff37c4a + .word 0x000f4593 + .word 0x000c769c + .word 0x000e7b27 + .word 0x0007958d + .word 0xfffc451d + .word 0x00019c91 + .word 0x000d21b3 + .word 0x000f2341 + .word 0x000ff082 + .word 0x00049171 + .word 0x00051b54 + .word 0xfff2b33a + .word 0xfff7332c + .word 0xfffe38f5 + .word 0x000e9284 + .word 0xfff9e16c + .word 0x0002547a + .word 0x000e7b24 + .word 0xfff3cb02 + .word 0x000f032b + .word 0x00088918 + .word 0x0005b089 + .word 0xffffe55f + .word 0xfff5f2ae + .word 0x000fcdcc + .word 0xfffb3883 + .word 0x00071737 + .word 0xfffda6ca + .word 0xfffd8ff1 + .word 0xfff6fa82 + .word 0x0005ab8d + .word 0x0002a0dd + .word 0x000d3888 + .word 0xfff5807e + .word 0x0005c4e0 + .word 0xfff4bbc4 + .word 0xfffc0c1a + .word 0xfff9e879 + .word 0xfffb0657 + .word 0xfff93f30 + .word 0xfffbdb15 + .word 0x0001c340 + .word 0x00038fc4 + .word 0xfffb066d + .word 0x0004941e + .word 0xfffa97f4 + .word 0xfff4299c + .word 0x000b175f + .word 0x000b5a2b + .word 0x000f5259 + .word 0x000dd6d9 + .word 0xfff64527 + .word 0xfff94dfc + .word 0xfffdea73 + .word 0x00028ee8 + .word 0x000ade66 + .word 0xfffb5dde + .word 0x0004f39d + .word 0xfff0a8d5 + .word 0xfffbb105 + .word 0xfff9f089 + .word 0xfff5935d + .word 0x000baa83 + .word 0xfff618e5 + .word 0x000f447c + .word 0xfff0735a + .word 0xfffe5739 + .word 0x00097f2b + .word 0xfff11d07 + .word 0xfff3bf9a + .word 0xfff2b32d + .word 0x000d6981 + .word 0xfffd2e11 + .word 0xfff0f62c + .word 0x00068325 + .word 0xfff283c1 + .word 0x000f9f82 + .word 0xfff8b01b + .word 0xfff96c4c + .word 0x000ccd60 + .word 0xfff75131 + .word 0xfffc5fd0 + .word 0x00075d9e + .word 0x00025eb5 + .word 0x000ad12d + .word 0x000657c6 + .word 0x000fc52d + .word 0xfffa1c2f + .word 0x0009aa3b + .word 0x00082df2 + .word 0xfff68258 + .word 0x0002433a + .word 0x00071ca7 + .word 0x00091e0c + .word 0xfff80425 + .word 0xfff1bdea + .word 0xfff3cf40 + .word 0xfffefa14 + .word 0xfff17391 + .word 0xfff147d2 + .word 0xfff8b70e + .word 0x0001204f + .word 0x00002487 + .word 0xfff3a0cd + .word 0x000e154c + .word 0x000496df + .word 0xfff36b6b + .word 0xfff09d6f + .word 0x000b732b + .word 0xfff32a0c + .word 0xfff85a28 + .word 0x0001e3ed + .word 0xfffa5a4e + .word 0x00090c30 + .word 0xfff92a4b + .word 0x00044cc3 + .word 0x0008f457 + .word 0xfff4d082 + .word 0x0008d43f + .word 0xfff21dc1 + .word 0x0005fdf0 + .word 0x00089733 + .word 0xfff7740d + .word 0x0006a2da + .word 0xfffca1a8 + .word 0x000ae0e2 + .word 0x000bffda + .word 0xfffa83b4 + .word 0xfff83b3e + .word 0x0001a848 + .word 0xfffd9ab2 + .word 0x000640ce + .word 0xfff17970 + .word 0x0004e6b9 + .word 0xfff49d84 + .word 0xfff87cea + .word 0x000bd975 + .word 0x0003860b + .word 0xfffbddd0 + .word 0xfffdd1fd + .word 0xfffe4199 + .word 0xfff73d58 + .word 0xfff7664e + .word 0xfff11fb6 + .word 0x0000c726 + .word 0xffff7256 + .word 0x00060713 + .word 0x000b5e31 + .word 0xfffd6e87 + .word 0x000cd185 + .word 0xfffbdb53 + .word 0x000162a2 + .word 0xfff63276 + .word 0x0005e69f + .word 0xfff61be6 + .word 0xfff0e9f5 + .word 0xfffea583 + .word 0x000cf9d1 + .word 0x0006296b + .word 0xfff53b0d + .word 0x000d3cce + .word 0x000817a6 + .word 0x0001a662 + .word 0x000c785f + .word 0xfff618bf + .word 0x000c98cf + .word 0x000c58c8 + .word 0xfffc2fc0 + .word 0x00015f7d + .word 0x000d6a39 + .word 0xfffc9a56 + .word 0xfffe6d92 + .word 0xfff72ef3 + .word 0x00081da2 + .word 0x000691cd + .word 0xfffe319c + .word 0x0006ae0f + .word 0xfff01918 + .word 0xfffe3edb + .word 0xfff6b821 + .word 0xfff09a6b + .word 0xfff52c8e + .word 0xfff14e18 + .word 0xfff08cc7 + .word 0x000f6392 + .word 0xfff67d99 + .word 0xfffe72fe + .word 0x000ca363 + .word 0xffff7bf8 + .word 0x000b10b0 + .word 0x0008cd04 + .word 0xfff1536f + .word 0xfff7bf11 + .word 0x00038564 + .word 0xfff2846c + .word 0xfff67d43 + .word 0x00002afb + .word 0x000a320c + .word 0x0001fcf4 + .word 0x00092b55 + .word 0xfff680ec + .word 0xfff12e6f + .word 0xfff79cd7 + .word 0xfffd7781 + .word 0xfff067b7 + .word 0xfffb9675 + .word 0x00050835 + .word 0xfff32bbb + .word 0xfff03e2d + .word 0xfff1de70 + .word 0x00010bbc + .word 0x0000b993 + .word 0x000de200 + .word 0x0001e573 + .word 0x000a861b + .word 0x0002266b + .word 0xfffb1f8b + .word 0xfff9067f + .word 0xfff48813 + .word 0xfffdf6a9 + .word 0xfff4153a + .word 0x0003240f + .word 0xfff2349c + .word 0x000346ee + .word 0xffff3e6a + .word 0x00044cf9 + .word 0xfff2df0e + .word 0xfff821ff + .word 0xfff0af6f + .word 0x000ff921 + .word 0xfff0a36c + .word 0x00059ff6 + .word 0x000e5cc7 + .word 0xffff1312 + .word 0x0004ae35 + .word 0xfffd0319 + .word 0x0005feb3 + .word 0x00057018 + .word 0xfffd209c + .word 0xfff3b7af + .word 0x00038930 + .word 0x00010a42 + .word 0xfff92aee + .word 0x000bff81 + .word 0xfffad4af + .word 0xfff8ac78 + .word 0xfff3c6ed + .word 0x000bab5f + .word 0x0001a1e3 + .word 0x0000b2b6 + .word 0x000b1fee + .word 0x00053dd8 + .word 0x00001f64 + .word 0xfffa4543 + .word 0xfffb31be + .word 0x000a1806 + .word 0x0005a6da + .word 0x00006f97 + .word 0xfff832e0 + .word 0xfff46731 + .word 0x000200b2 + .word 0xfff7dbcf + .word 0xfffeb33b + .word 0x0009c319 + .word 0x00001b06 + .word 0x0001de1a + .word 0xfff0be5b + .word 0xfff63645 + .word 0xfffef502 + .word 0x0001c08d + .word 0x0002de39 + .word 0xffff9398 + .word 0xfff24bba + .word 0x00041180 + .word 0xfff6ef82 + .word 0x000acf49 + .word 0x000eae4d + .word 0x000d0365 + .word 0xfff15c3e + .word 0xfff93aca + .word 0x000f438a + .word 0xfff49c67 + .word 0xfffc6143 + .word 0x0002d455 + .word 0xfff707f4 + .word 0xfffa87fc + .word 0xfff98218 + .word 0x000dc2d0 + .word 0xfff33138 + .word 0xfff02de2 + .word 0xfff3b53d + .word 0x000eb614 + .word 0xfffb486e + .word 0xfff8fb69 + .word 0x00080e0f + .word 0xfff6add3 + .word 0xfffe2e93 + .word 0xfff42c26 + .word 0x00048a8e + .word 0x000e645d + .word 0x0002103a + .word 0x000e9fe5 + .word 0x000f11db + .word 0x000bd4ff + .word 0xfff0780d + .word 0xfff81777 + .word 0xfff4bd23 + .word 0x0005cad4 + .word 0xfffa1c76 + .word 0xfff78536 + .word 0xfff5e179 + .word 0xfff15040 + .word 0x000f54d0 + .word 0x000517ae + .word 0xfffe21c7 + .word 0x000dda24 + .word 0x000bc792 + .word 0x000305ee + .word 0x000a82c9 + .word 0xfff3f7ee + .word 0x000d8f1d + .word 0x0005788c + .word 0xfffe8bc5 + .word 0x000e2ad3 + .word 0x00001c0f + .word 0x0000b37c + .word 0xfff34e26 + .word 0x00007035 + .word 0xfff3e397 + .word 0x0000a476 + .word 0xfff7507e + .word 0xfff6d589 + .word 0xfff7cee8 + .word 0x0003c198 + .word 0x000e4a2c + .word 0xfff9716d + .word 0xfffa1011 + .word 0x000dca00 + .word 0x0006fc31 + .word 0xfff847cc + .word 0x000e15de + .word 0xfff736d4 + .word 0xfff58047 + .word 0xfff9df08 + .word 0xfff68a93 + .word 0xfffa1d62 + .word 0x0005e795 + .word 0xfff4c879 + .word 0xfff602fe + .word 0x000cd1e6 + .word 0xfff132fa + .word 0xfffcd663 + .word 0x000eb8a5 + .word 0xfff8b8af + .word 0xfff59dd7 + .word 0x00064fe4 + .word 0x000f8dba + .word 0x0006bc20 + .word 0xfff94a3e + .word 0x0002d160 + .word 0xfffecb16 + .word 0xfff4b415 + .word 0x0009d5b5 + .word 0x000be5e4 + .word 0x000364c2 + .word 0x000a5f29 + .word 0xfff43aa9 + .word 0xfff9f137 + .word 0x000c5732 + .word 0xfffc3265 + .word 0xffff3cc7 + .word 0xffff9b8b + .word 0xfff8f1e0 + .word 0x000583c0 + .word 0x000d1dc2 + .word 0x00098fdf + .word 0x0005fcd1 + .word 0xfffb4179 + .word 0xfffb3cf3 + .word 0xfffe50db + .word 0x000423dd + .word 0x00074745 + .word 0x000d7157 + .word 0xfff1eed8 + .word 0xfff2a1ed + .word 0xfff577c3 + .word 0xfffd22a7 + .word 0xfff3cc58 + .word 0xfff27485 + .word 0x000e956d + .word 0xfff93497 + .word 0xfff40845 + .word 0x0001baaa + .word 0xfff8db4a + .word 0xfffb0450 + .word 0xfff6ea00 + .word 0xfffe8616 + .word 0xfffdf950 + .word 0xfff2d3bd + .word 0x000a46aa + .word 0x000e2d42 + .word 0xfffe920a + .word 0xfff7dbe9 + .word 0x0000611d + .word 0x0003183f + .word 0x000cb846 + .word 0xfff08552 + .word 0xfff4f764 + .word 0xfff15c3d + .word 0x000b98fc + .word 0x000b68fa + .word 0x00098abe + .word 0xfff0afa0 + .word 0x0000217b + .word 0xfff014b1 + .word 0xfff91b6c + .word 0xfffd8a92 + .word 0xfff636e2 + .word 0xfff79a4c + .word 0xfff84a43 + .word 0x000b758c + .word 0xfff7cae0 + .word 0xfff4af21 + .word 0xfff5b1d4 + .word 0x000997a1 + .word 0x000513bf + .word 0xfffc9652 + .word 0x000a4b12 + .word 0x000d335b + .word 0xfff11063 + .word 0x0002d35a + .word 0xffff90f4 + .word 0x00069aa9 + .word 0xfff1a150 + .word 0xfff4d1db + .word 0xfff06c13 + .word 0x0001346a + .word 0x00084474 + .word 0x000fdc3a + .word 0xfffa0d90 + .word 0x000cacc0 + .word 0x0006f999 + .word 0xfffd50b9 + .word 0x000629f5 + .word 0x000ebb9c + .word 0xfff337e0 + .word 0xfff8e237 + .word 0x00022e1b + .word 0x000da59b + .word 0x000fa072 + .word 0x000b678a + .word 0xfff211b2 + .word 0xfffd0c75 + .word 0x000ef75a + .word 0xfffc105a + .word 0xfff243cf + .word 0x00022de4 + .word 0x000082e6 + .word 0xfff6559b + .word 0xffffa6c6 + .word 0xfff74bac + .word 0xfff59be1 + .word 0xffff8f6e + .word 0x0006d698 + .word 0xfff801bb + .word 0x000c8dfd + .word 0xfff4b5a8 + .word 0x000ec003 + .word 0x000d13d6 + .word 0xfffdee70 + .word 0xfff2467d + .word 0xfff3e928 + .word 0xfff24d64 + .word 0x0008458e + .word 0x000fccf9 + .word 0xffff2eac + .word 0x00072148 + .word 0xfffc7ccf + .word 0x0008c6ea + .word 0xfffdd4b2 + .word 0xfffaa07d + .word 0x0009f288 + .word 0x000be667 + .word 0x000da3bd + .word 0xfff13063 + .word 0xfff8e3ec + .word 0xfff7f5ef + .word 0xfffb1b61 + .word 0x0006333e + .word 0xfff5a53f + .word 0x000f3126 + .word 0x0003aa37 + .word 0xfff8455b + .word 0x000c0191 + .word 0xfff9b299 + .word 0x0007e590 + .word 0xffff14ef + .word 0x0001bbe1 + .word 0x000b37c2 + .word 0x00098dcc + .word 0x0006cb4b + .word 0x0003098d + .word 0x000bf00e + .word 0xfff3ae0a + .word 0x000ff7ad + .word 0x000df6cf + .word 0xfff71f45 + .word 0xfffcfdcd + .word 0x000fa540 + .word 0x00065d71 + .word 0x000e37a7 + .word 0xfffae535 + .word 0xfff8c2d3 + .word 0x0004bb39 + .word 0x000df6fe + .word 0x000632ac + .word 0xfff1da47 + .word 0x0009a35f + .word 0x00006a94 + .word 0x0007d046 + .word 0xfff0433f + .word 0xfff1e773 + .word 0x000a9ada + .word 0x0005f561 + .word 0xfff25cf0 + .word 0xfffadcef + .word 0xfff85ee8 + .word 0xfffc4a75 + .word 0xfffdedb9 + .word 0xfffaf2ba + .word 0xfff6e0f8 + .word 0xfffe1362 + .word 0x000df404 + .word 0x0008385a + .word 0x000df7b3 + .word 0x00011a9c + .word 0x00039590 + .word 0x0003246f + .word 0xfff57eab + .word 0xfffabb97 + .word 0xfff36125 + .word 0x000d280f + .word 0xffff0045 + .word 0x000824ca + .word 0x000cb51e + .word 0xfff82bd9 + .word 0xfff2a229 + .word 0xfff5272f + .word 0xfff78cbc + .word 0x00011375 + .word 0xfffe19b4 + .word 0xfff76a45 + .word 0xfff5602a + .word 0x000dc3de + .word 0xfff2ffb4 + .word 0xfff6d375 + .word 0x000f5523 + .word 0xfff84721 + .word 0x000eb62d + .word 0xfffaaf05 + .word 0xfff66afd + .word 0x000e5305 + .word 0x000dfeff + .word 0xfff26556 + .word 0x000dc587 + .word 0xfff29ddf + .word 0xfffe20db + .word 0x00029a25 + .word 0x0001c2f8 + .word 0x00032a4d + .word 0x000f0c9b + .word 0xfff4c28e + .word 0xfff2814b + .word 0x000d14eb + .word 0x0004668e + .word 0x00034d4d + .word 0x0009a668 + .word 0xfffc7870 + .word 0xfff71650 + .word 0x00012bef + .word 0x000ff1ea + .word 0x00075ef8 + .word 0x000a2c61 + .word 0x00096543 + .word 0xfff5f7a2 + .word 0xfff10fd2 + .word 0xfff659db + .word 0xfff3df18 + .word 0x000cdf35 + .word 0xfff42eae + .word 0x00034930 + .word 0xfffb12a0 + .word 0x0005ef78 + .word 0x0007e9c6 + .word 0xfff25b6d + .word 0xfffb0ed7 + .word 0x000551c9 + .word 0x00045637 + .word 0x00079dbd + .word 0xffff9f10 + .word 0x000e10d0 + .word 0xfffcb8f0 + .word 0x0007a830 + .word 0xfff9a540 + .word 0x000fec53 + .word 0xffffb5ff + .word 0xfff1277f + .word 0xfffdbeef + .word 0x000b993e + .word 0x0007fd4d + .word 0xfff7ca3f + .word 0x00057445 + .word 0x0003e9ad + .word 0x00036bfc + .word 0x000aa7a0 + .word 0xfffa6fd1 + .word 0xffff8d8d + .word 0x0000a1fe + .word 0xfffe5d8b + .word 0xfffd0219 + .word 0x0001db7b + .word 0x00055bdb + .word 0xfff8e773 + .word 0x000a6779 + .word 0xfffb99cc + .word 0xfffba8cb + .word 0xfff078a5 + .word 0xfff12a96 + .word 0xfffb6401 + .word 0x0005f212 + .word 0xfff7062e + .word 0x000464b9 + .word 0xfffda7b4 + .word 0xfff61273 + .word 0xfffc4a6e + .word 0xfff6402f + .word 0xfff980b7 + .word 0xfff7fce5 + .word 0x00059a37 + .word 0x0006b8e6 + .word 0x0008b9f5 + .word 0x000c7762 + .word 0x0009a95a + .word 0x000f5928 + .word 0x000dbe6e + .word 0x0002fe2e + .word 0xfffa15a1 + .word 0xfff0ccd3 + .word 0x000e2446 + .word 0x00015f85 + .word 0x000b6733 + .word 0xfffac161 + .word 0xfff182aa + .word 0x0008109f + .word 0x0008c43f + .word 0xfff1392a + .word 0xffff0fae + .word 0x0007532d + .word 0x00029995 + .word 0xfff8cae2 + .word 0x000d3636 + .word 0x00001f14 + .word 0x000733ba + .word 0x0009bfd7 + .word 0x000d94d7 + .word 0xfff1f6d0 + .word 0x0001053c + .word 0xfff8cbd0 + .word 0xfffe9f18 + .word 0xfffdb8de + .word 0xfffa185f + .word 0xfffe296a + .word 0xffff8e78 + .word 0x000ec328 + .word 0xfff257f0 + .word 0xfff06cff + .word 0x0004c0e5 + .word 0x000b0a94 + .word 0xfff35d22 + .word 0x00044edc + .word 0x000d4c37 + .word 0xfff318ff + .word 0xfff6afbd + .word 0x000cab7a + .word 0x00033a8c + .word 0x000eb8b7 + .word 0xfffc3cf5 + .word 0xfffcbcaf + .word 0x00064ff9 + .word 0xfff287c4 + .word 0x0006cb2f + .word 0xfff1b962 + .word 0xfff2cfa6 + .word 0x000e9cd0 + .word 0xfffab3b8 + .word 0x00007fed + .word 0xfff55449 + .word 0xfffe98e7 + .word 0xfffcdd6b + .word 0x000f3ee8 + .word 0xfff80642 + .word 0xfffdc0eb + .word 0xfffe020b + .word 0xfff2efb9 + .word 0x000646b8 + .word 0xfff8e8ba + .word 0x000111a4 + .word 0xfff1da5e + .word 0x000748fb + .word 0x00003ec0 + .word 0x00007d21 + .word 0xfff4a9b0 + .word 0x0009f856 + .word 0x000f3a00 + .word 0xfffaa927 + .word 0xfff587df + .word 0x0002d186 + .word 0xfff65863 + .word 0xfff933d4 + .word 0xfff3d199 + .word 0xfffb8142 + .word 0x0008fc70 + .word 0xfffb2e6e + .word 0x0001adcf + .word 0xfff68a7c + .word 0x000cf73b + .word 0xfff0d5e9 + .word 0x00082934 + .word 0xfff2f8d9 + .word 0xfff608c8 + .word 0x00072c01 + .word 0xfff56f55 + .word 0xffff0e65 + .word 0x0009330b + .word 0x00061833 + .word 0xfff8052e + .word 0x0009afb9 + .word 0x0004a7c9 + .word 0xfff7b601 + .word 0xfffd0e93 + .word 0x000aa463 + .word 0x00067b09 + .word 0xfff488c9 + .word 0xfff9ef1a + .word 0x000d6269 + .word 0xfff97e19 + .word 0x0003aed4 + .word 0xfff045fa + .word 0x0009a663 + .word 0xfffe0895 + .word 0x0009c7cd + .word 0x000aaa4d + .word 0x000aede0 + .word 0xfff4d173 + .word 0x00032523 + .word 0x000c81e8 + .word 0x000fdfe5 + .word 0x0003c3bb + .word 0xfffdc4f3 + .word 0x00004bc6 + .word 0xfffe84ec + .word 0x0001a948 + .word 0xfffae17d + .word 0xffff0a8b + .word 0xfffaf1a9 + .word 0xfff997f3 + .word 0xfff696fe + .word 0x0008d687 + .word 0x00027c27 + .word 0xfff75efc + .word 0xfff33e82 + .word 0x00093355 + .word 0x000617c7 + .word 0x000caf87 + .word 0xfffa83eb + .word 0x0007b4bf + .word 0x000c7bca + .word 0xfff1f191 + .word 0xfff67d77 + .word 0xfff190ae + .word 0x00057c06 + .word 0xfff6e1f2 + .word 0x0000dfdf + .word 0x000e1b6e + .word 0x000c2fb0 + .word 0xfffea167 + .word 0xfff75c8f + .word 0x00003953 + .word 0xfffa48a4 + .word 0x00088c89 + .word 0xfff18e42 + .word 0xfffe8956 + .word 0x000b7c5a + .word 0x00048012 + .word 0x0004026d + .word 0xfff3885c + .word 0xffffc97d + .word 0xfff1bf79 + .word 0xfffaa776 + .word 0x000de279 + .word 0x00097c26 + .word 0xffff2680 + .word 0x00083bb7 + .word 0x000dda80 + .word 0x0008244f + .word 0xfffba25b + .word 0x0008285e + .word 0x000d34cc + .word 0xfff80913 + .word 0x00080033 + .word 0xfff3af16 + .word 0xfff43b6f + .word 0x00061f19 + .word 0xfff462c6 + .word 0x000842bd + .word 0xfff89fb9 + .word 0x0009b3b9 + .word 0x000b4b6c + .word 0x0001cc56 + .word 0xfff4ad13 + .word 0xfff897fc + .word 0x000896db + .word 0xffffa6eb + .word 0x00091e1c + .word 0xfff62e75 + .word 0x000f3dec + .word 0xfff5148b + .word 0x000d6fd7 + .word 0x0005c458 + .word 0x00011069 + .word 0x0009f808 + .word 0xfff8b64c + .word 0x000d438b + .word 0xfff431c3 + .word 0xfff917d4 + .word 0x000c7be8 + .word 0x000e46ac + .word 0xfff19bd0 + .word 0x000543ca + .word 0x000398ac + .word 0xfff13ba7 + .word 0xfffb6b50 + .word 0x00097bf5 + .word 0xfffe6ba9 + .word 0x00016fc3 + .word 0x0000666a + .word 0x00013df6 + .word 0xfffa1629 + .word 0x0009f44f + .word 0xfff0c4ca + .word 0x00012901 + .word 0x000f51c7 + .word 0xfff52067 + .word 0xfffd1694 + .word 0x0000685e + .word 0xfffe1048 + .word 0xfff5a05f + .word 0x0004e4d3 + .word 0x000cf52a + .word 0xffffb31e + .word 0x0007d471 + .word 0x000beef4 + .word 0xfff315a4 + .word 0x000e9a69 + .word 0xfff3fbba + .word 0xfffe7483 + .word 0x000435d1 + .word 0xfffea40a + .word 0xfffc3747 + .word 0x0007108b + .word 0x00036eca + .word 0x00081e00 + .word 0xfffef82c + .word 0xfffa49d8 + .word 0x0000d5d4 + .word 0x000fb757 + .word 0x0001d4e4 + .word 0x0009bc01 + .word 0xfff3e08f + .word 0xfff184f4 + .word 0x0005d7e8 + .word 0xfffca41f + .word 0x0004a0da + .word 0xfffd7885 + .word 0xfffa2f94 + .word 0x0002350c + .word 0xfff2ad16 + .word 0x000d7b27 + .word 0xffffb448 + .word 0x000cca64 + .word 0x000fb258 + .word 0xfff093fc + .word 0x000c9c7e + .word 0xfffd0785 + .word 0x000d086c + .word 0xfffa7e51 + .word 0xfff291db + .word 0xfff9766a + .word 0x000619b7 + .word 0xfffcafa9 + .word 0xfff3c2a7 + .word 0x000fe038 + .word 0xfffb0738 + .word 0x000dd7ec + .word 0x00079a1d + .word 0x0002eda7 + .word 0x000c993f + .word 0x000826c9 + .word 0xfff0c755 + .word 0xfff628e8 + .word 0xfff339ca + .word 0xfff5451c + .word 0x000e9e56 + .word 0x000687c9 + .word 0xfff41639 + .word 0x00094cc5 + .word 0x0000fba5 + .word 0x000a9b20 + .word 0x0008e0f1 + .word 0x0009a5cc + .word 0x000e5f76 + .word 0xfff96e8c + .word 0xfff88fdb + .word 0xfff5076a + .word 0xfff8794e + .word 0x0005d24a + .word 0x000ac73d + .word 0x0000856b + .word 0xfff69797 + .word 0xfff0488d + .word 0xfff60898 + .word 0x0002206f + .word 0x0002549f + .word 0x00007db5 + .word 0xfff97f38 + .word 0x0002680c + .word 0x000f32a3 + .word 0x00001463 + .word 0xfffc7db7 + .word 0x000722b3 + .word 0x00029cca + .word 0xfffd4d5c + .word 0x000d49d6 + .word 0x0005997f + .word 0xfff55a0a + .word 0xfffd6942 + .word 0x000239fe + .word 0xfffc663f + .word 0x00053726 + .word 0x000df488 + .word 0xfff25dfa + .word 0xfff0000e + .word 0xfff2bcd5 + .word 0x0007ef0a + .word 0xfff12152 + .word 0xfff57944 + .word 0xfff4d36a + .word 0xfff05369 + .word 0xfff555d3 + .word 0xffffb9b5 + .word 0xfff30773 + .word 0x000e24c7 + .word 0x0008b270 + .word 0x0000a3b3 + .word 0x000417cb + .word 0xfff60276 + .word 0xfff5a2c4 + .word 0x0008073f + .word 0xfff0c675 + .word 0xfff5f56c + .word 0xfff21085 + .word 0xfffb7a2f + .word 0xfff93fed + .word 0xffff68ba + .word 0xfff7d4e6 + .word 0x000aa586 + .word 0x00070ccd + .word 0xfff429b1 + .word 0x0005819e + .word 0x000fb63e + .word 0xfff69341 + .word 0x0002f139 + .word 0xfff92c1a + .word 0xfffdbecb + .word 0x000d135b + .word 0xfff8a952 + .word 0xfffa5ae8 + .word 0xfff07ab8 + .word 0xfff675cf + .word 0x000897e9 + .word 0x000ec6d5 + .word 0x0005faf0 + .word 0x00052c7e + .word 0xffffef1f + .word 0xfff6b589 + .word 0xfff9bf29 + .word 0x000f3371 + .word 0x00010745 + .word 0x00066a5b + .word 0x000e2442 + .word 0xfff90fcb + .word 0x0008fc16 + .word 0x000f3598 + .word 0xfff3a0c4 + .word 0xfff03b99 + .word 0x000ee095 + .word 0x000336ce + .word 0xfff90ddf + .word 0xfff7de2a + .word 0x0002b4a0 + .word 0x00039f6d + .word 0xfffc7d1e + .word 0x000bf427 + .word 0xfff55720 + .word 0x000f4bfe + .word 0x00087ec6 + .word 0xfff32a02 + .word 0xfff83a59 + .word 0x0005af70 + .word 0xfff3423e + .word 0x000256a2 + .word 0x00001c56 + .word 0xfff39ae2 + .word 0xfff007d5 + .word 0xfff284d1 + .word 0xfffd31a3 + .word 0x0007bd7b + .word 0x0008fd4f + .word 0xfff8ca80 + .word 0xfffc4d47 + .word 0x0008dab7 + .word 0xfffa003c + .word 0xfff1daf1 + .word 0x0008b704 + .word 0x000a3938 + .word 0xfffe540a + .word 0x00073d1b + .word 0xfff4152a + .word 0x00027764 + .word 0xfff8a4de + .word 0xffff758d + .word 0x000b1c5a + .word 0xfffac0d5 + .word 0x000dd0e8 + .word 0xfff28236 + .word 0x000f9541 + .word 0x000f1b77 + .word 0xfff97eb3 + .word 0x000e6017 + .word 0xfffdcc43 + .word 0xffff4373 + .word 0xfff638f6 + .word 0x000be748 + .word 0xfffb6b17 + .word 0xfffde350 + .word 0x000feaa4 + .word 0x0003df89 + .word 0x000e1699 + .word 0xfff71ef7 + .word 0xfff11842 + .word 0xfff65fa2 + .word 0xfffc510e + .word 0x0004ed32 + .word 0x0009055e + .word 0xfff197b2 + .word 0xfffa4b6d + .word 0xfff76858 + .word 0xfffc4659 + .word 0xfff33d23 + .word 0xfffc7266 + .word 0xfff63950 + .word 0x000ed44a + .word 0x00051910 + .word 0xfffe707a + .word 0x000b17cc + .word 0x000c3d65 + .word 0x000f726e + .word 0x0002fdc4 + .word 0x0004e073 + .word 0x0009f419 + .word 0xfffa8b9d + .word 0x000af288 + .word 0x000b0566 + .word 0xfff55829 + .word 0x000c1565 + .word 0x00058b1f + .word 0xfffe6915 + .word 0xfff464c8 + .word 0x000c6efd + .word 0x00010b70 + .word 0xfff8d706 + .word 0x00050d57 + .word 0x000addef + .word 0xfffbf9ed + .word 0xfff3117d + .word 0xfff9ecfd + .word 0xfff087a7 + .word 0x0007d388 + .word 0x0006bcac + .word 0x0003e9c0 + .word 0xfff312b8 + .word 0x00022fcf + .word 0xfff14ec4 + .word 0xfff42dc7 + .word 0xfff981f7 + .word 0xfff47d96 + .word 0xffff657e + .word 0x000ecb2e + .word 0xfff7ab36 + .word 0x00082d12 + .word 0xfff2afc3 + .word 0xfff8a69c + .word 0x0001acc7 + .word 0xfff2864f + .word 0xfff11bac + .word 0x0001d92b + .word 0xfff24c51 + .word 0x0006d426 + .word 0xfff83c90 + .word 0xfff79c07 + .word 0xfff28ff4 + .word 0xfffc7803 + .word 0xfffc9ee1 + .word 0x000937e3 + .word 0xfffcd2cb + .word 0x000a123d + .word 0xfffd32d4 + .word 0xfff63283 + .word 0xfffec931 + .word 0xfff7f139 + .word 0xfffb32b7 + .word 0x0009550d + .word 0xfff93a96 + .word 0xfff5c88d + .word 0x00046ca9 + .word 0xfff2afb5 + .word 0x00053ef2 + .word 0x000c059c + .word 0x0005cb4d + .word 0xfff4c38e + .word 0x000a212a + .word 0x0003cbd9 + .word 0x00097ebd + .word 0xfffc5804 + .word 0xfff6744e + .word 0x000154d4 + .word 0x0008577e + .word 0x0006fb85 + .word 0xfff93d52 + .word 0xfff6e1b5 + .word 0x000da9aa + .word 0xfffacdcf + .word 0xfffae1b9 + .word 0xfff7a7aa + .word 0x0002511e + .word 0x0009e0a0 + .word 0x000f3160 + .word 0xfff2352e + .word 0xfffb014c + .word 0xfff73c9d + .word 0xfff7d839 + .word 0x000817d4 + .word 0xfffddb84 + .word 0x0005c793 + .word 0xfffb0048 + .word 0x000ce764 + .word 0x000789f8 + .word 0x000ede45 + .word 0xfff74627 + .word 0xfffd9903 + .word 0xfffa6d77 + .word 0x00060e99 + .word 0xfffa031e + .word 0xfff3a770 + .word 0x00049bf7 + .word 0x0009df6c + .word 0x0002a10e + .word 0xfff47dc1 + .word 0x000a6e96 + .word 0x0001b14e + .word 0xfffe4d28 + .word 0x00002bff + .word 0x00031ffa + .word 0xfff52a91 + .word 0x0004ad30 + .word 0xfffba5ac + .word 0xfffa0dca + .word 0x000babbd + .word 0xfffdde39 + .word 0x00061f52 + .word 0xfff826a0 + .word 0x000a0717 + .word 0xfff3a537 + .word 0x000b7c25 + .word 0x0004b18e + .word 0x00005e01 + .word 0x00099f74 + .word 0xfffc7e13 + .word 0xfff53a05 + .word 0x00011d2d + .word 0x00013450 + .word 0x00062766 + .word 0x000819e7 + .word 0x00081b3d + .word 0x00089f2c + .word 0x0005f699 + .word 0xfff81add + .word 0x000fc2ab + .word 0x0007b560 + .word 0xfff393ec + .word 0x00044d65 + .word 0x0009441f + .word 0x000c657d + .word 0x000f32f6 + .word 0xfff275b8 + .word 0xfff079d5 + .word 0x000f2431 + .word 0xfff1542d + .word 0xfff28a52 + .word 0xfff93dfe + .word 0x00039a5d + .word 0xfff73c3d + .word 0xfffc69d1 + .word 0x00013e6d + .word 0xfffc978e + .word 0x0006c5a1 + .word 0xfff56a58 + .word 0x000d9b4c + .word 0x000d9ca0 + .word 0x000b391f + .word 0xfff5f09a + .word 0x000a6282 + .word 0xfff4d5be + .word 0x000e4b03 + .word 0xfff7d5b4 + .word 0xffffd639 + .word 0xfff305f4 + .word 0xfff21fab + .word 0xfffee4e6 + .word 0x00016e16 + .word 0x00052e09 + .word 0x000a1453 + .word 0x000f71b7 + .word 0x000881eb + .word 0x000ba2ee + .word 0xfffe3923 + .word 0xfff536bc + .word 0x000350d0 + .word 0xffff885d + .word 0x000f5e92 + .word 0x000f9ac1 + .word 0x000521a1 + .word 0xfff6f032 + .word 0x00097fdb + .word 0xfffbb259 + .word 0xfffd228a + .word 0x0008db62 + .word 0x0005e282 + .word 0x000c5bd2 + .word 0x000e11e8 + .word 0x000e7197 + .word 0x000f2855 + .word 0xfff8ef27 + .word 0xfff0ce12 + .word 0x00037c95 + .word 0x0006676e + .word 0xfff46d7a + .word 0x0000019b + .word 0xfffbb112 + .word 0x00098dfc + .word 0xfffc4838 + .word 0x000e17d0 + .word 0x00049ba2 + .word 0x000bc28c + .word 0x0005f054 + .word 0x0002e7d5 + .word 0xfffc7226 + .word 0xfffec98a + .word 0x000ea7f1 + .word 0xfff35474 + .word 0xfff0ae65 + .word 0x0006d77a + .word 0x00020eba + .word 0xfffb2157 + .word 0x000c5551 + .word 0x00063b71 + .word 0xfffe4808 + .word 0x00033c22 + .word 0x00052005 + .word 0xfffa2721 + .word 0x00017869 + .word 0xfffaf14d + .word 0x00067961 + .word 0xfffad630 + .word 0xfff0de2b + .word 0x00071c4e + .word 0x00023206 + .word 0x000d48ce + .word 0x000de5a9 + .word 0x000edb4f + .word 0x000c2bee + .word 0xfff8f365 + .word 0xfffb8265 + .word 0x0009e2bf + .word 0xfff02b83 + .word 0xffff52aa + .word 0x0006f6a8 + .word 0x000545ba + .word 0x0007c0fb + .word 0x0008554d + .word 0xfff1de5b + .word 0xfff452fd + .word 0xfffa4ff7 + .word 0xfff97731 + .word 0xfff9100f + .word 0x000c5f52 + .word 0xfff92865 + .word 0x00065d81 + .word 0x000d03ed + .word 0x0009ce2e + .word 0x000bdef7 + .word 0xfff54a84 + .word 0xfffcdcde + .word 0xfff165ea + .word 0x0002ee9c + .word 0x000ba387 + .word 0x00031815 + .word 0xfff8d4a5 + .word 0xfff61c12 + .word 0x00040f38 + .word 0x00046359 + .word 0xfffc9cd0 + .word 0xfff9763b + .word 0xfff5cbcf + .word 0xfff772d5 + .word 0xfff11c93 + .word 0x000ed4a8 + .word 0xfff4f13c + .word 0x00094aeb + .word 0x00051b16 + .word 0x000c0c64 + .word 0x0008b495 + .word 0x000e108c + .word 0x0003b1d5 + .word 0xfffa106f + .word 0xfffe944b + .word 0xfffea351 + .word 0xfffcf8a9 + .word 0x00009673 + .word 0xfffd6270 + .word 0xfff97c2a + .word 0xfff86663 + .word 0x000760f2 + .word 0x000d907a + .word 0x00080a4f + .word 0xfffdc59f + .word 0x00047fb7 + .word 0xfff76d53 + .word 0xfffa4f5b + .word 0x000ca3d4 + .word 0x0008d0e0 + .word 0x000427ec + .word 0xfff79bdd + .word 0xfffaa24e + .word 0xfff183dc + .word 0x0009ed62 + .word 0xfffe6b80 + .word 0xfff18147 + .word 0x000691e4 + .word 0xfffadd7d + .word 0xfff0336e + .word 0xfff00a10 + .word 0xfff55c6e + .word 0x0002cc0d + .word 0x00026630 + .word 0xfffd25dc + .word 0x000572bd + .word 0x000acaa1 + .word 0xfff7efe7 + .word 0x0002a4d7 + .word 0xfff699ec + .word 0x000cdd25 + .word 0x000c0a79 + .word 0x000ec806 + .word 0x0007cccd + .word 0xfffb1587 + .word 0x000494f5 + .word 0xfff33d38 + .word 0xfff720ce + .word 0xfff19784 + .word 0x000a7ef9 + .word 0xfffdd205 + .word 0xfff58915 + .word 0xfffe34cb + .word 0x000dce99 + .word 0xfffc5cb4 + .word 0xfffb8d0a + .word 0x0006efc1 + .word 0x0009997f + .word 0xfffb1734 + .word 0x00052d71 + .word 0x0002fe79 + .word 0x000b874e + .word 0xfff7eaf3 + .word 0x000f4642 + .word 0x0007f38d + .word 0xffff25f0 + .word 0x0002df49 + .word 0x0009d646 + .word 0xfff43fe5 + .word 0xfff5e60f + .word 0x00077bf6 + .word 0xfff69e78 + .word 0x00071bdd + .word 0x00084316 + .word 0xfffe9b9e + .word 0xfff6e068 + .word 0x000870d8 + .word 0xfffab25d + .word 0xfff10174 + .word 0xfff9a999 + .word 0xffff1d73 + .word 0x000198ee + .word 0x00075baf + .word 0x00084386 + .word 0x000f22db + .word 0xfff69afb + .word 0xfff5783d + .word 0x00045ec7 + .word 0x000dda67 + .word 0x000ebe01 + .word 0xfff081ae + .word 0x000b33a9 + .word 0xfffb270f + .word 0x000ee100 + .word 0xfffe136d + .word 0x000907b0 + .word 0x0005d4c5 + .word 0xfff94812 + .word 0xfff646dd + .word 0x000c9937 + .word 0xfff33920 + .word 0xfffe7b07 + .word 0x000d823b + .word 0xfff9da60 + .word 0x000f5c41 + .word 0x00064b01 + .word 0xfffdd144 + .word 0xffff4b53 + .word 0xfffea984 + .word 0xfff0306c + .word 0xfffca645 + .word 0xfffcd970 + .word 0x0008fb80 + .word 0xfffcc63f + .word 0xfffd8583 + .word 0x000ed44e + .word 0x000fa78e + .word 0x00008486 + .word 0xfff86779 + .word 0x00015acd + .word 0x00086bc0 + .word 0x000d8968 + .word 0xfff97c50 + .word 0xfff66a9a + .word 0xffffda22 + .word 0xfff58f5b + .word 0xfff95358 + .word 0xfff926bc + .word 0x00001870 + .word 0xfffc0b26 + .word 0x000b3542 + .word 0xfff44354 + .word 0x000b7ad4 + .word 0xfff70df8 + .word 0x00025abd + .word 0xfff94c6d + .word 0xffffa074 + .word 0x000a557f + .word 0xffff06c7 + .word 0x000c0ba1 + .word 0xfffee5c6 + .word 0x000e4e85 + .word 0x00025f3a + .word 0xfff80088 + .word 0xfff36782 + .word 0xffffab46 + .word 0xfffc3157 + .word 0x000a313c + .word 0x0005cfc2 + .word 0xffffa3f5 + .word 0x0009d698 + .word 0x000d20ba + .word 0xfff77f84 + .word 0xfffd76cb + .word 0xfff3d4f3 + .word 0xfff4d42a + .word 0xfff8191d + .word 0x000bba51 + .word 0xfff1a5b2 + .word 0xfff8435f + .word 0xfff28747 + .word 0x000958e5 + .word 0x000c42b9 + .word 0x000bdc0d + .word 0xfffc0763 + .word 0x00035202 + .word 0xfffb1fb1 + .word 0xfffe28fd + .word 0x0001d168 + .word 0xfff86a2e + .word 0x00023f26 + .word 0x00043358 + .word 0xfff30eb5 + .word 0x000e7917 + .word 0xfff106f8 + .word 0xfffb8672 + .word 0x0007d085 + .word 0x000a5439 + .word 0x000cefdf + .word 0x000be8ad + .word 0x00067862 + .word 0x00094a80 + .word 0x000ad8e3 + .word 0xffffe425 + .word 0x000bbda4 + .word 0xfff47520 + .word 0x00023ee8 + .word 0xfff3f20e + .word 0xfff66f13 + .word 0xfff96fed + .word 0xfff52dac + .word 0x000bdf96 + .word 0xfff1723c + .word 0x000e9676 + .word 0xfff70e1e + .word 0x0000480d + .word 0x000b8449 + .word 0xfff0f481 + .word 0x000d8e83 + .word 0xfff8cbf7 + .word 0xfff83760 + .word 0xfff758cc + .word 0x000c30b0 + .word 0xfff1a11f + .word 0xfff7584f + .word 0x0008c16e + .word 0x000b44b8 + .word 0xfffb03d9 + .word 0xfff5f1b5 .global v16a .balign NR_LANES*4 v16a: - .word 0xfe7efdfd - .word 0xfe72fcb7 - .word 0x03b2ff4b - .word 0x0012fe5d - .word 0xfc43fd24 - .word 0x01c20094 - .word 0xfebe03a2 - .word 0xff1301e2 - .word 0xfe68fefa - .word 0x01120122 - .word 0xfd14fdcc - .word 0xfeb70332 - .word 0x01a3fcce - .word 0xfcfffd36 - .word 0x01d6fd18 - .word 0xfd69ffce - .word 0x00a003af - .word 0x02ed0125 - .word 0xff13ff33 - .word 0xfc42ffb2 - .word 0x0357fd71 - .word 0xfe950146 - .word 0x03870248 - .word 0x009600e6 - .word 0x004d0302 - .word 0x0175ffc8 - .word 0x018dff47 - .word 0xfc2f02da - .word 0xfcbd00fe - .word 0xfed30297 - .word 0xfde7ffc2 - .word 0x01bdfcbc - .word 0xfed0ff58 - .word 0x0140fd1f - .word 0x0288ff72 - .word 0x03c70335 - .word 0xfe50fe18 - .word 0xffc4ffb1 - .word 0x03eefc28 - .word 0xfc38ff25 - .word 0xfc62ffdb - .word 0xfc6903ac - .word 0x01beff91 - .word 0xfdfefcf1 - .word 0xfcbffef1 - .word 0xfc4d008b - .word 0x01fd022d - .word 0xfebbffeb - .word 0x01eefec1 - .word 0x00affdf3 - .word 0x000603e7 - .word 0x00b203cf - .word 0xfc8ffdba - .word 0xfd2c0198 - .word 0xfd49fe51 - .word 0xfeb303b1 - .word 0x0185ffc7 - .word 0xfcb3ff10 - .word 0xfd4802e4 - .word 0x025cfdac - .word 0xfdcafc29 - .word 0x034fffe3 - .word 0x02cdfc2a - .word 0xfd710060 - .word 0xffb700ec - .word 0x0083025e - .word 0x03c1fedf - .word 0x00ce00f4 - .word 0x02cdfc86 - .word 0xfcb4ffb2 - .word 0xfd3cfe90 - .word 0x02f20002 - .word 0x03560002 - .word 0xfd8003ed - .word 0x03ef00e1 - .word 0x032801f1 - .word 0x03bb0223 - .word 0x03ad027c - .word 0x02affdb4 - .word 0xfe3201e5 - .word 0xfffcfdd0 - .word 0xfcb20186 - .word 0xfee5fe56 - .word 0x037401cf - .word 0x034bfd57 - .word 0x036801e2 - .word 0xfed7fcfa - .word 0xfdc600be - .word 0xff94fe13 - .word 0xfd1303fe - .word 0xff4603fe - .word 0x030703b0 - .word 0xfdd7fefc - .word 0xfebe01dc - .word 0x0394fc1c - .word 0xfdd4ff3f - .word 0x00d3025a - .word 0xfc0100bf - .word 0xfc9effc5 - .word 0x0003013d - .word 0xff73005f - .word 0x01d8fc79 - .word 0xfe050170 - .word 0xfd500016 - .word 0x02d9ffed - .word 0x01de0018 - .word 0x00fcfe10 - .word 0xff91fea6 - .word 0xff76008a - .word 0x038f00ff - .word 0x0192fdff - .word 0xfc7a026c - .word 0x00b301dc - .word 0x00bafe1d - .word 0xfc250021 - .word 0xfd92034a - .word 0xfcfd0263 - .word 0xff56fd3a - .word 0x022102f9 - .word 0xfec4008f - .word 0x02bc0044 - .word 0xfda9fff9 - .word 0xfe810024 - .word 0x0150fd41 - .word 0x00e7fd43 - .word 0xfcbdfd03 - .word 0x0020feb1 - .word 0xfe36fe4c - .word 0xff060067 - .word 0x01da03b3 - .word 0xff2200dd - .word 0xfe13ff63 - .word 0x03e30051 - .word 0x0373fc91 - .word 0xfe3efd9e - .word 0x0195ffa6 - .word 0x014b03dc - .word 0xfc1a0086 - .word 0xfda3fef0 - .word 0x011b02ca - .word 0xfcbdffef - .word 0x00cc005c - .word 0xfed3ffa3 - .word 0xfd490383 - .word 0xfd3703c1 - .word 0x03e10123 - .word 0xfde2ff4d - .word 0x00120181 - .word 0xff8c0187 - .word 0x03dffdce - .word 0x0332fc6f - .word 0xfeb0fc71 - .word 0x019dff49 - .word 0x033dfe1b - .word 0x037bffe5 - .word 0x029c036a - .word 0x033401a3 - .word 0xfd98fe95 - .word 0x0263009f - .word 0x000f00a8 - .word 0x03c0fe5e - .word 0xfd9003f6 - .word 0x032c0131 - .word 0xfc6c0034 - .word 0x002cfe64 - .word 0x00a2fc75 - .word 0xfc4f00c6 - .word 0x01390187 - .word 0xfd28fd1d - .word 0xffa901b1 - .word 0xfe530091 - .word 0x02550269 - .word 0xff3a03cd - .word 0xfea50003 - .word 0x005d01d0 - .word 0xffd6ffb9 - .word 0x008f018a - .word 0xfe9affaa - .word 0x017402d6 - .word 0xfe74fdcd - .word 0xfffdfee4 - .word 0x03e8fc15 - .word 0xfdf9fdba - .word 0xffe9fe62 - .word 0x01dbfe5c - .word 0x00d7fd38 - .word 0x0261fc78 - .word 0x01ccfc28 - .word 0xff78fd66 - .word 0x00a4fcad - .word 0xfde00199 - .word 0x0377fe97 - .word 0x036d011e - .word 0xfd9200bc - .word 0x022801db - .word 0xfe41fdee - .word 0x0368fd39 - .word 0x00af00df - .word 0xfef8feab - .word 0xfeba025b - .word 0x0092fe53 - .word 0x01ab00a0 - .word 0xffd9ff52 - .word 0x020cffec - .word 0xfda3fca1 - .word 0xffbefee3 - .word 0x02f1ff70 - .word 0x0074fd4f - .word 0xfe86fcdd - .word 0x0001ff52 - .word 0x020c0399 - .word 0x011b00c2 - .word 0xfd5cfc54 - .word 0x019102e0 - .word 0x02c6fc5e - .word 0xfe8300cb - .word 0x00e9fd0f - .word 0x0367fd1c - .word 0x0165fe62 - .word 0xfef30037 - .word 0xfcef03f8 - .word 0x01c8028f - .word 0xffdcfd90 - .word 0xffaefe01 - .word 0xfdd1ff1f - .word 0x018302ae - .word 0x02f0feae - .word 0xfd9ffffb - .word 0xfed40067 - .word 0x03b6fd4a - .word 0x016fff2d - .word 0xffe9ffda - .word 0x030600f6 - .word 0xfeeefca7 - .word 0xfe360307 - .word 0xfcbe00b7 - .word 0x02cafcc5 - .word 0xfca5fe3b - .word 0xfff3fdae - .word 0x01b00288 - .word 0xfcbe0210 - .word 0x0295fd71 - .word 0x005efe41 - .word 0x0306fe93 - .word 0xfed5ffdb - .word 0xfc97fdca - .word 0x02f8031d - .word 0x01a001ba - .word 0xff5efc05 - .word 0xfe12fc8d - .word 0x0211fc7d - .word 0x0365ffba - .word 0x0052030d - .word 0xff86fdb1 - .word 0x033efe32 - .word 0xfca8fd44 + .word 0x02c6fc8c + .word 0xff4602e2 + .word 0x0378fd81 + .word 0xfe040270 + .word 0xff880189 + .word 0x03d0fe4f + .word 0xffa803af + .word 0xfff20211 + .word 0x01930273 + .word 0x0066feab + .word 0xfe15fc45 + .word 0x01d5fe6a + .word 0x01bffc7b + .word 0x0056feb5 + .word 0x019e00ec + .word 0x0045fe4c + .word 0x01defe5c + .word 0x0000fdfe + .word 0xfff6fe7a + .word 0x01f6fc6e + .word 0xfda8fd4d + .word 0xfeae0027 + .word 0x0191025b + .word 0x02260177 + .word 0x023c029f + .word 0xfcdd01db + .word 0xfdcbfc8e + .word 0x02bc0373 + .word 0x000dffcc + .word 0x0350fe3f + .word 0x0028fc2e + .word 0xffe200bc + .word 0x02720092 + .word 0x0295feba + .word 0x01380310 + .word 0x0006fd96 + .word 0x021802ff + .word 0xfe36fef9 + .word 0x01ebff8d + .word 0xfdf400ff + .word 0xff9b00bb + .word 0xfcd0feee + .word 0x0257023e + .word 0xff79fe8a + .word 0x02faff1e + .word 0x017efd64 + .word 0xfc60feae + .word 0x01b30288 + .word 0x00f10274 + .word 0xfe4403a6 + .word 0xfd8c0056 + .word 0x0210ff61 + .word 0x039b018c + .word 0xff3bfc1b + .word 0x03860298 + .word 0xfc0702ab + .word 0x008601f6 + .word 0xfcb303c3 + .word 0xfe68ff08 + .word 0xffc000da + .word 0xfd6901b2 + .word 0xfe4dfe9c + .word 0x001f0100 + .word 0x00d5fdac + .word 0xfe2efd89 + .word 0x03fbff64 + .word 0xfc40ffcb + .word 0x03c10257 + .word 0x01a5024e + .word 0xfe63fc13 + .word 0x004efea3 + .word 0xfd23fe01 + .word 0x01d00371 + .word 0x038a008b + .word 0x006dfcea + .word 0x00f8fde5 + .word 0x039afe1f + .word 0x03b9fd36 + .word 0xfe89034e + .word 0xfcadfffb + .word 0xff27fd34 + .word 0x00b602ed + .word 0xfc7afd99 + .word 0x026603e6 + .word 0xfe9c0325 + .word 0x00a5fc10 + .word 0xfc6e03bb + .word 0xff67fffe + .word 0x03e6fdff + .word 0x00600129 + .word 0xfd640285 + .word 0x02aa0201 + .word 0xfe3e0239 + .word 0xfea1fe2f + .word 0xff21fdce + .word 0x03d9fc58 + .word 0x0076011b + .word 0xfffb0230 + .word 0xfde3ffec + .word 0x021fffea + .word 0x0387fec3 + .word 0x004afd9b + .word 0xfe1103df + .word 0xfd9a03a8 + .word 0xff350292 + .word 0x03c30057 + .word 0x01bcfc13 + .word 0x030affe3 + .word 0xfca7fc87 + .word 0xfedc0136 + .word 0xffe00061 + .word 0x0194017b + .word 0x039f030b + .word 0x02d00060 + .word 0xfe51fec6 + .word 0x030efe2d + .word 0x0383feb3 + .word 0x013e0054 + .word 0xff88fd14 + .word 0xfc970391 + .word 0x0166fc00 + .word 0xff74fdcf + .word 0xfcc6fc4e + .word 0xfe4dff5f + .word 0xfdb8006b + .word 0xff65038a + .word 0xfd0dff0f + .word 0xfe55fc31 + .word 0x008efd8d + .word 0x03740110 + .word 0x01190252 + .word 0x0203fd16 + .word 0x0323fc71 + .word 0xfe00fccd + .word 0xfdab02e8 + .word 0xff540365 + .word 0xfefdfc39 + .word 0x0137fc01 + .word 0xff5dfeab + .word 0x00f3014a + .word 0xff3b0169 + .word 0xfdd3007e + .word 0xfc1dff71 + .word 0x007e00d5 + .word 0xfc9803fb + .word 0xfea902df + .word 0xff2afe03 + .word 0x02360090 + .word 0xfd7efd0f + .word 0x0153fe8d + .word 0xfddffe34 + .word 0x031d00f0 + .word 0xfc52ffc7 + .word 0x02f300dc + .word 0x00b1fe40 + .word 0x024eff0f + .word 0x031afc37 + .word 0xff80020f + .word 0xfddffcf2 + .word 0x02ed035b + .word 0x0227ff72 + .word 0x0347024f + .word 0x025e027b + .word 0xfc7bfd68 + .word 0xfc8fffc3 + .word 0xfdea0101 + .word 0x0332ffed + .word 0xfe3c01c2 + .word 0xfea4ffbc + .word 0x0225fd5a + .word 0xfc81fe2b + .word 0x007302d1 + .word 0x02f00190 + .word 0xfce9ff95 + .word 0x02d1fd82 + .word 0x029ffe1b + .word 0xffb4ff80 + .word 0x034802c4 + .word 0x02cb0392 + .word 0xfdbd03b6 + .word 0x032002e7 + .word 0xff0c02c6 + .word 0x01c4feca + .word 0x000ffebd + .word 0xfdb9fdcb + .word 0x0095ff23 + .word 0x0370fcde + .word 0x00090038 + .word 0xfd65fee4 + .word 0x00d30251 + .word 0x01a2ffdc + .word 0x007401c0 + .word 0x02f5ff82 + .word 0xfe76fdc2 + .word 0x0173028c + .word 0xfece025d + .word 0xff01fd26 + .word 0x006d0244 + .word 0xfdaafe69 + .word 0xfcab0112 + .word 0xfe47fd51 + .word 0xff08004d + .word 0x019400d7 + .word 0x00cdfe31 + .word 0x0232fefd + .word 0xfed1ffa9 + .word 0xfc9e0376 + .word 0xff8900d2 + .word 0xff67fd56 + .word 0x02dafe35 + .word 0xfe6f0166 + .word 0x014bffbe + .word 0xfec4004d + .word 0x01dffcd5 + .word 0xfd2c022f + .word 0x0139fc63 + .word 0x001503bf + .word 0x0291ff83 + .word 0xff9bff6d + .word 0xfe000094 + .word 0x019cfd71 + .word 0x039e0115 + .word 0x02effe7b + .word 0xfe37fffb + .word 0xfe0b0136 + .word 0x0293fc13 + .word 0xfed5017d + .word 0x03ec0356 + .word 0xfc8900e2 + .word 0x0128030a + .word 0xfc6eff99 + .word 0xfef6fd91 + .word 0x00e5ff4d + .word 0xfc02ff30 + .word 0xfcc80226 + .word 0xfe4802ea + .word 0xfc62ff50 + .word 0x000102f0 + .word 0x001202af + .word 0xfc5a0149 + .word 0x0317fc68 + .word 0xfe0d01aa + .word 0xff630185 + .word 0xfcaa0247 + .word 0x01cefd93 + .word 0x0009fdb6 + .word 0x02c302bf + .word 0xfca40163 + .word 0x0193fdec + .word 0x016d0108 + .word 0x02f5fdf2 + .word 0x035702bd + .word 0xfdcfffea + .word 0x00f8ff2b + .word 0xff9dfd7b + .word 0x031cff6e + .word 0xffda0379 + .word 0xfd08ffd5 + .word 0xff87ffb3 + .word 0x0044fe7a + .word 0x027f01f8 + .word 0x022cffd0 + .word 0xff8b03ab + .word 0x00890313 + .word 0xfeb50395 + .word 0x01f30368 + .word 0xfe3602b3 + .word 0x0322fc41 + .word 0x02b10060 + .word 0xfe40fe3f + .word 0xfdc50105 + .word 0xff4a0131 + .word 0xff9f0359 + .word 0x006d0387 + .word 0xfd2bffee + .word 0x017affaf + .word 0x030ffc8c + .word 0xfdf0fd58 + .word 0x02fafe0c + .word 0x0081fc14 + .word 0xfc3e028d + .word 0xff7602c6 + .word 0xffc90176 + .word 0xfcc5fce3 + .word 0xff5bfd81 + .word 0xfcc1fece + .word 0x01760326 + .word 0x001203c8 + .word 0xff640334 + .word 0xfd63fde8 + .word 0xfd030356 + .word 0x0125ff5a + .word 0x03be0197 + .word 0x0081fc0b + .word 0xfd78fdca + .word 0xfe2b01fc + .word 0xffac004d + .word 0x01a3fe2a + .word 0xfc40fede + .word 0xfcd4fc5c + .word 0x0315fc9c + .word 0x0154ffab + .word 0xfc1103c3 + .word 0xfcd0ff88 + .word 0x034b0210 + .word 0x03bc0048 + .word 0xfe22007f + .word 0xfcf903c9 + .word 0xfeb600a1 + .word 0x025501ed + .word 0xfc5efce8 + .word 0x03ca00f2 + .word 0xfcbc0262 + .word 0xfc96fdd2 + .word 0xfe07fcbc + .word 0x01f8fead + .word 0xfddbfedd + .word 0xfe1c00b6 + .word 0xfd920052 + .word 0x034903ee + .word 0xff0efd8f + .word 0xfd870014 + .word 0xff00ff11 + .word 0x01ba038f + .word 0xfff4fe6d + .word 0xfedeff4e + .word 0x00bf03e9 + .word 0xfc5eff1c + .word 0xffbc0356 + .word 0xfcdefc2e + .word 0xff18fe9e + .word 0x016cfe7a + .word 0x000bfd1a + .word 0x00baff13 + .word 0xfc32fe55 + .word 0x01f6fe9d + .word 0x02df0082 + .word 0xfeb60069 + .word 0xfcd0fe12 + .word 0xfe25fca4 + .word 0xfe97fcba + .word 0xfdad01c8 + .word 0xfccdff25 + .word 0x01dffe31 + .word 0xfdf20044 + .word 0x020efebb + .word 0x0181ff84 + .word 0xfdfcff62 + .word 0x031eff60 + .word 0x000e0073 + .word 0xfc53fcdd + .word 0x01e9fe05 + .word 0x02a102d5 + .word 0x00f60333 + .word 0x010e0395 + .word 0x03a1fd0c + .word 0xfca6ff1e + .word 0xfd9efd20 + .word 0xfc6203ad + .word 0xfe9101e5 + .word 0xfebe00ed + .word 0x00a90028 + .word 0x02ce012f + .word 0x00c102ed + .word 0x03d403b3 + .word 0x0074fd12 + .word 0xff1efe60 + .word 0xfdabffe8 + .word 0x01e001e3 + .word 0xfd04fe82 + .word 0xff50fdbe + .word 0xfe400053 + .word 0x0012fd19 + .word 0x0309fed2 + .word 0xfc7e0258 + .word 0xfdef03e1 + .word 0xfeb8023a + .word 0x025001cf + .word 0x0190fd07 + .word 0xfd23fed8 + .word 0xfd67fcf3 + .word 0xfe2cfe2d + .word 0xfd19fd1a + .word 0x0060fccc + .word 0x00d20018 + .word 0xfec5026a + .word 0xfc36feb1 + .word 0x020efc32 + .word 0xffb8fda6 + .word 0xffb2fcb2 + .word 0xff74fc60 + .word 0x006ffee6 + .word 0x013500f7 + .word 0xfc840191 + .word 0xff4601af + .word 0x00c003b6 + .word 0x00380395 + .word 0x032902a4 + .word 0xff5dfd5f + .word 0xfec5fe31 + .word 0xfccb0033 + .word 0x0159fcd0 + .word 0xfe2cfec1 + .word 0xfc76fc07 + .word 0xffe003b3 + .word 0xfcc5ff01 + .word 0x024b0021 + .word 0xfcd9fc0a + .word 0x031efe57 + .word 0xfeb9fe47 + .word 0xfe4803a6 + .word 0x0277015f + .word 0xfcccfe91 + .word 0xfdd700d7 + .word 0x00fa024c + .word 0x00e102f5 + .word 0xff07ffb9 + .word 0xfe5ffe20 + .word 0x0029fc83 + .word 0xfef4ffdf + .word 0x03f700aa + .word 0xfcb7fcc7 + .word 0xfebd0059 + .word 0xffff0379 + .word 0xfcb6fcdb + .word 0x021dfc0e + .word 0xfebcfde1 + .word 0x01bbfdbe + .word 0x035cfeef + .word 0xfe5aff99 + .word 0xfe0a012d + .word 0x035a011e + .word 0x03520271 + .word 0x032f00d5 + .word 0x0310fd81 + .word 0x01eafe3e + .word 0xfe5402f4 + .word 0x036d0321 + .word 0xfe10fec2 + .word 0x009100bd + .word 0xfc6800a7 + .word 0x01fb02f2 + .word 0xff61ff6a + .word 0x01d101b4 + .word 0xffb3fdcb + .word 0x038afd8a + .word 0xfc2affdb + .word 0x017a0282 + .word 0x01750020 + .word 0xfd780203 + .word 0x00a2fdfc + .word 0xfdec0395 + .word 0x02ac03c5 + .word 0x030bfce4 + .word 0x033c035b + .word 0xff64020e + .word 0xfdb7ff2d + .word 0x020902dc + .word 0x02e10357 + .word 0x0083017c + .word 0xfff4fd20 + .word 0x0054fe3a + .word 0xfc75fdaf + .word 0x0270009f + .word 0xfd80feaf + .word 0x018b03ef + .word 0x01d802e0 + .word 0x014f0294 + .word 0xfc51fd8f + .word 0xfcc20025 + .word 0xfee6014a + .word 0xfe2cff23 + .word 0xfdd8fe7c + .word 0x00d8fe4b + .word 0xfeb50394 + .word 0x0322012c + .word 0x007d036c + .word 0x0070ff10 + .word 0x0064fc55 + .word 0x00db028b + .word 0x01b9fdc8 + .word 0xffe402b8 + .word 0x004a0370 + .word 0xfe87ff21 + .word 0x035cfebc + .word 0x028803ec + .word 0x0347027a + .word 0xffff03b4 + .word 0xfe62fd31 + .word 0x03b60338 + .word 0xfdf2ff26 + .word 0xfd1300cb + .word 0x02a6ff93 + .word 0x0219020c + .word 0xfd4e00fb + .word 0xffc9ff8f + .word 0x03a0ffb3 + .word 0xfe2afc2f + .word 0xfe80fdfd + .word 0xfef8039d + .word 0x03980010 + .word 0xfdfcfdb7 + .word 0xfe37fc3d + .word 0xfc9a011b + .word 0xff62fdba + .word 0x00b1fe00 + .word 0x0017fe77 + .word 0x02ed01d7 + .word 0x01fcfe0f + .word 0x0358fcfd + .word 0x0205fe83 + .word 0xffc7fd42 + .word 0xfc0e01e6 + .word 0xfdb703db + .word 0x02edfefb + .word 0x01d1007e + .word 0x0091fe9f + .word 0xff0c0115 + .word 0xfeb3fe0c + .word 0xfd31015f + .word 0x0213fcd1 + .word 0x01b301c4 + .word 0x027801a2 + .word 0x03fcffda + .word 0x003ffc3f + .word 0x02ed0351 + .word 0x028aff2d + .word 0xfe89036c + .word 0xfd7afc20 + .word 0x0024fc0e + .word 0xfd87026d + .word 0x0372fd2a + .word 0xff33014b + .word 0xfe39fcb8 + .word 0xfd2103d1 + .word 0x03b10147 + .word 0xffef005e + .word 0x038afdf5 + .word 0x0198ff2b + .word 0x0306fed9 + .word 0xfcec03a5 + .word 0xff9600f3 + .word 0x017c03b7 + .word 0xfd47fca9 + .word 0xffbfff55 + .word 0xfecf02fb + .word 0x00a70091 + .word 0xff56fd38 + .word 0xfd270249 + .word 0xfcdb00f8 + .word 0xfed2fe8a + .word 0x021802d3 + .word 0x0181022e + .word 0x01da00e7 + .word 0xfed5fcf5 + .word 0x0366030c + .word 0xfdfc0245 + .word 0xfd5500a9 + .word 0x00fcfcae + .word 0xfcf703d7 + .word 0xffc20016 + .word 0xfdc50239 + .word 0xfcd7fd26 + .word 0xfc3900cc + .word 0xfc3901f9 + .word 0xffd8fd2b + .word 0xfeb0fd2a + .word 0xfd77025a + .word 0xfd4efc45 + .word 0xff200046 + .word 0xff7b03ca + .word 0x03dd01fd + .word 0x0245ff19 + .word 0x02d7ff46 + .word 0x0313fd53 + .word 0xfc8902e1 + .word 0xff6e00d5 + .word 0xff1b0043 + .word 0x037b00f9 + .word 0xfd6cfecc + .word 0x00db005d + .word 0x0315fc39 + .word 0xfc6602f7 + .word 0xffbbfccf + .word 0x00f0fe63 + .word 0xfe580264 + .word 0x02f5fe56 + .word 0xfc4bff40 + .word 0xfc21005a + .word 0xff330130 + .word 0xfc89fdae + .word 0x011600dc + .word 0x0264fdfe + .word 0x0271fe4e + .word 0x003f0126 + .word 0x00fd03b7 + .word 0x02730238 + .word 0x00d9fff2 + .word 0xfd68fcd5 + .word 0xfd78fec7 + .word 0xfeeeffa4 + .word 0x009f0242 + .word 0xff1effdc + .word 0x01fbfcd1 + .word 0xfc8802be + .word 0xff86fe83 + .word 0xfc85fdee + .word 0x0003028b + .word 0xfc240118 + .word 0x0038fc73 + .word 0xfcedff79 + .word 0x01ac015f + .word 0xfcd8002f + .word 0x005d0141 + .word 0xfe47fd7c + .word 0xfdbc032d + .word 0xffb60011 + .word 0xfff50233 + .word 0xfe78fd99 + .word 0x0151ffce + .word 0x02aefcf4 + .word 0x0255feb6 + .word 0x03a70161 + .word 0xfdd6fd30 + .word 0xff66016e + .word 0x0184fe06 + .word 0xff7e012e + .word 0x014dfe27 + .word 0x0172028e + .word 0x00e3fc90 + .word 0x00890347 + .word 0xfcde0137 + .word 0x029ffc87 + .word 0x037b030d + .word 0x025efde4 + .word 0x026c0181 + .word 0x0087fc51 + .word 0xffcafe8a + .word 0xfdf50218 + .word 0xfceb03cd + .word 0x001d0113 + .word 0x01e20289 + .word 0x006bfcd7 + .word 0x033dfcad + .word 0xfd0601f9 + .word 0x02a6ff7f + .word 0x02100019 + .word 0x0270000a + .word 0xfd6dfd0e + .word 0x02500155 + .word 0xfe1bfc27 + .word 0x016c0243 + .word 0x01ef00c7 + .word 0x02b90172 + .word 0x03e1010a + .word 0xfc9e0018 + .word 0xfff201f5 + .word 0xfc56fc5c + .word 0xfe8cfce0 + .word 0x01cdff63 + .word 0xfc2cff66 + .word 0x01bf01d8 + .word 0x0260fc1d + .word 0xff0602ce + .word 0xfc490105 + .word 0xfcf9036d + .word 0xff97011f + .word 0x02000224 + .word 0x022dff93 + .word 0x00990106 + .word 0xfebbff9c + .word 0xfc4c02d9 + .word 0xffc503c2 + .word 0xfd4e0091 + .word 0x03f6005a + .word 0xfefdfc3e + .word 0xfe7803e9 + .word 0x02df009f + .word 0x021dfebc + .word 0x01020085 + .word 0x00abff3b + .word 0x01d903e2 + .word 0xfd7bfd55 + .word 0xfe3b003a + .word 0x0146ffc8 + .word 0x0188fe07 + .word 0xfdff022f + .word 0x01130198 + .word 0xfc6d03f9 + .word 0xfc1bfc99 + .word 0xfce3ff28 + .word 0xff19fc5a + .word 0x01cd0132 + .word 0xfe7b01d0 + .word 0xfd6403fa + .word 0x00b8fff7 + .word 0xfe280122 + .word 0xfcfefc74 + .word 0x019b012a + .word 0x022cfc74 + .word 0xfeaf03f3 + .word 0xfc67ff9f + .word 0xfd6afc56 + .word 0xff630015 + .word 0x033c036a + .word 0x03ba01a1 + .word 0x029003af + .word 0xfe9d0040 + .word 0xff05fe15 + .word 0x03fd024d + .word 0x0350034e + .word 0x03c9fe53 + .word 0xfe9cfcb1 + .word 0xfc7d0193 + .word 0xfed702a2 + .word 0x021ffcbc + .word 0xff0201df + .word 0xfc030159 + .word 0xff8e033b + .word 0x03c3ff00 + .word 0x0198fe42 + .word 0xfcb7ff06 + .word 0x035500de + .word 0x023e008c + .word 0x02a50108 + .word 0xfc730065 + .word 0xfceefe7f + .word 0x0345fcc8 + .word 0x03f6fd26 + .word 0xfeec02b5 + .word 0x0120fe6c + .word 0x00fa008b + .word 0x0278027b + .word 0x03f90280 + .word 0x007202ff + .word 0x0005024e + .word 0xff80ff68 + .word 0x01f6019f + .word 0xfc06ff8c + .word 0x0039fd82 + .word 0xfed6034e + .word 0xfe5e00ac + .word 0xfe98fd3f + .word 0x030bfcdc + .word 0x015d01c1 + .word 0x0215fcda + .word 0xfc0600f4 + .word 0x01d4fe62 + .word 0x02f8ff36 + .word 0x014afd81 + .word 0x03f7ff8a + .word 0x003e01a1 + .word 0xfe6cfc57 + .word 0xfc1bff03 + .word 0x03da00ba + .word 0xfedaff1d + .word 0xff2ffdaa + .word 0x012500cd + .word 0xfc61ff7f + .word 0x0324028d + .word 0xfe030310 + .word 0xfc25ffe7 + .word 0x00270319 + .word 0xfe9b0310 + .word 0xfc0cffd8 + .word 0xff5601ea + .word 0xfde1ff05 + .word 0x03b5ffdd + .word 0xffcd039f + .word 0xfee4ff3c + .word 0xffdb00c0 + .word 0xfdbeff7d + .word 0xfee8ff5e + .word 0x022d029b + .word 0xfebf0319 + .word 0xfd75fd3d + .word 0x01bdfd58 + .word 0xfe36024c + .word 0x001f0355 + .word 0xfd25fdf6 + .word 0xfef6fed2 + .word 0xfcb1fc6e + .word 0x03000065 + .word 0x0033fe8b + .word 0x0023febb + .word 0xff5afcb1 + .word 0x030d0112 + .word 0x032fffdd + .word 0xfcc4fc04 + .word 0xff69ffd0 + .word 0x001cfc23 + .word 0x01640064 + .word 0xfc0bfd3f + .word 0xfc8afe61 + .word 0x0250017c + .word 0x0188022b + .word 0x00a200f8 + .word 0xfec1fe76 + .word 0xfd05ff95 + .word 0x00ac0355 + .word 0x03b1ff5d + .word 0x01ccfef4 + .word 0xfe4300ff + .word 0xff0003d0 + .word 0x02b6fc6a + .word 0x0352fca7 + .word 0xfeac0363 + .word 0xfd9bfcd6 + .word 0x0383fcd6 + .word 0x029c0248 + .word 0x015e0222 + .word 0x02d800be + .word 0x00b0002c + .word 0x03930055 + .word 0xff4602ad + .word 0x0336ff40 + .word 0x0150028e + .word 0xff3903e3 + .word 0x031500e2 + .word 0x031a009b + .word 0x03af011f + .word 0x0318002e + .word 0x0334fdd9 + .word 0xfd550258 + .word 0xff9103ee + .word 0xfddcfda1 + .word 0x00d103e5 + .word 0x03d4ff5b + .word 0x00da039d + .word 0xffdf0304 + .word 0xfd96009b + .word 0x035dfe05 + .word 0x0094ff0f + .word 0x020d03f2 + .word 0x02b20318 + .word 0xfcee021d + .word 0xff1701e9 + .word 0x00c7fd08 + .word 0x010bffa0 + .word 0xfe31fc01 + .word 0x01c301bc + .word 0x03f7ff5c + .word 0xff1c01c6 + .word 0x021dfef0 + .word 0xfd710322 + .word 0xfeaf024c + .word 0x0012ffec + .word 0x001cfe82 + .word 0x01d1004c + .word 0xfd58fc73 + .word 0x032b0099 + .word 0xfd85ffff + .word 0x0085fd2f + .word 0xfca9ff9a + .word 0xfc08fda9 + .word 0xfd3ffca7 + .word 0x0066fc29 + .word 0x004ffc35 + .word 0x0269ffef + .word 0xfe24fd0d + .word 0x01d80214 + .word 0x03af028d + .word 0xfdbcfe1a + .word 0xfe08012d + .word 0x006bffff + .word 0xfdc901f9 + .word 0xffa00120 + .word 0x02f7fd90 + .word 0xfd74ffbf + .word 0xfcd3ffbe + .word 0x029afda8 + .word 0xfcd8fc83 + .word 0x0364ffe6 + .word 0xfe8e0290 + .word 0xfc59fc34 + .word 0x0014fddc + .word 0xfc11fc8f + .word 0x034703f7 + .word 0xfeea00b6 + .word 0xfcf9ff85 + .word 0xfc78fec9 + .word 0xffd6fd2e + .word 0xfce4ff73 + .word 0x012cfdb1 + .word 0xfdb30181 + .word 0x01d300d3 + .word 0x013a004f + .word 0x037a002f + .word 0x02d1fc09 + .word 0x023300df + .word 0xfd1fffcc + .word 0xff1a0237 + .word 0xfc1ffc8a + .word 0xfccffd3a + .word 0xfe6ffe0e + .word 0x03a0fee6 + .word 0x009a0348 + .word 0x03b5000d + .word 0x00fafc85 + .word 0x021cff9a + .word 0x009d0277 + .word 0x03dafe41 + .word 0xfd1dfd15 + .word 0xff30fe33 + .word 0x03a8010f + .word 0x03f8fe07 + .word 0xfdb1ff09 + .word 0xfdfbfd04 + .word 0xfedc00dc + .word 0x032cff3d + .word 0xfe89fd70 + .word 0x006a017c + .word 0x001801f2 + .word 0x0016fc17 + .word 0x007a0342 + .word 0x00ab02bd + .word 0xff9cff64 + .word 0x026afd40 + .word 0x035cfe39 + .word 0x0078008c + .word 0x03cf00d5 + .word 0xfdb0fc61 + .word 0x016fffbf + .word 0x008c0267 + .word 0x000100b4 + .word 0xfe7ffdb9 + .word 0x00cc015b + .word 0xfffa01c7 + .word 0xfd7d0083 + .word 0x008e0394 + .word 0xfe60ff6e + .word 0x0343023a + .word 0xff960096 + .word 0x03580162 + .word 0xfee203df + .word 0xfc7802ac + .word 0x0073ff95 + .word 0xffecfd3f + .word 0x01f6ffbc + .word 0xfd3e0385 + .word 0x0355fe01 + .word 0xfcfb03b2 + .word 0xfe1100e8 + .word 0x03810310 + .word 0xfc570136 + .word 0x003a007e + .word 0x0013ff8d + .word 0xfef30199 + .word 0xfdc302ae + .word 0x0064ffb8 + .word 0xfd740352 + .word 0xfce2004c + .word 0x033500b1 + .word 0xfc460179 + .word 0xfd6e03db + .word 0xfdea01e4 + .word 0xff8302f9 + .word 0x00020201 + .word 0x0191fe21 + .word 0x02bafd91 + .word 0x03a4fdbc + .word 0xfd69ff2a + .word 0x021c009e + .word 0xff04fc86 + .word 0x0050fde7 + .word 0x0392022b + .word 0x03b0fd0a + .word 0xff04006f + .word 0x006003f6 + .word 0x00c6fe93 + .word 0x0265fd00 + .word 0xfd33ff49 + .word 0x03b6fd0a + .word 0xfc8dfdf2 + .word 0x03d8fed7 + .word 0x023202b3 + .word 0x02ca01e6 + .word 0xffa70075 + .word 0xfeddfc6b + .word 0x0155028b + .word 0x020f02e5 + .word 0x01d902e9 + .word 0xfcb80165 + .word 0xfe050008 + .word 0x0084ffed + .word 0xfc1eff67 + .word 0x00f6fc9e + .word 0x01ba035d + .word 0x004efd3a + .word 0x03ec0331 + .word 0x02290334 + .word 0xfd17fd5a + .word 0x0331ff1b + .word 0xfc1b034e + .word 0x01df02e6 + .word 0x035301f6 + .word 0xfce1fc7c + .word 0x001d01d2 + .word 0x0210fc92 + .word 0x013603aa + .word 0xfdcc01c7 + .word 0xff3d0188 + .word 0xffefff9a + .word 0x007bfeb5 + .word 0x0173fc4e + .word 0x03aefd17 + .word 0xfe8dfdbf + .word 0xfe24fe70 + .word 0x0295fd4a + .word 0xfe8c0158 + .word 0xfc88fe3d + .word 0x015afe08 + .word 0xfcfbffbf + .word 0xfdb803a1 + .word 0x029ffc0f + .word 0x008dfd02 + .word 0xff2d0019 + .word 0x0240fd8b + .word 0x035d0329 + .word 0x00defece + .word 0x025f03e3 + .word 0xfe73fef9 + .word 0x01cafc7b + .word 0xfe7ffc0f + .word 0xffb10020 + .word 0xfdf6fe45 + .word 0xfd4103a3 + .word 0x0294ff38 + .word 0xffb801f1 + .word 0x01350172 + .word 0xfd43015e + .word 0x019f0268 + .word 0x02b3fda2 + .word 0x02bffffd + .word 0xfefdffa7 + .word 0xfe850046 + .word 0xfc2afd7d + .word 0xff7003d9 + .word 0x03160322 + .word 0x003afdfb + .word 0xfe63fcb2 + .word 0x02720164 + .word 0xffabff1f + .word 0xff5e0066 + .word 0x008003f8 + .word 0x01a9fdff + .word 0xfeb1fcfb + .word 0xfc96fd63 + .word 0xff93fec1 + .word 0x00030033 + .word 0x021efce2 + .word 0xfe8c017c + .word 0x012800db + .word 0x0190ffeb + .word 0xffc1fe3a + .word 0x02c00389 + .word 0x0108fef7 + .word 0x0298fd73 + .word 0xffbefdd6 + .word 0x02a6fef3 + .word 0xfdd702f9 + .word 0x03ebfeed + .word 0xfc0fffe0 + .word 0x01140377 + .word 0xffabfc15 + .word 0xfd6a01a8 + .word 0xff540371 + .word 0xfc4401c7 + .word 0xfe0fff5f + .word 0x0238006e + .word 0x032d0052 + .word 0xfdd601f5 + .word 0xfc8bfde2 + .word 0xfddcfdf5 + .word 0xff16ff7e + .word 0xfd6bfe9c + .word 0xfe2401bf + .word 0xfea202b1 + .word 0x0240ffa5 + .word 0xffc6005f + .word 0xff4dfe05 + .word 0xfd3bfc52 + .word 0xfedbfd70 + .word 0xfd26009e + .word 0x023c03fe + .word 0x010ffc6f + .word 0xfec1033c + .word 0xfdc403fd + .word 0x01760374 + .word 0x02b001db + .word 0x0264fc15 + .word 0xffa00149 + .word 0x0315ff04 + .word 0x01b0fdd4 + .word 0x02c3fe49 + .word 0xfdfafe19 + .word 0x0182fe14 + .word 0x0343fd4b + .word 0x016ffed5 + .word 0xfda300e7 + .word 0x008d0316 + .word 0xff580052 + .word 0xfd73fe52 + .word 0x0033031d + .word 0x0218fe89 + .word 0xfc90fcd0 + .word 0xfd300037 + .word 0xfe23fe63 + .word 0x006e012e + .word 0x0095027a + .word 0x03ae003d + .word 0x0018fe7f + .word 0x0238fd4a + .word 0xfd25fc65 + .word 0xfe0a02f4 + .word 0x0376fffd + .word 0x0155fd43 + .word 0x00ad01bd + .word 0x007e0059 + .word 0xfdb9fc0e + .word 0x017b0145 + .word 0x02bd039d + .word 0xfd29fe5c + .word 0xff9401b9 + .word 0xfee6fdf4 + .word 0xfef2ff16 + .word 0x00ee00f8 + .word 0x0363fdf0 + .word 0xff3effa7 + .word 0x0357fdf7 + .word 0xfcc0ffb0 + .word 0x0158fe0b + .word 0x02810245 + .word 0x00760330 + .word 0xff7303f6 + .word 0x02c7ff21 + .word 0xfc9dfcc3 + .word 0x01cdfe01 + .word 0x035dfffd + .word 0xfca9fd8a + .word 0x03d7fd8c + .word 0xfd1c0302 + .word 0x02c80325 + .word 0xff1afeaf + .word 0xfc210286 + .word 0xfe5ffd67 + .word 0xfcaffceb + .word 0x01c1ff87 + .word 0xff030171 + .word 0x03dbfc95 + .word 0xfdb3034f + .word 0xfc73fc17 + .word 0x0026fe6c + .word 0x028601cf + .word 0x0313fd4f + .word 0x0215fc5a + .word 0x005afc73 + .word 0xfc71fe2f + .word 0x026602af + .word 0x02e202d9 + .word 0xff7a03a1 + .word 0x03b8fca6 + .word 0x036f00e5 + .word 0xfc6002de + .word 0xfffa00b1 + .word 0xfeed0247 + .word 0x0321fd7e + .word 0xfd4400d8 + .word 0xfe36fc25 + .word 0x02410169 + .word 0xff9100a2 + .word 0x00e9fe50 + .word 0x0386fe76 + .word 0xfc280055 + .word 0x036d005d + .word 0x03f7ff4d + .word 0xfd37ff64 + .word 0xfe1cfea8 + .word 0x0263fd8f + .word 0xfcb5ffcc + .word 0xfec9fea4 + .word 0xfeab00eb + .word 0xff490039 + .word 0x031efe64 + .word 0xfdc2ff55 + .word 0x01ab002f + .word 0x01d4feab + .word 0x024001b7 + .word 0xfc9afdf8 + .word 0xffba01fd + .word 0xfc56ff91 + .word 0x018d0352 + .word 0xfdecfd3a + .word 0x000f0126 + .word 0x01880249 + .word 0x0152fdfe + .word 0x034302cb + .word 0xfd31015e + .word 0xfe8afd4f + .word 0xfe5f02be + .word 0x022cfd11 + .word 0x0319fcfd + .word 0xfd7e01a2 + .word 0xfd7f017e + .word 0x011afe24 + .word 0x002ffd20 + .word 0x00affeec + .word 0xff0afdcb + .word 0x02b1fdca + .word 0x02a0fcd6 + .word 0x025bfc7f + .word 0xfd4d007f + .word 0x00a5fefe + .word 0xff14fce9 + .word 0xfd8dfcdc + .word 0x003d00d5 + .word 0x012501a3 + .word 0x03ac0101 + .word 0x0179fe05 + .word 0x031cfe8b + .word 0x0256febf + .word 0x00a5fc76 + .word 0x03d9fcd8 + .word 0xfd63ff53 + .word 0xfef9fd99 + .word 0x0071fc47 + .word 0x0330013c + .word 0xfe2a0139 + .word 0x012602bf + .word 0xfc690115 + .word 0x03a20346 + .word 0x02eafe29 + .word 0x023001c7 + .word 0xff1cffb3 + .word 0x01df0194 + .word 0x03e5fd5a + .word 0x02c5fce1 + .word 0xffadfe0b + .word 0x034102e6 + .word 0xfd1afcf0 + .word 0xffaefc8a + .word 0x0057fcb7 + .word 0x0371ff30 + .word 0xfc2801fe + .word 0x01affc68 + .word 0xff2cfe71 + .word 0x0019fd54 + .word 0x031bfda9 + .word 0xfcda0020 + .word 0x016efda3 + .word 0x02eefc91 + .word 0x03f40358 + .word 0xff820245 + .word 0xffb30324 + .word 0xfddcff23 + .word 0xfed20272 + .word 0x02fbfd61 + .word 0xfdb0009b + .word 0xfe4afd59 + .word 0x014402e7 + .word 0x0241feb7 + .word 0xfea3ff8b + .word 0x028afe37 + .word 0xfd39ff33 + .word 0x03baff1a + .word 0xfdb0002d + .word 0x015103d9 + .word 0xfed3020b + .word 0xffeefde8 + .word 0xffbefe94 + .word 0x021bfd7c + .word 0xfca6fd52 + .word 0x01ab00df + .word 0x0089ff2c + .word 0xfd260283 + .word 0xfe74012f + .word 0xfccdff27 + .word 0xffaafd76 + .word 0xfca90363 + .word 0x02cc02af + .word 0xfd23ffa3 + .word 0xff58fcb4 + .word 0x038d029b + .word 0xffb803e4 + .word 0x0237fd8a + .word 0x03adfc50 + .word 0x03430104 + .word 0x01ae00ac + .word 0xfdf30002 + .word 0x0222fe16 + .word 0xff17fc25 + .word 0xfd24fef3 + .word 0xff3efc2d + .word 0x0340ff24 + .word 0xfd9fff1d + .word 0x0299fd23 + .word 0x034f03d2 + .word 0xfe25fe03 + .word 0xfd0f038a + .word 0x03ca0249 + .word 0xfe8403fe + .word 0x02eb0115 + .word 0x0373feb8 + .word 0xfde70307 + .word 0xfdf6ff67 + .word 0xfe88019b + .word 0xfcd1fd89 + .word 0xfc4800c8 + .word 0xfcccfcdd + .word 0x012701ee + .word 0xfe8d0053 + .word 0x02d7fffc + .word 0x015afdbc + .word 0x0116fe41 + .word 0xfe67035b + .word 0xfeb003e5 + .word 0xfd46fe01 + .word 0x00a4fdb4 + .word 0xfd5dfc93 + .word 0x03befcb3 + .word 0xff370190 + .word 0x01bf03b0 + .word 0xfc89007a + .word 0x03f4fd6c + .word 0xfd0403d0 + .word 0x017900d6 + .word 0x02a9fc03 + .word 0x0032fc2b + .word 0x027e03fc + .word 0xfdec00f9 + .word 0xfe1c0325 + .word 0x0008012e + .word 0xfc1a01ab + .word 0x01c4fec7 + .word 0x02fd00c4 + .word 0x03c00107 + .word 0x028a013b + .word 0x0108fc5f + .word 0x0354fdb8 + .word 0x00e3fdfa + .word 0x03bafe2e + .word 0x005bfc8c + .word 0x002bff52 + .word 0x03900260 + .word 0xff0cfc00 + .word 0x00310046 + .word 0xfe5cfcb6 + .word 0x0101034b + .word 0xfe8dfda4 + .word 0x01edff4f + .word 0x03b7ff34 + .word 0x00c302d0 + .word 0x02e70194 + .word 0xfe7ffdce + .word 0x00990094 + .word 0x02bcfd3c + .word 0xfeec03a6 + .word 0x03030271 + .word 0x018cfc10 + .word 0xfcd6fe5d + .word 0xff7dfd03 + .word 0xfdf1fcd0 + .word 0x00e0fcee + .word 0x0185fef1 + .word 0x018b0184 + .word 0x00b8fcc1 + .word 0xff4cfe35 + .word 0x02040033 + .word 0x0351fffe + .word 0xfeeb025e + .word 0x01200023 + .word 0xfe55fe5f + .word 0xfea100b8 + .word 0xfc91ff1f + .word 0x0198fc0f + .word 0x0224fe5e + .word 0xfff8ff16 + .word 0x0348001e + .word 0xfdf40263 + .word 0x02a60075 + .word 0xfda2ff8d + .word 0xfd62fea0 + .word 0x032b00fe + .word 0x0340fc34 + .word 0x02b500a0 + .word 0x01c1fd4e + .word 0x03ddff84 + .word 0xfebd02b4 + .word 0xfede03a0 + .word 0x010f01ca + .word 0x0333fd5b + .word 0x02b2fd1c + .word 0xfe09fcb5 + .word 0x011bff6b + .word 0x006f019b + .word 0x00ee0328 + .word 0x01e60341 + .word 0x019cfd33 + .word 0xfe41fe4a + .word 0xfeba03ab + .word 0x028301df + .word 0xff1bfea0 + .word 0x009d00c1 + .word 0x0328fe5d + .word 0xffa9fc2d + .word 0xfffa027b + .word 0xfdd8fedd + .word 0x0204ff8e + .word 0x004a01e9 + .word 0x0066ff93 + .word 0x0364fcf1 + .word 0x030803f4 + .word 0xfff8fcf7 + .word 0xfcdb027a + .word 0x00fffdc6 + .word 0x0230038c + .word 0xfc0503f3 + .word 0xfdfbfcc7 + .word 0xfcc601ad + .word 0x0003ffa9 + .word 0x028b012d + .word 0x033d030e + .word 0xfcfc0363 + .word 0x0102fd0a + .word 0x03bcfffe + .word 0x025a028c + .word 0x01eb02db + .word 0xfc96fe9c + .word 0x006cfe59 + .word 0x00af027b + .word 0xfd810250 + .word 0xfd9b0056 + .word 0xff28fdd6 + .word 0x00300178 + .word 0xfc4c029e + .word 0x00e101de + .word 0x0250003b + .word 0xfe5ffe40 + .word 0xfc4ffd39 + .word 0x02c40342 + .word 0x03160076 + .word 0x0274fd71 + .word 0xff3702f9 + .word 0x004dfc83 + .word 0x020afe9c + .word 0x026b0382 + .word 0xfe1201c7 + .word 0xfd73023a + .word 0x0316fdf1 + .word 0xfd12fc0b + .word 0x03750148 + .word 0x03f3fd07 + .word 0x0350fdb6 + .word 0x0381fea6 + .word 0x00f800e4 + .word 0x01140326 + .word 0xfeec0385 + .word 0xfee90107 + .word 0xfffbffb7 + .word 0x008700b5 + .word 0xfdf30054 + .word 0x0135ff16 + .word 0x01c401d4 + .word 0x00300373 + .word 0xfd5100ed + .word 0xfd7003e3 + .word 0x0043ffdd + .word 0x02ecfdac + .word 0x037c0187 + .word 0x0277014c + .word 0x00b20013 + .word 0xfef4026b + .word 0xfc0c02a2 + .word 0xfdff000d + .word 0xff3bfca7 + .word 0xfcd1fca5 + .word 0xffa9fc83 + .word 0xfd82035f + .word 0x03740345 + .word 0xfe9202d0 + .word 0xff47ff0a + .word 0xfefdfc91 + .word 0xffdb02f2 + .word 0xfec0ff17 + .word 0xfc2bfe87 + .word 0xfebb031f + .word 0xfe94fd4d + .word 0x03c702e4 + .word 0x03a8fd85 + .word 0xff5802a7 + .word 0xfee3fc93 + .word 0xfc78ff9b + .word 0xfe29028e + .word 0x03c5fcfb + .word 0xfc1dffeb + .word 0x0201fd4c + .word 0x0182ff8b + .word 0xfed0fd96 + .word 0xfd25fc57 + .word 0x0146fd28 + .word 0x0064ffcd + .word 0xfd5d02d2 + .word 0xfdd30292 + .word 0x03a60156 + .word 0xffbf015e + .word 0xfda90006 + .word 0x0291010c + .word 0x027b00c3 + .word 0xffeffdc3 + .word 0xfd2701b8 + .word 0x002efdf0 + .word 0x02c50161 + .word 0x03520306 + .word 0x0304fe10 + .word 0xfeaffd54 + .word 0x00d80307 + .word 0xfcd5026f + .word 0x012a03e9 + .word 0x03adfc56 + .word 0x031ffedb + .word 0x030d008e + .word 0x033cfca8 + .word 0x00a001e3 + .word 0x002dfca2 + .word 0x0007fe90 + .word 0xfccdffd3 + .word 0xfd3f034b + .word 0x02cc0397 + .word 0x0321ffdb + .word 0xfd1d0398 + .word 0xfdfc003c + .word 0xff65fd7f + .word 0xfcdc00bc + .word 0xfcc300e4 + .word 0x021300a4 + .word 0x01df01e3 + .word 0x00e0fc96 + .word 0xfe37ff53 + .word 0x03fa01f5 + .word 0x03d4001e + .word 0x01e7ff90 + .word 0xffa8fc5f + .word 0xff55fe9c + .word 0x027a01dd + .word 0x01da01e4 + .word 0xfc6bffac + .word 0x015cfde0 + .word 0xffa50127 + .word 0xffe6fe7c + .word 0xffd5ff99 + .word 0x02080386 + .word 0xfdaf0194 + .word 0x02fbffad + .word 0x0259020d + .word 0x03d601ee + .word 0x016301c2 + .word 0x0265fd41 + .word 0xffa40038 + .word 0x0260fc6d + .word 0xfd14fda5 + .word 0x0286fcbc + .word 0xfd19fc54 + .word 0x0100039b + .word 0xfd880058 + .word 0x00ccfce8 + .word 0xff5dfe8c + .word 0x01b0009f + .word 0xfe69fc0b + .word 0x036f02b0 + .word 0x01aaff36 + .word 0x01c5fc6e + .word 0xfc00012c + .word 0xfc19025c + .word 0xfea702cf + .word 0xfd5a002e + .word 0xfca7fcd9 + .word 0x02640019 + .word 0x030dff93 + .word 0x03ebfc55 + .word 0xffb0fe8d + .word 0x005900ce + .word 0xfcf70024 + .word 0x031e008b + .word 0xfc9c0219 + .word 0x02b902a7 + .word 0xfda402d6 + .word 0xff17fe4e + .word 0x000b0367 + .word 0x01e1fef3 + .word 0x025bfeb3 + .word 0xfec900bc + .word 0x02d202a5 + .word 0x03330172 + .word 0x02ddfc14 + .word 0xfc9bfd1f + .word 0xff7bfe47 + .word 0x022c018e + .word 0x02d4010e + .word 0xfda300fd + .word 0x01eefd08 + .word 0x00fd024a + .word 0x00cbfe35 + .word 0xfd7effae + .word 0xfd06009a + .word 0xfdebffb9 + .word 0xfc4fff21 + .word 0xfdbcfcb7 + .word 0x00d3feb7 + .word 0xfedd00ff + .word 0xff8a03c7 + .word 0xfde6020d + .word 0xffaf02fb + .word 0x01c201e2 + .word 0xfd33fca9 + .word 0x007cff02 + .word 0x02960050 + .word 0x0117fd21 + .word 0xfee701ef + .word 0xfd7cfc37 + .word 0xff5a00c3 + .word 0xffa5ffa7 + .word 0x010afdc9 + .word 0xfc21fce1 + .word 0xffb8fe45 + .word 0xfe69fdad + .word 0x0036fc27 + .word 0x00550005 + .word 0xfc690025 + .word 0x02ee01ea + .word 0x027b03bf + .word 0xfe3e0324 + .word 0x011ffe7e + .word 0xff6dfe2a + .word 0xfe46fdbc + .word 0x01f30115 + .word 0x022803b8 + .word 0xfc4e01f7 + .word 0x01910398 + .word 0xfcf9ff11 + .word 0x002002e8 + .word 0xfca700a8 + .word 0x0124fc4f + .word 0x03e1fc44 + .word 0xfc28008b + .word 0xfdf602ff + .word 0x0193013c + .word 0x012d01e3 + .word 0x02edff1b + .word 0x02680247 + .word 0xfc87030d + .word 0xfc6d015f + .word 0x020f01dd + .word 0x01af02ae + .word 0x0381ff46 + .word 0xfc0ffeb4 + .word 0x02e4037c + .word 0xfc14fefc + .word 0x01e1fec4 + .word 0xffa0016b + .word 0xff5ffdf9 + .word 0xfd89ffd4 + .word 0x019b0011 + .word 0x005903ca + .word 0x019b035c + .word 0xfd5702b7 + .word 0xfea2fe71 + .word 0x0250ff36 + .word 0xfd58fc89 + .word 0xff20fe67 + .word 0xff380211 + .word 0xfdf7fcce + .word 0xffc5fdf4 + .word 0x01ac032a + .word 0x019602d4 + .word 0xfdc50171 + .word 0xfc0bfcf7 + .word 0x009b00ee + .word 0x0268fea3 + .word 0x038f0144 + .word 0xfdd9fe8e + .word 0xfd5dfc72 + .word 0x0099ff20 + .word 0xfd2e004c + .word 0x0096fd5d + .word 0x01f1008a + .word 0xfdb9005f + .word 0x01610055 + .word 0xfe66fc47 + .word 0x0164fd7b + .word 0xfd4f0124 + .word 0x01570241 + .word 0xfdf1fe2b + .word 0x0146ff1e + .word 0x03f9fcbf + .word 0x01a703be + .word 0xfcbbfc96 + .word 0x01d100e4 + .word 0xfdd50257 + .word 0x012dff37 + .word 0x007301a6 + .word 0x021002ba + .word 0x0206fcb2 + .word 0xfe660396 + .word 0x00cf00f8 + .word 0xff3fffb7 + .word 0xff75ff6f + .word 0xfdfcfda0 + .word 0x024f0030 + .word 0xfcd3fe8c + .word 0xfc1f028c + .word 0x01a6ff41 + .word 0xfd8dfff3 + .word 0xfd31024f + .word 0x000afc65 + .word 0xfc27018c + .word 0xfd0aff0d + .word 0xfc330268 + .word 0x010c00d4 + .word 0x03d9fcc9 + .word 0x01f0fe8b + .word 0x010f038d + .word 0xfe73fe37 + .word 0x02acfda9 + .word 0xfc6efce3 + .word 0xff7503bd + .word 0xff77fe44 + .word 0xff5cffaf + .word 0xfd0b00d1 + .word 0xfd9fffd1 + .word 0x0288fdf0 + .word 0xfcca0071 + .word 0x01b003ce + .word 0x01310106 + .word 0xfd8103a3 + .word 0x03d4001d + .word 0xfc45fc02 + .word 0xfc19fda8 + .word 0x03de03b7 + .word 0x0259ff1f + .word 0xfe2aff9a + .word 0xfcb0fc7f + .word 0xffe6fd6c + .word 0x0391fdac + .word 0x002902d4 + .word 0x0120fd72 + .word 0x02c1fccf + .word 0x00d0fc86 + .word 0x00f70196 + .word 0xfd8d0251 + .word 0xff80fc43 + .word 0x0083fed4 + .word 0xfcb50341 + .word 0xfe31fcb4 + .word 0xfd7f029b + .word 0xfcd000b7 + .word 0x0278ff3f + .word 0x038f026a + .word 0x013a0251 + .word 0xfc2fffac + .word 0xfc8900db + .word 0xfdf600d9 + .word 0xfecfff06 + .word 0x0304ffcc + .word 0x020afd19 + .word 0xfd27033c + .word 0xfc74ffd4 + .word 0xfd46fd87 + .word 0x00190261 + .word 0x00ae032f + .word 0x0198fd4f + .word 0x0078fcaf + .word 0xfcd7ff3f + .word 0x00f301b2 + .word 0x03ca005d + .word 0x027cfd94 + .word 0x02d3fc8a + .word 0xfc4f01c8 + .word 0xfc490193 + .word 0xfd4500c8 + .word 0x03e2fc50 + .word 0xfe0d03c1 + .word 0xfe12fd84 + .word 0xfeba03c4 + .word 0x0398fd08 + .word 0xfccd030f + .word 0x0020fee2 + .word 0x0345fed2 + .word 0xfcb2fcd6 + .word 0x0242fffc + .word 0x006a0353 + .word 0x01b5fd1a + .word 0xffc80134 + .word 0x004b0375 + .word 0x0219fdd6 + .word 0xfe77fc39 + .word 0xfcd4fe1c + .word 0xfe6c0061 + .word 0x029fffb2 + .word 0x03d202c9 + .word 0xfead016c + .word 0xfeca0303 + .word 0xfcbefd9c + .word 0x01edfe3b + .word 0xfe4f0298 + .word 0x005f016e + .word 0x02250393 + .word 0xfde7ff09 + .word 0xfe31fc86 + .word 0x000cfeb1 + .word 0xfc1c026d + .word 0xfc50ffb0 + .word 0x020b00e4 + .word 0x0022ffb7 + .word 0x00a50060 + .word 0xfd5eff23 + .word 0xfc07fc6a + .word 0x00d7fe42 + .word 0x024f01c8 + .word 0x003efd82 + .word 0xfeeb0100 + .word 0xfdbc028c + .word 0xfff2033a + .word 0xfee4ff74 + .word 0x03f1027d + .word 0x0316fd23 + .word 0xfcb30107 + .word 0xff5c013d + .word 0x0280fce4 + .word 0xfd160297 + .word 0x034dff48 + .word 0x03bcffb9 + .word 0x00ca0042 + .word 0x024afe9f + .word 0xfc13fc68 + .word 0xff66ff4c + .word 0xffd2fc97 + .word 0x0031ff3f + .word 0x036dff30 + .word 0x036a01ee + .word 0xfc3afe69 + .word 0xfc3afe57 + .word 0xfda4fc19 + .word 0xfcb40237 + .word 0xfe4301a8 + .word 0xfe5f02e7 + .word 0x0176016b + .word 0xff8602f8 + .word 0xfea8fcb7 + .word 0xffdbfc59 + .word 0xfd020198 + .word 0x03f40106 + .word 0x01a0006d + .word 0xff5300b9 + .word 0x0367031e + .word 0xfeda0180 + .word 0xfc1902fb + .word 0xfd4d0081 + .word 0xff9efeb4 + .word 0xfe8f030b + .word 0x038c01f3 + .word 0xfc3f031b + .word 0x033402bf + .word 0xfcdf0097 + .word 0xfd1300d0 + .word 0x007200b1 + .word 0xffe502e9 + .word 0xfe86fff2 + .word 0xfca2fce8 + .word 0xfdecfda0 + .word 0xff8100f5 + .word 0x0176fd2b + .word 0xfe6c0292 + .word 0x001d016a + .word 0xfe1dfd73 + .word 0x02a10153 + .word 0xfd300383 + .word 0xfe510215 + .word 0x02bcfd41 + .word 0xfdb702d0 + .word 0xff8801c1 + .word 0x01340250 + .word 0x01f803ec + .word 0x0096fdf2 + .word 0xfce8ffd9 + .word 0xfee7ff1d + .word 0xffcdfeb3 + .word 0x01d401a5 + .word 0x03dbfd3a + .word 0xffcc00ad + .word 0xfccafce8 + .word 0x000d02a6 + .word 0x00e902d8 + .word 0xfcabfc0e + .word 0x022efd9d + .word 0x0378fd35 + .word 0xfd68fd6f + .word 0x022500d1 + .word 0x00be0379 + .word 0xff9303b8 + .word 0xfdddfcbc + .word 0xfed4ffca + .word 0x01a3ff8c + .word 0xfc720367 + .word 0x01cafd8f + .word 0x02a6fe21 + .word 0x004dfd08 + .word 0xfec0ff04 + .word 0xfea5024f + .word 0x031b01dd + .word 0xfe22fce5 + .word 0xffb003b7 + .word 0x01d7fd3c + .word 0xfe5fffe9 + .word 0xffe503cd + .word 0xfc3f0345 + .word 0xfc39fedd + .word 0x035ffc93 + .word 0x015cfc7e + .word 0x00acfc7e + .word 0xff71ffd3 + .word 0xff89fe66 + .word 0x03800193 + .word 0x021dfc6b + .word 0xfc71feaa + .word 0x03cefc0f + .word 0xfd1f0289 + .word 0x00d2fdf8 + .word 0x00880158 + .word 0x02d9fc10 + .word 0x02110215 + .word 0x03b701cb + .word 0xfc8502e7 + .word 0x038a018a + .word 0x03190228 + .word 0xfc310282 + .word 0xfc33fd08 + .word 0x00a8016a + .word 0x0165fe10 + .word 0xff7afde3 + .word 0x02a1fcca + .word 0xfc6dfd72 + .word 0x000d03ad + .word 0xfe78fd7f + .word 0xffaafd29 + .word 0xfd260071 + .word 0x0091fe37 + .word 0x02340072 + .word 0xfcb1fd6a + .word 0xfc5afe30 + .word 0xfcf8ffa8 + .word 0xfc1900e4 + .word 0xffbafc7f + .word 0x0174014c + .word 0xff9d0187 + .word 0x00360088 + .word 0xffbe0186 + .word 0x01070248 + .word 0xfe4500e6 + .word 0xff2f02d2 + .word 0x01f8fd38 + .word 0x0102014d + .word 0x01daffa1 + .word 0xff61fc63 + .word 0x007e0351 + .word 0x03aa00ae + .word 0xfc4500fd + .word 0x00c102e2 + .word 0xffebfd41 + .word 0x008efd93 + .word 0xfdaffc73 + .word 0x014e0301 + .word 0x01a00158 + .word 0xff9d02cb + .word 0xfc3afdd9 + .word 0xffbbfefc + .word 0x03d200d9 + .word 0x031b018d + .word 0xfe24026d + .word 0x009f03c2 + .word 0x00ff0180 + .word 0xfc520248 + .word 0x02780164 + .word 0xfe0c025f + .word 0xfc3cfc68 + .word 0x034efed3 + .word 0xfe0a034e + .word 0x007d022e + .word 0xfce8fe6d + .word 0xfe7ffe54 + .word 0x0276fd2a + .word 0x02cb0339 + .word 0x02e5fd59 + .word 0x019803dd + .word 0x0029ffe0 + .word 0x00c6fffa + .word 0x024ffcd6 + .word 0x03860195 + .word 0x0096fc60 + .word 0x010d012b + .word 0x018a0151 + .word 0x01770014 + .word 0xffe9fe7e + .word 0xfe1fff57 + .word 0x03b202cc + .word 0xfcc90286 + .word 0xffe0ffb2 + .word 0x0053014e + .word 0xfdf9ffb3 + .word 0xfd20039e + .word 0xfda500b3 + .word 0xfc3d0165 + .word 0xfc4fff64 + .word 0x023ffd61 + .word 0xfe310204 + .word 0x03c80019 + .word 0xfe390139 + .word 0x024cff8c + .word 0xfe12fcb3 + .word 0xffe6fdbf + .word 0x00ab0318 + .word 0x01e20202 + .word 0x023b02c7 + .word 0xfe12016f + .word 0xfdfeffea + .word 0x019bfc46 + .word 0x021b0272 + .word 0xfec3035c + .word 0xfc09ff47 + .word 0xfdaffee0 + .word 0x03c100ce + .word 0xff6ffc36 + .word 0xfee2feac + .word 0xfe3100f6 + .word 0x03cfff57 + .word 0x036e005d + .word 0x01f40345 + .word 0xff5802e2 + .word 0x02a8fe24 + .word 0xfe7fff3b + .word 0xfec403c3 + .word 0x007aff63 + .word 0xff920225 + .word 0x0242ffb6 + .word 0x02e3ffee + .word 0xfc70ff44 + .word 0x00d7fd4f + .word 0x02960207 + .word 0xfcc5fdd1 .global v16b .balign NR_LANES*4 v16b: - .word 0x01fdffc9 - .word 0xfd480273 - .word 0xfdadfc50 - .word 0x02e6fc25 - .word 0x0268005b - .word 0x0350fcd1 - .word 0xfe3dfc82 - .word 0xfe59023d - .word 0x03c101f9 - .word 0x00f101c5 - .word 0x0094005d - .word 0xfe5b00dc - .word 0x012a0042 - .word 0x02fefec1 - .word 0xfe29ff48 - .word 0x0283ff11 - .word 0xfeb0fdb0 - .word 0xfcbcfc7a - .word 0x0290ff6a - .word 0x002bfd2c - .word 0x032dfe5b - .word 0x025b030d - .word 0x019cff87 - .word 0x03c8fd2b - .word 0xfde8fc41 - .word 0x03b600b7 - .word 0x0212008e - .word 0x0255fd58 - .word 0x0235feb0 - .word 0x0313029b - .word 0xfee7fc56 - .word 0xfeb40089 - .word 0xfc260355 - .word 0xffdd001f - .word 0x022cff12 - .word 0x001b0313 - .word 0x023c0357 - .word 0xfe190266 - .word 0x03070119 - .word 0xfe38fca9 - .word 0x0261fe1c - .word 0x00af0007 - .word 0xff9dfc86 - .word 0x01cd02d3 - .word 0x0165fc26 - .word 0xfcebfea4 - .word 0xfd6efdae - .word 0xfd12011c - .word 0x0093000a - .word 0xffc0fffc - .word 0xfc2301b6 - .word 0xfcb802ea - .word 0xff14feed - .word 0xfe100056 - .word 0x01d001d2 - .word 0x02a8feea - .word 0xfcc2ff5d - .word 0xfc2103ba - .word 0x000a016f - .word 0x03af01b3 - .word 0xffdcff3d - .word 0x0183fd7f - .word 0xfd4001d6 - .word 0xfddf03b4 - .word 0xfec0fc1d - .word 0x0092ffe4 - .word 0x00590118 - .word 0x0066feef - .word 0xfce40152 - .word 0x028700d0 - .word 0x03d3ff96 - .word 0xfdd102a9 - .word 0xff2efd08 - .word 0x0283fe52 - .word 0x01c100fd - .word 0x0396fce5 - .word 0xfc80fc28 - .word 0x01cdfdef - .word 0xfe350132 - .word 0xff4bfd7a - .word 0x0235fd51 - .word 0xfca4fc30 - .word 0xfff10258 - .word 0x0053fecf - .word 0xfda4027a - .word 0xfe18fc84 - .word 0x038003cf - .word 0xffb1fd78 - .word 0xfde3fee9 - .word 0xfed2006f - .word 0xfe64fee4 - .word 0xfc6601c5 - .word 0xfd05fc6c - .word 0xff4f014d - .word 0x02a801c5 - .word 0xfd34034c - .word 0x013201b1 - .word 0xff4801dc - .word 0x0334fd25 - .word 0x00d60076 - .word 0xfc8702d4 - .word 0xff96fd6b - .word 0x00820205 - .word 0xffa10124 - .word 0x02bf02d6 - .word 0xfe75030b - .word 0x02f5fe31 - .word 0x0063febb - .word 0xff72fdf4 - .word 0xfef00348 - .word 0xffb50360 - .word 0x01710299 - .word 0x02a3fd17 - .word 0x035bfc54 - .word 0xfda300dc - .word 0xfdc0015f - .word 0x01fe02a3 - .word 0xfe56fe05 - .word 0xfc95ff54 - .word 0xfd0efeed - .word 0xfd67fe9c - .word 0x004cfcf1 - .word 0x03e702df - .word 0x010cfe42 - .word 0xfd3f017a - .word 0xfddc0379 - .word 0x03ad0363 - .word 0x0303ffaa - .word 0x00c50077 - .word 0xfcf6fedb - .word 0x00f80030 - .word 0xff94fc33 - .word 0x033f0124 - .word 0x00b50239 - .word 0x01c900d2 - .word 0xffa4fcbc - .word 0xff9303c0 - .word 0x008f01bb - .word 0xfc7ffd40 - .word 0xfc3f00e1 - .word 0x0363fe89 - .word 0xfcdbfcfd - .word 0x0274ffa4 - .word 0xfeb5fe35 - .word 0xfe6f00e9 - .word 0x02c00168 - .word 0x02be0218 - .word 0xfe0503f5 - .word 0xfcc2feed - .word 0xfd22fc2f - .word 0xff31fc75 - .word 0x03a4ff6a - .word 0x0108fd9d - .word 0x0387024c - .word 0x01ad039b - .word 0x01d1fdc0 - .word 0x0130fe56 - .word 0x023601f8 - .word 0x010efcef - .word 0xff1b006c - .word 0x01d603d8 - .word 0xfec50261 - .word 0x0149ff72 - .word 0xfd93002c - .word 0x0184006b - .word 0xfc11017e - .word 0xffa0fff5 - .word 0xff97fc1f - .word 0x03bafd13 - .word 0x014dfd4a - .word 0xfd3e038d - .word 0x021efea1 - .word 0x00eefd77 - .word 0xfe28ff13 - .word 0x0168fc53 - .word 0x02db0343 - .word 0xfe7a02f5 - .word 0xfca4fd6f - .word 0x031cfd72 - .word 0xfc8d025e - .word 0x01c5031b - .word 0xfcfafffa - .word 0xffad01f8 - .word 0xfd0e0376 - .word 0xfe98fd71 - .word 0x015c028e - .word 0xfc3e0270 - .word 0xfe590210 - .word 0xfe08ff3f - .word 0xfc29013e - .word 0x0361fe0f - .word 0x02140160 - .word 0x02080358 - .word 0xfee70281 - .word 0xfcdf0081 - .word 0x03c2027a - .word 0x0088fc5d - .word 0x02faff91 - .word 0xfe1d0097 - .word 0x0397007e - .word 0x0269fe3f - .word 0x0184fca5 - .word 0xff080362 - .word 0xff46009b - .word 0xffa3fdae - .word 0xff4801d3 - .word 0x0000fe66 - .word 0x03060335 - .word 0x03380046 - .word 0x030601fe - .word 0xfda0ff5b - .word 0x021ffe60 - .word 0x024affca - .word 0xffa00265 - .word 0x0305030b - .word 0xffeefc0a - .word 0x02dffc9c - .word 0xfe0e01d1 - .word 0xfcd1fe80 - .word 0x01070021 - .word 0xfc0603af - .word 0xfe2d0054 - .word 0x0176fe57 - .word 0x00e5fc07 - .word 0x0224020a - .word 0xfd99fdcd - .word 0xfd80fd7e - .word 0x010902df - .word 0x0106026e - .word 0x03dcfd9b - .word 0x02df0367 - .word 0x03e303bf - .word 0x02ef02d7 - .word 0x03440279 - .word 0x0048fdd3 - .word 0xfc77fda1 - .word 0xfef70322 - .word 0x00bafd59 - .word 0x016d0067 - .word 0x02fdffd7 - .word 0x005a0388 - .word 0x029cff53 - .word 0xfc4f02bf - .word 0x026efc44 - .word 0x0046031e - .word 0xfedb0014 - .word 0xfdd900d7 - .word 0xff6f003b - .word 0xfe9effc4 - .word 0xfdbafd85 - .word 0xfd9c02f6 - .word 0xfd36fe61 - .word 0xfff203fd - .word 0xfdfafc34 - .word 0xfc1efd74 - .word 0x01f50098 + .word 0xfc0e0217 + .word 0xfd26ffd4 + .word 0x02f7ff33 + .word 0x02cdfc79 + .word 0x01800292 + .word 0xfd64ff4c + .word 0xfd970339 + .word 0x02edfc53 + .word 0xfe8901f2 + .word 0xfee3fd3b + .word 0xfd19025c + .word 0x00760293 + .word 0x031e010e + .word 0x014bffc1 + .word 0x006e0031 + .word 0xfc6e0386 + .word 0x035cfff9 + .word 0xfd18fee9 + .word 0x02d203e2 + .word 0xff82fed5 + .word 0x03ca00c0 + .word 0xfc9c02e5 + .word 0x01ec0158 + .word 0xfc99fcbe + .word 0x0196023f + .word 0xffaf024b + .word 0x02a4fdfe + .word 0x02a3fc53 + .word 0xff710203 + .word 0xff580022 + .word 0x0172032e + .word 0x01910374 + .word 0xfd2a02d1 + .word 0xff4002ae + .word 0xfca302a7 + .word 0x007a00a0 + .word 0xfffb000d + .word 0x03db0219 + .word 0xfeb100a4 + .word 0x026e03bf + .word 0x0275001b + .word 0x02a500bf + .word 0xfce202b9 + .word 0x0050fc2c + .word 0x02280286 + .word 0x01280228 + .word 0x02da007d + .word 0xfe15fd60 + .word 0x0271039e + .word 0x00af0263 + .word 0x03db02ef + .word 0x01960287 + .word 0xfd27fcfe + .word 0x03690066 + .word 0xff99fe03 + .word 0xfe9101dd + .word 0x0264036f + .word 0xff8bffd2 + .word 0xff150397 + .word 0x01bcfd2c + .word 0x0373feb6 + .word 0x0133fe2c + .word 0xfce50323 + .word 0xfdf0000d + .word 0xfed0fdf8 + .word 0xfd71005b + .word 0x017cfc4a + .word 0x01effded + .word 0xfd180015 + .word 0xfdd200f0 + .word 0x0037fdd5 + .word 0xfd89032c + .word 0x0222fca5 + .word 0xfeea03ba + .word 0x0122fe7a + .word 0xfc23fd5c + .word 0xff83034f + .word 0xfceb026e + .word 0x02970242 + .word 0x03cb0069 + .word 0xfd30fe63 + .word 0xfeff00e5 + .word 0x02ef01af + .word 0xff4afc71 + .word 0x000bfe0b + .word 0xfed3fd3a + .word 0xfc5e02e5 + .word 0xfd29fcc6 + .word 0xff9700c8 + .word 0xfc320354 + .word 0x0343fe03 + .word 0xfdb800cb + .word 0x03f4fd29 + .word 0x03230195 + .word 0xfdcafdd0 + .word 0xfd04ff52 + .word 0xffb4fd1d + .word 0xff67fd42 + .word 0x01ab022f + .word 0x02e6fc3a + .word 0x0133fe22 + .word 0x011c00e3 + .word 0xff0000f5 + .word 0xfe71ff34 + .word 0x035403f8 + .word 0xffc6fe91 + .word 0x01e5015a + .word 0xff480360 + .word 0xfe36003b + .word 0x01f703f1 + .word 0x0316fdb3 + .word 0xfff5007c + .word 0xfd910066 + .word 0xfc9bff17 + .word 0xfe5400a8 + .word 0xfc840272 + .word 0xfcd0026d + .word 0x02c9fe78 + .word 0xfdd1fe9d + .word 0xff40fe6c + .word 0x033c01fc + .word 0xff1bfc62 + .word 0xfe7efea5 + .word 0x006000bd + .word 0xfd0903bf + .word 0x00abff53 + .word 0x0046fdb7 + .word 0xfe37025f + .word 0x028300c6 + .word 0x00dffe6b + .word 0xfff702c9 + .word 0x0353ff9c + .word 0xfe01febf + .word 0xfd0601d8 + .word 0xffeb013d + .word 0xfe9dff59 + .word 0xfee3fe0c + .word 0xfc5802cd + .word 0x01b7fd04 + .word 0x03b5fd9e + .word 0x01e5fcfb + .word 0x00440157 + .word 0x00c5fe00 + .word 0x0135fd8f + .word 0xffe3012c + .word 0x037f01bb + .word 0xfc7bfc4a + .word 0x012dfde0 + .word 0x00f0ff1b + .word 0x00c0ff31 + .word 0xfc3a02ab + .word 0xfd1dfff1 + .word 0x03300280 + .word 0x028dfcb7 + .word 0x0196038b + .word 0xfcdbff9e + .word 0x0004ff0b + .word 0x01790237 + .word 0x00b9fcff + .word 0xfcf70058 + .word 0xfcfa002e + .word 0xff8a02f7 + .word 0x00690156 + .word 0x0196017b + .word 0xff7afd68 + .word 0x00a0fcfe + .word 0x0119fd52 + .word 0x02cffe5c + .word 0xffadfdf5 + .word 0x0243ff35 + .word 0x02a5fe50 + .word 0xfc0dfe74 + .word 0xfca2fce9 + .word 0xff6c0367 + .word 0xfecd033d + .word 0xffaf03a4 + .word 0x0324fc19 + .word 0x01ed02e5 + .word 0xfffd00de + .word 0xfd1000d9 + .word 0x027afe6b + .word 0xfdbc0107 + .word 0x02bdff3f + .word 0x020bff53 + .word 0x022f02eb + .word 0x02370301 + .word 0x029003f2 + .word 0xffbdfd07 + .word 0x01b30001 + .word 0xff0cff47 + .word 0x030dfe1f + .word 0xfc1800ec + .word 0x027c0240 + .word 0xfe840315 + .word 0xfdfffd47 + .word 0xfd5f02e5 + .word 0x037300e7 + .word 0xfe37ff2a + .word 0xfc9bff07 + .word 0x02c8feee + .word 0x038b02c8 + .word 0x0106fdd2 + .word 0xff08020c + .word 0xffcffca4 + .word 0x032efc5b + .word 0x027efd51 + .word 0xfcd503f5 + .word 0x03740097 + .word 0xff57036d + .word 0x03dcfeaa + .word 0x0150fe79 + .word 0x020d0250 + .word 0x02d50373 + .word 0x03fa03f8 + .word 0xfe9c00a2 + .word 0x00720387 + .word 0x025bff67 + .word 0xfde700f6 + .word 0x01f5fee9 + .word 0x02c5ff27 + .word 0xfc0a0229 + .word 0xfdb0ff85 + .word 0x01fafdab + .word 0x0208fd7e + .word 0x000201f4 + .word 0x022300c5 + .word 0x035f00be + .word 0xfca502ee + .word 0x0161fc17 + .word 0x001301e1 + .word 0x00eb00cc + .word 0xfc650035 + .word 0xfcc40125 + .word 0x01dbfc3d + .word 0xfd6efde8 + .word 0xfd8bfc49 + .word 0xfe4fff37 + .word 0x0030008b + .word 0xff2d01b4 + .word 0x01e3039d + .word 0x03befce4 + .word 0x008d02a6 + .word 0xfe9703af + .word 0xfc38ffc6 + .word 0xfca80355 + .word 0x038c023e + .word 0x037efd8a + .word 0x0110fca7 + .word 0x0264fddb + .word 0xff5c00ce + .word 0x025efdeb + .word 0x0023fcc7 + .word 0x020400fb + .word 0x017cff74 + .word 0xfe810040 + .word 0xfef1fea9 + .word 0xfe9902d8 + .word 0xff9dffa9 + .word 0xfd0c0328 + .word 0x016dfed1 + .word 0x02c10108 + .word 0xff6501b9 + .word 0x02bafd81 + .word 0xfcb903a6 + .word 0x007a0032 + .word 0x03b90044 + .word 0x001c01c4 + .word 0x0014022a + .word 0x0183ffdd + .word 0x0001fddd + .word 0x013102f5 + .word 0x0325011d + .word 0xfdbbfe32 + .word 0x009a0379 + .word 0x007802e4 + .word 0xffa401b2 + .word 0xff7d03d0 + .word 0x0056fc29 + .word 0xfe8d00fd + .word 0x03e90014 + .word 0x02f0002f + .word 0xfc4cfee7 + .word 0x017cfd7a + .word 0x00a3fe5b + .word 0xfc75fc70 + .word 0xffd5fd6f + .word 0x026e0019 + .word 0x028500b8 + .word 0xfea90348 + .word 0xfd160371 + .word 0x02d502bf + .word 0x032b008d + .word 0x0245fc80 + .word 0xfcf30312 + .word 0x0106fe79 + .word 0xfd5efcd8 + .word 0x01d40070 + .word 0x0301ff2d + .word 0xfc31fff2 + .word 0xfd82fd08 + .word 0x0272fd20 + .word 0xfd4b01e9 + .word 0xfc2b0305 + .word 0x0126fc06 + .word 0x004e02a6 + .word 0xfd25fe7f + .word 0xfe3bfdb0 + .word 0x0235feca + .word 0x0288fe45 + .word 0x0004fd95 + .word 0x010d02b7 + .word 0x034e02fa + .word 0xfe480251 + .word 0x0052ff27 + .word 0x01920348 + .word 0x016600b7 + .word 0xfee203c4 + .word 0xfd08fcfe + .word 0x01f1010d + .word 0xfc6402fb + .word 0xfd370249 + .word 0xfdd6fc0b + .word 0xff13fc07 + .word 0x0204fce0 + .word 0xff34ffe5 + .word 0xfc4d00a9 + .word 0x034ffc05 + .word 0xfe15ff89 + .word 0x03b30080 + .word 0xfca30044 + .word 0xfe8301c5 + .word 0x012e0229 + .word 0xfda5fe53 + .word 0x028500be + .word 0x03870048 + .word 0xfc5bfe73 + .word 0x035e021d + .word 0x007203ae + .word 0x0044ff23 + .word 0xfd3cfda0 + .word 0x03ddffad + .word 0xff2b0284 + .word 0xfd4a0203 + .word 0xfdbbfe2a + .word 0xfdd30026 + .word 0x03f50358 + .word 0xfcc8fe49 + .word 0x03bffd82 + .word 0x01c8035a + .word 0x01e8ff5f + .word 0x03b90266 + .word 0x01920250 + .word 0x0107fc34 + .word 0xfe1700f7 + .word 0x01ccfcc9 + .word 0xfea7fc06 + .word 0x0262fef1 + .word 0x01edfef1 + .word 0xffaf0074 + .word 0xfe63ffd2 + .word 0x03f4ff25 + .word 0xff7cfce5 + .word 0xff0f030b + .word 0xfce301a1 + .word 0x02d5fc95 + .word 0xfe22fc82 + .word 0xff61fc58 + .word 0x0370013f + .word 0xfd53fd09 + .word 0xfe9ffdc2 + .word 0xfc67ff26 + .word 0xfc33ff92 + .word 0xfc8e02d0 + .word 0xfde9ff44 + .word 0x01e6024a + .word 0x036303e6 + .word 0xff99ff0e + .word 0xfc48033b + .word 0xfd8602ab + .word 0x01d3fcfc + .word 0xfef00010 + .word 0xffdeff9c + .word 0x00abffdb + .word 0x03f7000b + .word 0x02c50143 + .word 0xff5d0035 + .word 0x0086fc92 + .word 0xfe270034 + .word 0xff9a0349 + .word 0xff88fd5b + .word 0xffbdffc3 + .word 0x012cff59 + .word 0xfc1efdd7 + .word 0xfd80ff29 + .word 0x00d4fc22 + .word 0xff30fcf8 + .word 0xfe0a0381 + .word 0x00670060 + .word 0x00f001f1 + .word 0xfdbcfdb2 + .word 0x0327ff49 + .word 0x0039026b + .word 0xfdea03dc + .word 0xfdd4fd28 + .word 0xfcd30148 + .word 0x0226ff10 + .word 0x01a4fc32 + .word 0xffca0131 + .word 0x010501ea + .word 0xfe21fda0 + .word 0xff75fcd5 + .word 0x0156fcc9 + .word 0xfe15fd13 + .word 0xfcd3ffd8 + .word 0xff3efc4b + .word 0xfe7dfdca + .word 0xfe8f03e3 + .word 0xfea2fce8 + .word 0xffa1ff3a + .word 0xff85fdec + .word 0xff4c0362 + .word 0x00bc0359 + .word 0x01fc0113 + .word 0xfcd1feaa + .word 0xfebb02b4 + .word 0xfce50393 + .word 0x02e80090 + .word 0xfd6eff9b + .word 0xfdb4fde5 + .word 0x0239017e + .word 0x023d0331 + .word 0x01b2015c + .word 0xfe8301ba + .word 0x01b203ed + .word 0x036bff53 + .word 0x003c01c7 + .word 0x001b030b + .word 0x025600f2 + .word 0xfc87ff64 + .word 0xfe940222 + .word 0x03d200d2 + .word 0x01570030 + .word 0xffea004c + .word 0xff190134 + .word 0xfc360270 + .word 0xfcc302e0 + .word 0xffd80316 + .word 0xff03fc11 + .word 0xffac03bf + .word 0xffbefd54 + .word 0x0202017c + .word 0xfd8a0228 + .word 0xfde00062 + .word 0xffd1fecc + .word 0xff3800c7 + .word 0xffd10172 + .word 0xffa5ffa7 + .word 0x0060fe96 + .word 0x008702df + .word 0x028dfede + .word 0xfc150026 + .word 0xfc8700bd + .word 0x010203c4 + .word 0xffdefebe + .word 0xfe8afffe + .word 0xfe9cffe0 + .word 0xfcaaff94 + .word 0xfe4efcd9 + .word 0x01d7fcde + .word 0xfd0bfc1e + .word 0x0390fc9b + .word 0xfc890112 + .word 0xff4cffe8 + .word 0x011dfef2 + .word 0x03d1fe07 + .word 0x0366fea3 + .word 0xfe43fd2c + .word 0x03930004 + .word 0xfc8c0347 + .word 0xffdffdcb + .word 0x0277019c + .word 0x00be0190 + .word 0xffc2fd9a + .word 0x0329ff2b + .word 0x0170fc2b + .word 0x02d4fcda + .word 0x034bfd85 + .word 0x000dfc81 + .word 0xff3cfc07 + .word 0x00e1feea + .word 0x02c10208 + .word 0x01bc00e4 + .word 0xfd9f03f0 + .word 0x005bfd48 + .word 0x03a500db + .word 0x0006fea0 + .word 0x0115fd91 + .word 0x02bdfcf9 + .word 0x0004fe5f + .word 0x0141feff + .word 0xff3300c7 + .word 0xfe2efcf5 + .word 0xfe3bfc99 + .word 0x02b8ffd4 + .word 0xfd18005c + .word 0x03370294 + .word 0xfca1ffb4 + .word 0x0116fd17 + .word 0xfc74fdb2 + .word 0x00e80269 + .word 0xff1202ef + .word 0xff97034a + .word 0xfd62fe68 + .word 0x0261ff46 + .word 0x03e40316 + .word 0xffe40261 + .word 0xfed9fca5 + .word 0xfc36ffc8 + .word 0xfd2cfc91 + .word 0x01f4fcf6 + .word 0xfc740394 + .word 0x0018fc9a + .word 0xff1b0135 + .word 0xfe070070 + .word 0x028c006f + .word 0x020300cd + .word 0xfc8dfda9 + .word 0x0003ff21 + .word 0x00ca00e9 + .word 0x03a001e3 + .word 0x01ee018a + .word 0xfe99ffa4 + .word 0x0372fea9 + .word 0xfc2cffbc + .word 0xfc860192 + .word 0xfc53020f + .word 0x0365fc4f + .word 0xfdad00d9 + .word 0x0209fdbf + .word 0xffe3ffd6 + .word 0x0093ffc3 + .word 0xff7bfe89 + .word 0xffd8fe12 + .word 0xfc4502a1 + .word 0x000cfd41 + .word 0x023c00b0 + .word 0x01f60206 + .word 0xfdee0242 + .word 0x034d0142 + .word 0x03700163 + .word 0x02d302f6 + .word 0x036afe25 + .word 0x00fa038b + .word 0x012402cf + .word 0x0163fd3e + .word 0x03a203cb + .word 0xff83fe82 + .word 0x03ec0173 + .word 0xfcf4fc3b + .word 0xfca20186 + .word 0x010dfd97 + .word 0xffe7001b + .word 0xfff7fc9e + .word 0x006c029a + .word 0x01c5fc48 + .word 0xfffd021e + .word 0xfd670319 + .word 0x00e10206 + .word 0x0166fd0f + .word 0x02850271 + .word 0xfcf203ed + .word 0x01eb010b + .word 0x0276fcce + .word 0xfcc4fe76 + .word 0x02e70011 + .word 0x03d5fe35 + .word 0xff020061 + .word 0xfc10014d + .word 0x005f01fb + .word 0xfd49fd18 + .word 0x027a037d + .word 0xfe9efcbe + .word 0xfefdfd68 + .word 0xffdffde6 + .word 0xfc73fd83 + .word 0x023c025d + .word 0xfd8fff22 + .word 0x0033016b + .word 0xffe2fcf2 + .word 0xfdb2fde3 + .word 0x005b0390 + .word 0x00cfffa6 + .word 0x004d02bf + .word 0x03890075 + .word 0x00a8fd5f + .word 0x01430161 + .word 0xfeb1fc4e + .word 0xfc7d0133 + .word 0xfd6dfe76 + .word 0x024ffd76 + .word 0xfe3a025e + .word 0xfdcd0326 + .word 0xfc720288 + .word 0x00b70353 + .word 0xfc32fde0 + .word 0xfdbc014e + .word 0x034e006f + .word 0xff560367 + .word 0xfe510061 + .word 0xffd3fddb + .word 0xfdea000d + .word 0xfe7302c3 + .word 0x027dfdac + .word 0x005d0201 + .word 0x006f029c + .word 0xfea303e4 + .word 0xff4dfd94 + .word 0xff99fdf4 + .word 0xfddd016d + .word 0x00bd0371 + .word 0x02ddff7e + .word 0xfeac01c9 + .word 0x00c701d1 + .word 0xfccd021d + .word 0xfd7601cc + .word 0xffb8fcd7 + .word 0x03550127 + .word 0x036c02b1 + .word 0x0347022b + .word 0x030bfc19 + .word 0xfdb8fe8a + .word 0xffb5fdb3 + .word 0xfd4b00b5 + .word 0xff660274 + .word 0x030b02ad + .word 0x03f9fe12 + .word 0xffb10162 + .word 0x000302b0 + .word 0xfe9bfd63 + .word 0x0196034d + .word 0x02c9fe93 + .word 0x0305ff98 + .word 0x01fcfc2b + .word 0x0286fe94 + .word 0xfd22fc9e + .word 0x00b0fda2 + .word 0xfdc803c7 + .word 0x01d8fd53 + .word 0xfc95fff9 + .word 0xfcb0fd6c + .word 0x0362004c + .word 0x0181ff5c + .word 0xfc76fd44 + .word 0xfcac0397 + .word 0xfe30fd92 + .word 0x001600d5 + .word 0xfc7afc43 + .word 0x02550028 + .word 0xff8dfdcf + .word 0xff17fcb8 + .word 0x0061fe84 + .word 0xfd38fe96 + .word 0x03520388 + .word 0x01fefc70 + .word 0xfc3efe49 + .word 0x033100c9 + .word 0x02d9fcaa + .word 0xfd9c01e7 + .word 0x0208fe06 + .word 0x0120026d + .word 0xfe45fca7 + .word 0xfd5dffc1 + .word 0x01e0fd81 + .word 0x01c60214 + .word 0xff5f00bf + .word 0x00aeff67 + .word 0x019bff2f + .word 0xff87fc72 + .word 0xfd80fcc4 + .word 0xfca80187 + .word 0xfcdffd05 + .word 0xfdba03fe + .word 0xfc6cff75 + .word 0x008afd7b + .word 0xfc3703f4 + .word 0xfd1f0236 + .word 0x01720069 + .word 0xffc0fefb + .word 0x026c027e + .word 0x02b70089 + .word 0xfcc700d4 + .word 0x023600ed + .word 0x021b00cc + .word 0xff970327 + .word 0xff5400c1 + .word 0xfcc602c9 + .word 0xfe8f037c + .word 0xfcb102ee + .word 0x0316021b + .word 0x039a01c8 + .word 0x00040100 + .word 0x039202ad + .word 0xfc230398 + .word 0x026afe42 + .word 0x01c5ff30 + .word 0xfd0c0312 + .word 0xffb0018c + .word 0xfcb80333 + .word 0x00bdfe95 + .word 0xfeadfe71 + .word 0x02cbff8c + .word 0x029703de + .word 0x034cfcd2 + .word 0x00c6fe67 + .word 0xfdf8ffd9 + .word 0xff3b035d + .word 0x03950269 + .word 0xff3dffb8 + .word 0xfd3bfe30 + .word 0xff05fe0c + .word 0x0166ff15 + .word 0x01c2ffa5 + .word 0x00630339 + .word 0xffecfcd9 + .word 0x016efc54 + .word 0xff70015d + .word 0x00d5015a + .word 0xfedffee9 + .word 0xfd1bff84 + .word 0xff38ff0b + .word 0xfd920399 + .word 0x0048ff98 + .word 0x0091fece + .word 0xfef1ffc2 + .word 0xff97fd72 + .word 0xfdf2fc97 + .word 0x01d3fe37 + .word 0x03fcfe5d + .word 0xfeac0356 + .word 0xffaeff34 + .word 0xff6700c7 + .word 0x0395ffdc + .word 0xfd6302dc + .word 0xff2c00f8 + .word 0x0337fc73 + .word 0x01d6ffc5 + .word 0xfe0efc70 + .word 0x01b4ffa0 + .word 0x00bb0269 + .word 0x03a9fcf7 + .word 0x00f4fc38 + .word 0x02fcfe4a + .word 0x03440290 + .word 0xfc49fcdd + .word 0x038ffd87 + .word 0xfee1fda6 + .word 0xfc8cfe59 + .word 0x0197fdb4 + .word 0x023003bd + .word 0xffc70165 + .word 0x032003de + .word 0xfdb00156 + .word 0x035c0016 + .word 0x03d80050 + .word 0x03aafca0 + .word 0xfcfc02c1 + .word 0x00f002a3 + .word 0xfc48fd02 + .word 0x00bbfc08 + .word 0xfd7cfdb8 + .word 0x01980267 + .word 0x03f8fd78 + .word 0x00830345 + .word 0xfc9700b2 + .word 0xff6802ab + .word 0xff7701c3 + .word 0x01450285 + .word 0x01da01fe + .word 0xff530075 + .word 0xfced005c + .word 0xfd3efd43 + .word 0xfe63fed3 + .word 0xffd6fe01 + .word 0xfcdbff71 + .word 0xfde1fd39 + .word 0xfe5cfdb1 + .word 0x02a9fc3d + .word 0xfe8500d7 + .word 0x03c1feb1 + .word 0xfecd002f + .word 0xffa7ff8b + .word 0xfdf1027e + .word 0xfe1cfe84 + .word 0xfe2a026f + .word 0x01d7fdfa + .word 0xfedc0073 + .word 0x00a5ffe2 + .word 0xfe16ff57 + .word 0xff4cff07 + .word 0x033b00d7 + .word 0xfd29ff58 + .word 0xfd2cfee7 + .word 0x00e70005 + .word 0xfd0d0366 + .word 0x0128ffa3 + .word 0xfd9dfd1e + .word 0xffda02b1 + .word 0x01b203f2 + .word 0xfe5803a3 + .word 0xfe98fdf8 + .word 0x00910287 + .word 0x03fefe44 + .word 0xfefc0245 + .word 0x026fff9b + .word 0xfea6013d + .word 0x0347ff3e + .word 0x017afd3b + .word 0xfef2fec1 + .word 0x032bff40 + .word 0x024efd7f + .word 0x01240112 + .word 0x005400a8 + .word 0xfd73002a + .word 0x01e9fdfe + .word 0xffeb0274 + .word 0x038403b1 + .word 0x0261fd7c + .word 0x0306fce2 + .word 0xfe71016d + .word 0x016b03fa + .word 0xfd0affa3 + .word 0x0204fd42 + .word 0xff8c0308 + .word 0x017b03f6 + .word 0x00bb0315 + .word 0x00f3005a + .word 0x026e0078 + .word 0xffd602d5 + .word 0x03cf0004 + .word 0x0096fe9a + .word 0xfd6efe94 + .word 0x028dfd7b + .word 0x03e10266 + .word 0xff09feee + .word 0x03e5fe34 + .word 0xfe47fc37 + .word 0x038001c7 + .word 0x01d10345 + .word 0xff9bfe63 + .word 0xffa002de + .word 0x02d0fd0e + .word 0x03680025 + .word 0xfecb0067 + .word 0xff8d0022 + .word 0x01f1fd88 + .word 0xffeffe76 + .word 0xff88ff2c + .word 0x0240fce3 + .word 0x036efc21 + .word 0xfff2fdb6 + .word 0xfd01fdb8 + .word 0x02cf03e9 + .word 0xff9900ed + .word 0xfeccfcd2 + .word 0xfd44fc6a + .word 0xfedefd4d + .word 0xff65fcee + .word 0xfc99fca0 + .word 0x00cf0063 + .word 0xfcdb038c + .word 0xfe5bffe9 + .word 0x0286004b + .word 0xfd8e0200 + .word 0xfe1ffee2 + .word 0x02ba0293 + .word 0xfd5ffe87 + .word 0xfd7e0037 + .word 0x007bff93 + .word 0xfe3e0211 + .word 0x03340145 + .word 0xfe80fe00 + .word 0xfc6afdd3 + .word 0xfc79fd8e + .word 0x00a801aa + .word 0x03effda0 + .word 0xfd7e0079 + .word 0x0320fd43 + .word 0x0053fc02 + .word 0x03ee0308 + .word 0xfcf50373 + .word 0x039f0294 + .word 0x03510290 + .word 0x024201cc + .word 0xfd50ff16 + .word 0xfd6afe6a + .word 0x0145fd66 + .word 0x008dfce7 + .word 0x0325ffe7 + .word 0xffe102d0 + .word 0x003dfe6e + .word 0x010d023d + .word 0x01a10009 + .word 0xff0cfc67 + .word 0xfda9fca4 + .word 0xfd9a0151 + .word 0x01b0fcde + .word 0xfd5c0185 + .word 0xfc7d030e + .word 0xfd48fc40 + .word 0x0197fdba + .word 0xfcd0fc82 + .word 0xfd64027f + .word 0x02be0110 + .word 0x0380ffdc + .word 0xfc2ffcbd + .word 0x0075ffc5 + .word 0xfe000196 + .word 0x009d015e + .word 0xfc88ff99 + .word 0xffa9013f + .word 0x037f0013 + .word 0xfc9efe9e + .word 0x033bfe15 + .word 0xfcaefdf0 + .word 0xfc4dff38 + .word 0x0329fcf5 + .word 0xff8efca8 + .word 0x016afe1d + .word 0xfd39017a + .word 0xff360148 + .word 0xff9a02be + .word 0xfd88fc3d + .word 0x0150030f + .word 0x00a3ff15 + .word 0x03a0002c + .word 0xfe730156 + .word 0x014f0309 + .word 0xff800179 + .word 0xfc5c0209 + .word 0xff14fd04 + .word 0xff070359 + .word 0x03f1013d + .word 0xffd3019a + .word 0x026900e6 + .word 0x036efeb4 + .word 0x028b00dc + .word 0xfcf3ff0c + .word 0xffa5029f + .word 0xfe1303df + .word 0xfc2f00f6 + .word 0xfeec03f2 + .word 0xfea4ffa9 + .word 0xfc14fead + .word 0xff1f0225 + .word 0x00610023 + .word 0x0357ff0a + .word 0x00f8ff06 + .word 0x036ffeca + .word 0x03f8fc81 + .word 0x02550199 + .word 0xfe7dfe92 + .word 0x031d0126 + .word 0x025bfe60 + .word 0xfcc1ff02 + .word 0xff34fdac + .word 0xfd35fcf2 + .word 0x014afcfd + .word 0xfc8301f0 + .word 0xff26fc05 + .word 0x038effe4 + .word 0x02a3fe94 + .word 0xfef60338 + .word 0x00e7fcad + .word 0x0229ffa6 + .word 0xffe5fc71 + .word 0x013101e0 + .word 0xfe76fc38 + .word 0x028dff17 + .word 0xfd2afdf0 + .word 0xff840219 + .word 0x00a0ffee + .word 0x03780138 + .word 0xff5effc8 + .word 0xfd8d0032 + .word 0x03dcfee1 + .word 0x022d0025 + .word 0xfe230207 + .word 0xff91032b + .word 0xff9efd87 + .word 0x007301ae + .word 0xff79ff0f + .word 0x00a9fd9c + .word 0xff98fd05 + .word 0x020a024d + .word 0x039903d4 + .word 0x038afdab + .word 0x0166fd03 + .word 0xfede0368 + .word 0xfef3021e + .word 0xff1cfcbb + .word 0x009a019e + .word 0x00fe002f + .word 0x0331fc8a + .word 0x02f902c4 + .word 0x00defed9 + .word 0xfd210084 + .word 0xfd15fc7a + .word 0xfdf2fd45 + .word 0xfdbbfe25 + .word 0xfd250023 + .word 0xff6d00c7 + .word 0xffeffe98 + .word 0x011902dc + .word 0x03fa0257 + .word 0x01eb0298 + .word 0xff3f018d + .word 0x026dfd60 + .word 0xfd5c0101 + .word 0x000701fb + .word 0x02c7005b + .word 0xfe3602f0 + .word 0x01430034 + .word 0xfff60098 + .word 0x013aff6e + .word 0x006c03c5 + .word 0xfc990286 + .word 0x01380038 + .word 0x036201ae + .word 0x03a402dd + .word 0x02670391 + .word 0xfe2000c4 + .word 0xfc1afd41 + .word 0x0097fea3 + .word 0xff1503ac + .word 0xfcaefff4 + .word 0x02d4fefe + .word 0xffbb0010 + .word 0xfc75fe26 + .word 0x026ffe7f + .word 0x0324fe82 + .word 0x0303007a + .word 0xfcd8fc0e + .word 0xfc93fddf + .word 0x0021fd2e + .word 0xffb10067 + .word 0x03a7fe95 + .word 0x01cbfc72 + .word 0xfcdbfc16 + .word 0x000cff27 + .word 0xffd8fd1c + .word 0x03f700d1 + .word 0x031f0039 + .word 0xfded0183 + .word 0xfe620280 + .word 0xfe22fc8f + .word 0xfc6dfdc8 + .word 0xfd06ff8b + .word 0xfca30321 + .word 0xff650276 + .word 0xfc45ff96 + .word 0x0003fd1c + .word 0x0038fc58 + .word 0xfc4afc59 + .word 0xfffe03f7 + .word 0xfccf027a + .word 0xfeaa030c + .word 0x008503cd + .word 0xfe17ff20 + .word 0x02ac001b + .word 0xfe2a0007 + .word 0x03b90046 + .word 0xfe94037a + .word 0x02f600a1 + .word 0xfcc403dc + .word 0x03d701e5 + .word 0xfef6fd68 + .word 0xfe8bff18 + .word 0x00f3fcb0 + .word 0x030301a4 + .word 0xfefe0071 + .word 0x039500ce + .word 0xfeb9fc14 + .word 0xfd04018a + .word 0xfc9902e1 + .word 0xffe000ba + .word 0xfffbfe8e + .word 0xfd4aff54 + .word 0xfda700c5 + .word 0x039efcfc + .word 0x00ac01f2 + .word 0xff0afe94 + .word 0xfc220281 + .word 0x02bffe51 + .word 0xff660230 + .word 0xff2a0023 + .word 0x004a006e + .word 0x013afe79 + .word 0x01f4ff55 + .word 0xfebdfc21 + .word 0x007901b5 + .word 0xfee001b8 + .word 0xfea1ffea + .word 0xfc7bfc32 + .word 0x01d0fdd7 + .word 0x0121fc0d + .word 0xfdb9ffef + .word 0x02befd48 + .word 0x00e6fc4a + .word 0x012901e0 + .word 0x022801cc + .word 0x0284001d + .word 0xfde1fd0a + .word 0x00b4fc68 + .word 0x006f0288 + .word 0xffeb03e9 + .word 0x01c1fc4f + .word 0xfdd4fc71 + .word 0xff8b00ed + .word 0xfce201db + .word 0x02d8fce1 + .word 0x0058002a + .word 0x027ffd3a + .word 0x024efe62 + .word 0x0164fc2a + .word 0x00d6017b + .word 0x004cfc29 + .word 0xfff50260 + .word 0xfe62fd40 + .word 0x02e100eb + .word 0x027c00d3 + .word 0x02f7fcac + .word 0xffdafdf9 + .word 0xfcd90126 + .word 0xfc5dfca3 + .word 0x001cffae + .word 0xfd8afff8 + .word 0xfeadfed7 + .word 0xfd2ffe07 + .word 0xff5afd78 + .word 0xff6aff73 + .word 0xff8202fd + .word 0xff32fe91 + .word 0xfe42fdb7 + .word 0xfd0d006a + .word 0xfe5403cf + .word 0x0373ff14 + .word 0xfe4100fb + .word 0x020cfd8b + .word 0xfc79fe0a + .word 0xfd55017e + .word 0x0102fce6 + .word 0xfe39ffdd + .word 0xff0bfd65 + .word 0xffa9ffa7 + .word 0x039bff8c + .word 0x024f00fd + .word 0x03ec02ab + .word 0x00150262 + .word 0x020f002c + .word 0xfe97fd92 + .word 0x02e30288 + .word 0xfc25018c + .word 0x01dfff9d + .word 0xffabfdb9 + .word 0x028afeae + .word 0x001d02dd + .word 0x02dd01c5 + .word 0xfda10071 + .word 0xfe80fcc0 + .word 0xfdd20224 + .word 0xff6dfe2c + .word 0x008101d8 + .word 0x01b1ff6d + .word 0xff890259 + .word 0x013afdc1 + .word 0xfe8200b0 + .word 0xfe8d0121 + .word 0x005200af + .word 0x0061fc57 + .word 0xfcaafc99 + .word 0x0197fe63 + .word 0xfcbc03c4 + .word 0xfe9e0254 + .word 0xffa2ff89 + .word 0x0298fd90 + .word 0x020a01f9 + .word 0x03defed7 + .word 0x01450364 + .word 0x02380264 + .word 0x0054fd82 + .word 0xfca700f2 + .word 0x03760254 + .word 0x028aff2b + .word 0x02f2ffd9 + .word 0xff75fd56 + .word 0xfd2f014b + .word 0x03840115 + .word 0x0240001b + .word 0xfcdafe62 + .word 0xfe610086 + .word 0x001dfc1c + .word 0xfc01fc7f + .word 0x00620342 + .word 0xfea2037e + .word 0x014cfdef + .word 0xfebc037d + .word 0xff50fd4b + .word 0x03f100c2 + .word 0xfe0bfe92 + .word 0x02be03ee + .word 0xff84ff18 + .word 0xfe5c00fc + .word 0x026dff10 + .word 0x009701aa + .word 0x023403bb + .word 0xffb100f5 + .word 0x01a603b2 + .word 0xfc8800c0 + .word 0x0083009d + .word 0x00c70229 + .word 0xfef2fcec + .word 0xfc8c00d2 + .word 0x0280ff9e + .word 0x00e4fe98 + .word 0x006000a2 + .word 0x00f40339 + .word 0x0333fdeb + .word 0x01210298 + .word 0x00f2fd00 + .word 0xfeeb03d3 + .word 0x01c4ff80 + .word 0xfc2efcb2 + .word 0x03e1fd2d + .word 0x02fa0157 + .word 0x014a006c + .word 0xfe1efe8a + .word 0x0172007c + .word 0xfdaafda3 + .word 0x026dfc20 + .word 0x0316fd98 + .word 0xfce3ffcc + .word 0x021d034f + .word 0xfe3d0159 + .word 0xfc2b0179 + .word 0x03bafe69 + .word 0xfc6dfeaa + .word 0x007bff3a + .word 0x018f0339 + .word 0x022afe9e + .word 0x032afedb + .word 0xfd1b017e + .word 0xfd98fe4b + .word 0xff60fd92 + .word 0x02f8fc07 + .word 0xfe0cfd53 + .word 0xffe60252 + .word 0xffbbfd9e + .word 0x002c0135 + .word 0x03a8fc48 + .word 0x034effa8 + .word 0x012cff07 + .word 0x01cf018f + .word 0x02100204 + .word 0x003c01a3 + .word 0xfd34fda9 + .word 0xfed60096 + .word 0xffadfcc1 + .word 0x0137fc68 + .word 0xfe31008a + .word 0xfdbffe30 + .word 0x00c80219 + .word 0xfe4afe61 + .word 0xfd9b0185 + .word 0xfc3afc13 + .word 0xfd2cfff8 + .word 0x02a6fda2 + .word 0xfd2ffc8a + .word 0x037afde5 + .word 0x03d40240 + .word 0x0298ff53 + .word 0xfd36fed6 + .word 0x0079fe16 + .word 0xfe9efe73 + .word 0x00d9fc9a + .word 0xfe41fc0a + .word 0xfe50fc7a + .word 0x038e011e + .word 0xfc0f0190 + .word 0xfce2fe5b + .word 0x0111006a + .word 0x00cefe9d + .word 0x03d9fdba + .word 0x01a9fdbe + .word 0xfe52fc8a + .word 0xff79fc58 + .word 0x012e0294 + .word 0x028102af + .word 0xfea5ffc4 + .word 0x0030ff8b + .word 0x0026020b + .word 0x00fa00d8 + .word 0x003b00b3 + .word 0xfc0fff4e + .word 0x0050036a + .word 0x034f013a + .word 0x009fffe8 + .word 0xfc5102a2 + .word 0xff4cff57 + .word 0x0197fefc + .word 0x000dfc59 + .word 0x00d50324 + .word 0x021efeaa + .word 0x01fb0158 + .word 0xfd1b008a + .word 0x0383feba + .word 0xfc8702aa + .word 0xfd9702ff + .word 0xfe39ff9e + .word 0x007efd2c + .word 0xfc5dfcf7 + .word 0x00d90003 + .word 0x001cff4d + .word 0xfc97ff1c + .word 0xfc5afdee + .word 0xfe6dfd14 + .word 0x016a0113 + .word 0x02c6013c + .word 0xffe1ffa2 + .word 0x020a0391 + .word 0x03f302cc + .word 0xfe50fc09 + .word 0xff5afe15 + .word 0xff6afddf + .word 0x01a7ff12 + .word 0x01d6fd33 + .word 0xfc7003ec + .word 0xfeefff8c + .word 0xfee501a8 + .word 0x03fb035c + .word 0xfeaffc89 + .word 0xff68fc9e + .word 0x00470335 + .word 0xfe7cffeb + .word 0x016efdb3 + .word 0xfd5efeac + .word 0xfc900394 + .word 0x00b3fd0b + .word 0x020d0380 + .word 0x0281039d + .word 0xfc1f02b4 + .word 0x0359023a + .word 0x018dfc5a + .word 0x026e00e9 + .word 0xfd3c0019 + .word 0x03c7fc5d + .word 0x0037fde1 + .word 0x031bffce + .word 0x00f9fea7 + .word 0xfe57fd30 + .word 0x01aefe38 + .word 0x02b5014f + .word 0xfff50026 + .word 0x037b036e + .word 0x02ddfc53 + .word 0x01e903d3 + .word 0x023a0366 + .word 0x02c7feb5 + .word 0x000a0147 + .word 0xff42fca3 + .word 0xfd7c03bd + .word 0x010dfd63 + .word 0xfe9efef5 + .word 0x0123025f + .word 0x00c8ffeb + .word 0x03c3019b + .word 0x03c1fde6 + .word 0xff20fef9 + .word 0xfe50ff5b + .word 0x0234ff16 + .word 0x024dfc41 + .word 0x01fbfd41 + .word 0xfc67fd49 + .word 0x005f01a3 + .word 0x00d1fd73 + .word 0x018a0266 + .word 0xfd88fc2d + .word 0x024bff16 + .word 0x028afdaf + .word 0xffcc02d2 + .word 0x010bfce2 + .word 0x01fa02db + .word 0x03a900b4 + .word 0x026d00c5 + .word 0xfcb4018f + .word 0xfd7afd9b + .word 0xff8cfffd + .word 0xfdf6fffa + .word 0xfd9ffd70 + .word 0x01ddfc8f + .word 0x00f500ce + .word 0xfd98013c + .word 0x01200035 + .word 0x0327011d + .word 0xfe2e0068 + .word 0x012fffbd + .word 0x03430292 + .word 0x01570124 + .word 0xfc3d03ef + .word 0x02040241 + .word 0x00e201c3 + .word 0xff77ff06 + .word 0x003c000c + .word 0xfdc9fe1a + .word 0xfe5000c6 + .word 0xfc1afd72 + .word 0xfe5effcc + .word 0x01800322 + .word 0xfcaf03bc + .word 0x0341007e + .word 0x0179fc53 + .word 0xfd00ff4c + .word 0x038c03b8 + .word 0x02a20274 + .word 0x02d4feff + .word 0x014b03dc + .word 0xfd7ffef2 + .word 0x0364020d + .word 0x030b01b7 + .word 0x031c014e + .word 0xfd64fd77 + .word 0xffcafd86 + .word 0xfcfa013e + .word 0xfd8e0151 + .word 0xffeafc9a + .word 0xfc64fff2 + .word 0xffd70088 + .word 0x00a600c1 + .word 0x036c015d + .word 0xfc8a0337 + .word 0xffb2008e + .word 0x03790036 + .word 0xfee5fd0a + .word 0xfcdb006e + .word 0x03f5feec + .word 0xff5dfd57 + .word 0x0355025a + .word 0xfc54019a + .word 0x03c401bd + .word 0xfe7effd9 + .word 0x02c802b1 + .word 0xff8c0308 + .word 0xfc3703a4 + .word 0x0157fe93 + .word 0x017affaf + .word 0x01d70177 + .word 0xfda40317 + .word 0xfec0ff2d + .word 0x0189fe55 + .word 0xfe9f003d + .word 0x03e301cb + .word 0xfd85fe23 + .word 0xff20fd4b + .word 0xff020114 + .word 0x0071fca4 + .word 0xfdbb0164 + .word 0x03610207 + .word 0x0017fc9a + .word 0xfcf7fc74 + .word 0x0239015d + .word 0x009bff98 + .word 0x0092fcb3 + .word 0x00eb03e2 + .word 0xfe97006c + .word 0x03f8ff3f + .word 0x0195fc0e + .word 0x0356fda9 + .word 0x010a032d + .word 0x000600c6 + .word 0x013702f2 + .word 0x03850273 + .word 0xfe5dfc43 + .word 0xffb00334 + .word 0xff05fca4 + .word 0x002103c5 + .word 0xfd770199 + .word 0xfed703c8 + .word 0x03a60079 + .word 0x00effe3c + .word 0x013bfe80 + .word 0x01d6fe5a + .word 0x0032fe69 + .word 0xfd46fd6a + .word 0x028f0199 + .word 0x0008fccc + .word 0x01c3fc1f + .word 0xfcbf0132 + .word 0xfebffea4 + .word 0xfe45ff77 + .word 0x0238039d + .word 0x03090225 + .word 0xffc2fd9b + .word 0xfc620395 + .word 0x033cfd57 + .word 0xff43ff6b + .word 0xfe1f01f8 + .word 0x02ff0043 + .word 0xfec7ff6d + .word 0x01a10182 + .word 0xfc03ff1f + .word 0x023ffccb + .word 0x00cc005e + .word 0x0016ff06 + .word 0x039b03e9 + .word 0xfeb0008c + .word 0x00a3022a + .word 0x0280fd40 + .word 0xffdc00bc + .word 0xfdb1fd9b + .word 0xfda803d1 + .word 0xfd6002ff + .word 0x0189013d + .word 0x020d0371 + .word 0xffc3fc3f + .word 0xfceefcf3 + .word 0xffbf0017 + .word 0xffc4ffed + .word 0x00910218 + .word 0x031efeb7 + .word 0x0278fe42 + .word 0x017d019d + .word 0x0341fdd8 + .word 0xfedefe04 + .word 0xfdb6fdf0 + .word 0xfd9f01b6 + .word 0x03ecfc6f + .word 0x01ccfdc7 + .word 0xffb702e9 + .word 0xfd5a02a8 + .word 0x0149fdf7 + .word 0x0089026f + .word 0x00990317 + .word 0x037800ee + .word 0x0127fed4 + .word 0x034601a7 + .word 0x01e0fdec + .word 0xfcc7fd61 + .word 0x0254fd0c + .word 0x02a5ffa4 + .word 0xff1201cf + .word 0xfe12fd2e + .word 0x0194fee5 + .word 0x03cf03b9 + .word 0x02d6030c + .word 0xfcd0fe60 + .word 0x03b401bc + .word 0x02dd00b5 + .word 0xfc10fce7 + .word 0xfc6b03f9 + .word 0xffb9fcc2 + .word 0x00ccffd2 + .word 0xfc90fcdb + .word 0x03fefe63 + .word 0x0181ffbc + .word 0x01a3fe49 + .word 0xfd8900e5 + .word 0xffb90378 + .word 0xfe4effe6 + .word 0x02f800bf + .word 0x017d03e1 + .word 0x017efe8e + .word 0xfe5301da + .word 0xfeb202fe + .word 0xffc5fcaf + .word 0x026200a3 + .word 0x015e03bd + .word 0xfcaeffb6 + .word 0x0276027c + .word 0x0244002c + .word 0xfea7fcd9 + .word 0x005c01c1 + .word 0xfcb60092 + .word 0x02aeff54 + .word 0xff1b01ea + .word 0x0003fe25 + .word 0x01a80147 + .word 0xfc22fe02 + .word 0x03dfffb7 + .word 0xfc6c03c3 + .word 0xfeb402c9 + .word 0x012aff59 + .word 0x03fd0118 + .word 0xfcb3fcc9 + .word 0xfd00003a + .word 0x01fb02ed + .word 0xffe0fe41 + .word 0x016efc50 + .word 0xfdfeff59 + .word 0xfeb2fe67 + .word 0x015dfefd + .word 0x01a2034c + .word 0x01a8fd0e + .word 0x007dff71 + .word 0xfe9b0176 + .word 0xfdb5fe52 + .word 0xfe8a00fc + .word 0x024c02e1 + .word 0x002cfd10 + .word 0xfc3900e4 + .word 0xfe9802ff + .word 0xff12fe62 + .word 0x030efeb4 + .word 0xfd9500c0 + .word 0xfd17032c + .word 0x0033ff55 + .word 0xfe40012a + .word 0x03de0292 + .word 0x016a0023 + .word 0xfcc703db + .word 0xfc1b03f2 + .word 0xfe4d0149 + .word 0x03c7000d + .word 0xfe46fcb2 + .word 0xfe3c0295 + .word 0x000801e8 + .word 0x01dd00e0 + .word 0xfc22fd97 + .word 0xfe02fcd8 + .word 0xff10fd9f + .word 0x019f00c8 + .word 0x030cffa6 + .word 0x0097024a + .word 0xfd23ffe2 + .word 0xff8401af + .word 0xffff0343 + .word 0x0063fde8 + .word 0x027b0396 + .word 0xfd9502bb + .word 0x02c5010e + .word 0x0264fed5 + .word 0x0132ff6a + .word 0xff9cfee2 + .word 0x009c0083 + .word 0xff20ffcf + .word 0x0315fcfc + .word 0xfcc9ffc0 + .word 0x03d2ffe2 + .word 0xfd9601e9 + .word 0xff09fcf2 + .word 0xfe9dfc40 + .word 0xfc8902a3 + .word 0xfe06ffa5 + .word 0x03da02a3 + .word 0xfdf8fd72 + .word 0xfec90177 + .word 0x03020194 + .word 0x005300d7 + .word 0x02de0303 + .word 0xfd1f02ac + .word 0xfd5bffdc + .word 0xfd3cfce4 + .word 0x00f50380 + .word 0xff2102e4 + .word 0x00a8ff04 + .word 0xfe01ff01 + .word 0x0099fc40 + .word 0x01f50383 + .word 0x038dfc2f + .word 0x038efe9b + .word 0xfc79fda7 + .word 0x02f8011b + .word 0x026bfd82 + .word 0xfc78011c + .word 0x03620204 + .word 0xfe63ff44 + .word 0xffcdfe67 + .word 0xfde8fe90 + .word 0x03fa022d + .word 0x012efdc3 + .word 0x00a00003 + .word 0xfe090321 + .word 0xfe6bff9e + .word 0x0267fea6 + .word 0xfe63fe62 + .word 0x00fbfed1 + .word 0xfde3004b + .word 0xfed2018b + .word 0x03ee0344 + .word 0x0279fd8f + .word 0x0338017f + .word 0x0304030c + .word 0xfe74fdd2 + .word 0x03c7fe84 + .word 0x00b00033 + .word 0x0237ff73 + .word 0xff060280 + .word 0xfe7d0172 + .word 0x039efd76 + .word 0xfe30fe3d + .word 0x03f7fee6 + .word 0x021f02b6 + .word 0xfc90024c + .word 0xfd74fcd0 + .word 0x03e602ba + .word 0xff050106 + .word 0x0399fe9a + .word 0x014efcc7 + .word 0xfc6dff1d + .word 0xff1f0245 + .word 0xfd5aff41 + .word 0xff31ff0b + .word 0xfdcc01e6 + .word 0x023002c3 + .word 0xfdeafd02 + .word 0xff32febc + .word 0xff4effba + .word 0x00b9ff65 + .word 0xfd7f01a3 + .word 0x0148002c + .word 0x03b40067 + .word 0xfc15ffc3 + .word 0x0246fdb2 + .word 0xfd13ff07 + .word 0x01cdfd14 + .word 0x03270009 + .word 0x0070fe78 + .word 0xfff002b5 + .word 0xffb801de + .word 0xfc3b02f9 + .word 0x00c40329 + .word 0x00c1010d + .word 0x03b300d6 + .word 0xffe10187 + .word 0x027b000f + .word 0xfe890034 + .word 0xfd74fc5e + .word 0xfddd00a7 + .word 0x02060169 + .word 0xff03025f + .word 0xfe9f039c + .word 0x0100009e + .word 0xfe84015f + .word 0xfe71fdaf + .word 0xfe0dfec6 + .word 0xfc32fe11 + .word 0xfe5cfcfe + .word 0xfd5eff14 + .word 0x00db00b6 + .word 0xfdfc03aa + .word 0xfd4902b5 + .word 0xff4d0050 + .word 0x01e60180 + .word 0xfe2efff4 + .word 0x022b0240 + .word 0x036f004f + .word 0x03670259 + .word 0x00000328 + .word 0xfce40065 + .word 0x001c0150 + .word 0xfd8cfee5 + .word 0x03ccfc1c + .word 0x0256feb2 + .word 0x003b0321 + .word 0xff9efe95 + .word 0xfd0aff03 + .word 0xfed9026e + .word 0xfd78fe67 + .word 0x0090fe0e + .word 0x0051ff82 + .word 0xfe480139 + .word 0xfc95fc10 + .word 0xfd640090 + .word 0x01a9ff8c + .word 0x01c4fd3f + .word 0xfd16039d + .word 0x015e0188 + .word 0x03b3fdb6 + .word 0xfdbdfc88 + .word 0xfefbfc37 + .word 0xfed001e8 + .word 0x004f039a + .word 0xfeadfc3b + .word 0x02d0ff9f + .word 0xfeac036b + .word 0xff1cfe23 + .word 0x03effc4d + .word 0x020c0197 + .word 0x00ee0305 + .word 0xfffcfe0d + .word 0xff1afc2f + .word 0x0074feae + .word 0xfd69029a + .word 0xfdcd00dd + .word 0xfd9600fd + .word 0x0055006e + .word 0x02f20267 + .word 0xfdd8fc84 + .word 0xfd5403cd + .word 0xfe82fe7a + .word 0x0044fc2c + .word 0x035e023b + .word 0xfeee0141 + .word 0x025eff27 + .word 0x00db00f4 + .word 0x026a0040 + .word 0x0242030e + .word 0x02acfc38 + .word 0xff0e0062 + .word 0xfd220017 + .word 0x01f9fe5d + .word 0x01b0029c + .word 0x027e0132 + .word 0x0380fc02 + .word 0x016c0154 + .word 0xfd65feeb + .word 0x03840374 + .word 0xfc99fcb7 + .word 0xffca0084 + .word 0x03d8fcf1 + .word 0xffa303ae + .word 0xfd4b0258 + .word 0x00430270 + .word 0xfe0afd73 + .word 0xfef4fd37 + .word 0xfd590211 + .word 0x010a0258 + .word 0xfc23ff40 + .word 0x0359fe05 + .word 0x0220fcc6 + .word 0x02b9ffa8 + .word 0x01ec02a5 + .word 0xff7ffd01 + .word 0xfe180112 + .word 0x01bd0059 + .word 0xff230185 + .word 0x0219fccf + .word 0xff900254 + .word 0xfe4efc94 + .word 0x02b7fcd6 + .word 0xfd5b039e + .word 0x010bff39 + .word 0xfc38ff7a + .word 0x0324fe14 + .word 0xfd1b02f9 + .word 0x02b6febb + .word 0x0237025b + .word 0x0047035a + .word 0x01ef03a3 + .word 0x00efffda + .word 0xfcb4fe2b + .word 0xff200051 + .word 0xfcaffe5a + .word 0xffdeff57 + .word 0x01ceffa8 + .word 0x0271019e + .word 0x001300bf + .word 0x02f002f8 + .word 0x000903ec + .word 0x0174fe20 + .word 0x01f50176 + .word 0xfefdfcb4 + .word 0x02d00036 + .word 0xfd2afc05 + .word 0xfcb6fe2f + .word 0xfddafe67 + .word 0x005e0087 + .word 0xfdc90031 + .word 0xfdfa011c + .word 0x022cfdce + .word 0xfc6f0306 + .word 0xfe23fc49 + .word 0xfe5fff62 + .word 0x018901e5 + .word 0xff84fdc1 + .word 0x03d1fec0 + .word 0xfdfa0190 + .word 0x02dd023f + .word 0x018ffdd1 + .word 0xffb5fd38 + .word 0x0136031f + .word 0x01df0023 + .word 0x009302b1 + .word 0x0003009f + .word 0xfd5c0201 + .word 0xfd9effa4 + .word 0x03f9ff73 + .word 0x03ec0263 + .word 0xfdc40244 + .word 0xfdaa028c + .word 0xff7101fa + .word 0x015c0137 + .word 0xfddcfebc + .word 0xff3e0139 + .word 0x026bfea3 + .word 0x02260303 + .word 0xfd96fff5 + .word 0xfc390027 + .word 0xfeb30004 + .word 0x0120fded + .word 0x01b7fe00 + .word 0xfda5009e + .word 0x022cff2d + .word 0xfe8d0017 + .word 0xff5cfe5c + .word 0xffd903ef + .word 0x033e0278 + .word 0xff0ffdeb + .word 0x00f5ffe1 + .word 0x0284027f + .word 0xfd2b02c7 + .word 0xfd10fe8d + .word 0x002c033a + .word 0x030200d2 + .word 0x030afe52 + .word 0x01b5fc5f + .word 0xff610078 + .word 0x0166fcb4 + .word 0x023c016f + .word 0x0143fe3f + .word 0x02ea02e6 + .word 0xfdd4fcbd + .word 0xfd04013a + .word 0xfe790164 + .word 0x01250089 + .word 0x02ee01da + .word 0x02b50185 + .word 0x005d036a + .word 0x010e02e1 + .word 0x03bc03fc + .word 0xff9cffdb + .word 0x01ad0352 + .word 0x03bafe04 + .word 0x020aff70 + .word 0xfcdf0318 + .word 0x009a007b + .word 0x006702c1 + .word 0x029301ca + .word 0x019ffc90 + .word 0xfe4bffeb + .word 0xfe1003ed + .word 0x002c0392 + .word 0xfdb7ff84 + .word 0x03f5ffec + .word 0xfe79004b + .word 0x02cd01ca + .word 0xfdebfc72 + .word 0x008c019a + .word 0xfc8901f7 + .word 0x0061ffdf + .word 0xfea1020a + .word 0x038bffc4 + .word 0x0254fda7 + .word 0xfd77fc93 + .word 0xff3ffcca + .word 0x018002d9 + .word 0xff90009e + .word 0xfc7e03a8 + .word 0xffe4fc10 + .word 0xfc4cfece + .word 0x00ba019b + .word 0xfd8afd28 + .word 0x0111fdf7 + .word 0xff40fd7b + .word 0x0076fe30 + .word 0xfe92026b + .word 0xfedffd62 + .word 0x034aff20 + .word 0xff45033c + .word 0xfe27039b + .word 0xfdea0164 + .word 0x00b102c1 + .word 0xffb5fec0 + .word 0x0213ff99 + .word 0x03a5fd6a + .word 0xfd5dfda6 + .word 0xff31ffe7 + .word 0x001c0164 + .word 0xffc703ab + .word 0x0270fcf2 + .word 0xfea70074 + .word 0x02b70075 + .word 0xfd95fc0d + .word 0x03a403f9 + .word 0x001ffca4 + .word 0xfd4efef8 + .word 0xfda00069 + .word 0x00e5fc51 + .word 0x014ffe73 + .word 0xffe5fdc9 + .word 0xfc41011b + .word 0x0133fd75 + .word 0x02000118 + .word 0x00ff0086 + .word 0xfda5021c + .word 0x02b7001d + .word 0xffc9009c + .word 0x03760277 + .word 0x006e005a + .word 0x004200a9 + .word 0x01d4fd3b + .word 0xfd9101a9 + .word 0x03e6ff73 + .word 0xfda5fd5b + .word 0x0102fffc + .word 0x029c0015 + .word 0x01c5ff37 + .word 0xff95fc7a + .word 0x025cfc26 + .word 0xff4b027f + .word 0x017f02bd + .word 0x03b100df + .word 0x03f30268 + .word 0xfc70feb3 + .word 0xfc6500a8 + .word 0xff67fdce + .word 0x02e1fc94 + .word 0x01e9fdc3 + .word 0x029b0103 + .word 0x020effac + .word 0xffec017e + .word 0xfdf70150 + .word 0x02bf01e3 + .word 0x01c60318 + .word 0x02b500b0 + .word 0xffa7ffe8 + .word 0xfd270368 + .word 0xfe48ff10 + .word 0x019d00cc + .word 0xfcdb0084 + .word 0x00e50374 + .word 0xffac03fb + .word 0x00e4fe5c + .word 0x017a0393 + .word 0x0310030a + .word 0x027efe27 + .word 0xff0d01f6 + .word 0x01c7ff16 + .word 0x032c00c2 + .word 0xfc4d01aa + .word 0xff0ffc5c + .word 0x012701ec + .word 0xfe84fecc + .word 0x030101ad + .word 0x025f009f + .word 0xfd21fca0 + .word 0xfc4301cc + .word 0x02ac0278 + .word 0xfe53ffd5 + .word 0x0036010c .global v8a .balign NR_LANES*4 v8a: - .word 0xfdfcfcfe - .word 0x000002fd - .word 0xff02fffe - .word 0x0101fdfe - .word 0xfffc02fd - .word 0x00fd02ff - .word 0xfefefc02 - .word 0x02fdfcff - .word 0x00fffdfe - .word 0x0200fffe - .word 0xfc02ff01 - .word 0x01fefffc - .word 0xfd00fffe - .word 0xfc010000 - .word 0xfffdfd02 - .word 0xfffefeff - .word 0x02010201 - .word 0x01fcfcfc - .word 0xfc01fefd - .word 0x01fd0201 + .word 0x0201fffd + .word 0x0002fd00 + .word 0x01fcffff + .word 0x01fd0000 + .word 0x00fffe00 + .word 0xfdfdfdff + .word 0x0100ff02 .word 0xfcfc02fd - .word 0x00ff01ff + .word 0xfcfffcfd + .word 0xfefefdfd + .word 0xfcfc01ff + .word 0x00fd00fc + .word 0xfdfcfefc + .word 0x010101fe + .word 0x01fcfd01 + .word 0x00fe00fe + .word 0xfc02ff01 + .word 0x02fffcfe + .word 0xff00fefe + .word 0xfffffcfe + .word 0x01fd0101 + .word 0xfffdfdfe + .word 0xfefffdfc + .word 0xfeff0000 + .word 0xfeff02ff + .word 0xfe01fc01 + .word 0x0001feff + .word 0xfdfffc00 + .word 0xfffdfefc + .word 0xfdfc02fe + .word 0x0001fc01 + .word 0xfc01ff00 + .word 0x00020202 + .word 0xfd02fefc + .word 0xfdfe0200 + .word 0xfcfdff01 + .word 0xfc01fcff + .word 0xfdfc01fc + .word 0xfdfc02fc + .word 0x00fefefe + .word 0x01fdfdfc + .word 0x0100fe00 + .word 0xff000001 + .word 0xff02fe02 + .word 0xfefdfd01 + .word 0xfe02fc01 + .word 0xfdff0101 + .word 0xfffe0002 + .word 0x02fdff00 + .word 0xfefefc00 + .word 0x02fefd00 + .word 0x000002fe + .word 0x000200fc + .word 0xfc0202fd + .word 0xfefcfcff + .word 0x00fe0102 + .word 0x010001fd + .word 0x00fdfdfe + .word 0xff00ff00 + .word 0x0002fc02 + .word 0xfffcfdfc + .word 0xfefd0201 + .word 0x0100fcff + .word 0x010001fe + .word 0xff01fe00 + .word 0xfc01fd01 + .word 0x00fd0102 + .word 0xfffe02fc + .word 0xfd0101fe + .word 0xfffffd01 + .word 0x00fefc02 + .word 0xfc00fffd + .word 0xfdfeff02 + .word 0xfefffffd + .word 0xfffffefc + .word 0xfc0102fd + .word 0x00fdfe02 + .word 0xfe00fe00 + .word 0x00fffcfd + .word 0xfdfffd02 + .word 0xfd00fffc + .word 0x010001fc + .word 0x01fcfdfe + .word 0x01fd02ff + .word 0xfd0000fe + .word 0xfe01fdfc + .word 0xfd0100fc + .word 0x010200ff + .word 0xfdfe02fe + .word 0x01fdfc00 + .word 0xfdfefefc + .word 0x00fffd00 + .word 0xff020200 + .word 0x02fdfe02 + .word 0x01020200 + .word 0xfe00ff01 + .word 0x010101fd + .word 0x00ff0002 + .word 0x0100fffd + .word 0xfd0201ff + .word 0xfe010202 + .word 0xfffefe00 + .word 0xfdfcfdfd + .word 0x02fd0102 + .word 0x00fcfc02 + .word 0xfffefffe + .word 0xfefe02fd + .word 0xfcfefd00 + .word 0xfefcff02 + .word 0x00fe00fe + .word 0xfffd0001 + .word 0xff01fdfc + .word 0xfffdfdfc + .word 0x02020200 + .word 0xfcfd00fe + .word 0x0000fffd + .word 0xfe010102 + .word 0xfdfcff00 + .word 0xfe010102 + .word 0x00fc00fe + .word 0x000201ff + .word 0x0202fffe + .word 0xfe020102 .word 0x00fdfc01 - .word 0x0201fefe - .word 0xfdff02ff - .word 0x02fcff00 - .word 0x02fc0002 + .word 0xfdfe01ff + .word 0xfcfe0201 + .word 0xfd02fffd + .word 0x02ffff01 + .word 0x01020100 + .word 0x0102fe00 + .word 0x02fffe01 + .word 0xfcff02ff + .word 0x0101fcff + .word 0x00fd02ff + .word 0x00fc0100 + .word 0x0102fdfe + .word 0xfdfcff01 + .word 0xfe02fffc + .word 0xfeff01fc + .word 0x01fefd01 + .word 0x010201fe + .word 0xfffdfd02 + .word 0xfefd02fe + .word 0x0002fcfe + .word 0xfffc01fc + .word 0xffff00ff + .word 0xfefc01fd + .word 0x0202fc02 + .word 0x02fc0101 + .word 0xfc020001 + .word 0xfffefdfe + .word 0xfcfdfffd + .word 0x02000101 + .word 0x00010101 + .word 0xfcfdfc00 + .word 0xfd020202 + .word 0xfefd01ff + .word 0x0200fcfd + .word 0xfefcff00 .word 0x00ff0200 - .word 0xff0002ff - .word 0xfefd0001 - .word 0xfdfcfd02 - .word 0xfdfc01ff + .word 0xfd01fcfe + .word 0x0002feff + .word 0x00fffcff + .word 0xfefffd01 + .word 0x00fd02fd + .word 0xfdfefd00 + .word 0xfc02fdfd + .word 0xfffffcff + .word 0xfe02fdff + .word 0x02fffefc + .word 0x02fe01fd + .word 0xfc01fc01 + .word 0x02fe02fc + .word 0x01fd0000 + .word 0xfffdffff + .word 0x01fefffd + .word 0xfe00fdfd + .word 0xfd02fdfd + .word 0xfd00ffff + .word 0xfd0102fc + .word 0xfffdffff + .word 0xfefffc00 + .word 0xfefcfcfe + .word 0x02fe00fc + .word 0xfffcfefd + .word 0x0001fffc + .word 0x02fe0001 + .word 0x01fefe01 + .word 0xfdfc02fc + .word 0x01fefdff + .word 0x0200fdfd + .word 0xfffc0101 + .word 0xfefd02fd + .word 0xfffc0202 + .word 0xff01fefd + .word 0xfe0200fc + .word 0xfc020001 + .word 0xfdfcff00 + .word 0xfffdfffe + .word 0xfcfffffc + .word 0xfd02fd02 + .word 0xfd0101fe + .word 0x0102ff01 + .word 0x0000ff00 + .word 0x0202fe01 + .word 0xfffc02fd + .word 0x0001fffd + .word 0x02fe0101 + .word 0x02fcfe01 + .word 0x01fdfdfe + .word 0x02fd0201 + .word 0xfffefc00 .word 0x00020101 - .word 0xff0100fe - .word 0xfcfdfc01 - .word 0xfe0001fe - .word 0x0201fefd - .word 0x02fffe01 - .word 0xfd02fe02 - .word 0x0201fcff - .word 0xfcfd00fd - .word 0x02ffff01 + .word 0x01fdfdfe + .word 0x01fcfe01 + .word 0xfeff01fe + .word 0x020000fe + .word 0xfefd0000 + .word 0xfefc0002 + .word 0xfc02ff00 + .word 0x02ff00fe + .word 0xfcfffdff + .word 0xfefe0000 + .word 0xfffd01fe + .word 0xfdfc0000 + .word 0x000102fe + .word 0xfe00fe00 + .word 0x0001ff02 + .word 0xfefdfdfe + .word 0xfd02fdfd + .word 0xffffff02 + .word 0x020002fe + .word 0x02fd0001 + .word 0xff0102fe + .word 0x0002ff01 + .word 0x00fc01ff + .word 0x01ff01fe + .word 0x020102fc + .word 0xfefe01fd + .word 0x01fffcfc + .word 0xfdfe0100 + .word 0xff02fc02 + .word 0xfcfe0101 + .word 0xff0201fe + .word 0x010101fd + .word 0xffff02fd + .word 0x0100fefc + .word 0xff000102 + .word 0x01000000 + .word 0x01fd0000 + .word 0x000101fd + .word 0xfc0200fc + .word 0xfd00fffd + .word 0x00fffd01 + .word 0xfcff0102 + .word 0xfefeff00 + .word 0x020102ff + .word 0xfc000202 + .word 0x02fefefd + .word 0x0002fc02 + .word 0xfe02ff02 + .word 0x0001fdfc + .word 0xfcfe00fe + .word 0x0202fefc + .word 0x010201fc + .word 0xfffcfe00 + .word 0xfefd0002 + .word 0xfe01fefe + .word 0xfd00fefe + .word 0xfefe0201 + .word 0x00010101 + .word 0xff01fe02 + .word 0x0202fc00 + .word 0x02ff02ff + .word 0xfffefd00 + .word 0x01fffdfe + .word 0xfc00fe02 + .word 0x02fdfdfe + .word 0xfdfe02fe + .word 0x02fdfd02 + .word 0xfeff02fd + .word 0x0002ff00 + .word 0x00010201 + .word 0x02feff00 + .word 0x02fffc01 + .word 0xfdfcfdff + .word 0xfefd00fd + .word 0x0102fe02 + .word 0x010100ff + .word 0xfcfefeff + .word 0xfcfefdff + .word 0xfefffffe + .word 0x00feff01 + .word 0xfcfffdfe + .word 0x020101fe + .word 0xfe0100fc + .word 0x00fefd00 + .word 0xffff01fd + .word 0xfe02fffc + .word 0xfc0101ff + .word 0xfffdfffc + .word 0x010000fe + .word 0xfffe00ff + .word 0xfffefefe + .word 0x01000001 + .word 0xfc0102fd + .word 0x01fcfe01 + .word 0xfd020200 + .word 0x0101fe01 + .word 0xfffd01fe + .word 0xfefcffff + .word 0x020200fc + .word 0xfd0000fc + .word 0x0000fe01 + .word 0x02fcfc02 + .word 0xfdfd02fd + .word 0xfd02fc01 + .word 0xfcfdfcfc + .word 0x00ff0001 + .word 0x020002ff + .word 0xfffffc02 + .word 0xfffcfffd + .word 0xfd02fffc + .word 0xfffefcff + .word 0xfcfdfc02 + .word 0xfe00fdfe + .word 0xfffcfffd + .word 0xff0001fe + .word 0x01fffc01 + .word 0xfefcfc00 + .word 0xfefcfefd + .word 0x00fdfcfc + .word 0xfefe0100 + .word 0x02fe0000 + .word 0x0100fffd + .word 0x0101fd00 + .word 0xfc020202 + .word 0x00ff02ff + .word 0xfffe00ff + .word 0x0002fffe + .word 0x00fdfe02 + .word 0xfdfefdfe + .word 0x000200fc + .word 0xfffefefc + .word 0xfcfc00fc + .word 0x010102ff + .word 0xfd0102fc + .word 0xfd0100fe + .word 0xfd020000 + .word 0xfdfdfc00 + .word 0x0100fd01 + .word 0xfc01fe02 + .word 0xfc020202 + .word 0xfffe00fe + .word 0x00fc02ff + .word 0x02ff02ff + .word 0xfc02ffff + .word 0x0202ff00 + .word 0xfe0000fe + .word 0xfd00fefc .word 0x00fd00fe + .word 0x02ffff00 + .word 0x00fc0000 + .word 0xfe01ff02 + .word 0xfdfefcfd + .word 0x0101fcff + .word 0x01fffefd + .word 0x020102fe + .word 0x01fcfdfe + .word 0xff010100 + .word 0xfc00feff + .word 0x01fdfffd + .word 0xfdfd01fd + .word 0xfefc0200 + .word 0xfdfe0201 + .word 0xfcfdfcfc + .word 0x00fdfc01 + .word 0xff0000fe + .word 0xfffe0102 + .word 0xfc00fcfc + .word 0xfdfcffff + .word 0x02fcff02 + .word 0x01fffcff + .word 0xfd02ff01 + .word 0xfefc0000 + .word 0x00fffffe + .word 0xfd0000ff + .word 0x0200fffd + .word 0x00fe01fe + .word 0xfdfe00fe + .word 0x01ffff00 + .word 0xfffe01ff + .word 0x01fc0201 + .word 0xfc010201 + .word 0x01fffe00 + .word 0x0201fcfc + .word 0x02fc02fd + .word 0x00fefcfe + .word 0xfdfdfd02 + .word 0x00fd0100 + .word 0xffff02fc + .word 0x02fdff01 + .word 0xfdfe0101 + .word 0x0000fc01 + .word 0x0000fcfe + .word 0x01fd0202 + .word 0xff020202 + .word 0xfd02fe02 + .word 0xfcff0100 + .word 0xfffd0101 + .word 0x010201fe + .word 0xfdfdfffd + .word 0xfc02fffd + .word 0xfffd01ff + .word 0xfd0202ff + .word 0xfefcfdfe + .word 0x02fe0200 + .word 0x0200fe01 + .word 0xfefdfdfc + .word 0xfd00fc00 + .word 0xfd01fffe + .word 0xfefc0201 + .word 0xfc010200 + .word 0x02fd02fc + .word 0x0201fc02 + .word 0xfcfcfcff + .word 0xfe000000 + .word 0xfe00ff01 + .word 0xfd0100fe + .word 0xfdfdfcfc + .word 0x02fd02fc + .word 0xfc020000 + .word 0x02fffc02 + .word 0xfefe01fe + .word 0xfffd02fc + .word 0xfefcfc01 + .word 0xff0002fc + .word 0x0102fdfe + .word 0xfefcff02 + .word 0x010202fd + .word 0x02fdfefc + .word 0xfc0100fe + .word 0x01020102 + .word 0xff02ff00 + .word 0xfe02fdfc + .word 0xfcff00fc + .word 0xff01fc01 + .word 0xfcfffc02 + .word 0x0000ffff + .word 0xfffefffd + .word 0x00fcfffe + .word 0xfdff0202 + .word 0x00fcfe02 + .word 0xff00fffc + .word 0xfeff00fe + .word 0xfe01fdfd + .word 0xfdff01fd + .word 0xfefcfcfd + .word 0xfcfd0000 + .word 0xfefefc02 + .word 0x01fdff02 + .word 0x01020200 + .word 0xfeff0202 + .word 0x0002fe02 + .word 0xffff0001 + .word 0x00fc0000 + .word 0xff02fc01 + .word 0x00fffd01 + .word 0xfd0001fd + .word 0x01fefdfd + .word 0x01fcfdfe + .word 0xfcfe0201 + .word 0xfdfcfcfe + .word 0x0200fcfd + .word 0xff0002fe + .word 0x00fd00fd + .word 0xfdfe0101 + .word 0x020201ff + .word 0xfdfdfeff + .word 0xfc000202 + .word 0x02fdfe02 + .word 0x01fd01fe + .word 0x01fefdff + .word 0x00fdfcfe + .word 0xfcfe0000 + .word 0xfcfc0200 + .word 0xfffc0000 + .word 0x0002ff02 + .word 0xfe010100 + .word 0xfcfdfefc + .word 0xfe02fe02 + .word 0xfe0001fc + .word 0xff0100ff + .word 0xfffdfd01 + .word 0xff0202fe + .word 0x01fffffc + .word 0xfdfefd00 + .word 0xfcfefcfc + .word 0x02fffffd + .word 0xfdff0202 + .word 0xfc01fffd + .word 0xfe02fefd + .word 0x00fd0002 + .word 0xfe0102fc + .word 0xfc000202 + .word 0x0201fe01 + .word 0x0002fffc + .word 0xfdfd00fd + .word 0xfcfeffff + .word 0xfe020202 + .word 0xffffff02 + .word 0xfe020202 + .word 0xfdfefe01 + .word 0x00fffcff + .word 0xff02fdff + .word 0x00ff02fd + .word 0xfefffc02 + .word 0x01ff00ff + .word 0x00fe0000 + .word 0xfdff02fd + .word 0x0200fe01 + .word 0x000002fc + .word 0xfc0100fd + .word 0xfeff0200 + .word 0x010201fd + .word 0x00fcfcfe + .word 0xfd02fd01 + .word 0xfd0102fe + .word 0xfdff01fc + .word 0x01fcfc01 + .word 0x0001fdfe + .word 0xff000001 + .word 0xfd0002fd + .word 0xfdfdfcff + .word 0x01fd00fc + .word 0x0001ff02 + .word 0xff0100fe + .word 0xfe0001ff + .word 0x000202ff + .word 0xfcfdfd00 + .word 0xfefdfc00 + .word 0xfc010101 + .word 0xfefe02ff + .word 0xfc01ff00 + .word 0xfc01fd00 + .word 0xffff0201 + .word 0xff00fcfe + .word 0x02fc02ff + .word 0x00fefcff + .word 0xff01fdfd + .word 0x01ff0000 + .word 0xfdfcfffe + .word 0x0101fffc + .word 0xfd00fcfc + .word 0xff00fd00 + .word 0xfe010200 + .word 0x02fe0000 + .word 0x0202fd00 + .word 0x01fe0202 + .word 0x00020201 + .word 0xfd0102fd + .word 0xfdfeffff + .word 0xfe00fc02 + .word 0xfcfe0002 + .word 0x0000fd01 + .word 0xfd01ff01 + .word 0xff02ffff + .word 0x0202fc01 + .word 0x0102fffe + .word 0xff000001 + .word 0xfefdfffc + .word 0xfd00fefd + .word 0xff000102 + .word 0x0002fcfc + .word 0x00fffffd + .word 0xfcfdfcfc + .word 0x0101fdff + .word 0xfc00fefd + .word 0xfcfcfffd + .word 0xfefffd00 + .word 0xfe0102fc + .word 0xfefc0200 + .word 0xff0100fe + .word 0x00fefc02 + .word 0xfffcfcfd + .word 0xfe010202 + .word 0xfcff02fe + .word 0x0200fe01 + .word 0x00fd0102 + .word 0x00fc0201 + .word 0xfe02ff00 + .word 0x01fefcfd + .word 0xfc01fe00 + .word 0x01fc0002 + .word 0x00fe0201 + .word 0xfdfdfc02 + .word 0xff00fc00 + .word 0x0102fe02 + .word 0xfefcfffd + .word 0xfd01fefe + .word 0xfeff02fd + .word 0x00000202 + .word 0xfefcfffd + .word 0x000000fd + .word 0x0101ff01 + .word 0xfefe00fc + .word 0xfffefefd + .word 0x00fcfcfd + .word 0xfcfcfd02 + .word 0xfffc01fe + .word 0xfcfffe00 + .word 0xfeff0101 + .word 0x02fdfd01 + .word 0x01000001 + .word 0x01fdfcfd + .word 0xfcfefcff + .word 0xff01fe00 + .word 0x0000ff00 + .word 0xfd020200 + .word 0x02fe02ff .word 0xfffeff02 - .word 0x00fdfc02 - .word 0x00fdfcff - .word 0xfefc0202 - .word 0x0002fdfc - .word 0x0000fdfd - .word 0x0101fdfc - .word 0x02fc0100 - .word 0xfdfffdfd - .word 0x0201fc00 - .word 0xfcfe0102 - .word 0xff01fcfd - .word 0x01ff00fc - .word 0xff0001fd - .word 0xfdfdfc01 - .word 0xfe01fffc + .word 0x01ff0000 + .word 0x01fcfc02 + .word 0x01020001 + .word 0x01fe0202 + .word 0x010000fc + .word 0xfdfffefc + .word 0x01fcfeff + .word 0xfd00fd01 + .word 0xfcfdfefc + .word 0x010202ff + .word 0x01fcfcff + .word 0x02fdfdff + .word 0x01fcfe02 + .word 0x020200fc + .word 0x0000fd00 + .word 0x020202fc + .word 0xfffe02fe + .word 0x00fcfffc + .word 0x0002fc02 + .word 0x01fcff00 + .word 0x01fdff00 + .word 0x01fc0101 + .word 0x01fc02fc + .word 0x01fffd02 + .word 0x02020201 + .word 0x00010000 + .word 0xfe0201fc + .word 0x01fffc00 + .word 0x01fcfe01 + .word 0x01fcfd02 + .word 0x00fefd02 + .word 0xfd00fc01 + .word 0xfe01ff01 + .word 0xfc00fe01 + .word 0x0101fffc + .word 0xfd01fc02 + .word 0x0200fefe + .word 0xfcff0200 + .word 0xfe0002fd + .word 0xfcfdfdff + .word 0xfefe01fc + .word 0xfcfdfcfe .word 0xfc02fdff + .word 0x01000002 + .word 0xfc0200fc + .word 0x00fdfdfd + .word 0x000001fd + .word 0xfffe00ff + .word 0xfe01fffe + .word 0x00fd02fc + .word 0x000100fd + .word 0x00fc0002 + .word 0xfffdfd01 + .word 0xfffffeff + .word 0xfdfffefd + .word 0xfcfffe00 + .word 0xfe00fe02 + .word 0xfffd01fd + .word 0x01fcfffd + .word 0x00000001 + .word 0x02fefd00 + .word 0xfc01fefc + .word 0x01fcfd00 + .word 0xfdfefd00 + .word 0xfd01fcfe + .word 0xfc0201fe + .word 0x01fe02fe + .word 0xfcfe01fe + .word 0x01fc00ff + .word 0xfefefe01 + .word 0xfcfc0102 + .word 0x01fffd02 + .word 0x000200fc + .word 0xfffcfe00 + .word 0x01020101 + .word 0xfc000100 + .word 0xfefefffd + .word 0xfc01fcfc + .word 0xfd0200fd + .word 0x0002fc02 + .word 0xfcfcfd00 + .word 0xfe020002 + .word 0x0002fdfd + .word 0xfe000001 + .word 0xfffcfefc + .word 0x00fd02ff + .word 0xfcfffeff + .word 0x02000001 + .word 0xff01fc00 + .word 0x01fefffc + .word 0x01fc0002 + .word 0xfe0202fc + .word 0xfcfc00fe + .word 0xfd0001fd + .word 0xfffefcfc + .word 0x0100fd01 + .word 0xfe0202fc + .word 0xfc01feff + .word 0x02fefdfe + .word 0xfcfdfefd + .word 0x02fdfd02 + .word 0x020200fc + .word 0xfffcff00 + .word 0x01fefd01 + .word 0x02fcfdfc + .word 0xff010101 + .word 0x020102fe + .word 0x0002fdff + .word 0xff00fe00 + .word 0x01fe0100 + .word 0xfeff0000 + .word 0xfffffdfe + .word 0xfffefefe + .word 0xffff0202 + .word 0xfdfd00fe + .word 0xfefe0200 + .word 0x0200fcfe + .word 0xff01fc00 + .word 0x0100fcfc + .word 0x01fcfefc + .word 0x020100fe + .word 0x01fd01fd + .word 0xfefd0102 + .word 0xfd00ff00 + .word 0xfffc01fd + .word 0x02ff0202 + .word 0x00fcfefd + .word 0xfefffffd + .word 0xfffcfeff + .word 0xfefcfdff + .word 0xfc02fe00 + .word 0x02fcffff + .word 0xfe00fffd + .word 0x01fe0200 + .word 0xfefcfefd + .word 0xfe00fc00 + .word 0xfdfffc02 + .word 0x02000200 + .word 0x02fffefc + .word 0xfe02ff00 + .word 0xfcfd0000 + .word 0xfe01ffff + .word 0xfdfe0201 + .word 0xff01fe02 + .word 0xfcfc0201 + .word 0xfdfc00fe + .word 0x0101fe02 + .word 0x00fefe01 + .word 0x0200fd02 + .word 0xfeff0201 + .word 0x01fcff02 + .word 0xfffd0200 + .word 0xfd0001fe + .word 0xfdfc01fc + .word 0x01fdfffc + .word 0x02fc0000 + .word 0xfd0100fd + .word 0xfffc02fd + .word 0xfffe0202 + .word 0xfd00fdfe + .word 0xfc0000fc + .word 0xfd0201ff + .word 0x0201fe00 + .word 0xfe000202 + .word 0x01fdff02 .word 0x00fdfdfc - .word 0xfefcfffe - .word 0xfc00fcfd - .word 0xfcfe0102 - .word 0x00fefc02 - .word 0x00010200 - .word 0x02fd01fe - .word 0xfffc0202 - .word 0xfdfdfc02 - .word 0x01feff00 - .word 0x00020000 - .word 0xfe0201fd + .word 0xfdfcfeff + .word 0xfefc0200 + .word 0xfe0200ff + .word 0x02fdfffd + .word 0xfdfe02fd + .word 0x02fdfcfd + .word 0x01fd0102 + .word 0x02fdfd00 + .word 0xff010002 + .word 0xfffd02fc + .word 0x01fdfcfd + .word 0xfdfd01ff + .word 0xfd0202ff + .word 0x0100fcff + .word 0xfcfdfffc + .word 0xfcff0200 + .word 0x0200ff02 + .word 0xfefefc01 + .word 0x020102fd + .word 0xfe000102 + .word 0xfd0100fe + .word 0x0100fc01 + .word 0x01fc0200 + .word 0x01fc0000 + .word 0xfd02ff01 + .word 0x020000fc + .word 0xfdfffcfe + .word 0x00020200 + .word 0xfe02fd01 + .word 0x02fc0100 + .word 0xfdfffdfd + .word 0xff00fffc + .word 0x01fffd00 + .word 0xff00fc01 + .word 0x0100fdff + .word 0x0100fffd + .word 0xfc01fdfd + .word 0x0002fcfd + .word 0xfd02fdfd + .word 0xffff0100 + .word 0x00fdfcfe + .word 0x00feff00 + .word 0xfcfe0101 + .word 0xfefe0102 + .word 0xfdff02fc + .word 0xfcff0200 + .word 0xfcfd01fc + .word 0xfdfffd01 + .word 0xfe020201 + .word 0xfdfcfc02 + .word 0x02fdfd02 + .word 0x00fcffff + .word 0x0201fcfe + .word 0xfc0201fc + .word 0xfcfd0000 + .word 0xfc000001 + .word 0x02fdfefe + .word 0x0101fe00 + .word 0x0200fffd + .word 0xfeff0200 + .word 0xfcfcffff + .word 0x02fcfefd + .word 0xfcfdff01 + .word 0xfc01fcff + .word 0xfdfdfffd + .word 0xfcfffcff + .word 0xfd0102fd + .word 0xfefe0102 + .word 0xfdfc00fe + .word 0xfc00fefd + .word 0xfc02fcfe + .word 0xfd02fefc + .word 0xfefffefd + .word 0x02ff00fc + .word 0xff00fd01 + .word 0x0101fd00 + .word 0x010201fc + .word 0x020101fe + .word 0xfefffefe + .word 0xfe0001fd + .word 0xff010001 + .word 0x00fffffd + .word 0xfcfffc02 + .word 0xfffdfcfe + .word 0xfffdfc02 + .word 0xfefffcfe + .word 0xfd000102 + .word 0x0102fdff + .word 0xffffff01 + .word 0xfefefefd + .word 0x00fefcfe + .word 0x00ff0001 + .word 0xfe020001 + .word 0xfdfc01fe + .word 0x0001fcfc + .word 0x01fffcfc + .word 0xfe02fefd + .word 0xfcffff00 + .word 0xfd0202fd .word 0x02fffd02 - .word 0xffffffff - .word 0xfcffff01 - .word 0xff02fdfe - .word 0xffff02fc + .word 0x0200fffc + .word 0xff01ff01 + .word 0xff01fefe + .word 0x00fc02fc + .word 0x00010001 + .word 0xfc00fdfc + .word 0x01fc00fd + .word 0x01fffdfc + .word 0x01fd00fe + .word 0xfcfffdfd + .word 0xfefcfffd + .word 0x00fe01fd + .word 0xff00fcfe + .word 0xfd00fdff + .word 0xfc0201fc + .word 0xfdfdfe01 + .word 0xff00ff00 + .word 0x00fdfdfe + .word 0x010000fc .word 0x0001ff02 - .word 0xff0002fd - .word 0xff0002fc - .word 0x02fdfcff - .word 0x01ff01fe - .word 0x010002fd - .word 0x02fffc00 - .word 0x00020002 - .word 0xfdfefe00 - .word 0xfe0200ff - .word 0x02ff00ff - .word 0xfcfffc01 - .word 0x0000fffc - .word 0xfcfcfd01 - .word 0x0102fcff - .word 0x01fc01fe - .word 0xff0000fd - .word 0xfd01fc02 - .word 0xfffc01fe - .word 0x02fd0102 - .word 0x02fd0201 - .word 0xfefcfc02 + .word 0xff00fffd + .word 0xfdfdfcfd + .word 0xfc01fffc + .word 0xfcfffd02 + .word 0xff00fffc + .word 0x02fe0002 + .word 0xfffeff00 + .word 0xff00fd00 + .word 0x0100fdfd + .word 0x02fefe00 + .word 0x0000ff00 + .word 0xfffefcff + .word 0xfe02fd00 + .word 0xfc0201ff + .word 0xfeff0200 + .word 0x00fe00fe + .word 0x01fdfcff + .word 0xfdfd0102 + .word 0xfc00ffff + .word 0xfc0100fc + .word 0x02000201 + .word 0x0202ffff + .word 0xfcfc02fc + .word 0xfd01fffd + .word 0xfdfd02fd + .word 0xfdfd0201 + .word 0xfc00fffe + .word 0xfefffdfe + .word 0x02fcfeff + .word 0xfefe0101 + .word 0xff01fdff + .word 0x02fc0201 + .word 0x01fe02fe + .word 0xff00fe00 + .word 0xfe010201 + .word 0x00fc0000 + .word 0xfe01fdff + .word 0xfe00fcfd + .word 0x00fe0100 + .word 0xfd02fd01 + .word 0xfffffdfd + .word 0x0202fefd + .word 0xfefcfefc + .word 0x02fefefc + .word 0x0102fd02 + .word 0xfefd0201 + .word 0xfefeff02 + .word 0xfcfdfefe + .word 0xff01fefd + .word 0xfffefd00 + .word 0x01fcfffe + .word 0x000100fd + .word 0xfefe00fd + .word 0xffff0201 + .word 0xfefffd02 + .word 0x00ff01fc + .word 0xfc00fd01 + .word 0x02fc0102 + .word 0x0001fcfc + .word 0x010000fd + .word 0x0200fffc + .word 0x02fd02fd + .word 0x0202fffc + .word 0xfd0201ff + .word 0x00fd0100 + .word 0x0101fd00 + .word 0xfefffffe + .word 0xfefd0102 + .word 0xff02fe02 + .word 0x00fcfeff + .word 0xfefc00fe + .word 0x020001fe + .word 0xfdfefefd + .word 0xfdfdfefe + .word 0x00fdfdff + .word 0x01010100 + .word 0x00010002 + .word 0xfffc0000 + .word 0x02fffc02 + .word 0x01020102 + .word 0xfe02fcfc + .word 0x01fcfdfd + .word 0x01fc0100 + .word 0x000001fc + .word 0xfc0201fc + .word 0x020201ff + .word 0xfc0002ff + .word 0xfdfc02fd .word 0x00fc00fe - .word 0xfdfffffc - .word 0xffff0001 - .word 0xfc02fdfd - .word 0x0102fdff - .word 0x02fffd00 - .word 0x01fe0000 - .word 0xfcff02fe - .word 0xfffd00ff - .word 0xfc02fcff - .word 0x01fefffc - .word 0xfc0201fe - .word 0xfd0000fc - .word 0xfc01fcfd - .word 0x00fd0002 - .word 0xff0201fc - .word 0x02ff00ff - .word 0x02fefe02 - .word 0x0100fe00 - .word 0xfffdff00 - .word 0xfffffe02 - .word 0xfd0101fd - .word 0xff000102 - .word 0x01fe00fd - .word 0xfdff0001 - .word 0x00fe0002 - .word 0x02fffeff - .word 0xff0101ff - .word 0x02fe02fc + .word 0xfffcff00 + .word 0x01fcfdfd + .word 0xfcfefefe + .word 0xfffefeff + .word 0xfe02ffff + .word 0x00fcfd01 + .word 0xfffffc02 + .word 0xfd020200 + .word 0xfffefc02 + .word 0xfe010001 + .word 0xfe00fffd + .word 0xfe02ff00 + .word 0xffff01ff + .word 0x01ff00fe + .word 0xfc010201 + .word 0xfc0102ff + .word 0x0100fe02 + .word 0xfc020101 + .word 0x01000000 + .word 0xfc000100 + .word 0xfffcfffd + .word 0xfe0000fd + .word 0xff000002 + .word 0xfefefdfe + .word 0x01020100 + .word 0x02fefd02 + .word 0xfefffefe + .word 0xfd01fefd .global v8b .balign NR_LANES*4 v8b: - .word 0xfc00fffe - .word 0x00fdfe02 - .word 0xfffffcfc - .word 0xfffcfc02 - .word 0xffff00fd - .word 0x0102fefc - .word 0xfe02fc00 - .word 0x02fd02fe - .word 0xffff0001 - .word 0x02ff00ff - .word 0xfdff0100 - .word 0xfe02fffd - .word 0xfcfffdfd - .word 0xfe020001 - .word 0x00020201 - .word 0xff0202fe - .word 0x02020002 - .word 0x00020101 - .word 0xfc00fd01 - .word 0xfffdfe02 - .word 0x00fcfd01 - .word 0x010200fc - .word 0xfffc01fd - .word 0xfc01ff02 + .word 0xfd0002ff + .word 0xfcfe00ff + .word 0xff01fcfc + .word 0x020201fe + .word 0xfe01ff00 + .word 0x00fd0001 + .word 0xfe000200 + .word 0x0201fefe + .word 0x02fffd01 + .word 0xfc020102 + .word 0x01fdfe00 + .word 0xfe0000ff + .word 0x0102ff02 .word 0xfefc0201 - .word 0xfcfe00fe - .word 0xfe02fd00 - .word 0x0202fcfe - .word 0xfcfefffd - .word 0x0102fdfd - .word 0x0002fcff - .word 0x0102fdfe - .word 0x01fd00ff - .word 0xfdfd0200 - .word 0x02000000 - .word 0xfdfefdfc - .word 0xfe00fdfc - .word 0xfdff00fc - .word 0x010201ff - .word 0x02fd00fc - .word 0xfdfffcff - .word 0xfcfffffe .word 0xfdfc0100 - .word 0xfefffe01 - .word 0xfc01fffd - .word 0xfdfdfe01 - .word 0xff00fd01 - .word 0xfdfefdfc - .word 0x01fcfeff - .word 0xfdfeff02 - .word 0x01fcfeff - .word 0x0200fdff + .word 0x01fe01fd + .word 0x02fd0002 + .word 0xfdfc0102 + .word 0xfcfcfffe + .word 0xfefcfe02 + .word 0xff020102 + .word 0xfefc02fc + .word 0x0202fc00 + .word 0x00fffcfd + .word 0x00010101 + .word 0xff02fcfc + .word 0xfe00feff + .word 0xfd0001fc + .word 0x00fc0001 + .word 0xfffe00ff + .word 0xfefd00fc + .word 0xfffefd02 + .word 0x02ff0100 + .word 0xffff0200 + .word 0xfe0100fd + .word 0xfcff0201 + .word 0xfefffe02 + .word 0x00fefffd + .word 0xfe0100ff + .word 0xfd01fd01 + .word 0xff02fffe + .word 0xfe00fc00 + .word 0xfdfffefe + .word 0x02fdfffe + .word 0xfdfdfffc + .word 0xfc01ff00 + .word 0xfd000101 + .word 0x01fe0101 + .word 0xfffffcfd + .word 0xfe02ff01 + .word 0x0100fcfc + .word 0xff02fc00 + .word 0xfffd0002 + .word 0xfefefdff + .word 0xfe0102fd + .word 0x02fe0000 + .word 0x00fcfc02 + .word 0x0002fcfd + .word 0xfcfd0201 + .word 0xfcfdfcfe + .word 0x02fd01ff + .word 0xfffefeff + .word 0xfe0001ff + .word 0x02ff0201 + .word 0xfc02fc00 + .word 0xfefdfd02 + .word 0xff0201fe + .word 0x02fdff01 + .word 0x0100feff + .word 0xfdfe0000 + .word 0x0001fffc + .word 0xfffcff02 + .word 0x0102fc01 + .word 0x0202fdfc + .word 0xfd01fcfe + .word 0x02ff02fd + .word 0xfd000100 + .word 0x0101fdfc .word 0x01ff00ff - .word 0x0001fe01 - .word 0x00fdfefd - .word 0xfdfdfe01 - .word 0x01fffcfc - .word 0xfefcfd01 - .word 0x00fcfd00 - .word 0xfcfc00fd - .word 0xfefd01fd - .word 0xfe00fc02 - .word 0x020202fe - .word 0x01feffff - .word 0xfc0201ff - .word 0xfffffc01 - .word 0x01020100 - .word 0x01fefd02 - .word 0x00fdff02 + .word 0x02fc02fc + .word 0xfffdfc01 + .word 0xfefefcff + .word 0xfd00feff + .word 0x010002ff + .word 0x020100fd + .word 0xfc020101 + .word 0x000202ff + .word 0x01fcfefe + .word 0x02010202 + .word 0x0000fe02 + .word 0xfcfd01fe + .word 0xfffefc02 + .word 0xfeff02ff + .word 0x01010201 + .word 0x01fefc02 + .word 0x01ffff02 + .word 0x0201fc02 + .word 0xfd020000 + .word 0xfcfffd02 + .word 0xfdfd02fe + .word 0xfcfffd01 + .word 0x020000fd + .word 0xfe0202fc + .word 0x00fefc02 + .word 0xfd00fc01 + .word 0xfdfc0000 + .word 0xfffffffc + .word 0xfe00fe02 + .word 0xfc000202 + .word 0xfdfcfffd + .word 0xfefefdfe + .word 0xfd00fd00 + .word 0xff01fefc + .word 0xfcfffd00 + .word 0x01fc0002 + .word 0xfc010202 + .word 0xfffcfe01 + .word 0xfe000100 + .word 0xfc01fc00 + .word 0xfeff00fe + .word 0xfefdfe01 + .word 0x01fcfffc + .word 0x02fd0101 + .word 0x0200fc01 + .word 0x00fffc02 + .word 0x00000101 + .word 0x01fefdfd + .word 0xfffc0102 + .word 0x000100fe + .word 0x01fc02fd + .word 0xfcfeff02 + .word 0x0002fdfe + .word 0x00fdfcfd + .word 0x02fdfe00 + .word 0xfe00feff + .word 0xfcfd01fc + .word 0x0100fefc + .word 0x02fffdff + .word 0xfffc01ff + .word 0x00fefdff + .word 0xff000200 + .word 0xfcfefe00 + .word 0xfefd00fe + .word 0xff0201fd + .word 0x020001fd + .word 0xfcfdfcfd + .word 0x02fd0001 .word 0xfcfc0002 - .word 0x00fdfdfc - .word 0x00fffc01 - .word 0xffff00fd - .word 0xfefe02fd + .word 0xfdfcfdfe + .word 0x00ff02fc + .word 0xfeff02ff + .word 0x01ff0002 + .word 0xfffd0201 + .word 0x00fcffff + .word 0xff020001 + .word 0x01fc02ff + .word 0xfeff00fd + .word 0xfc02fefd + .word 0x01ff02ff + .word 0x01020001 + .word 0x01fcfdff + .word 0xfc00fffe + .word 0x02fd0200 + .word 0x0102fffc + .word 0x01feff00 + .word 0xfc02feff + .word 0xfdfdff01 + .word 0xfefe00fc + .word 0xfdfd02fc + .word 0x02fc00fd + .word 0xfefcfefd + .word 0x0202fc01 + .word 0x01ff01fe + .word 0xfdfefc02 + .word 0x01fffcfd + .word 0xfdfdfffd + .word 0xff020002 + .word 0xfe02fcfe + .word 0x0102fe00 + .word 0x01fc0001 + .word 0xfcfffefe + .word 0x000000fd + .word 0xfcfcfc01 + .word 0xfd01fc00 + .word 0xfd0101fd + .word 0xfc00fcff + .word 0xfcfd02fd + .word 0xfd02fefd + .word 0xfefd0002 + .word 0xfdfefdfe + .word 0xfefdff00 + .word 0x02fcfefd + .word 0x0201fefc + .word 0xfcfcfefc + .word 0xfc02fdfe + .word 0xfffffd02 + .word 0xfefc0000 + .word 0xfffc00fe + .word 0x00ff00ff + .word 0x0001fdfe + .word 0x0100fefe + .word 0xfeff00fc + .word 0xfffefdfd + .word 0xff02fcff + .word 0xfcfe0001 + .word 0x01fc02fe + .word 0xfdfffdff + .word 0xfd0000ff + .word 0x02fffc02 + .word 0xfc01ff01 + .word 0xfffdfc01 + .word 0x01fcfdfd + .word 0xfdfdfd01 + .word 0xff00fcfd + .word 0xfd00fcfd + .word 0x01ff0202 + .word 0xfd0201ff + .word 0x0102fffc + .word 0x00fdfefd + .word 0x000102fd + .word 0xfdff00fd + .word 0xfd02ff00 + .word 0xfffefcfd + .word 0xfd00fe02 + .word 0x00fcfd02 + .word 0xfffcfe00 + .word 0x000201fd + .word 0x02ff0102 + .word 0x01000100 + .word 0xfcff0000 + .word 0xfcfcfefd + .word 0xfe000001 + .word 0xfc020101 + .word 0xfc000001 + .word 0xff02ffff + .word 0xff020102 + .word 0x00ffff00 + .word 0xffff0002 + .word 0xfcff01fc + .word 0xff00fefd + .word 0xfe010201 + .word 0x0101fdfc + .word 0xfcfdff01 + .word 0xfefdffff + .word 0xfd020202 + .word 0xfefdfffe + .word 0xff020100 + .word 0xff02fd00 + .word 0x0001fdfe + .word 0x01fc01fd + .word 0x01fffc01 + .word 0xff000000 + .word 0xfe0200fd + .word 0x0001feff + .word 0x01fc0100 + .word 0xfd00fe01 + .word 0xfd020001 + .word 0x0201fdfd + .word 0x02fc02fd .word 0x00000202 - .word 0xfd000100 - .word 0x01020002 - .word 0xfcfe0100 - .word 0x0002ff01 - .word 0x010002fd - .word 0x01fcfcfd - .word 0xfffd0202 + .word 0x01fe01fe + .word 0xfcfc00fc + .word 0xfcff0101 + .word 0xfffc00ff + .word 0x0202fdfd + .word 0xfe0101fd + .word 0xff00fc00 + .word 0x0200fc02 + .word 0x01fc0200 + .word 0xfefd00fe + .word 0xfefdfe02 + .word 0xfdfefdfc + .word 0xfc0000fe + .word 0x0101fe02 + .word 0x0001ffff + .word 0xfdfc00fd + .word 0xfe01fefc + .word 0xfc010200 + .word 0x02fe02fe + .word 0xfefd02ff + .word 0xfcfc0102 + .word 0xfe000100 + .word 0x01fffffe + .word 0xfd00fe00 + .word 0x010101fe .word 0xfe00fcfd + .word 0x0202fdfc + .word 0x01010100 + .word 0x010200fd + .word 0xfdfc0002 + .word 0xfffffd00 + .word 0xfffffe01 + .word 0xfefffdfd + .word 0x020200ff + .word 0xfffdfd01 + .word 0x000101fd + .word 0xffff00fe + .word 0x01fdfe02 + .word 0xfcfcfefe + .word 0xfc0002ff + .word 0xfffe01ff + .word 0xfc0202fd + .word 0x01fdfefd + .word 0x00fdfefc + .word 0xfe010200 + .word 0xfdfefc01 + .word 0x02fc0202 + .word 0x01010102 + .word 0x01020200 + .word 0xfe010201 + .word 0x01fcfd00 + .word 0xfc00fefc + .word 0x02fd00fe + .word 0xfefcfeff + .word 0xfc0001fc + .word 0xfd02ff01 + .word 0x0001fdfc .word 0xfe020100 - .word 0xfc02fd01 - .word 0xfdfe02ff - .word 0x00000000 - .word 0x02fd0201 - .word 0x0200ff00 - .word 0xfffd00fd - .word 0x0101fcff - .word 0xfe00fcfc + .word 0x00fe00fc + .word 0x0101ff01 + .word 0xfdff02fd + .word 0xff01fdfc + .word 0xfd010202 + .word 0x00fe0002 + .word 0x0002ff01 + .word 0x01ff00ff + .word 0xfc000002 + .word 0xfdfc0200 + .word 0xfcfdfefe + .word 0x02fefd00 + .word 0xfcfffeff + .word 0xfffc02ff + .word 0x02fefe00 + .word 0x02ff01fd + .word 0x01fdfe02 + .word 0xfcfffe01 + .word 0xfffefcff + .word 0x02fc01fd + .word 0xfefc0200 + .word 0xfefffffd + .word 0x00fcfc00 + .word 0xff01fe02 + .word 0x0001fd02 + .word 0x01fefd02 + .word 0xfefefcfd + .word 0x02fc0100 + .word 0x010001fe + .word 0x01ff0000 + .word 0x02fefcfc + .word 0x02ff0200 + .word 0x0202ff02 + .word 0xfffe0001 + .word 0xfffdfefe + .word 0x00feffff + .word 0xfcfd01fd + .word 0xfefdfdff + .word 0x01ff0102 + .word 0xfffd02fd + .word 0xff01ff00 + .word 0x01fefdfd + .word 0x010202ff + .word 0xfffe0100 + .word 0xfe01fe02 + .word 0xfdfffdfd + .word 0x0101ff02 + .word 0x00fffefd + .word 0x020002fd + .word 0xfc00fefd + .word 0xfcff01fe + .word 0x00fdfffe + .word 0xfffffdfd + .word 0x01fd0102 + .word 0x0000fcff + .word 0x020000fc + .word 0x02fcfd02 + .word 0xfefdfe02 + .word 0xffff0201 + .word 0x01000002 + .word 0xfffcfcff + .word 0x0000fdfc + .word 0xfffcfd02 + .word 0xfffeff02 + .word 0x0002fcfd + .word 0x02ff01fe + .word 0x02fc02fc + .word 0xfffefeff + .word 0xff0200fc + .word 0xfffefd00 + .word 0x0101ff00 + .word 0xfeff0201 + .word 0x00feff00 + .word 0x00fe0100 + .word 0x0202fdfe + .word 0x02fefdfe + .word 0xfe01fdff + .word 0xfefe02fc + .word 0xfefd02fc + .word 0x01000200 + .word 0xfd01fefc + .word 0x00fe0102 + .word 0x010100fc + .word 0xfefefd01 + .word 0xfd0201fe + .word 0xfcff0001 + .word 0x0201fdfd + .word 0xfc00fd00 + .word 0xff0200fd + .word 0x01fe0100 + .word 0xfcfcfd02 + .word 0xfefdfefc + .word 0x000100fe + .word 0x00fd0200 + .word 0xfdff0000 + .word 0xfefffc00 + .word 0xfefc02fe + .word 0xfd00fc02 + .word 0x0100fefe + .word 0xfcfffcfc + .word 0xfdfe00ff + .word 0x02fe02fc + .word 0xff02fdfd + .word 0xfe0102ff + .word 0xfefcfdfe + .word 0xff00fd00 + .word 0xfe0202ff + .word 0xfc000200 + .word 0x02fe0101 + .word 0x02fd0100 + .word 0xfd010200 + .word 0xfffffd01 + .word 0x02fcfffe + .word 0xfffdfc00 + .word 0xff0200fc + .word 0x01ffffff + .word 0xfffdfdfd + .word 0xfffdffff + .word 0xfeff00fc + .word 0x02fe00fd + .word 0xfd000000 + .word 0x01fefcfd + .word 0xfc02fe00 + .word 0xfefffd02 + .word 0xfefcfeff + .word 0x0200fdfd + .word 0xfffe0101 + .word 0x00fefdfc + .word 0x010000fd + .word 0xfefd00ff .word 0x00020102 - .word 0x010101ff - .word 0xfc010201 - .word 0xfcfdff02 - .word 0x0102fcfc - .word 0x00ff01fd + .word 0xfcfffcfd + .word 0x02fe01fd + .word 0xfdfcfffd + .word 0x00fcfc00 + .word 0xff00fd00 + .word 0xfcfcff00 + .word 0xfefcfd01 + .word 0xff01fc02 + .word 0xfd02fffe + .word 0xfe020002 + .word 0xfc0101fd + .word 0xfdfcff01 + .word 0x00000201 + .word 0x010001fc + .word 0xfd01fd02 + .word 0xff0001fc + .word 0x00fdfd00 + .word 0xfd00fffd + .word 0xfffdfe00 + .word 0xfc0201fc + .word 0xff02fcfc + .word 0xfd01fd02 + .word 0x02fefdff + .word 0x01fcfcfc + .word 0xfefdfd00 + .word 0xffff02fc + .word 0x01fd01fc + .word 0x02fc00fc + .word 0x00fcfe02 + .word 0xfd02fefd + .word 0x0100fcfd + .word 0x02fd0101 + .word 0x0201fc01 + .word 0x00fcfe00 + .word 0x00fd0100 + .word 0x02fd00ff + .word 0xfd020202 + .word 0x0201fcfd + .word 0x00fefd00 + .word 0x0202fffd + .word 0x0100ffff + .word 0x02fcfffe + .word 0xffff01fc + .word 0x0002fffc + .word 0x0202fc01 + .word 0xfcff0201 + .word 0x00fefe01 + .word 0x02fdfffe + .word 0x02ff0001 + .word 0x00fd02fc + .word 0x01feff00 + .word 0x02fcffff + .word 0xfc0201fe + .word 0xfefefc00 + .word 0xff02fd01 + .word 0xfefffc00 .word 0x00fdfe01 - .word 0x02fdfdfc - .word 0x00fcff01 - .word 0xfdfe0000 - .word 0x01fcffff - .word 0x020201ff - .word 0x00fffffd - .word 0xfefcfdff - .word 0xfc0001fc - .word 0x010200fd - .word 0xfdfcfcfd - .word 0xfe0100fe - .word 0xfd02fc02 - .word 0xfcfffefc - .word 0x00ff00fd + .word 0x0101fc00 + .word 0xfdff0201 + .word 0x01fdfdfc + .word 0x0101fefd + .word 0x01fcfe02 + .word 0x02fdfdfd + .word 0xfc010102 + .word 0x0102fe01 + .word 0xfcfcfc00 + .word 0xfefefdfe + .word 0xff0102fd + .word 0x01fd01fc + .word 0xfd000101 + .word 0x0101fdfd + .word 0x0001fdff + .word 0x01fe01fe + .word 0xfdfcff02 + .word 0x0100fdfc + .word 0xfdfc02ff + .word 0xfe02fefd + .word 0x00fcffff + .word 0xfffefdff + .word 0x01ff01fe + .word 0x01fcfffc + .word 0xff000200 + .word 0x0202fe01 + .word 0x01ff0201 + .word 0xfd02fc01 + .word 0x020002fe + .word 0xfe02fd01 + .word 0xfc020202 + .word 0xfc0102fc + .word 0xfffc0001 + .word 0xfefcfdfd + .word 0xfd02fdfe + .word 0xff0000fc + .word 0x00fcfc02 + .word 0x000002fd + .word 0xfeff0102 + .word 0xfcfc02fd + .word 0xfd00fefd + .word 0xfc0100fd + .word 0x00fe02fe + .word 0xff01fc02 + .word 0xfcfdffff + .word 0x00fe00fd + .word 0xfefefcff + .word 0xfdfdfdff + .word 0x020100ff + .word 0xfefd01fd + .word 0xfefefdfe + .word 0xfdfc00fd + .word 0xff0202fc + .word 0xfefd01ff + .word 0xfefffffd + .word 0x02020201 + .word 0x010200ff + .word 0xfefe02fd + .word 0x00fefcfc + .word 0x02fffc01 + .word 0x0201fe00 + .word 0xfefd01ff + .word 0xfffd00fe + .word 0xfcfc00fc + .word 0x00fe0202 + .word 0x0000fcfd + .word 0xfffd01fc + .word 0xfffefd02 + .word 0xfffcfcff + .word 0x02fefd00 + .word 0x010202fd + .word 0x00fefefd .word 0xfdffffff - .word 0x01ff02ff - .word 0xfffc00ff - .word 0x010102ff - .word 0xfffcfefd - .word 0xfefe0000 - .word 0x0000ff02 - .word 0xfcfdfffe - .word 0x00000100 + .word 0x020202fe + .word 0x01020201 + .word 0xfdfffdff + .word 0xfdfcfffc + .word 0xfdfd01fd + .word 0xfefe00ff + .word 0xff000101 + .word 0xfe02fefc + .word 0xfefefe01 + .word 0xfcfdfefe + .word 0xfc000100 + .word 0x0002fdfd + .word 0x01fc00fe + .word 0xff020001 + .word 0x01fe0101 + .word 0x0102ff01 + .word 0xfd01fd00 + .word 0x01ff00fd + .word 0xfc02fffe + .word 0xff00fd00 + .word 0xfd02fcfe + .word 0xfdfe0100 + .word 0xfd0201ff + .word 0x01fc0002 + .word 0x02fcfe02 + .word 0xfffcfefc + .word 0xfdfc0001 + .word 0xfefe0002 + .word 0x01ff00fe + .word 0x0000fffe + .word 0x02fdfdfd + .word 0xfefe0100 + .word 0x00fefc01 + .word 0x0101fffd + .word 0xfdff0202 + .word 0x020102fd + .word 0xfdfd0102 + .word 0xfe020101 + .word 0x0200fcfe + .word 0xfeff00fc + .word 0x00fc01ff + .word 0x0101fefd + .word 0xfcfffdff + .word 0x02ff00ff + .word 0xfdfffd02 + .word 0xfefefcfc + .word 0x01fffefe + .word 0xfcfefffe + .word 0xfd010002 + .word 0xff0201fc + .word 0xfdfc02fc + .word 0x0001fefc + .word 0xfefffe00 + .word 0x00fffefd + .word 0xfffe00ff + .word 0xfdfffc02 + .word 0x01fe01ff + .word 0x02fe0002 + .word 0xfffffffd + .word 0xfdff01ff + .word 0xfefc00fe + .word 0x00fffd02 + .word 0xfd000100 + .word 0xfdfcfdfc + .word 0x00ffff00 + .word 0xfcfefcfc + .word 0xfe01fdfe + .word 0x02fefcff + .word 0x00fc02fd + .word 0xfffd00fc + .word 0x010101fd + .word 0x000001ff + .word 0x000201fc + .word 0xfe00fc01 + .word 0x0201fffc + .word 0x02fcfdff + .word 0xff0101fe + .word 0xfdfe01fe + .word 0x01fffd01 + .word 0x02ff0201 + .word 0xfdfffdfe + .word 0xfc01fefd + .word 0xfe00fcfc + .word 0x00fe0000 + .word 0x02fd01fd + .word 0xfdfdfdfd + .word 0xfcfdfeff + .word 0x02fefe02 + .word 0x0102fc02 + .word 0xfd0100fc + .word 0xfc0100ff + .word 0xfe0000fc + .word 0xfdfcff02 + .word 0xfc0201ff + .word 0x02fc0100 + .word 0xfdffff01 + .word 0xfdfe0002 + .word 0x00000201 + .word 0xfefe02fe + .word 0xfdfd01ff + .word 0xff00fcfe + .word 0x02fdfcfe + .word 0xfefc00fe + .word 0xfd0001fc + .word 0x01fe0100 + .word 0x02fffc01 + .word 0xfe02fefd + .word 0xfdfcff01 + .word 0xff01fe02 + .word 0xfcfc01fe + .word 0x01fdfffe + .word 0xfd00fe01 + .word 0x02ff0200 + .word 0xfd010001 + .word 0xfffffcfc + .word 0xfdfffcfd + .word 0x0200fefd + .word 0x0002fdfe + .word 0x02fc0201 + .word 0x01ff0101 + .word 0x010101fe + .word 0xfc000001 + .word 0xff010002 + .word 0xfffefcfc + .word 0xfcfcfe00 + .word 0xfc01ff00 + .word 0x00fefeff + .word 0xfe00fe00 + .word 0x00fdfc02 + .word 0xfc00ff00 + .word 0xff0000fd + .word 0xfefefffd + .word 0x02fefcfd + .word 0xfdfcfd01 + .word 0xfc02fc01 + .word 0x0200fe01 + .word 0x00fc00ff + .word 0xfdfe00fc + .word 0xfffdfffc + .word 0x0102fe02 + .word 0x00010202 + .word 0xfc02fffe + .word 0x010100fc + .word 0x010002ff + .word 0xfc0000ff + .word 0xfdff01fd + .word 0xfe00fcff + .word 0xff01fd02 + .word 0x0102fdfd + .word 0xfc000101 + .word 0xff02fdfd + .word 0xfcfdfffd + .word 0xfe000200 + .word 0xfe0102fc + .word 0x02000100 + .word 0xfe01feff + .word 0xfc0202fc + .word 0xfdff00fd + .word 0xfdfe0102 + .word 0x01fffcff + .word 0x0000fd01 + .word 0xfffe0000 + .word 0x01fc0201 + .word 0xfefffeff + .word 0xfd000101 + .word 0xfd020200 + .word 0xfe0200fe + .word 0x00fdfdff + .word 0xfefc0201 + .word 0xfdfdfc01 + .word 0x0002fdff + .word 0x01fc01fd + .word 0xfefc02fc + .word 0x00fdfefe + .word 0xfc01fdff + .word 0x01fffc02 + .word 0xfd01fe01 + .word 0x010002ff + .word 0xff00fdfd + .word 0x00fefe00 + .word 0x0202fe00 + .word 0x02ff0000 + .word 0x0100fd02 + .word 0xfc02fefd + .word 0x020101fc + .word 0xfffefefd + .word 0xfd020001 + .word 0xfe02fefc + .word 0x0101fdfc + .word 0x0102fe02 + .word 0x01fdfe01 + .word 0xfc00fd00 + .word 0x020000fe + .word 0xfcfcfd00 + .word 0xfcfefefc + .word 0xffffffff + .word 0xfdfefc00 + .word 0xfe02fd02 + .word 0xfcfeff02 + .word 0xfdfe01ff + .word 0xffff0202 + .word 0xfffffcfe + .word 0xfc000001 + .word 0xfcff00fd + .word 0x0000ff01 + .word 0x0101fc01 + .word 0xfdfd0100 + .word 0xfcfdfe00 + .word 0x0101fcff + .word 0x02fd0201 + .word 0xfd02fe01 + .word 0x0201ff00 + .word 0xfc02fdfc + .word 0xfcfffefc + .word 0xfcfffe00 + .word 0x01fcfefc + .word 0xfffd02fc + .word 0x0200fffc + .word 0xfcfe0102 + .word 0xfd020202 + .word 0xfd02ff02 + .word 0xfffcfe00 + .word 0x02fefffc + .word 0x0100fdfe + .word 0xfcfe0002 + .word 0x0100fcff + .word 0x00fdff01 + .word 0xff020201 + .word 0xff0201fe + .word 0xffff02ff + .word 0x0101fcfd + .word 0xfdfffe02 + .word 0x0000fffe + .word 0xfc01fe02 + .word 0xfefe02fc + .word 0xfcfffefd + .word 0x01fc0102 + .word 0x0202fd02 + .word 0xfcfc02ff + .word 0x020002ff + .word 0x0202fffc + .word 0x00fffc02 + .word 0x01fdfefe + .word 0x01fcfcfc + .word 0xfcfdff00 + .word 0xfd02fc02 + .word 0xfffdfeff + .word 0x0200fd00 + .word 0x02fe01ff + .word 0x01fc0000 + .word 0xfe02fd00 + .word 0x01fefffd + .word 0xfe0201fc + .word 0x0000ff00 + .word 0xfcfeff00 + .word 0xfd01feff + .word 0x01000002 + .word 0xfc01fd00 + .word 0xfcfd0002 + .word 0xff000202 + .word 0x0102fc00 + .word 0xfcfefffd + .word 0x02010002 + .word 0x01fe01fe + .word 0x00000001 + .word 0x01fdfe00 + .word 0xfd0102fe + .word 0xfcfd00fe + .word 0xfc01ffff + .word 0x02fdffff + .word 0xfdff00fc + .word 0x0200fe02 + .word 0xfcfe00fe + .word 0xfcfcff02 + .word 0xff00fc02 + .word 0xfdfd02ff + .word 0xfe00fe02 + .word 0x0000ffff + .word 0xfe01feff + .word 0xfe0202fe + .word 0x02fd01fd + .word 0xff020101 + .word 0xfdfdfd01 + .word 0x0002fe00 + .word 0xfd00fcfe + .word 0x01fd0201 + .word 0x01020002 + .word 0xfffffcfe + .word 0xfcfd0200 + .word 0xfffefcfe + .word 0xfd02fcfc + .word 0x01010200 + .word 0x02fd0101 + .word 0x00fffe00 + .word 0x01fd0000 + .word 0xfdff01fe + .word 0x02fffcfe + .word 0xfffe00fe + .word 0x02fc01fe + .word 0x0100ff01 + .word 0x000001fc + .word 0xfcfe00fd + .word 0xfc02ffff + .word 0x02fefe01 + .word 0xfdfe0202 + .word 0x00fc01fd + .word 0xff02fc00 + .word 0xfe01ffff + .word 0xfefefd00 + .word 0x0100ff02 + .word 0xfc02fe02 + .word 0xfdfffcfe + .word 0x01fffe02 + .word 0xfc00fd00 + .word 0xfffdffff + .word 0xffff0200 + .word 0x02000200 + .word 0x01010100 + .word 0x00fdfcff + .word 0xfc02fe02 + .word 0xfcfcfe01 + .word 0xfdfd02ff + .word 0x00fc0000 + .word 0xfdfefe00 + .word 0x01fe01ff + .word 0x01fdfcfc + .word 0x02fd0000 + .word 0xfefffc01 + .word 0x00fc0202 + .word 0xfc01fe00 + .word 0x00020101 + .word 0xfdfffe01 + .word 0xfffefd02 + .word 0x02fcfeff + .word 0xfdfc00fc + .word 0xfcfc0101 + .word 0x0002fc00 + .word 0xfc000000 + .word 0xfd0200ff + .word 0x0002fc01 + .word 0xfe0201fe + .word 0x00fd0202 + .word 0xfffdff01 + .word 0x00fe00fe + .word 0xfcfdfe02 + .word 0xfffc0202 + .word 0x02fefefd + .word 0x02fdfd00 + .word 0xfdfcfe00 + .word 0x00fe0101 + .word 0x0000fcfe + .word 0x01ff02fc + .word 0xfeff00fd + .word 0x02fdffff + .word 0x01fc0102 + .word 0x0202fd02 + .word 0x00fcfc01 + .word 0x00fefc02 + .word 0xfefdff02 + .word 0xfcfcfdfc + .word 0x0002fdfd + .word 0x02ff01fc + .word 0x020002fc + .word 0x01fc02fc + .word 0x020002fc + .word 0xfc0000ff + .word 0x0102fc02 + .word 0x010001fe + .word 0x02fdfffe + .word 0x02fcfe01 + .word 0x00fffcff + .word 0x00fdfd00 + .word 0xfd02fd02 + .word 0xfdfcfdfe + .word 0x00020002 .word 0x00ff00ff - .word 0x02fd00fc - .word 0xfc02ff01 - .word 0x02fdfeff - .word 0x01fd01fe - .word 0x02fd0002 + .word 0x02fcfcfc + .word 0xfcfffdfd + .word 0x02fdfffd + .word 0xfcfdfd00 + .word 0x01fcff00 + .word 0xfcfd00fe + .word 0x0201fc02 + .word 0xff00fcfc + .word 0xfd00fefc + .word 0xff00fefc + .word 0xfffefefc + .word 0xfc01fe01 + .word 0x02010002 + .word 0xfcfc02fc + .word 0x0001ff01 + .word 0xfffd02ff + .word 0x00fdfffe + .word 0xfefffefc + .word 0xfefffc01 + .word 0x0202fefc + .word 0x01fc00fe + .word 0xfc00fdfd + .word 0x0102fc02 + .word 0xff02fc02 + .word 0xfd0201fe + .word 0xfdfd00ff + .word 0xfefffcff + .word 0xfcfeffff + .word 0x01fffefe + .word 0x00fcfffc + .word 0x02fdff02 + .word 0x00fdfe01 + .word 0xfe01fcfc + .word 0x01fd0002 + .word 0xfdfe02fe + .word 0x020002fc + .word 0xfdfffefe + .word 0x02fefc02 + .word 0xfcff02fe + .word 0x00fc0202 + .word 0xfdfd0002 + .word 0xfc00fdff + .word 0xfffe0002 + .word 0xfdfd0202 + .word 0x01fdfd02 + .word 0x0102fc01 + .word 0x02fefc02 + .word 0x020102ff + .word 0x0100fffd + .word 0xfefefcfc + .word 0x01ff0001 + .word 0x0101fffe + .word 0xfefdfdfc + .word 0xfe0202ff + .word 0x0102fcfd + .word 0x010100fd + .word 0x0002fdfc + .word 0xfcff02fd + .word 0xfefc0200 + .word 0xfefffc00 + .word 0x0100fd01 + .word 0x0202fdfe + .word 0x00fcfc00 + .word 0x00fcff00 + .word 0xfcfc00ff + .word 0xfcfe00fe + .word 0xfeff0202 + .word 0xfefdfdfc + .word 0x02fefcfd .global res64_v .balign 8 res64_v: diff --git a/apps/dotproduct/main.c b/apps/dotproduct/main.c index f864e00..d6a5965 100644 --- a/apps/dotproduct/main.c +++ b/apps/dotproduct/main.c @@ -62,7 +62,9 @@ int main() { int64_t runtime_s, runtime_v; - for (uint64_t avl = 8; avl <= (vsize >> 3); avl *= 8) { + // for (uint64_t avl = 32; avl <= (vsize >> 3); avl *= 2) { + for (uint64_t avl = (vsize >> 3); avl >=8; avl /= 2) { + // uint64_t avl = 4; // Dotp printf("Calulating 64b dotp with vectors with length = %lu\n", avl); start_timer(); @@ -87,80 +89,81 @@ int main() { } } - for (uint64_t avl = 8; avl <= (vsize >> 2); avl *= 8) { - // Dotp - printf("Calulating 32b dotp with vectors with length = %lu\n", avl); - start_timer(); - res32_v = dotp_v32b(v32a, v32b, avl); - stop_timer(); - runtime_v = get_timer(); - printf("Vector runtime: %ld\n", runtime_v); - - if (SCALAR) { - start_timer(); - res32_s = dotp_s32b(v32a, v32b, avl); - stop_timer(); - runtime_s = get_timer(); - printf("Scalar runtime: %ld\n", runtime_s); - - if (CHECK) { - if (res32_v != res32_s) { - printf("Error: v = %ld, g = %ld\n", res32_v, res32_s); - return -1; - } - } - } - } - - for (uint64_t avl = 8; avl <= (vsize >> 1); avl *= 8) { - // Dotp - printf("Calulating 16b dotp with vectors with length = %lu\n", avl); - start_timer(); - res16_v = dotp_v16b(v16a, v16b, avl); - stop_timer(); - runtime_v = get_timer(); - printf("Vector runtime: %ld\n", runtime_v); - - if (SCALAR) { - start_timer(); - res16_s = dotp_s16b(v16a, v16b, avl); - stop_timer(); - runtime_s = get_timer(); - printf("Scalar runtime: %ld\n", runtime_s); - - if (CHECK) { - if (res16_v != res16_s) { - printf("Error: v = %ld, g = %ld\n", res16_v, res16_s); - return -1; - } - } - } - } - - for (uint64_t avl = 8; avl <= (vsize >> 0); avl *= 8) { - // Dotp - printf("Calulating 8b dotp with vectors with length = %lu\n", avl); - start_timer(); - res8_v = dotp_v8b(v8a, v8b, avl); - stop_timer(); - runtime_v = get_timer(); - printf("Vector runtime: %ld\n", runtime_v); - - if (SCALAR) { - start_timer(); - res8_s = dotp_s8b(v8a, v8b, avl); - stop_timer(); - runtime_s = get_timer(); - printf("Scalar runtime: %ld\n", runtime_s); - - if (CHECK) { - if (res8_v != res8_s) { - printf("Error: v = %ld, g = %ld\n", res8_v, res8_s); - return -1; - } - } - } - } + // for (uint64_t avl = 8; avl <= (vsize >> 2); avl *= 8) { + // // Dotp + // // uint64_t avl = 4; + // printf("Calulating 32b dotp with vectors with length = %lu\n", avl); + // start_timer(); + // res32_v = dotp_v32b(v32a, v32b, avl); + // stop_timer(); + // runtime_v = get_timer(); + // printf("Vector runtime: %ld\n", runtime_v); + + // if (SCALAR) { + // start_timer(); + // res32_s = dotp_s32b(v32a, v32b, avl); + // stop_timer(); + // runtime_s = get_timer(); + // printf("Scalar runtime: %ld\n", runtime_s); + + // if (CHECK) { + // if (res32_v != res32_s) { + // printf("Error: v = %ld, g = %ld\n", res32_v, res32_s); + // return -1; + // } + // } + // } + // } + + // for (uint64_t avl = 8; avl <= (vsize >> 1); avl *= 8) { + // // Dotp + // printf("Calulating 16b dotp with vectors with length = %lu\n", avl); + // start_timer(); + // res16_v = dotp_v16b(v16a, v16b, avl); + // stop_timer(); + // runtime_v = get_timer(); + // printf("Vector runtime: %ld\n", runtime_v); + + // if (SCALAR) { + // start_timer(); + // res16_s = dotp_s16b(v16a, v16b, avl); + // stop_timer(); + // runtime_s = get_timer(); + // printf("Scalar runtime: %ld\n", runtime_s); + + // if (CHECK) { + // if (res16_v != res16_s) { + // printf("Error: v = %ld, g = %ld\n", res16_v, res16_s); + // return -1; + // } + // } + // } + // } + + // for (uint64_t avl = 8; avl <= (vsize >> 0); avl *= 8) { + // // Dotp + // printf("Calulating 8b dotp with vectors with length = %lu\n", avl); + // start_timer(); + // res8_v = dotp_v8b(v8a, v8b, avl); + // stop_timer(); + // runtime_v = get_timer(); + // printf("Vector runtime: %ld\n", runtime_v); + + // if (SCALAR) { + // start_timer(); + // res8_s = dotp_s8b(v8a, v8b, avl); + // stop_timer(); + // runtime_s = get_timer(); + // printf("Scalar runtime: %ld\n", runtime_s); + + // if (CHECK) { + // if (res8_v != res8_s) { + // printf("Error: v = %ld, g = %ld\n", res8_v, res8_s); + // return -1; + // } + // } + // } + // } printf("SUCCESS.\n"); diff --git a/apps/dotproduct/script/gen_data.py b/apps/dotproduct/script/gen_data.py index 371c906..c6eb863 100755 --- a/apps/dotproduct/script/gen_data.py +++ b/apps/dotproduct/script/gen_data.py @@ -48,6 +48,8 @@ def emit(name, array, alignment='8'): # Create the vectors v64a = np.random.randint(-2**(50), high=2**(50)-1, size=avl64, dtype=np.int64) v64b = np.random.randint(-2**(50), high=2**(50)-1, size=avl64, dtype=np.int64) +# v64a = np.random.randint(1, 2, size=avl64, dtype=np.int64) +# v64b = np.random.randint(1, 2, size=avl64, dtype=np.int64) v32a = np.random.randint(-2**(20), high=2**(20)-1, size=avl32, dtype=np.int32) v32b = np.random.randint(-2**(20), high=2**(20)-1, size=avl32, dtype=np.int32) v16a = np.random.randint(-2**(10), high=2**(10)-1, size=avl16, dtype=np.int16) diff --git a/apps/fdotproduct/main.c b/apps/fdotproduct/main.c index 028d799..55bf647 100644 --- a/apps/fdotproduct/main.c +++ b/apps/fdotproduct/main.c @@ -72,8 +72,10 @@ int main() { uint64_t runtime_s, runtime_v; - //for (uint64_t avl = 8; avl <= (vsize >> 3); avl *= 8) { - uint64_t avl = vsize; + // for (uint64_t avl = 32; avl <= (vsize >> 3); avl *= 2) { + for (uint64_t avl = (vsize >> 3); avl >= 8; avl /= 2) { + // uint64_t avl = vsize >> 3; + // uint64_t avl = 4; printf("Calulating 64b dotp with vectors with length = %lu\n", avl); start_timer(); res64_v = fdotp_v64b(v64a, v64b, avl); @@ -98,49 +100,49 @@ int main() { } } } - // } + } - /* - // for (uint64_t avl = 16; avl <= (vsize); avl *= 2) { - uint64_t avl=vsize; - printf("Calulating 32b dotp with vectors with length = %lu\n", avl); - start_timer(); - res32_v = fdotp_v32b(v32a, v32b, avl); - stop_timer(); - runtime_v = get_timer(); - printf("Vector runtime: %ld\n", runtime_v); - if (SCALAR) { - start_timer(); - res32_s = fdotp_s32b(v32a, v32b, avl); - stop_timer(); - runtime_s = get_timer(); - printf("Scalar runtime: %ld\n", runtime_s); - } - - if (CHECK) { - if (SCALAR) { - printf("Checking results: v = %f, s = %f\n", res32_v, res32_s); - if (!similarity_check_32b(res32_v, res32_s, THRESHOLD_32b)) { - printf("Error: v = %f, s = %f\n", res32_v, res32_s); - return -1; - } - } - } - - // Dotproduct Arithmetic intensity calculation - // Ops = 2N FP32 ops - // Bytes = 2N * 4B = 8N Bytes , AI = 1/4 FP32 Op/B - // BW = 32N bits/ cycle = 4N Bytes - // Max Perf = N * 2 * 2 FP32op/cycle = 4N FP32 op/cycle - // From roofline max perf at the arithmetic intensity = N FP32 op/cycle - float performance = avl * 1.0 / runtime_v; - float utilization = 100.0 * performance / (NR_LANES * NR_CLUSTERS); - printf("The execution took %d cycles.\n", runtime_v); - printf("The performance is %f FLOP/cycle (%f%% utilization).\n", - performance, utilization); - - // }*/ + // for (uint64_t avl = 16; avl <= (vsize); avl *= 2) { + // for (uint64_t avl = 32; avl <= 32; avl *= 2) { + // uint64_t avl=4; + // printf("Calulating 32b dotp with vectors with length = %lu\n", avl); + // start_timer(); + // res32_v = fdotp_v32b(v32a, v32b, avl); + // stop_timer(); + // runtime_v = get_timer(); + // printf("Vector runtime: %ld\n", runtime_v); + + // if (SCALAR) { + // start_timer(); + // res32_s = fdotp_s32b(v32a, v32b, avl); + // stop_timer(); + // runtime_s = get_timer(); + // printf("Scalar runtime: %ld\n", runtime_s); + // } + + // if (CHECK) { + // if (SCALAR) { + // printf("Checking results: v = %f, s = %f\n", res32_v, res32_s); + // if (!similarity_check_32b(res32_v, res32_s, THRESHOLD_32b)) { + // printf("Error: v = %f, s = %f\n", res32_v, res32_s); + // return -1; + // } + // } + // } + + // // Dotproduct Arithmetic intensity calculation + // // Ops = 2N FP32 ops + // // Bytes = 2N * 4B = 8N Bytes , AI = 1/4 FP32 Op/B + // // BW = 32N bits/ cycle = 4N Bytes + // // Max Perf = N * 2 * 2 FP32op/cycle = 4N FP32 op/cycle + // // From roofline max perf at the arithmetic intensity = N FP32 op/cycle + // float performance = avl * 1.0 / runtime_v; + // float utilization = 100.0 * performance / (NR_LANES * NR_CLUSTERS); + // printf("The execution took %d cycles.\n", runtime_v); + // printf("The performance is %f FLOP/cycle (%f%% utilization).\n", + // performance, utilization); + // } /* for (uint64_t avl = 8; avl <= (vsize >> 2); avl *= 8) { diff --git a/apps/fdotproduct/script/gen_data.py b/apps/fdotproduct/script/gen_data.py index 15c06ed..f91155e 100755 --- a/apps/fdotproduct/script/gen_data.py +++ b/apps/fdotproduct/script/gen_data.py @@ -47,6 +47,8 @@ def emit(name, array, alignment='8'): # Create the vectors v64a = np.random.rand(avl64).astype(np.float64) v64b = np.random.rand(avl64).astype(np.float64) +# v64a = np.ones(avl64, dtype=np.float64) +# v64b = np.ones(avl64, dtype=np.float64) v32a = np.random.rand(avl32).astype(np.float32) v32b = np.random.rand(avl32).astype(np.float32) v16a = np.random.rand(avl16).astype(np.float16) diff --git a/apps/fmatmul/main.c b/apps/fmatmul/main.c index b8977b8..91b46e3 100644 --- a/apps/fmatmul/main.c +++ b/apps/fmatmul/main.c @@ -52,6 +52,7 @@ int verify_matrix(double *result, double *gold, size_t R, size_t C, for (uint64_t j = 0; j < C; ++j) { uint64_t idx = i * C + j; if (!similarity_check(result[idx], gold[idx], threshold)) { + // if (!similarity_check(result[idx+1], gold[idx], threshold)) { return (i + j) == 0 ? -1 : idx; } } @@ -119,6 +120,7 @@ int main() { printf("Calculating fmatmul 64-bit...\n"); start_timer(); fmatmul(c, a, b, s, N, P); + // fmatmul(c+1, a, b, s, N, P); stop_timer(); #endif diff --git a/apps/fmatmul/script/gen_data.py b/apps/fmatmul/script/gen_data.py index ec77e8f..76c57bc 100644 --- a/apps/fmatmul/script/gen_data.py +++ b/apps/fmatmul/script/gen_data.py @@ -54,6 +54,7 @@ def emit(name, array, alignment='8'): # Matrices and results A = np.random.rand(M, N).astype(dtype) B = np.random.rand(N, P).astype(dtype) +# C = np.zeros([M+1, P+1], dtype=dtype) C = np.zeros([M, P], dtype=dtype) # Golden result matrix G = np.matmul(A, B).astype(dtype) diff --git a/hardware/include/ara_pkg.sv b/hardware/include/ara_pkg.sv index 55ff403..1bbacfc 100644 --- a/hardware/include/ara_pkg.sv +++ b/hardware/include/ara_pkg.sv @@ -1060,6 +1060,9 @@ package ara_pkg; // Hazards logic [NrVInsn-1:0] hazard; + + // Reduction idle case + logic instr_idle; } operand_request_cmd_t; typedef struct packed { @@ -1069,6 +1072,8 @@ package ara_pkg; logic [1:0] ntr_red; // Neutral type for reductions logic is_reduct; // Is this a reduction? target_fu_e target_fu; // Target FU of the opqueue (if it is not clear) + // Reduction idle case + logic instr_idle; } operand_queue_cmd_t; // This is the interface between the lane's sequencer and the lane's VFUs. @@ -1100,6 +1105,7 @@ package ara_pkg; vlen_t vl; vlen_t vstart; rvv_pkg::vtype_t vtype; + logic instr_idle; } vfu_operation_t; // Due to the shuffled nature of the vector elements inside one lane, the byte enable diff --git a/hardware/src/ara.sv b/hardware/src/ara.sv index 4f51486..d39f5f1 100644 --- a/hardware/src/ara.sv +++ b/hardware/src/ara.sv @@ -9,6 +9,7 @@ module ara import ara_pkg::*; import rvv_pkg::*; #( // RVV Parameters parameter int unsigned NrLanes = 0, // Number of parallel vector lanes. + parameter int unsigned NrClusters = 0, // Number of Ara instances // Support for floating-point data types parameter fpu_support_e FPUSupport = FPUSupportHalfSingleDouble, // External support for vfrec7, vfrsqrt7 @@ -104,12 +105,14 @@ module ara import ara_pkg::*; import rvv_pkg::*; #( vxrm_t [NrLanes-1:0] alu_vxrm; ara_dispatcher #( - .NrLanes (NrLanes ) + .NrLanes (NrLanes ), + .NrClusters (NrClusters ) ) i_dispatcher ( .clk_i (clk_i ), .rst_ni (rst_ni ), // Id .num_clusters_i (num_clusters_i ), + .cluster_id_i (cluster_id_i ), // Interface with Ariane .acc_req_i (acc_req_i ), .acc_resp_o (acc_resp_o ), diff --git a/hardware/src/ara_cluster.sv b/hardware/src/ara_cluster.sv index 901e023..1c1fb3a 100644 --- a/hardware/src/ara_cluster.sv +++ b/hardware/src/ara_cluster.sv @@ -130,6 +130,7 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( for (genvar cluster=0; cluster < NrClusters; cluster++) begin : p_cluster ara_macro #( .NrLanes (NrLanes ), + .NrClusters (NrClusters ), .FPUSupport (FPUSupport ), .FPExtSupport (FPExtSupport ), .FixPtSupport (FixPtSupport ), @@ -331,8 +332,8 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( assign ara_axi_req_cut = ara_axi_req_shuffle_cut[ShuffleCuts]; assign ara_axi_resp_shuffle_cut[ShuffleCuts] = ara_axi_resp_cut; shuffle_stage #( - .NrLanes (NrLanes ), - .NrClusters (NrClusters ), + .NrLanes (NrLanes ), + .NrClusters (NrClusters ), .ClusterAxiDataWidth(ClusterAxiDataWidth ), .AxiAddrWidth (AxiAddrWidth ), .axi_r_t (cluster_axi_r_t ), @@ -421,6 +422,7 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( // Align stage align_stage #( + .NrLanes (NrLanes ), .NrClusters (NrClusters ), .AxiDataWidth (AxiDataWidth ), .AxiAddrWidth (AxiAddrWidth ), diff --git a/hardware/src/ara_dispatcher.sv b/hardware/src/ara_dispatcher.sv index e6f5c90..a10924f 100644 --- a/hardware/src/ara_dispatcher.sv +++ b/hardware/src/ara_dispatcher.sv @@ -10,6 +10,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( parameter int unsigned NrLanes = 0, + parameter int unsigned NrClusters = 0, // Number of Ara instances // Support for floating-point data types parameter fpu_support_e FPUSupport = FPUSupportHalfSingleDouble, // External support for vfrec7, vfrsqrt7 @@ -22,6 +23,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( input logic rst_ni, // Id input num_cluster_t num_clusters_i, + input id_cluster_t cluster_id_i, // Interfaces with Ariane input accelerator_req_t acc_req_i, output accelerator_resp_t acc_resp_o, @@ -224,7 +226,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // Is the stride power of two? popcount #( // .INPUT_WIDTH (idx_width(VLENB << 3)) - .INPUT_WIDTH (2) + // .INPUT_WIDTH (2) + .INPUT_WIDTH ($clog2(NrLanes)) ) i_np2_stride ( //.data_i (ara_req_d.stride[idx_width(VLENB << 3)-1:0]), .data_i (ara_req_d.stride[$clog2(NrLanes)-1:0] ), @@ -240,6 +243,13 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( logic illegal_insn; elen_t vfmvfs_result; + vlen_t total_cluster_pieces; + // assign total_cluster_pieces = vlen_t'(acc_req_i.rs1) >> $clog2(VLENB >> vtype_d.vsew); + assign total_cluster_pieces = vlen_t'(acc_req_i.rs1) >> $clog2(NrLanes); + + vlen_t check_total_cluster_pieces; + assign check_total_cluster_pieces = ((total_cluster_pieces >> $clog2(NrClusters)) + 1) * NrLanes; + always_comb begin: p_decoder // Default values vstart_d = vstart_q; @@ -473,6 +483,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( (signed'($clog2(ELENB)) + signed'(vtype_d.vlmul) < signed'(vtype_d.vsew))) begin vtype_d = '{vill: 1'b1, default: '0}; vl_d = '0; + acc_resp_o.result = vl_d << num_clusters_i; end // Update the vector length @@ -493,24 +504,46 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli vl_d = vlen_t'(insn.vsetivli_type.uimm5) >> num_clusters_i; + acc_resp_o.result = vl_d << num_clusters_i; end else begin // vsetvl || vsetvli if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd == '0) begin // Do not update the vector length vl_d = vl_q; + acc_resp_o.result = vl_d << num_clusters_i; end else if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd != '0) begin // Set the vector length to vlmax vl_d = vlmax; + acc_resp_o.result = vl_d << num_clusters_i; end else begin + // // Normal stripmining + // vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || + // ((vlen_t'(acc_req_i.rs1) >> num_clusters_i) > vlmax)) ? vlmax : (vlen_t'(acc_req_i.rs1) >> num_clusters_i); // Normal stripmining - vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || - ((vlen_t'(acc_req_i.rs1) >> num_clusters_i) > vlmax)) ? vlmax : (vlen_t'(acc_req_i.rs1) >> num_clusters_i); + if ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || + ((vlen_t'(acc_req_i.rs1) >> $clog2(NrClusters)) > vlmax)) begin + vl_d = vlmax; + // Return the new vl + acc_resp_o.result = vl_d << num_clusters_i; + end else begin + if (cluster_id_i < total_cluster_pieces[$clog2(NrClusters) - 1 : 0]) begin + // vl_d = (total_cluster_pieces >> $clog2(NrClusters) + 1) * (VLENB >> vtype_d.vsew); + vl_d = ((total_cluster_pieces >> $clog2(NrClusters)) + 1) * NrLanes; + end else if (cluster_id_i == total_cluster_pieces[$clog2(NrClusters) - 1 : 0]) begin + // vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * (VLENB >> vtype_d.vsew) + + // acc_req_i.rs1 % (VLENB >> vtype_d.vsew); + vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * NrLanes + + acc_req_i.rs1 % NrLanes; + end else begin + // vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * (VLENB >> vtype_d.vsew); + vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * NrLanes; + end + // Return the new vl + acc_resp_o.result = vlen_t'(acc_req_i.rs1); + end end end end - // Return the new vl - acc_resp_o.result = vl_d << num_clusters_i; - // If the vtype has changed, wait for the backend before issuing any new instructions. // This is to avoid hazards on implicit register labels when LMUL_old > LMUL_new // and both the LMULs are greater then LMUL_1 (i.e., lmul[2] == 1'b0) @@ -3210,7 +3243,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // Any valid non-config instruction is a NOP if vl == 0, with some exceptions, // e.g. whole vector memory operations / whole vector register move - if (is_decoding && (vl_q == '0 || null_vslideup) && !is_config && + if (is_decoding && (vl_q == '0 || null_vslideup) && !is_config && + !(ara_req_d.op inside {[VREDSUM:VWREDSUM], [VFREDUSUM:VFWREDOSUM]}) && !ignore_zero_vl_check && !acc_resp_o.error) begin // If we are acknowledging a memory operation, we must tell Ariane that the memory // operation was resolved (to decrement its pending load/store counter) diff --git a/hardware/src/ara_macro.sv b/hardware/src/ara_macro.sv index 4d0afec..4b826f8 100644 --- a/hardware/src/ara_macro.sv +++ b/hardware/src/ara_macro.sv @@ -9,6 +9,7 @@ module ara_macro import ara_pkg::*; import rvv_pkg::*; #( // RVV Parameters parameter int unsigned NrLanes = 0, // Number of parallel vector lanes per Ara instance + parameter int unsigned NrClusters = 0, // Number of Ara instances // Support for floating-point data types parameter fpu_support_e FPUSupport = FPUSupportHalfSingleDouble, @@ -228,6 +229,7 @@ module ara_macro import ara_pkg::*; import rvv_pkg::*; #( ara #( .NrLanes (NrLanes ), + .NrClusters (NrClusters ), .FPUSupport (FPUSupport ), .FPExtSupport(FPExtSupport ), .FixPtSupport(FixPtSupport ), diff --git a/hardware/src/lane/lane_sequencer.sv b/hardware/src/lane/lane_sequencer.sv index 864ce70..e74bd1e 100644 --- a/hardware/src/lane/lane_sequencer.sv +++ b/hardware/src/lane/lane_sequencer.sv @@ -263,7 +263,11 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vfu_operation_valid_d = (vfu_operation_d.vfu != VFU_None) ? 1'b1 : 1'b0; // Vector length calculation + // vfu_operation_d.vl = (!pe_req.vl) ? 1 : pe_req.vl / NrLanes; vfu_operation_d.vl = pe_req.vl / NrLanes; + // For idle reduction case + vfu_operation_d.instr_idle = !pe_req.vl; + // If lane_id_i < vl % NrLanes, this lane has to execute one extra micro-operation. if (lane_id_i < pe_req.vl[idx_width(NrLanes)-1:0]) vfu_operation_d.vl += 1; @@ -307,6 +311,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: hazard : pe_req.hazard_vs1 | pe_req.hazard_vd, is_reduct : pe_req.op inside {[VREDSUM:VWREDSUM]} ? 1'b1 : 0, target_fu : ALU_SLDU, + instr_idle : !pe_req.vl, default : '0 }; operand_request_push[AluA] = pe_req.use_vs1; @@ -328,6 +333,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: hazard : pe_req.hazard_vs2 | pe_req.hazard_vd, is_reduct : pe_req.op inside {[VREDSUM:VWREDSUM]} ? 1'b1 : 0, target_fu : ALU_SLDU, + instr_idle : !pe_req.vl, default : '0 }; operand_request_push[AluB] = pe_req.use_vs2; @@ -343,6 +349,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : (pe_req.vl / NrLanes / 8) >> int'(pe_req.vtype.vsew), vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vm | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default: '0 }; if ((operand_request_i[MaskM].vl << int'(pe_req.vtype.vsew)) * @@ -362,10 +369,12 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: // If reductions and vl == 0, we must replace the operands with neutral // values in the opqueues. So, vl must be 1 at least vl : (pe_req.op inside {[VFREDUSUM:VFWREDOSUM]}) ? 1 : vfu_operation_d.vl, + // vl : (pe_req.op inside {[VFREDUSUM:VFWREDOSUM]}) ? (|pe_req.vl ? 1 : 0) : vfu_operation_d.vl, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs1 | pe_req.hazard_vd, is_reduct : pe_req.op inside {[VFREDUSUM:VFWREDOSUM]} ? 1'b1 : 0, target_fu : MFPU_ADDRGEN, + instr_idle : !pe_req.vl, default : '0 }; operand_request_push[MulFPUA] = pe_req.use_vs1; @@ -388,6 +397,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: pe_req.hazard_vd : (pe_req.hazard_vs2 | pe_req.hazard_vd)), is_reduct : pe_req.op inside {[VFREDUSUM:VFWREDOSUM]} ? 1'b1 : 0, target_fu : MFPU_ADDRGEN, + instr_idle : !pe_req.vl, default: '0 }; operand_request_push[MulFPUB] = pe_req.swap_vs2_vd_op ? @@ -404,12 +414,14 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: // values in the opqueues. So, vl must be 1 at least vl : (pe_req.op inside {[VFREDUSUM:VFWREDOSUM]} && vfu_operation_d.vl == '0) ? 1 : vfu_operation_d.vl, + // vl : vfu_operation_d.vl = vfu_operation_d.vl, vstart : vfu_operation_d.vstart, vtype : pe_req.vtype, hazard : pe_req.swap_vs2_vd_op ? (pe_req.hazard_vs2 | pe_req.hazard_vd) : pe_req.hazard_vd, is_reduct : pe_req.op inside {[VFREDUSUM:VFWREDOSUM]} ? 1'b1 : 0, target_fu : MFPU_ADDRGEN, + instr_idle : !pe_req.vl, default : '0 }; operand_request_push[MulFPUC] = pe_req.swap_vs2_vd_op ? @@ -426,6 +438,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : (pe_req.vl / NrLanes / 8) >> int'(pe_req.vtype.vsew), vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vm | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default: '0 }; if ((operand_request_i[MaskM].vl << int'(pe_req.vtype.vsew)) * @@ -444,6 +457,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : (pe_req.vl / NrLanes / 8) >> int'(pe_req.vtype.vsew), vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vm | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default: '0 }; if ((operand_request_i[MaskM].vl << int'(pe_req.vtype.vsew)) * @@ -462,6 +476,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vstart : vfu_operation_d.vstart, vtype : pe_req_i.vtype, hazard : pe_req_i.hazard_vs2 | pe_req_i.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; // Since this request goes outside of the lane, we might need to request an @@ -484,6 +499,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : pe_req.vl / NrLanes, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs1 | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; if (operand_request_i[StA].vl * NrLanes != pe_req.vl) operand_request_i[StA].vl += 1; @@ -500,6 +516,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : (pe_req.vl / NrLanes / 8) >> int'(pe_req.vtype.vsew), vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vm | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default: '0 }; if ((operand_request_i[MaskM].vl << int'(pe_req.vtype.vsew)) * @@ -518,6 +535,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vstart : vfu_operation_d.vstart, vtype : pe_req_i.vtype, hazard : pe_req_i.hazard_vs2 | pe_req_i.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; // Since this request goes outside of the lane, we might need to request an @@ -538,6 +556,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vtype : pe_req.vtype, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs2 | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; operand_request_push[SlideAddrGenA] = pe_req.use_vs2; @@ -601,6 +620,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vtype : pe_req.vtype, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vm | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default: '0 }; operand_request_push[MaskM] = !pe_req.vm; @@ -647,6 +667,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vtype : pe_req.vtype, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs1 | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; @@ -675,6 +696,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vtype : pe_req.vtype, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs2 | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; // This is an operation that runs normally on the ALU, and then gets *condensed* and @@ -702,6 +724,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vtype : pe_req.vtype, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs1 | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; @@ -718,6 +741,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vtype : pe_req.vtype, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs2 | pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; // This is an operation that runs normally on the ALU, and then gets *condensed* and @@ -736,6 +760,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : (pe_req.vl / NrLanes / ELEN) << (int'(EW64) - int'(pe_req.vtype.vsew)), vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vd, + instr_idle : !pe_req.vl, default : '0 }; if (((pe_req.vl / NrLanes / ELEN) * NrLanes * ELEN) != @@ -752,6 +777,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : (pe_req.vl / NrLanes / ELEN), vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vm, + instr_idle : !pe_req.vl, default: '0 }; if ((operand_request_i[MaskM].vl * NrLanes * ELEN) != pe_req.vl) begin @@ -771,6 +797,7 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: vl : vfu_operation_d.vl, vstart : vfu_operation_d.vstart, hazard : pe_req.hazard_vs2, + instr_idle : !pe_req.vl, default : '0 }; operand_request_push[MaskB] = 1'b1; diff --git a/hardware/src/lane/operand_queue.sv b/hardware/src/lane/operand_queue.sv index 10c075c..c180d63 100644 --- a/hardware/src/lane/operand_queue.sv +++ b/hardware/src/lane/operand_queue.sv @@ -314,10 +314,10 @@ module operand_queue import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::i if (SupportReduct) begin if (lane_id_i == '0) begin unique case (cmd.eew) - EW8 : conv_operand = {ntr.w8[7:1] , ibuf_operand[7:0]}; - EW16: conv_operand = {ntr.w16[3:1], ibuf_operand[15:0]}; - EW32: conv_operand = {ntr.w32[1:1], ibuf_operand[31:0]}; - default:; + EW8 : conv_operand = (cmd.instr_idle) ? ntr.w8 : {ntr.w8[7:1] , ibuf_operand[7:0]}; + EW16: conv_operand = (cmd.instr_idle) ? ntr.w16 : {ntr.w16[3:1], ibuf_operand[15:0]}; + EW32: conv_operand = (cmd.instr_idle) ? ntr.w32 : {ntr.w32[1:1], ibuf_operand[31:0]}; + default:conv_operand = (cmd.instr_idle) ? ntr.w64 : ibuf_operand; endcase end else begin conv_operand = ntr.w64; @@ -369,21 +369,24 @@ module operand_queue import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::i // not to compromise reductions. default: begin // Pad only the last packet during a reduction, and pad the correct bytes only! - if (last_packet && incomplete_packet) begin + if (cmd.instr_idle || (last_packet && incomplete_packet)) begin if (SupportNtrVal) unique case (cmd.eew) EW8 : for (int unsigned b = 0; b < 8; b++) begin automatic int unsigned bs = shuffle_index(b, 1, EW8); - if ((b >> 0) >= cmd.vl[2:0]) conv_operand[8*bs +: 8] = ntr.w8[b]; + if (cmd.instr_idle || ((b >> 0) >= cmd.vl[2:0])) conv_operand[8*bs +: 8] = ntr.w8[b]; end EW16: for (int unsigned b = 0; b < 8; b++) begin automatic int unsigned bs = shuffle_index(b, 1, EW16); - if ((b >> 1) >= cmd.vl[1:0]) conv_operand[8*bs +: 8] = ntr.w8[b]; + if (cmd.instr_idle || ((b >> 1) >= cmd.vl[1:0])) conv_operand[8*bs +: 8] = ntr.w8[b]; end EW32: for (int unsigned b = 0; b < 8; b++) begin automatic int unsigned bs = shuffle_index(b, 1, EW32); - if ((b >> 2) >= cmd.vl[0:0]) conv_operand[8*bs +: 8] = ntr.w8[b]; + if (cmd.instr_idle || ((b >> 2) >= cmd.vl[0:0])) conv_operand[8*bs +: 8] = ntr.w8[b]; end - default:; + default: for (int unsigned b = 0; b < 8; b++) begin + automatic int unsigned bs = shuffle_index(b, 1, EW32); + if (cmd.instr_idle) conv_operand[8*bs +: 8] = ntr.w8[b]; + end endcase end end diff --git a/hardware/src/lane/operand_requester.sv b/hardware/src/lane/operand_requester.sv index f660a21..ad2af99 100644 --- a/hardware/src/lane/operand_requester.sv +++ b/hardware/src/lane/operand_requester.sv @@ -303,7 +303,8 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( conv : operand_request_i[requester].conv, ntr_red : operand_request_i[requester].cvt_resize, target_fu: operand_request_i[requester].target_fu, - is_reduct: operand_request_i[requester].is_reduct + is_reduct: operand_request_i[requester].is_reduct, + instr_idle: operand_request_i[requester].instr_idle }; // The length should be at least one after the rescaling if (operand_queue_cmd_o[requester].vl == '0) @@ -392,7 +393,8 @@ module operand_requester import ara_pkg::*; import rvv_pkg::*; #( conv : operand_request_i[requester].conv, ntr_red : operand_request_i[requester].cvt_resize, target_fu: operand_request_i[requester].target_fu, - is_reduct: operand_request_i[requester].is_reduct + is_reduct: operand_request_i[requester].is_reduct, + instr_idle: operand_request_i[requester].instr_idle }; operand_queue_cmd_valid_o[requester] = 1'b1; // The length should be at least one after the rescaling diff --git a/hardware/src/lane/valu.sv b/hardware/src/lane/valu.sv index aefd481..8c2d210 100644 --- a/hardware/src/lane/valu.sv +++ b/hardware/src/lane/valu.sv @@ -21,6 +21,8 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; input logic clk_i, input logic rst_ni, input logic[idx_width(NrLanes)-1:0] lane_id_i, + input id_cluster_t cluster_id_i, + input num_cluster_t num_clusters_i, // Interface with Dispatcher output logic vxsat_flag_o, input vxrm_t alu_vxrm_i, @@ -264,7 +266,7 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; // so on. In the end, the result is collected in Lane 0 and the last SIMD reduction is performed. // The following function determines how many partial results this lane must process during the // inter-lane reduction. - typedef logic [idx_width(NrLanes/2):0] reduction_rx_cnt_t; + typedef logic [idx_width(NrLanes*MaxNrClusters/2):0] reduction_rx_cnt_t; reduction_rx_cnt_t reduction_rx_cnt_d, reduction_rx_cnt_q; reduction_rx_cnt_t simd_red_cnt_max_d, simd_red_cnt_max_q; @@ -298,6 +300,12 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; endcase endfunction: reduction_rx_cnt_init + // Inter cluster reductions are handled like inter lane reductions. + // In inter cluster only the last lane participates. + // Finally, the lane-0 receives the last packet for SIMD + id_cluster_t max_cluster_id; + assign max_cluster_id = (1 << num_clusters_i) - 1; + // Count how many transactions we must do in total to complete the reduction operation logic [idx_width($clog2(NrLanes)+1):0] sldu_transactions_cnt_d, sldu_transactions_cnt_q; @@ -309,7 +317,10 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; logic first_op_d, first_op_q; // Signal to indicate the state of the ALU - typedef enum logic [2:0] {NO_REDUCTION, INTRA_LANE_REDUCTION, INTER_LANES_REDUCTION_RX, INTER_LANES_REDUCTION_TX, LN0_REDUCTION_COMMIT, SIMD_REDUCTION} alu_state_e; + typedef enum logic [2:0] {NO_REDUCTION, INTRA_LANE_REDUCTION, + INTER_LANES_REDUCTION_RX, INTER_LANES_REDUCTION_TX, + LN0_REDUCTION_COMMIT, SIMD_REDUCTION + } alu_state_e; alu_state_e alu_state_d, alu_state_q; // Reductions commit by zeroing the commit counter @@ -782,7 +793,10 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; // Initialize reduction-related sequential elements first_op_d = 1'b1; reduction_rx_cnt_d = reduction_rx_cnt_init(NrLanes, lane_id_i); - sldu_transactions_cnt_d = $clog2(NrLanes) + 1; + if (lane_id_i == NrLanes-1) + reduction_rx_cnt_d += reduction_rx_cnt_init(max_cluster_id, cluster_id_i); // Inter cluster + // sldu_transactions_cnt_d = $clog2(NrLanes) + 1; + sldu_transactions_cnt_d = $clog2(NrLanes) + reduction_rx_cnt_init(max_cluster_id, cluster_id_i) + 1; alu_state_d = INTRA_LANE_REDUCTION; end else begin @@ -810,7 +824,10 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; // Initialize reduction-related sequential elements first_op_d = 1'b1; reduction_rx_cnt_d = reduction_rx_cnt_init(NrLanes, lane_id_i); - sldu_transactions_cnt_d = $clog2(NrLanes) + 1; + if (lane_id_i == NrLanes-1) + reduction_rx_cnt_d += reduction_rx_cnt_init(max_cluster_id, cluster_id_i); // Inter cluster + // sldu_transactions_cnt_d = $clog2(NrLanes) + 1; + sldu_transactions_cnt_d = $clog2(NrLanes) + reduction_rx_cnt_init(max_cluster_id, cluster_id_i) + 1; issue_cnt_d = vfu_operation_i.vl; if (!(vfu_operation_i.op inside {[VMANDNOT:VMXNOR]})) diff --git a/hardware/src/lane/vector_fus_stage.sv b/hardware/src/lane/vector_fus_stage.sv index d99f979..ffcf6dd 100644 --- a/hardware/src/lane/vector_fus_stage.sv +++ b/hardware/src/lane/vector_fus_stage.sv @@ -107,6 +107,8 @@ module vector_fus_stage import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg .clk_i (clk_i ), .rst_ni (rst_ni ), .lane_id_i (lane_id_i ), + .cluster_id_i (cluster_id_i ), + .num_clusters_i (num_clusters_i ), // Interface with Dispatcher .vxsat_flag_o (alu_vxsat ), .alu_vxrm_i (alu_vxrm_i ), diff --git a/hardware/src/sldu/sldu.sv b/hardware/src/sldu/sldu.sv index 04e4219..7d3e444 100644 --- a/hardware/src/sldu/sldu.sv +++ b/hardware/src/sldu/sldu.sv @@ -1422,6 +1422,9 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( if (!vinsn_queue_full && pe_req_valid_i && !vinsn_running_q[pe_req_i.id] && (pe_req_i.vfu == VFU_SlideUnit || pe_req_i.op inside {[VREDSUM:VWREDSUM], [VFREDUSUM:VFWREDOSUM]})) begin vinsn_queue_d.vinsn[vinsn_queue_q.accept_pnt] = pe_req_i; + // if ((pe_req_i.op inside {[VREDSUM:VWREDSUM], [VFREDUSUM:VFWREDOSUM]}) && (pe_req_i.vl < NrLanes)) begin + // vinsn_queue_d.vinsn[vinsn_queue_q.accept_pnt].vl = NrLanes; + // end vinsn_running_d[pe_req_i.id] = 1'b1; // Calculate the slide offset inside the vector register diff --git a/hardware/src/vlsu/align_stage.sv b/hardware/src/vlsu/align_stage.sv index ad5a59d..4c7708c 100644 --- a/hardware/src/vlsu/align_stage.sv +++ b/hardware/src/vlsu/align_stage.sv @@ -9,6 +9,7 @@ // This means the alignment in the Load store unit can be removed. module align_stage import ara_pkg::*; import rvv_pkg::*; #( + parameter int unsigned NrLanes = 0, // Number of parallel vector lanes. parameter int unsigned NrClusters = 0, parameter int unsigned AxiDataWidth = 0, parameter int unsigned AxiAddrWidth = 0, @@ -43,6 +44,7 @@ vlen_cl_t vl, vl_d, vl_q; vtype_t vtype; global_dispatcher #( + .NrLanes (NrLanes ), .NrClusters (NrClusters), .vlen_cl_t (vlen_cl_t ) ) i_global_dispatcher ( @@ -291,6 +293,9 @@ always_comb begin if (be_final_d != '1) begin // For unaligned data, this is the last packet. axi_resp_o.r.last = 1'b1; + if (!data_prev_valid_q) begin + axi_resp_o.r_valid = 1'b1; + end data_prev_d = '0; data_prev_valid_d = 1'b0; end else begin diff --git a/hardware/src/vlsu/global_dispatcher.sv b/hardware/src/vlsu/global_dispatcher.sv index 82f1e38..e4bb34b 100644 --- a/hardware/src/vlsu/global_dispatcher.sv +++ b/hardware/src/vlsu/global_dispatcher.sv @@ -9,6 +9,7 @@ // vl and vtype of the current configuration for LdSt requests. module global_dispatcher import ara_pkg::*; import rvv_pkg::*; #( + parameter int unsigned NrLanes = 0, // Number of parallel vector lanes. parameter int unsigned NrClusters = 0, parameter type vlen_cl_t = logic ) @@ -108,8 +109,16 @@ module global_dispatcher import ara_pkg::*; import rvv_pkg::*; #( vl_d = vlmax; end else begin // Normal stripmining - vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || - (vlen_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_t'(acc_req_i.rs1); + // vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || + // (vlen_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_t'(acc_req_i.rs1); + if (((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || + (vlen_t'(acc_req_i.rs1) > vlmax))) begin + vl_d = vlmax; + end else if (vlen_t'(acc_req_i.rs1) < NrClusters * NrLanes) begin + vl_d = NrClusters * NrLanes; + end else begin + vl_d = vlen_t'(acc_req_i.rs1); + end end end end diff --git a/hardware/src/vlsu/global_ldst.sv b/hardware/src/vlsu/global_ldst.sv index 8d2d2c2..58b920f 100644 --- a/hardware/src/vlsu/global_ldst.sv +++ b/hardware/src/vlsu/global_ldst.sv @@ -46,6 +46,7 @@ vlen_cl_t vl; vtype_t vtype; global_dispatcher #( + .NrLanes (NrLanes ), .NrClusters (NrClusters), .vlen_cl_t (vlen_cl_t ) ) i_global_dispatcher ( diff --git a/hardware/src/vlsu/shuffle_stage.sv b/hardware/src/vlsu/shuffle_stage.sv index c7be052..9f61521 100644 --- a/hardware/src/vlsu/shuffle_stage.sv +++ b/hardware/src/vlsu/shuffle_stage.sv @@ -47,6 +47,7 @@ vlen_cl_t vl, vl_d, vl_q; vtype_t vtype; global_dispatcher #( + .NrLanes (NrLanes ), .NrClusters (NrClusters), .vlen_cl_t (vlen_cl_t ) ) i_global_dispatcher ( From 3890099b58bcd8755e114585185850eab45c7e74 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 10 Oct 2025 20:08:49 +0200 Subject: [PATCH 02/37] [HW] 1. Fix sldu issue on reduction: align transaction number among clusters; 2. Fix valu issue on reduction: return back to NO_REDUCTION state when finish reduction, reduction operation should only start when the previous reduction is finished; 3. Update addrgen and vldu module to the newest released Ara version and adapt to support GLSU interaction; 4. (WIP)Adapt vl length for vector load to NrLanes*NrClusters as smallest number to support short vector load (TODO: GLSU may not need to be adjusted); 5. Fix shuffle stage resp issue: take control signal from the last stage instead of the first stage --- apps/dotproduct/main.c | 154 ++-- apps/fdotproduct/main.c | 114 +-- hardware/include/ara_pkg.sv | 1 + hardware/src/ara_dispatcher.sv | 33 +- hardware/src/lane/valu.sv | 29 +- hardware/src/lane/vmfpu.sv | 3 +- hardware/src/sldu/sldu.sv | 9 +- hardware/src/vlsu/addrgen.sv | 1053 +++++++++++++++++++----- hardware/src/vlsu/global_dispatcher.sv | 8 +- hardware/src/vlsu/shuffle_stage.sv | 9 +- hardware/src/vlsu/vldu.sv | 381 ++++++--- 11 files changed, 1295 insertions(+), 499 deletions(-) diff --git a/apps/dotproduct/main.c b/apps/dotproduct/main.c index d6a5965..e3d7988 100644 --- a/apps/dotproduct/main.c +++ b/apps/dotproduct/main.c @@ -62,8 +62,8 @@ int main() { int64_t runtime_s, runtime_v; - // for (uint64_t avl = 32; avl <= (vsize >> 3); avl *= 2) { - for (uint64_t avl = (vsize >> 3); avl >=8; avl /= 2) { + for (uint64_t avl = 8; avl <= (vsize); avl *= 2) { + // for (uint64_t avl = (vsize >> 3); avl >=8; avl /= 2) { // uint64_t avl = 4; // Dotp printf("Calulating 64b dotp with vectors with length = %lu\n", avl); @@ -89,81 +89,81 @@ int main() { } } - // for (uint64_t avl = 8; avl <= (vsize >> 2); avl *= 8) { - // // Dotp - // // uint64_t avl = 4; - // printf("Calulating 32b dotp with vectors with length = %lu\n", avl); - // start_timer(); - // res32_v = dotp_v32b(v32a, v32b, avl); - // stop_timer(); - // runtime_v = get_timer(); - // printf("Vector runtime: %ld\n", runtime_v); - - // if (SCALAR) { - // start_timer(); - // res32_s = dotp_s32b(v32a, v32b, avl); - // stop_timer(); - // runtime_s = get_timer(); - // printf("Scalar runtime: %ld\n", runtime_s); - - // if (CHECK) { - // if (res32_v != res32_s) { - // printf("Error: v = %ld, g = %ld\n", res32_v, res32_s); - // return -1; - // } - // } - // } - // } - - // for (uint64_t avl = 8; avl <= (vsize >> 1); avl *= 8) { - // // Dotp - // printf("Calulating 16b dotp with vectors with length = %lu\n", avl); - // start_timer(); - // res16_v = dotp_v16b(v16a, v16b, avl); - // stop_timer(); - // runtime_v = get_timer(); - // printf("Vector runtime: %ld\n", runtime_v); - - // if (SCALAR) { - // start_timer(); - // res16_s = dotp_s16b(v16a, v16b, avl); - // stop_timer(); - // runtime_s = get_timer(); - // printf("Scalar runtime: %ld\n", runtime_s); - - // if (CHECK) { - // if (res16_v != res16_s) { - // printf("Error: v = %ld, g = %ld\n", res16_v, res16_s); - // return -1; - // } - // } - // } - // } - - // for (uint64_t avl = 8; avl <= (vsize >> 0); avl *= 8) { - // // Dotp - // printf("Calulating 8b dotp with vectors with length = %lu\n", avl); - // start_timer(); - // res8_v = dotp_v8b(v8a, v8b, avl); - // stop_timer(); - // runtime_v = get_timer(); - // printf("Vector runtime: %ld\n", runtime_v); - - // if (SCALAR) { - // start_timer(); - // res8_s = dotp_s8b(v8a, v8b, avl); - // stop_timer(); - // runtime_s = get_timer(); - // printf("Scalar runtime: %ld\n", runtime_s); - - // if (CHECK) { - // if (res8_v != res8_s) { - // printf("Error: v = %ld, g = %ld\n", res8_v, res8_s); - // return -1; - // } - // } - // } - // } + for (uint64_t avl = 8; avl <= (vsize); avl *= 2) { + // Dotp + // uint64_t avl = 4; + printf("Calulating 32b dotp with vectors with length = %lu\n", avl); + start_timer(); + res32_v = dotp_v32b(v32a, v32b, avl); + stop_timer(); + runtime_v = get_timer(); + printf("Vector runtime: %ld\n", runtime_v); + + if (SCALAR) { + start_timer(); + res32_s = dotp_s32b(v32a, v32b, avl); + stop_timer(); + runtime_s = get_timer(); + printf("Scalar runtime: %ld\n", runtime_s); + + if (CHECK) { + if (res32_v != res32_s) { + printf("Error: v = %ld, g = %ld\n", res32_v, res32_s); + return -1; + } + } + } + } + + for (uint64_t avl = 8; avl <= (vsize); avl *= 2) { + // Dotp + printf("Calulating 16b dotp with vectors with length = %lu\n", avl); + start_timer(); + res16_v = dotp_v16b(v16a, v16b, avl); + stop_timer(); + runtime_v = get_timer(); + printf("Vector runtime: %ld\n", runtime_v); + + if (SCALAR) { + start_timer(); + res16_s = dotp_s16b(v16a, v16b, avl); + stop_timer(); + runtime_s = get_timer(); + printf("Scalar runtime: %ld\n", runtime_s); + + if (CHECK) { + if (res16_v != res16_s) { + printf("Error: v = %ld, g = %ld\n", res16_v, res16_s); + return -1; + } + } + } + } + + for (uint64_t avl = 8; avl <= (vsize); avl *= 2) { + // Dotp + printf("Calulating 8b dotp with vectors with length = %lu\n", avl); + start_timer(); + res8_v = dotp_v8b(v8a, v8b, avl); + stop_timer(); + runtime_v = get_timer(); + printf("Vector runtime: %ld\n", runtime_v); + + if (SCALAR) { + start_timer(); + res8_s = dotp_s8b(v8a, v8b, avl); + stop_timer(); + runtime_s = get_timer(); + printf("Scalar runtime: %ld\n", runtime_s); + + if (CHECK) { + if (res8_v != res8_s) { + printf("Error: v = %ld, g = %ld\n", res8_v, res8_s); + return -1; + } + } + } + } printf("SUCCESS.\n"); diff --git a/apps/fdotproduct/main.c b/apps/fdotproduct/main.c index 55bf647..dea7770 100644 --- a/apps/fdotproduct/main.c +++ b/apps/fdotproduct/main.c @@ -32,7 +32,7 @@ // Threshold for FP comparisons #define THRESHOLD_64b 0.0000000001 -#define THRESHOLD_32b 0.0001 +#define THRESHOLD_32b 0.01 #define THRESHOLD_16b 1 // Run also the scalar benchmark @@ -72,10 +72,8 @@ int main() { uint64_t runtime_s, runtime_v; - // for (uint64_t avl = 32; avl <= (vsize >> 3); avl *= 2) { - for (uint64_t avl = (vsize >> 3); avl >= 8; avl /= 2) { + for (uint64_t avl = 8; avl <= (vsize); avl *= 2) { // uint64_t avl = vsize >> 3; - // uint64_t avl = 4; printf("Calulating 64b dotp with vectors with length = %lu\n", avl); start_timer(); res64_v = fdotp_v64b(v64a, v64b, avl); @@ -103,77 +101,83 @@ int main() { } - // for (uint64_t avl = 16; avl <= (vsize); avl *= 2) { - // for (uint64_t avl = 32; avl <= 32; avl *= 2) { - // uint64_t avl=4; - // printf("Calulating 32b dotp with vectors with length = %lu\n", avl); + for (uint64_t avl = 8; avl <= (vsize); avl *= 2) { + // for (uint64_t avl = vsize; avl <= (vsize); avl *= 2) { // start_timer(); - // res32_v = fdotp_v32b(v32a, v32b, avl); + // res32_s = fdotp_s32b(v32a, v32b, avl); // stop_timer(); - // runtime_v = get_timer(); - // printf("Vector runtime: %ld\n", runtime_v); - - // if (SCALAR) { - // start_timer(); - // res32_s = fdotp_s32b(v32a, v32b, avl); - // stop_timer(); - // runtime_s = get_timer(); - // printf("Scalar runtime: %ld\n", runtime_s); - // } - - // if (CHECK) { - // if (SCALAR) { - // printf("Checking results: v = %f, s = %f\n", res32_v, res32_s); - // if (!similarity_check_32b(res32_v, res32_s, THRESHOLD_32b)) { - // printf("Error: v = %f, s = %f\n", res32_v, res32_s); - // return -1; - // } - // } - // } + // runtime_s = get_timer(); + // printf("Scalar runtime: %ld\n, result: %f\n", runtime_s, res32_s); - // // Dotproduct Arithmetic intensity calculation - // // Ops = 2N FP32 ops - // // Bytes = 2N * 4B = 8N Bytes , AI = 1/4 FP32 Op/B - // // BW = 32N bits/ cycle = 4N Bytes - // // Max Perf = N * 2 * 2 FP32op/cycle = 4N FP32 op/cycle - // // From roofline max perf at the arithmetic intensity = N FP32 op/cycle - // float performance = avl * 1.0 / runtime_v; - // float utilization = 100.0 * performance / (NR_LANES * NR_CLUSTERS); - // printf("The execution took %d cycles.\n", runtime_v); - // printf("The performance is %f FLOP/cycle (%f%% utilization).\n", - // performance, utilization); - // } - - /* - for (uint64_t avl = 8; avl <= (vsize >> 2); avl *= 8) { - // Dotp - printf("Calulating 16b dotp with vectors with length = %lu\n", avl); + printf("Calulating 32b dotp with vectors with length = %lu\n", avl); start_timer(); - res16_v = fdotp_v16b(v16a, v16b, avl); + res32_v = fdotp_v32b(v32a, v32b, avl); + printf("Finished!\n"); stop_timer(); runtime_v = get_timer(); printf("Vector runtime: %ld\n", runtime_v); if (SCALAR) { start_timer(); - res16_s = fdotp_s16b(v16a, v16b, avl); + res32_s = fdotp_s32b(v32a, v32b, avl); stop_timer(); runtime_s = get_timer(); - printf("Scalar runtime: %ld\n", runtime_s); + printf("Scalar runtime: %ld\n, result: %f\n", runtime_s, res32_s); } if (CHECK) { if (SCALAR) { - printf("Checking results: v = %x, s = %x\n", *((uint16_t *)&res16_v), - *((uint16_t *)&res16_s)); - if (!similarity_check(res16_v, res16_s, THRESHOLD_16b)) { - printf("Error: v = %x, s = %x\n", *((uint16_t *)&res16_v), - *((uint16_t *)&res16_s)); + printf("Checking results: v = %f, s = %f\n", res32_v, res32_s); + if (!similarity_check_32b(res32_v, res32_s, THRESHOLD_32b)) { + printf("Error: v = %f, s = %f\n", res32_v, res32_s); return -1; } } } - }*/ + + // // Dotproduct Arithmetic intensity calculation + // // Ops = 2N FP32 ops + // // Bytes = 2N * 4B = 8N Bytes , AI = 1/4 FP32 Op/B + // // BW = 32N bits/ cycle = 4N Bytes + // // Max Perf = N * 2 * 2 FP32op/cycle = 4N FP32 op/cycle + // // From roofline max perf at the arithmetic intensity = N FP32 op/cycle + // float performance = avl * 1.0 / runtime_v; + // float utilization = 100.0 * performance / (NR_LANES * NR_CLUSTERS); + // printf("The execution took %d cycles.\n", runtime_v); + // printf("The performance is %f FLOP/cycle (%f%% utilization).\n", + // performance, utilization); + } + + + // for (uint64_t avl = 8; avl <= (vsize); avl *= 8) { + // // Dotp + // printf("Calulating 16b dotp with vectors with length = %lu\n", avl); + // start_timer(); + // res16_v = fdotp_v16b(v16a, v16b, avl); + // stop_timer(); + // runtime_v = get_timer(); + // printf("Vector runtime: %ld\n", runtime_v); + + // if (SCALAR) { + // start_timer(); + // res16_s = fdotp_s16b(v16a, v16b, avl); + // stop_timer(); + // runtime_s = get_timer(); + // printf("Scalar runtime: %ld\n", runtime_s); + // } + + // if (CHECK) { + // if (SCALAR) { + // printf("Checking results: v = %x, s = %x\n", *((uint16_t *)&res16_v), + // *((uint16_t *)&res16_s)); + // if (!similarity_check(res16_v, res16_s, THRESHOLD_16b)) { + // printf("Error: v = %x, s = %x\n", *((uint16_t *)&res16_v), + // *((uint16_t *)&res16_s)); + // return -1; + // } + // } + // } + // } printf("SUCCESS.\n"); diff --git a/hardware/include/ara_pkg.sv b/hardware/include/ara_pkg.sv index 1bbacfc..ead2dc7 100644 --- a/hardware/include/ara_pkg.sv +++ b/hardware/include/ara_pkg.sv @@ -32,6 +32,7 @@ package ara_pkg; // Maximum number of clusters that Ara can support. localparam int unsigned MaxNrClusters = 32; + // localparam int unsigned NrClusters = 4; typedef logic [$clog2(MaxNrClusters)-1:0] id_cluster_t; typedef logic [$clog2(MaxNrLanes)-1:0] id_lane_t; typedef logic [cf_math_pkg::idx_width($clog2(MaxNrClusters))-1:0] num_cluster_t; diff --git a/hardware/src/ara_dispatcher.sv b/hardware/src/ara_dispatcher.sv index a10924f..1d331f8 100644 --- a/hardware/src/ara_dispatcher.sv +++ b/hardware/src/ara_dispatcher.sv @@ -58,13 +58,15 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( //////////// vlen_t vstart_d, vstart_q; - vlen_t vl_d, vl_q; + vlen_t vl_d, vl_q, vl_max_check; + vlen_t vl_ld_d, vl_ld_q; vtype_t vtype_d, vtype_q; vxsat_e vxsat_d, vxsat_q; vxrm_t vxrm_d, vxrm_q; `FF(vstart_q, vstart_d, '0) `FF(vl_q, vl_d, '0) + `FF(vl_ld_q, vl_ld_d, '0) `FF(vtype_q, vtype_d, '{vill: 1'b1, default: '0}) `FF(vxsat_q, vxsat_d, '0) `FF(vxrm_q, vxrm_d, '0) @@ -254,6 +256,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // Default values vstart_d = vstart_q; vl_d = vl_q; + vl_ld_d = vl_ld_q; vtype_d = vtype_q; state_d = state_q; eew_d = eew_q; @@ -502,6 +505,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( default:; endcase + vl_max_check = vlmax; + if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli vl_d = vlen_t'(insn.vsetivli_type.uimm5) >> num_clusters_i; acc_resp_o.result = vl_d << num_clusters_i; @@ -526,20 +531,25 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( acc_resp_o.result = vl_d << num_clusters_i; end else begin if (cluster_id_i < total_cluster_pieces[$clog2(NrClusters) - 1 : 0]) begin - // vl_d = (total_cluster_pieces >> $clog2(NrClusters) + 1) * (VLENB >> vtype_d.vsew); vl_d = ((total_cluster_pieces >> $clog2(NrClusters)) + 1) * NrLanes; end else if (cluster_id_i == total_cluster_pieces[$clog2(NrClusters) - 1 : 0]) begin - // vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * (VLENB >> vtype_d.vsew) + - // acc_req_i.rs1 % (VLENB >> vtype_d.vsew); vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * NrLanes + acc_req_i.rs1 % NrLanes; end else begin - // vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * (VLENB >> vtype_d.vsew); vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * NrLanes; end // Return the new vl acc_resp_o.result = vlen_t'(acc_req_i.rs1); end + // vector length for load instruction (need to be align with GLSU) + if (((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || + ((acc_req_i.rs1 >> num_clusters_i) > vlmax))) begin + vl_ld_d = vlmax; + end else if (|acc_req_i.rs1[$clog2(NrClusters * NrLanes)-1:0]) begin + vl_ld_d = vlen_t'((((acc_req_i.rs1 >> $clog2(NrClusters * NrLanes)) + 1) << $clog2(NrClusters * NrLanes)) >> $clog2(NrClusters)); + end else begin + vl_ld_d = vlen_t'(acc_req_i.rs1 >> $clog2(NrClusters)); + end end end end @@ -2550,6 +2560,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( acc_resp_o.req_ready = 1'b0; // These generate a request to Ara's backend + ara_req_d.vl = vl_ld_q; ara_req_d.vd = insn.vmem_type.rd; ara_req_d.use_vd = 1'b1; ara_req_d.vm = insn.vmem_type.vm; @@ -2610,7 +2621,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( 5'b01000:; // Unit-strided, whole registers 5'b01011: begin // Unit-strided, mask load, EEW=1 // We operate ceil(vl/8) bytes - ara_req_d.vl = (vl_q >> 3) + |vl_q[2:0]; + // ara_req_d.vl = (vl_q >> 3) + |vl_q[2:0]; + ara_req_d.vl = (vl_ld_q >> 3) + |vl_ld_q[2:0]; ara_req_d.vtype.vsew = EW8; end 5'b10000: begin // Unit-strided, fault-only first @@ -2762,6 +2774,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( ara_req_d.scale_vl = 1'b1; // These generate a request to Ara's backend + ara_req_d.vl = vl_q; ara_req_d.vs1 = insn.vmem_type.rd; // vs3 is encoded in the same position as rd ara_req_d.use_vs1 = 1'b1; ara_req_d.eew_vs1 = eew_q[insn.vmem_type.rd]; // This is the vs1 EEW @@ -3243,8 +3256,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // Any valid non-config instruction is a NOP if vl == 0, with some exceptions, // e.g. whole vector memory operations / whole vector register move - if (is_decoding && (vl_q == '0 || null_vslideup) && !is_config && - !(ara_req_d.op inside {[VREDSUM:VWREDSUM], [VFREDUSUM:VFWREDOSUM]}) && + if (is_decoding && (((vl_q == '0 && (!(ara_req_d.op inside {[VLE:VSXE]}))) || + (vl_ld_q == '0 && (ara_req_d.op inside {[VLE:VSXE]}))) || null_vslideup) && !is_config && !ignore_zero_vl_check && !acc_resp_o.error) begin // If we are acknowledging a memory operation, we must tell Ariane that the memory // operation was resolved (to decrement its pending load/store counter) @@ -3252,7 +3265,9 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // delay the zero_vl acknowledge by 1 cycle acc_resp_o.req_ready = ~((is_vload & load_complete_q) | (is_vstore & store_complete_q)); acc_resp_o.resp_valid = ~((is_vload & load_complete_q) | (is_vstore & store_complete_q)); - ara_req_valid_d = 1'b0; + if (!(ara_req_d.op inside {[VREDSUM:VWREDSUM], [VFREDUSUM:VFWREDOSUM]})) begin + ara_req_valid_d = 1'b0; + end load_zero_vl = is_vload; store_zero_vl = is_vstore; end diff --git a/hardware/src/lane/valu.sv b/hardware/src/lane/valu.sv index 8c2d210..37eb808 100644 --- a/hardware/src/lane/valu.sv +++ b/hardware/src/lane/valu.sv @@ -674,6 +674,8 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; end end + alu_state_d = NO_REDUCTION; + // Give the done to the main sequencer commit_cnt_d = '0; end @@ -692,6 +694,7 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; simd_red_cnt_d = simd_red_cnt_q + 1; result_queue_d[result_queue_write_pnt_q].wdata = valu_result; end else begin + alu_state_d = NO_REDUCTION; // Bump issue counter and pointers vinsn_queue_d.issue_cnt -= 1; if (vinsn_queue_q.issue_pnt == VInsnQueueDepth-1) @@ -789,18 +792,20 @@ module valu import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::idx_width; // Initialize counters and alu state if needed by the next instruction // After a reduction, the next instructions starts after the reduction commits - if (is_reduction(vinsn_queue_q.vinsn[vinsn_queue_d.issue_pnt].op) && (vinsn_queue_d.issue_cnt != '0)) begin - // Initialize reduction-related sequential elements - first_op_d = 1'b1; - reduction_rx_cnt_d = reduction_rx_cnt_init(NrLanes, lane_id_i); - if (lane_id_i == NrLanes-1) - reduction_rx_cnt_d += reduction_rx_cnt_init(max_cluster_id, cluster_id_i); // Inter cluster - // sldu_transactions_cnt_d = $clog2(NrLanes) + 1; - sldu_transactions_cnt_d = $clog2(NrLanes) + reduction_rx_cnt_init(max_cluster_id, cluster_id_i) + 1; - - alu_state_d = INTRA_LANE_REDUCTION; - end else begin - alu_state_d = NO_REDUCTION; + if (alu_state_q == NO_REDUCTION) begin + if (is_reduction(vinsn_queue_q.vinsn[vinsn_queue_d.issue_pnt].op) && (vinsn_queue_d.issue_cnt != '0)) begin + // Initialize reduction-related sequential elements + first_op_d = 1'b1; + reduction_rx_cnt_d = reduction_rx_cnt_init(NrLanes, lane_id_i); + if (lane_id_i == NrLanes-1) + reduction_rx_cnt_d += reduction_rx_cnt_init(max_cluster_id, cluster_id_i); // Inter cluster + // sldu_transactions_cnt_d = $clog2(NrLanes) + 1; + sldu_transactions_cnt_d = $clog2(NrLanes) + reduction_rx_cnt_init(max_cluster_id, cluster_id_i) + 1; + + alu_state_d = INTRA_LANE_REDUCTION; + end else begin + alu_state_d = NO_REDUCTION; + end end end diff --git a/hardware/src/lane/vmfpu.sv b/hardware/src/lane/vmfpu.sv index 1e2f49e..fc1886f 100644 --- a/hardware/src/lane/vmfpu.sv +++ b/hardware/src/lane/vmfpu.sv @@ -594,7 +594,8 @@ module vmfpu import ara_pkg::*; import rvv_pkg::*; import fpnew_pkg::*; logic prevent_commit; // Count how many transactions we must do in total to complete the reduction operation - logic [idx_width($clog2(NrLanes)+1):0] sldu_transactions_cnt_d, sldu_transactions_cnt_q; + // logic [idx_width($clog2(NrLanes)+1):0] sldu_transactions_cnt_d, sldu_transactions_cnt_q; + logic [idx_width(NrLanes*MaxNrClusters/2):0] sldu_transactions_cnt_d, sldu_transactions_cnt_q; // Handshake synchronizer // Since the SLDU must receive a valid signals also from lanes that should not send anything, diff --git a/hardware/src/sldu/sldu.sv b/hardware/src/sldu/sldu.sv index 7d3e444..75414e7 100644 --- a/hardware/src/sldu/sldu.sv +++ b/hardware/src/sldu/sldu.sv @@ -1135,7 +1135,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( slide_data_accepted = '0; for (int lane = 0; lane < NrLanes; lane++) begin: result_write sldu_result_req_o[lane] = result_queue_valid_q[result_queue_read_pnt_q][lane] & (~(vinsn_commit.vfu inside {VFU_Alu, VFU_MFpu})); - sldu_red_valid_o[lane] = result_queue_valid_q[result_queue_read_pnt_q][lane] & (vinsn_commit.vfu inside {VFU_Alu, VFU_MFpu}); + sldu_red_valid_o[lane] = result_queue_valid_q[result_queue_read_pnt_q][lane] & vinsn_commit_valid & (vinsn_commit.vfu inside {VFU_Alu, VFU_MFpu}); sldu_result_addr_o[lane] = result_queue_q[result_queue_read_pnt_q][lane].addr; sldu_result_id_o[lane] = result_queue_q[result_queue_read_pnt_q][lane].id; sldu_result_wdata_o[lane] = result_queue_q[result_queue_read_pnt_q][lane].wdata; @@ -1160,7 +1160,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( // If this is a reduction, no need for the final grants // if (!(|result_queue_valid_d[result_queue_read_pnt_q]) && // (vinsn_commit.vfu inside {VFU_Alu, VFU_MFpu} || (&result_final_gnt_d || commit_cnt_q > (NrLanes * 8)))) - if (|slide_data_accepted && (vinsn_commit.vfu inside {VFU_Alu, VFU_MFpu} || (&result_final_gnt_d || commit_cnt_q >= (NrLanes * 8)))) + if (|slide_data_accepted && ((vinsn_commit.vfu inside {VFU_Alu, VFU_MFpu}) || (&result_final_gnt_d || commit_cnt_q >= (NrLanes * 8)))) // There is something waiting to be written if (!result_queue_empty) begin if (!vinsn_commit.is_stride_np2) // if (state_q != SLIDE_NP2_SETUP) @@ -1205,7 +1205,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( // Add packets for inter cluster reduction if (vinsn_queue_q.vinsn[vinsn_queue_d.commit_pnt].vfu inside {VFU_Alu, VFU_MFpu}) begin // results to be committed after receiving from ring, cluster0 commits 1 additional packet for final result - commit_cnt_d += (NrLanes * (cluster_reduction_rx_cnt_init(cluster_id_i) - 1 + (cluster_id_i==0 ? 1 : 0))) << EW64; + commit_cnt_d += (NrLanes * (cluster_reduction_rx_cnt_init(cluster_id_i))) << EW64; end // Trim vector elements which are not written by the slide unit @@ -1445,7 +1445,8 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( // Add packets for inter cluster reduction if (pe_req_i.vfu inside {VFU_Alu, VFU_MFpu}) begin // results to be committed after receiving from ring, cluster0 commits 1 additional packet for final result - commit_cnt_d += (NrLanes * (cluster_reduction_rx_cnt_init(cluster_id_i) - 1 + (cluster_id_i==0 ? 1 : 0))) << EW64; + // commit_cnt_d += (NrLanes * (cluster_reduction_rx_cnt_init(cluster_id_i) - 1 + (cluster_id_i==0 ? 1 : 0))) << EW64; + commit_cnt_d += (NrLanes * (cluster_reduction_rx_cnt_init(cluster_id_i))) << EW64; end // Trim vector elements which are not written by the slide unit diff --git a/hardware/src/vlsu/addrgen.sv b/hardware/src/vlsu/addrgen.sv index a862646..8112062 100644 --- a/hardware/src/vlsu/addrgen.sv +++ b/hardware/src/vlsu/addrgen.sv @@ -49,14 +49,37 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( output logic addrgen_operand_ready_o ); + localparam unsigned DataWidth = $bits(elen_t); + localparam unsigned DataWidthB = DataWidth / 8; + + localparam unsigned Log2NrLanes = $clog2(NrLanes); + localparam unsigned Log2LaneWordWidthB = $clog2(DataWidthB/1); + localparam unsigned Log2LaneWordWidthH = $clog2(DataWidthB/2); + localparam unsigned Log2LaneWordWidthS = $clog2(DataWidthB/4); + localparam unsigned Log2LaneWordWidthD = $clog2(DataWidthB/8); + localparam unsigned Log2VRFWordWidthB = Log2NrLanes + Log2LaneWordWidthB; + localparam unsigned Log2VRFWordWidthH = Log2NrLanes + Log2LaneWordWidthH; + localparam unsigned Log2VRFWordWidthS = Log2NrLanes + Log2LaneWordWidthS; + localparam unsigned Log2VRFWordWidthD = Log2NrLanes + Log2LaneWordWidthD; + import cf_math_pkg::idx_width; import axi_pkg::aligned_addr; import axi_pkg::BURST_INCR; import axi_pkg::CACHE_MODIFIABLE; + // // Check if the address is aligned to a particular width + // function automatic logic is_addr_error(axi_addr_t addr, vew_e vew); + // is_addr_error = |(addr & (elen_t'(1 << vew) - 1)); + // endfunction // is_addr_error + // Check if the address is aligned to a particular width - function automatic logic is_addr_error(axi_addr_t addr, vew_e vew); - is_addr_error = |(addr & (elen_t'(1 << vew) - 1)); + // Max element width: 8 bytes + function automatic logic is_addr_error(axi_addr_t addr, logic [1:0] vew); + // log2(MAX_ELEMENT_WIDTH_BYTE) + localparam LOG2_MAX_SEW_BYTE = 3; + typedef logic [LOG2_MAX_SEW_BYTE:0] max_sew_byte_t; + + is_addr_error = |(max_sew_byte_t'(addr[LOG2_MAX_SEW_BYTE-1:0]) & (max_sew_byte_t'(1 << vew) - 1)); endfunction // is_addr_error //////////////////// @@ -69,9 +92,10 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( axi_addr_t addr; vlen_t len; elen_t stride; - vew_e vew; + logic [1:0] vew; logic is_load; logic is_burst; // Unit-strided instructions can be converted into AXI INCR bursts + vlen_t vstart; } addrgen_req_t; addrgen_req_t addrgen_req; logic addrgen_req_valid; @@ -89,6 +113,9 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( logic axi_addrgen_queue_push; logic axi_addrgen_queue_full; logic axi_addrgen_queue_empty; + logic axi_addrgen_queue_pop; + + assign axi_addrgen_queue_pop = ldu_axi_addrgen_req_ready_i | stu_axi_addrgen_req_ready_i; fifo_v3 #( .DEPTH(VaddrgenInsnQueueDepth), @@ -102,7 +129,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( .push_i (axi_addrgen_queue_push ), .full_o (axi_addrgen_queue_full ), .data_o (axi_addrgen_req_o ), - .pop_i (ldu_axi_addrgen_req_ready_i | stu_axi_addrgen_req_ready_i), + .pop_i (axi_addrgen_queue_pop ), .empty_o (axi_addrgen_queue_empty ), .usage_o (/* Unused */ ) ); @@ -149,6 +176,9 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // Address generation // ////////////////////////// + vlen_t len_temp; + axi_addr_t next_addr_strided_temp; + // Running vector instructions logic [NrVInsn-1:0] vinsn_running_d, vinsn_running_q; @@ -165,10 +195,19 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( ADDRGEN_IDX_OP_END } state_q, state_d; + axi_addr_t lookahead_addr_e_d, lookahead_addr_e_q; + axi_addr_t lookahead_addr_se_d, lookahead_addr_se_q; + vlen_t lookahead_len_d, lookahead_len_q; + + logic [VLEN-1:0] vaddr_start; + always_comb begin: addr_generation // Maintain state state_d = state_q; pe_req_d = pe_req_q; + lookahead_addr_e_d = lookahead_addr_e_q; + lookahead_addr_se_d = lookahead_addr_se_q; + lookahead_len_d = lookahead_len_q; // Running vector instructions vinsn_running_d = vinsn_running_q & pe_vinsn_running_i; @@ -216,71 +255,182 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // Store the PE request pe_req_d = pe_req_i; + // Pre-calculate expensive additions / multiplications + // pe_req_i shouldn't be that critical at this point + lookahead_addr_e_d = pe_req_i.scalar_op + (pe_req_i.vstart << unsigned'(pe_req_i.vtype.vsew)); + lookahead_addr_se_d = pe_req_i.scalar_op + (pe_req_i.vstart * pe_req_i.stride); + lookahead_len_d = (pe_req_i.vl - pe_req_i.vstart) << unsigned'(pe_req_i.vtype.vsew[1:0]); + case (pe_req_i.op) VLXE, VSXE: begin state_d = ADDRGEN_IDX_OP; // Load element pointers case (pe_req_i.eew_vs2) - EW8: last_elm_subw_d = 7; - EW16: last_elm_subw_d = 3; - EW32: last_elm_subw_d = 1; - EW64: last_elm_subw_d = 0; - default: + EW8: begin + last_elm_subw_d = 7; + word_lane_ptr_d = pe_req_i.vstart[Log2VRFWordWidthB-1:Log2LaneWordWidthB]; + elm_ptr_d = pe_req_i.vstart[Log2LaneWordWidthB-1:0]; + end + EW16: begin + last_elm_subw_d = 3; + word_lane_ptr_d = pe_req_i.vstart[Log2VRFWordWidthH-1:Log2LaneWordWidthH]; + elm_ptr_d = pe_req_i.vstart[Log2LaneWordWidthH-1:0]; + end + EW32: begin + last_elm_subw_d = 1; + word_lane_ptr_d = pe_req_i.vstart[Log2VRFWordWidthS-1:Log2LaneWordWidthS]; + elm_ptr_d = pe_req_i.vstart[Log2LaneWordWidthS-1:0]; + end + default: begin // EW64 last_elm_subw_d = 0; + word_lane_ptr_d = pe_req_i.vstart[Log2VRFWordWidthD-1:0]; + elm_ptr_d = 0; + end endcase // Load element counter - idx_op_cnt_d = pe_req_i.vl; + idx_op_cnt_d = pe_req_i.vl - pe_req_i.vstart; end default: state_d = ADDRGEN; endcase end end + // IDLE: begin + // // Received a new request + // if (pe_req_valid_i && + // (is_load(pe_req_i.op) || is_store(pe_req_i.op)) && !vinsn_running_q[pe_req_i.id]) begin + // // Mark the instruction as running in this unit + // vinsn_running_d[pe_req_i.id] = 1'b1; + + // // Store the PE request + // pe_req_d = pe_req_i; + + // case (pe_req_i.op) + // VLXE, VSXE: begin + // state_d = ADDRGEN_IDX_OP; + + // // Load element pointers + // case (pe_req_i.eew_vs2) + // EW8: last_elm_subw_d = 7; + // EW16: last_elm_subw_d = 3; + // EW32: last_elm_subw_d = 1; + // EW64: last_elm_subw_d = 0; + // default: + // last_elm_subw_d = 0; + // endcase + + // // Load element counter + // idx_op_cnt_d = pe_req_i.vl; + // end + // default: state_d = ADDRGEN; + // endcase + // end + // end ADDRGEN: begin + // NOTE: indexed are not covered here + case (pe_req_q.op) + // Unit-stride: address = base + (vstart in elements) + VLE, VSE : vaddr_start = lookahead_addr_e_q; + // Strided: address = base + (vstart * stride) + VLSE, VSSE: vaddr_start = lookahead_addr_se_q; + // Indexed: let the next stage take care of vstart + VLXE, VSXE: vaddr_start = pe_req_q.scalar_op; + default : vaddr_start = '0; + endcase // pe_req_q.op + + // Start the computation already + addrgen_req = '{ + addr : vaddr_start, + len : lookahead_len_q, + stride : pe_req_q.stride, + vew : pe_req_q.vtype.vsew[1:0], + is_load : is_load(pe_req_q.op), + // Unit-strided loads/stores trigger incremental AXI bursts. + is_burst: (pe_req_q.op inside {VLE, VSE}), + vstart : pe_req_q.vstart + }; + // Ara does not support misaligned AXI requests - if (is_addr_error(pe_req_q.scalar_op, pe_req_q.vtype.vsew)) begin + if (is_addr_error(pe_req_q.scalar_op, pe_req_q.vtype.vsew[1:0])) begin state_d = IDLE; addrgen_ack_o = 1'b1; addrgen_error_o = 1'b1; - end else begin - addrgen_req = '{ - addr : pe_req_q.scalar_op, - len : pe_req_q.vl, - stride : pe_req_q.stride, - vew : pe_req_q.vtype.vsew, - is_load : is_load(pe_req_q.op), - // Unit-strided loads/stores trigger incremental AXI bursts. - is_burst: (pe_req_q.op inside {VLE, VSE}) - }; + end + else begin : address_valid addrgen_req_valid = 1'b1; - if (addrgen_req_ready) begin + if (addrgen_req_ready) begin : finished addrgen_req_valid = '0; addrgen_ack_o = 1'b1; state_d = IDLE; - end - end + end : finished + end : address_valid end + // ADDRGEN: begin + // // Ara does not support misaligned AXI requests + // if (is_addr_error(pe_req_q.scalar_op, pe_req_q.vtype.vsew)) begin + // state_d = IDLE; + // addrgen_ack_o = 1'b1; + // addrgen_error_o = 1'b1; + // end else begin + // addrgen_req = '{ + // addr : pe_req_q.scalar_op, + // len : pe_req_q.vl, + // stride : pe_req_q.stride, + // vew : pe_req_q.vtype.vsew, + // is_load : is_load(pe_req_q.op), + // // Unit-strided loads/stores trigger incremental AXI bursts. + // is_burst: (pe_req_q.op inside {VLE, VSE}) + // }; + // addrgen_req_valid = 1'b1; + + // if (addrgen_req_ready) begin + // addrgen_req_valid = '0; + // addrgen_ack_o = 1'b1; + // state_d = IDLE; + // end + // end + // end ADDRGEN_IDX_OP: begin + // NOTE: vstart is not supported for indexed operations + // the logic shuld be introduced: + // 1. in the addrgen_operand_i operand read + // 2. in idx_addr computation + automatic logic [NrLanes-1:0] addrgen_operand_valid; + // Stall the interface until the operation is over to catch possible exceptions // Every address can generate an exception addrgen_req = '{ addr : pe_req_q.scalar_op, - len : pe_req_q.vl, + len : lookahead_len_q, stride : pe_req_q.stride, - vew : pe_req_q.vtype.vsew, + vew : pe_req_q.vtype.vsew[1:0], is_load : is_load(pe_req_q.op), // Unit-strided loads/stores trigger incremental AXI bursts. - is_burst: 1'b0 + is_burst: 1'b0, + vstart : pe_req_q.vstart }; addrgen_req_valid = 1'b1; + // Adjust valid signals to the next block "operands_ready" + addrgen_operand_valid = addrgen_operand_valid_i; + for (int unsigned lane = 0; lane < NrLanes; lane++) begin : adjust_operand_valid + // - We are left with less byte than the maximim to issue, + // this means that at least one lane is not going to push us any operand anymore + // - For the lanes which index % NrLanes != 0 + if (((idx_op_cnt_q << pe_req_q.vtype.vsew) < (NrLanes * DataWidthB)) + && (lane < pe_req_q.vstart[idx_width(NrLanes)-1:0])) begin : vstart_lane_adjust + addrgen_operand_valid[lane] |= 1'b1; + end : vstart_lane_adjust + end : adjust_operand_valid + // TODO: apply the same vstart logic also to mask_valid_i + // Handle handshake and data between VRF and spill register // We accept all the incoming data, without any checks // since Ara stalls on an indexed memory operation - if (&addrgen_operand_valid_i & addrgen_operand_target_fu_i[0] == MFPU_ADDRGEN) begin + if (&addrgen_operand_valid) begin // Valid data for the spill register idx_addr_valid_d = 1'b1; @@ -346,7 +496,90 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( state_d = ADDRGEN_IDX_OP_END; end end - + // ADDRGEN_IDX_OP: begin + // // Stall the interface until the operation is over to catch possible exceptions + + // // Every address can generate an exception + // addrgen_req = '{ + // addr : pe_req_q.scalar_op, + // len : pe_req_q.vl, + // stride : pe_req_q.stride, + // vew : pe_req_q.vtype.vsew, + // is_load : is_load(pe_req_q.op), + // // Unit-strided loads/stores trigger incremental AXI bursts. + // is_burst: 1'b0 + // }; + // addrgen_req_valid = 1'b1; + + // // Handle handshake and data between VRF and spill register + // // We accept all the incoming data, without any checks + // // since Ara stalls on an indexed memory operation + // if (&addrgen_operand_valid_i & addrgen_operand_target_fu_i[0] == MFPU_ADDRGEN) begin + + // // Valid data for the spill register + // idx_addr_valid_d = 1'b1; + + // // Select the correct element, and zero extend it depending on vsew + // case (pe_req_q.eew_vs2) + // EW8: begin + // for (int unsigned b = 0; b < 8; b++) + // if (b == elm_ptr_q) + // idx_addr = reduced_word[b*8 +: 8]; + // end + // EW16: begin + // for (int unsigned h = 0; h < 4; h++) + // if (h == elm_ptr_q) + // idx_addr = reduced_word[h*16 +: 16]; + // end + // EW32: begin + // for (int unsigned w = 0; w < 2; w++) + // if (w == elm_ptr_q) + // idx_addr = reduced_word[w*32 +: 32]; + // end + // EW64: begin + // for (int unsigned d = 0; d < 1; d++) + // if (d == elm_ptr_q) + // idx_addr = reduced_word[d*64 +: 64]; + // end + // default: begin + // for (int unsigned b = 0; b < 8; b++) + // if (b == elm_ptr_q) + // idx_addr = reduced_word[b*8 +: 8]; + // end + // endcase + + // // Compose the address + // idx_final_addr_d = pe_req_q.scalar_op + idx_addr; + + // // When the data is accepted + // if (idx_addr_ready_q) begin + // // Consumed one element + // idx_op_cnt_d = idx_op_cnt_q - 1; + // // Have we finished a full NrLanes*64b word? + // if (elm_ptr_q == last_elm_subw_q) begin + // // Bump lane pointer + // elm_ptr_d = '0; + // word_lane_ptr_d += 1; + // if (word_lane_ptr_q == NrLanes - 1) begin + // // Ready for the next full word + // addrgen_operand_ready_o = 1'b1; + // end + // end else begin + // // Bump element pointer + // elm_ptr_d += 1; + // end + // end + + // if (idx_op_cnt_d == '0) begin + // // Give a ready to the lanes if this was not done before + // addrgen_operand_ready_o = 1'b1; + // end + // end + + // if (idx_op_error_d || addrgen_req_ready) begin + // state_d = ADDRGEN_IDX_OP_END; + // end + // end // This state exists not to create combinatorial paths on the interface ADDRGEN_IDX_OP_END : begin // Acknowledge the indexed memory operation @@ -358,9 +591,23 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( word_lane_ptr_d = '0; // Raise an error if necessary if (idx_op_error_q) begin + // In this case, we always get EEW-misaligned exceptions addrgen_error_o = 1'b1; end end + // ADDRGEN_IDX_OP_END : begin + // // Acknowledge the indexed memory operation + // addrgen_ack_o = 1'b1; + // addrgen_req_valid = '0; + // state_d = IDLE; + // // Reset pointers + // elm_ptr_d = '0; + // word_lane_ptr_d = '0; + // // Raise an error if necessary + // if (idx_op_error_q) begin + // addrgen_error_o = 1'b1; + // end + // end endcase end @@ -375,6 +622,9 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( last_elm_subw_q <= '0; idx_op_error_q <= '0; addrgen_error_vl_o <= '0; + lookahead_addr_e_q <= '0; + lookahead_addr_se_q <= '0; + lookahead_len_q <= '0; end else begin state_q <= state_d; pe_req_q <= pe_req_d; @@ -385,6 +635,9 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( last_elm_subw_q <= last_elm_subw_d; idx_op_error_q <= idx_op_error_d; addrgen_error_vl_o <= addrgen_error_vl_d; + lookahead_addr_e_q <= lookahead_addr_e_d; + lookahead_addr_se_q <= lookahead_addr_se_d; + lookahead_len_q <= lookahead_len_d; end end @@ -392,6 +645,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // Support for misaligned stores // ///////////////////////////////////// + localparam clog2_AxiStrobeWidth = $clog2(AxiDataWidth/8); + // AXI Request Generation signals, declared here for convenience addrgen_req_t axi_addrgen_d, axi_addrgen_q; @@ -430,8 +685,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( } axi_addrgen_state_d, axi_addrgen_state_q; axi_addr_t aligned_start_addr_d, aligned_start_addr_q; - axi_addr_t aligned_next_start_addr_d, aligned_next_start_addr_q; - axi_addr_t aligned_end_addr_d, aligned_end_addr_q; + axi_addr_t aligned_next_start_addr_d, aligned_next_start_addr_q, aligned_next_start_addr_temp; + axi_addr_t aligned_end_addr_d, aligned_end_addr_q, aligned_end_addr_temp; // MSb of the next-next page (page selector for page 2 positions after the current one) logic [($bits(aligned_start_addr_d) - 12)-1:0] next_2page_msb_d, next_2page_msb_q; @@ -439,6 +694,35 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( logic [$clog2(AxiDataWidth/8):0] eff_axi_dw_d, eff_axi_dw_q; logic [idx_width($clog2(AxiDataWidth/8)):0] eff_axi_dw_log_d, eff_axi_dw_log_q; + function automatic void set_end_addr ( + input logic [($bits(axi_addr_t) - 12)-1:0] next_2page_msb, + input vlen_t num_bytes, + input axi_addr_t addr, + input logic [clog2_AxiStrobeWidth:0] eff_axi_dw, + input logic [idx_width(clog2_AxiStrobeWidth):0] eff_axi_dw_log, + input axi_addr_t aligned_start_addr, + output axi_addr_t aligned_end_addr, + output axi_addr_t aligned_next_start_addr + ); + + automatic int unsigned max_burst_bytes = 256 << eff_axi_dw_log; + + // The final address can be found similarly... + if (num_bytes >= max_burst_bytes) begin + aligned_next_start_addr = aligned_addr(addr + max_burst_bytes, eff_axi_dw_log); + end else begin + aligned_next_start_addr = aligned_addr(addr + num_bytes - 1, eff_axi_dw_log) + eff_axi_dw; + end + aligned_end_addr = aligned_next_start_addr - 1; + + // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the + // same page as aligned_start_addr + if (aligned_start_addr[AxiAddrWidth-1:12] != aligned_end_addr[AxiAddrWidth-1:12]) begin + aligned_end_addr = {aligned_start_addr[AxiAddrWidth-1:12], 12'hFFF}; + aligned_next_start_addr = { next_2page_msb , 12'h000}; + end + endfunction + always_comb begin: axi_addrgen // Maintain state axi_addrgen_state_d = axi_addrgen_state_q; @@ -477,14 +761,42 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( case (axi_addrgen_state_q) AXI_ADDRGEN_IDLE: begin + // This computation is timing-critical. Look ahead and compute even if addr not valid. + axi_addrgen_d = addrgen_req; + + // The start address is found by aligning the original request address by the width of + // the memory interface. + aligned_start_addr_d = aligned_addr(axi_addrgen_d.addr, clog2_AxiStrobeWidth); + // Pre-calculate the next_2page_msb. This should not require much energy if the addr + // has zeroes in the upper positions. + // We can use this also for the misaligned address calculation, as the next 2 page msb + // will be the same either way. + next_2page_msb_d = aligned_start_addr_d[AxiAddrWidth-1:12] + 1; + // The final address can be found similarly... + set_end_addr ( + next_2page_msb_d, + axi_addrgen_d.len, + axi_addrgen_d.addr, + AxiDataWidth/8, + clog2_AxiStrobeWidth, + aligned_start_addr_d, + aligned_end_addr_d, + aligned_next_start_addr_d + ); + if (addrgen_req_valid) begin - axi_addrgen_d = addrgen_req; axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; // In case of a misaligned store, reduce the effective width of the AXI transaction, // since the store unit does not support misalignments between the AXI bus and the lanes - if ((axi_addrgen_d.addr[$clog2(AxiDataWidth/8)-1:0] != '0) && !axi_addrgen_d.is_load) - begin + if (axi_addrgen_d.vstart != 0 && !axi_addrgen_d.is_load) begin + // vstart > 0 can create problems similar to the ones a misalignment would create. + // Limit the effective AXI bus width to the element width to avoid problems. + axi_addrgen_state_d = AXI_ADDRGEN_MISALIGNED; + + eff_axi_dw_d = 1 << axi_addrgen_d.vew; + eff_axi_dw_log_d = axi_addrgen_d.vew; + end else if ((axi_addrgen_d.addr[clog2_AxiStrobeWidth-1:0] != '0) && !axi_addrgen_d.is_load) begin // Calculate the start and the end addresses in the AXI_ADDRGEN_MISALIGNED state axi_addrgen_state_d = AXI_ADDRGEN_MISALIGNED; @@ -492,86 +804,149 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( eff_axi_dw_log_d = zeroes_cnt; end else begin eff_axi_dw_d = AxiDataWidth/8; - eff_axi_dw_log_d = $clog2(AxiDataWidth/8); - end - - /*// The start address is found by aligning the original request address by the width of - // the memory interface. - aligned_start_addr_d = aligned_addr(axi_addrgen_d.addr, $clog2(AxiDataWidth/8)); - // Pre-calculate the next_2page_msb. This should not require much energy if the addr - // has zeroes in the upper positions. - next_2page_msb_d = aligned_start_addr_d[AxiAddrWidth-1:12] + 1; - // The final address can be found similarly... - if (axi_addrgen_d.len << int'(axi_addrgen_d.vew) >= (256 << $clog2(AxiDataWidth/8))) begin - aligned_next_start_addr_d = - aligned_addr(axi_addrgen_d.addr + (256 << $clog2(AxiDataWidth/8)), $clog2(AxiDataWidth/8)); - aligned_end_addr_d = aligned_next_start_addr_d - 1; - end else begin - aligned_next_start_addr_d = - aligned_addr(axi_addrgen_d.addr + (axi_addrgen_d.len << int'(axi_addrgen_d.vew)) - 1, - $clog2(AxiDataWidth/8)) + AxiDataWidth/8; - aligned_end_addr_d = aligned_next_start_addr_d - 1; + eff_axi_dw_log_d = clog2_AxiStrobeWidth; end - // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the - // same page as aligned_start_addr - if (aligned_start_addr_d[AxiAddrWidth-1:12] != aligned_end_addr_d[AxiAddrWidth-1:12]) begin - aligned_end_addr_d = {aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; - aligned_next_start_addr_d = { next_2page_msb_d, 12'h000}; - end*/ - - /*aligned_start_addr_d = axi_addrgen_d.addr; - aligned_next_start_addr_d = axi_addrgen_d.addr + (axi_addrgen_d.len << int'(axi_addrgen_d.vew)); - aligned_end_addr_d = aligned_next_start_addr_d - 1;*/ end end + // AXI_ADDRGEN_IDLE: begin + // if (addrgen_req_valid) begin + // axi_addrgen_d = addrgen_req; + // axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; + + // // In case of a misaligned store, reduce the effective width of the AXI transaction, + // // since the store unit does not support misalignments between the AXI bus and the lanes + // if ((axi_addrgen_d.addr[$clog2(AxiDataWidth/8)-1:0] != '0) && !axi_addrgen_d.is_load) + // begin + // // Calculate the start and the end addresses in the AXI_ADDRGEN_MISALIGNED state + // axi_addrgen_state_d = AXI_ADDRGEN_MISALIGNED; + + // eff_axi_dw_d = {1'b0, narrow_axi_data_bwidth}; + // eff_axi_dw_log_d = zeroes_cnt; + // end else begin + // eff_axi_dw_d = AxiDataWidth/8; + // eff_axi_dw_log_d = $clog2(AxiDataWidth/8); + // end + + // /*// The start address is found by aligning the original request address by the width of + // // the memory interface. + // aligned_start_addr_d = aligned_addr(axi_addrgen_d.addr, $clog2(AxiDataWidth/8)); + // // Pre-calculate the next_2page_msb. This should not require much energy if the addr + // // has zeroes in the upper positions. + // next_2page_msb_d = aligned_start_addr_d[AxiAddrWidth-1:12] + 1; + // // The final address can be found similarly... + // if (axi_addrgen_d.len << int'(axi_addrgen_d.vew) >= (256 << $clog2(AxiDataWidth/8))) begin + // aligned_next_start_addr_d = + // aligned_addr(axi_addrgen_d.addr + (256 << $clog2(AxiDataWidth/8)), $clog2(AxiDataWidth/8)); + // aligned_end_addr_d = aligned_next_start_addr_d - 1; + // end else begin + // aligned_next_start_addr_d = + // aligned_addr(axi_addrgen_d.addr + (axi_addrgen_d.len << int'(axi_addrgen_d.vew)) - 1, + // $clog2(AxiDataWidth/8)) + AxiDataWidth/8; + // aligned_end_addr_d = aligned_next_start_addr_d - 1; + // end + // // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the + // // same page as aligned_start_addr + // if (aligned_start_addr_d[AxiAddrWidth-1:12] != aligned_end_addr_d[AxiAddrWidth-1:12]) begin + // aligned_end_addr_d = {aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; + // aligned_next_start_addr_d = { next_2page_msb_d, 12'h000}; + // end*/ + + // /*aligned_start_addr_d = axi_addrgen_d.addr; + // aligned_next_start_addr_d = axi_addrgen_d.addr + (axi_addrgen_d.len << int'(axi_addrgen_d.vew)); + // aligned_end_addr_d = aligned_next_start_addr_d - 1;*/ + // end + // end AXI_ADDRGEN_MISALIGNED: begin axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; // The start address is found by aligning the original request address by the width of // the memory interface. aligned_start_addr_d = aligned_addr(axi_addrgen_q.addr, eff_axi_dw_log_q); - // The final address can be found similarly... - if (axi_addrgen_q.len << int'(axi_addrgen_q.vew) >= (256 << eff_axi_dw_log_q)) begin - aligned_next_start_addr_d = - aligned_addr(axi_addrgen_q.addr + (256 << eff_axi_dw_log_q), eff_axi_dw_log_q); - aligned_end_addr_d = aligned_next_start_addr_d - 1; - end else begin - aligned_next_start_addr_d = - aligned_addr(axi_addrgen_q.addr + (axi_addrgen_q.len << int'(axi_addrgen_q.vew)) - 1, - eff_axi_dw_log_q) + eff_axi_dw_q; - aligned_end_addr_d = aligned_next_start_addr_d - 1; - end - // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the - // same page as aligned_start_addr - if (aligned_start_addr_d[AxiAddrWidth-1:12] != aligned_end_addr_d[AxiAddrWidth-1:12]) begin - aligned_end_addr_d = {aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; - aligned_next_start_addr_d = { next_2page_msb_q, 12'h000}; - end + + set_end_addr ( + next_2page_msb_q, + axi_addrgen_q.len, + axi_addrgen_q.addr, + eff_axi_dw_q, + eff_axi_dw_log_q, + aligned_start_addr_d, + aligned_end_addr_d, + aligned_next_start_addr_d + ); end + // AXI_ADDRGEN_MISALIGNED: begin + // axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; + + // // The start address is found by aligning the original request address by the width of + // // the memory interface. + // aligned_start_addr_d = aligned_addr(axi_addrgen_q.addr, eff_axi_dw_log_q); + // // The final address can be found similarly... + // if (axi_addrgen_q.len << int'(axi_addrgen_q.vew) >= (256 << eff_axi_dw_log_q)) begin + // aligned_next_start_addr_d = + // aligned_addr(axi_addrgen_q.addr + (256 << eff_axi_dw_log_q), eff_axi_dw_log_q); + // aligned_end_addr_d = aligned_next_start_addr_d - 1; + // end else begin + // aligned_next_start_addr_d = + // aligned_addr(axi_addrgen_q.addr + (axi_addrgen_q.len << int'(axi_addrgen_q.vew)) - 1, + // eff_axi_dw_log_q) + eff_axi_dw_q; + // aligned_end_addr_d = aligned_next_start_addr_d - 1; + // end + // // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the + // // same page as aligned_start_addr + // if (aligned_start_addr_d[AxiAddrWidth-1:12] != aligned_end_addr_d[AxiAddrWidth-1:12]) begin + // aligned_end_addr_d = {aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; + // aligned_next_start_addr_d = { next_2page_msb_q, 12'h000}; + // end + // end AXI_ADDRGEN_WAITING: begin if (!core_st_pending_i) axi_addrgen_state_d = AXI_ADDRGEN_REQUESTING; end AXI_ADDRGEN_REQUESTING : begin - automatic logic axi_ax_ready = (axi_addrgen_q.is_load && axi_ar_ready_i) || (! - axi_addrgen_q.is_load && axi_aw_ready_i); + automatic logic axi_ax_ready = (axi_addrgen_q.is_load && axi_ar_ready_i) || (!axi_addrgen_q.is_load && axi_aw_ready_i); + automatic logic [12:0] num_bytes; // Cannot consume more than 4 KiB + automatic vlen_t remaining_bytes; // Pre-calculate the next_2page_msb. This should not require much energy if the addr // has zeroes in the upper positions. next_2page_msb_d = aligned_next_start_addr_q[AxiAddrWidth-1:12] + 1; + // Pre-calculate the bytes used in a unit-strided access and the remaining bytes to ask. + // The proper way to do so would be aligned_end_addr_q[11:0] + 1 - axi_addrgen_q.addr[11:0]. + // Avoid explicit computation of aligned_next_start_addr + 1 with a trick that works if + // aligned_next_start_addr <= 12'hFFF. + if (aligned_end_addr_q[11:0] != 12'hFFF) begin + num_bytes = aligned_next_start_addr_q[11:0] - axi_addrgen_q.addr[11:0]; + end else begin + // Special case: aligned_next_start_addr > 12'hFFF. + num_bytes = 13'h1000 - axi_addrgen_q.addr[11:0]; + end + // remaining_bytes = axi_addrgen_q.len - num_bytes; + // if (axi_addrgen_q.len < num_bytes) begin + // remaining_bytes = 0; + // end + remaining_bytes = 0; // Before starting a transaction on a different channel, wait the formers to complete // Otherwise, the ordering of the responses is not guaranteed, and with the current // implementation we can incur in deadlocks + // NOTE: this might be referring to an obsolete axi_cut implementation if (axi_addrgen_queue_empty || (axi_addrgen_req_o.is_load && axi_addrgen_q.is_load) || - (~axi_addrgen_req_o.is_load && ~axi_addrgen_q.is_load)) begin - if (!axi_addrgen_queue_full && axi_ax_ready) begin - if (axi_addrgen_q.is_burst) begin + (~axi_addrgen_req_o.is_load && ~axi_addrgen_q.is_load)) begin : axi_ax_idle + if (!axi_addrgen_queue_full && axi_ax_ready) begin : start_req + automatic axi_addr_t paddr; + + // Mux target address + paddr = axi_addrgen_q.addr; + // Prepare data in advance + if (axi_addrgen_q.is_burst) begin : unit_stride_data ///////////////////////// // Unit-Stride access // ///////////////////////// + // NOTE: all these variables could be narrowed to the minimum number of bits + automatic int unsigned num_beats; + // AXI burst length automatic int unsigned burst_length; @@ -580,37 +955,28 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // 2 - The AXI burst length cannot be longer than the number of beats required // to access the memory regions between aligned_start_addr and // aligned_end_addr - // if (burst_length > ((aligned_end_addr_q - aligned_start_addr_q) >> - // eff_axi_dw_log_q) + 1) - // burst_length = ((aligned_end_addr_q - aligned_start_addr_q) >> - // eff_axi_dw_log_q) + 1; + num_beats = ((aligned_end_addr_q[11:0] - aligned_start_addr_q[11:0]) >> eff_axi_dw_log_q) + 1; + if (burst_length > num_beats) begin + burst_length = num_beats; + end - burst_length = (((axi_addrgen_q.len << int'(axi_addrgen_q.vew))-1) >> eff_axi_dw_log_q) + 1; + burst_length = ((axi_addrgen_q.len-1) >> eff_axi_dw_log_q) + 1; - // if (burst_length > ((aligned_end_addr_q[11:0] - aligned_start_addr_q[11:0]) >> - // eff_axi_dw_log_q) + 1) - // burst_length = ((aligned_end_addr_q[11:0] - aligned_start_addr_q[11:0]) >> - // eff_axi_dw_log_q) + 1; - - // The above burst length is only used for vldu and vstu to know how many packets to receive. - // The AXI request to Memory in Global Ld-St unit takes care of the maximum burst limit. // AR Channel if (axi_addrgen_q.is_load) begin axi_ar_o = '{ - addr : axi_addrgen_q.addr, + addr : paddr, len : burst_length - 1, size : eff_axi_dw_log_q, cache : CACHE_MODIFIABLE, burst : BURST_INCR, default: '0 }; - vew_ar_o = axi_addrgen_q.vew; - axi_ar_valid_o = 1'b1; end // AW Channel else begin axi_aw_o = '{ - addr : axi_addrgen_q.addr, + addr : paddr, len : burst_length - 1, // If misaligned store access, reduce the effective AXI width // This hurts performance @@ -619,173 +985,432 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( burst : BURST_INCR, default: '0 }; - vew_aw_o = axi_addrgen_q.vew; - axi_aw_valid_o = 1'b1; end // Send this request to the load/store units axi_addrgen_queue = '{ - addr : axi_addrgen_q.addr, - len : burst_length - 1, - size : eff_axi_dw_log_q, - is_load: axi_addrgen_q.is_load + addr : paddr, + len : burst_length - 1, + size : eff_axi_dw_log_q, + is_load : axi_addrgen_q.is_load }; - axi_addrgen_queue_push = 1'b1; - // Account for the requested operands - /*axi_addrgen_d.len = axi_addrgen_q.len - ((aligned_end_addr_q[11:0] - axi_addrgen_q.addr[11:0] + 1) - >> int'(axi_addrgen_q.vew)); - if (axi_addrgen_q.len < ((aligned_end_addr_q[11:0] - axi_addrgen_q.addr[11:0] + 1) - >> int'(axi_addrgen_q.vew))) - axi_addrgen_d.len = 0; - axi_addrgen_d.addr = aligned_next_start_addr_q; - */ - // Finished generating AXI requests - // if (axi_addrgen_d.len == 0) begin - addrgen_req_ready = 1'b1; - axi_addrgen_state_d = AXI_ADDRGEN_IDLE; - // end - /* // Calculate the addresses for the next iteration + // TODO: test this for SEW!=64, otherwise this computation is never used // The start address is found by aligning the original request address by the width of // the memory interface. In our case, we have it already. - aligned_start_addr_d = axi_addrgen_d.addr; - // The final address can be found similarly. - // How many B we requested? No more than (256 << burst_size) - if (axi_addrgen_d.len << int'(axi_addrgen_q.vew) >= (256 << eff_axi_dw_log_q)) begin - aligned_next_start_addr_d = - aligned_addr(aligned_start_addr_d + (256 << eff_axi_dw_log_q), eff_axi_dw_log_q); - aligned_end_addr_d = aligned_next_start_addr_d - 1; - end else begin - aligned_next_start_addr_d = - aligned_addr(aligned_start_addr_d + (axi_addrgen_d.len << int'(axi_addrgen_q.vew)) - - 1, eff_axi_dw_log_q) + eff_axi_dw_q; - aligned_end_addr_d = aligned_next_start_addr_d - 1; - end - // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the - // same page as aligned_start_addr - if (aligned_start_addr_d[AxiAddrWidth-1:12] != aligned_end_addr_d[AxiAddrWidth-1:12]) begin - aligned_end_addr_d = {aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; - aligned_next_start_addr_d = { next_2page_msb_d, 12'h000}; - end*/ - - end else if (state_q != ADDRGEN_IDX_OP) begin - + set_end_addr ( + next_2page_msb_d, + axi_addrgen_q.len - num_bytes, + aligned_next_start_addr_q, + eff_axi_dw_q, + eff_axi_dw_log_q, + aligned_next_start_addr_q, + aligned_end_addr_temp, + aligned_next_start_addr_temp + ); + end : unit_stride_data + else if (state_q != ADDRGEN_IDX_OP) begin : strided_data ///////////////////// // Strided access // ///////////////////// - // AR Channel if (axi_addrgen_q.is_load) begin axi_ar_o = '{ - addr : axi_addrgen_q.addr, + addr : paddr, len : 0, size : axi_addrgen_q.vew, cache : CACHE_MODIFIABLE, burst : BURST_INCR, default: '0 }; - axi_ar_valid_o = 1'b1; end // AW Channel else begin axi_aw_o = '{ - addr : axi_addrgen_q.addr, + addr : paddr, len : 0, size : axi_addrgen_q.vew, cache : CACHE_MODIFIABLE, burst : BURST_INCR, default: '0 }; - axi_aw_valid_o = 1'b1; end // Send this request to the load/store units axi_addrgen_queue = '{ - addr : axi_addrgen_q.addr, - size : axi_addrgen_q.vew, - len : 0, - is_load: axi_addrgen_q.is_load + addr : paddr, + size : axi_addrgen_q.vew, + len : 0, + is_load : axi_addrgen_q.is_load }; - axi_addrgen_queue_push = 1'b1; // Account for the requested operands - axi_addrgen_d.len = axi_addrgen_q.len - 1; + // This should never overflow + len_temp = axi_addrgen_q.len - (1 << axi_addrgen_q.vew); // Calculate the addresses for the next iteration, adding the correct stride - axi_addrgen_d.addr = axi_addrgen_q.addr + axi_addrgen_q.stride; - - // Finished generating AXI requests - if (axi_addrgen_d.len == 0) begin - addrgen_req_ready = 1'b1; - axi_addrgen_state_d = AXI_ADDRGEN_IDLE; - end - end else begin + next_addr_strided_temp = axi_addrgen_q.addr + axi_addrgen_q.stride; + end : strided_data + else begin : indexed_data + // NOTE: address translation is not yet been implemented/tested for indexed + automatic axi_addr_t idx_final_paddr; ////////////////////// // Indexed access // ////////////////////// - if (idx_addr_valid_q) begin - // We consumed a word - idx_addr_ready_d = 1'b1; - - // AR Channel - if (axi_addrgen_q.is_load) begin - axi_ar_o = '{ - addr : idx_final_addr_q, - len : 0, - size : axi_addrgen_q.vew, - cache : CACHE_MODIFIABLE, - burst : BURST_INCR, - default: '0 - }; - axi_ar_valid_o = 1'b1; - end - // AW Channel - else begin - axi_aw_o = '{ - addr : idx_final_addr_q, - len : 0, - size : axi_addrgen_q.vew, - cache : CACHE_MODIFIABLE, - burst : BURST_INCR, - default: '0 - }; - axi_aw_valid_o = 1'b1; - end - - // Send this request to the load/store units - axi_addrgen_queue = '{ - addr : idx_final_addr_q, - size : axi_addrgen_q.vew, - len : 0, - is_load: axi_addrgen_q.is_load - }; - axi_addrgen_queue_push = 1'b1; - - // Account for the requested operands - axi_addrgen_d.len = axi_addrgen_q.len - 1; - - // Check if the address does generate an exception - if (is_addr_error(idx_final_addr_q, axi_addrgen_q.vew)) begin + // TODO: check if idx_addr_valid_q is stable + if (idx_addr_valid_q) begin : if_idx_addr_valid_q + // Check if the virtual address generates an exception + // NOTE: we can do this even before address translation, since the + // page offset (2^12) is the same for both physical and virtual addresses + if (is_addr_error(idx_final_addr_q, axi_addrgen_q.vew[1:0])) begin : eew_misaligned_error // Generate an error idx_op_error_d = 1'b1; // Forward next vstart info to the dispatcher addrgen_error_vl_d = addrgen_req.len - axi_addrgen_q.len - 1; addrgen_req_ready = 1'b1; axi_addrgen_state_d = AXI_ADDRGEN_IDLE; - end + end : eew_misaligned_error + else begin : aligned_vaddress + // Mux target address + idx_final_paddr = idx_final_addr_q; + + // AR Channel + if (axi_addrgen_q.is_load) begin + axi_ar_o = '{ + addr : idx_final_paddr, + len : 0, + size : axi_addrgen_q.vew, + cache : CACHE_MODIFIABLE, + burst : BURST_INCR, + default: '0 + }; + end + // AW Channel + else begin + axi_aw_o = '{ + addr : idx_final_paddr, + len : 0, + size : axi_addrgen_q.vew, + cache : CACHE_MODIFIABLE, + burst : BURST_INCR, + default: '0 + }; + end + + // Prepare the request for the load or store unit + axi_addrgen_queue = '{ + addr : idx_final_paddr, + size : axi_addrgen_q.vew, + len : 0, + is_load : axi_addrgen_q.is_load + }; - // Finished generating AXI requests - if (axi_addrgen_d.len == 0) begin - addrgen_req_ready = 1'b1; - axi_addrgen_state_d = AXI_ADDRGEN_IDLE; - end - end - end + // Account for the requested operands + // This should never overflow + len_temp = axi_addrgen_q.len - (1 << axi_addrgen_q.vew); + end : aligned_vaddress + end : if_idx_addr_valid_q + end : indexed_data + + if (axi_addrgen_q.is_burst) begin : unit_stride // UNIT-STRIDED ACCESS + // AR Channel + axi_ar_valid_o = axi_addrgen_q.is_load; + // AW Channel + axi_aw_valid_o = ~axi_addrgen_q.is_load; + + // Send this request to the load/store units + axi_addrgen_queue_push = 1'b1; + + // We pre-calculated the values already + axi_addrgen_d.len = remaining_bytes; + axi_addrgen_d.addr = aligned_next_start_addr_q; + + aligned_start_addr_d = axi_addrgen_d.addr; + aligned_end_addr_d = aligned_end_addr_temp; + aligned_next_start_addr_d = aligned_next_start_addr_temp; + end : unit_stride + else if (state_q != ADDRGEN_IDX_OP) begin : strided // STRIDED ACCESS + // AR Channel + axi_ar_valid_o = axi_addrgen_q.is_load; + // AW Channel + axi_aw_valid_o = ~axi_addrgen_q.is_load; + + // Send this request to the load/store units + axi_addrgen_queue_push = 1'b1; + + // We pre-calculated the values already + axi_addrgen_d.len = len_temp; + axi_addrgen_d.addr = next_addr_strided_temp; + end : strided + else begin : indexed // INDEXED ACCESS + automatic axi_addr_t idx_final_paddr; + // TODO: check if idx_addr_valid_q is stable + if (idx_addr_valid_q) begin : if_idx_addr_valid_q + + // Check if the virtual address generates an exception + // NOTE: we can do this even before address translation, since the + // page offset (2^12) is the same for both physical and virtual addresses + if (!is_addr_error(idx_final_addr_q, axi_addrgen_q.vew[1:0])) begin : aligned_vaddress + // We consumed a word + idx_addr_ready_d = 1'b1; + + // AR Channel + axi_ar_valid_o = axi_addrgen_q.is_load; + // AW Channel + axi_aw_valid_o = ~axi_addrgen_q.is_load; + + // Send this request to the load/store units + axi_addrgen_queue_push = 1'b1; + + // We pre-calculated the values already + axi_addrgen_d.len = len_temp; + end : aligned_vaddress + end : if_idx_addr_valid_q + end : indexed + // Finished generating AXI requests + if (axi_addrgen_d.len == 0) begin : finished + addrgen_req_ready = 1'b1; + axi_addrgen_state_d = AXI_ADDRGEN_IDLE; + end : finished end end end + // AXI_ADDRGEN_REQUESTING : begin + // automatic logic axi_ax_ready = (axi_addrgen_q.is_load && axi_ar_ready_i) || (! + // axi_addrgen_q.is_load && axi_aw_ready_i); + + // // Pre-calculate the next_2page_msb. This should not require much energy if the addr + // // has zeroes in the upper positions. + // next_2page_msb_d = aligned_next_start_addr_q[AxiAddrWidth-1:12] + 1; + + // // Before starting a transaction on a different channel, wait the formers to complete + // // Otherwise, the ordering of the responses is not guaranteed, and with the current + // // implementation we can incur in deadlocks + // if (axi_addrgen_queue_empty || (axi_addrgen_req_o.is_load && axi_addrgen_q.is_load) || + // (~axi_addrgen_req_o.is_load && ~axi_addrgen_q.is_load)) begin + // if (!axi_addrgen_queue_full && axi_ax_ready) begin + // if (axi_addrgen_q.is_burst) begin + + // ///////////////////////// + // // Unit-Stride access // + // ///////////////////////// + + // // AXI burst length + // automatic int unsigned burst_length; + + // // 1 - AXI bursts are at most 256 beats long. + // burst_length = 256; + // // 2 - The AXI burst length cannot be longer than the number of beats required + // // to access the memory regions between aligned_start_addr and + // // aligned_end_addr + // // if (burst_length > ((aligned_end_addr_q - aligned_start_addr_q) >> + // // eff_axi_dw_log_q) + 1) + // // burst_length = ((aligned_end_addr_q - aligned_start_addr_q) >> + // // eff_axi_dw_log_q) + 1; + + // burst_length = (((axi_addrgen_q.len << int'(axi_addrgen_q.vew))-1) >> eff_axi_dw_log_q) + 1; + + // // if (burst_length > ((aligned_end_addr_q[11:0] - aligned_start_addr_q[11:0]) >> + // // eff_axi_dw_log_q) + 1) + // // burst_length = ((aligned_end_addr_q[11:0] - aligned_start_addr_q[11:0]) >> + // // eff_axi_dw_log_q) + 1; + + // // The above burst length is only used for vldu and vstu to know how many packets to receive. + // // The AXI request to Memory in Global Ld-St unit takes care of the maximum burst limit. + // // AR Channel + // if (axi_addrgen_q.is_load) begin + // axi_ar_o = '{ + // addr : axi_addrgen_q.addr, + // len : burst_length - 1, + // size : eff_axi_dw_log_q, + // cache : CACHE_MODIFIABLE, + // burst : BURST_INCR, + // default: '0 + // }; + // vew_ar_o = axi_addrgen_q.vew; + // axi_ar_valid_o = 1'b1; + // end + // // AW Channel + // else begin + // axi_aw_o = '{ + // addr : axi_addrgen_q.addr, + // len : burst_length - 1, + // // If misaligned store access, reduce the effective AXI width + // // This hurts performance + // size : eff_axi_dw_log_q, + // cache : CACHE_MODIFIABLE, + // burst : BURST_INCR, + // default: '0 + // }; + // vew_aw_o = axi_addrgen_q.vew; + // axi_aw_valid_o = 1'b1; + // end + + // // Send this request to the load/store units + // axi_addrgen_queue = '{ + // addr : axi_addrgen_q.addr, + // len : burst_length - 1, + // size : eff_axi_dw_log_q, + // is_load: axi_addrgen_q.is_load + // }; + // axi_addrgen_queue_push = 1'b1; + + // // Account for the requested operands + // /*axi_addrgen_d.len = axi_addrgen_q.len - ((aligned_end_addr_q[11:0] - axi_addrgen_q.addr[11:0] + 1) + // >> int'(axi_addrgen_q.vew)); + // if (axi_addrgen_q.len < ((aligned_end_addr_q[11:0] - axi_addrgen_q.addr[11:0] + 1) + // >> int'(axi_addrgen_q.vew))) + // axi_addrgen_d.len = 0; + // axi_addrgen_d.addr = aligned_next_start_addr_q; + // */ + // // Finished generating AXI requests + // // if (axi_addrgen_d.len == 0) begin + // addrgen_req_ready = 1'b1; + // axi_addrgen_state_d = AXI_ADDRGEN_IDLE; + // // end + // /* + // // Calculate the addresses for the next iteration + // // The start address is found by aligning the original request address by the width of + // // the memory interface. In our case, we have it already. + // aligned_start_addr_d = axi_addrgen_d.addr; + // // The final address can be found similarly. + // // How many B we requested? No more than (256 << burst_size) + // if (axi_addrgen_d.len << int'(axi_addrgen_q.vew) >= (256 << eff_axi_dw_log_q)) begin + // aligned_next_start_addr_d = + // aligned_addr(aligned_start_addr_d + (256 << eff_axi_dw_log_q), eff_axi_dw_log_q); + // aligned_end_addr_d = aligned_next_start_addr_d - 1; + // end else begin + // aligned_next_start_addr_d = + // aligned_addr(aligned_start_addr_d + (axi_addrgen_d.len << int'(axi_addrgen_q.vew)) + // - 1, eff_axi_dw_log_q) + eff_axi_dw_q; + // aligned_end_addr_d = aligned_next_start_addr_d - 1; + // end + // // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the + // // same page as aligned_start_addr + // if (aligned_start_addr_d[AxiAddrWidth-1:12] != aligned_end_addr_d[AxiAddrWidth-1:12]) begin + // aligned_end_addr_d = {aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; + // aligned_next_start_addr_d = { next_2page_msb_d, 12'h000}; + // end*/ + + // end else if (state_q != ADDRGEN_IDX_OP) begin + + // ///////////////////// + // // Strided access // + // ///////////////////// + + // // AR Channel + // if (axi_addrgen_q.is_load) begin + // axi_ar_o = '{ + // addr : axi_addrgen_q.addr, + // len : 0, + // size : axi_addrgen_q.vew, + // cache : CACHE_MODIFIABLE, + // burst : BURST_INCR, + // default: '0 + // }; + // axi_ar_valid_o = 1'b1; + // end + // // AW Channel + // else begin + // axi_aw_o = '{ + // addr : axi_addrgen_q.addr, + // len : 0, + // size : axi_addrgen_q.vew, + // cache : CACHE_MODIFIABLE, + // burst : BURST_INCR, + // default: '0 + // }; + // axi_aw_valid_o = 1'b1; + // end + + // // Send this request to the load/store units + // axi_addrgen_queue = '{ + // addr : axi_addrgen_q.addr, + // size : axi_addrgen_q.vew, + // len : 0, + // is_load: axi_addrgen_q.is_load + // }; + // axi_addrgen_queue_push = 1'b1; + + // // Account for the requested operands + // axi_addrgen_d.len = axi_addrgen_q.len - 1; + // // Calculate the addresses for the next iteration, adding the correct stride + // axi_addrgen_d.addr = axi_addrgen_q.addr + axi_addrgen_q.stride; + + // // Finished generating AXI requests + // if (axi_addrgen_d.len == 0) begin + // addrgen_req_ready = 1'b1; + // axi_addrgen_state_d = AXI_ADDRGEN_IDLE; + // end + // end else begin + + // ////////////////////// + // // Indexed access // + // ////////////////////// + + // if (idx_addr_valid_q) begin + // // We consumed a word + // idx_addr_ready_d = 1'b1; + + // // AR Channel + // if (axi_addrgen_q.is_load) begin + // axi_ar_o = '{ + // addr : idx_final_addr_q, + // len : 0, + // size : axi_addrgen_q.vew, + // cache : CACHE_MODIFIABLE, + // burst : BURST_INCR, + // default: '0 + // }; + // axi_ar_valid_o = 1'b1; + // end + // // AW Channel + // else begin + // axi_aw_o = '{ + // addr : idx_final_addr_q, + // len : 0, + // size : axi_addrgen_q.vew, + // cache : CACHE_MODIFIABLE, + // burst : BURST_INCR, + // default: '0 + // }; + // axi_aw_valid_o = 1'b1; + // end + + // // Send this request to the load/store units + // axi_addrgen_queue = '{ + // addr : idx_final_addr_q, + // size : axi_addrgen_q.vew, + // len : 0, + // is_load: axi_addrgen_q.is_load + // }; + // axi_addrgen_queue_push = 1'b1; + + // // Account for the requested operands + // axi_addrgen_d.len = axi_addrgen_q.len - 1; + + // // Check if the address does generate an exception + // if (is_addr_error(idx_final_addr_q, axi_addrgen_q.vew)) begin + // // Generate an error + // idx_op_error_d = 1'b1; + // // Forward next vstart info to the dispatcher + // addrgen_error_vl_d = addrgen_req.len - axi_addrgen_q.len - 1; + // addrgen_req_ready = 1'b1; + // axi_addrgen_state_d = AXI_ADDRGEN_IDLE; + // end + + // // Finished generating AXI requests + // if (axi_addrgen_d.len == 0) begin + // addrgen_req_ready = 1'b1; + // axi_addrgen_state_d = AXI_ADDRGEN_IDLE; + // end + // end + // end + // end + // end + // end endcase end: axi_addrgen diff --git a/hardware/src/vlsu/global_dispatcher.sv b/hardware/src/vlsu/global_dispatcher.sv index e4bb34b..94f6432 100644 --- a/hardware/src/vlsu/global_dispatcher.sv +++ b/hardware/src/vlsu/global_dispatcher.sv @@ -112,12 +112,12 @@ module global_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || // (vlen_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_t'(acc_req_i.rs1); if (((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || - (vlen_t'(acc_req_i.rs1) > vlmax))) begin + (vlen_cl_t'(acc_req_i.rs1) > vlmax))) begin vl_d = vlmax; - end else if (vlen_t'(acc_req_i.rs1) < NrClusters * NrLanes) begin - vl_d = NrClusters * NrLanes; + end else if (|vlen_cl_t'(acc_req_i.rs1[$clog2(NrClusters * NrLanes)-1:0])) begin + vl_d = vlen_cl_t'(((acc_req_i.rs1 >> $clog2(NrClusters * NrLanes)) + 1) << $clog2(NrClusters * NrLanes)); end else begin - vl_d = vlen_t'(acc_req_i.rs1); + vl_d = vlen_cl_t'(acc_req_i.rs1); end end end diff --git a/hardware/src/vlsu/shuffle_stage.sv b/hardware/src/vlsu/shuffle_stage.sv index 9f61521..ec6412d 100644 --- a/hardware/src/vlsu/shuffle_stage.sv +++ b/hardware/src/vlsu/shuffle_stage.sv @@ -213,8 +213,9 @@ logic [NumBuffers-1:0] shift_d, shift_q; // For each b logic [NumBuffers-1:0] buf_valid_d, buf_valid_q; logic r_ready_buf, r_ready_buf_q; -logic rd_buffer_en; +logic rd_buffer_en, rd_buffer_en_last_stage; assign rd_buffer_en = rd_tracker_q[rd_issue_pnt_q[0]].buffer_en; +assign rd_buffer_en_last_stage = rd_tracker_q[rd_issue_pnt_q[1]].buffer_en; // Write packets logic [NrClusters-1:0] [ClusterAxiDataWidth*2-1:0] wrbuf_d, wrbuf_q; @@ -504,8 +505,10 @@ for (genvar c=0; c < NrClusters; c++) begin // Reads assign r_data_in[0][c] = rd_buffer_en ? '0 : axi_resp_i[c].r; // Copy input resp to first stage - assign axi_resp_o[c].r = rd_buffer_en ? axi_resp_buf_out[c].r : r_data_out[NumStages-1][c]; // Copy output resp from last stage - assign axi_resp_o[c].r_valid = rd_buffer_en ? axi_resp_buf_out[c].r_valid : r_valid_o[c]; // Copy valid from stream fork to output + // assign axi_resp_o[c].r = rd_buffer_en ? axi_resp_buf_out[c].r : r_data_out[NumStages-1][c]; // Copy output resp from last stage + // assign axi_resp_o[c].r_valid = rd_buffer_en ? axi_resp_buf_out[c].r_valid : r_valid_o[c]; // Copy valid from stream fork to output + assign axi_resp_o[c].r = rd_buffer_en_last_stage ? axi_resp_buf_out[c].r : r_data_out[NumStages-1][c]; // Copy output resp from last stage + assign axi_resp_o[c].r_valid = rd_buffer_en_last_stage ? axi_resp_buf_out[c].r_valid : r_valid_o[c]; // Copy valid from stream fork to output // Writes assign axi_resp_o[c].w_ready = wr_buffer_en ? ~wrbuf_full[c] : w_ready_o[c]; // Copy ready from stream join output to response diff --git a/hardware/src/vlsu/vldu.sv b/hardware/src/vlsu/vldu.sv index 00b87dd..56a6a7d 100644 --- a/hardware/src/vlsu/vldu.sv +++ b/hardware/src/vlsu/vldu.sv @@ -1,4 +1,4 @@ -// Copyright 2021-2025 ETH Zurich and University of Bologna. +// Copyright 2021 ETH Zurich and University of Bologna. // Solderpad Hardware License, Version 0.51, see LICENSE for details. // SPDX-License-Identifier: SHL-0.51 // @@ -8,8 +8,8 @@ // upon receiving vector memory operations. module vldu import ara_pkg::*; import rvv_pkg::*; #( - parameter int unsigned NrLanes = 0, - parameter type vaddr_t = logic, // Type used to address vector register file elements + parameter int unsigned NrLanes = 0, + parameter type vaddr_t = logic, // Type used to address vector register file elements // AXI Interface parameters parameter int unsigned AxiDataWidth = 0, parameter int unsigned AxiAddrWidth = 0, @@ -52,10 +52,43 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( ); import cf_math_pkg::idx_width; - import axi_pkg::beat_lower_byte; - import axi_pkg::beat_upper_byte; + // import axi_pkg::beat_lower_byte; + // import axi_pkg::beat_upper_byte; import axi_pkg::BURST_INCR; + //////////////// + // MASK cut // + //////////////// + + strb_t [NrLanes-1:0] mask_q; + logic [NrLanes-1:0] mask_valid_d, mask_valid_q; + logic mask_ready_d; + logic [NrLanes-1:0] mask_ready_q; + // Insn queue related signal + pe_req_t vinsn_issue_d, vinsn_issue_q; + logic vinsn_issue_valid; + + for (genvar l = 0; l < NrLanes; l++) begin + spill_register #( + .T(strb_t) + ) i_vldu_mask_register ( + .clk_i (clk_i ), + .rst_ni (rst_ni ), + .data_o (mask_q[l] ), + .valid_o (mask_valid_q[l] ), + .ready_i (mask_ready_d ), + .data_i (mask_i[l] ), + .valid_i (mask_valid_d[l] ), + .ready_o (mask_ready_q[l] ) + ); + + // Sample only SLDU mask valid + assign mask_valid_d[l] = mask_valid_i[l] & ~vinsn_issue_q.vm & vinsn_issue_valid; + end + + // Don't upset the masku with a spurious ready + assign mask_ready_o = mask_ready_q[0] & mask_valid_i[0] & ~vinsn_issue_q.vm & vinsn_issue_valid; + //////////////////////////////// // Vector instruction queue // //////////////////////////////// @@ -91,8 +124,6 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( assign vinsn_queue_full = (vinsn_queue_q.commit_cnt == VInsnQueueDepth); // Do we have a vector instruction ready to be issued? - pe_req_t vinsn_issue_d, vinsn_issue_q; - logic vinsn_issue_valid; assign vinsn_issue_d = vinsn_queue_d.vinsn[vinsn_queue_d.issue_pnt]; assign vinsn_issue_valid = (vinsn_queue_q.issue_cnt != '0); @@ -136,7 +167,7 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( // reading from and writing into the lanes (read_pnt). logic [idx_width(ResultQueueDepth)-1:0] result_queue_write_pnt_d, result_queue_write_pnt_q; logic [idx_width(ResultQueueDepth)-1:0] result_queue_read_pnt_d, result_queue_read_pnt_q; - // We need to count how many valid elements are there in this result queue. + // We need to count how many valid elements (payload_t) are there in this result queue. logic [idx_width(ResultQueueDepth):0] result_queue_cnt_d, result_queue_cnt_q; // Vector to register the final grants from the operand requesters, which indicate // that the result was actually written in the VRF (while the normal grant just says @@ -174,33 +205,57 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( logic [NrVInsn-1:0] vinsn_running_d, vinsn_running_q; // Interface with the main sequencer - pe_resp_t pe_resp; + pe_resp_t pe_resp_d; // Remaining bytes of the current instruction in the issue phase - vlen_t issue_cnt_d, issue_cnt_q; + vlen_t issue_cnt_bytes_d, issue_cnt_bytes_q; // Remaining bytes of the current instruction in the commit phase - vlen_t commit_cnt_d, commit_cnt_q; + vlen_t commit_cnt_bytes_d, commit_cnt_bytes_q; // Pointers // // We need several pointers to copy data from the memory interface // into the VRF. Namely, we need: // - A counter of how many beats are left in the current AXI burst - axi_pkg::len_t len_d, len_q; + axi_pkg::len_t axi_len_d, axi_len_q; // - A pointer to which byte in the current R beat we are reading data from. - logic [idx_width(AxiDataWidth/8):0] r_pnt_d, r_pnt_q; + logic [idx_width(AxiDataWidth/8):0] axi_r_byte_pnt_d, axi_r_byte_pnt_q; // - A pointer to which byte in the full VRF word we are writing data into. - logic [idx_width(DataWidth*NrLanes/8):0] vrf_pnt_d, vrf_pnt_q; + logic [idx_width(DataWidth*NrLanes/8):0] vrf_word_byte_pnt_d, vrf_word_byte_pnt_q; + // - A pointer that indicates the start byte in the vrf word. + logic [$clog2(8*NrLanes)-1:0] vrf_word_start_byte; + + // A counter that follows the vrf_word_byte_pnt pointer, but without the vstart information + // We can compare this counter witht the issue_cnt_bytes counter to find the last byte in + // our transaction + logic [idx_width(DataWidth*NrLanes/8):0] vrf_word_byte_cnt_d, vrf_word_byte_cnt_q; + + // When vstart > 0, the very first payload written to the VRF contains less than + // (8 * NrLanes) bytes. + logic [$clog2(8*NrLanes):0] first_payload_byte_d, first_payload_byte_q; + logic [$clog2(8*NrLanes):0] vrf_eff_write_bytes; + // Same thing, but for the commit (resqueue -> VRF) + // Track if this VRF write is the first one for this instruction + logic first_result_queue_read_d, first_result_queue_read_q; + logic [$clog2(8*NrLanes):0] res_queue_eff_write_bytes; + + // Signal that the current burst is having an exception + logic ldu_current_burst_exception_d; + + // Counter to increase the VRF write address. + vlen_t seq_word_wr_offset_d, seq_word_wr_offset_q; + + localparam unsigned DataWidthB = DataWidth / 8; always_comb begin: p_vldu // Maintain state vinsn_queue_d = vinsn_queue_q; - issue_cnt_d = issue_cnt_q; - commit_cnt_d = commit_cnt_q; + issue_cnt_bytes_d = issue_cnt_bytes_q; + commit_cnt_bytes_d = commit_cnt_bytes_q; - len_d = len_q; - r_pnt_d = r_pnt_q; - vrf_pnt_d = vrf_pnt_q; + axi_len_d = axi_len_q; + axi_r_byte_pnt_d = axi_r_byte_pnt_q; + vrf_word_byte_pnt_d = vrf_word_byte_pnt_q; result_queue_d = result_queue_q; result_queue_valid_d = result_queue_valid_q; @@ -210,16 +265,28 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( result_final_gnt_d = result_final_gnt_q; + seq_word_wr_offset_d = seq_word_wr_offset_q; + first_payload_byte_d = first_payload_byte_q; + vrf_word_byte_cnt_d = vrf_word_byte_cnt_q; + // Vector instructions currently running vinsn_running_d = vinsn_running_q & pe_vinsn_running_i; // We are not ready, by default axi_addrgen_req_ready_o = 1'b0; - pe_resp = '0; + pe_resp_d = '0; axi_r_ready_o = 1'b0; - mask_ready_o = 1'b0; + mask_ready_d = 1'b0; load_complete_o = 1'b0; + first_result_queue_read_d = first_result_queue_read_q; + + // Normally write multiple of resqueue width + vrf_eff_write_bytes = (NrLanes * DataWidthB); + res_queue_eff_write_bytes = (NrLanes * DataWidthB); + + ldu_current_burst_exception_d = 1'b0; + // Inform the main sequencer if we are idle pe_req_ready_o = !vinsn_queue_full; @@ -231,129 +298,164 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( // - There is an R beat available. // - The Address Generator sent us the data about the corresponding AR beat // - There is place in the result queue to write the data read from the R channel + // - This request did not generate an exception if (axi_r_valid_i && axi_addrgen_req_valid_i - && axi_addrgen_req_i.is_load && !result_queue_full) begin - // Bytes valid in the current R beat - // If non-unit strided load, we do not progress within the beat - automatic shortint unsigned lower_byte = beat_lower_byte(axi_addrgen_req_i.addr, - axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, len_q); - automatic shortint unsigned upper_byte = beat_upper_byte(axi_addrgen_req_i.addr, - axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, len_q); + && axi_addrgen_req_i.is_load && !result_queue_full) begin : axi_r_beat_read + // // Bytes valid in the current R beat + // // If non-unit strided load, we do not progress within the beat + // automatic logic [idx_width(AxiDataWidth/8)-1:0] lower_byte = beat_lower_byte(axi_addrgen_req_i.addr, + // axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, axi_len_q); + // automatic logic [idx_width(AxiDataWidth/8)-1:0] upper_byte = beat_upper_byte(axi_addrgen_req_i.addr, + // axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, axi_len_q); // Is there a vector instruction ready to be issued? // Do we have the operands for it? - if (vinsn_issue_valid && (vinsn_issue_q.vm || (|mask_valid_i))) begin + if (vinsn_issue_valid && (vinsn_issue_q.vm || (|mask_valid_q))) begin : operands_valid // Account for the issued bytes // How many bytes are valid in this VRF word - automatic vlen_t vrf_valid_bytes = NrLanes * 8 - vrf_pnt_q; + automatic vlen_t vrf_valid_bytes = (NrLanes * DataWidthB) - vrf_word_byte_pnt_q; // How many bytes are valid in this instruction - automatic vlen_t vinsn_valid_bytes = issue_cnt_q - vrf_pnt_q; + automatic vlen_t vinsn_valid_bytes = issue_cnt_bytes_q - vrf_word_byte_cnt_q; // How many bytes are valid in this AXI word automatic vlen_t axi_valid_bytes = AxiDataWidth/8; // upper_byte - lower_byte - r_pnt_q + 1; + // How many bytes are we committing? automatic logic [idx_width(DataWidth*NrLanes/8):0] valid_bytes; - valid_bytes = issue_cnt_q < NrLanes * 8 ? vinsn_valid_bytes : vrf_valid_bytes; - valid_bytes = valid_bytes < axi_valid_bytes ? valid_bytes : axi_valid_bytes; + valid_bytes = (issue_cnt_bytes_q < (NrLanes * DataWidthB)) ? vinsn_valid_bytes : vrf_valid_bytes; + valid_bytes = (valid_bytes < axi_valid_bytes ) ? valid_bytes : axi_valid_bytes; - r_pnt_d = r_pnt_q + valid_bytes; - vrf_pnt_d = vrf_pnt_q + valid_bytes; + // Bump R beat and VRF word pointers + axi_r_byte_pnt_d = axi_r_byte_pnt_q + valid_bytes; + vrf_word_byte_pnt_d = vrf_word_byte_pnt_q + valid_bytes; + vrf_word_byte_cnt_d = vrf_word_byte_cnt_q + valid_bytes; // Copy data from the R channel into the result queue - for (int axi_byte = 0; axi_byte < AxiDataWidth/8; axi_byte++) begin + for (int unsigned axi_byte = 0; axi_byte < AxiDataWidth/8; axi_byte++) begin : axi_r_to_result_queue // Map axi_byte to the corresponding byte in the VRF word (sequential) - // And then shuffle it - shuffling has 2 components - // First AxiDataWidth/8 byte indices are found from shuffle_index - // Second, for the next axi packets only the additional offset change depending on vrf_pnt_q - automatic int vrf_byte = shuffle_index(axi_byte, NrLanes, vinsn_issue_q.vtype.vsew); - automatic int vrf_seq_offset = shuffle_offset(vrf_pnt_q, NrLanes, vinsn_issue_q.vtype.vsew); - vrf_byte = vrf_byte + vrf_seq_offset; + automatic int unsigned vrf_seq_byte = axi_byte - axi_r_byte_pnt_q + vrf_word_byte_pnt_q; + // Follow the vrf_seq_byte, but without the vstart information + automatic int unsigned vrf_seq_byte_cnt = axi_byte - axi_r_byte_pnt_q + vrf_word_byte_cnt_q; + // And then shuffle it + automatic int unsigned vrf_byte = shuffle_index(vrf_seq_byte, NrLanes, vinsn_issue_q.vtype.vsew); // Is this byte a valid byte in the VRF word? - if (axi_byte < issue_cnt_q && axi_byte < NrLanes * 8) begin + // We compare vrf_seq_byte_cnt since vrf_seq_byte contains also the vstart contribution, while the issue_cnt_bytes + // counter does not. + if (vrf_seq_byte_cnt < issue_cnt_bytes_q && vrf_seq_byte < (NrLanes * DataWidthB)) begin : is_vrf_byte // At which lane, and what is the byte offset in that lane, of the byte vrf_byte? - automatic int vrf_lane = vrf_byte >> 3; - automatic int vrf_offset = vrf_byte[2:0]; + automatic int unsigned vrf_offset = vrf_byte[2:0]; + // Make sure this index wraps around the number of lane + automatic int unsigned vrf_lane = (vrf_byte >> 3); // Copy data and byte strobe result_queue_d[result_queue_write_pnt_q][vrf_lane].wdata[8*vrf_offset +: 8] = axi_r_i.data[8*axi_byte +: 8]; result_queue_d[result_queue_write_pnt_q][vrf_lane].be[vrf_offset] = - vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]; - end - end + vinsn_issue_q.vm || mask_q[vrf_lane][vrf_offset]; + end : is_vrf_byte + end : axi_r_to_result_queue + + for (int unsigned lane = 0; lane < NrLanes; lane++) begin : compute_vrf_addr + // vstart value local ot the lane + automatic vlen_t vstart_lane; - // Initialize id and addr fields of the result queue requests - for (int lane = 0; lane < NrLanes; lane++) begin + // vstart of the lanes that we are writing to in this cycle + vstart_lane = vinsn_issue_q.vstart / NrLanes; + + // Store in result queue + result_queue_d[result_queue_write_pnt_q][lane].addr = vaddr(vinsn_issue_q.vd, NrLanes) + (vstart_lane >> (EW64 - vinsn_issue_q.vtype.vsew)) + seq_word_wr_offset_q; result_queue_d[result_queue_write_pnt_q][lane].id = vinsn_issue_q.id; - result_queue_d[result_queue_write_pnt_q][lane].addr = vaddr(vinsn_issue_q.vd, NrLanes) + - (((vinsn_issue_q.vl - (issue_cnt_q >> int'(vinsn_issue_q.vtype.vsew))) / NrLanes) >> - (int'(EW64) - int'(vinsn_issue_q.vtype.vsew))); - end - end + end : compute_vrf_addr + end : operands_valid // We have a word ready to be sent to the lanes - if (vrf_pnt_d == NrLanes*8 || vrf_pnt_d == issue_cnt_q) begin + if (vrf_word_byte_pnt_d == (NrLanes * DataWidthB) || vrf_word_byte_cnt_d == issue_cnt_bytes_q) begin : vrf_word_ready // Increment result queue pointers and counters result_queue_cnt_d += 1; - if (result_queue_write_pnt_q == ResultQueueDepth-1) + if (result_queue_write_pnt_q == ResultQueueDepth-1) begin : result_queue_write_pnt_overflow result_queue_write_pnt_d = '0; - else + end : result_queue_write_pnt_overflow + else begin : result_queue_write_pnt_increment result_queue_write_pnt_d = result_queue_write_pnt_q + 1; + end : result_queue_write_pnt_increment // Trigger the request signal result_queue_valid_d[result_queue_write_pnt_q] = {NrLanes{1'b1}}; + // Increase the VRF-write sequential counter + seq_word_wr_offset_d = seq_word_wr_offset_q + 1; + // Acknowledge the mask operands - mask_ready_o = !vinsn_issue_q.vm; + mask_ready_d = !vinsn_issue_q.vm; // Reset the pointer in the VRF word - vrf_pnt_d = '0; + vrf_word_byte_pnt_d = '0; + vrf_word_byte_cnt_d = '0; // Account for the results that were issued - issue_cnt_d = issue_cnt_q - NrLanes * 8; - if (issue_cnt_q < NrLanes * 8) - issue_cnt_d = '0; - end + if (seq_word_wr_offset_q) begin + vrf_eff_write_bytes = (NrLanes * DataWidthB); + end else begin + // First payload of the vector instruction + vrf_eff_write_bytes = first_payload_byte_q; + end + issue_cnt_bytes_d = issue_cnt_bytes_q - vrf_eff_write_bytes; + if (issue_cnt_bytes_q < vrf_eff_write_bytes) begin : issue_cnt_bytes_overflow + issue_cnt_bytes_d = '0; + end : issue_cnt_bytes_overflow + end : vrf_word_ready // Consumed all valid bytes in this R beat - if (r_pnt_d == AxiDataWidth/8 || issue_cnt_d == '0) begin + if ((axi_r_byte_pnt_d == AxiDataWidth/8) || (issue_cnt_bytes_d == '0)) begin : axi_r_beat_finish // Request another beat axi_r_ready_o = 1'b1; - r_pnt_d = '0; + axi_r_byte_pnt_d = '0; // Account for the beat we consumed - len_d = len_q + 1; - end + axi_len_d = axi_len_q + 1; + end : axi_r_beat_finish // Consumed all beats from this burst - if ($unsigned(len_d) == axi_pkg::len_t'($unsigned(axi_addrgen_req_i.len) + 1)) begin + if ($unsigned(axi_len_d) == axi_pkg::len_t'($unsigned(axi_addrgen_req_i.len) + 1)) begin : axi_finish // Reset AXI pointers - len_d = '0; - r_pnt_d = '0; + axi_len_d = '0; + axi_r_byte_pnt_d = '0; // Wait for another AXI request axi_addrgen_req_ready_o = 1'b1; - end + end : axi_finish // Finished issuing results - if (vinsn_issue_valid && issue_cnt_d == '0) begin + if (vinsn_issue_valid && issue_cnt_bytes_d == '0 ) begin : vrf_results_finish // Increment vector instruction queue pointers and counters vinsn_queue_d.issue_cnt -= 1; - if (vinsn_queue_q.issue_pnt == VInsnQueueDepth-1) + if (vinsn_queue_q.issue_pnt == (VInsnQueueDepth-1)) begin : issue_pnt_overflow vinsn_queue_d.issue_pnt = '0; - else + end : issue_pnt_overflow + else begin : issue_pnt_increment vinsn_queue_d.issue_pnt += 1; + end : issue_pnt_increment // Prepare for the next vector instruction - if (vinsn_queue_d.issue_cnt != 0) - issue_cnt_d = vinsn_queue_q.vinsn[vinsn_queue_d.issue_pnt].vl << int'(vinsn_queue_q.vinsn[ - vinsn_queue_d.issue_pnt].vtype.vsew); - end - end + if (vinsn_queue_d.issue_cnt != 0) begin : issue_cnt_bytes_update + issue_cnt_bytes_d = ( + vinsn_queue_q.vinsn[vinsn_queue_d.issue_pnt].vl + - vinsn_queue_q.vinsn[vinsn_queue_d.issue_pnt].vstart + ) << unsigned'(vinsn_queue_q.vinsn[vinsn_queue_d.issue_pnt].vtype.vsew); + // Prepare the VRF start pointer + vrf_word_start_byte = vinsn_issue_d.vstart[$clog2(8*NrLanes)-1:0] << vinsn_issue_d.vtype.vsew; + vrf_word_byte_pnt_d = {1'b0, vrf_word_start_byte[$clog2(8*NrLanes)-1:0]}; + vrf_word_byte_cnt_d = '0; + seq_word_wr_offset_d = '0; + // The first payload byte width for this vload + first_payload_byte_d = (NrLanes * DataWidthB) - vrf_word_start_byte[$clog2(8*NrLanes)-1:0]; + end : issue_cnt_bytes_update + end : vrf_results_finish + end : axi_r_beat_read ////////////////////////////////// // Write results into the VRF // ////////////////////////////////// - for (int lane = 0; lane < NrLanes; lane++) begin: result_write + for (int unsigned lane = 0; lane < NrLanes; lane++) begin: vrf_result_write ldu_result_req_o[lane] = result_queue_valid_q[result_queue_read_pnt_q][lane]; ldu_result_addr_o[lane] = result_queue_q[result_queue_read_pnt_q][lane].addr; ldu_result_id_o[lane] = result_queue_q[result_queue_read_pnt_q][lane].id; @@ -365,39 +467,53 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( // Received a grant from the VRF. // Deactivate the request, but do not bump the pointers for now. - if (ldu_result_req_o[lane] && ldu_result_gnt_i[lane]) begin + if (ldu_result_req_o[lane] && ldu_result_gnt_i[lane]) begin : vrf_grant result_queue_valid_d[result_queue_read_pnt_q][lane] = 1'b0; result_queue_d[result_queue_read_pnt_q][lane] = '0; // Reset the final gnt vector since we are now waiting for another final gnt result_final_gnt_d[lane] = 1'b0; - end - end: result_write + end : vrf_grant + end: vrf_result_write + + // How many result bytes can possibly be committed this cycle? + res_queue_eff_write_bytes = (NrLanes * DataWidthB); + // If vstart > 0, the first payload can contain less than (NrLanes * DataWidthB) Bytes + if (first_result_queue_read_q) begin + res_queue_eff_write_bytes = first_payload_byte_q; + end // All lanes accepted the VRF request // Wait for all the final grants, to be sure that all the results were written back if (!(|result_queue_valid_d[result_queue_read_pnt_q]) && - (&result_final_gnt_d || commit_cnt_q > (NrLanes * 8))) + (&result_final_gnt_d || commit_cnt_bytes_q > (NrLanes * DataWidthB))) begin : wait_for_write_back // There is something waiting to be written - if (!result_queue_empty) begin + if (!result_queue_empty) begin : result_available // Increment the read pointer - if (result_queue_read_pnt_q == ResultQueueDepth-1) + if (result_queue_read_pnt_q == (ResultQueueDepth-1)) begin : result_queue_read_pnt_overflow result_queue_read_pnt_d = 0; - else + end : result_queue_read_pnt_overflow + else begin : result_queue_read_pnt_increment result_queue_read_pnt_d = result_queue_read_pnt_q + 1; + end : result_queue_read_pnt_increment // Decrement the counter of results waiting to be written result_queue_cnt_d -= 1; + // The next write will surely not be the first one anymore + first_result_queue_read_d = 1'b0; + // Decrement the counter of remaining vector elements waiting to be written - commit_cnt_d = commit_cnt_q - NrLanes * 8; - if (commit_cnt_q < (NrLanes * 8)) - commit_cnt_d = '0; - end + commit_cnt_bytes_d = commit_cnt_bytes_q - res_queue_eff_write_bytes; + if (commit_cnt_bytes_q < (NrLanes * DataWidthB)) begin : commit_cnt_bytes_overflow + commit_cnt_bytes_d = '0; + end : commit_cnt_bytes_overflow + end : result_available + end : wait_for_write_back // Finished committing the results of a vector instruction - if (vinsn_commit_valid && commit_cnt_d == '0) begin + if (vinsn_commit_valid && commit_cnt_bytes_d == '0) begin : vinsn_done // Mark the vector instruction as being done - pe_resp.vinsn_done[vinsn_commit.id] = 1'b1; + pe_resp_d.vinsn_done[vinsn_commit.id] = 1'b1; // Signal complete load load_complete_o = 1'b1; @@ -410,52 +526,77 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( vinsn_queue_d.commit_pnt += 1; // Update the commit counter for the next instruction - if (vinsn_queue_d.commit_cnt != '0) - commit_cnt_d = vinsn_queue_q.vinsn[vinsn_queue_d.commit_pnt].vl << int'(vinsn_queue_q.vinsn[ - vinsn_queue_d.commit_pnt].vtype.vsew); - end + if (vinsn_queue_d.commit_cnt != '0) begin + first_result_queue_read_d = 1'b1; + commit_cnt_bytes_d = ( + vinsn_queue_q.vinsn[vinsn_queue_d.commit_pnt].vl + - vinsn_queue_q.vinsn[vinsn_queue_d.commit_pnt].vstart + ) << unsigned'(vinsn_queue_q.vinsn[vinsn_queue_d.commit_pnt].vtype.vsew); + end + end : vinsn_done ////////////////////////////// // Accept new instruction // ////////////////////////////// if (!vinsn_queue_full && pe_req_valid_i && !vinsn_running_q[pe_req_i.id] && - pe_req_i.vfu == VFU_LoadUnit) begin + pe_req_i.vfu == VFU_LoadUnit) begin : pe_req_valid vinsn_queue_d.vinsn[vinsn_queue_q.accept_pnt] = pe_req_i; vinsn_running_d[pe_req_i.id] = 1'b1; // Initialize counters - if (vinsn_queue_d.issue_cnt == '0) - issue_cnt_d = pe_req_i.vl << int'(pe_req_i.vtype.vsew); - if (vinsn_queue_d.commit_cnt == '0) - commit_cnt_d = pe_req_i.vl << int'(pe_req_i.vtype.vsew); + if (vinsn_queue_d.issue_cnt == '0) begin : issue_cnt_bytes_init + issue_cnt_bytes_d = (pe_req_i.vl - pe_req_i.vstart) << unsigned'(pe_req_i.vtype.vsew); + end : issue_cnt_bytes_init + if (vinsn_queue_d.commit_cnt == '0) begin : commit_cnt_bytes_init + first_result_queue_read_d = 1'b1; + commit_cnt_bytes_d = (pe_req_i.vl - pe_req_i.vstart) << unsigned'(pe_req_i.vtype.vsew); + end : commit_cnt_bytes_init + + // New instruction with new vstart. Initialize the vrf byte ptr + if (vinsn_queue_d.issue_cnt == '0) begin + vrf_word_start_byte = pe_req_i.vstart[$clog2(8*NrLanes)-1:0] << pe_req_i.vtype.vsew; + vrf_word_byte_pnt_d = {1'b0, vrf_word_start_byte[$clog2(8*NrLanes)-1:0]}; + vrf_word_byte_cnt_d = '0; + seq_word_wr_offset_d = '0; + // The first payload byte width for this vload + first_payload_byte_d = (NrLanes * DataWidthB) - vrf_word_start_byte[$clog2(8*NrLanes)-1:0]; + end // Bump pointers and counters of the vector instruction queue vinsn_queue_d.accept_pnt += 1; vinsn_queue_d.issue_cnt += 1; vinsn_queue_d.commit_cnt += 1; - end + end : pe_req_valid end: p_vldu always_ff @(posedge clk_i or negedge rst_ni) begin if (!rst_ni) begin - vinsn_running_q <= '0; - issue_cnt_q <= '0; - commit_cnt_q <= '0; - len_q <= '0; - r_pnt_q <= '0; - vrf_pnt_q <= '0; - pe_resp_o <= '0; - result_final_gnt_q <= '0; + vinsn_running_q <= '0; + issue_cnt_bytes_q <= '0; + commit_cnt_bytes_q <= '0; + axi_len_q <= '0; + axi_r_byte_pnt_q <= '0; + vrf_word_byte_pnt_q <= '0; + pe_resp_o <= '0; + result_final_gnt_q <= '0; + seq_word_wr_offset_q <= '0; + first_payload_byte_q <= '0; + vrf_word_byte_cnt_q <= '0; + first_result_queue_read_q <= 1'b0; end else begin - vinsn_running_q <= vinsn_running_d; - issue_cnt_q <= issue_cnt_d; - commit_cnt_q <= commit_cnt_d; - len_q <= len_d; - r_pnt_q <= r_pnt_d; - vrf_pnt_q <= vrf_pnt_d; - pe_resp_o <= pe_resp; - result_final_gnt_q <= result_final_gnt_d; + vinsn_running_q <= vinsn_running_d; + issue_cnt_bytes_q <= issue_cnt_bytes_d; + commit_cnt_bytes_q <= commit_cnt_bytes_d; + axi_len_q <= axi_len_d; + axi_r_byte_pnt_q <= axi_r_byte_pnt_d; + vrf_word_byte_pnt_q <= vrf_word_byte_pnt_d; + pe_resp_o <= pe_resp_d; + result_final_gnt_q <= result_final_gnt_d; + seq_word_wr_offset_q <= seq_word_wr_offset_d; + first_payload_byte_q <= first_payload_byte_d; + vrf_word_byte_cnt_q <= vrf_word_byte_cnt_d; + first_result_queue_read_q <= first_result_queue_read_d; end end From fb7dd9d85c88781c8d3d96cf2d970b48ce574759 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 17 Oct 2025 16:04:51 +0200 Subject: [PATCH 03/37] [HW/SW] [SW] 1. Fix bug in dotproduct kernel on red vl; 2. Align data generation with 4*Nrlanes*NrClusters for imatmul and iconv2d kernels; [HW] 1. Synchronize instruction of Ara and GLSU; 2. VSE: support the case where number of elements stored is not multiplier of NrLanes*NrClusters; 3. VSE: axi write req controlling signal fix; 4. Fix SLIDEDOWN operation issue; 5. Recalculate slide operation to ensure vl is multiplier of NrLanes*NrClusters for inter-cluster ring interaction --- apps/common/default_args.mk | 13 +- apps/fdotproduct/kernel/fdotproduct.c | 18 ++- apps/iconv2d/main.c | 17 ++- apps/iconv2d/script/gen_data.py | 12 +- apps/imatmul/main.c | 10 +- apps/imatmul/script/gen_data.py | 8 +- hardware/include/ara_pkg.sv | 5 + hardware/src/ara_cluster.sv | 35 ++++- hardware/src/ara_dispatcher.sv | 14 +- hardware/src/ara_sequencer.sv | 1 + hardware/src/sldu/sldu.sv | 60 +++++++-- hardware/src/vlsu/addrgen.sv | 83 ++++++------ hardware/src/vlsu/align_stage.sv | 29 ++-- hardware/src/vlsu/global_dispatcher.sv | 175 +++++++++++++++---------- hardware/src/vlsu/global_ldst.sv | 57 ++++++-- hardware/src/vlsu/shuffle_stage.sv | 20 ++- hardware/src/vlsu/vldu.sv | 2 +- hardware/src/vlsu/vstu.sv | 47 ++++--- 18 files changed, 394 insertions(+), 212 deletions(-) diff --git a/apps/common/default_args.mk b/apps/common/default_args.mk index 07205cf..bc0fa22 100644 --- a/apps/common/default_args.mk +++ b/apps/common/default_args.mk @@ -1,16 +1,17 @@ # Default app parameters # Matrix sizes -def_args_imatmul ?= "64 64 64" -def_args_fmatmul ?= "64 64 64" +def_args_imatmul ?= "32 32 32" +def_args_fmatmul ?= "32 32 32" # Matrix size, filter size -def_args_iconv2d ?= "112 7" -def_args_fconv2d ?= "112 7" +def_args_iconv2d ?= "32 3" +def_args_fconv2d ?= "128 128 3" +# def_args_fconv2d ?= "128 128 7" def_args_fconv3d ?= "112 7" # Vector size -def_args_fdotproduct ?= "8192" +def_args_fdotproduct ?= "4096" # Vector size -def_args_dotproduct ?= "8192" +def_args_dotproduct ?= "4096" # Matrix padded size 0, matrix padded size 1, onlyvec def_args_jacobi2d ?= "130 130" # Vector size diff --git a/apps/fdotproduct/kernel/fdotproduct.c b/apps/fdotproduct/kernel/fdotproduct.c index 99e1cf1..e4070cf 100644 --- a/apps/fdotproduct/kernel/fdotproduct.c +++ b/apps/fdotproduct/kernel/fdotproduct.c @@ -24,6 +24,7 @@ double fdotp_v64b(const double *a, const double *b, size_t avl) { size_t orig_avl = avl; size_t vl = vsetvl_e64m8(avl); + size_t vl_red = vl; vfloat64m8_t acc, buf_a, buf_b; vfloat64m1_t red; @@ -50,6 +51,7 @@ double fdotp_v64b(const double *a, const double *b, size_t avl) { b_ += vl; } + vl = vsetvl_e64m8(vl_red); // Reduce and return red = vfredusum_vs_f64m8_f64m1(red, acc, red, vl); return vfmv_f_s_f64m1_f64(red); @@ -58,7 +60,9 @@ double fdotp_v64b(const double *a, const double *b, size_t avl) { size_t orig_avl = avl; size_t vl; + size_t vl_red; asm volatile("vsetvli %0, %1, e64, m8, ta, ma" : "=r"(vl) : "r"(avl)); + vl_red = vl; double red; @@ -85,6 +89,7 @@ double fdotp_v64b(const double *a, const double *b, size_t avl) { } // Reduce and return + asm volatile("vsetvli %0, %1, e64, m8, ta, ma" : "=r"(vl) : "r"(vl_red)); asm volatile("vfredusum.vs v0, v24, v0"); asm volatile("vfmv.f.s %0, v0" : "=f"(red)); return red; @@ -98,6 +103,7 @@ float fdotp_v32b(const float *a, const float *b, size_t avl) { size_t orig_avl = avl; size_t vl = vsetvl_e32m8(avl); + size_t vl_red = vl; vfloat32m8_t acc, buf_a, buf_b; vfloat32m1_t red; @@ -125,6 +131,7 @@ float fdotp_v32b(const float *a, const float *b, size_t avl) { } // Reduce and return + vl = vsetvl_e32m8(vl_red); red = vfredusum_vs_f32m8_f32m1(red, acc, red, vl); return vfmv_f_s_f32m1_f32(red); @@ -132,7 +139,9 @@ float fdotp_v32b(const float *a, const float *b, size_t avl) { size_t orig_avl = avl; size_t vl; + size_t vl_red; asm volatile("vsetvli %0, %1, e32, m8, ta, ma" : "=r"(vl) : "r"(avl)); + vl_red = vl; float red; @@ -148,7 +157,7 @@ float fdotp_v32b(const float *a, const float *b, size_t avl) { asm volatile("vle32.v v8, (%0)" ::"r"(a_)); asm volatile("vle32.v v16, (%0)" ::"r"(b_)); // Multiply and accumulate - if (avl == orig_avl) { + if (avl == orig_avl) { asm volatile("vfmul.vv v24, v8, v16"); } else { asm volatile("vfmacc.vv v24, v8, v16"); @@ -159,9 +168,11 @@ float fdotp_v32b(const float *a, const float *b, size_t avl) { } // Reduce and return + asm volatile("vsetvli %0, %1, e32, m8, ta, ma" : "=r"(vl) : "r"(vl_red)); asm volatile("vfredusum.vs v0, v24, v0"); asm volatile("vfmv.f.s %0, v0" : "=f"(red)); return red; + // return 1.5; #endif } @@ -172,6 +183,7 @@ _Float16 fdotp_v16b(const _Float16 *a, const _Float16 *b, size_t avl) { size_t orig_avl = avl; size_t vl = vsetvl_e16m8(avl); + size_t vl_red = vl; vfloat16m8_t acc, buf_a, buf_b; vfloat16m1_t red; @@ -199,6 +211,7 @@ _Float16 fdotp_v16b(const _Float16 *a, const _Float16 *b, size_t avl) { } // Reduce and store + vl = vsetvl_e16m8(vl_red); red = vfredusum_vs_f16m8_f16m1(red, acc, red, vl); return vfmv_f_s_f16m1_f16(red); @@ -206,7 +219,9 @@ _Float16 fdotp_v16b(const _Float16 *a, const _Float16 *b, size_t avl) { size_t orig_avl = avl; size_t vl; + size_t vl_red; asm volatile("vsetvli %0, %1, e16, m8, ta, ma" : "=r"(vl) : "r"(avl)); + vl_red = vl; _Float16 red; @@ -233,6 +248,7 @@ _Float16 fdotp_v16b(const _Float16 *a, const _Float16 *b, size_t avl) { } // Reduce and return + asm volatile("vsetvli %0, %1, e16, m8, ta, ma" : "=r"(vl) : "r"(vl_red)); asm volatile("vfredusum.vs v0, v24, v0"); asm volatile("vfmv.f.s %0, v0" : "=f"(red)); return red; diff --git a/apps/iconv2d/main.c b/apps/iconv2d/main.c index 5d5f7e7..6fe86fb 100644 --- a/apps/iconv2d/main.c +++ b/apps/iconv2d/main.c @@ -31,12 +31,19 @@ // o = i ° f, with i=[MxN], f=[FxF], o=[MxN] // The filter is a square matrix, and F is odd +// // Matrices defined in data.S +// extern int64_t i[] __attribute__(( +// aligned(4 * NR_LANES))); // [ (M+floor(F/2)) * (N+floor(F/2)) ] +// extern int64_t f[] __attribute__((aligned(4 * NR_LANES))); // [ F*F ] +// extern int64_t o[] __attribute__((aligned(4 * NR_LANES))); // [ M*N ] +// extern int64_t golden_o[] __attribute__((aligned(4 * NR_LANES))); // [ M*N ] + // Matrices defined in data.S -extern int64_t i[] __attribute__(( - aligned(4 * NR_LANES))); // [ (M+floor(F/2)) * (N+floor(F/2)) ] -extern int64_t f[] __attribute__((aligned(4 * NR_LANES))); // [ F*F ] -extern int64_t o[] __attribute__((aligned(4 * NR_LANES))); // [ M*N ] -extern int64_t golden_o[] __attribute__((aligned(4 * NR_LANES))); // [ M*N ] +extern int64_t i[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS))); // [ (M+floor(F/2)) * (N+floor(F/2)) ] +extern int64_t f[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS))); // [ F*F ] +extern int64_t o[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS))); // [ M*N ] +extern int64_t golden_o[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS))); // [ M*N ] + // M, N, F defined in data.S extern int64_t M; extern int64_t N; diff --git a/apps/iconv2d/script/gen_data.py b/apps/iconv2d/script/gen_data.py index 1572466..312ac85 100644 --- a/apps/iconv2d/script/gen_data.py +++ b/apps/iconv2d/script/gen_data.py @@ -109,7 +109,11 @@ def emit(name, array, alignment='8'): emit("M", np.array(M, dtype=np.uint64)) emit("N", np.array(N, dtype=np.uint64)) emit("F", np.array(F, dtype=np.uint64)) -emit("i", image, 'NR_LANES*4') -emit("f", gen_filter, 'NR_LANES*4') -emit("o", empty_o, 'NR_LANES*4') -emit("golden_o", result, 'NR_LANES*4') +# emit("i", image, 'NR_LANES*4') +# emit("f", gen_filter, 'NR_LANES*4') +# emit("o", empty_o, 'NR_LANES*4') +# emit("golden_o", result, 'NR_LANES*4') +emit("i", image, 'NR_LANES*4*NR_CLUSTERS') +emit("f", gen_filter, 'NR_LANES*4*NR_CLUSTERS') +emit("o", empty_o, 'NR_LANES*4*NR_CLUSTERS') +emit("golden_o", result, 'NR_LANES*4*NR_CLUSTERS') diff --git a/apps/imatmul/main.c b/apps/imatmul/main.c index 31430a4..ca8922a 100644 --- a/apps/imatmul/main.c +++ b/apps/imatmul/main.c @@ -35,11 +35,11 @@ extern uint64_t M; extern uint64_t N; extern uint64_t P; -extern int64_t a[] __attribute__((aligned(32 * NR_LANES), section(".l2"))); -extern int64_t b[] __attribute__((aligned(32 * NR_LANES), section(".l2"))); -extern int64_t c[] __attribute__((aligned(32 * NR_LANES), section(".l2"))); +extern double a[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS), section(".l2"))); +extern double b[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS), section(".l2"))); +extern double c[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS), section(".l2"))); // Gold results -extern int64_t g[] __attribute__((aligned(32 * NR_LANES), section(".l2"))); +extern double g[] __attribute__((aligned(4 * NR_LANES * NR_CLUSTERS), section(".l2"))); // Verify the matrix int verify_matrix(int64_t *result, int64_t *gold, size_t R, size_t C) { @@ -66,7 +66,7 @@ int main() { // Measure only the full-size matmul for (uint64_t s = M; s <= M; s *= 2) { #else - for (int s = 4; s <= M; s *= 2) { + for (uint64_t s = M; s <= M; s *= 2) { #endif printf("\n"); printf("------------------------------------------------------------\n"); diff --git a/apps/imatmul/script/gen_data.py b/apps/imatmul/script/gen_data.py index 05457a6..dcf5dba 100644 --- a/apps/imatmul/script/gen_data.py +++ b/apps/imatmul/script/gen_data.py @@ -65,7 +65,7 @@ def emit(name, array, alignment='8'): emit("M", np.array(M, dtype=np.uint64)) emit("N", np.array(N, dtype=np.uint64)) emit("P", np.array(P, dtype=np.uint64)) -emit("a", A, 'NR_LANES*4') -emit("b", B, 'NR_LANES*4') -emit("c", C, 'NR_LANES*4') -emit("g", G, 'NR_LANES*4') +emit("a", A, 'NR_LANES*4*NR_CLUSTERS') +emit("b", B, 'NR_LANES*4*NR_CLUSTERS') +emit("c", C, 'NR_LANES*4*NR_CLUSTERS') +emit("g", G, 'NR_LANES*4*NR_CLUSTERS') diff --git a/hardware/include/ara_pkg.sv b/hardware/include/ara_pkg.sv index ead2dc7..216fc2c 100644 --- a/hardware/include/ara_pkg.sv +++ b/hardware/include/ara_pkg.sv @@ -318,6 +318,8 @@ package ara_pkg; // Vector machine metadata vlen_t vl; + // Real vector length number assigned for vle and vse + vlen_t vl_ldst; vlen_t vstart; rvv_pkg::vtype_t vtype; @@ -416,6 +418,8 @@ package ara_pkg; // Vector machine metadata vlen_t vl; + // Actual vector length assigned for vle and vse + vlen_t vl_ldst; vlen_t vstart; rvv_pkg::vtype_t vtype; @@ -1158,6 +1162,7 @@ package ara_pkg; axi_pkg::size_t size; axi_pkg::len_t len; logic is_load; + vlen_t vl_ldst; // Meaning that vstu should write enable to zero when executing vse (vl-vl_ldst) } addrgen_axi_req_t; diff --git a/hardware/src/ara_cluster.sv b/hardware/src/ara_cluster.sv index 1c1fb3a..a831011 100644 --- a/hardware/src/ara_cluster.sv +++ b/hardware/src/ara_cluster.sv @@ -96,6 +96,7 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( fork_req_t [nlevels : 0] acc_req_fork; fork_resp_t [nlevels : 0] acc_resp_fork; + accelerator_resp_t acc_resp_fork_glb; // Shuffle stage to ARA cuts localparam int ShuffleCuts = $clog2(NrClusters); @@ -105,6 +106,10 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( group_req_t [ShuffleCuts:0] ara_axi_req_shuffle_cut; group_resp_t [ShuffleCuts:0] ara_axi_resp_shuffle_cut; + // GLSU ready to accept new acc req + logic acc_req_ready_glsu; + logic ar_addrgen_ack, aw_addrgen_ack; + ///////// // ARA // ///////// @@ -344,7 +349,11 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .clk_i (clk_i ), .rst_ni (rst_ni ), - .acc_req_i (acc_req_i ), + .acc_req_i (acc_req_fork[nlevels][0] ), + + // To Shuffle stage and Align stage + .ar_addrgen_ack_i (ar_addrgen_ack ), + .aw_addrgen_ack_i (aw_addrgen_ack ), .axi_req_i (ara_axi_req_cut ), .axi_resp_o (ara_axi_resp_cut ), @@ -388,7 +397,8 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( ) i_global_ldst ( .clk_i (clk_i ), .rst_ni (rst_ni ), - .acc_req_i (acc_req_i ), + .acc_req_i (acc_req_fork[nlevels][0] ), + .acc_req_ready_o (acc_req_ready_glsu ), // To Ara .axi_req_i (ldst_axi_req ), .axi_resp_o (ldst_axi_resp ), @@ -396,6 +406,9 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( // .axi_req_i (ara_axi_req_cut ), // .axi_resp_o (ara_axi_resp_cut ), + // To Shuffle stage and Align stage + .ar_addrgen_ack_o (ar_addrgen_ack ), + .aw_addrgen_ack_o (aw_addrgen_ack ), // To System .axi_resp_i (axi_resp_cut ), .axi_req_o (axi_req_cut ) @@ -436,7 +449,11 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( ) i_align_stage ( .clk_i (clk_i ), .rst_ni (rst_ni ), - .acc_req_i (acc_req_i ), + .acc_req_i (acc_req_fork[nlevels][0] ), + + // To Shuffle stage and Align stage + .ar_addrgen_ack_i (ar_addrgen_ack ), + .aw_addrgen_ack_i (aw_addrgen_ack ), // .axi_req_i (axi_req_cut ), // .axi_resp_o (axi_resp_cut ), @@ -509,6 +526,12 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( `endif + + always_comb begin + acc_resp_fork_glb = acc_resp_fork[0][0]; + acc_resp_fork_glb.req_ready = acc_resp_fork[0][0].req_ready && acc_req_ready_glsu; + end + ////////////////// ////// CVA6 ////// ////////////////// @@ -541,11 +564,13 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( assign acc_resp_o = resp_cut_o; assign acc_req_fork[0][0] = req_cut_o; - assign resp_cut_i = acc_resp_fork[0][0]; + // assign resp_cut_i = acc_resp_fork[0][0]; + assign resp_cut_i = acc_resp_fork_glb; `else assign acc_req_fork[0][0] = acc_req_i; - assign acc_resp_o = acc_resp_fork[0][0]; + // assign acc_resp_o = acc_resp_fork[0][0]; + assign acc_resp_o = acc_resp_fork_glb; `endif diff --git a/hardware/src/ara_dispatcher.sv b/hardware/src/ara_dispatcher.sv index 1d331f8..e15d0aa 100644 --- a/hardware/src/ara_dispatcher.sv +++ b/hardware/src/ara_dispatcher.sv @@ -514,10 +514,12 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd == '0) begin // Do not update the vector length vl_d = vl_q; + vl_ld_d = vl_ld_q; acc_resp_o.result = vl_d << num_clusters_i; end else if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd != '0) begin // Set the vector length to vlmax vl_d = vlmax; + vl_ld_d = vlmax; acc_resp_o.result = vl_d << num_clusters_i; end else begin // // Normal stripmining @@ -2561,6 +2563,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // These generate a request to Ara's backend ara_req_d.vl = vl_ld_q; + ara_req_d.vl_ldst = vl_q; ara_req_d.vd = insn.vmem_type.rd; ara_req_d.use_vd = 1'b1; ara_req_d.vm = insn.vmem_type.vm; @@ -2774,7 +2777,9 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( ara_req_d.scale_vl = 1'b1; // These generate a request to Ara's backend - ara_req_d.vl = vl_q; + // ara_req_d.vl = vl_q; + ara_req_d.vl = vl_ld_q; + ara_req_d.vl_ldst = vl_q; ara_req_d.vs1 = insn.vmem_type.rd; // vs3 is encoded in the same position as rd ara_req_d.use_vs1 = 1'b1; ara_req_d.eew_vs1 = eew_q[insn.vmem_type.rd]; // This is the vs1 EEW @@ -2836,7 +2841,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( 5'b01000:; // Unit-strided, whole registers 5'b01011: begin // Unit-strided, mask store, EEW=1 // We operate ceil(vl/8) bytes - ara_req_d.vl = (vl_q >> 3) + |vl_q[2:0]; + // ara_req_d.vl = (vl_q >> 3) + |vl_q[2:0]; + ara_req_d.vl = (vl_ld_q >> 3) + |vl_ld_q[2:0]; ara_req_d.vtype.vsew = EW8; end default: begin // Reserved @@ -3141,6 +3147,10 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( acc_resp_o.resp_valid = 1'b1; end endcase + + if (ara_req_d.op inside {VSLIDEUP, VSLIDEDOWN}) begin + ara_req_d.vl = vl_ld_q; + end end // Check that we have fixed-point support if requested diff --git a/hardware/src/ara_sequencer.sv b/hardware/src/ara_sequencer.sv index 3132f75..7b017ae 100644 --- a/hardware/src/ara_sequencer.sv +++ b/hardware/src/ara_sequencer.sv @@ -361,6 +361,7 @@ module ara_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg::i cvt_resize : ara_req_i.cvt_resize, scale_vl : ara_req_i.scale_vl, vl : ara_req_i.vl, + vl_ldst : ara_req_i.vl_ldst, vstart : ara_req_i.vstart, vtype : ara_req_i.vtype, hazard_vd : pe_req_d.hazard_vd, diff --git a/hardware/src/sldu/sldu.sv b/hardware/src/sldu/sldu.sv index 75414e7..06a21b3 100644 --- a/hardware/src/sldu/sldu.sv +++ b/hardware/src/sldu/sldu.sv @@ -446,6 +446,11 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( // Remaining bytes of the current instruction in the issue phase vlen_t issue_cnt_d, issue_cnt_q; + vlen_t rest_issue_cnt_d; + // We give slidedown (not slide1down) extra flits, for upper most elements, + // these number should be minused to get the actual count to be issued + assign rest_issue_cnt_d = ((vinsn_ring.op == VSLIDEDOWN) && (!(vinsn_ring.use_scalar_op || (vinsn_ring.stride == 0)))) ? + (issue_cnt_d - 8 * NrLanes) : issue_cnt_d; // Respected by default: input_limit_d = 8*NrLanes + out_pnt_d - in_pnt_d; // To enforce: output_limit_d = out_pnt_d + issue_cnt_d; logic [idx_width(MAXVL+1):0] output_limit_d, output_limit_q; @@ -564,7 +569,12 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( eff_stride_q <= eff_stride_d; end end - + + logic slidedown_extra_flit; + // assign slidedown_extra_flit = (vinsn_issue_q.op == VSLIDEDOWN) && (!vinsn_issue_q.use_scalar_op) && (issue_cnt_q <= 8*NrLanes); + assign slidedown_extra_flit = (|vinsn_issue_q.stride) ? + ((vinsn_issue_q.op == VSLIDEDOWN) && (!vinsn_issue_q.use_scalar_op) && (issue_cnt_q <= 8*NrLanes)) : 0; + always_comb begin: p_sldu // Maintain state vinsn_queue_d = vinsn_queue_q; @@ -752,8 +762,12 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( eff_stride_d = eff_stride; // Initialize counters - issue_cnt_d = vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew); - output_limit_d = issue_cnt_d; + // issue_cnt_d = vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew); + // issue_cnt_d = (vinsn_issue_q.use_scalar_op) ? (vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) : + // ((vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) + 8*NrLanes); + issue_cnt_d = (vinsn_issue_q.use_scalar_op || (vinsn_issue_q.stride == 0)) ? (vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) : + ((vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) + 8*NrLanes); + output_limit_d = vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew); end // Ordered sum reductions @@ -804,7 +818,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( out_en = out_en_flat & ({8*NrLanes{vinsn_issue_q.vm | (vinsn_issue_q.vfu inside {VFU_Alu, VFU_MFpu})}} | mask_q); // Write in the correct bytes - if (init_queue_q) begin + if (init_queue_q && !slidedown_extra_flit) begin // To initialize the queue only once with the local shifted data // The ring data is written later on top of the initialized data for (int lane = 0; lane < NrLanes; lane++) @@ -1011,12 +1025,14 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( vinsn_queue_d.issue_cnt -= 1; end - // Send result to the VRF - result_queue_cnt_d += 1; + if (!slidedown_extra_flit) begin + // Send result to the VRF + result_queue_cnt_d += 1; - result_queue_write_pnt_d = result_queue_write_pnt_q+1; - if (result_queue_write_pnt_q == ResultQueueDepth-1) - result_queue_write_pnt_d = '0; + result_queue_write_pnt_d = result_queue_write_pnt_q+1; + if (result_queue_write_pnt_q == ResultQueueDepth-1) + result_queue_write_pnt_d = '0; + end // if (state_q == SLIDE_NP2_COMMIT) // state_d = SLIDE_NP2_WAIT; @@ -1231,12 +1247,15 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( // For the edge cluster alone, for slidedown, the last 8*NrLanes bytes should not be ring but from previous ring packet and scalar operand. use_fifo_inp = 1'b1; - if (is_edge_cluster && vinsn_ring.op==VSLIDEDOWN && (ring_cnt_q <= 8*NrLanes) && |ring_data_prev_valid_q) begin + if (is_edge_cluster && vinsn_ring.op==VSLIDEDOWN && (vinsn_ring.use_scalar_op || (vinsn_ring.stride == 0)) && (ring_cnt_q <= 8*NrLanes) && |ring_data_prev_valid_q) begin use_fifo_inp = 1'b0; end - if ((result_queue_cnt_d || issue_cnt_d==0) && - (((vinsn_queue_d.issue_pnt != vinsn_queue_d.ring_pnt) || ((issue_cnt_d < ring_cnt_d) && (vinsn_queue_d.issue_pnt == vinsn_queue_d.ring_pnt))) || + // if ((result_queue_cnt_d || issue_cnt_d==0) && + // (((vinsn_queue_d.issue_pnt != vinsn_queue_d.ring_pnt) || ((issue_cnt_d < ring_cnt_d) && (vinsn_queue_d.issue_pnt == vinsn_queue_d.ring_pnt))) || + // is_ring_reduction)) begin + if ((result_queue_cnt_d || issue_cnt_d==0) && (ring_cnt_d > 0) && + (((vinsn_queue_d.issue_pnt != vinsn_queue_d.ring_pnt) || ((rest_issue_cnt_d < ring_cnt_d) && (vinsn_queue_d.issue_pnt == vinsn_queue_d.ring_pnt))) || is_ring_reduction)) begin // if (((vinsn_queue_d.issue_pnt != vinsn_queue_d.ring_pnt) || ((issue_cnt_d < ring_cnt_d) && (vinsn_queue_d.issue_pnt == vinsn_queue_d.ring_pnt))) || @@ -1297,6 +1316,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( ring_data_prev[63:56]}; endcase end + // ring_data_prev_valid_d[lane_id] = 1'b0; n_ring_in_d = n_ring_in_q - 1; slide_data_valid = (n_ring_in_q == 1) ? 1'b1 : 1'b0; end else begin @@ -1345,7 +1365,8 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( fifo_ring_ready_out = 1'b1; // Acknowledge fifo that data has been accepted. end else begin // For the last data for slide1down use the scalar op - if (cluster_id_i == max_cluster_id && vinsn_ring.op==VSLIDEDOWN && (ring_cnt_q <= 8*NrLanes) && |ring_data_prev_valid_q && issue_cnt_q==0) begin + // if (cluster_id_i == max_cluster_id && vinsn_ring.op==VSLIDEDOWN && (ring_cnt_q <= 8*NrLanes) && |ring_data_prev_valid_q && issue_cnt_q==0) begin + if (cluster_id_i == max_cluster_id && vinsn_ring.op==VSLIDEDOWN && (vinsn_ring.use_scalar_op || (vinsn_ring.stride == 0)) && (ring_cnt_q <= 8*NrLanes) && |ring_data_prev_valid_q && issue_cnt_q==0) begin automatic elen_t ring_data_prev = ring_data_prev_q[edge_lane_id]; unique case (vinsn_ring.vtype.vsew) EW64: result_queue_d[result_queue_write_pnt_q2][edge_lane_id].wdata = {vinsn_ring.scalar_op}; @@ -1363,6 +1384,17 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( end end + // Consume extra ring element; + if ((result_queue_cnt_d || issue_cnt_d==0) && (ring_cnt_d == 0) && fifo_ring_valid_inp && use_fifo_inp) begin + fifo_ring_ready_out = 1'b1; + end + + // if ((result_queue_cnt_d || issue_cnt_d==0) && (ring_cnt_d == 0) && + // (((vinsn_queue_d.issue_pnt != vinsn_queue_d.ring_pnt) || ((rest_issue_cnt_d < ring_cnt_d) && (vinsn_queue_d.issue_pnt == vinsn_queue_d.ring_pnt))) || + // is_ring_reduction) && fifo_ring_valid_inp && use_fifo_inp) begin + // fifo_ring_ready_out = 1'b1; + // end + // Set the data to valid to be sent to the VRF // Update the write_pnt_q2 if (slide_data_valid) begin @@ -1565,4 +1597,4 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( end end -endmodule: sldu +endmodule: sldu \ No newline at end of file diff --git a/hardware/src/vlsu/addrgen.sv b/hardware/src/vlsu/addrgen.sv index 8112062..68a6700 100644 --- a/hardware/src/vlsu/addrgen.sv +++ b/hardware/src/vlsu/addrgen.sv @@ -96,6 +96,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( logic is_load; logic is_burst; // Unit-strided instructions can be converted into AXI INCR bursts vlen_t vstart; + vlen_t vl_ldst; // Meaning that the cluster should pad zero for write data } addrgen_req_t; addrgen_req_t addrgen_req; logic addrgen_req_valid; @@ -197,7 +198,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( axi_addr_t lookahead_addr_e_d, lookahead_addr_e_q; axi_addr_t lookahead_addr_se_d, lookahead_addr_se_q; - vlen_t lookahead_len_d, lookahead_len_q; + vlen_t lookahead_len_d, lookahead_len_q, lookahead_len_ldst_d, lookahead_len_ldst_q; logic [VLEN-1:0] vaddr_start; @@ -208,6 +209,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_d = lookahead_addr_e_q; lookahead_addr_se_d = lookahead_addr_se_q; lookahead_len_d = lookahead_len_q; + lookahead_len_ldst_d = lookahead_len_ldst_q; // Running vector instructions vinsn_running_d = vinsn_running_q & pe_vinsn_running_i; @@ -260,6 +262,9 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_d = pe_req_i.scalar_op + (pe_req_i.vstart << unsigned'(pe_req_i.vtype.vsew)); lookahead_addr_se_d = pe_req_i.scalar_op + (pe_req_i.vstart * pe_req_i.stride); lookahead_len_d = (pe_req_i.vl - pe_req_i.vstart) << unsigned'(pe_req_i.vtype.vsew[1:0]); + // For synchronization among clusters, vl for vse is always multiplier of NrLanes*NrClusters, but actual write vl may + // be smaller. Here we tell vstu module how many data should not be written (i.e. set write enable to zero) + lookahead_len_ldst_d = (pe_req_i.vl - pe_req_i.vl_ldst) << unsigned'(pe_req_i.vtype.vsew[1:0]); case (pe_req_i.op) VLXE, VSXE: begin @@ -348,7 +353,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( is_load : is_load(pe_req_q.op), // Unit-strided loads/stores trigger incremental AXI bursts. is_burst: (pe_req_q.op inside {VLE, VSE}), - vstart : pe_req_q.vstart + vstart : pe_req_q.vstart, + vl_ldst : lookahead_len_ldst_q }; // Ara does not support misaligned AXI requests @@ -410,7 +416,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( is_load : is_load(pe_req_q.op), // Unit-strided loads/stores trigger incremental AXI bursts. is_burst: 1'b0, - vstart : pe_req_q.vstart + vstart : pe_req_q.vstart, + vl_ldst : lookahead_len_ldst_q }; addrgen_req_valid = 1'b1; @@ -625,6 +632,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_q <= '0; lookahead_addr_se_q <= '0; lookahead_len_q <= '0; + lookahead_len_ldst_q <= '0; end else begin state_q <= state_d; pe_req_q <= pe_req_d; @@ -638,6 +646,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_q <= lookahead_addr_e_d; lookahead_addr_se_q <= lookahead_addr_se_d; lookahead_len_q <= lookahead_len_d; + lookahead_len_ldst_q <= lookahead_len_ldst_d; end end @@ -680,8 +689,12 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // AXI Request Generation // ////////////////////////////// + // enum logic [1:0] { + // AXI_ADDRGEN_IDLE, AXI_ADDRGEN_MISALIGNED, AXI_ADDRGEN_WAITING, AXI_ADDRGEN_REQUESTING + // } axi_addrgen_state_d, axi_addrgen_state_q; + enum logic [1:0] { - AXI_ADDRGEN_IDLE, AXI_ADDRGEN_MISALIGNED, AXI_ADDRGEN_WAITING, AXI_ADDRGEN_REQUESTING + AXI_ADDRGEN_IDLE, AXI_ADDRGEN_WAITING, AXI_ADDRGEN_REQUESTING } axi_addrgen_state_d, axi_addrgen_state_q; axi_addr_t aligned_start_addr_d, aligned_start_addr_q; @@ -787,25 +800,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( if (addrgen_req_valid) begin axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; - // In case of a misaligned store, reduce the effective width of the AXI transaction, - // since the store unit does not support misalignments between the AXI bus and the lanes - if (axi_addrgen_d.vstart != 0 && !axi_addrgen_d.is_load) begin - // vstart > 0 can create problems similar to the ones a misalignment would create. - // Limit the effective AXI bus width to the element width to avoid problems. - axi_addrgen_state_d = AXI_ADDRGEN_MISALIGNED; - - eff_axi_dw_d = 1 << axi_addrgen_d.vew; - eff_axi_dw_log_d = axi_addrgen_d.vew; - end else if ((axi_addrgen_d.addr[clog2_AxiStrobeWidth-1:0] != '0) && !axi_addrgen_d.is_load) begin - // Calculate the start and the end addresses in the AXI_ADDRGEN_MISALIGNED state - axi_addrgen_state_d = AXI_ADDRGEN_MISALIGNED; - - eff_axi_dw_d = {1'b0, narrow_axi_data_bwidth}; - eff_axi_dw_log_d = zeroes_cnt; - end else begin - eff_axi_dw_d = AxiDataWidth/8; - eff_axi_dw_log_d = clog2_AxiStrobeWidth; - end + eff_axi_dw_d = AxiDataWidth/8; + eff_axi_dw_log_d = clog2_AxiStrobeWidth; end end // AXI_ADDRGEN_IDLE: begin @@ -856,24 +852,24 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // aligned_end_addr_d = aligned_next_start_addr_d - 1;*/ // end // end - AXI_ADDRGEN_MISALIGNED: begin - axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; + // AXI_ADDRGEN_MISALIGNED: begin + // axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; - // The start address is found by aligning the original request address by the width of - // the memory interface. - aligned_start_addr_d = aligned_addr(axi_addrgen_q.addr, eff_axi_dw_log_q); + // // The start address is found by aligning the original request address by the width of + // // the memory interface. + // aligned_start_addr_d = aligned_addr(axi_addrgen_q.addr, eff_axi_dw_log_q); - set_end_addr ( - next_2page_msb_q, - axi_addrgen_q.len, - axi_addrgen_q.addr, - eff_axi_dw_q, - eff_axi_dw_log_q, - aligned_start_addr_d, - aligned_end_addr_d, - aligned_next_start_addr_d - ); - end + // set_end_addr ( + // next_2page_msb_q, + // axi_addrgen_q.len, + // axi_addrgen_q.addr, + // eff_axi_dw_q, + // eff_axi_dw_log_q, + // aligned_start_addr_d, + // aligned_end_addr_d, + // aligned_next_start_addr_d + // ); + // end // AXI_ADDRGEN_MISALIGNED: begin // axi_addrgen_state_d = core_st_pending_i ? AXI_ADDRGEN_WAITING : AXI_ADDRGEN_REQUESTING; @@ -992,7 +988,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( addr : paddr, len : burst_length - 1, size : eff_axi_dw_log_q, - is_load : axi_addrgen_q.is_load + is_load : axi_addrgen_q.is_load, + vl_ldst : axi_addrgen_q.vl_ldst }; // Calculate the addresses for the next iteration @@ -1042,7 +1039,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( addr : paddr, size : axi_addrgen_q.vew, len : 0, - is_load : axi_addrgen_q.is_load + is_load : axi_addrgen_q.is_load, + vl_ldst : axi_addrgen_q.vl_ldst }; // Account for the requested operands @@ -1104,7 +1102,8 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( addr : idx_final_paddr, size : axi_addrgen_q.vew, len : 0, - is_load : axi_addrgen_q.is_load + is_load : axi_addrgen_q.is_load, + vl_ldst : axi_addrgen_q.vl_ldst }; // Account for the requested operands diff --git a/hardware/src/vlsu/align_stage.sv b/hardware/src/vlsu/align_stage.sv index 4c7708c..1a470ff 100644 --- a/hardware/src/vlsu/align_stage.sv +++ b/hardware/src/vlsu/align_stage.sv @@ -30,6 +30,9 @@ module align_stage import ara_pkg::*; import rvv_pkg::*; #( input logic rst_ni, // Interfaces with Ariane input accelerator_req_t acc_req_i, + // From global_ldst + input logic ar_addrgen_ack_i, + input logic aw_addrgen_ack_i, input axi_req_t axi_req_i, output axi_req_t axi_req_o, @@ -40,7 +43,7 @@ module align_stage import ara_pkg::*; import rvv_pkg::*; #( localparam int unsigned MAXVL_CL = VLEN * NrClusters; typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; -vlen_cl_t vl, vl_d, vl_q; +vlen_cl_t vl_ld, vl_st, rd_vl_d, rd_vl_q; vtype_t vtype; global_dispatcher #( @@ -51,7 +54,11 @@ global_dispatcher #( .clk_i (clk_i), .rst_ni (rst_ni), .acc_req_i (acc_req_i), - .vl_o (vl), + .acc_req_ready_o (), + .ar_addrgen_ack_i (ar_addrgen_ack_i), + .aw_addrgen_ack_i (aw_addrgen_ack_i), + .vl_ld_o (vl_ld), + .vl_st_o (vl_st), .vtype_o (vtype) ); @@ -92,9 +99,9 @@ be_data_t be_final_d, be_final_q; always_ff @(posedge clk_i or negedge rst_ni) begin if(~rst_ni) begin - vl_q <= '0; + rd_vl_q <= '0; end else begin - vl_q <= vl_d; + rd_vl_q <= rd_vl_d; end end @@ -191,7 +198,7 @@ always_comb begin r_pnt_tracker_d = r_pnt_tracker_q; data_prev_d = data_prev_q; data_prev_valid_d = data_prev_valid_q; - vl_d = vl_q; + rd_vl_d = rd_vl_q; // If a request arrives, add to tracker. // Assign shift enable for different stages @@ -199,16 +206,16 @@ always_comb begin automatic int burst = axi_req_i.ar.len + 1; automatic int axi_bytes = AxiDataWidth/8; automatic vlen_cl_t vlen_request = ((burst << $clog2(AxiDataWidth/8)) - (axi_req_i.ar.addr[$clog2(AxiDataWidth/8)-1:0])) >> vtype.vsew; - vl_d = vl_q + vlen_request; + rd_vl_d = rd_vl_q + vlen_request; tracker_d[w_pnt_tracker_q].addr = axi_req_i.ar.addr; - tracker_d[w_pnt_tracker_q].len = vl; + tracker_d[w_pnt_tracker_q].len = vl_ld; tracker_d[w_pnt_tracker_q].vew = vtype.vsew; for (int s=0; s < NumStages; s++) tracker_d[w_pnt_tracker_q].num_requests[s] += 1; // If the first request - if (vl_q == 0) begin + if (rd_vl_q == 0) begin for (int s=0; s= vl) begin - vl_d = 0; + if (rd_vl_d >= vl_ld) begin + rd_vl_d = 0; w_pnt_tracker_d = w_pnt_tracker_q + 1; if (w_pnt_tracker_q == NumTrackers-1) begin w_pnt_tracker_d = 0; @@ -380,7 +387,7 @@ always_comb begin wr_cnt_d += 1; wr_pnt_d = (wr_pnt_q == NumTrackers-1) ? 0 : wr_pnt_q + 1; - if (wr_vl_d >= vl) begin + if (wr_vl_d >= vl_st) begin wr_vl_d = 0; b_pnt_d = (b_pnt_q == NumTrackers-1) ? 0 : b_pnt_q + 1; end diff --git a/hardware/src/vlsu/global_dispatcher.sv b/hardware/src/vlsu/global_dispatcher.sv index 94f6432..aaffbc1 100644 --- a/hardware/src/vlsu/global_dispatcher.sv +++ b/hardware/src/vlsu/global_dispatcher.sv @@ -19,27 +19,43 @@ module global_dispatcher import ara_pkg::*; import rvv_pkg::*; #( input logic rst_ni, // Interfaces with Ariane input accelerator_req_t acc_req_i, + output logic acc_req_ready_o, - output vlen_cl_t vl_o, + // Interface with GLSU + // To prevent vl_ld/vl_st from changing before the undergoing ld/st finishes + input logic ar_addrgen_ack_i, + input logic aw_addrgen_ack_i, + + output vlen_cl_t vl_ld_o, + output vlen_cl_t vl_st_o, output vtype_t vtype_o ); `include "common_cells/registers.svh" - vlen_cl_t vl_d, vl_q; - vtype_t vtype_d, vtype_q; + vlen_cl_t vl_st_d, vl_st_q; + vlen_cl_t vl_ld_d, vl_ld_q; + vtype_t vtype_d, vtype_q; + logic acc_req_ready_d, acc_req_ready_q; always_ff @(posedge clk_i or negedge rst_ni) begin if(~rst_ni) begin - vl_q <= 0; + vl_ld_q <= 0; + vl_st_q <= 0; vtype_q <= '{vill: 1'b1, default: '0}; + acc_req_ready_q <= 1'b1; end else begin - vl_q <= vl_d; + vl_ld_q <= vl_ld_d; + vl_st_q <= vl_st_d; vtype_q <= vtype_d; + acc_req_ready_q <= acc_req_ready_d; end end - assign vl_o = vl_q; + assign vl_ld_o = vl_ld_q; + assign vl_st_o = vl_st_q; assign vtype_o = vtype_q; +// assign acc_req_ready_o = acc_req_ready_d; + assign acc_req_ready_o = 1'b1; // Converts between the XLEN-bit vtype CSR and its internal representation function automatic vtype_t vtype_xlen(riscv::xlen_t xlen); @@ -53,80 +69,101 @@ module global_dispatcher import ara_pkg::*; import rvv_pkg::*; #( endfunction : vtype_xlen always_comb begin - vl_d = vl_q; + vl_ld_d = vl_ld_q; + vl_st_d = vl_st_q; vtype_d = vtype_q; + acc_req_ready_d = acc_req_ready_q; + + if ((!acc_req_ready_q) && (ar_addrgen_ack_i || aw_addrgen_ack_i)) begin + acc_req_ready_d = 1'b1; + end - if (acc_req_i.req_valid) begin + if (acc_req_i.req_valid && acc_req_ready_q) begin + automatic rvv_instruction_t insn = rvv_instruction_t'(acc_req_i.insn.instr); // Decode the instructions based on their opcode unique case (acc_req_i.insn.itype.opcode) - riscv::OpcodeVec: begin - automatic rvv_instruction_t insn = rvv_instruction_t'(acc_req_i.insn.instr); - unique case (insn.varith_type.func3) - OPCFG: begin - - // Update vtype - if (insn.vsetvli_type.func1 == 1'b0) begin // vsetvli - vtype_d = vtype_xlen(riscv::xlen_t'(insn.vsetvli_type.zimm11)); - end else if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli - vtype_d = vtype_xlen(riscv::xlen_t'(insn.vsetivli_type.zimm10)); - end else if (insn.vsetvl_type.func7 == 7'b100_0000) begin // vsetvl - vtype_d = vtype_xlen(riscv::xlen_t'(acc_req_i.rs2[7:0])); - end + riscv::OpcodeLoadFp: begin + acc_req_ready_d = 1'b0; + end + riscv::OpcodeStoreFp: begin + acc_req_ready_d = 1'b0; + end + riscv::OpcodeVec: begin + acc_req_ready_d = 1'b1; + unique case (insn.varith_type.func3) + OPCFG: begin + // Update vtype + if (insn.vsetvli_type.func1 == 1'b0) begin // vsetvli + vtype_d = vtype_xlen(riscv::xlen_t'(insn.vsetvli_type.zimm11)); + end else if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli + vtype_d = vtype_xlen(riscv::xlen_t'(insn.vsetivli_type.zimm10)); + end else if (insn.vsetvl_type.func7 == 7'b100_0000) begin // vsetvl + vtype_d = vtype_xlen(riscv::xlen_t'(acc_req_i.rs2[7:0])); + end - // Check whether the updated vtype makes sense - if ((vtype_d.vsew > rvv_pkg::vew_e'($clog2(ELENB))) || // SEW <= ELEN - (vtype_d.vlmul == LMUL_RSVD) || // reserved value - // LMUL >= SEW/ELEN - (signed'($clog2(ELENB)) + signed'(vtype_d.vlmul) < signed'(vtype_d.vsew))) begin - vtype_d = '{vill: 1'b1, default: '0}; - vl_d = '0; - end + // Check whether the updated vtype makes sense + if ((vtype_d.vsew > rvv_pkg::vew_e'($clog2(ELENB))) || // SEW <= ELEN + (vtype_d.vlmul == LMUL_RSVD) || // reserved value + // LMUL >= SEW/ELEN + (signed'($clog2(ELENB)) + signed'(vtype_d.vlmul) < signed'(vtype_d.vsew))) begin + vtype_d = '{vill: 1'b1, default: '0}; + vl_ld_d = '0; + vl_st_d = '0; + end + + // Update the vector length + else begin + // Maximum vector length. VLMAX = LMUL * VLEN / SEW. + automatic int unsigned vlmax = (VLENB << $clog2(NrClusters)) >> vtype_d.vsew; + unique case (vtype_d.vlmul) + LMUL_1 : vlmax <<= 0; + LMUL_2 : vlmax <<= 1; + LMUL_4 : vlmax <<= 2; + LMUL_8 : vlmax <<= 3; + // Fractional LMUL + LMUL_1_2: vlmax >>= 1; + LMUL_1_4: vlmax >>= 2; + LMUL_1_8: vlmax >>= 3; + default:; + endcase - // Update the vector length - else begin - // Maximum vector length. VLMAX = LMUL * VLEN / SEW. - automatic int unsigned vlmax = (VLENB << $clog2(NrClusters)) >> vtype_d.vsew; - unique case (vtype_d.vlmul) - LMUL_1 : vlmax <<= 0; - LMUL_2 : vlmax <<= 1; - LMUL_4 : vlmax <<= 2; - LMUL_8 : vlmax <<= 3; - // Fractional LMUL - LMUL_1_2: vlmax >>= 1; - LMUL_1_4: vlmax >>= 2; - LMUL_1_8: vlmax >>= 3; - default:; - endcase - - if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli - vl_d = vlen_t'(insn.vsetivli_type.uimm5); - end else begin // vsetvl || vsetvli - if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd == '0) begin - // Do not update the vector length - vl_d = vl_q; - end else if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd != '0) begin - // Set the vector length to vlmax - vl_d = vlmax; - end else begin - // Normal stripmining - // vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || - // (vlen_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_t'(acc_req_i.rs1); - if (((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || - (vlen_cl_t'(acc_req_i.rs1) > vlmax))) begin - vl_d = vlmax; - end else if (|vlen_cl_t'(acc_req_i.rs1[$clog2(NrClusters * NrLanes)-1:0])) begin - vl_d = vlen_cl_t'(((acc_req_i.rs1 >> $clog2(NrClusters * NrLanes)) + 1) << $clog2(NrClusters * NrLanes)); + if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli + vl_ld_d = vlen_t'(insn.vsetivli_type.uimm5); + vl_st_d = vlen_t'(insn.vsetivli_type.uimm5); + end else begin // vsetvl || vsetvli + if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd == '0) begin + // Do not update the vector length + vl_ld_d = vl_ld_q; + vl_st_d = vl_st_q; + end else if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd != '0) begin + // Set the vector length to vlmax + vl_ld_d = vlmax; + vl_st_d = vlmax; end else begin - vl_d = vlen_cl_t'(acc_req_i.rs1); + // vl_st_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_st_d)]) || + // (vlen_cl_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_cl_t'(acc_req_i.rs1); + + // Normal stripmining + // vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || + // (vlen_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_t'(acc_req_i.rs1); + if (((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_ld_d)]) || + (vlen_cl_t'(acc_req_i.rs1) > vlmax))) begin + vl_ld_d = vlmax; + end else if (|vlen_cl_t'(acc_req_i.rs1[$clog2(NrClusters * NrLanes)-1:0])) begin + vl_ld_d = vlen_cl_t'(((acc_req_i.rs1 >> $clog2(NrClusters * NrLanes)) + 1) << $clog2(NrClusters * NrLanes)); + end else begin + vl_ld_d = vlen_cl_t'(acc_req_i.rs1); + end + + vl_st_d = vl_ld_d; end end end end - end - default: ; - endcase - end - default: ; + default: ; + endcase + end + default: acc_req_ready_d = 1'b1; endcase end end diff --git a/hardware/src/vlsu/global_ldst.sv b/hardware/src/vlsu/global_ldst.sv index 58b920f..772bb47 100644 --- a/hardware/src/vlsu/global_ldst.sv +++ b/hardware/src/vlsu/global_ldst.sv @@ -30,10 +30,15 @@ module global_ldst import ara_pkg::*; import rvv_pkg::*; #( // Interfaces with Ariane input accelerator_req_t acc_req_i, + output logic acc_req_ready_o, // To ARA input cluster_axi_req_t [NrClusters-1:0] axi_req_i, output cluster_axi_resp_t [NrClusters-1:0] axi_resp_o, + + // To shuffle stage and align stage + output logic ar_addrgen_ack_o, + output logic aw_addrgen_ack_o, // To System AXI input axi_resp_t axi_resp_i, @@ -42,9 +47,13 @@ module global_ldst import ara_pkg::*; import rvv_pkg::*; #( localparam int unsigned MAXVL_CL = VLEN * NrClusters; typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; -vlen_cl_t vl; +vlen_cl_t vl_ld, vl_st; vtype_t vtype; +logic ar_addrgen_ack, aw_addrgen_ack; +assign ar_addrgen_ack_o = ar_addrgen_ack; +assign aw_addrgen_ack_o = aw_addrgen_ack; + global_dispatcher #( .NrLanes (NrLanes ), .NrClusters (NrClusters), @@ -53,7 +62,11 @@ global_dispatcher #( .clk_i (clk_i), .rst_ni (rst_ni), .acc_req_i (acc_req_i), - .vl_o (vl), + .acc_req_ready_o (acc_req_ready_o), + .ar_addrgen_ack_i (ar_addrgen_ack), + .aw_addrgen_ack_i (aw_addrgen_ack), + .vl_ld_o (vl_ld), + .vl_st_o (vl_st), .vtype_o (vtype) ); @@ -64,7 +77,7 @@ import axi_pkg::CACHE_MODIFIABLE; logic w_ready_q, w_ready_d; // If this unit is ready to receive data from ARA logic w_valid_d, w_valid_q; // If this unit has a walid write data to System -logic w_last_d, w_last_q; // If this is a last write packer +// logic w_last_d, w_last_q; // If this is a last write packer // Pointers to clusters to which data has to be written or read from logic [$clog2(NrClusters)-1:0] cluster_start_r_d, cluster_start_r_q, cluster_start_wr_d, cluster_start_wr_q; @@ -109,6 +122,8 @@ always_ff @(posedge clk_i or negedge rst_ni) begin end end +logic [8:0] w_burst_length, wr_length_check; + always_comb begin : p_global_ldst // Copy data between ARA<->System @@ -120,17 +135,20 @@ always_comb begin : p_global_ldst w_req_ready = ~w_req_valid_q; vl_w_d = vl_w_q; + ar_addrgen_ack = 1'b0; + aw_addrgen_ack = 1'b0; + req_wrmem = '0; req_wrmem.aw_valid = 1'b0; if (axi_req_i[0].aw_valid && w_req_ready) begin req_d.aw = axi_req_i[0].aw; w_req_valid_d = 1'b1; - vl_w_d = vl; + vl_w_d = vl_st; end if (w_req_valid_d==1'b1 && axi_resp_i.aw_ready) begin - automatic logic [8:0] w_burst_length; + // automatic logic [8:0] w_burst_length; automatic axi_addr_t wr_aligned_start_addr_d, wr_aligned_next_start_addr_d, wr_aligned_end_addr_d; automatic logic [($bits(wr_aligned_start_addr_d) - 12)-1:0] wr_next_2page_msb_d; @@ -152,7 +170,8 @@ always_comb begin : p_global_ldst end // 2 - AXI bursts are at most 256 beats long. w_burst_length = MaxAxiBurst; - if (w_burst_length > ((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1) begin + wr_length_check = ((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1; + if (w_burst_length > (((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1)) begin w_burst_length = ((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1; end else begin wr_aligned_next_start_addr_d = wr_aligned_start_addr_d + ((w_burst_length) << size_axi); @@ -168,6 +187,7 @@ always_comb begin : p_global_ldst w_req_valid_d = 1'b1; end else begin w_req_valid_d = 1'b0; + aw_addrgen_ack = 1'b1; end end axi_req_o.aw = req_wrmem.aw; @@ -191,7 +211,7 @@ always_comb begin : p_global_ldst if (axi_req_i[0].ar_valid && r_req_ready) begin req_d.ar = axi_req_i[0].ar; r_req_valid_d = 1'b1; - vl_req_d = vl; + vl_req_d = vl_ld; end if (r_req_valid_d==1'b1 && axi_resp_i.ar_ready) begin @@ -217,7 +237,9 @@ always_comb begin : p_global_ldst end // 2 - AXI bursts are at most 256 beats long. burst_length = MaxAxiBurst; - if (burst_length > ((aligned_end_addr_d - aligned_start_addr_d) >> size_axi) + 1) begin + // if (burst_length > ((aligned_end_addr_d - aligned_start_addr_d) >> size_axi) + 1) begin + // burst_length = ((aligned_end_addr_d - aligned_start_addr_d) >> size_axi) + 1; + if (burst_length > (((aligned_end_addr_d - aligned_start_addr_d) >> size_axi) + 1)) begin burst_length = ((aligned_end_addr_d - aligned_start_addr_d) >> size_axi) + 1; end else begin aligned_next_start_addr_d = aligned_start_addr_d + ((burst_length) << size_axi); @@ -233,6 +255,7 @@ always_comb begin : p_global_ldst end else begin req_d = '0; r_req_valid_d = 1'b0; + ar_addrgen_ack = 1'b1; end end axi_req_o.ar = req_final.ar; @@ -243,9 +266,17 @@ always_comb begin : p_global_ldst // axi_req_o.ar.len = len_r ? len_r-1 : 0; // axi_req_o.ar.size = size_axi; // axi_req_o.ar_valid = axi_req_i[0].ar_valid; + + + + + + // b channel - axi_req_o.b_ready = axi_req_i[0].b_ready; + axi_req_o.b_ready = 1'b1; + for (int i=0; i> axi_addrgen_req_i.vl_ldst); always_comb begin: p_vstu // Maintain state @@ -206,11 +206,11 @@ module vstu import ara_pkg::*; import rvv_pkg::*; #( // - The AXI subsystem is ready to accept this W beat if (vinsn_issue_valid && &stu_operand_valid && (vinsn_issue_q.vm || (|mask_valid_i)) && axi_addrgen_req_valid_i && !axi_addrgen_req_i.is_load && axi_w_ready_i) begin - // Bytes valid in the current W beat - automatic shortint unsigned lower_byte = beat_lower_byte(axi_addrgen_req_i.addr, - axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, len_q); - automatic shortint unsigned upper_byte = beat_upper_byte(axi_addrgen_req_i.addr, - axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, len_q); + // // Bytes valid in the current W beat + // automatic shortint unsigned lower_byte = beat_lower_byte(axi_addrgen_req_i.addr, + // axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, len_q); + // automatic shortint unsigned upper_byte = beat_upper_byte(axi_addrgen_req_i.addr, + // axi_addrgen_req_i.size, axi_addrgen_req_i.len, BURST_INCR, AxiDataWidth/8, len_q); // Account for the issued bytes // How many bytes are valid in this VRF word @@ -218,7 +218,7 @@ module vstu import ara_pkg::*; import rvv_pkg::*; #( // How many bytes are valid in this instruction automatic vlen_t vinsn_valid_bytes = issue_cnt_q - vrf_pnt_q; // How many bytes are valid in this AXI word - automatic vlen_t axi_valid_bytes = upper_byte - lower_byte + 1; + automatic vlen_t axi_valid_bytes = AxiDataWidth / 8; // How many bytes are we committing? automatic logic [idx_width(DataWidth*NrLanes/8):0] valid_bytes; @@ -230,22 +230,21 @@ module vstu import ara_pkg::*; import rvv_pkg::*; #( // Copy data from the operands into the W channel for (int axi_byte = 0; axi_byte < AxiDataWidth/8; axi_byte++) begin // Is this byte a valid byte in the W beat? - if (axi_byte >= lower_byte && axi_byte <= upper_byte) begin - // Map axy_byte to the corresponding byte in the VRF word (sequential) - automatic int vrf_seq_byte = axi_byte - lower_byte + vrf_pnt_q; - // And then shuffle it - automatic int vrf_byte = shuffle_index(vrf_seq_byte, NrLanes, vinsn_issue_q.eew_vs1); - - // Is this byte a valid byte in the VRF word? - if (vrf_seq_byte < issue_cnt_q) begin - // At which lane, and what is the byte offset in that lane, of the byte vrf_byte? - automatic int vrf_lane = vrf_byte >> 3; - automatic int vrf_offset = vrf_byte[2:0]; - - // Copy data - axi_w_o.data[8*axi_byte +: 8] = stu_operand[vrf_lane][8*vrf_offset +: 8]; - axi_w_o.strb[axi_byte] = vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]; - end + // Map axy_byte to the corresponding byte in the VRF word (sequential) + automatic int vrf_seq_byte = axi_byte + vrf_pnt_q; + // And then shuffle it + automatic int vrf_byte = shuffle_index(vrf_seq_byte, NrLanes, vinsn_issue_q.eew_vs1); + + // Is this byte a valid byte in the VRF word? + if (vrf_seq_byte < issue_cnt_q) begin + // At which lane, and what is the byte offset in that lane, of the byte vrf_byte? + automatic int vrf_lane = vrf_byte >> 3; + automatic int vrf_offset = vrf_byte[2:0]; + + // Copy data + axi_w_o.data[8*axi_byte +: 8] = stu_operand[vrf_lane][8*vrf_offset +: 8]; + axi_w_o.strb[axi_byte] = (vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]) && st_strb_en[vrf_seq_byte]; + // axi_w_o.strb[axi_byte] = (vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]); end end From f8b60fe74b36bebe925dff5fd2f10ab9f16acb41 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Thu, 23 Oct 2025 21:12:48 +0200 Subject: [PATCH 04/37] [HW] 1. Synchronize vl and vew between Ara and GLSU for load/store operation, delete global_dispatcher module; 2. Support effective slided data which is not multiple of NrLanes*NrClusters; 3. Support load element number which is not multiple of NrLanes*NrClusters; 4. Support misaligned processing for VSE; 5. Fix store strb bug; 6. Fix cache-cosistency issue between GLSU and scalar core --- Bender.yml | 1 - hardware/src/ara.sv | 3 + hardware/src/ara_cluster.sv | 129 +++-- hardware/src/ara_dispatcher.sv | 7 +- hardware/src/ara_macro.sv | 7 +- hardware/src/lane/lane_sequencer.sv | 5 + hardware/src/sldu/sldu.sv | 19 +- hardware/src/vlsu/addrgen.sv | 18 +- hardware/src/vlsu/align_stage.sv | 45 +- hardware/src/vlsu/global_dispatcher.sv | 172 ------- hardware/src/vlsu/global_ldst.sv | 675 +++++++++++++++++++------ hardware/src/vlsu/shuffle_stage.sv | 46 +- hardware/src/vlsu/vldu.sv | 13 +- hardware/src/vlsu/vlsu.sv | 2 + hardware/src/vlsu/vstu.sv | 37 +- 15 files changed, 692 insertions(+), 487 deletions(-) delete mode 100644 hardware/src/vlsu/global_dispatcher.sv diff --git a/Bender.yml b/Bender.yml index 895eee4..2231773 100644 --- a/Bender.yml +++ b/Bender.yml @@ -52,7 +52,6 @@ sources: - hardware/src/vlsu/addrgen.sv - hardware/src/vlsu/vldu.sv - hardware/src/vlsu/vstu.sv - - hardware/src/vlsu/global_dispatcher.sv - hardware/src/vlsu/global_ldst.sv - hardware/src/vlsu/align_stage.sv - hardware/src/vlsu/shuffle_stage.sv diff --git a/hardware/src/ara.sv b/hardware/src/ara.sv index d39f5f1..78fdaeb 100644 --- a/hardware/src/ara.sv +++ b/hardware/src/ara.sv @@ -53,6 +53,8 @@ module ara import ara_pkg::*; import rvv_pkg::*; #( input axi_resp_t axi_resp_i, output vew_e vew_ar_o, output vew_e vew_aw_o, + // vl upper rounded to multiple of NrLanes and each cluster has the same vl_ldst + output vlen_t vl_ldst_o, // Interface with Ring Interconnect output remote_data_t ring_data_o, @@ -354,6 +356,7 @@ module ara import ara_pkg::*; import rvv_pkg::*; #( .axi_resp_i (axi_resp_i ), .vew_ar_o (vew_ar_o ), .vew_aw_o (vew_aw_o ), + .vl_ldst_o (vl_ldst_o ), // Interface with the dispatcher .core_st_pending_i (core_st_pending ), .load_complete_o (load_complete ), diff --git a/hardware/src/ara_cluster.sv b/hardware/src/ara_cluster.sv index a831011..8684d9f 100644 --- a/hardware/src/ara_cluster.sv +++ b/hardware/src/ara_cluster.sv @@ -63,6 +63,8 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( ); + `include "common_cells/registers.svh" + // Number of Clusters configuration num_cluster_t numClusters; assign numClusters = $clog2(NrClusters); @@ -80,8 +82,6 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( axi_req_t axi_req_cut, axi_req_ldst, axi_req_align, axi_req_align_o; axi_resp_t axi_resp_cut, axi_resp_ldst, axi_resp_align, axi_resp_align_i; - vew_e [NrClusters-1:0] vew_ar, vew_aw; - // Ring connections remote_data_t [NrClusters-1:0] ring_data_l, ring_data_r; logic [NrClusters-1:0] ring_data_l_ready, ring_data_l_valid, ring_data_r_ready, ring_data_r_valid; @@ -96,20 +96,29 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( fork_req_t [nlevels : 0] acc_req_fork; fork_resp_t [nlevels : 0] acc_resp_fork; - accelerator_resp_t acc_resp_fork_glb; // Shuffle stage to ARA cuts localparam int ShuffleCuts = $clog2(NrClusters); + + vew_e [NrClusters-1:0] vew_ar, vew_aw; + vew_e vew_ar_cut, vew_aw_cut, vew_ar_cut_glsu, vew_aw_cut_glsu, + vew_ar_glsu2align, vew_aw_glsu2align, vew_ar_align, vew_aw_align; + vlen_t [NrClusters-1:0] vl_ldst; + vlen_t vl_ldst_cut, vl_ldst_cut_glsu, vl_ldst_rd_glsu2align, vl_ldst_wr_glsu2align, + vl_ldst_rd_align, vl_ldst_wr_align; + + typedef vew_e [NrClusters-1:0] vew_group_t; + typedef vlen_t [NrClusters-1:0] vlen_group_t; + + vew_group_t [ShuffleCuts:0] vew_ar_shuffle_cut, vew_aw_shuffle_cut; + vlen_group_t [ShuffleCuts:0] vl_ldst_suhffle_cut; + typedef cluster_axi_req_t [NrClusters-1:0] group_req_t; typedef cluster_axi_resp_t [NrClusters-1:0] group_resp_t; group_req_t [ShuffleCuts:0] ara_axi_req_shuffle_cut; group_resp_t [ShuffleCuts:0] ara_axi_resp_shuffle_cut; - // GLSU ready to accept new acc req - logic acc_req_ready_glsu; - logic ar_addrgen_ack, aw_addrgen_ack; - ///////// // ARA // ///////// @@ -171,6 +180,7 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .vew_ar_o (vew_ar[cluster] ), .vew_aw_o (vew_aw[cluster] ), + .vl_ldst_o (vl_ldst[cluster] ), // Ring .ring_data_r_i (ring_data_l_cut [cluster == NrClusters-1 ? 0 : cluster + 1] ), @@ -194,6 +204,10 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( assign ara_axi_req_shuffle_cut[0][cluster] = ara_axi_req[cluster]; assign ara_axi_resp[cluster] = ara_axi_resp_shuffle_cut[0][cluster]; + assign vew_ar_shuffle_cut[0][cluster] = vew_ar[cluster]; + assign vew_aw_shuffle_cut[0][cluster] = vew_aw[cluster]; + assign vl_ldst_suhffle_cut[0][cluster] = vl_ldst[cluster]; + for (genvar s=0; s < ShuffleCuts; s++) begin axi_cut #( .ar_chan_t (cluster_axi_ar_t ), @@ -213,6 +227,9 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .mst_req_o (ara_axi_req_shuffle_cut [s+1][cluster]), .mst_resp_i (ara_axi_resp_shuffle_cut[s+1][cluster]) ); + `FF(vew_ar_shuffle_cut[s+1][cluster], vew_ar_shuffle_cut[s][cluster], vew_e'(1'b0), clk_i, rst_ni); + `FF(vew_aw_shuffle_cut[s+1][cluster], vew_aw_shuffle_cut[s][cluster], vew_e'(1'b0), clk_i, rst_ni); + `FF(vl_ldst_suhffle_cut[s+1][cluster], vl_ldst_suhffle_cut[s][cluster], '0, clk_i, rst_ni); end end @@ -336,6 +353,10 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( // Shuffle stage assign ara_axi_req_cut = ara_axi_req_shuffle_cut[ShuffleCuts]; assign ara_axi_resp_shuffle_cut[ShuffleCuts] = ara_axi_resp_cut; + assign vew_ar_cut = vew_ar_shuffle_cut[ShuffleCuts][0]; + assign vew_aw_cut = vew_aw_shuffle_cut[ShuffleCuts][0]; + assign vl_ldst_cut = vl_ldst_suhffle_cut[ShuffleCuts][0]; + shuffle_stage #( .NrLanes (NrLanes ), .NrClusters (NrClusters ), @@ -349,11 +370,8 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .clk_i (clk_i ), .rst_ni (rst_ni ), - .acc_req_i (acc_req_fork[nlevels][0] ), - - // To Shuffle stage and Align stage - .ar_addrgen_ack_i (ar_addrgen_ack ), - .aw_addrgen_ack_i (aw_addrgen_ack ), + .vew_ar_i (vew_ar_cut), + .vew_aw_i (vew_aw_cut), .axi_req_i (ara_axi_req_cut ), .axi_resp_o (ara_axi_resp_cut ), @@ -381,6 +399,10 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .mst_req_o (ldst_axi_req[cluster]), .mst_resp_i (ldst_axi_resp[cluster]) ); + + `FF(vew_ar_cut_glsu, vew_ar_cut, vew_e'(1'b0), clk_i, rst_ni); + `FF(vew_aw_cut_glsu, vew_aw_cut, vew_e'(1'b0), clk_i, rst_ni); + `FF(vl_ldst_cut_glsu, vl_ldst_cut, '0, clk_i, rst_ni); end // Global Ld/St Unit @@ -398,17 +420,22 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .clk_i (clk_i ), .rst_ni (rst_ni ), .acc_req_i (acc_req_fork[nlevels][0] ), - .acc_req_ready_o (acc_req_ready_glsu ), // To Ara .axi_req_i (ldst_axi_req ), .axi_resp_o (ldst_axi_resp ), + .vew_ar_i (vew_ar_cut_glsu), + .vew_aw_i (vew_aw_cut_glsu), + .vl_ldst_i (vl_ldst_cut_glsu), + + .vew_ar_o (vew_ar_glsu2align), + .vew_aw_o (vew_aw_glsu2align), + .vl_ldst_rd_o (vl_ldst_rd_glsu2align), + .vl_ldst_wr_o (vl_ldst_wr_glsu2align), + // .axi_req_i (ara_axi_req_cut ), // .axi_resp_o (ara_axi_resp_cut ), - // To Shuffle stage and Align stage - .ar_addrgen_ack_o (ar_addrgen_ack ), - .aw_addrgen_ack_o (aw_addrgen_ack ), // To System .axi_resp_i (axi_resp_cut ), .axi_req_o (axi_req_cut ) @@ -433,36 +460,38 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .mst_resp_i (axi_resp_ldst) ); + `FF(vew_ar_align, vew_ar_glsu2align, vew_e'(1'b0), clk_i, rst_ni); + `FF(vew_aw_align, vew_aw_glsu2align, vew_e'(1'b0), clk_i, rst_ni); + `FF(vl_ldst_rd_align, vl_ldst_rd_glsu2align, '0, clk_i, rst_ni); + `FF(vl_ldst_wr_align, vl_ldst_wr_glsu2align, '0, clk_i, rst_ni); + // Align stage align_stage #( - .NrLanes (NrLanes ), - .NrClusters (NrClusters ), - .AxiDataWidth (AxiDataWidth ), - .AxiAddrWidth (AxiAddrWidth ), - .axi_ar_t (axi_ar_t ), - .axi_aw_t (axi_aw_t ), - .axi_b_t (axi_b_t ), - .axi_r_t (axi_r_t ), - .axi_w_t (axi_w_t ), - .axi_req_t (axi_req_t ), - .axi_resp_t (axi_resp_t ) - ) i_align_stage ( - .clk_i (clk_i ), - .rst_ni (rst_ni ), - .acc_req_i (acc_req_fork[nlevels][0] ), - - // To Shuffle stage and Align stage - .ar_addrgen_ack_i (ar_addrgen_ack ), - .aw_addrgen_ack_i (aw_addrgen_ack ), - - // .axi_req_i (axi_req_cut ), - // .axi_resp_o (axi_resp_cut ), - - .axi_req_i (axi_req_ldst ), - .axi_resp_o (axi_resp_ldst ), - - .axi_req_o (axi_req_align ), - .axi_resp_i (axi_resp_align ) + .NrLanes (NrLanes ), + .NrClusters (NrClusters ), + .AxiDataWidth (AxiDataWidth ), + .AxiAddrWidth (AxiAddrWidth ), + .axi_ar_t (axi_ar_t ), + .axi_aw_t (axi_aw_t ), + .axi_b_t (axi_b_t ), + .axi_r_t (axi_r_t ), + .axi_w_t (axi_w_t ), + .axi_req_t (axi_req_t ), + .axi_resp_t (axi_resp_t ) + ) i_align_stage ( + .clk_i (clk_i ), + .rst_ni (rst_ni ), + + .axi_req_i (axi_req_ldst ), + .axi_resp_o (axi_resp_ldst ), + + .vew_ar_i (vew_ar_align), + .vew_aw_i (vew_aw_align), + .vl_ldst_rd_i (vl_ldst_rd_align), + .vl_ldst_wr_i (vl_ldst_wr_align), + + .axi_req_o (axi_req_align ), + .axi_resp_i (axi_resp_align ) ); axi_cut #( @@ -526,11 +555,7 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( `endif - - always_comb begin - acc_resp_fork_glb = acc_resp_fork[0][0]; - acc_resp_fork_glb.req_ready = acc_resp_fork[0][0].req_ready && acc_req_ready_glsu; - end + ////////////////// ////// CVA6 ////// @@ -564,13 +589,11 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( assign acc_resp_o = resp_cut_o; assign acc_req_fork[0][0] = req_cut_o; - // assign resp_cut_i = acc_resp_fork[0][0]; - assign resp_cut_i = acc_resp_fork_glb; + assign resp_cut_i = acc_resp_fork[0][0]; `else assign acc_req_fork[0][0] = acc_req_i; - // assign acc_resp_o = acc_resp_fork[0][0]; - assign acc_resp_o = acc_resp_fork_glb; + assign acc_resp_o = acc_resp_fork[0][0]; `endif diff --git a/hardware/src/ara_dispatcher.sv b/hardware/src/ara_dispatcher.sv index e15d0aa..992c9f3 100644 --- a/hardware/src/ara_dispatcher.sv +++ b/hardware/src/ara_dispatcher.sv @@ -3149,7 +3149,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( endcase if (ara_req_d.op inside {VSLIDEUP, VSLIDEDOWN}) begin - ara_req_d.vl = vl_ld_q; + ara_req_d.vl = vl_ld_q; + ara_req_d.vl_ldst = vl_q; end end @@ -3266,8 +3267,8 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // Any valid non-config instruction is a NOP if vl == 0, with some exceptions, // e.g. whole vector memory operations / whole vector register move - if (is_decoding && (((vl_q == '0 && (!(ara_req_d.op inside {[VLE:VSXE]}))) || - (vl_ld_q == '0 && (ara_req_d.op inside {[VLE:VSXE]}))) || null_vslideup) && !is_config && + if (is_decoding && (((vl_q == '0 && (!(ara_req_d.op inside {[VLE:VSXE], [VSLIDEUP:VSLIDEDOWN]}))) || + (vl_ld_q == '0 && (ara_req_d.op inside {[VLE:VSXE], [VSLIDEUP:VSLIDEDOWN]}))) || null_vslideup) && !is_config && !ignore_zero_vl_check && !acc_resp_o.error) begin // If we are acknowledging a memory operation, we must tell Ariane that the memory // operation was resolved (to decrement its pending load/store counter) diff --git a/hardware/src/ara_macro.sv b/hardware/src/ara_macro.sv index 4b826f8..cbcd1de 100644 --- a/hardware/src/ara_macro.sv +++ b/hardware/src/ara_macro.sv @@ -76,8 +76,8 @@ module ara_macro import ara_pkg::*; import rvv_pkg::*; #( input logic ring_data_l_ready_i, output vew_e vew_ar_o, - output vew_e vew_aw_o - + output vew_e vew_aw_o, + output vlen_t vl_ldst_o ); `include "common_cells/registers.svh" @@ -92,6 +92,7 @@ module ara_macro import ara_pkg::*; import rvv_pkg::*; #( logic sldu_ready_i, sldu_ready_o; vew_e vew_ar, vew_aw; + vlen_t vl_ldst; id_cluster_t cluster_id; num_cluster_t num_clusters; @@ -123,6 +124,7 @@ module ara_macro import ara_pkg::*; import rvv_pkg::*; #( `FF(vew_ar_o, vew_ar, vew_e'(1'b0), clk_i, rst_ni); `FF(vew_aw_o, vew_aw, vew_e'(1'b0), clk_i, rst_ni); + `FF(vl_ldst_o, vl_ldst, '0, clk_i, rst_ni); `FF(cluster_id, cluster_id_i, '0, clk_i, rst_ni); `FF(num_clusters, num_clusters_i, '0, clk_i, rst_ni); @@ -258,6 +260,7 @@ module ara_macro import ara_pkg::*; import rvv_pkg::*; #( .vew_ar_o (vew_ar ), .vew_aw_o (vew_aw ), + .vl_ldst_o (vl_ldst ), // To Ring Routers .ring_data_o (sldu_o ), diff --git a/hardware/src/lane/lane_sequencer.sv b/hardware/src/lane/lane_sequencer.sv index e74bd1e..dd83b33 100644 --- a/hardware/src/lane/lane_sequencer.sv +++ b/hardware/src/lane/lane_sequencer.sv @@ -38,6 +38,9 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: input logic [NrVInsn-1:0] mfpu_vinsn_done_i ); + // vlen_t num_el_check; + // vlen_t cluster_stride_check; + id_cluster_t max_cluster_id; assign max_cluster_id = (1 << num_clusters_i) - 1; @@ -574,6 +577,8 @@ module lane_sequencer import ara_pkg::*; import rvv_pkg::*; import cf_math_pkg:: automatic vlen_t num_el = (cluster_stride * NrLanes * 8) >> pe_req_i.vtype.vsew; operand_request_i[SlideAddrGenA].vl = (pe_req.vl - num_el + NrLanes - 1) / NrLanes; + // cluster_stride_check = cluster_stride; + // num_el_check = num_el; end VSLIDEDOWN: begin // Extra elements to ask, because of the stride diff --git a/hardware/src/sldu/sldu.sv b/hardware/src/sldu/sldu.sv index 06a21b3..6eec7e1 100644 --- a/hardware/src/sldu/sldu.sv +++ b/hardware/src/sldu/sldu.sv @@ -726,7 +726,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( issue_cnt_d = vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew); // Initialize be-enable-generation ancillary signals - output_limit_d = issue_cnt_d; + output_limit_d = vinsn_issue_q.vl_ldst << int'(vinsn_issue_q.vtype.vsew); // issue_cnt_d -= ((cluster_strides + cluster_id_i) >> num_clusters_i) * 8 * NrLanes; @@ -767,7 +767,8 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( // ((vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) + 8*NrLanes); issue_cnt_d = (vinsn_issue_q.use_scalar_op || (vinsn_issue_q.stride == 0)) ? (vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) : ((vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew)) + 8*NrLanes); - output_limit_d = vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew); + // output_limit_d = vinsn_issue_q.vl << int'(vinsn_issue_q.vtype.vsew); + output_limit_d = vinsn_issue_q.vl_ldst << int'(vinsn_issue_q.vtype.vsew); end // Ordered sum reductions @@ -818,17 +819,23 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( out_en = out_en_flat & ({8*NrLanes{vinsn_issue_q.vm | (vinsn_issue_q.vfu inside {VFU_Alu, VFU_MFpu})}} | mask_q); // Write in the correct bytes - if (init_queue_q && !slidedown_extra_flit) begin + if (init_queue_q) begin // To initialize the queue only once with the local shifted data // The ring data is written later on top of the initialized data for (int lane = 0; lane < NrLanes; lane++) for (int b = 0; b < 8; b++) if (out_en[lane][b]) begin - result_queue_d[result_queue_write_pnt_q][lane].wdata[8*b +: 8] = sld_op_dst[lane][8*b +: 8]; + // If this is the last extra operand flit that is used for highest few elements of SLIDEDOWN, we dont update the wdata + if (!slidedown_extra_flit) begin + result_queue_d[result_queue_write_pnt_q][lane].wdata[8*b +: 8] = sld_op_dst[lane][8*b +: 8]; + end result_queue_d[result_queue_write_pnt_q][lane].be[b] = 1'b1; end else begin // Unchanged policy - result_queue_d[result_queue_write_pnt_q][lane].wdata[8*b +: 8] = sldu_operand_ref[lane][8*b +: 8]; + // If this is the last extra operand flit that is used for highest few elements of SLIDEDOWN, we dont update the wdata + if (!slidedown_extra_flit) begin + result_queue_d[result_queue_write_pnt_q][lane].wdata[8*b +: 8] = sldu_operand_ref[lane][8*b +: 8]; + end result_queue_d[result_queue_write_pnt_q][lane].be[b] = 1'b1; end init_queue_d = 1'b0; @@ -1278,7 +1285,7 @@ module sldu import ara_pkg::*; import rvv_pkg::*; #( result_queue_cnt_d += 1; end result_queue_d[result_queue_write_pnt_q2][lane_id].id = vinsn_ring.id; - result_queue_d[result_queue_write_pnt_q2][lane_id].be = '1; + // result_queue_d[result_queue_write_pnt_q2][lane_id].be = '1; // For the edge clusters, We need to have the current ring packet and the previous ring packet // if (is_edge_cluster) begin diff --git a/hardware/src/vlsu/addrgen.sv b/hardware/src/vlsu/addrgen.sv index 68a6700..fb58cf9 100644 --- a/hardware/src/vlsu/addrgen.sv +++ b/hardware/src/vlsu/addrgen.sv @@ -28,6 +28,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( output vew_e vew_aw_o, output logic axi_aw_valid_o, input logic axi_aw_ready_i, + output vlen_t vl_ldst_o, // Interace with the dispatcher input logic core_st_pending_i, // Interface with the main sequencer @@ -198,7 +199,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( axi_addr_t lookahead_addr_e_d, lookahead_addr_e_q; axi_addr_t lookahead_addr_se_d, lookahead_addr_se_q; - vlen_t lookahead_len_d, lookahead_len_q, lookahead_len_ldst_d, lookahead_len_ldst_q; + vlen_t lookahead_len_d, lookahead_len_q, lookahead_len_ldst_left_d, lookahead_len_ldst_left_q; logic [VLEN-1:0] vaddr_start; @@ -209,7 +210,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_d = lookahead_addr_e_q; lookahead_addr_se_d = lookahead_addr_se_q; lookahead_len_d = lookahead_len_q; - lookahead_len_ldst_d = lookahead_len_ldst_q; + lookahead_len_ldst_left_d = lookahead_len_ldst_left_q; // Running vector instructions vinsn_running_d = vinsn_running_q & pe_vinsn_running_i; @@ -264,7 +265,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_len_d = (pe_req_i.vl - pe_req_i.vstart) << unsigned'(pe_req_i.vtype.vsew[1:0]); // For synchronization among clusters, vl for vse is always multiplier of NrLanes*NrClusters, but actual write vl may // be smaller. Here we tell vstu module how many data should not be written (i.e. set write enable to zero) - lookahead_len_ldst_d = (pe_req_i.vl - pe_req_i.vl_ldst) << unsigned'(pe_req_i.vtype.vsew[1:0]); + lookahead_len_ldst_left_d = (pe_req_i.vl - pe_req_i.vl_ldst) << unsigned'(pe_req_i.vtype.vsew[1:0]); case (pe_req_i.op) VLXE, VSXE: begin @@ -354,7 +355,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // Unit-strided loads/stores trigger incremental AXI bursts. is_burst: (pe_req_q.op inside {VLE, VSE}), vstart : pe_req_q.vstart, - vl_ldst : lookahead_len_ldst_q + vl_ldst : lookahead_len_ldst_left_q }; // Ara does not support misaligned AXI requests @@ -417,7 +418,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( // Unit-strided loads/stores trigger incremental AXI bursts. is_burst: 1'b0, vstart : pe_req_q.vstart, - vl_ldst : lookahead_len_ldst_q + vl_ldst : lookahead_len_ldst_left_q }; addrgen_req_valid = 1'b1; @@ -632,7 +633,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_q <= '0; lookahead_addr_se_q <= '0; lookahead_len_q <= '0; - lookahead_len_ldst_q <= '0; + lookahead_len_ldst_left_q <= '0; end else begin state_q <= state_d; pe_req_q <= pe_req_d; @@ -646,7 +647,7 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( lookahead_addr_e_q <= lookahead_addr_e_d; lookahead_addr_se_q <= lookahead_addr_se_d; lookahead_len_q <= lookahead_len_d; - lookahead_len_ldst_q <= lookahead_len_ldst_d; + lookahead_len_ldst_left_q <= lookahead_len_ldst_left_d; end end @@ -1113,6 +1114,9 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #( end : if_idx_addr_valid_q end : indexed_data + vew_ar_o = vew_e'(axi_addrgen_q.vew); + vew_aw_o = vew_e'(axi_addrgen_q.vew); + vl_ldst_o = pe_req_q.vl; if (axi_addrgen_q.is_burst) begin : unit_stride // UNIT-STRIDED ACCESS // AR Channel axi_ar_valid_o = axi_addrgen_q.is_load; diff --git a/hardware/src/vlsu/align_stage.sv b/hardware/src/vlsu/align_stage.sv index 1a470ff..fbfd37e 100644 --- a/hardware/src/vlsu/align_stage.sv +++ b/hardware/src/vlsu/align_stage.sv @@ -28,11 +28,12 @@ module align_stage import ara_pkg::*; import rvv_pkg::*; #( // Clock and Reset input logic clk_i, input logic rst_ni, - // Interfaces with Ariane - input accelerator_req_t acc_req_i, - // From global_ldst - input logic ar_addrgen_ack_i, - input logic aw_addrgen_ack_i, + + // vew information to align stage + input vew_e vew_ar_i, + input vew_e vew_aw_i, + input vlen_t vl_ldst_rd_i, + input vlen_t vl_ldst_wr_i, input axi_req_t axi_req_i, output axi_req_t axi_req_o, @@ -43,24 +44,8 @@ module align_stage import ara_pkg::*; import rvv_pkg::*; #( localparam int unsigned MAXVL_CL = VLEN * NrClusters; typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; -vlen_cl_t vl_ld, vl_st, rd_vl_d, rd_vl_q; -vtype_t vtype; - -global_dispatcher #( - .NrLanes (NrLanes ), - .NrClusters (NrClusters), - .vlen_cl_t (vlen_cl_t ) -) i_global_dispatcher ( - .clk_i (clk_i), - .rst_ni (rst_ni), - .acc_req_i (acc_req_i), - .acc_req_ready_o (), - .ar_addrgen_ack_i (ar_addrgen_ack_i), - .aw_addrgen_ack_i (aw_addrgen_ack_i), - .vl_ld_o (vl_ld), - .vl_st_o (vl_st), - .vtype_o (vtype) -); + +vlen_cl_t rd_vl_d, rd_vl_q; localparam int unsigned NumTrackers=8; typedef logic [$clog2(NumTrackers)-1:0] pnt_t; @@ -205,12 +190,13 @@ always_comb begin if (axi_req_i.ar_valid && axi_resp_o.ar_ready) begin automatic int burst = axi_req_i.ar.len + 1; automatic int axi_bytes = AxiDataWidth/8; - automatic vlen_cl_t vlen_request = ((burst << $clog2(AxiDataWidth/8)) - (axi_req_i.ar.addr[$clog2(AxiDataWidth/8)-1:0])) >> vtype.vsew; + automatic vlen_cl_t vlen_request = ((burst << $clog2(AxiDataWidth/8)) - (axi_req_i.ar.addr[$clog2(AxiDataWidth/8)-1:0])) >> vew_ar_i; + // automatic vlen_cl_t vlen_request = (burst << axi_req_i.ar.size) >> vew_ar_i; rd_vl_d = rd_vl_q + vlen_request; tracker_d[w_pnt_tracker_q].addr = axi_req_i.ar.addr; - tracker_d[w_pnt_tracker_q].len = vl_ld; - tracker_d[w_pnt_tracker_q].vew = vtype.vsew; + tracker_d[w_pnt_tracker_q].len = vl_ldst_rd_i << $clog2(NrClusters); + tracker_d[w_pnt_tracker_q].vew = vew_ar_i; for (int s=0; s < NumStages; s++) tracker_d[w_pnt_tracker_q].num_requests[s] += 1; @@ -224,7 +210,7 @@ always_comb begin end // If last request - if (rd_vl_d >= vl_ld) begin + if (rd_vl_d >= (vl_ldst_rd_i << $clog2(NrClusters))) begin rd_vl_d = 0; w_pnt_tracker_d = w_pnt_tracker_q + 1; if (w_pnt_tracker_q == NumTrackers-1) begin @@ -379,7 +365,8 @@ always_comb begin if (axi_req_i.aw_valid && axi_resp_o.aw_ready) begin automatic int burst = axi_req_i.aw.len + 1; automatic int axi_bytes = AxiDataWidth/8; - automatic vlen_cl_t vlen_request = ((burst << $clog2(AxiDataWidth/8)) - (axi_req_i.aw.addr[$clog2(AxiDataWidth/8)-1:0])) >> vtype.vsew; + // automatic vlen_cl_t vlen_request = ((burst << $clog2(AxiDataWidth/8)) - (axi_req_i.aw.addr[$clog2(AxiDataWidth/8)-1:0])) >> vew_aw_i; + automatic vlen_cl_t vlen_request = (burst << axi_req_i.aw.size) >> vew_aw_i; wr_vl_d = wr_vl_q + vlen_request; wr_track_d[wr_pnt_q].len = axi_req_i.aw.len; @@ -387,7 +374,7 @@ always_comb begin wr_cnt_d += 1; wr_pnt_d = (wr_pnt_q == NumTrackers-1) ? 0 : wr_pnt_q + 1; - if (wr_vl_d >= vl_st) begin + if (wr_vl_d >= (vl_ldst_wr_i << $clog2(NrClusters))) begin wr_vl_d = 0; b_pnt_d = (b_pnt_q == NumTrackers-1) ? 0 : b_pnt_q + 1; end diff --git a/hardware/src/vlsu/global_dispatcher.sv b/hardware/src/vlsu/global_dispatcher.sv deleted file mode 100644 index aaffbc1..0000000 --- a/hardware/src/vlsu/global_dispatcher.sv +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2024-2025 ETH Zurich and University of Bologna. -// Solderpad Hardware License, Version 0.51, see LICENSE for details. -// SPDX-License-Identifier: SHL-0.51 -// -// Author: Navaneeth Kunhi Purayil -// -// Description: -// Global Dispatcher unit that receives request from CVA6 to decode the -// vl and vtype of the current configuration for LdSt requests. - -module global_dispatcher import ara_pkg::*; import rvv_pkg::*; #( - parameter int unsigned NrLanes = 0, // Number of parallel vector lanes. - parameter int unsigned NrClusters = 0, - parameter type vlen_cl_t = logic -) -( - // Clock and reset - input logic clk_i, - input logic rst_ni, - // Interfaces with Ariane - input accelerator_req_t acc_req_i, - output logic acc_req_ready_o, - - // Interface with GLSU - // To prevent vl_ld/vl_st from changing before the undergoing ld/st finishes - input logic ar_addrgen_ack_i, - input logic aw_addrgen_ack_i, - - output vlen_cl_t vl_ld_o, - output vlen_cl_t vl_st_o, - output vtype_t vtype_o -); - `include "common_cells/registers.svh" - - vlen_cl_t vl_st_d, vl_st_q; - vlen_cl_t vl_ld_d, vl_ld_q; - vtype_t vtype_d, vtype_q; - logic acc_req_ready_d, acc_req_ready_q; - - always_ff @(posedge clk_i or negedge rst_ni) begin - if(~rst_ni) begin - vl_ld_q <= 0; - vl_st_q <= 0; - vtype_q <= '{vill: 1'b1, default: '0}; - acc_req_ready_q <= 1'b1; - end else begin - vl_ld_q <= vl_ld_d; - vl_st_q <= vl_st_d; - vtype_q <= vtype_d; - acc_req_ready_q <= acc_req_ready_d; - end - end - - assign vl_ld_o = vl_ld_q; - assign vl_st_o = vl_st_q; - assign vtype_o = vtype_q; -// assign acc_req_ready_o = acc_req_ready_d; - assign acc_req_ready_o = 1'b1; - - // Converts between the XLEN-bit vtype CSR and its internal representation - function automatic vtype_t vtype_xlen(riscv::xlen_t xlen); - vtype_xlen = '{ - vill : xlen[riscv::XLEN-1], - vma : xlen[7], - vta : xlen[6], - vsew : vew_e'(xlen[5:3]), - vlmul : vlmul_e'(xlen[2:0]) - }; - endfunction : vtype_xlen - - always_comb begin - vl_ld_d = vl_ld_q; - vl_st_d = vl_st_q; - vtype_d = vtype_q; - acc_req_ready_d = acc_req_ready_q; - - if ((!acc_req_ready_q) && (ar_addrgen_ack_i || aw_addrgen_ack_i)) begin - acc_req_ready_d = 1'b1; - end - - if (acc_req_i.req_valid && acc_req_ready_q) begin - automatic rvv_instruction_t insn = rvv_instruction_t'(acc_req_i.insn.instr); - // Decode the instructions based on their opcode - unique case (acc_req_i.insn.itype.opcode) - riscv::OpcodeLoadFp: begin - acc_req_ready_d = 1'b0; - end - riscv::OpcodeStoreFp: begin - acc_req_ready_d = 1'b0; - end - riscv::OpcodeVec: begin - acc_req_ready_d = 1'b1; - unique case (insn.varith_type.func3) - OPCFG: begin - // Update vtype - if (insn.vsetvli_type.func1 == 1'b0) begin // vsetvli - vtype_d = vtype_xlen(riscv::xlen_t'(insn.vsetvli_type.zimm11)); - end else if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli - vtype_d = vtype_xlen(riscv::xlen_t'(insn.vsetivli_type.zimm10)); - end else if (insn.vsetvl_type.func7 == 7'b100_0000) begin // vsetvl - vtype_d = vtype_xlen(riscv::xlen_t'(acc_req_i.rs2[7:0])); - end - - // Check whether the updated vtype makes sense - if ((vtype_d.vsew > rvv_pkg::vew_e'($clog2(ELENB))) || // SEW <= ELEN - (vtype_d.vlmul == LMUL_RSVD) || // reserved value - // LMUL >= SEW/ELEN - (signed'($clog2(ELENB)) + signed'(vtype_d.vlmul) < signed'(vtype_d.vsew))) begin - vtype_d = '{vill: 1'b1, default: '0}; - vl_ld_d = '0; - vl_st_d = '0; - end - - // Update the vector length - else begin - // Maximum vector length. VLMAX = LMUL * VLEN / SEW. - automatic int unsigned vlmax = (VLENB << $clog2(NrClusters)) >> vtype_d.vsew; - unique case (vtype_d.vlmul) - LMUL_1 : vlmax <<= 0; - LMUL_2 : vlmax <<= 1; - LMUL_4 : vlmax <<= 2; - LMUL_8 : vlmax <<= 3; - // Fractional LMUL - LMUL_1_2: vlmax >>= 1; - LMUL_1_4: vlmax >>= 2; - LMUL_1_8: vlmax >>= 3; - default:; - endcase - - if (insn.vsetivli_type.func2 == 2'b11) begin // vsetivli - vl_ld_d = vlen_t'(insn.vsetivli_type.uimm5); - vl_st_d = vlen_t'(insn.vsetivli_type.uimm5); - end else begin // vsetvl || vsetvli - if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd == '0) begin - // Do not update the vector length - vl_ld_d = vl_ld_q; - vl_st_d = vl_st_q; - end else if (insn.vsetvl_type.rs1 == '0 && insn.vsetvl_type.rd != '0) begin - // Set the vector length to vlmax - vl_ld_d = vlmax; - vl_st_d = vlmax; - end else begin - // vl_st_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_st_d)]) || - // (vlen_cl_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_cl_t'(acc_req_i.rs1); - - // Normal stripmining - // vl_d = ((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_d)]) || - // (vlen_t'(acc_req_i.rs1) > vlmax)) ? vlmax : vlen_t'(acc_req_i.rs1); - if (((|acc_req_i.rs1[$bits(acc_req_i.rs1)-1:$bits(vl_ld_d)]) || - (vlen_cl_t'(acc_req_i.rs1) > vlmax))) begin - vl_ld_d = vlmax; - end else if (|vlen_cl_t'(acc_req_i.rs1[$clog2(NrClusters * NrLanes)-1:0])) begin - vl_ld_d = vlen_cl_t'(((acc_req_i.rs1 >> $clog2(NrClusters * NrLanes)) + 1) << $clog2(NrClusters * NrLanes)); - end else begin - vl_ld_d = vlen_cl_t'(acc_req_i.rs1); - end - - vl_st_d = vl_ld_d; - end - end - end - end - default: ; - endcase - end - default: acc_req_ready_d = 1'b1; - endcase - end - end - - -endmodule \ No newline at end of file diff --git a/hardware/src/vlsu/global_ldst.sv b/hardware/src/vlsu/global_ldst.sv index 772bb47..5a92256 100644 --- a/hardware/src/vlsu/global_ldst.sv +++ b/hardware/src/vlsu/global_ldst.sv @@ -30,70 +30,62 @@ module global_ldst import ara_pkg::*; import rvv_pkg::*; #( // Interfaces with Ariane input accelerator_req_t acc_req_i, - output logic acc_req_ready_o, // To ARA input cluster_axi_req_t [NrClusters-1:0] axi_req_i, output cluster_axi_resp_t [NrClusters-1:0] axi_resp_o, - // To shuffle stage and align stage - output logic ar_addrgen_ack_o, - output logic aw_addrgen_ack_o, + input vew_e vew_ar_i, + input vew_e vew_aw_i, + input vlen_t vl_ldst_i, + + // vew information to align stage + output vew_e vew_ar_o, + output vew_e vew_aw_o, + output vlen_t vl_ldst_rd_o, + output vlen_t vl_ldst_wr_o, // To System AXI input axi_resp_t axi_resp_i, output axi_req_t axi_req_o ); -localparam int unsigned MAXVL_CL = VLEN * NrClusters; -typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; -vlen_cl_t vl_ld, vl_st; -vtype_t vtype; - -logic ar_addrgen_ack, aw_addrgen_ack; -assign ar_addrgen_ack_o = ar_addrgen_ack; -assign aw_addrgen_ack_o = aw_addrgen_ack; - -global_dispatcher #( - .NrLanes (NrLanes ), - .NrClusters (NrClusters), - .vlen_cl_t (vlen_cl_t ) -) i_global_dispatcher ( - .clk_i (clk_i), - .rst_ni (rst_ni), - .acc_req_i (acc_req_i), - .acc_req_ready_o (acc_req_ready_o), - .ar_addrgen_ack_i (ar_addrgen_ack), - .aw_addrgen_ack_i (aw_addrgen_ack), - .vl_ld_o (vl_ld), - .vl_st_o (vl_st), - .vtype_o (vtype) -); - import cf_math_pkg::idx_width; import axi_pkg::aligned_addr; +import axi_pkg::beat_lower_byte; +import axi_pkg::beat_upper_byte; import axi_pkg::BURST_INCR; import axi_pkg::CACHE_MODIFIABLE; -logic w_ready_q, w_ready_d; // If this unit is ready to receive data from ARA -logic w_valid_d, w_valid_q; // If this unit has a walid write data to System -// logic w_last_d, w_last_q; // If this is a last write packer +localparam clog2_AxiStrobeWidth = $clog2(AxiDataWidth/8); +localparam int unsigned MAXVL_CL = VLEN * NrClusters; + +typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; + +typedef struct packed { + axi_pkg::largest_addr_t addr; + axi_pkg::size_t size; + axi_pkg::len_t len; + logic is_load; + vlen_cl_t vl_ldst; + vew_e vsew; +} addrgen_cluster_axi_req_t; + +logic ar_addrgen_ack, aw_addrgen_ack; // Pointers to clusters to which data has to be written or read from logic [$clog2(NrClusters)-1:0] cluster_start_r_d, cluster_start_r_q, cluster_start_wr_d, cluster_start_wr_q; +vew_e vew_ar_d, vew_ar_q, vew_aw_d, vew_aw_q; +vlen_t vl_ldst_rd_d, vl_ldst_rd_q, vl_ldst_wr_d, vl_ldst_wr_q; cluster_axi_resp_t [NrClusters-1:0] cluster_axi_resp_data_d, cluster_axi_resp_data_q; -cluster_axi_resp_t [NrClusters-1:0] cluster_axi_resp_data_shuffle; cluster_axi_req_t [NrClusters-1:0] axi_req_data_d, axi_req_data_q; // For Shuffling -logic [NrClusters-1:0] data_valid; logic [NrClusters-1:0] w_cluster_valid; logic [NrClusters-1:0] w_cluster_ready_d, w_cluster_ready_q; logic [NrClusters-1:0] w_cluster_last_d, w_cluster_last_q; -int len_r, len_w; - // Handle unaligned AXI cluster_axi_req_t req_d, req_q; axi_req_t req_final; @@ -104,114 +96,402 @@ axi_req_t req_wrmem; logic w_req_valid_d, w_req_valid_q, w_req_ready; vlen_cl_t vl_w_d, vl_w_q, vl_w_done; -always_ff @(posedge clk_i or negedge rst_ni) begin - if(~rst_ni) begin - r_req_valid_q <= 1'b0; - req_q <= '0; - vl_req_q <= '0; +// AXI burst length +logic [8:0] w_burst_length; +// NOTE: all these variables could be narrowed to the minimum number of bits +logic [12:0] num_beats; - w_req_valid_q <= 1'b0; - vl_w_q <= '0; +///////////////////////////////////// +// Support for misaligned stores // +///////////////////////////////////// + +// Narrower AXI Data Byte-Width used for misaligned stores +logic [clog2_AxiStrobeWidth-1:0] narrow_axi_data_bwidth; +// Helper signal to calculate the narrow_axi_data_bwidth +// It carries information about the misalignment of the start address w.r.t. the AxiDataWidth +logic [clog2_AxiStrobeWidth-1:0] axi_addr_misalignment; +// Number of trailing 0s of axi_addr_misalignment +logic [idx_width(clog2_AxiStrobeWidth)-1:0] zeroes_cnt; + +// If this is the first beat of the write signal +logic first_beat_d, first_beat_q; +// A counter of how many beats are left in the current AXI burst +axi_pkg::len_t wr_axi_len_d, wr_axi_len_q; +// A pointer to which byte in the full VRF word we are reading data from. +logic [idx_width(ClusterAxiDataWidth*NrClusters/8):0] wr_data_pnt_d, wr_data_pnt_q; + +// Get the misalignment information for this vector memory instruction +assign axi_addr_misalignment = req_d.aw.addr[clog2_AxiStrobeWidth-1:0]; + +int unsigned wr_data_seq_byte; + +vlen_cl_t wr_issue_cnt_bytes_d, wr_issue_cnt_bytes_q; + +vlen_cl_t wr_vinsn_valid_bytes; +logic [idx_width(ClusterAxiDataWidth*NrClusters/8):0] wr_data_valid_bytes; +logic [idx_width(AxiDataWidth/8):0] wr_axi_valid_bytes; +logic [idx_width(AxiDataWidth/8):0] wr_valid_bytes; + +logic [ClusterAxiDataWidth*NrClusters-1:0] wr_data_coalesce; +logic [ClusterAxiDataWidth*NrClusters/8-1:0] wr_strb_coalesce; + +logic [idx_width(ClusterAxiDataWidth*NrClusters/8):0] data_eff_write_bytes; + +// Have a valid write data to send to System AXI +generate + for (genvar i=0; i> (clog2_AxiStrobeWidth - zeroes_cnt); + +////////////////////////////// +// AXI Request Generation // +////////////////////////////// + +enum logic [2:0] { + AXI_ADDRGEN_IDLE, + AXI_ADDRGEN_WAITING_CORE_STORE_PENDING, + AXI_ADDRGEN_AXI_DW_STORE_MISALIGNED, // Misaligned vector store to AxiDataWidth/8, needs special treatement + AXI_ADDRGEN_REQUESTING // Perform AW/AR transactions and push addrgen_req to VSTU/VLDU +} axi_addrgen_state_d, axi_addrgen_state_q; + +axi_addr_t wr_aligned_start_addr_d, wr_aligned_start_addr_q; +axi_addr_t wr_aligned_next_start_addr_d, wr_aligned_next_start_addr_q, wr_aligned_next_start_addr_temp; +axi_addr_t wr_aligned_end_addr_d, wr_aligned_end_addr_q, wr_aligned_end_addr_temp; + +// MSb of the next-next page (page selector for page 2 positions after the current one) +logic [($bits(wr_aligned_start_addr_d)-12)-1:0] wr_next_2page_msb_d, wr_next_2page_msb_q; + +logic [clog2_AxiStrobeWidth:0] eff_axi_dw_d, eff_axi_dw_q; +logic [idx_width(clog2_AxiStrobeWidth):0] eff_axi_dw_log_d, eff_axi_dw_log_q; + +function automatic void set_end_addr ( + input logic [($bits(axi_addr_t)-12)-1:0] next_2page_msb, + input vlen_cl_t num_bytes, + input axi_addr_t addr, + input logic [clog2_AxiStrobeWidth:0] eff_axi_dw, + input logic [idx_width(clog2_AxiStrobeWidth):0] eff_axi_dw_log, + input axi_addr_t aligned_start_addr, + output axi_addr_t aligned_end_addr, + output axi_addr_t aligned_next_start_addr +); + + automatic int unsigned max_burst_bytes = 256 << eff_axi_dw_log; + + // The final address can be found similarly... + if (num_bytes >= max_burst_bytes) begin + aligned_next_start_addr = aligned_addr(addr + max_burst_bytes, eff_axi_dw_log); end else begin - r_req_valid_q <= r_req_valid_d; - req_q <= req_d; - vl_req_q <= vl_req_d; + aligned_next_start_addr = aligned_addr(addr + num_bytes - 1, eff_axi_dw_log) + eff_axi_dw; + end + aligned_end_addr = aligned_next_start_addr - 1; - w_req_valid_q <= w_req_valid_d; - vl_w_q <= vl_w_d; + // But since AXI requests are aligned in 4 KiB pages, aligned_end_addr must be in the + // same page as aligned_start_addr + if (aligned_start_addr[AxiAddrWidth-1:12] != aligned_end_addr[AxiAddrWidth-1:12]) begin + aligned_end_addr = {aligned_start_addr[AxiAddrWidth-1:12], 12'hFFF}; + aligned_next_start_addr = { next_2page_msb , 12'h000}; end -end +endfunction + +////////////////////////////// +// Address Queue for Store // +////////////////////////////// + +// Address queue for the vector load/store units +addrgen_cluster_axi_req_t axi_addrgen_queue; +addrgen_cluster_axi_req_t axi_addrgen_req; +logic axi_addrgen_queue_push; +logic axi_addrgen_queue_full; +logic axi_addrgen_queue_empty; +logic axi_addrgen_queue_pop; +logic axi_addrgen_req_ready; +logic axi_addrgen_req_valid; + +assign axi_addrgen_queue_pop = axi_addrgen_req_ready; + +fifo_v3 #( + .DEPTH(VaddrgenInsnQueueDepth ), + .dtype(addrgen_cluster_axi_req_t ) +) i_addrgen_req_queue ( + .clk_i (clk_i ), + .rst_ni (rst_ni ), + .flush_i (1'b0 ), + .testmode_i(1'b0 ), + .data_i (axi_addrgen_queue ), + .push_i (axi_addrgen_queue_push ), + .full_o (axi_addrgen_queue_full ), + .data_o (axi_addrgen_req ), + .pop_i (axi_addrgen_queue_pop ), + .empty_o (axi_addrgen_queue_empty ), + .usage_o (/* Unused */ ) +); + +assign axi_addrgen_req_valid = !axi_addrgen_queue_empty; + +// These are updated only when a new aw/ar is accepted +assign vew_ar_o = vew_ar_d; +assign vew_aw_o = vew_aw_d; +assign vl_ldst_rd_o = vl_ldst_rd_d; +assign vl_ldst_wr_o = vl_ldst_wr_d; + -logic [8:0] w_burst_length, wr_length_check; always_comb begin : p_global_ldst - + // Maintain state + axi_addrgen_state_d = axi_addrgen_state_q; // Copy data between ARA<->System // Combine Request from Lane Groups // Here using Cluster-0 as the request and ignoring the other requests. // aw channel req_d = req_q; + + wr_aligned_start_addr_d = wr_aligned_start_addr_q; + wr_aligned_next_start_addr_d = wr_aligned_next_start_addr_q; + wr_aligned_end_addr_d = wr_aligned_end_addr_q; + + wr_aligned_next_start_addr_temp = wr_aligned_next_start_addr_q; + wr_aligned_end_addr_temp = wr_aligned_end_addr_q; + + wr_next_2page_msb_d = wr_next_2page_msb_q; + + eff_axi_dw_d = eff_axi_dw_q; + eff_axi_dw_log_d = eff_axi_dw_log_q; + w_req_valid_d = w_req_valid_q; w_req_ready = ~w_req_valid_q; vl_w_d = vl_w_q; + vew_aw_d = vew_aw_q; + + wr_axi_len_d = wr_axi_len_q; + wr_issue_cnt_bytes_d = wr_issue_cnt_bytes_q; + wr_data_pnt_d = wr_data_pnt_q; + + vl_ldst_wr_d = vl_ldst_wr_q; + vl_ldst_rd_d = vl_ldst_rd_q; ar_addrgen_ack = 1'b0; aw_addrgen_ack = 1'b0; req_wrmem = '0; req_wrmem.aw_valid = 1'b0; - + + axi_addrgen_queue = '0; + axi_addrgen_queue_push = 1'b0; + + + wr_data_seq_byte = 0; + if (axi_req_i[0].aw_valid && w_req_ready) begin req_d.aw = axi_req_i[0].aw; w_req_valid_d = 1'b1; - vl_w_d = vl_st; + vew_aw_d = vew_aw_i; + vl_ldst_wr_d = vl_ldst_i; + // vl in terms of byte + vl_w_d = (vl_ldst_i << $clog2(NrClusters)) << vew_aw_i; end - if (w_req_valid_d==1'b1 && axi_resp_i.aw_ready) begin - // automatic logic [8:0] w_burst_length; - automatic axi_addr_t wr_aligned_start_addr_d, wr_aligned_next_start_addr_d, wr_aligned_end_addr_d; - automatic logic [($bits(wr_aligned_start_addr_d) - 12)-1:0] wr_next_2page_msb_d; + case (axi_addrgen_state_q) + AXI_ADDRGEN_IDLE: begin + // The start address is found by aligning the original request address by the width of + // the memory interface. + wr_aligned_start_addr_d = aligned_addr(req_d.aw.addr, clog2_AxiStrobeWidth); + // Pre-calculate the next_2page_msb. This should not require much energy if the addr + // has zeroes in the upper positions. + // We can use this also for the misaligned address calculation, as the next 2 page msb + // will be the same either way. + wr_next_2page_msb_d = wr_aligned_start_addr_d[AxiAddrWidth-1:12] + 1; + // The final address can be found similarly... + set_end_addr ( + wr_next_2page_msb_d, + vl_w_d, + req_d.aw.addr, + AxiDataWidth/8, + clog2_AxiStrobeWidth, + wr_aligned_start_addr_d, + wr_aligned_end_addr_d, + wr_aligned_next_start_addr_d + ); + + if (w_req_valid_d==1'b1) begin + axi_addrgen_state_d = acc_req_i.store_pending ? AXI_ADDRGEN_WAITING_CORE_STORE_PENDING : AXI_ADDRGEN_REQUESTING; + + eff_axi_dw_log_d = clog2_AxiStrobeWidth; + + if (req_d.aw.addr[clog2_AxiStrobeWidth-1:0] != '0) begin + // Calculate the start and the end addresses in the AXI_ADDRGEN_AXI_DW_STORE_MISALIGNED state + axi_addrgen_state_d = AXI_ADDRGEN_AXI_DW_STORE_MISALIGNED; + + eff_axi_dw_d = {1'b0, narrow_axi_data_bwidth}; + eff_axi_dw_log_d = zeroes_cnt; + end else begin + eff_axi_dw_d = AxiDataWidth/8; + eff_axi_dw_log_d = clog2_AxiStrobeWidth; + end + end + end - req_wrmem.aw = req_d.aw; // Copy request state - req_wrmem.aw.size = size_axi; - req_wrmem.aw.cache = CACHE_MODIFIABLE; - req_wrmem.aw.burst = BURST_INCR; - req_wrmem.aw_valid = 1'b1; + AXI_ADDRGEN_AXI_DW_STORE_MISALIGNED: begin + axi_addrgen_state_d = acc_req_i.store_pending ? AXI_ADDRGEN_WAITING_CORE_STORE_PENDING : AXI_ADDRGEN_REQUESTING; + + // The start address is found by aligning the original request address by the width of + // the memory interface. + wr_aligned_start_addr_d = aligned_addr(req_q.aw.addr, eff_axi_dw_log_q); + + set_end_addr ( + wr_next_2page_msb_q, + vl_w_d, + req_q.aw.addr, + eff_axi_dw_q, + eff_axi_dw_log_q, + wr_aligned_start_addr_d, + wr_aligned_end_addr_d, + wr_aligned_next_start_addr_d + ); + end - // Check if the address is unaligned for AxiDataWidth bits - wr_aligned_start_addr_d = aligned_addr(req_wrmem.aw.addr, size_axi); - wr_aligned_next_start_addr_d = aligned_addr(req_wrmem.aw.addr + (vl_w_d << vtype.vsew) -1, size_axi) + AxiDataWidth/8; - wr_aligned_end_addr_d = wr_aligned_next_start_addr_d - 1; - wr_next_2page_msb_d = wr_aligned_start_addr_d[AxiAddrWidth-1:12] + 1; - // 1 - Check for 4KB page boundary - if (wr_aligned_start_addr_d[AxiAddrWidth-1:12] != wr_aligned_end_addr_d[AxiAddrWidth-1:12]) begin - wr_aligned_end_addr_d = {wr_aligned_start_addr_d[AxiAddrWidth-1:12], 12'hFFF}; - wr_aligned_next_start_addr_d = { wr_next_2page_msb_d, 12'h000}; - end - // 2 - AXI bursts are at most 256 beats long. - w_burst_length = MaxAxiBurst; - wr_length_check = ((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1; - if (w_burst_length > (((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1)) begin - w_burst_length = ((wr_aligned_end_addr_d - wr_aligned_start_addr_d) >> size_axi) + 1; - end else begin - wr_aligned_next_start_addr_d = wr_aligned_start_addr_d + ((w_burst_length) << size_axi); - wr_aligned_end_addr_d = wr_aligned_next_start_addr_d - 1; - end + AXI_ADDRGEN_WAITING_CORE_STORE_PENDING: begin + if (!acc_req_i.store_pending) begin + axi_addrgen_state_d = AXI_ADDRGEN_REQUESTING; + end + end + + AXI_ADDRGEN_REQUESTING : begin + automatic logic axi_aw_ready = axi_resp_i.aw_ready; + automatic logic [12:0] num_bytes; // Cannot consume more than 4 KiB + automatic vlen_cl_t remaining_bytes; + + // Pre-calculate the next_2page_msb. This should not require much energy if the addr + // has zeroes in the upper positions. + wr_next_2page_msb_d = wr_aligned_next_start_addr_q[AxiAddrWidth-1:12] + 1; + + // Pre-calculate the bytes used in a unit-strided access and the remaining bytes to ask. + // The proper way to do so would be aligned_end_addr_q[11:0] + 1 - req_q.aw.addr[11:0]. + // Avoid explicit computation of aligned_next_start_addr + 1 with a trick that works if + // aligned_next_start_addr <= 12'hFFF. + if (wr_aligned_end_addr_q[11:0] != 12'hFFF) begin + num_bytes = wr_aligned_next_start_addr_q[11:0] - req_q.aw.addr[11:0]; + end else begin + // Special case: aligned_next_start_addr > 12'hFFF. + num_bytes = 13'h1000 - req_q.aw.addr[11:0]; + end + remaining_bytes = vl_w_q - num_bytes; + if (vl_w_q < num_bytes) begin + remaining_bytes = 0; + end + + if (!axi_addrgen_queue_full && axi_aw_ready) begin + automatic axi_addr_t paddr; + + // Mux target address + paddr = req_q.aw.addr; + + // 1 - AXI bursts are at most 256 beats long. + w_burst_length = 256; + // 2 - The AXI burst length cannot be longer than the number of beats required + // to access the memory regions between aligned_start_addr and + // aligned_end_addr + num_beats = ((wr_aligned_end_addr_q[11:0] - wr_aligned_start_addr_q[11:0]) >> eff_axi_dw_log_q) + 1; + if (w_burst_length > num_beats) begin + w_burst_length = num_beats; + end + + // AW Channel + req_wrmem.aw = '{ + addr : paddr, + len : w_burst_length - 1, + // If misaligned store access, reduce the effective AXI width + // This hurts performance + size : eff_axi_dw_log_q, + cache : CACHE_MODIFIABLE, + burst : BURST_INCR, + default: '0 + }; + + // Send this request to the load/store units + axi_addrgen_queue = '{ + addr : paddr, + len : w_burst_length - 1, + size : eff_axi_dw_log_q, + vl_ldst : w_burst_length << eff_axi_dw_log_q, + vsew : vew_aw_q, + default: '0 + }; + + // Calculate the addresses for the next iteration + // TODO: test this for SEW!=64, otherwise this computation is never used + // The start address is found by aligning the original request address by the width of + // the memory interface. In our case, we have it already. + set_end_addr ( + wr_next_2page_msb_d, + vl_w_q - num_bytes, + wr_aligned_next_start_addr_q, + eff_axi_dw_q, + eff_axi_dw_log_q, + wr_aligned_next_start_addr_q, + wr_aligned_end_addr_temp, + wr_aligned_next_start_addr_temp + ); + + // AW Channel + req_wrmem.aw_valid = 1'b1; + // Send this request to the load/store units + axi_addrgen_queue_push = 1'b1; + // We pre-calculated the values already + vl_w_d = remaining_bytes; + req_d.aw.addr = wr_aligned_next_start_addr_q; + + wr_aligned_start_addr_d = req_d.aw.addr; + wr_aligned_end_addr_d = wr_aligned_end_addr_temp; + wr_aligned_next_start_addr_d = wr_aligned_next_start_addr_temp; + + // Finished generating AXI requests + if (vl_w_d == 0) begin + w_req_valid_d = 1'b0; + aw_addrgen_ack = 1'b1; + axi_addrgen_state_d = AXI_ADDRGEN_IDLE; + end + end + end + endcase + + axi_req_o.aw = req_wrmem.aw; + axi_req_o.aw_valid = req_wrmem.aw_valid; - req_wrmem.aw.len = w_burst_length - 1; - vl_w_done = (wr_aligned_next_start_addr_d - req_d.aw.addr) >> int'(vtype.vsew); - if (vl_w_d > vl_w_done) begin - vl_w_d -= vl_w_done; - req_d.aw.addr = wr_aligned_next_start_addr_d; // Update request state - w_req_valid_d = 1'b1; - end else begin - w_req_valid_d = 1'b0; - aw_addrgen_ack = 1'b1; - end - end - axi_req_o.aw = req_wrmem.aw; - axi_req_o.aw_valid = req_wrmem.aw_valid; - - // axi_req_o.aw = axi_req_i[0].aw; - // len_w = (axi_req_i[0].aw.len + 1) << axi_req_i[0].aw.size << $clog2(NrClusters) >> size_axi; - // axi_req_o.aw.len = len_w ? len_w-1 : 0; - // axi_req_o.aw.size = size_axi; - // axi_req_o.aw_valid = axi_req_i[0].aw_valid; - // Alignment is only done for the read request channel AR // ar channel r_req_valid_d = r_req_valid_q; + vew_ar_d = vew_ar_q; r_req_ready = ~r_req_valid_q; // As long as a request is valid, not ready to receive another request vl_req_d = vl_req_q; req_final = '0; // Request to be send on AXI req_final.ar_valid = 1'b0; - if (axi_req_i[0].ar_valid && r_req_ready) begin + if (axi_req_i[0].ar_valid && r_req_ready && axi_resp_i.ar_ready) begin req_d.ar = axi_req_i[0].ar; r_req_valid_d = 1'b1; - vl_req_d = vl_ld; + // vl In terms of element number + vl_req_d = vl_ldst_i << $clog2(NrClusters); + vew_ar_d = vew_ar_i; + vl_ldst_rd_d = vl_ldst_i; end if (r_req_valid_d==1'b1 && axi_resp_i.ar_ready) begin @@ -227,7 +507,7 @@ always_comb begin : p_global_ldst // Check if the address is unaligned for AxiDataWidth bits aligned_start_addr_d = aligned_addr(req_final.ar.addr, size_axi); - aligned_next_start_addr_d = aligned_addr(req_final.ar.addr + (vl_req_d << vtype.vsew) -1, size_axi) + AxiDataWidth/8; + aligned_next_start_addr_d = aligned_addr(req_final.ar.addr + (vl_req_d << vew_ar_d) -1, size_axi) + AxiDataWidth/8; aligned_end_addr_d = aligned_next_start_addr_d - 1; next_2page_msb_d = aligned_start_addr_d[AxiAddrWidth-1:12] + 1; // 1 - Check for 4KB page boundary @@ -247,7 +527,7 @@ always_comb begin : p_global_ldst end req_final.ar.len = burst_length - 1; - vl_done = (aligned_next_start_addr_d - req_d.ar.addr) >> int'(vtype.vsew); + vl_done = (aligned_next_start_addr_d - req_d.ar.addr) >> int'(vew_ar_d); if (vl_req_d > vl_done) begin vl_req_d -= vl_done; req_d.ar.addr = aligned_next_start_addr_d; // Update request state @@ -261,18 +541,6 @@ always_comb begin : p_global_ldst axi_req_o.ar = req_final.ar; axi_req_o.ar_valid = req_final.ar_valid; - // axi_req_o.ar = axi_req_i[0].ar; - // len_r = (axi_req_i[0].ar.len + 1) << axi_req_i[0].ar.size << $clog2(NrClusters) >> size_axi; - // axi_req_o.ar.len = len_r ? len_r-1 : 0; - // axi_req_o.ar.size = size_axi; - // axi_req_o.ar_valid = axi_req_i[0].ar_valid; - - - - - - - // b channel axi_req_o.b_ready = 1'b1; for (int i=0; i= lower_byte && axi_byte <= upper_byte) begin + // Map axy_byte to the corresponding byte in the VRF word (sequential) + wr_data_seq_byte = axi_byte - lower_byte + wr_data_pnt_q; + // Copy data + axi_req_o.w.data[8*axi_byte +: 8] = wr_data_coalesce[8*wr_data_seq_byte +: 8]; + axi_req_o.w.strb[axi_byte] = wr_strb_coalesce[wr_data_seq_byte]; + // To check if we write any x data into the memory + if ($isunknown(axi_req_o.w.data[8*axi_byte +: 8]) && axi_req_o.w.strb[axi_byte]) begin + $error("ASSERTION FAILED: data is X when valid=1"); + end + // Currently directly wired to cluster 0 user signal, can be changed according to needs + axi_req_o.w.user = axi_req_data_d[0].w.user; end end + + // Send the W beat + axi_req_o.w_valid = 1'b1; + // Account for the beat we sent + wr_axi_len_d = wr_axi_len_q + 1; + // We wrote all the beats for this AW burst + if ($unsigned(wr_axi_len_d) == axi_pkg::len_t'($unsigned(axi_addrgen_req.len) + 1)) begin : beats_complete + axi_req_o.w.last = 1'b1; + // Ask for another burst by the address generator + axi_addrgen_req_ready = 1'b1; + // Prepare for the first beat for next aw req + first_beat_d = 1'b1; + // Reset AXI pointers + wr_axi_len_d = '0; + end : beats_complete + + // We consumed a whole word from the lanes + if (wr_data_pnt_d == (ClusterAxiDataWidth*NrClusters/8)) begin + // Reset the pointer in the VRF word + wr_data_pnt_d = '0; + + // Acknowledge the operands from the clusters + w_cluster_ready_d = '1; + // Account for the results that were issued + data_eff_write_bytes = ClusterAxiDataWidth*NrClusters/8; + + wr_issue_cnt_bytes_d = wr_issue_cnt_bytes_q - data_eff_write_bytes; + if (wr_issue_cnt_bytes_q < data_eff_write_bytes) begin : issue_cnt_bytes_overflow + wr_issue_cnt_bytes_d = '0; + end : issue_cnt_bytes_overflow + end end end for (int i=0; i= vtype.vsew) ? 1'b1 : 1'b0; + rd_tracker_d[rd_accept_pnt_q].shuffle_en[s] = (s >= vew_ar_i) ? 1'b1 : 1'b0; end - rd_tracker_d[rd_accept_pnt_q].buffer_en = NumStages < vtype.vsew ? 1'b1 : 1'b0; + rd_tracker_d[rd_accept_pnt_q].buffer_en = NumStages < vew_ar_i ? 1'b1 : 1'b0; end if (axi_req_i[0].aw_valid & axi_resp_o[0].aw_ready) begin - wr_tracker_d[wr_accept_pnt_q].vew = vtype.vsew; //vew_aw_i; + wr_tracker_d[wr_accept_pnt_q].vew = vew_aw_i; //vew_aw_i; for (int c=0; c= vtype.vsew) ? 1'b1 : 1'b0; + wr_tracker_d[wr_accept_pnt_q].shuffle_en[s] = (s >= vew_aw_i) ? 1'b1 : 1'b0; end - wr_tracker_d[wr_accept_pnt_q].buffer_en = NumStages < vtype.vsew ? 1'b1 : 1'b0; + wr_tracker_d[wr_accept_pnt_q].buffer_en = NumStages < vew_aw_i ? 1'b1 : 1'b0; end // Update counters for shuffle stage diff --git a/hardware/src/vlsu/vldu.sv b/hardware/src/vlsu/vldu.sv index 505f13d..d9faf51 100644 --- a/hardware/src/vlsu/vldu.sv +++ b/hardware/src/vlsu/vldu.sv @@ -351,9 +351,18 @@ module vldu import ara_pkg::*; import rvv_pkg::*; #( // Copy data and byte strobe result_queue_d[result_queue_write_pnt_q][vrf_lane].wdata[8*vrf_offset +: 8] = axi_r_i.data[8*axi_byte +: 8]; - result_queue_d[result_queue_write_pnt_q][vrf_lane].be[vrf_offset] = - vinsn_issue_q.vm || mask_q[vrf_lane][vrf_offset]; + // result_queue_d[result_queue_write_pnt_q][vrf_lane].be[vrf_offset] = + // vinsn_issue_q.vm || mask_q[vrf_lane][vrf_offset]; end : is_vrf_byte + + if (vrf_seq_byte_cnt < (issue_cnt_bytes_q - axi_addrgen_req_i.vl_ldst) && vrf_seq_byte < (NrLanes * DataWidthB)) begin + // At which lane, and what is the byte offset in that lane, of the byte vrf_byte? + automatic int unsigned vrf_offset = vrf_byte[2:0]; + // Make sure this index wraps around the number of lane + automatic int unsigned vrf_lane = (vrf_byte >> 3); + // Some data might not be written due to the actual vl non-multiple of NrLanes*NrClusters + result_queue_d[result_queue_write_pnt_q][vrf_lane].be[vrf_offset] = (vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]); + end end : axi_r_to_result_queue for (int unsigned lane = 0; lane < NrLanes; lane++) begin : compute_vrf_addr diff --git a/hardware/src/vlsu/vlsu.sv b/hardware/src/vlsu/vlsu.sv index 476e4b6..0f9d899 100644 --- a/hardware/src/vlsu/vlsu.sv +++ b/hardware/src/vlsu/vlsu.sv @@ -31,6 +31,7 @@ module vlsu import ara_pkg::*; import rvv_pkg::*; #( output axi_req_t axi_req_o, output vew_e vew_ar_o, output vew_e vew_aw_o, + output vlen_t vl_ldst_o, input axi_resp_t axi_resp_i, // Interface with the dispatcher input logic core_st_pending_i, @@ -136,6 +137,7 @@ module vlsu import ara_pkg::*; import rvv_pkg::*; #( .vew_ar_o (vew_ar ), .axi_ar_valid_o (axi_req.ar_valid ), .axi_ar_ready_i (axi_resp.ar_ready ), + .vl_ldst_o (vl_ldst_o ), // Interface with dispatcher .core_st_pending_i (core_st_pending_i ), // Interface with the sequencer diff --git a/hardware/src/vlsu/vstu.sv b/hardware/src/vlsu/vstu.sv index e7e10e4..2d9dff5 100644 --- a/hardware/src/vlsu/vstu.sv +++ b/hardware/src/vlsu/vstu.sv @@ -168,8 +168,9 @@ module vstu import ara_pkg::*; import rvv_pkg::*; #( axi_pkg::len_t len_d, len_q; // - A pointer to which byte in the full VRF word we are reading data from. logic [idx_width(DataWidth*NrLanes/8):0] vrf_pnt_d, vrf_pnt_q; + + // Some data might not be written due to the actual vl non-multiple of NrLanes*NrClusters logic [DataWidth * NrLanes / 8 - 1 : 0] st_strb_en; - assign st_strb_en = ('1 >> axi_addrgen_req_i.vl_ldst); always_comb begin: p_vstu // Maintain state @@ -222,6 +223,22 @@ module vstu import ara_pkg::*; import rvv_pkg::*; #( // How many bytes are we committing? automatic logic [idx_width(DataWidth*NrLanes/8):0] valid_bytes; + + // Account for the beat we sent + len_d = len_q + 1; + // st_strb_en is all 1s by default + st_strb_en = '1; + // We wrote all the beats for this AW burst + if ($unsigned(len_d) == axi_pkg::len_t'($unsigned(axi_addrgen_req_i.len) + 1)) begin + axi_w_o.last = 1'b1; + // // Some data might not be written due to the actual vl non-multiple of NrLanes*NrClusters + // st_strb_en = ('1 >> axi_addrgen_req_i.vl_ldst); + // Ask for another burst by the address generator + axi_addrgen_req_ready_o = 1'b1; + // Reset AXI pointers + len_d = '0; + end + valid_bytes = issue_cnt_q < NrLanes * 8 ? vinsn_valid_bytes : vrf_valid_bytes; valid_bytes = valid_bytes < axi_valid_bytes ? valid_bytes : axi_valid_bytes; @@ -243,23 +260,19 @@ module vstu import ara_pkg::*; import rvv_pkg::*; #( // Copy data axi_w_o.data[8*axi_byte +: 8] = stu_operand[vrf_lane][8*vrf_offset +: 8]; - axi_w_o.strb[axi_byte] = (vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]) && st_strb_en[vrf_seq_byte]; // axi_w_o.strb[axi_byte] = (vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]); end + + if (vrf_seq_byte < (issue_cnt_q - axi_addrgen_req_i.vl_ldst)) begin + automatic int vrf_lane = vrf_byte >> 3; + automatic int vrf_offset = vrf_byte[2:0]; + // Some data might not be written due to the actual vl non-multiple of NrLanes*NrClusters + axi_w_o.strb[axi_byte] = (vinsn_issue_q.vm || mask_i[vrf_lane][vrf_offset]); + end end // Send the W beat axi_w_valid_o = 1'b1; - // Account for the beat we sent - len_d = len_q + 1; - // We wrote all the beats for this AW burst - if ($unsigned(len_d) == axi_pkg::len_t'($unsigned(axi_addrgen_req_i.len) + 1)) begin - axi_w_o.last = 1'b1; - // Ask for another burst by the address generator - axi_addrgen_req_ready_o = 1'b1; - // Reset AXI pointers - len_d = '0; - end // We consumed a whole word from the lanes if (vrf_pnt_d == NrLanes*8 || vrf_pnt_d == issue_cnt_q) begin From 1d9fe95d64311be082d975b57e4d3b568e41cd56 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Thu, 30 Oct 2025 14:22:07 +0100 Subject: [PATCH 05/37] [HW] Fix bugs on multi-driven signals --- hardware/src/ara_cluster.sv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hardware/src/ara_cluster.sv b/hardware/src/ara_cluster.sv index 8684d9f..6205892 100644 --- a/hardware/src/ara_cluster.sv +++ b/hardware/src/ara_cluster.sv @@ -399,12 +399,12 @@ module ara_cluster import ara_pkg::*; import rvv_pkg::*; #( .mst_req_o (ldst_axi_req[cluster]), .mst_resp_i (ldst_axi_resp[cluster]) ); - - `FF(vew_ar_cut_glsu, vew_ar_cut, vew_e'(1'b0), clk_i, rst_ni); - `FF(vew_aw_cut_glsu, vew_aw_cut, vew_e'(1'b0), clk_i, rst_ni); - `FF(vl_ldst_cut_glsu, vl_ldst_cut, '0, clk_i, rst_ni); end + `FF(vew_ar_cut_glsu, vew_ar_cut, vew_e'(1'b0), clk_i, rst_ni); + `FF(vew_aw_cut_glsu, vew_aw_cut, vew_e'(1'b0), clk_i, rst_ni); + `FF(vl_ldst_cut_glsu, vl_ldst_cut, '0, clk_i, rst_ni); + // Global Ld/St Unit global_ldst #( .NrLanes (NrLanes ), From 26513fe8ec57b859d3ef9e411a719a30686333c2 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 19:12:37 +0100 Subject: [PATCH 06/37] [CI] Add CI and riscv-test --- .github/pull_request_template.md | 23 + .github/workflows/ci.yml | 751 ++ .github/workflows/sphinx.yml | 22 + apps/riscv-tests/LICENSE | 24 + apps/riscv-tests/Makefile.in | 45 + apps/riscv-tests/README.md | 177 + apps/riscv-tests/benchmarks/Makefile | 98 + apps/riscv-tests/benchmarks/common/crt.S | 225 + apps/riscv-tests/benchmarks/common/syscalls.c | 469 ++ apps/riscv-tests/benchmarks/common/test.ld | 66 + apps/riscv-tests/benchmarks/common/util.h | 90 + .../benchmarks/dhrystone/dhrystone.c | 185 + .../benchmarks/dhrystone/dhrystone.h | 477 ++ .../benchmarks/dhrystone/dhrystone_main.c | 332 + apps/riscv-tests/benchmarks/median/dataset1.h | 53 + apps/riscv-tests/benchmarks/median/median.c | 42 + apps/riscv-tests/benchmarks/median/median.h | 11 + .../benchmarks/median/median_gendata.pl | 140 + .../benchmarks/median/median_main.c | 40 + apps/riscv-tests/benchmarks/mm/common.h | 36 + apps/riscv-tests/benchmarks/mm/gen.scala | 81 + apps/riscv-tests/benchmarks/mm/mm.c | 152 + apps/riscv-tests/benchmarks/mm/mm_main.c | 72 + apps/riscv-tests/benchmarks/mm/rb.h | 210 + .../benchmarks/mt-matmul/dataset.h | 63 + .../riscv-tests/benchmarks/mt-matmul/matmul.c | 23 + .../benchmarks/mt-matmul/matmul_gendata.pl | 205 + .../benchmarks/mt-matmul/mt-matmul.c | 57 + .../riscv-tests/benchmarks/mt-vvadd/dataset.h | 173 + .../benchmarks/mt-vvadd/mt-vvadd.c | 78 + apps/riscv-tests/benchmarks/mt-vvadd/vvadd.c | 18 + .../benchmarks/mt-vvadd/vvadd_gendata.pl | 139 + .../benchmarks/multiply/dataset1.h | 32 + .../benchmarks/multiply/multiply.c | 24 + .../benchmarks/multiply/multiply.h | 11 + .../benchmarks/multiply/multiply_gendata.pl | 142 + .../benchmarks/multiply/multiply_main.c | 45 + apps/riscv-tests/benchmarks/pmp/pmp.c | 212 + apps/riscv-tests/benchmarks/qsort/dataset1.h | 219 + .../benchmarks/qsort/qsort_gendata.pl | 132 + .../riscv-tests/benchmarks/qsort/qsort_main.c | 153 + apps/riscv-tests/benchmarks/readme.txt | 48 + apps/riscv-tests/benchmarks/rsort/dataset1.h | 219 + apps/riscv-tests/benchmarks/rsort/rsort.c | 122 + apps/riscv-tests/benchmarks/spmv/dataset1.h | 6312 +++++++++++++++++ .../benchmarks/spmv/spmv_gendata.scala | 48 + apps/riscv-tests/benchmarks/spmv/spmv_main.c | 52 + .../benchmarks/towers/towers_main.c | 234 + .../benchmarks/vvadd/dataset1-large.h | 167 + apps/riscv-tests/benchmarks/vvadd/dataset1.h | 62 + .../benchmarks/vvadd/vvadd_gendata.pl | 139 + .../riscv-tests/benchmarks/vvadd/vvadd_main.c | 48 + apps/riscv-tests/configure | 3694 ++++++++++ apps/riscv-tests/configure.ac | 16 + apps/riscv-tests/debug/Makefile | 35 + apps/riscv-tests/debug/README.md | 58 + apps/riscv-tests/debug/gdbserver.py | 1607 +++++ apps/riscv-tests/debug/openocd.py | 85 + apps/riscv-tests/debug/programs/checksum.c | 38 + .../debug/programs/counting_loop.c | 17 + apps/riscv-tests/debug/programs/debug.c | 69 + apps/riscv-tests/debug/programs/encoding.h | 1 + apps/riscv-tests/debug/programs/entry.S | 207 + .../debug/programs/infinite_loop.S | 44 + apps/riscv-tests/debug/programs/init.c | 47 + apps/riscv-tests/debug/programs/init.h | 12 + apps/riscv-tests/debug/programs/interrupt.c | 32 + apps/riscv-tests/debug/programs/mprv.S | 46 + apps/riscv-tests/debug/programs/multicore.c | 89 + apps/riscv-tests/debug/programs/priv.S | 11 + apps/riscv-tests/debug/programs/regs.S | 60 + .../debug/programs/run_halt_timing.S | 18 + apps/riscv-tests/debug/programs/semihosting.c | 73 + apps/riscv-tests/debug/programs/semihosting.h | 82 + apps/riscv-tests/debug/programs/step.S | 28 + apps/riscv-tests/debug/programs/tiny-malloc.c | 600 ++ apps/riscv-tests/debug/programs/translate.c | 188 + apps/riscv-tests/debug/programs/trigger.S | 113 + apps/riscv-tests/debug/programs/vectors.S | 159 + apps/riscv-tests/debug/pylint.rc | 341 + apps/riscv-tests/debug/requirements.txt | 1 + apps/riscv-tests/debug/targets.py | 227 + .../debug/targets/RISC-V/spike-1.cfg | 30 + .../debug/targets/RISC-V/spike-2-hwthread.cfg | 38 + .../debug/targets/RISC-V/spike-2.cfg | 36 + .../debug/targets/RISC-V/spike-rtos.cfg | 29 + .../targets/RISC-V/spike32-2-hwthread.py | 15 + .../debug/targets/RISC-V/spike32-2-rtos.py | 19 + .../debug/targets/RISC-V/spike32-2.py | 15 + .../debug/targets/RISC-V/spike32.lds | 38 + .../debug/targets/RISC-V/spike32.py | 26 + .../targets/RISC-V/spike64-2-hwthread.py | 14 + .../debug/targets/RISC-V/spike64-2-rtos.py | 18 + .../debug/targets/RISC-V/spike64-2.py | 21 + .../debug/targets/RISC-V/spike64.lds | 36 + .../debug/targets/RISC-V/spike64.py | 24 + .../debug/targets/SiFive/Freedom/E300.py | 13 + .../debug/targets/SiFive/Freedom/Freedom.cfg | 14 + .../debug/targets/SiFive/Freedom/Freedom.lds | 36 + .../debug/targets/SiFive/Freedom/U500.py | 13 + .../debug/targets/SiFive/Freedom/U500Sim.py | 17 + .../debug/targets/SiFive/HiFive1-flash.lds | 44 + .../debug/targets/SiFive/HiFive1-flash.py | 15 + .../debug/targets/SiFive/HiFive1.cfg | 33 + .../debug/targets/SiFive/HiFive1.lds | 38 + .../debug/targets/SiFive/HiFive1.py | 11 + .../targets/SiFive/HiFiveUnleashed-flash.lds | 41 + .../targets/SiFive/HiFiveUnleashed-flash.py | 22 + .../debug/targets/SiFive/HiFiveUnleashed.cfg | 64 + .../debug/targets/SiFive/HiFiveUnleashed.lds | 38 + .../debug/targets/SiFive/HiFiveUnleashed.py | 21 + .../targets/SiFive/HiFiveUnleashed_setup.bin | Bin 0 -> 25296 bytes apps/riscv-tests/debug/testlib.py | 1194 ++++ apps/riscv-tests/env/LICENSE | 24 + apps/riscv-tests/env/encoding.h | 2828 ++++++++ apps/riscv-tests/env/p/link.ld | 17 + apps/riscv-tests/env/p/riscv_test.h | 269 + apps/riscv-tests/env/pm/link.ld | 1 + apps/riscv-tests/env/pm/riscv_test.h | 11 + apps/riscv-tests/env/pt/link.ld | 1 + apps/riscv-tests/env/pt/riscv_test.h | 69 + apps/riscv-tests/env/v/entry.S | 162 + apps/riscv-tests/env/v/link.ld | 1 + apps/riscv-tests/env/v/riscv_test.h | 80 + apps/riscv-tests/env/v/string.c | 114 + apps/riscv-tests/env/v/vm.c | 300 + apps/riscv-tests/isa/.gitignore | 1 + apps/riscv-tests/isa/Makefile | 152 + .../isa/macros/scalar/test_macros.h | 649 ++ apps/riscv-tests/isa/macros/vector/dataset.h | 48 + .../isa/macros/vector/float_conversion.h | 133 + .../isa/macros/vector/float_macros.h | 159 + .../isa/macros/vector/long_array.h | 722 ++ .../isa/macros/vector/rvv_debug_macros.h | 106 + .../isa/macros/vector/vector_macros.h | 301 + apps/riscv-tests/isa/rv32mi/Makefrag | 18 + apps/riscv-tests/isa/rv32mi/breakpoint.S | 8 + apps/riscv-tests/isa/rv32mi/csr.S | 8 + apps/riscv-tests/isa/rv32mi/illegal.S | 7 + apps/riscv-tests/isa/rv32mi/ma_addr.S | 7 + apps/riscv-tests/isa/rv32mi/ma_fetch.S | 8 + apps/riscv-tests/isa/rv32mi/mcsr.S | 7 + apps/riscv-tests/isa/rv32mi/sbreak.S | 8 + apps/riscv-tests/isa/rv32mi/scall.S | 8 + apps/riscv-tests/isa/rv32mi/shamt.S | 44 + apps/riscv-tests/isa/rv32si/Makefrag | 15 + apps/riscv-tests/isa/rv32si/csr.S | 7 + apps/riscv-tests/isa/rv32si/dirty.S | 10 + apps/riscv-tests/isa/rv32si/ma_fetch.S | 7 + apps/riscv-tests/isa/rv32si/sbreak.S | 7 + apps/riscv-tests/isa/rv32si/scall.S | 7 + apps/riscv-tests/isa/rv32si/wfi.S | 7 + apps/riscv-tests/isa/rv32ua/Makefrag | 12 + apps/riscv-tests/isa/rv32ua/amoadd_w.S | 7 + apps/riscv-tests/isa/rv32ua/amoand_w.S | 7 + apps/riscv-tests/isa/rv32ua/amomax_w.S | 7 + apps/riscv-tests/isa/rv32ua/amomaxu_w.S | 7 + apps/riscv-tests/isa/rv32ua/amomin_w.S | 7 + apps/riscv-tests/isa/rv32ua/amominu_w.S | 7 + apps/riscv-tests/isa/rv32ua/amoor_w.S | 7 + apps/riscv-tests/isa/rv32ua/amoswap_w.S | 7 + apps/riscv-tests/isa/rv32ua/amoxor_w.S | 7 + apps/riscv-tests/isa/rv32ua/lrsc.S | 7 + apps/riscv-tests/isa/rv32uc/Makefrag | 11 + apps/riscv-tests/isa/rv32uc/rvc.S | 7 + apps/riscv-tests/isa/rv32ud/Makefrag | 15 + apps/riscv-tests/isa/rv32ud/fadd.S | 7 + apps/riscv-tests/isa/rv32ud/fclass.S | 7 + apps/riscv-tests/isa/rv32ud/fcmp.S | 7 + apps/riscv-tests/isa/rv32ud/fcvt.S | 7 + apps/riscv-tests/isa/rv32ud/fcvt_w.S | 7 + apps/riscv-tests/isa/rv32ud/fdiv.S | 7 + apps/riscv-tests/isa/rv32ud/fmadd.S | 7 + apps/riscv-tests/isa/rv32ud/fmin.S | 7 + apps/riscv-tests/isa/rv32ud/ldst.S | 42 + apps/riscv-tests/isa/rv32ud/move.S | 7 + apps/riscv-tests/isa/rv32ud/recoding.S | 7 + apps/riscv-tests/isa/rv32uf/Makefrag | 12 + apps/riscv-tests/isa/rv32uf/fadd.S | 7 + apps/riscv-tests/isa/rv32uf/fclass.S | 7 + apps/riscv-tests/isa/rv32uf/fcmp.S | 7 + apps/riscv-tests/isa/rv32uf/fcvt.S | 7 + apps/riscv-tests/isa/rv32uf/fcvt_w.S | 7 + apps/riscv-tests/isa/rv32uf/fdiv.S | 7 + apps/riscv-tests/isa/rv32uf/fmadd.S | 7 + apps/riscv-tests/isa/rv32uf/fmin.S | 7 + apps/riscv-tests/isa/rv32uf/ldst.S | 38 + apps/riscv-tests/isa/rv32uf/move.S | 7 + apps/riscv-tests/isa/rv32uf/recoding.S | 7 + apps/riscv-tests/isa/rv32ui/Makefrag | 27 + apps/riscv-tests/isa/rv32ui/add.S | 7 + apps/riscv-tests/isa/rv32ui/addi.S | 7 + apps/riscv-tests/isa/rv32ui/and.S | 7 + apps/riscv-tests/isa/rv32ui/andi.S | 7 + apps/riscv-tests/isa/rv32ui/auipc.S | 7 + apps/riscv-tests/isa/rv32ui/beq.S | 7 + apps/riscv-tests/isa/rv32ui/bge.S | 7 + apps/riscv-tests/isa/rv32ui/bgeu.S | 7 + apps/riscv-tests/isa/rv32ui/blt.S | 7 + apps/riscv-tests/isa/rv32ui/bltu.S | 7 + apps/riscv-tests/isa/rv32ui/bne.S | 7 + apps/riscv-tests/isa/rv32ui/fence_i.S | 7 + apps/riscv-tests/isa/rv32ui/jal.S | 7 + apps/riscv-tests/isa/rv32ui/jalr.S | 7 + apps/riscv-tests/isa/rv32ui/lb.S | 7 + apps/riscv-tests/isa/rv32ui/lbu.S | 7 + apps/riscv-tests/isa/rv32ui/lh.S | 7 + apps/riscv-tests/isa/rv32ui/lhu.S | 7 + apps/riscv-tests/isa/rv32ui/lui.S | 7 + apps/riscv-tests/isa/rv32ui/lw.S | 7 + apps/riscv-tests/isa/rv32ui/or.S | 7 + apps/riscv-tests/isa/rv32ui/ori.S | 7 + apps/riscv-tests/isa/rv32ui/sb.S | 7 + apps/riscv-tests/isa/rv32ui/sh.S | 7 + apps/riscv-tests/isa/rv32ui/simple.S | 7 + apps/riscv-tests/isa/rv32ui/sll.S | 7 + apps/riscv-tests/isa/rv32ui/slli.S | 7 + apps/riscv-tests/isa/rv32ui/slt.S | 7 + apps/riscv-tests/isa/rv32ui/slti.S | 7 + apps/riscv-tests/isa/rv32ui/sltiu.S | 7 + apps/riscv-tests/isa/rv32ui/sltu.S | 7 + apps/riscv-tests/isa/rv32ui/sra.S | 7 + apps/riscv-tests/isa/rv32ui/srai.S | 7 + apps/riscv-tests/isa/rv32ui/srl.S | 7 + apps/riscv-tests/isa/rv32ui/srli.S | 7 + apps/riscv-tests/isa/rv32ui/sub.S | 7 + apps/riscv-tests/isa/rv32ui/sw.S | 7 + apps/riscv-tests/isa/rv32ui/xor.S | 7 + apps/riscv-tests/isa/rv32ui/xori.S | 7 + apps/riscv-tests/isa/rv32um/Makefrag | 13 + apps/riscv-tests/isa/rv32um/div.S | 41 + apps/riscv-tests/isa/rv32um/divu.S | 41 + apps/riscv-tests/isa/rv32um/mul.S | 84 + apps/riscv-tests/isa/rv32um/mulh.S | 81 + apps/riscv-tests/isa/rv32um/mulhsu.S | 83 + apps/riscv-tests/isa/rv32um/mulhu.S | 82 + apps/riscv-tests/isa/rv32um/rem.S | 41 + apps/riscv-tests/isa/rv32um/remu.S | 41 + apps/riscv-tests/isa/rv64mi/Makefrag | 18 + apps/riscv-tests/isa/rv64mi/access.S | 70 + apps/riscv-tests/isa/rv64mi/breakpoint.S | 129 + apps/riscv-tests/isa/rv64mi/csr.S | 8 + apps/riscv-tests/isa/rv64mi/illegal.S | 195 + apps/riscv-tests/isa/rv64mi/ma_addr.S | 126 + apps/riscv-tests/isa/rv64mi/ma_fetch.S | 8 + apps/riscv-tests/isa/rv64mi/mcsr.S | 45 + apps/riscv-tests/isa/rv64mi/sbreak.S | 8 + apps/riscv-tests/isa/rv64mi/scall.S | 8 + apps/riscv-tests/isa/rv64si/Makefrag | 16 + apps/riscv-tests/isa/rv64si/csr.S | 154 + apps/riscv-tests/isa/rv64si/dirty.S | 133 + apps/riscv-tests/isa/rv64si/icache-alias.S | 141 + apps/riscv-tests/isa/rv64si/ma_fetch.S | 204 + apps/riscv-tests/isa/rv64si/sbreak.S | 51 + apps/riscv-tests/isa/rv64si/scall.S | 83 + apps/riscv-tests/isa/rv64si/wfi.S | 33 + apps/riscv-tests/isa/rv64ua/Makefrag | 13 + apps/riscv-tests/isa/rv64ua/amoadd_d.S | 47 + apps/riscv-tests/isa/rv64ua/amoadd_w.S | 48 + apps/riscv-tests/isa/rv64ua/amoand_d.S | 48 + apps/riscv-tests/isa/rv64ua/amoand_w.S | 48 + apps/riscv-tests/isa/rv64ua/amomax_d.S | 48 + apps/riscv-tests/isa/rv64ua/amomax_w.S | 48 + apps/riscv-tests/isa/rv64ua/amomaxu_d.S | 48 + apps/riscv-tests/isa/rv64ua/amomaxu_w.S | 48 + apps/riscv-tests/isa/rv64ua/amomin_d.S | 48 + apps/riscv-tests/isa/rv64ua/amomin_w.S | 48 + apps/riscv-tests/isa/rv64ua/amominu_d.S | 49 + apps/riscv-tests/isa/rv64ua/amominu_w.S | 49 + apps/riscv-tests/isa/rv64ua/amoor_d.S | 48 + apps/riscv-tests/isa/rv64ua/amoor_w.S | 48 + apps/riscv-tests/isa/rv64ua/amoswap_d.S | 48 + apps/riscv-tests/isa/rv64ua/amoswap_w.S | 48 + apps/riscv-tests/isa/rv64ua/amoxor_d.S | 48 + apps/riscv-tests/isa/rv64ua/amoxor_w.S | 48 + apps/riscv-tests/isa/rv64ua/lrsc.S | 102 + apps/riscv-tests/isa/rv64uc/Makefrag | 11 + apps/riscv-tests/isa/rv64uc/rvc.S | 154 + apps/riscv-tests/isa/rv64ud/Makefrag | 12 + apps/riscv-tests/isa/rv64ud/fadd.S | 50 + apps/riscv-tests/isa/rv64ud/fclass.S | 46 + apps/riscv-tests/isa/rv64ud/fcmp.S | 56 + apps/riscv-tests/isa/rv64ud/fcvt.S | 79 + apps/riscv-tests/isa/rv64ud/fcvt_w.S | 114 + apps/riscv-tests/isa/rv64ud/fdiv.S | 54 + apps/riscv-tests/isa/rv64ud/fmadd.S | 51 + apps/riscv-tests/isa/rv64ud/fmin.S | 60 + apps/riscv-tests/isa/rv64ud/ldst.S | 42 + apps/riscv-tests/isa/rv64ud/move.S | 113 + apps/riscv-tests/isa/rv64ud/recoding.S | 67 + apps/riscv-tests/isa/rv64ud/structural.S | 58 + apps/riscv-tests/isa/rv64uf/Makefrag | 12 + apps/riscv-tests/isa/rv64uf/fadd.S | 44 + apps/riscv-tests/isa/rv64uf/fclass.S | 40 + apps/riscv-tests/isa/rv64uf/fcmp.S | 50 + apps/riscv-tests/isa/rv64uf/fcvt.S | 43 + apps/riscv-tests/isa/rv64uf/fcvt_w.S | 105 + apps/riscv-tests/isa/rv64uf/fdiv.S | 40 + apps/riscv-tests/isa/rv64uf/fmadd.S | 45 + apps/riscv-tests/isa/rv64uf/fmin.S | 54 + apps/riscv-tests/isa/rv64uf/ldst.S | 38 + apps/riscv-tests/isa/rv64uf/move.S | 58 + apps/riscv-tests/isa/rv64uf/recoding.S | 46 + apps/riscv-tests/isa/rv64ui/Makefrag | 27 + apps/riscv-tests/isa/rv64ui/add.S | 85 + apps/riscv-tests/isa/rv64ui/addi.S | 71 + apps/riscv-tests/isa/rv64ui/addiw.S | 71 + apps/riscv-tests/isa/rv64ui/addw.S | 85 + apps/riscv-tests/isa/rv64ui/and.S | 69 + apps/riscv-tests/isa/rv64ui/andi.S | 55 + apps/riscv-tests/isa/rv64ui/auipc.S | 39 + apps/riscv-tests/isa/rv64ui/beq.S | 73 + apps/riscv-tests/isa/rv64ui/bge.S | 76 + apps/riscv-tests/isa/rv64ui/bgeu.S | 76 + apps/riscv-tests/isa/rv64ui/blt.S | 73 + apps/riscv-tests/isa/rv64ui/bltu.S | 73 + apps/riscv-tests/isa/rv64ui/bne.S | 73 + apps/riscv-tests/isa/rv64ui/fence_i.S | 62 + apps/riscv-tests/isa/rv64ui/jal.S | 59 + apps/riscv-tests/isa/rv64ui/jalr.S | 86 + apps/riscv-tests/isa/rv64ui/lb.S | 92 + apps/riscv-tests/isa/rv64ui/lbu.S | 92 + apps/riscv-tests/isa/rv64ui/ld.S | 92 + apps/riscv-tests/isa/rv64ui/lh.S | 92 + apps/riscv-tests/isa/rv64ui/lhu.S | 92 + apps/riscv-tests/isa/rv64ui/lui.S | 36 + apps/riscv-tests/isa/rv64ui/lw.S | 92 + apps/riscv-tests/isa/rv64ui/lwu.S | 92 + apps/riscv-tests/isa/rv64ui/or.S | 69 + apps/riscv-tests/isa/rv64ui/ori.S | 55 + apps/riscv-tests/isa/rv64ui/sb.S | 96 + apps/riscv-tests/isa/rv64ui/sd.S | 92 + apps/riscv-tests/isa/rv64ui/sh.S | 96 + apps/riscv-tests/isa/rv64ui/simple.S | 27 + apps/riscv-tests/isa/rv64ui/sll.S | 96 + apps/riscv-tests/isa/rv64ui/slli.S | 74 + apps/riscv-tests/isa/rv64ui/slliw.S | 75 + apps/riscv-tests/isa/rv64ui/sllw.S | 97 + apps/riscv-tests/isa/rv64ui/slt.S | 84 + apps/riscv-tests/isa/rv64ui/slti.S | 70 + apps/riscv-tests/isa/rv64ui/sltiu.S | 70 + apps/riscv-tests/isa/rv64ui/sltu.S | 84 + apps/riscv-tests/isa/rv64ui/sra.S | 90 + apps/riscv-tests/isa/rv64ui/srai.S | 68 + apps/riscv-tests/isa/rv64ui/sraiw.S | 78 + apps/riscv-tests/isa/rv64ui/sraw.S | 97 + apps/riscv-tests/isa/rv64ui/srl.S | 93 + apps/riscv-tests/isa/rv64ui/srli.S | 71 + apps/riscv-tests/isa/rv64ui/srliw.S | 75 + apps/riscv-tests/isa/rv64ui/srlw.S | 97 + apps/riscv-tests/isa/rv64ui/sub.S | 83 + apps/riscv-tests/isa/rv64ui/subw.S | 83 + apps/riscv-tests/isa/rv64ui/sw.S | 92 + apps/riscv-tests/isa/rv64ui/xor.S | 69 + apps/riscv-tests/isa/rv64ui/xori.S | 55 + apps/riscv-tests/isa/rv64um/Makefrag | 13 + apps/riscv-tests/isa/rv64um/div.S | 41 + apps/riscv-tests/isa/rv64um/divu.S | 41 + apps/riscv-tests/isa/rv64um/divuw.S | 41 + apps/riscv-tests/isa/rv64um/divw.S | 41 + apps/riscv-tests/isa/rv64um/mul.S | 78 + apps/riscv-tests/isa/rv64um/mulh.S | 72 + apps/riscv-tests/isa/rv64um/mulhsu.S | 72 + apps/riscv-tests/isa/rv64um/mulhu.S | 75 + apps/riscv-tests/isa/rv64um/mulw.S | 72 + apps/riscv-tests/isa/rv64um/rem.S | 41 + apps/riscv-tests/isa/rv64um/remu.S | 41 + apps/riscv-tests/isa/rv64um/remuw.S | 41 + apps/riscv-tests/isa/rv64um/remw.S | 42 + apps/riscv-tests/isa/rv64uv/Makefrag | 188 + apps/riscv-tests/isa/rv64uv/vaadd.c | 59 + apps/riscv-tests/isa/rv64uv/vaaddu.c | 59 + apps/riscv-tests/isa/rv64uv/vadc.c | 103 + apps/riscv-tests/isa/rv64uv/vadd.c | 202 + apps/riscv-tests/isa/rv64uv/vand.c | 309 + apps/riscv-tests/isa/rv64uv/vasub.c | 54 + apps/riscv-tests/isa/rv64uv/vasubu.c | 54 + apps/riscv-tests/isa/rv64uv/vcompress.c | 183 + apps/riscv-tests/isa/rv64uv/vcpop.c | 111 + apps/riscv-tests/isa/rv64uv/vdiv.c | 232 + apps/riscv-tests/isa/rv64uv/vdivu.c | 232 + apps/riscv-tests/isa/rv64uv/vfadd.c | 463 ++ apps/riscv-tests/isa/rv64uv/vfclass.c | 90 + apps/riscv-tests/isa/rv64uv/vfcvt.c | 834 +++ apps/riscv-tests/isa/rv64uv/vfdiv.c | 355 + apps/riscv-tests/isa/rv64uv/vfirst.c | 43 + apps/riscv-tests/isa/rv64uv/vfmacc.c | 356 + apps/riscv-tests/isa/rv64uv/vfmadd.c | 433 ++ apps/riscv-tests/isa/rv64uv/vfmax.c | 351 + apps/riscv-tests/isa/rv64uv/vfmerge.c | 94 + apps/riscv-tests/isa/rv64uv/vfmin.c | 348 + apps/riscv-tests/isa/rv64uv/vfmsac.c | 454 ++ apps/riscv-tests/isa/rv64uv/vfmsub.c | 453 ++ apps/riscv-tests/isa/rv64uv/vfmul.c | 350 + apps/riscv-tests/isa/rv64uv/vfmv.c | 68 + apps/riscv-tests/isa/rv64uv/vfmvfs.c | 90 + apps/riscv-tests/isa/rv64uv/vfmvsf.c | 69 + apps/riscv-tests/isa/rv64uv/vfncvt.c | 773 ++ apps/riscv-tests/isa/rv64uv/vfnmacc.c | 456 ++ apps/riscv-tests/isa/rv64uv/vfnmadd.c | 458 ++ apps/riscv-tests/isa/rv64uv/vfnmsac.c | 455 ++ apps/riscv-tests/isa/rv64uv/vfnmsub.c | 454 ++ apps/riscv-tests/isa/rv64uv/vfrdiv.c | 179 + apps/riscv-tests/isa/rv64uv/vfrec7.c | 121 + apps/riscv-tests/isa/rv64uv/vfredmax.c | 348 + apps/riscv-tests/isa/rv64uv/vfredmin.c | 348 + apps/riscv-tests/isa/rv64uv/vfredosum.c | 348 + apps/riscv-tests/isa/rv64uv/vfredusum.c | 348 + apps/riscv-tests/isa/rv64uv/vfrsqrt7.c | 71 + apps/riscv-tests/isa/rv64uv/vfrsub.c | 167 + apps/riscv-tests/isa/rv64uv/vfsgnj.c | 408 ++ apps/riscv-tests/isa/rv64uv/vfsgnjn.c | 350 + apps/riscv-tests/isa/rv64uv/vfsgnjx.c | 348 + apps/riscv-tests/isa/rv64uv/vfslide1down.c | 107 + apps/riscv-tests/isa/rv64uv/vfslide1up.c | 90 + apps/riscv-tests/isa/rv64uv/vfsqrt.c | 142 + apps/riscv-tests/isa/rv64uv/vfsub.c | 349 + apps/riscv-tests/isa/rv64uv/vfwadd.c | 523 ++ apps/riscv-tests/isa/rv64uv/vfwcvt.c | 656 ++ apps/riscv-tests/isa/rv64uv/vfwmacc.c | 351 + apps/riscv-tests/isa/rv64uv/vfwmsac.c | 353 + apps/riscv-tests/isa/rv64uv/vfwmul.c | 254 + apps/riscv-tests/isa/rv64uv/vfwnmacc.c | 352 + apps/riscv-tests/isa/rv64uv/vfwnmsac.c | 347 + apps/riscv-tests/isa/rv64uv/vfwredosum.c | 268 + apps/riscv-tests/isa/rv64uv/vfwredusum.c | 272 + apps/riscv-tests/isa/rv64uv/vfwsub.c | 519 ++ apps/riscv-tests/isa/rv64uv/vid.c | 42 + apps/riscv-tests/isa/rv64uv/viota.c | 280 + apps/riscv-tests/isa/rv64uv/vl.c | 79 + apps/riscv-tests/isa/rv64uv/vl1r.c | 439 ++ apps/riscv-tests/isa/rv64uv/vl_nocheck.c | 68 + apps/riscv-tests/isa/rv64uv/vle1.c | 45 + apps/riscv-tests/isa/rv64uv/vle16.c | 294 + apps/riscv-tests/isa/rv64uv/vle32.c | 311 + apps/riscv-tests/isa/rv64uv/vle64.c | 315 + apps/riscv-tests/isa/rv64uv/vle8.c | 274 + apps/riscv-tests/isa/rv64uv/vle_vse_hazards.c | 222 + apps/riscv-tests/isa/rv64uv/vlff.c | 91 + apps/riscv-tests/isa/rv64uv/vls.c | 190 + apps/riscv-tests/isa/rv64uv/vlseg.c | 391 + apps/riscv-tests/isa/rv64uv/vlsseg.c | 1678 +++++ apps/riscv-tests/isa/rv64uv/vluxei.c | 206 + apps/riscv-tests/isa/rv64uv/vluxseg.c | 145 + apps/riscv-tests/isa/rv64uv/vlx.c | 101 + apps/riscv-tests/isa/rv64uv/vmacc.c | 292 + apps/riscv-tests/isa/rv64uv/vmadc.c | 238 + apps/riscv-tests/isa/rv64uv/vmadd.c | 292 + apps/riscv-tests/isa/rv64uv/vmand.c | 79 + apps/riscv-tests/isa/rv64uv/vmandnot.c | 68 + apps/riscv-tests/isa/rv64uv/vmax.c | 181 + apps/riscv-tests/isa/rv64uv/vmaxu.c | 181 + apps/riscv-tests/isa/rv64uv/vmerge.c | 113 + apps/riscv-tests/isa/rv64uv/vmfeq.c | 503 ++ apps/riscv-tests/isa/rv64uv/vmfge.c | 134 + apps/riscv-tests/isa/rv64uv/vmfgt.c | 134 + apps/riscv-tests/isa/rv64uv/vmfle.c | 273 + apps/riscv-tests/isa/rv64uv/vmflt.c | 279 + apps/riscv-tests/isa/rv64uv/vmfne.c | 503 ++ apps/riscv-tests/isa/rv64uv/vmin.c | 181 + apps/riscv-tests/isa/rv64uv/vminu.c | 176 + apps/riscv-tests/isa/rv64uv/vmnand.c | 68 + apps/riscv-tests/isa/rv64uv/vmnor.c | 68 + apps/riscv-tests/isa/rv64uv/vmor.c | 68 + apps/riscv-tests/isa/rv64uv/vmornot.c | 68 + apps/riscv-tests/isa/rv64uv/vmsbc.c | 168 + apps/riscv-tests/isa/rv64uv/vmsbf.c | 160 + apps/riscv-tests/isa/rv64uv/vmseq.c | 365 + apps/riscv-tests/isa/rv64uv/vmsgt.c | 168 + apps/riscv-tests/isa/rv64uv/vmsgtu.c | 168 + apps/riscv-tests/isa/rv64uv/vmsif.c | 75 + apps/riscv-tests/isa/rv64uv/vmsle.c | 237 + apps/riscv-tests/isa/rv64uv/vmsleu.c | 237 + apps/riscv-tests/isa/rv64uv/vmslt.c | 163 + apps/riscv-tests/isa/rv64uv/vmsltu.c | 163 + apps/riscv-tests/isa/rv64uv/vmsne.c | 306 + apps/riscv-tests/isa/rv64uv/vmsof.c | 43 + apps/riscv-tests/isa/rv64uv/vmul.c | 232 + apps/riscv-tests/isa/rv64uv/vmulh.c | 232 + apps/riscv-tests/isa/rv64uv/vmulhsu.c | 232 + apps/riscv-tests/isa/rv64uv/vmulhu.c | 232 + apps/riscv-tests/isa/rv64uv/vmv.c | 104 + apps/riscv-tests/isa/rv64uv/vmvnrr.c | 146 + apps/riscv-tests/isa/rv64uv/vmvsx.c | 75 + apps/riscv-tests/isa/rv64uv/vmvxs.c | 72 + apps/riscv-tests/isa/rv64uv/vmxnor.c | 68 + apps/riscv-tests/isa/rv64uv/vmxor.c | 68 + apps/riscv-tests/isa/rv64uv/vnclip.c | 78 + apps/riscv-tests/isa/rv64uv/vnclipu.c | 78 + apps/riscv-tests/isa/rv64uv/vnmsac.c | 292 + apps/riscv-tests/isa/rv64uv/vnmsub.c | 292 + apps/riscv-tests/isa/rv64uv/vnsra.c | 242 + apps/riscv-tests/isa/rv64uv/vnsrl.c | 242 + apps/riscv-tests/isa/rv64uv/vor.c | 309 + apps/riscv-tests/isa/rv64uv/vpopc_m.c | 29 + apps/riscv-tests/isa/rv64uv/vredand.c | 93 + apps/riscv-tests/isa/rv64uv/vredmax.c | 79 + apps/riscv-tests/isa/rv64uv/vredmaxu.c | 106 + apps/riscv-tests/isa/rv64uv/vredmin.c | 78 + apps/riscv-tests/isa/rv64uv/vredminu.c | 78 + apps/riscv-tests/isa/rv64uv/vredor.c | 93 + apps/riscv-tests/isa/rv64uv/vredsum.c | 178 + apps/riscv-tests/isa/rv64uv/vredxor.c | 44 + apps/riscv-tests/isa/rv64uv/vrem.c | 232 + apps/riscv-tests/isa/rv64uv/vremu.c | 232 + apps/riscv-tests/isa/rv64uv/vrgather.c | 340 + apps/riscv-tests/isa/rv64uv/vrsub.c | 136 + apps/riscv-tests/isa/rv64uv/vs.c | 93 + apps/riscv-tests/isa/rv64uv/vs1r.c | 162 + apps/riscv-tests/isa/rv64uv/vsadd.c | 99 + apps/riscv-tests/isa/rv64uv/vsaddu.c | 113 + apps/riscv-tests/isa/rv64uv/vsbc.c | 76 + apps/riscv-tests/isa/rv64uv/vse1.c | 57 + apps/riscv-tests/isa/rv64uv/vse16.c | 360 + apps/riscv-tests/isa/rv64uv/vse32.c | 412 ++ apps/riscv-tests/isa/rv64uv/vse64.c | 436 ++ apps/riscv-tests/isa/rv64uv/vse8.c | 333 + apps/riscv-tests/isa/rv64uv/vsetivli.c | 466 ++ apps/riscv-tests/isa/rv64uv/vsetvl.c | 497 ++ apps/riscv-tests/isa/rv64uv/vsetvli.c | 498 ++ apps/riscv-tests/isa/rv64uv/vsext.c | 106 + apps/riscv-tests/isa/rv64uv/vslide1down.c | 102 + apps/riscv-tests/isa/rv64uv/vslide1up.c | 78 + apps/riscv-tests/isa/rv64uv/vslidedown.c | 181 + apps/riscv-tests/isa/rv64uv/vslideup.c | 166 + apps/riscv-tests/isa/rv64uv/vsll.c | 316 + apps/riscv-tests/isa/rv64uv/vsmul.c | 59 + apps/riscv-tests/isa/rv64uv/vsra.c | 316 + apps/riscv-tests/isa/rv64uv/vsrl.c | 316 + apps/riscv-tests/isa/rv64uv/vss.c | 146 + apps/riscv-tests/isa/rv64uv/vsseg.c | 407 ++ apps/riscv-tests/isa/rv64uv/vssra.c | 79 + apps/riscv-tests/isa/rv64uv/vssrl.c | 79 + apps/riscv-tests/isa/rv64uv/vssseg.c | 425 ++ apps/riscv-tests/isa/rv64uv/vssub.c | 68 + apps/riscv-tests/isa/rv64uv/vssubu.c | 55 + apps/riscv-tests/isa/rv64uv/vsub.c | 136 + apps/riscv-tests/isa/rv64uv/vsux.c | 104 + apps/riscv-tests/isa/rv64uv/vsuxei.c | 141 + apps/riscv-tests/isa/rv64uv/vsuxseg.c | 196 + apps/riscv-tests/isa/rv64uv/vsx.c | 102 + apps/riscv-tests/isa/rv64uv/vwadd.c | 228 + apps/riscv-tests/isa/rv64uv/vwaddu.c | 231 + apps/riscv-tests/isa/rv64uv/vwmacc.c | 248 + apps/riscv-tests/isa/rv64uv/vwmaccsu.c | 248 + apps/riscv-tests/isa/rv64uv/vwmaccu.c | 248 + apps/riscv-tests/isa/rv64uv/vwmaccus.c | 127 + apps/riscv-tests/isa/rv64uv/vwmul.c | 182 + apps/riscv-tests/isa/rv64uv/vwmulsu.c | 182 + apps/riscv-tests/isa/rv64uv/vwmulu.c | 182 + apps/riscv-tests/isa/rv64uv/vwredsum.c | 153 + apps/riscv-tests/isa/rv64uv/vwredsumu.c | 153 + apps/riscv-tests/isa/rv64uv/vwsub.c | 234 + apps/riscv-tests/isa/rv64uv/vwsubu.c | 234 + apps/riscv-tests/isa/rv64uv/vxor.c | 309 + apps/riscv-tests/isa/rv64uv/vzext.c | 115 + apps/riscv-tests/mt/.gitignore | 6 + apps/riscv-tests/mt/Makefile | 162 + apps/riscv-tests/mt/ad_matmul.c | 37 + apps/riscv-tests/mt/ae_matmul.c | 110 + apps/riscv-tests/mt/af_matmul.c | 79 + apps/riscv-tests/mt/ag_matmul.c | 79 + apps/riscv-tests/mt/ai_matmul.c | 72 + apps/riscv-tests/mt/ak_matmul.c | 62 + apps/riscv-tests/mt/al_matmul.c | 123 + apps/riscv-tests/mt/am_matmul.c | 64 + apps/riscv-tests/mt/an_matmul.c | 40 + apps/riscv-tests/mt/ap_matmul.c | 29 + apps/riscv-tests/mt/aq_matmul.c | 30 + apps/riscv-tests/mt/ar_matmul.c | 41 + apps/riscv-tests/mt/at_matmul.c | 164 + apps/riscv-tests/mt/av_matmul.c | 259 + apps/riscv-tests/mt/ay_matmul.c | 60 + apps/riscv-tests/mt/az_matmul.c | 181 + apps/riscv-tests/mt/bb_matmul.c | 35 + apps/riscv-tests/mt/bc_matmul.c | 137 + apps/riscv-tests/mt/bf_matmul.c | 127 + apps/riscv-tests/mt/bh_matmul.c | 97 + apps/riscv-tests/mt/bj_matmul.c | 97 + apps/riscv-tests/mt/bk_matmul.c | 92 + apps/riscv-tests/mt/bm_matmul.c | 205 + apps/riscv-tests/mt/bo_matmul.c | 98 + apps/riscv-tests/mt/br_matmul.c | 128 + apps/riscv-tests/mt/bs_matmul.c | 26 + apps/riscv-tests/mt/ce_matmul.c | 157 + apps/riscv-tests/mt/cf_matmul.c | 100 + apps/riscv-tests/mt/cg_matmul.c | 78 + apps/riscv-tests/mt/ci_matmul.c | 70 + apps/riscv-tests/mt/ck_matmul.c | 61 + apps/riscv-tests/mt/cl_matmul.c | 176 + apps/riscv-tests/mt/cm_matmul.c | 91 + apps/riscv-tests/mt/cs_matmul.c | 24 + apps/riscv-tests/mt/cv_matmul.c | 374 + apps/riscv-tests/mt/cy_matmul.c | 108 + apps/riscv-tests/mt/dc_matmul.c | 168 + apps/riscv-tests/mt/df_matmul.c | 237 + apps/riscv-tests/mt/dm_matmul.c | 196 + apps/riscv-tests/mt/do_matmul.c | 26 + apps/riscv-tests/mt/dr_matmul.c | 128 + apps/riscv-tests/mt/ds_matmul.c | 32 + apps/riscv-tests/mt/du_matmul.c | 64 + apps/riscv-tests/mt/dv_matmul.c | 98 + apps/riscv-tests/mt/vvadd0.c | 14 + apps/riscv-tests/mt/vvadd1.c | 17 + apps/riscv-tests/mt/vvadd2.c | 11 + apps/riscv-tests/mt/vvadd3.c | 22 + apps/riscv-tests/mt/vvadd4.c | 16 + config/16_lanes.mk | 2 + config/2_lanes.mk | 2 + config/4_lanes.mk | 2 + config/8_lanes.mk | 2 + 611 files changed, 87143 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/sphinx.yml create mode 100644 apps/riscv-tests/LICENSE create mode 100644 apps/riscv-tests/Makefile.in create mode 100644 apps/riscv-tests/README.md create mode 100644 apps/riscv-tests/benchmarks/Makefile create mode 100644 apps/riscv-tests/benchmarks/common/crt.S create mode 100644 apps/riscv-tests/benchmarks/common/syscalls.c create mode 100644 apps/riscv-tests/benchmarks/common/test.ld create mode 100644 apps/riscv-tests/benchmarks/common/util.h create mode 100644 apps/riscv-tests/benchmarks/dhrystone/dhrystone.c create mode 100644 apps/riscv-tests/benchmarks/dhrystone/dhrystone.h create mode 100644 apps/riscv-tests/benchmarks/dhrystone/dhrystone_main.c create mode 100644 apps/riscv-tests/benchmarks/median/dataset1.h create mode 100644 apps/riscv-tests/benchmarks/median/median.c create mode 100644 apps/riscv-tests/benchmarks/median/median.h create mode 100755 apps/riscv-tests/benchmarks/median/median_gendata.pl create mode 100644 apps/riscv-tests/benchmarks/median/median_main.c create mode 100644 apps/riscv-tests/benchmarks/mm/common.h create mode 100644 apps/riscv-tests/benchmarks/mm/gen.scala create mode 100644 apps/riscv-tests/benchmarks/mm/mm.c create mode 100644 apps/riscv-tests/benchmarks/mm/mm_main.c create mode 100644 apps/riscv-tests/benchmarks/mm/rb.h create mode 100644 apps/riscv-tests/benchmarks/mt-matmul/dataset.h create mode 100644 apps/riscv-tests/benchmarks/mt-matmul/matmul.c create mode 100755 apps/riscv-tests/benchmarks/mt-matmul/matmul_gendata.pl create mode 100644 apps/riscv-tests/benchmarks/mt-matmul/mt-matmul.c create mode 100644 apps/riscv-tests/benchmarks/mt-vvadd/dataset.h create mode 100644 apps/riscv-tests/benchmarks/mt-vvadd/mt-vvadd.c create mode 100644 apps/riscv-tests/benchmarks/mt-vvadd/vvadd.c create mode 100755 apps/riscv-tests/benchmarks/mt-vvadd/vvadd_gendata.pl create mode 100644 apps/riscv-tests/benchmarks/multiply/dataset1.h create mode 100644 apps/riscv-tests/benchmarks/multiply/multiply.c create mode 100644 apps/riscv-tests/benchmarks/multiply/multiply.h create mode 100755 apps/riscv-tests/benchmarks/multiply/multiply_gendata.pl create mode 100644 apps/riscv-tests/benchmarks/multiply/multiply_main.c create mode 100644 apps/riscv-tests/benchmarks/pmp/pmp.c create mode 100644 apps/riscv-tests/benchmarks/qsort/dataset1.h create mode 100755 apps/riscv-tests/benchmarks/qsort/qsort_gendata.pl create mode 100644 apps/riscv-tests/benchmarks/qsort/qsort_main.c create mode 100644 apps/riscv-tests/benchmarks/readme.txt create mode 100644 apps/riscv-tests/benchmarks/rsort/dataset1.h create mode 100644 apps/riscv-tests/benchmarks/rsort/rsort.c create mode 100644 apps/riscv-tests/benchmarks/spmv/dataset1.h create mode 100644 apps/riscv-tests/benchmarks/spmv/spmv_gendata.scala create mode 100644 apps/riscv-tests/benchmarks/spmv/spmv_main.c create mode 100644 apps/riscv-tests/benchmarks/towers/towers_main.c create mode 100644 apps/riscv-tests/benchmarks/vvadd/dataset1-large.h create mode 100644 apps/riscv-tests/benchmarks/vvadd/dataset1.h create mode 100755 apps/riscv-tests/benchmarks/vvadd/vvadd_gendata.pl create mode 100644 apps/riscv-tests/benchmarks/vvadd/vvadd_main.c create mode 100755 apps/riscv-tests/configure create mode 100644 apps/riscv-tests/configure.ac create mode 100644 apps/riscv-tests/debug/Makefile create mode 100644 apps/riscv-tests/debug/README.md create mode 100755 apps/riscv-tests/debug/gdbserver.py create mode 100755 apps/riscv-tests/debug/openocd.py create mode 100644 apps/riscv-tests/debug/programs/checksum.c create mode 100644 apps/riscv-tests/debug/programs/counting_loop.c create mode 100644 apps/riscv-tests/debug/programs/debug.c create mode 120000 apps/riscv-tests/debug/programs/encoding.h create mode 100755 apps/riscv-tests/debug/programs/entry.S create mode 100644 apps/riscv-tests/debug/programs/infinite_loop.S create mode 100644 apps/riscv-tests/debug/programs/init.c create mode 100644 apps/riscv-tests/debug/programs/init.h create mode 100644 apps/riscv-tests/debug/programs/interrupt.c create mode 100644 apps/riscv-tests/debug/programs/mprv.S create mode 100644 apps/riscv-tests/debug/programs/multicore.c create mode 100644 apps/riscv-tests/debug/programs/priv.S create mode 100644 apps/riscv-tests/debug/programs/regs.S create mode 100644 apps/riscv-tests/debug/programs/run_halt_timing.S create mode 100644 apps/riscv-tests/debug/programs/semihosting.c create mode 100644 apps/riscv-tests/debug/programs/semihosting.h create mode 100644 apps/riscv-tests/debug/programs/step.S create mode 100644 apps/riscv-tests/debug/programs/tiny-malloc.c create mode 100644 apps/riscv-tests/debug/programs/translate.c create mode 100644 apps/riscv-tests/debug/programs/trigger.S create mode 100644 apps/riscv-tests/debug/programs/vectors.S create mode 100644 apps/riscv-tests/debug/pylint.rc create mode 100644 apps/riscv-tests/debug/requirements.txt create mode 100644 apps/riscv-tests/debug/targets.py create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike-1.cfg create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike-2-hwthread.cfg create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike-2.cfg create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike-rtos.cfg create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike32-2-hwthread.py create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike32-2-rtos.py create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike32-2.py create mode 100755 apps/riscv-tests/debug/targets/RISC-V/spike32.lds create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike32.py create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike64-2-hwthread.py create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike64-2-rtos.py create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike64-2.py create mode 100755 apps/riscv-tests/debug/targets/RISC-V/spike64.lds create mode 100644 apps/riscv-tests/debug/targets/RISC-V/spike64.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/Freedom/E300.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.cfg create mode 100644 apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.lds create mode 100644 apps/riscv-tests/debug/targets/SiFive/Freedom/U500.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/Freedom/U500Sim.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.lds create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFive1.cfg create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFive1.lds create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFive1.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.lds create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.py create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.cfg create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.lds create mode 100644 apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.py create mode 100755 apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed_setup.bin create mode 100644 apps/riscv-tests/debug/testlib.py create mode 100644 apps/riscv-tests/env/LICENSE create mode 100644 apps/riscv-tests/env/encoding.h create mode 100644 apps/riscv-tests/env/p/link.ld create mode 100644 apps/riscv-tests/env/p/riscv_test.h create mode 120000 apps/riscv-tests/env/pm/link.ld create mode 100644 apps/riscv-tests/env/pm/riscv_test.h create mode 120000 apps/riscv-tests/env/pt/link.ld create mode 100644 apps/riscv-tests/env/pt/riscv_test.h create mode 100644 apps/riscv-tests/env/v/entry.S create mode 120000 apps/riscv-tests/env/v/link.ld create mode 100644 apps/riscv-tests/env/v/riscv_test.h create mode 100644 apps/riscv-tests/env/v/string.c create mode 100644 apps/riscv-tests/env/v/vm.c create mode 100644 apps/riscv-tests/isa/.gitignore create mode 100644 apps/riscv-tests/isa/Makefile create mode 100644 apps/riscv-tests/isa/macros/scalar/test_macros.h create mode 100644 apps/riscv-tests/isa/macros/vector/dataset.h create mode 100644 apps/riscv-tests/isa/macros/vector/float_conversion.h create mode 100644 apps/riscv-tests/isa/macros/vector/float_macros.h create mode 100644 apps/riscv-tests/isa/macros/vector/long_array.h create mode 100644 apps/riscv-tests/isa/macros/vector/rvv_debug_macros.h create mode 100644 apps/riscv-tests/isa/macros/vector/vector_macros.h create mode 100644 apps/riscv-tests/isa/rv32mi/Makefrag create mode 100644 apps/riscv-tests/isa/rv32mi/breakpoint.S create mode 100644 apps/riscv-tests/isa/rv32mi/csr.S create mode 100644 apps/riscv-tests/isa/rv32mi/illegal.S create mode 100644 apps/riscv-tests/isa/rv32mi/ma_addr.S create mode 100644 apps/riscv-tests/isa/rv32mi/ma_fetch.S create mode 100644 apps/riscv-tests/isa/rv32mi/mcsr.S create mode 100644 apps/riscv-tests/isa/rv32mi/sbreak.S create mode 100644 apps/riscv-tests/isa/rv32mi/scall.S create mode 100644 apps/riscv-tests/isa/rv32mi/shamt.S create mode 100644 apps/riscv-tests/isa/rv32si/Makefrag create mode 100644 apps/riscv-tests/isa/rv32si/csr.S create mode 100644 apps/riscv-tests/isa/rv32si/dirty.S create mode 100644 apps/riscv-tests/isa/rv32si/ma_fetch.S create mode 100644 apps/riscv-tests/isa/rv32si/sbreak.S create mode 100644 apps/riscv-tests/isa/rv32si/scall.S create mode 100644 apps/riscv-tests/isa/rv32si/wfi.S create mode 100644 apps/riscv-tests/isa/rv32ua/Makefrag create mode 100644 apps/riscv-tests/isa/rv32ua/amoadd_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amoand_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amomax_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amomaxu_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amomin_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amominu_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amoor_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amoswap_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/amoxor_w.S create mode 100644 apps/riscv-tests/isa/rv32ua/lrsc.S create mode 100644 apps/riscv-tests/isa/rv32uc/Makefrag create mode 100644 apps/riscv-tests/isa/rv32uc/rvc.S create mode 100644 apps/riscv-tests/isa/rv32ud/Makefrag create mode 100644 apps/riscv-tests/isa/rv32ud/fadd.S create mode 100644 apps/riscv-tests/isa/rv32ud/fclass.S create mode 100644 apps/riscv-tests/isa/rv32ud/fcmp.S create mode 100644 apps/riscv-tests/isa/rv32ud/fcvt.S create mode 100644 apps/riscv-tests/isa/rv32ud/fcvt_w.S create mode 100644 apps/riscv-tests/isa/rv32ud/fdiv.S create mode 100644 apps/riscv-tests/isa/rv32ud/fmadd.S create mode 100644 apps/riscv-tests/isa/rv32ud/fmin.S create mode 100644 apps/riscv-tests/isa/rv32ud/ldst.S create mode 100644 apps/riscv-tests/isa/rv32ud/move.S create mode 100644 apps/riscv-tests/isa/rv32ud/recoding.S create mode 100644 apps/riscv-tests/isa/rv32uf/Makefrag create mode 100644 apps/riscv-tests/isa/rv32uf/fadd.S create mode 100644 apps/riscv-tests/isa/rv32uf/fclass.S create mode 100644 apps/riscv-tests/isa/rv32uf/fcmp.S create mode 100644 apps/riscv-tests/isa/rv32uf/fcvt.S create mode 100644 apps/riscv-tests/isa/rv32uf/fcvt_w.S create mode 100644 apps/riscv-tests/isa/rv32uf/fdiv.S create mode 100644 apps/riscv-tests/isa/rv32uf/fmadd.S create mode 100644 apps/riscv-tests/isa/rv32uf/fmin.S create mode 100644 apps/riscv-tests/isa/rv32uf/ldst.S create mode 100644 apps/riscv-tests/isa/rv32uf/move.S create mode 100644 apps/riscv-tests/isa/rv32uf/recoding.S create mode 100644 apps/riscv-tests/isa/rv32ui/Makefrag create mode 100644 apps/riscv-tests/isa/rv32ui/add.S create mode 100644 apps/riscv-tests/isa/rv32ui/addi.S create mode 100644 apps/riscv-tests/isa/rv32ui/and.S create mode 100644 apps/riscv-tests/isa/rv32ui/andi.S create mode 100644 apps/riscv-tests/isa/rv32ui/auipc.S create mode 100644 apps/riscv-tests/isa/rv32ui/beq.S create mode 100644 apps/riscv-tests/isa/rv32ui/bge.S create mode 100644 apps/riscv-tests/isa/rv32ui/bgeu.S create mode 100644 apps/riscv-tests/isa/rv32ui/blt.S create mode 100644 apps/riscv-tests/isa/rv32ui/bltu.S create mode 100644 apps/riscv-tests/isa/rv32ui/bne.S create mode 100644 apps/riscv-tests/isa/rv32ui/fence_i.S create mode 100644 apps/riscv-tests/isa/rv32ui/jal.S create mode 100644 apps/riscv-tests/isa/rv32ui/jalr.S create mode 100644 apps/riscv-tests/isa/rv32ui/lb.S create mode 100644 apps/riscv-tests/isa/rv32ui/lbu.S create mode 100644 apps/riscv-tests/isa/rv32ui/lh.S create mode 100644 apps/riscv-tests/isa/rv32ui/lhu.S create mode 100644 apps/riscv-tests/isa/rv32ui/lui.S create mode 100644 apps/riscv-tests/isa/rv32ui/lw.S create mode 100644 apps/riscv-tests/isa/rv32ui/or.S create mode 100644 apps/riscv-tests/isa/rv32ui/ori.S create mode 100644 apps/riscv-tests/isa/rv32ui/sb.S create mode 100644 apps/riscv-tests/isa/rv32ui/sh.S create mode 100644 apps/riscv-tests/isa/rv32ui/simple.S create mode 100644 apps/riscv-tests/isa/rv32ui/sll.S create mode 100644 apps/riscv-tests/isa/rv32ui/slli.S create mode 100644 apps/riscv-tests/isa/rv32ui/slt.S create mode 100644 apps/riscv-tests/isa/rv32ui/slti.S create mode 100644 apps/riscv-tests/isa/rv32ui/sltiu.S create mode 100644 apps/riscv-tests/isa/rv32ui/sltu.S create mode 100644 apps/riscv-tests/isa/rv32ui/sra.S create mode 100644 apps/riscv-tests/isa/rv32ui/srai.S create mode 100644 apps/riscv-tests/isa/rv32ui/srl.S create mode 100644 apps/riscv-tests/isa/rv32ui/srli.S create mode 100644 apps/riscv-tests/isa/rv32ui/sub.S create mode 100644 apps/riscv-tests/isa/rv32ui/sw.S create mode 100644 apps/riscv-tests/isa/rv32ui/xor.S create mode 100644 apps/riscv-tests/isa/rv32ui/xori.S create mode 100644 apps/riscv-tests/isa/rv32um/Makefrag create mode 100644 apps/riscv-tests/isa/rv32um/div.S create mode 100644 apps/riscv-tests/isa/rv32um/divu.S create mode 100644 apps/riscv-tests/isa/rv32um/mul.S create mode 100644 apps/riscv-tests/isa/rv32um/mulh.S create mode 100644 apps/riscv-tests/isa/rv32um/mulhsu.S create mode 100644 apps/riscv-tests/isa/rv32um/mulhu.S create mode 100644 apps/riscv-tests/isa/rv32um/rem.S create mode 100644 apps/riscv-tests/isa/rv32um/remu.S create mode 100644 apps/riscv-tests/isa/rv64mi/Makefrag create mode 100644 apps/riscv-tests/isa/rv64mi/access.S create mode 100644 apps/riscv-tests/isa/rv64mi/breakpoint.S create mode 100644 apps/riscv-tests/isa/rv64mi/csr.S create mode 100644 apps/riscv-tests/isa/rv64mi/illegal.S create mode 100644 apps/riscv-tests/isa/rv64mi/ma_addr.S create mode 100644 apps/riscv-tests/isa/rv64mi/ma_fetch.S create mode 100644 apps/riscv-tests/isa/rv64mi/mcsr.S create mode 100644 apps/riscv-tests/isa/rv64mi/sbreak.S create mode 100644 apps/riscv-tests/isa/rv64mi/scall.S create mode 100644 apps/riscv-tests/isa/rv64si/Makefrag create mode 100644 apps/riscv-tests/isa/rv64si/csr.S create mode 100644 apps/riscv-tests/isa/rv64si/dirty.S create mode 100644 apps/riscv-tests/isa/rv64si/icache-alias.S create mode 100644 apps/riscv-tests/isa/rv64si/ma_fetch.S create mode 100644 apps/riscv-tests/isa/rv64si/sbreak.S create mode 100644 apps/riscv-tests/isa/rv64si/scall.S create mode 100644 apps/riscv-tests/isa/rv64si/wfi.S create mode 100644 apps/riscv-tests/isa/rv64ua/Makefrag create mode 100644 apps/riscv-tests/isa/rv64ua/amoadd_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoadd_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoand_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoand_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amomax_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amomax_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amomaxu_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amomaxu_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amomin_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amomin_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amominu_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amominu_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoor_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoor_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoswap_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoswap_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoxor_d.S create mode 100644 apps/riscv-tests/isa/rv64ua/amoxor_w.S create mode 100644 apps/riscv-tests/isa/rv64ua/lrsc.S create mode 100644 apps/riscv-tests/isa/rv64uc/Makefrag create mode 100644 apps/riscv-tests/isa/rv64uc/rvc.S create mode 100644 apps/riscv-tests/isa/rv64ud/Makefrag create mode 100644 apps/riscv-tests/isa/rv64ud/fadd.S create mode 100644 apps/riscv-tests/isa/rv64ud/fclass.S create mode 100644 apps/riscv-tests/isa/rv64ud/fcmp.S create mode 100644 apps/riscv-tests/isa/rv64ud/fcvt.S create mode 100644 apps/riscv-tests/isa/rv64ud/fcvt_w.S create mode 100644 apps/riscv-tests/isa/rv64ud/fdiv.S create mode 100644 apps/riscv-tests/isa/rv64ud/fmadd.S create mode 100644 apps/riscv-tests/isa/rv64ud/fmin.S create mode 100644 apps/riscv-tests/isa/rv64ud/ldst.S create mode 100644 apps/riscv-tests/isa/rv64ud/move.S create mode 100644 apps/riscv-tests/isa/rv64ud/recoding.S create mode 100644 apps/riscv-tests/isa/rv64ud/structural.S create mode 100644 apps/riscv-tests/isa/rv64uf/Makefrag create mode 100644 apps/riscv-tests/isa/rv64uf/fadd.S create mode 100644 apps/riscv-tests/isa/rv64uf/fclass.S create mode 100644 apps/riscv-tests/isa/rv64uf/fcmp.S create mode 100644 apps/riscv-tests/isa/rv64uf/fcvt.S create mode 100644 apps/riscv-tests/isa/rv64uf/fcvt_w.S create mode 100644 apps/riscv-tests/isa/rv64uf/fdiv.S create mode 100644 apps/riscv-tests/isa/rv64uf/fmadd.S create mode 100644 apps/riscv-tests/isa/rv64uf/fmin.S create mode 100644 apps/riscv-tests/isa/rv64uf/ldst.S create mode 100644 apps/riscv-tests/isa/rv64uf/move.S create mode 100644 apps/riscv-tests/isa/rv64uf/recoding.S create mode 100644 apps/riscv-tests/isa/rv64ui/Makefrag create mode 100644 apps/riscv-tests/isa/rv64ui/add.S create mode 100644 apps/riscv-tests/isa/rv64ui/addi.S create mode 100644 apps/riscv-tests/isa/rv64ui/addiw.S create mode 100644 apps/riscv-tests/isa/rv64ui/addw.S create mode 100644 apps/riscv-tests/isa/rv64ui/and.S create mode 100644 apps/riscv-tests/isa/rv64ui/andi.S create mode 100644 apps/riscv-tests/isa/rv64ui/auipc.S create mode 100644 apps/riscv-tests/isa/rv64ui/beq.S create mode 100644 apps/riscv-tests/isa/rv64ui/bge.S create mode 100644 apps/riscv-tests/isa/rv64ui/bgeu.S create mode 100644 apps/riscv-tests/isa/rv64ui/blt.S create mode 100644 apps/riscv-tests/isa/rv64ui/bltu.S create mode 100644 apps/riscv-tests/isa/rv64ui/bne.S create mode 100644 apps/riscv-tests/isa/rv64ui/fence_i.S create mode 100644 apps/riscv-tests/isa/rv64ui/jal.S create mode 100644 apps/riscv-tests/isa/rv64ui/jalr.S create mode 100644 apps/riscv-tests/isa/rv64ui/lb.S create mode 100644 apps/riscv-tests/isa/rv64ui/lbu.S create mode 100644 apps/riscv-tests/isa/rv64ui/ld.S create mode 100644 apps/riscv-tests/isa/rv64ui/lh.S create mode 100644 apps/riscv-tests/isa/rv64ui/lhu.S create mode 100644 apps/riscv-tests/isa/rv64ui/lui.S create mode 100644 apps/riscv-tests/isa/rv64ui/lw.S create mode 100644 apps/riscv-tests/isa/rv64ui/lwu.S create mode 100644 apps/riscv-tests/isa/rv64ui/or.S create mode 100644 apps/riscv-tests/isa/rv64ui/ori.S create mode 100644 apps/riscv-tests/isa/rv64ui/sb.S create mode 100644 apps/riscv-tests/isa/rv64ui/sd.S create mode 100644 apps/riscv-tests/isa/rv64ui/sh.S create mode 100644 apps/riscv-tests/isa/rv64ui/simple.S create mode 100644 apps/riscv-tests/isa/rv64ui/sll.S create mode 100644 apps/riscv-tests/isa/rv64ui/slli.S create mode 100644 apps/riscv-tests/isa/rv64ui/slliw.S create mode 100644 apps/riscv-tests/isa/rv64ui/sllw.S create mode 100644 apps/riscv-tests/isa/rv64ui/slt.S create mode 100644 apps/riscv-tests/isa/rv64ui/slti.S create mode 100644 apps/riscv-tests/isa/rv64ui/sltiu.S create mode 100644 apps/riscv-tests/isa/rv64ui/sltu.S create mode 100644 apps/riscv-tests/isa/rv64ui/sra.S create mode 100644 apps/riscv-tests/isa/rv64ui/srai.S create mode 100644 apps/riscv-tests/isa/rv64ui/sraiw.S create mode 100644 apps/riscv-tests/isa/rv64ui/sraw.S create mode 100644 apps/riscv-tests/isa/rv64ui/srl.S create mode 100644 apps/riscv-tests/isa/rv64ui/srli.S create mode 100644 apps/riscv-tests/isa/rv64ui/srliw.S create mode 100644 apps/riscv-tests/isa/rv64ui/srlw.S create mode 100644 apps/riscv-tests/isa/rv64ui/sub.S create mode 100644 apps/riscv-tests/isa/rv64ui/subw.S create mode 100644 apps/riscv-tests/isa/rv64ui/sw.S create mode 100644 apps/riscv-tests/isa/rv64ui/xor.S create mode 100644 apps/riscv-tests/isa/rv64ui/xori.S create mode 100644 apps/riscv-tests/isa/rv64um/Makefrag create mode 100644 apps/riscv-tests/isa/rv64um/div.S create mode 100644 apps/riscv-tests/isa/rv64um/divu.S create mode 100644 apps/riscv-tests/isa/rv64um/divuw.S create mode 100644 apps/riscv-tests/isa/rv64um/divw.S create mode 100644 apps/riscv-tests/isa/rv64um/mul.S create mode 100644 apps/riscv-tests/isa/rv64um/mulh.S create mode 100644 apps/riscv-tests/isa/rv64um/mulhsu.S create mode 100644 apps/riscv-tests/isa/rv64um/mulhu.S create mode 100644 apps/riscv-tests/isa/rv64um/mulw.S create mode 100644 apps/riscv-tests/isa/rv64um/rem.S create mode 100644 apps/riscv-tests/isa/rv64um/remu.S create mode 100644 apps/riscv-tests/isa/rv64um/remuw.S create mode 100644 apps/riscv-tests/isa/rv64um/remw.S create mode 100644 apps/riscv-tests/isa/rv64uv/Makefrag create mode 100644 apps/riscv-tests/isa/rv64uv/vaadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vaaddu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vadc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vand.c create mode 100644 apps/riscv-tests/isa/rv64uv/vasub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vasubu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vcompress.c create mode 100644 apps/riscv-tests/isa/rv64uv/vcpop.c create mode 100644 apps/riscv-tests/isa/rv64uv/vdiv.c create mode 100644 apps/riscv-tests/isa/rv64uv/vdivu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfclass.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfcvt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfdiv.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfirst.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmacc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmax.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmerge.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmin.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmsac.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmul.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmv.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmvfs.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfmvsf.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfncvt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfnmacc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfnmadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfnmsac.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfnmsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfrdiv.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfrec7.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfredmax.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfredmin.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfredosum.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfredusum.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfrsqrt7.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfrsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfsgnj.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfsgnjn.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfsgnjx.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfslide1down.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfslide1up.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfsqrt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwcvt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwmacc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwmsac.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwmul.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwnmacc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwnmsac.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwredosum.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwredusum.c create mode 100644 apps/riscv-tests/isa/rv64uv/vfwsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vid.c create mode 100644 apps/riscv-tests/isa/rv64uv/viota.c create mode 100644 apps/riscv-tests/isa/rv64uv/vl.c create mode 100644 apps/riscv-tests/isa/rv64uv/vl1r.c create mode 100644 apps/riscv-tests/isa/rv64uv/vl_nocheck.c create mode 100644 apps/riscv-tests/isa/rv64uv/vle1.c create mode 100644 apps/riscv-tests/isa/rv64uv/vle16.c create mode 100644 apps/riscv-tests/isa/rv64uv/vle32.c create mode 100644 apps/riscv-tests/isa/rv64uv/vle64.c create mode 100644 apps/riscv-tests/isa/rv64uv/vle8.c create mode 100644 apps/riscv-tests/isa/rv64uv/vle_vse_hazards.c create mode 100644 apps/riscv-tests/isa/rv64uv/vlff.c create mode 100644 apps/riscv-tests/isa/rv64uv/vls.c create mode 100644 apps/riscv-tests/isa/rv64uv/vlseg.c create mode 100644 apps/riscv-tests/isa/rv64uv/vlsseg.c create mode 100644 apps/riscv-tests/isa/rv64uv/vluxei.c create mode 100644 apps/riscv-tests/isa/rv64uv/vluxseg.c create mode 100644 apps/riscv-tests/isa/rv64uv/vlx.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmacc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmadc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmand.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmandnot.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmax.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmaxu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmerge.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmfeq.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmfge.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmfgt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmfle.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmflt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmfne.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmin.c create mode 100644 apps/riscv-tests/isa/rv64uv/vminu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmnand.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmnor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmornot.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsbc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsbf.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmseq.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsgt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsgtu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsif.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsle.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsleu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmslt.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsltu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsne.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmsof.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmul.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmulh.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmulhsu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmulhu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmv.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmvnrr.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmvsx.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmvxs.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmxnor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vmxor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vnclip.c create mode 100644 apps/riscv-tests/isa/rv64uv/vnclipu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vnmsac.c create mode 100644 apps/riscv-tests/isa/rv64uv/vnmsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vnsra.c create mode 100644 apps/riscv-tests/isa/rv64uv/vnsrl.c create mode 100644 apps/riscv-tests/isa/rv64uv/vor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vpopc_m.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredand.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredmax.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredmaxu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredmin.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredminu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredsum.c create mode 100644 apps/riscv-tests/isa/rv64uv/vredxor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vrem.c create mode 100644 apps/riscv-tests/isa/rv64uv/vremu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vrgather.c create mode 100644 apps/riscv-tests/isa/rv64uv/vrsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vs.c create mode 100644 apps/riscv-tests/isa/rv64uv/vs1r.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsaddu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsbc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vse1.c create mode 100644 apps/riscv-tests/isa/rv64uv/vse16.c create mode 100644 apps/riscv-tests/isa/rv64uv/vse32.c create mode 100644 apps/riscv-tests/isa/rv64uv/vse64.c create mode 100644 apps/riscv-tests/isa/rv64uv/vse8.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsetivli.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsetvl.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsetvli.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsext.c create mode 100644 apps/riscv-tests/isa/rv64uv/vslide1down.c create mode 100644 apps/riscv-tests/isa/rv64uv/vslide1up.c create mode 100644 apps/riscv-tests/isa/rv64uv/vslidedown.c create mode 100644 apps/riscv-tests/isa/rv64uv/vslideup.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsll.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsmul.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsra.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsrl.c create mode 100644 apps/riscv-tests/isa/rv64uv/vss.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsseg.c create mode 100644 apps/riscv-tests/isa/rv64uv/vssra.c create mode 100644 apps/riscv-tests/isa/rv64uv/vssrl.c create mode 100644 apps/riscv-tests/isa/rv64uv/vssseg.c create mode 100644 apps/riscv-tests/isa/rv64uv/vssub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vssubu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsux.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsuxei.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsuxseg.c create mode 100644 apps/riscv-tests/isa/rv64uv/vsx.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwadd.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwaddu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmacc.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmaccsu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmaccu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmaccus.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmul.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmulsu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwmulu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwredsum.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwredsumu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwsub.c create mode 100644 apps/riscv-tests/isa/rv64uv/vwsubu.c create mode 100644 apps/riscv-tests/isa/rv64uv/vxor.c create mode 100644 apps/riscv-tests/isa/rv64uv/vzext.c create mode 100644 apps/riscv-tests/mt/.gitignore create mode 100644 apps/riscv-tests/mt/Makefile create mode 100644 apps/riscv-tests/mt/ad_matmul.c create mode 100644 apps/riscv-tests/mt/ae_matmul.c create mode 100644 apps/riscv-tests/mt/af_matmul.c create mode 100644 apps/riscv-tests/mt/ag_matmul.c create mode 100644 apps/riscv-tests/mt/ai_matmul.c create mode 100644 apps/riscv-tests/mt/ak_matmul.c create mode 100644 apps/riscv-tests/mt/al_matmul.c create mode 100644 apps/riscv-tests/mt/am_matmul.c create mode 100644 apps/riscv-tests/mt/an_matmul.c create mode 100644 apps/riscv-tests/mt/ap_matmul.c create mode 100644 apps/riscv-tests/mt/aq_matmul.c create mode 100644 apps/riscv-tests/mt/ar_matmul.c create mode 100644 apps/riscv-tests/mt/at_matmul.c create mode 100644 apps/riscv-tests/mt/av_matmul.c create mode 100644 apps/riscv-tests/mt/ay_matmul.c create mode 100644 apps/riscv-tests/mt/az_matmul.c create mode 100644 apps/riscv-tests/mt/bb_matmul.c create mode 100644 apps/riscv-tests/mt/bc_matmul.c create mode 100644 apps/riscv-tests/mt/bf_matmul.c create mode 100644 apps/riscv-tests/mt/bh_matmul.c create mode 100644 apps/riscv-tests/mt/bj_matmul.c create mode 100644 apps/riscv-tests/mt/bk_matmul.c create mode 100644 apps/riscv-tests/mt/bm_matmul.c create mode 100644 apps/riscv-tests/mt/bo_matmul.c create mode 100644 apps/riscv-tests/mt/br_matmul.c create mode 100644 apps/riscv-tests/mt/bs_matmul.c create mode 100644 apps/riscv-tests/mt/ce_matmul.c create mode 100644 apps/riscv-tests/mt/cf_matmul.c create mode 100644 apps/riscv-tests/mt/cg_matmul.c create mode 100644 apps/riscv-tests/mt/ci_matmul.c create mode 100644 apps/riscv-tests/mt/ck_matmul.c create mode 100644 apps/riscv-tests/mt/cl_matmul.c create mode 100644 apps/riscv-tests/mt/cm_matmul.c create mode 100644 apps/riscv-tests/mt/cs_matmul.c create mode 100644 apps/riscv-tests/mt/cv_matmul.c create mode 100644 apps/riscv-tests/mt/cy_matmul.c create mode 100644 apps/riscv-tests/mt/dc_matmul.c create mode 100644 apps/riscv-tests/mt/df_matmul.c create mode 100644 apps/riscv-tests/mt/dm_matmul.c create mode 100644 apps/riscv-tests/mt/do_matmul.c create mode 100644 apps/riscv-tests/mt/dr_matmul.c create mode 100644 apps/riscv-tests/mt/ds_matmul.c create mode 100644 apps/riscv-tests/mt/du_matmul.c create mode 100644 apps/riscv-tests/mt/dv_matmul.c create mode 100644 apps/riscv-tests/mt/vvadd0.c create mode 100644 apps/riscv-tests/mt/vvadd1.c create mode 100644 apps/riscv-tests/mt/vvadd2.c create mode 100644 apps/riscv-tests/mt/vvadd3.c create mode 100644 apps/riscv-tests/mt/vvadd4.c diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..9a8774c --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,23 @@ +Description of PR that completes issue here... + +## Changelog + +### Fixed + +- Description of changes + +### Added + +- Description of changes + +### Changed + +- Description of changes + +## Checklist + +- [ ] Automated tests pass +- [ ] Changelog updated +- [ ] Code style guideline is observed + +Please check our [contributing guidelines](CONTRIBUTING.md) before opening a Pull Request. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9a64d12 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,751 @@ +# Copyright 2021 ETH Zurich and University of Bologna. +# Solderpad Hardware License, Version 0.51, see LICENSE for details. +# SPDX-License-Identifier: SHL-0.51 +# +# Author: Matheus Cavalcante + +# Run functional regression checks +name: ci +on: [push, pull_request] +variables: + TOOL_DIR=/usr/scratch2/tokyo/mperotti/tools/arathon/install + +# Only allow one workflow per PR/Branch (the last one) +# https://docs.github.com/en/actions/learn-github-actions/expressions +# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context +# https://docs.github.com/en/actions/using-jobs/using-concurrency +concurrency: + # github.workflow: name of the workflow + # github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + # Cancel in-progress runs when a new workflow with the same group name is triggered + cancel-in-progress: true + +jobs: + +##################### +# Toolchain stage # +##################### + + tc-llvm: + runs-on: ubuntu-22.04 + steps: + # LLVM and GCC installations require plenty of disk space + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + # - uses: actions/checkout@v4 + # - name: Recover the submodule commit hash + # id: recover_hash + # run: | + # git submodule status toolchain/riscv-llvm | cut -d' ' -f1 + # echo "tc-llvm-hash=`git submodule status toolchain/riscv-llvm | cut -d' ' -f1`" >> $GITHUB_ENV + - name: Cache the LLVM toolchain + uses: actions/cache@v4 + id: tc-llvm-cache + env: + cache-name: cache-llvm + with: + path: install/riscv-llvm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-llvm-hash }} + restore-keys: + ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-llvm-hash }} + # - name: Download the LLVM toolchain + # if: steps.tc-llvm-cache.outputs.cache-hit != 'true' + # run: git submodule update --init --recursive --checkout -- toolchain/riscv-llvm + # - name: Download Newlib + # if: steps.tc-llvm-cache.outputs.cache-hit != 'true' + # run: git submodule update --init --recursive --checkout -- toolchain/newlib + # - name: Compile LLVM + # if: steps.tc-llvm-cache.outputs.cache-hit != 'true' + # run: | + # sudo apt-get install libmpc-dev + # sudo apt-get install -y ninja-build + # CC=gcc CXX=g++ make toolchain-llvm + - name: Copy LLVM tools + run: cp -Lr ${TOOL_DIR}/riscv-llvm install + - name: Tar LLVM + run: tar -cvf tc-llvm.tar install/riscv-llvm + - name: Upload LLVM + uses: actions/upload-artifact@v4 + with: + name: tc-llvm + path: tc-llvm.tar + + tc-gcc: + runs-on: ubuntu-22.04 + steps: + # LLVM and GCC installations require plenty of disk space + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + # - uses: actions/checkout@v4 + # - name: Recover the submodule commit hash + # id: recover_hash + # run: | + # git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1 + # echo "tc-gcc-hash=`git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1`" >> $GITHUB_ENV + - name: Cache the GCC toolchain + uses: actions/cache@v4 + id: tc-gcc-cache + env: + cache-name: cache-gcc + with: + path: install/riscv-gcc + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-gcc-hash }} + restore-keys: + ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-gcc-hash }} + # - name: Download the GCC toolchain + # if: steps.tc-gcc-cache.outputs.cache-hit != 'true' + # run: git submodule update --init --recursive --checkout -- toolchain/riscv-gnu-toolchain + # - name: Compile GCC + # if: steps.tc-gcc-cache.outputs.cache-hit != 'true' + # run: | + # sudo apt-get install libmpc-dev + # CC=gcc CXX=g++ make toolchain-gcc + - name: Copy GCC tools + run: cp -Lr ${TOOL_DIR}/riscv-gcc install + - name: Tar GCC + run: tar -cvf tc-gcc.tar install/riscv-gcc + - name: Upload GCC + uses: actions/upload-artifact@v4 + with: + name: tc-gcc + path: tc-gcc.tar + + tc-isa-sim: + runs-on: ubuntu-22.04 + steps: + # - uses: actions/checkout@v4 + # - name: Recover the submodule commit hash + # id: recover_hash + # run: | + # git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1 + # echo "tc-isa-sim-hash=`git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1`" >> $GITHUB_ENV + - name: Cache Spike + uses: actions/cache@v4 + id: tc-isa-sim-cache + env: + cache-name: cache-spike + with: + path: install/riscv-isa-sim + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-isa-sim-hash }} + restore-keys: + ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-isa-sim-hash }} + # - name: Download Spike + # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' + # run: | + # git submodule update --init --recursive -- toolchain/riscv-isa-sim + # git submodule foreach --recursive git reset --hard + # - name: Compile Spike + # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' + # run: make riscv-isa-sim + - name: Copy Spike + run: cp -Lr ${TOOL_DIR}/riscv-isa-sim install + - name: Tar Spike + run: tar -cvf tc-isa-sim.tar install/riscv-isa-sim + - name: Upload Spike + uses: actions/upload-artifact@v4 + with: + name: tc-isa-sim + path: tc-isa-sim.tar + + tc-verilator: + runs-on: ubuntu-22.04 + steps: + # - uses: actions/checkout@v4 + # - name: Recover the submodule commit hash + # id: recover_hash + # run: | + # git submodule status toolchain/verilator | cut -d' ' -f1 + # echo "tc-verilator-hash=`git submodule status toolchain/verilator | cut -d' ' -f1`" >> $GITHUB_ENV + - name: Cache Verilator + uses: actions/cache@v4 + id: tc-verilator-cache + env: + cache-name: cache-verilator + with: + path: install/verilator + key: ${{ runner.os }}-build-llvm10-${{ env.cache-name }}-${{ env.tc-verilator-hash }} + restore-keys: + ${{ runner.os }}-build-llvm10-${{ env.cache-name }}-${{ env.tc-verilator-hash }} + # - name: Download Verilator + # if: steps.tc-verilator-cache.outputs.cache-hit != 'true' + # run: | + # git submodule update --init --recursive -- toolchain/verilator + # - name: Compile Verilator + # if: steps.tc-verilator-cache.outputs.cache-hit != 'true' + # run: | + # sudo apt-get install flex libfl-dev help2man + # make verilator + - name: Copy Verilator + run: cp -Lr ${TOOL_DIR}/verilator install + - name: Tar Verilator + run: tar -cvf tc-verilator.tar install/verilator + - name: Upload Verilator + uses: actions/upload-artifact@v4 + with: + name: tc-verilator + path: tc-verilator.tar + +################### +# Compile stage # +################### + + compile-apps: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + needs: tc-llvm + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.12.0 + - name: Install Python requirements + run: pip install -r python-requirements.txt + - name: Download Spike + run: | + git submodule update --init --recursive -- toolchain/riscv-isa-sim + git submodule foreach --recursive git reset --hard + - name: Download the LLVM toolchain + uses: actions/download-artifact@v4 + with: + name: tc-llvm + - name: Untar LLVM + run: tar xvf tc-llvm.tar + - name: Compile applications + run: config=${{ matrix.ara_config }} make -C apps + - name: Upload applications + uses: actions/upload-artifact@v4 + with: + name: compile-apps-${{ matrix.ara_config }} + path: apps/bin + + compile-riscv-tests: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + needs: ["tc-llvm", "tc-gcc", "tc-isa-sim"] + steps: + - uses: actions/checkout@v4 + - name: Download Spike + run: | + git submodule update --init --recursive -- toolchain/riscv-isa-sim + git submodule foreach --recursive git reset --hard + - name: Get Spike artifacts + uses: actions/download-artifact@v4 + with: + name: tc-isa-sim + - name: Untar Spike + run: tar xvf tc-isa-sim.tar + - name: Get LLVM toolchain artifacts + uses: actions/download-artifact@v4 + with: + name: tc-llvm + - name: Untar LLVM + run: tar xvf tc-llvm.tar + - name: Get GCC toolchain artifacts + uses: actions/download-artifact@v4 + with: + name: tc-gcc + - name: Untar GCC + run: tar xvf tc-gcc.tar + - name: Compile applications + run: config=${{ matrix.ara_config }} make -C apps riscv_tests + - name: Upload applications + uses: actions/upload-artifact@v4 + with: + name: compile-riscv-tests-${{ matrix.ara_config }} + path: apps/bin + + compile-ara: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + needs: ["tc-verilator", "tc-isa-sim"] + steps: + - uses: actions/checkout@v4 + - name: Download Spike + run: | + git submodule update --init --recursive -- toolchain/riscv-isa-sim + git submodule foreach --recursive git reset --hard + - name: Get Spike artifacts + uses: actions/download-artifact@v4 + with: + name: tc-isa-sim + - name: Untar Spike + run: tar xvf tc-isa-sim.tar + - name: Get Verilator artifacts + uses: actions/download-artifact@v4 + with: + name: tc-verilator + - name: Untar Verilator + run: tar xvf tc-verilator.tar + - name: Set the Verilator root directory + run: | + echo VERILATOR_ROOT="$GITHUB_WORKSPACE/install/verilator" >> $GITHUB_ENV + VERILATOR_ROOT="$GITHUB_WORKSPACE/install/verilator" + ln -s $VERILATOR_ROOT/share/verilator/include $VERILATOR_ROOT/include + ln -s $VERILATOR_ROOT/share/verilator/bin/verilator_includer $VERILATOR_ROOT/bin/verilator_includer + - name: Download RTL submodules + run: make -C hardware checkout + - name: Compile Verilated model of Ara + run: | + sudo apt-get install libelf-dev + make -C hardware apply-patches + config=${{ matrix.ara_config }} make -C hardware verilate + - name: Tar Verilated model of Ara + run: tar -cvf ara.tar hardware/build/verilator hardware/bender + - name: Upload Ara Verilated model + uses: actions/upload-artifact@v4 + with: + name: compile-ara-${{ matrix.ara_config }} + path: ara.tar + +#################### +# Simulate stage # +#################### + + simulate: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, fconv3d, jacobi2d, dropout, fft, dwt, exp, softmax, dotproduct, fdotproduct, pathfinder, roi_align, lavamd] + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + needs: ["compile-ara", "compile-apps"] + steps: + - uses: actions/checkout@v4 + - name: Get Spike artifacts + uses: actions/download-artifact@v4 + with: + name: tc-isa-sim + - name: Untar Spike + run: tar xvf tc-isa-sim.tar + - name: Get Verilated model of Ara + uses: actions/download-artifact@v4 + with: + name: compile-ara-${{ matrix.ara_config }} + - name: Untar Verilated model of Ara + run: tar xvf ara.tar + - name: Get applications + uses: actions/download-artifact@v4 + with: + name: compile-apps-${{ matrix.ara_config }} + path: apps/bin + - name: Run test + run: config=${{ matrix.ara_config }} app=${{ matrix.app }} make -C hardware simv + +######################## +# RISC-V Tests stage # +######################## + + # riscv-tests-simv: + # runs-on: ubuntu-22.04 + # strategy: + # max-parallel: 1 + # matrix: + # ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + # needs: ["compile-ara", "compile-riscv-tests"] + # steps: + # - uses: actions/checkout@v4 + # - name: Get Spike artifacts + # uses: actions/download-artifact@v4 + # with: + # name: tc-isa-sim + # - name: Untar Spike + # run: tar xvf tc-isa-sim.tar + # - name: Get Verilated model of Ara + # uses: actions/download-artifact@v4 + # with: + # name: compile-ara-${{ matrix.ara_config }} + # - name: Untar Verilated model of Ara + # run: tar xvf ara.tar + # - name: Get RISC-V tests + # uses: actions/download-artifact@v4 + # with: + # name: compile-riscv-tests-${{ matrix.ara_config }} + # path: apps/bin + # - name: Run tests + # run: config=${{ matrix.ara_config }} make -C hardware -j8 riscv_tests_simv + + # riscv-tests-spike: + # runs-on: ubuntu-22.04 + # needs: ["tc-isa-sim", "compile-riscv-tests"] + # steps: + # - uses: actions/checkout@v4 + # - name: Get Spike artifacts + # uses: actions/download-artifact@v4 + # with: + # name: tc-isa-sim + # - name: Untar Spike + # run: tar xvf tc-isa-sim.tar + # - name: Download the LLVM toolchain + # uses: actions/download-artifact@v4 + # with: + # name: tc-llvm + # - name: Untar LLVM + # run: tar xvf tc-llvm.tar + # - name: Download the GCC toolchain + # uses: actions/download-artifact@v4 + # with: + # name: tc-gcc + # - name: Untar GCC + # run: tar xvf tc-gcc.tar + # - name: Run tests + # run: | + # make -C apps/riscv-tests/isa clean + # make -C apps riscv_tests_spike + # - name: Upload dumps + # uses: actions/upload-artifact@v4 + # with: + # name: riscv-tests-spike + # path: | + # apps/riscv-tests/isa/*.dump + # apps/riscv-tests/isa/*.out32 + +################### +# Linting stage # +################### + + check-license: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.12.0 + - name: Install Python requirements + run: pip install -r python-requirements.txt + - name: Check license + run: python scripts/licence-checker.py --config scripts/licence-checker.hjson hardware + + check-clang-format: + runs-on: ubuntu-22.04 + needs: ['tc-llvm'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.12.0 + - name: Install Python requirements + run: pip install -r python-requirements.txt + - name: Download the LLVM toolchain + uses: actions/download-artifact@v4 + with: + name: tc-llvm + - name: Untar LLVM + run: tar xvf tc-llvm.tar + - name: Run clang-format + run: | + for file in `find apps -type f -name "*.[c|h|cpp|hpp]" ! -path "*rivec-bmarks*" | grep -vP "apps/riscv-tests"`; do + ./scripts/run-clang-format.py --clang-format-executable install/riscv-llvm/bin/clang-format $file || EXIT_STATUS=$? + done + for file in `find apps/riscv-tests/isa/rv64uv -type f -name "*.[c|h|cpp|hpp]"`; do + ./scripts/run-clang-format.py --clang-format-executable install/riscv-llvm/bin/clang-format $file || EXIT_STATUS=$? + done + exit $EXIT_STATUS + + check-trailing-whitespaces: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Determine base commit + run: | + if [[ -n $GITHUB_BASE_REF ]]; then + # Make sure we have the latest version of the target branch + git fetch origin $GITHUB_BASE_REF + echo "base=origin/$GITHUB_BASE_REF" >> $GITHUB_ENV + else + echo "base=HEAD~1" >> $GITHUB_ENV + fi + # Don't check the `patches` directory! Trailing whitespaces + # are mandatory there if they exist. + - name: Check for trailing whitespaces and tabs + run: | + bash -O extglob -c \ + "git diff --check $base HEAD -- \ + apps/!(rivec-bmarks) config .github *.md \ + Bender.* Makefile hardware/!(patches)" + +##################### +# Benchmark stage # +##################### + + # benchmark: + # runs-on: ubuntu-22.04 + # strategy: + # max-parallel: 1 + # matrix: + # ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + # needs: ["compile-ara", "compile-apps"] + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v4 + # with: + # python-version: 3.12.0 + # - name: Install Python requirements + # run: pip install -r python-requirements.txt + # - name: Download the LLVM toolchain + # uses: actions/download-artifact@v4 + # with: + # name: tc-llvm + # - name: Untar LLVM + # run: tar xvf tc-llvm.tar + # - name: Get Spike artifacts + # uses: actions/download-artifact@v4 + # with: + # name: tc-isa-sim + # - name: Untar Spike + # run: tar xvf tc-isa-sim.tar + # - name: Get Verilated model of Ara + # uses: actions/download-artifact@v4 + # with: + # name: compile-ara-${{ matrix.ara_config }} + # - name: Untar Verilated model of Ara + # run: tar xvf ara.tar + # - name: Benchmark Ara + # run: config=${{ matrix.ara_config }} ./scripts/benchmark.sh ci + # - name: Tar [f]dotproduct runtime results + # run: | + # tar -cvf dotproducts-${{ matrix.ara_config }}.tar *dotproduct*.benchmark + # rm *dotproduct*.benchmark + # - name: Tar runtime results + # run: | + # tar -cvf benchmarks-${{ matrix.ara_config }}.tar *.benchmark + # - name: Upload [f]dotproduct runtime results + # uses: actions/upload-artifact@v4 + # with: + # name: dotproducts-${{ matrix.ara_config }} + # path: dotproducts-${{ matrix.ara_config }}.tar + # - name: Upload runtime results + # uses: actions/upload-artifact@v4 + # with: + # name: benchmark-${{ matrix.ara_config }} + # path: benchmarks-${{ matrix.ara_config }}.tar + + # roofline: + # runs-on: ubuntu-22.04 + # needs: benchmark + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v4 + # with: + # python-version: 3.12.0 + # - name: Install Python requirements + # run: pip install -r python-requirements.txt + # - uses: actions/checkout@v4 + # - name: Get [f]dotproduct results (2 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: dotproducts-2_lanes + # - name: Get [f]dotproduct results (4 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: dotproducts-4_lanes + # - name: Get [f]dotproduct results (8 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: dotproducts-8_lanes + # - name: Get [f]dotproduct results (16 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: dotproducts-16_lanes + # - name: Get benchmark results (2 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: benchmark-2_lanes + # - name: Get benchmark results (4 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: benchmark-4_lanes + # - name: Get benchmark results (8 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: benchmark-8_lanes + # - name: Get benchmark results (16 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: benchmark-16_lanes + # - name: Untar the [f]dotproduct results + # run: | + # tar xvf dotproducts-2_lanes.tar + # tar xvf dotproducts-4_lanes.tar + # tar xvf dotproducts-8_lanes.tar + # tar xvf dotproducts-16_lanes.tar + # - name: Untar the results + # run: | + # tar xvf benchmarks-2_lanes.tar + # tar xvf benchmarks-4_lanes.tar + # tar xvf benchmarks-8_lanes.tar + # tar xvf benchmarks-16_lanes.tar + # - name: Install gnuplot + # run: | + # sudo apt-get update + # sudo apt-get install gnuplot + # - name: Plot [f]dotproduct plots + # run: | + # for kernel in fdotproduct dotproduct; do + # > ${kernel}.benchmark + # for nr_lanes in 2 4 8 16; do + # cat ${kernel}_${nr_lanes}_bar_plots.benchmark >> ${kernel}.benchmark + # done + # python scripts/process_dotp.py ${kernel} ${kernel}.benchmark ${kernel} + # tar -cvf ${kernel}.tar $(find . -name "${kernel}_*.png") + # done + # - name: Plot the rooflines + # run: gnuplot -c scripts/benchmark.gnuplot + # - name: Upload the imatmul roofline + # uses: actions/upload-artifact@v4 + # with: + # name: imatmul_roofline + # path: imatmul.png + # - name: Upload the fmatmul roofline + # uses: actions/upload-artifact@v4 + # with: + # name: fmatmul_roofline + # path: fmatmul.png + # - name: Upload the iconv2d roofline + # uses: actions/upload-artifact@v4 + # with: + # name: iconv2d_roofline + # path: iconv2d.png + # - name: Upload the fconv2d roofline + # uses: actions/upload-artifact@v4 + # with: + # name: fconv2d_roofline + # path: fconv2d.png + # - name: Upload the fconv3d roofline + # uses: actions/upload-artifact@v4 + # with: + # name: fconv3d_roofline + # path: fconv3d.png + # - name: Upload the jacobi2d roofline + # uses: actions/upload-artifact@v4 + # with: + # name: jacobi2d_roofline + # path: jacobi2d.png + # - name: Upload the dropout roofline + # uses: actions/upload-artifact@v4 + # with: + # name: dropout_roofline + # path: dropout.png + # - name: Upload the fft roofline + # uses: actions/upload-artifact@v4 + # with: + # name: fft_roofline + # path: fft.png + # - name: Upload the dwt roofline + # uses: actions/upload-artifact@v4 + # with: + # name: dwt_roofline + # path: dwt.png + # - name: Upload the exp roofline + # uses: actions/upload-artifact@v4 + # with: + # name: exp_roofline + # path: exp.png + # - name: Upload the softmax roofline + # uses: actions/upload-artifact@v4 + # with: + # name: softmax_roofline + # path: softmax.png + # - name: Upload the fdotproduct roofline + # uses: actions/upload-artifact@v4 + # with: + # name: fdotproduct_plots + # path: fdotproduct.tar + # - name: Upload the dotproduct roofline + # uses: actions/upload-artifact@v4 + # with: + # name: dotproduct_plots + # path: dotproduct.tar + # - name: Upload the pathfinder roofline + # uses: actions/upload-artifact@v4 + # with: + # name: pathfinder_roofline + # path: pathfinder.png + # - name: Upload the roi_align roofline + # uses: actions/upload-artifact@v4 + # with: + # name: roi_align_roofline + # path: roi_align.png + # - name: Upload the lavamd roofline + # uses: actions/upload-artifact@v4 + # with: + # name: lavamd_roofline + # path: lavamd.png + +#################### +# Clean-up stage # +#################### + + clean-up: + runs-on: ubuntu-22.04 + if: always() + # needs: ["simulate", "riscv-tests-spike", "riscv-tests-simv"] + needs: ["simulate"] + steps: + - uses: actions/checkout@v4 + - name: Delete artifacts + uses: geekyeggo/delete-artifact@v5 + with: + name: | + tc-llvm + tc-gcc + tc-isa-sim + tc-verilator + riscv-tests-spike + + clean-up-compile-runs: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + if: always() + # needs: ["simulate", "riscv-tests-spike", "riscv-tests-simv"] + needs: ["simulate"] + steps: + - uses: actions/checkout@v4 + - name: Delete artifacts + uses: geekyeggo/delete-artifact@v5 + with: + name: | + compile-ara-${{ matrix.ara_config }} + compile-apps-${{ matrix.ara_config }} + compile-riscv-tests-${{ matrix.ara_config }} + benchmark-${{ matrix.ara_config }} diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml new file mode 100644 index 0000000..caa1b74 --- /dev/null +++ b/.github/workflows/sphinx.yml @@ -0,0 +1,22 @@ +name: Sphinx build + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build HTML + uses: ammaraskar/sphinx-action@master + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: html-docs + path: docs/build/html/ + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html diff --git a/apps/riscv-tests/LICENSE b/apps/riscv-tests/LICENSE new file mode 100644 index 0000000..48fe522 --- /dev/null +++ b/apps/riscv-tests/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2012-2015, The Regents of the University of California (Regents). +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the Regents nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/apps/riscv-tests/Makefile.in b/apps/riscv-tests/Makefile.in new file mode 100644 index 0000000..f00c8a2 --- /dev/null +++ b/apps/riscv-tests/Makefile.in @@ -0,0 +1,45 @@ +prefix := @prefix@ +abs_top_src_dir := @abs_top_srcdir@ +XLEN := @XLEN@ +target_alias := @target_alias@ +ifeq ($(target_alias),) +RISCV_PREFIX_VAR := +else +RISCV_PREFIX_VAR := RISCV_PREFIX=@target_alias@- +endif +instbasedir := $(DESTDIR)$(prefix) +bmarkdir := $(abs_top_src_dir)/benchmarks +isa_src_dir := $(abs_top_src_dir)/isa +debug_src_dir := $(abs_top_src_dir)/debug + +all: benchmarks isa + +install: all + install -d $(instbasedir)/share/riscv-tests/isa + install -d $(instbasedir)/share/riscv-tests/benchmarks + install -p -m 644 `find isa -maxdepth 1 -type f` $(instbasedir)/share/riscv-tests/isa + install -p -m 644 `find benchmarks -maxdepth 1 -type f` $(instbasedir)/share/riscv-tests/benchmarks + +benchmarks: + mkdir -p benchmarks + $(MAKE) -C benchmarks -f $(bmarkdir)/Makefile src_dir=$(bmarkdir) XLEN=$(XLEN) $(RISCV_PREFIX_VAR) + +isa: + mkdir -p isa + $(MAKE) -C isa -f $(isa_src_dir)/Makefile src_dir=$(isa_src_dir) XLEN=$(XLEN) $(RISCV_PREFIX_VAR) + +debug-check: + mkdir -p debug + $(MAKE) -C debug -f $(debug_src_dir)/Makefile src_dir=$(debug_src_dir) XLEN=$(XLEN) + +debug-check-fast: + mkdir -p debug + $(MAKE) -C debug -f $(debug_src_dir)/Makefile src_dir=$(debug_src_dir) XLEN=$(XLEN) spike$(XLEN) + +clean: + [ ! -d isa ] || $(MAKE) -C isa -f $(isa_src_dir)/Makefile src_dir=$(isa_src_dir) clean + [ ! -d benchmarks ] || $(MAKE) -C benchmarks -f $(bmarkdir)/Makefile src_dir=$(bmarkdir) clean + [ ! -d debug ] || $(MAKE) -C debug -f $(debug_src_dir)/Makefile src_dir=$(debug_src_dir) clean + +.PHONY: benchmarks isa clean + diff --git a/apps/riscv-tests/README.md b/apps/riscv-tests/README.md new file mode 100644 index 0000000..850878a --- /dev/null +++ b/apps/riscv-tests/README.md @@ -0,0 +1,177 @@ +riscv-tests +================ + +About +----------- + +This repository hosts unit tests for RISC-V processors. + +Building from repository +----------------------------- + +We assume that the RISCV environment variable is set to the RISC-V tools +install path, and that the riscv-gnu-toolchain package is installed. + + $ git clone https://github.com/riscv/riscv-tests + $ cd riscv-tests + $ git submodule update --init --recursive + $ autoconf + $ ./configure --prefix=$RISCV/target + $ make + $ make install + +The rest of this document describes the format of test programs for the RISC-V +architecture. + +Test Virtual Machines +------------------------- + +To allow maximum reuse of a given test, each test program is constrained to +only use features of a given *test virtual machine* or TVM. A TVM hides +differences between alternative implementations by defining: + +* The set of registers and instructions that can be used. +* Which portions of memory can be accessed. +* The way the test program starts and ends execution. +* The way that test data is input. +* The way that test results are output. + +The following table shows the TVMs currently defined for RISC-V. All of these +TVMs only support a single hardware thread. + +TVM Name | Description +--- | --- +`rv32ui` | RV32 user-level, integer only +`rv32si` | RV32 supervisor-level, integer only +`rv64ui` | RV64 user-level, integer only +`rv64uf` | RV64 user-level, integer and floating-point +`rv64uv` | RV64 user-level, integer, floating-point, and vector +`rv64si` | RV64 supervisor-level, integer only +`rv64sv` | RV64 supervisor-level, integer and vector + +A test program for RISC-V is written within a single assembly language file, +which is passed through the C preprocessor, and all regular assembly +directives can be used. An example test program is shown below. Each test +program should first include the `riscv test.h` header file, which defines the +macros used by the TVM. The header file will have different contents depending +on the target environment for which the test will be built. One of the goals +of the various TVMs is to allow the same test program to be compiled and run +on very different target environments yet still produce the same results. The +following table shows the target environment currently defined. + +Target Environment Name | Description +--- | --- +`p` | virtual memory is disabled, only core 0 boots up +`pm` | virtual memory is disabled, all cores boot up +`pt` | virtual memory is disabled, timer interrupt fires every 100 cycles +`v` | virtual memory is enabled + +Each test program must next specify for which TVM it is designed by including +the appropriate TVM macro, `RVTEST_RV64U` in this example. This specification +can change the way in which subsequent macros are interpreted, and supports +a static check of the TVM functionality used by the program. + +The test program will begin execution at the first instruction after +`RVTEST_CODE_BEGIN`, and continue until execution reaches an `RVTEST_PASS` +macro or the `RVTEST_CODE_END` macro, which is implicitly a success. A test +can explicitly fail by invoking the `RVTEST_FAIL` macro. + +The example program contains self-checking code to test the result of the add. +However, self-checks rely on correct functioning of the processor instructions +used to implement the self check (e.g., the branch) and so cannot be the only +testing strategy. + +All tests should also contain a test data section, delimited by +`RVTEST_DATA_BEGIN` and `RVTEST_DATA_END`. There is no alignment guarantee for +the start of the test data section, so regular assembler alignment +instructions should be used to ensure desired alignment of data values. This +region of memory will be captured at the end of the test to act as a signature +from the test. The signature can be compared with that from a run on the +golden model. + +Any given test environment for running tests should also include a timeout +facility, which will class a test as failing if it does not successfully +complete a test within a reasonable time bound. + + #include "riscv_test.h" + + RVTEST_RV64U # Define TVM used by program. + + # Test code region. + RVTEST_CODE_BEGIN # Start of test code. + lw x2, testdata + addi x2, 1 # Should be 42 into $2. + sw x2, result # Store result into memory overwriting 1s. + li x3, 42 # Desired result. + bne x2, x3, fail # Fail out if doesn't match. + RVTEST_PASS # Signal success. + fail: + RVTEST_FAIL + RVTEST_CODE_END # End of test code. + + # Input data section. + # This section is optional, and this data is NOT saved in the output. + .data + .align 3 + testdata: + .dword 41 + + # Output data section. + RVTEST_DATA_BEGIN # Start of test output data region. + .align 3 + result: + .dword -1 + RVTEST_DATA_END # End of test output data region. + +User-Level TVMs +-------------------- + +Test programs for the `rv32u*` and `rv64u*` TVMs can contain all instructions +from the respective base user-level ISA (RV32 or RV64), except for those with +the SYSTEM major opcode (syscall, break, rdcycle, rdtime, rdinstret). All user +registers (pc, x0-x31, f0-f31, fsr) can be accessed. + +The `rv32ui` and `rv64ui` TVMs are integer-only subsets of `rv32u` and `rv64u` +respectively. These subsets can not use any floating-point instructions (major +opcodes: LOAD-FP, STORE-FP, MADD, MSUB, NMSUB, NMADD, OP-FP), and hence cannot +access the floating-point register state (f0-f31 and fsr). The integer-only +TVMs are useful for initial processor bringup and to test simpler +implementations that lack a hardware FPU. + +Note that any `rv32ui` test program is also valid for the `rv32u` TVM, and +similarly `rv64ui` is a strict subset of `rv64u`. To allow a given test to run +on the widest possible set of implementations, it is desirable to write any +given test to run on the smallest or least capable TVM possible. For example, +any simple tests of integer functionality should be written for the `rv64ui` +TVM, as the same test can then be run on RV64 implementations with or without a +hardware FPU. As another example, all tests for these base user-level TVMs will +also be valid for more advanced processors with instruction-set extensions. + +At the start of execution, the values of all registers are undefined. All +branch and jump destinations must be to labels within the test code region of +the assembler source file. The code and data sections will be relocated +differently for the various implementations of the test environment, and so +test program results shall not depend on absolute addresses of instructions or +data memory. The test build environment should support randomization of the +section relocation to provide better coverage and to ensure test signatures do +not contain absolute addresses. + +Supervisor-Level TVMs +-------------------------- + +The supervisor-level TVMs allow testing of supervisor-level state and +instructions. As with the user-level TVMs, we provide integer-only +supervisor-level TVMs indicated with a trailing `i`. + +History and Acknowledgements +--------------------------------- + +This style of test virtual machine originated with the T0 (Torrent-0) vector +microprocessor project at UC Berkeley and ICSI, begun in 1992. The main +developers of this test strategy were Krste Asanovic and David Johnson. A +precursor to `torture` was `rantor` developed by Phil Kohn at ICSI. + +A variant of this testing approach was also used for the Scale vector-thread +processor at MIT, begun in 2000. Ronny Krashinsky and Christopher Batten were +the principal architects of the Scale chip. Jeffrey Cohen and Mark Hampton +developed a version of torture capable of generating vector-thread code. diff --git a/apps/riscv-tests/benchmarks/Makefile b/apps/riscv-tests/benchmarks/Makefile new file mode 100644 index 0000000..cc32714 --- /dev/null +++ b/apps/riscv-tests/benchmarks/Makefile @@ -0,0 +1,98 @@ +#======================================================================= +# UCB VLSI FLOW: Makefile for riscv-bmarks +#----------------------------------------------------------------------- +# Yunsup Lee (yunsup@cs.berkeley.edu) +# + +XLEN ?= 64 + +default: all + +src_dir = . + +instname = riscv-bmarks +instbasedir = $(UCB_VLSI_HOME)/install + +#-------------------------------------------------------------------- +# Sources +#-------------------------------------------------------------------- + +bmarks = \ + median \ + qsort \ + rsort \ + towers \ + vvadd \ + multiply \ + mm \ + dhrystone \ + spmv \ + mt-vvadd \ + mt-matmul \ + pmp \ + +#-------------------------------------------------------------------- +# Build rules +#-------------------------------------------------------------------- + +RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf- +RISCV_GCC ?= $(RISCV_PREFIX)gcc +RISCV_GCC_OPTS ?= -DPREALLOCATE=1 -mcmodel=medany -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf +RISCV_LINK ?= $(RISCV_GCC) -T $(src_dir)/common/test.ld $(incs) +RISCV_LINK_OPTS ?= -static -nostdlib -nostartfiles -lm -lgcc -T $(src_dir)/common/test.ld +RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.text.init --section=.data +RISCV_SIM ?= spike --isa=rv$(XLEN)gc + +incs += -I$(src_dir)/../env -I$(src_dir)/common $(addprefix -I$(src_dir)/, $(bmarks)) +objs := + +define compile_template +$(1).riscv: $(wildcard $(src_dir)/$(1)/*) $(wildcard $(src_dir)/common/*) + $$(RISCV_GCC) $$(incs) $$(RISCV_GCC_OPTS) -o $$@ $(wildcard $(src_dir)/$(1)/*.c) $(wildcard $(src_dir)/common/*.c) $(wildcard $(src_dir)/common/*.S) $$(RISCV_LINK_OPTS) +endef + +$(foreach bmark,$(bmarks),$(eval $(call compile_template,$(bmark)))) + +#------------------------------------------------------------ +# Build and run benchmarks on riscv simulator + +bmarks_riscv_bin = $(addsuffix .riscv, $(bmarks)) +bmarks_riscv_dump = $(addsuffix .riscv.dump, $(bmarks)) +bmarks_riscv_out = $(addsuffix .riscv.out, $(bmarks)) + +$(bmarks_riscv_dump): %.riscv.dump: %.riscv + $(RISCV_OBJDUMP) $< > $@ + +$(bmarks_riscv_out): %.riscv.out: %.riscv + $(RISCV_SIM) $< > $@ + +riscv: $(bmarks_riscv_dump) +run: $(bmarks_riscv_out) + +junk += $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(bmarks_riscv_hex) $(bmarks_riscv_out) + +#------------------------------------------------------------ +# Default + +all: riscv + +#------------------------------------------------------------ +# Install + +date_suffix = $(shell date +%Y-%m-%d_%H-%M) +install_dir = $(instbasedir)/$(instname)-$(date_suffix) +latest_install = $(shell ls -1 -d $(instbasedir)/$(instname)* | tail -n 1) + +install: + mkdir $(install_dir) + cp -r $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(install_dir) + +install-link: + rm -rf $(instbasedir)/$(instname) + ln -s $(latest_install) $(instbasedir)/$(instname) + +#------------------------------------------------------------ +# Clean up + +clean: + rm -rf $(objs) $(junk) diff --git a/apps/riscv-tests/benchmarks/common/crt.S b/apps/riscv-tests/benchmarks/common/crt.S new file mode 100644 index 0000000..018f929 --- /dev/null +++ b/apps/riscv-tests/benchmarks/common/crt.S @@ -0,0 +1,225 @@ +# See LICENSE for license details. + +#include "encoding.h" + +#if __riscv_xlen == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + + .section ".text.init" + .globl _start +_start: + li x1, 0 + li x2, 0 + li x3, 0 + li x4, 0 + li x5, 0 + li x6, 0 + li x7, 0 + li x8, 0 + li x9, 0 + li x10,0 + li x11,0 + li x12,0 + li x13,0 + li x14,0 + li x15,0 + li x16,0 + li x17,0 + li x18,0 + li x19,0 + li x20,0 + li x21,0 + li x22,0 + li x23,0 + li x24,0 + li x25,0 + li x26,0 + li x27,0 + li x28,0 + li x29,0 + li x30,0 + li x31,0 + + # enable FPU and accelerator if present + li t0, MSTATUS_FS | MSTATUS_XS + csrs mstatus, t0 + + # make sure XLEN agrees with compilation choice + li t0, 1 + slli t0, t0, 31 +#if __riscv_xlen == 64 + bgez t0, 1f +#else + bltz t0, 1f +#endif +2: + li a0, 1 + sw a0, tohost, t0 + j 2b +1: + +#ifdef __riscv_flen + # initialize FPU if we have one + la t0, 1f + csrw mtvec, t0 + + fssr x0 + fmv.s.x f0, x0 + fmv.s.x f1, x0 + fmv.s.x f2, x0 + fmv.s.x f3, x0 + fmv.s.x f4, x0 + fmv.s.x f5, x0 + fmv.s.x f6, x0 + fmv.s.x f7, x0 + fmv.s.x f8, x0 + fmv.s.x f9, x0 + fmv.s.x f10,x0 + fmv.s.x f11,x0 + fmv.s.x f12,x0 + fmv.s.x f13,x0 + fmv.s.x f14,x0 + fmv.s.x f15,x0 + fmv.s.x f16,x0 + fmv.s.x f17,x0 + fmv.s.x f18,x0 + fmv.s.x f19,x0 + fmv.s.x f20,x0 + fmv.s.x f21,x0 + fmv.s.x f22,x0 + fmv.s.x f23,x0 + fmv.s.x f24,x0 + fmv.s.x f25,x0 + fmv.s.x f26,x0 + fmv.s.x f27,x0 + fmv.s.x f28,x0 + fmv.s.x f29,x0 + fmv.s.x f30,x0 + fmv.s.x f31,x0 +1: +#endif + + # initialize trap vector + la t0, trap_entry + csrw mtvec, t0 + + # initialize global pointer +.option push +.option norelax + la gp, __global_pointer$ +.option pop + + la tp, _end + 63 + and tp, tp, -64 + + # get core id + csrr a0, mhartid + # for now, assume only 1 core + li a1, 1 +1:bgeu a0, a1, 1b + + # give each core 128KB of stack + TLS +#define STKSHIFT 17 + add sp, a0, 1 + sll sp, sp, STKSHIFT + add sp, sp, tp + sll a2, a0, STKSHIFT + add tp, tp, a2 + + j _init + + .align 2 +trap_entry: + addi sp, sp, -272 + + SREG x1, 1*REGBYTES(sp) + SREG x2, 2*REGBYTES(sp) + SREG x3, 3*REGBYTES(sp) + SREG x4, 4*REGBYTES(sp) + SREG x5, 5*REGBYTES(sp) + SREG x6, 6*REGBYTES(sp) + SREG x7, 7*REGBYTES(sp) + SREG x8, 8*REGBYTES(sp) + SREG x9, 9*REGBYTES(sp) + SREG x10, 10*REGBYTES(sp) + SREG x11, 11*REGBYTES(sp) + SREG x12, 12*REGBYTES(sp) + SREG x13, 13*REGBYTES(sp) + SREG x14, 14*REGBYTES(sp) + SREG x15, 15*REGBYTES(sp) + SREG x16, 16*REGBYTES(sp) + SREG x17, 17*REGBYTES(sp) + SREG x18, 18*REGBYTES(sp) + SREG x19, 19*REGBYTES(sp) + SREG x20, 20*REGBYTES(sp) + SREG x21, 21*REGBYTES(sp) + SREG x22, 22*REGBYTES(sp) + SREG x23, 23*REGBYTES(sp) + SREG x24, 24*REGBYTES(sp) + SREG x25, 25*REGBYTES(sp) + SREG x26, 26*REGBYTES(sp) + SREG x27, 27*REGBYTES(sp) + SREG x28, 28*REGBYTES(sp) + SREG x29, 29*REGBYTES(sp) + SREG x30, 30*REGBYTES(sp) + SREG x31, 31*REGBYTES(sp) + + csrr a0, mcause + csrr a1, mepc + mv a2, sp + jal handle_trap + csrw mepc, a0 + + # Remain in M-mode after eret + li t0, MSTATUS_MPP + csrs mstatus, t0 + + LREG x1, 1*REGBYTES(sp) + LREG x2, 2*REGBYTES(sp) + LREG x3, 3*REGBYTES(sp) + LREG x4, 4*REGBYTES(sp) + LREG x5, 5*REGBYTES(sp) + LREG x6, 6*REGBYTES(sp) + LREG x7, 7*REGBYTES(sp) + LREG x8, 8*REGBYTES(sp) + LREG x9, 9*REGBYTES(sp) + LREG x10, 10*REGBYTES(sp) + LREG x11, 11*REGBYTES(sp) + LREG x12, 12*REGBYTES(sp) + LREG x13, 13*REGBYTES(sp) + LREG x14, 14*REGBYTES(sp) + LREG x15, 15*REGBYTES(sp) + LREG x16, 16*REGBYTES(sp) + LREG x17, 17*REGBYTES(sp) + LREG x18, 18*REGBYTES(sp) + LREG x19, 19*REGBYTES(sp) + LREG x20, 20*REGBYTES(sp) + LREG x21, 21*REGBYTES(sp) + LREG x22, 22*REGBYTES(sp) + LREG x23, 23*REGBYTES(sp) + LREG x24, 24*REGBYTES(sp) + LREG x25, 25*REGBYTES(sp) + LREG x26, 26*REGBYTES(sp) + LREG x27, 27*REGBYTES(sp) + LREG x28, 28*REGBYTES(sp) + LREG x29, 29*REGBYTES(sp) + LREG x30, 30*REGBYTES(sp) + LREG x31, 31*REGBYTES(sp) + + addi sp, sp, 272 + mret + +.section ".tohost","aw",@progbits +.align 6 +.globl tohost +tohost: .dword 0 +.align 6 +.globl fromhost +fromhost: .dword 0 diff --git a/apps/riscv-tests/benchmarks/common/syscalls.c b/apps/riscv-tests/benchmarks/common/syscalls.c new file mode 100644 index 0000000..4d20be9 --- /dev/null +++ b/apps/riscv-tests/benchmarks/common/syscalls.c @@ -0,0 +1,469 @@ +// See LICENSE for license details. + +#include +#include +#include +#include +#include +#include +#include "util.h" + +#define SYS_write 64 + +#undef strcmp + +extern volatile uint64_t tohost; +extern volatile uint64_t fromhost; + +static uintptr_t syscall(uintptr_t which, uint64_t arg0, uint64_t arg1, uint64_t arg2) +{ + volatile uint64_t magic_mem[8] __attribute__((aligned(64))); + magic_mem[0] = which; + magic_mem[1] = arg0; + magic_mem[2] = arg1; + magic_mem[3] = arg2; + __sync_synchronize(); + + tohost = (uintptr_t)magic_mem; + while (fromhost == 0) + ; + fromhost = 0; + + __sync_synchronize(); + return magic_mem[0]; +} + +#define NUM_COUNTERS 2 +static uintptr_t counters[NUM_COUNTERS]; +static char* counter_names[NUM_COUNTERS]; + +void setStats(int enable) +{ + int i = 0; +#define READ_CTR(name) do { \ + while (i >= NUM_COUNTERS) ; \ + uintptr_t csr = read_csr(name); \ + if (!enable) { csr -= counters[i]; counter_names[i] = #name; } \ + counters[i++] = csr; \ + } while (0) + + READ_CTR(mcycle); + READ_CTR(minstret); + +#undef READ_CTR +} + +void __attribute__((noreturn)) tohost_exit(uintptr_t code) +{ + tohost = (code << 1) | 1; + while (1); +} + +uintptr_t __attribute__((weak)) handle_trap(uintptr_t cause, uintptr_t epc, uintptr_t regs[32]) +{ + tohost_exit(1337); +} + +void exit(int code) +{ + tohost_exit(code); +} + +void abort() +{ + exit(128 + SIGABRT); +} + +void printstr(const char* s) +{ + syscall(SYS_write, 1, (uintptr_t)s, strlen(s)); +} + +void __attribute__((weak)) thread_entry(int cid, int nc) +{ + // multi-threaded programs override this function. + // for the case of single-threaded programs, only let core 0 proceed. + while (cid != 0); +} + +int __attribute__((weak)) main(int argc, char** argv) +{ + // single-threaded programs override this function. + printstr("Implement main(), foo!\n"); + return -1; +} + +static void init_tls() +{ + register void* thread_pointer asm("tp"); + extern char _tdata_begin, _tdata_end, _tbss_end; + size_t tdata_size = &_tdata_end - &_tdata_begin; + memcpy(thread_pointer, &_tdata_begin, tdata_size); + size_t tbss_size = &_tbss_end - &_tdata_end; + memset(thread_pointer + tdata_size, 0, tbss_size); +} + +void _init(int cid, int nc) +{ + init_tls(); + thread_entry(cid, nc); + + // only single-threaded programs should ever get here. + int ret = main(0, 0); + + char buf[NUM_COUNTERS * 32] __attribute__((aligned(64))); + char* pbuf = buf; + for (int i = 0; i < NUM_COUNTERS; i++) + if (counters[i]) + pbuf += sprintf(pbuf, "%s = %ld\n", counter_names[i], counters[i]); + if (pbuf != buf) + printstr(buf); + + exit(ret); +} + +#undef putchar +int putchar(int ch) +{ + static __thread char buf[64] __attribute__((aligned(64))); + static __thread int buflen = 0; + + buf[buflen++] = ch; + + if (ch == '\n' || buflen == sizeof(buf)) + { + syscall(SYS_write, 1, (uintptr_t)buf, buflen); + buflen = 0; + } + + return 0; +} + +void printhex(uint64_t x) +{ + char str[17]; + int i; + for (i = 0; i < 16; i++) + { + str[15-i] = (x & 0xF) + ((x & 0xF) < 10 ? '0' : 'a'-10); + x >>= 4; + } + str[16] = 0; + + printstr(str); +} + +static inline void printnum(void (*putch)(int, void**), void **putdat, + unsigned long long num, unsigned base, int width, int padc) +{ + unsigned digs[sizeof(num)*CHAR_BIT]; + int pos = 0; + + while (1) + { + digs[pos++] = num % base; + if (num < base) + break; + num /= base; + } + + while (width-- > pos) + putch(padc, putdat); + + while (pos-- > 0) + putch(digs[pos] + (digs[pos] >= 10 ? 'a' - 10 : '0'), putdat); +} + +static unsigned long long getuint(va_list *ap, int lflag) +{ + if (lflag >= 2) + return va_arg(*ap, unsigned long long); + else if (lflag) + return va_arg(*ap, unsigned long); + else + return va_arg(*ap, unsigned int); +} + +static long long getint(va_list *ap, int lflag) +{ + if (lflag >= 2) + return va_arg(*ap, long long); + else if (lflag) + return va_arg(*ap, long); + else + return va_arg(*ap, int); +} + +static void vprintfmt(void (*putch)(int, void**), void **putdat, const char *fmt, va_list ap) +{ + register const char* p; + const char* last_fmt; + register int ch, err; + unsigned long long num; + int base, lflag, width, precision, altflag; + char padc; + + while (1) { + while ((ch = *(unsigned char *) fmt) != '%') { + if (ch == '\0') + return; + fmt++; + putch(ch, putdat); + } + fmt++; + + // Process a %-escape sequence + last_fmt = fmt; + padc = ' '; + width = -1; + precision = -1; + lflag = 0; + altflag = 0; + reswitch: + switch (ch = *(unsigned char *) fmt++) { + + // flag to pad on the right + case '-': + padc = '-'; + goto reswitch; + + // flag to pad with 0's instead of spaces + case '0': + padc = '0'; + goto reswitch; + + // width field + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + for (precision = 0; ; ++fmt) { + precision = precision * 10 + ch - '0'; + ch = *fmt; + if (ch < '0' || ch > '9') + break; + } + goto process_precision; + + case '*': + precision = va_arg(ap, int); + goto process_precision; + + case '.': + if (width < 0) + width = 0; + goto reswitch; + + case '#': + altflag = 1; + goto reswitch; + + process_precision: + if (width < 0) + width = precision, precision = -1; + goto reswitch; + + // long flag (doubled for long long) + case 'l': + lflag++; + goto reswitch; + + // character + case 'c': + putch(va_arg(ap, int), putdat); + break; + + // string + case 's': + if ((p = va_arg(ap, char *)) == NULL) + p = "(null)"; + if (width > 0 && padc != '-') + for (width -= strnlen(p, precision); width > 0; width--) + putch(padc, putdat); + for (; (ch = *p) != '\0' && (precision < 0 || --precision >= 0); width--) { + putch(ch, putdat); + p++; + } + for (; width > 0; width--) + putch(' ', putdat); + break; + + // (signed) decimal + case 'd': + num = getint(&ap, lflag); + if ((long long) num < 0) { + putch('-', putdat); + num = -(long long) num; + } + base = 10; + goto signed_number; + + // unsigned decimal + case 'u': + base = 10; + goto unsigned_number; + + // (unsigned) octal + case 'o': + // should do something with padding so it's always 3 octits + base = 8; + goto unsigned_number; + + // pointer + case 'p': + static_assert(sizeof(long) == sizeof(void*)); + lflag = 1; + putch('0', putdat); + putch('x', putdat); + /* fall through to 'x' */ + + // (unsigned) hexadecimal + case 'x': + base = 16; + unsigned_number: + num = getuint(&ap, lflag); + signed_number: + printnum(putch, putdat, num, base, width, padc); + break; + + // escaped '%' character + case '%': + putch(ch, putdat); + break; + + // unrecognized escape sequence - just print it literally + default: + putch('%', putdat); + fmt = last_fmt; + break; + } + } +} + +int printf(const char* fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + + vprintfmt((void*)putchar, 0, fmt, ap); + + va_end(ap); + return 0; // incorrect return value, but who cares, anyway? +} + +void sprintf_putch(int ch, void** data) +{ + char** pstr = (char**)data; + **pstr = ch; + (*pstr)++; +} + +int sprintf(char* str, const char* fmt, ...) +{ + va_list ap; + char* str0 = str; + va_start(ap, fmt); + + vprintfmt(sprintf_putch, (void**)&str, fmt, ap); + *str = 0; + + va_end(ap); + return str - str0; +} + +void* memcpy(void* dest, const void* src, size_t len) +{ + if ((((uintptr_t)dest | (uintptr_t)src | len) & (sizeof(uintptr_t)-1)) == 0) { + const uintptr_t* s = src; + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = *s++; + } else { + const char* s = src; + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = *s++; + } + return dest; +} + +void* memset(void* dest, int byte, size_t len) +{ + if ((((uintptr_t)dest | len) & (sizeof(uintptr_t)-1)) == 0) { + uintptr_t word = byte & 0xFF; + word |= word << 8; + word |= word << 16; + word |= word << 16 << 16; + + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = word; + } else { + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = byte; + } + return dest; +} + +size_t strlen(const char *s) +{ + const char *p = s; + while (*p) + p++; + return p - s; +} + +size_t strnlen(const char *s, size_t n) +{ + const char *p = s; + while (n-- && *p) + p++; + return p - s; +} + +int strcmp(const char* s1, const char* s2) +{ + unsigned char c1, c2; + + do { + c1 = *s1++; + c2 = *s2++; + } while (c1 != 0 && c1 == c2); + + return c1 - c2; +} + +char* strcpy(char* dest, const char* src) +{ + char* d = dest; + while ((*d++ = *src++)) + ; + return dest; +} + +long atol(const char* str) +{ + long res = 0; + int sign = 0; + + while (*str == ' ') + str++; + + if (*str == '-' || *str == '+') { + sign = *str == '-'; + str++; + } + + while (*str) { + res *= 10; + res += *str++ - '0'; + } + + return sign ? -res : res; +} diff --git a/apps/riscv-tests/benchmarks/common/test.ld b/apps/riscv-tests/benchmarks/common/test.ld new file mode 100644 index 0000000..a50b017 --- /dev/null +++ b/apps/riscv-tests/benchmarks/common/test.ld @@ -0,0 +1,66 @@ +/*======================================================================*/ +/* Proxy kernel linker script */ +/*======================================================================*/ +/* This is the linker script used when building the proxy kernel. */ + +/*----------------------------------------------------------------------*/ +/* Setup */ +/*----------------------------------------------------------------------*/ + +/* The OUTPUT_ARCH command specifies the machine architecture where the + argument is one of the names used in the BFD library. More + specifically one of the entires in bfd/cpu-mips.c */ + +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +/*----------------------------------------------------------------------*/ +/* Sections */ +/*----------------------------------------------------------------------*/ + +SECTIONS +{ + + /* text: test code section */ + . = 0x80000000; + .text.init : { *(.text.init) } + + . = ALIGN(0x1000); + .tohost : { *(.tohost) } + + . = ALIGN(0x1000); + .text : { *(.text) } + + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + + /* thread-local data segment */ + .tdata : + { + _tdata_begin = .; + *(.tdata) + _tdata_end = .; + } + .tbss : + { + *(.tbss) + _tbss_end = .; + } + + /* End of uninitalized data segement */ + _end = .; +} + diff --git a/apps/riscv-tests/benchmarks/common/util.h b/apps/riscv-tests/benchmarks/common/util.h new file mode 100644 index 0000000..081cfd6 --- /dev/null +++ b/apps/riscv-tests/benchmarks/common/util.h @@ -0,0 +1,90 @@ +// See LICENSE for license details. + +#ifndef __UTIL_H +#define __UTIL_H + +extern void setStats(int enable); + +#include + +#define static_assert(cond) switch(0) { case 0: case !!(long)(cond): ; } + +static int verify(int n, const volatile int* test, const int* verify) +{ + int i; + // Unrolled for faster verification + for (i = 0; i < n/2*2; i+=2) + { + int t0 = test[i], t1 = test[i+1]; + int v0 = verify[i], v1 = verify[i+1]; + if (t0 != v0) return i+1; + if (t1 != v1) return i+2; + } + if (n % 2 != 0 && test[n-1] != verify[n-1]) + return n; + return 0; +} + +static int verifyDouble(int n, const volatile double* test, const double* verify) +{ + int i; + // Unrolled for faster verification + for (i = 0; i < n/2*2; i+=2) + { + double t0 = test[i], t1 = test[i+1]; + double v0 = verify[i], v1 = verify[i+1]; + int eq1 = t0 == v0, eq2 = t1 == v1; + if (!(eq1 & eq2)) return i+1+eq1; + } + if (n % 2 != 0 && test[n-1] != verify[n-1]) + return n; + return 0; +} + +static void __attribute__((noinline)) barrier(int ncores) +{ + static volatile int sense; + static volatile int count; + static __thread int threadsense; + + __sync_synchronize(); + + threadsense = !threadsense; + if (__sync_fetch_and_add(&count, 1) == ncores-1) + { + count = 0; + sense = threadsense; + } + else while(sense != threadsense) + ; + + __sync_synchronize(); +} + +static uint64_t lfsr(uint64_t x) +{ + uint64_t bit = (x ^ (x >> 1)) & 1; + return (x >> 1) | (bit << 62); +} + +static uintptr_t insn_len(uintptr_t pc) +{ + return (*(unsigned short*)pc & 3) ? 4 : 2; +} + +#ifdef __riscv +#include "encoding.h" +#endif + +#define stringify_1(s) #s +#define stringify(s) stringify_1(s) +#define stats(code, iter) do { \ + unsigned long _c = -read_csr(mcycle), _i = -read_csr(minstret); \ + code; \ + _c += read_csr(mcycle), _i += read_csr(minstret); \ + if (cid == 0) \ + printf("\n%s: %ld cycles, %ld.%ld cycles/iter, %ld.%ld CPI\n", \ + stringify(code), _c, _c/iter, 10*_c/iter%10, _c/_i, 10*_c/_i%10); \ + } while(0) + +#endif //__UTIL_H diff --git a/apps/riscv-tests/benchmarks/dhrystone/dhrystone.c b/apps/riscv-tests/benchmarks/dhrystone/dhrystone.c new file mode 100644 index 0000000..38e3376 --- /dev/null +++ b/apps/riscv-tests/benchmarks/dhrystone/dhrystone.c @@ -0,0 +1,185 @@ +// See LICENSE for license details. + +#pragma GCC optimize ("no-inline") + +#include "dhrystone.h" + +#ifndef REG +#define REG + /* REG becomes defined as empty */ + /* i.e. no register variables */ +#else +#undef REG +#define REG register +#endif + +extern int Int_Glob; +extern char Ch_1_Glob; + + +Proc_6 (Enum_Val_Par, Enum_Ref_Par) +/*********************************/ + /* executed once */ + /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */ + +Enumeration Enum_Val_Par; +Enumeration *Enum_Ref_Par; +{ + *Enum_Ref_Par = Enum_Val_Par; + if (! Func_3 (Enum_Val_Par)) + /* then, not executed */ + *Enum_Ref_Par = Ident_4; + switch (Enum_Val_Par) + { + case Ident_1: + *Enum_Ref_Par = Ident_1; + break; + case Ident_2: + if (Int_Glob > 100) + /* then */ + *Enum_Ref_Par = Ident_1; + else *Enum_Ref_Par = Ident_4; + break; + case Ident_3: /* executed */ + *Enum_Ref_Par = Ident_2; + break; + case Ident_4: break; + case Ident_5: + *Enum_Ref_Par = Ident_3; + break; + } /* switch */ +} /* Proc_6 */ + + +Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref) +/**********************************************/ + /* executed three times */ + /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */ + /* Int_Par_Ref becomes 7 */ + /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */ + /* Int_Par_Ref becomes 17 */ + /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */ + /* Int_Par_Ref becomes 18 */ +One_Fifty Int_1_Par_Val; +One_Fifty Int_2_Par_Val; +One_Fifty *Int_Par_Ref; +{ + One_Fifty Int_Loc; + + Int_Loc = Int_1_Par_Val + 2; + *Int_Par_Ref = Int_2_Par_Val + Int_Loc; +} /* Proc_7 */ + + +Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val) +/*********************************************************************/ + /* executed once */ + /* Int_Par_Val_1 == 3 */ + /* Int_Par_Val_2 == 7 */ +Arr_1_Dim Arr_1_Par_Ref; +Arr_2_Dim Arr_2_Par_Ref; +int Int_1_Par_Val; +int Int_2_Par_Val; +{ + REG One_Fifty Int_Index; + REG One_Fifty Int_Loc; + + Int_Loc = Int_1_Par_Val + 5; + Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val; + Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc]; + Arr_1_Par_Ref [Int_Loc+30] = Int_Loc; + for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index) + Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc; + Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1; + Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc]; + Int_Glob = 5; +} /* Proc_8 */ + + +Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val) +/*************************************************/ + /* executed three times */ + /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */ + /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */ + /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */ + +Capital_Letter Ch_1_Par_Val; +Capital_Letter Ch_2_Par_Val; +{ + Capital_Letter Ch_1_Loc; + Capital_Letter Ch_2_Loc; + + Ch_1_Loc = Ch_1_Par_Val; + Ch_2_Loc = Ch_1_Loc; + if (Ch_2_Loc != Ch_2_Par_Val) + /* then, executed */ + return (Ident_1); + else /* not executed */ + { + Ch_1_Glob = Ch_1_Loc; + return (Ident_2); + } +} /* Func_1 */ + + +Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref) +/*************************************************/ + /* executed once */ + /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */ + /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */ + +Str_30 Str_1_Par_Ref; +Str_30 Str_2_Par_Ref; +{ + REG One_Thirty Int_Loc; + Capital_Letter Ch_Loc; + + Int_Loc = 2; + while (Int_Loc <= 2) /* loop body executed once */ + if (Func_1 (Str_1_Par_Ref[Int_Loc], + Str_2_Par_Ref[Int_Loc+1]) == Ident_1) + /* then, executed */ + { + Ch_Loc = 'A'; + Int_Loc += 1; + } /* if, while */ + if (Ch_Loc >= 'W' && Ch_Loc < 'Z') + /* then, not executed */ + Int_Loc = 7; + if (Ch_Loc == 'R') + /* then, not executed */ + return (true); + else /* executed */ + { + if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0) + /* then, not executed */ + { + Int_Loc += 7; + Int_Glob = Int_Loc; + return (true); + } + else /* executed */ + return (false); + } /* if Ch_Loc */ +} /* Func_2 */ + + +Boolean Func_3 (Enum_Par_Val) +/***************************/ + /* executed once */ + /* Enum_Par_Val == Ident_3 */ +Enumeration Enum_Par_Val; +{ + Enumeration Enum_Loc; + + Enum_Loc = Enum_Par_Val; + if (Enum_Loc == Ident_3) + /* then, executed */ + return (true); + else /* not executed */ + return (false); +} /* Func_3 */ + +void debug_printf(const char* str, ...) +{ +} diff --git a/apps/riscv-tests/benchmarks/dhrystone/dhrystone.h b/apps/riscv-tests/benchmarks/dhrystone/dhrystone.h new file mode 100644 index 0000000..e350c17 --- /dev/null +++ b/apps/riscv-tests/benchmarks/dhrystone/dhrystone.h @@ -0,0 +1,477 @@ +// See LICENSE for license details. + +#ifndef _DHRYSTONE_H +#define _DHRYSTONE_H + +/****************** "DHRYSTONE" Benchmark Program ***************************/ +#define Version "C, Version 2.2" +/* File: dhry_1.c (part 2 of 3) + * Author: Reinhold P. Weicker + * Siemens Nixdorf, Paderborn/Germany + * weicker@specbench.org + * Date: May 25, 1988 + * Modified: Steven Pemberton, CWI, Amsterdam; Steven.Pemberton@cwi.nl + * Date: October, 1993; March 1995 + * Included both files into one source, that gets compiled + * in two passes. Made program auto-compiling, and auto-running, + * and generally made it much easier to use. + * + * Original Version (in Ada) published in + * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984), + * pp. 1013 - 1030, together with the statistics + * on which the distribution of statements etc. is based. + * + * In this C version, the following C library functions are used: + * - strcpy, strcmp (inside the measurement loop) + * - printf, scanf (outside the measurement loop) + * In addition, Berkeley UNIX system calls "times ()" or "time ()" + * are used for execution time measurement. For measurements + * on other systems, these calls have to be changed. + * + * Collection of Results: + * Reinhold Weicker (address see above) and + * + * Rick Richardson + * PC Research. Inc. + * 94 Apple Orchard Drive + * Tinton Falls, NJ 07724 + * Phone: (201) 389-8963 (9-17 EST) + * Usenet: ...!uunet!pcrat!rick + * + * Please send results to Rick Richardson and/or Reinhold Weicker. + * Complete information should be given on hardware and software used. + * Hardware information includes: Machine type, CPU, type and size + * of caches; for microprocessors: clock frequency, memory speed + * (number of wait states). + * Software information includes: Compiler (and runtime library) + * manufacturer and version, compilation switches, OS version. + * The Operating System version may give an indication about the compiler; + * Dhrystone itself performs no OS calls in the measurement loop. + * + * The complete output generated by the program should be mailed + * such that at least some checks for correctness can be made. + * + *************************************************************************** + * + * Defines: The following "Defines" are possible: + * -DREG (default: Not defined) + * As an approximation to what an average C programmer + * might do, causes the "register" storage class to be applied + * - for local variables, if they are used (dynamically) + * five or more times + * - for parameters if they are used (dynamically) + * six or more times + * Note that an optimal "register" strategy is + * compiler-dependent, and that "register" declarations + * do not necessarily lead to faster execution. + * -DNOSTRUCTASSIGN (default: Not defined) + * Define if the C compiler does not support + * assignment of structures. + * -DNOENUMS (default: Not defined) + * Define if the C compiler does not support + * enumeration types. + * -DTIMES (default) + * -DTIME + * The "times" function of UNIX (returning process times) + * or the "time" function (returning wallclock time) + * is used for measurement. + * For single user machines, "time ()" is adequate. For + * multi-user machines where you cannot get single-user + * access, use the "times ()" function. If you have + * neither, use a stopwatch in the dead of night. + * "printf"s are provided marking the points "Start Timer" + * and "Stop Timer". DO NOT use the UNIX "time(1)" + * command, as this will measure the total time to + * run this program, which will (erroneously) include + * the time to allocate storage (malloc) and to perform + * the initialization. + * -DHZ=nnn + * In Berkeley UNIX, the function "times" returns process + * time in 1/HZ seconds, with HZ = 60 for most systems. + * CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY + * A VALUE. + * + *************************************************************************** + * + * History: Version C/2.1 was made for two reasons: + * + * 1) There was an obvious need for a common C version of + * Dhrystone, since C is at present the most popular system + * programming language for the class of processors + * (microcomputers, minicomputers) where Dhrystone is used most. + * There should be, as far as possible, only one C version of + * Dhrystone such that results can be compared without + * restrictions. In the past, the C versions distributed + * by Rick Richardson (Version 1.1) and by Reinhold Weicker + * had small (though not significant) differences. + * + * 2) As far as it is possible without changes to the Dhrystone + * statistics, optimizing compilers should be prevented from + * removing significant statements. + * + * This C version has been developed in cooperation with + * Rick Richardson (Tinton Falls, NJ), it incorporates many + * ideas from the "Version 1.1" distributed previously by + * him over the UNIX network Usenet. + * I also thank Chaim Benedelac (National Semiconductor), + * David Ditzel (SUN), Earl Killian and John Mashey (MIPS), + * Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley) + * for their help with comments on earlier versions of the + * benchmark. + * + * Changes: In the initialization part, this version follows mostly + * Rick Richardson's version distributed via Usenet, not the + * version distributed earlier via floppy disk by Reinhold Weicker. + * As a concession to older compilers, names have been made + * unique within the first 8 characters. + * Inside the measurement loop, this version follows the + * version previously distributed by Reinhold Weicker. + * + * At several places in the benchmark, code has been added, + * but within the measurement loop only in branches that + * are not executed. The intention is that optimizing compilers + * should be prevented from moving code out of the measurement + * loop, or from removing code altogether. Since the statements + * that are executed within the measurement loop have NOT been + * changed, the numbers defining the "Dhrystone distribution" + * (distribution of statements, operand types and locality) + * still hold. Except for sophisticated optimizing compilers, + * execution times for this version should be the same as + * for previous versions. + * + * Since it has proven difficult to subtract the time for the + * measurement loop overhead in a correct way, the loop check + * has been made a part of the benchmark. This does have + * an impact - though a very minor one - on the distribution + * statistics which have been updated for this version. + * + * All changes within the measurement loop are described + * and discussed in the companion paper "Rationale for + * Dhrystone version 2". + * + * Because of the self-imposed limitation that the order and + * distribution of the executed statements should not be + * changed, there are still cases where optimizing compilers + * may not generate code for some statements. To a certain + * degree, this is unavoidable for small synthetic benchmarks. + * Users of the benchmark are advised to check code listings + * whether code is generated for all statements of Dhrystone. + * + * Version 2.1 is identical to version 2.0 distributed via + * the UNIX network Usenet in March 1988 except that it corrects + * some minor deficiencies that were found by users of version 2.0. + * The only change within the measurement loop is that a + * non-executed "else" part was added to the "if" statement in + * Func_3, and a non-executed "else" part removed from Proc_3. + * + * Version C/2.2, Steven Pemberton, October 1993 + * Functionally, identical to version 2.2; the changes are in + * how you compile and use it: + * - Everything is in one file now, but compiled in 2 passes + * - Compile (and run) by running the file through the shell: 'sh dhry.c" + * - Uses the system definition of HZ if one can be found + * - HZ must be defined, otherwise it won't compile (no defaults here) + * - The (uninteresting) output is printed to stderr (dhry2 > /dev/null) + * - The number of loops is passed as a parameter, rather than read + * (dhry2 500000) + * - If the number of loops is insufficient to get a good result, + * it repeats it with loops*10 until it is enough (rather than just + * stopping) + * - Output says which sort of clock it is using, and the HZ value + * - You can use -DREG instead of the -DREG=register of previous versions + * - Some stylistic cleanups. + * + *************************************************************************** + * + * Compilation model and measurement (IMPORTANT): + * + * The following "ground rules" apply for measurements: + * - Separate compilation + * - No procedure merging + * - Otherwise, compiler optimizations are allowed but should be indicated + * - Default results are those without register declarations + * See the companion paper "Rationale for Dhrystone Version 2" for a more + * detailed discussion of these ground rules. + * + * For 16-Bit processors (e.g. 80186, 80286), times for all compilation + * models ("small", "medium", "large" etc.) should be given if possible, + * together with a definition of these models for the compiler system used. + * + ************************************************************************** + * + * Dhrystone (C version) statistics: + * + * [Comment from the first distribution, updated for version 2. + * Note that because of language differences, the numbers are slightly + * different from the Ada version.] + * + * The following program contains statements of a high level programming + * language (here: C) in a distribution considered representative: + * + * assignments 52 (51.0 %) + * control statements 33 (32.4 %) + * procedure, function calls 17 (16.7 %) + * + * 103 statements are dynamically executed. The program is balanced with + * respect to the three aspects: + * + * - statement type + * - operand type + * - operand locality + * operand global, local, parameter, or constant. + * + * The combination of these three aspects is balanced only approximately. + * + * 1. Statement Type: + * ----------------- number + * + * V1 = V2 9 + * (incl. V1 = F(..) + * V = Constant 12 + * Assignment, 7 + * with array element + * Assignment, 6 + * with record component + * -- + * 34 34 + * + * X = Y +|-|"&&"|"|" Z 5 + * X = Y +|-|"==" Constant 6 + * X = X +|- 1 3 + * X = Y *|/ Z 2 + * X = Expression, 1 + * two operators + * X = Expression, 1 + * three operators + * -- + * 18 18 + * + * if .... 14 + * with "else" 7 + * without "else" 7 + * executed 3 + * not executed 4 + * for ... 7 | counted every time + * while ... 4 | the loop condition + * do ... while 1 | is evaluated + * switch ... 1 + * break 1 + * declaration with 1 + * initialization + * -- + * 34 34 + * + * P (...) procedure call 11 + * user procedure 10 + * library procedure 1 + * X = F (...) + * function call 6 + * user function 5 + * library function 1 + * -- + * 17 17 + * --- + * 103 + * + * The average number of parameters in procedure or function calls + * is 1.82 (not counting the function values aX * + * + * 2. Operators + * ------------ + * number approximate + * percentage + * + * Arithmetic 32 50.8 + * + * + 21 33.3 + * - 7 11.1 + * * 3 4.8 + * / (int div) 1 1.6 + * + * Comparison 27 42.8 + * + * == 9 14.3 + * /= 4 6.3 + * > 1 1.6 + * < 3 4.8 + * >= 1 1.6 + * <= 9 14.3 + * + * Logic 4 6.3 + * + * && (AND-THEN) 1 1.6 + * | (OR) 1 1.6 + * ! (NOT) 2 3.2 + * + * -- ----- + * 63 100.1 + * + * + * 3. Operand Type (counted once per operand reference): + * --------------- + * number approximate + * percentage + * + * Integer 175 72.3 % + * Character 45 18.6 % + * Pointer 12 5.0 % + * String30 6 2.5 % + * Array 2 0.8 % + * Record 2 0.8 % + * --- ------- + * 242 100.0 % + * + * When there is an access path leading to the final operand (e.g. a record + * component), only the final data type on the access path is counted. + * + * + * 4. Operand Locality: + * ------------------- + * number approximate + * percentage + * + * local variable 114 47.1 % + * global variable 22 9.1 % + * parameter 45 18.6 % + * value 23 9.5 % + * reference 22 9.1 % + * function result 6 2.5 % + * constant 55 22.7 % + * --- ------- + * 242 100.0 % + * + * The program does not compute anything meaningful, but it is syntactically + * and semantically correct. All variables have a value assigned to them + * before they are used as a source operand. + * + * There has been no explicit effort to account for the effects of a + * cache, or to balance the use of long or short displacements for code or + * data. + * + *************************************************************************** + */ + +/* Compiler and system dependent definitions: */ + +/* variables for time measurement: */ + +#ifdef TIME + +#define CLOCK_TYPE "time()" +#undef HZ +#define HZ (1) /* time() returns time in seconds */ +extern long time(); /* see library function "time" */ +#define Too_Small_Time 2 /* Measurements should last at least 2 seconds */ +#define Start_Timer() Begin_Time = time ( (long *) 0) +#define Stop_Timer() End_Time = time ( (long *) 0) + +#else + +#ifdef MSC_CLOCK /* Use Microsoft C hi-res clock */ + +#undef HZ +#undef TIMES +#include +#define HZ CLK_TCK +#define CLOCK_TYPE "MSC clock()" +extern clock_t clock(); +#define Too_Small_Time (2*HZ) +#define Start_Timer() Begin_Time = clock() +#define Stop_Timer() End_Time = clock() + +#elif defined(__riscv) + +#define HZ 1000000 +#define Too_Small_Time 1 +#define CLOCK_TYPE "rdcycle()" +#define Start_Timer() Begin_Time = read_csr(mcycle) +#define Stop_Timer() End_Time = read_csr(mcycle) + +#else + /* Use times(2) time function unless */ + /* explicitly defined otherwise */ +#define CLOCK_TYPE "times()" +#include +#include +#ifndef HZ /* Added by SP 900619 */ +#include /* If your system doesn't have this, use -DHZ=xxx */ +#else + *** You must define HZ!!! *** +#endif /* HZ */ +#ifndef PASS2 +struct tms time_info; +#endif +/*extern int times ();*/ + /* see library function "times" */ +#define Too_Small_Time (2*HZ) + /* Measurements should last at least about 2 seconds */ +#define Start_Timer() times(&time_info); Begin_Time=(long)time_info.tms_utime +#define Stop_Timer() times(&time_info); End_Time = (long)time_info.tms_utime + +#endif /* MSC_CLOCK */ +#endif /* TIME */ + + +#define Mic_secs_Per_Second 1000000 +#define NUMBER_OF_RUNS 500 /* Default number of runs */ + +#ifdef NOSTRUCTASSIGN +#define structassign(d, s) memcpy(&(d), &(s), sizeof(d)) +#else +#define structassign(d, s) d = s +#endif + +#ifdef NOENUM +#define Ident_1 0 +#define Ident_2 1 +#define Ident_3 2 +#define Ident_4 3 +#define Ident_5 4 + typedef int Enumeration; +#else + typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} + Enumeration; +#endif + /* for boolean and enumeration types in Ada, Pascal */ + +/* General definitions: */ + +#include +#include + /* for strcpy, strcmp */ + +#define Null 0 + /* Value of a Null pointer */ +#define true 1 +#define false 0 + +typedef int One_Thirty; +typedef int One_Fifty; +typedef char Capital_Letter; +typedef int Boolean; +typedef char Str_30 [31]; +typedef int Arr_1_Dim [50]; +typedef int Arr_2_Dim [50] [50]; + +typedef struct record + { + struct record *Ptr_Comp; + Enumeration Discr; + union { + struct { + Enumeration Enum_Comp; + int Int_Comp; + char Str_Comp [31]; + } var_1; + struct { + Enumeration E_Comp_2; + char Str_2_Comp [31]; + } var_2; + struct { + char Ch_1_Comp; + char Ch_2_Comp; + } var_3; + } variant; + } Rec_Type, *Rec_Pointer; + +#endif diff --git a/apps/riscv-tests/benchmarks/dhrystone/dhrystone_main.c b/apps/riscv-tests/benchmarks/dhrystone/dhrystone_main.c new file mode 100644 index 0000000..9c7bcf5 --- /dev/null +++ b/apps/riscv-tests/benchmarks/dhrystone/dhrystone_main.c @@ -0,0 +1,332 @@ +// See LICENSE for license details. + +//************************************************************************** +// Dhrystone bencmark +//-------------------------------------------------------------------------- +// +// This is the classic Dhrystone synthetic integer benchmark. +// + +#pragma GCC optimize ("no-inline") + +#include "dhrystone.h" + +void debug_printf(const char* str, ...); + +#include "util.h" + +#include + +/* Global Variables: */ + +Rec_Pointer Ptr_Glob, + Next_Ptr_Glob; +int Int_Glob; +Boolean Bool_Glob; +char Ch_1_Glob, + Ch_2_Glob; +int Arr_1_Glob [50]; +int Arr_2_Glob [50] [50]; + +Enumeration Func_1 (); + /* forward declaration necessary since Enumeration may not simply be int */ + +#ifndef REG + Boolean Reg = false; +#define REG + /* REG becomes defined as empty */ + /* i.e. no register variables */ +#else + Boolean Reg = true; +#undef REG +#define REG register +#endif + +Boolean Done; + +long Begin_Time, + End_Time, + User_Time; +long Microseconds, + Dhrystones_Per_Second; + +/* end of variables for time measurement */ + + +int main (int argc, char** argv) +/*****/ + /* main program, corresponds to procedures */ + /* Main and Proc_0 in the Ada version */ +{ + One_Fifty Int_1_Loc; + REG One_Fifty Int_2_Loc; + One_Fifty Int_3_Loc; + REG char Ch_Index; + Enumeration Enum_Loc; + Str_30 Str_1_Loc; + Str_30 Str_2_Loc; + REG int Run_Index; + REG int Number_Of_Runs; + + /* Arguments */ + Number_Of_Runs = NUMBER_OF_RUNS; + + /* Initializations */ + + Next_Ptr_Glob = (Rec_Pointer) alloca (sizeof (Rec_Type)); + Ptr_Glob = (Rec_Pointer) alloca (sizeof (Rec_Type)); + + Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; + Ptr_Glob->Discr = Ident_1; + Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; + Ptr_Glob->variant.var_1.Int_Comp = 40; + strcpy (Ptr_Glob->variant.var_1.Str_Comp, + "DHRYSTONE PROGRAM, SOME STRING"); + strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); + + Arr_2_Glob [8][7] = 10; + /* Was missing in published program. Without this statement, */ + /* Arr_2_Glob [8][7] would have an undefined value. */ + /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */ + /* overflow may occur for this array element. */ + + debug_printf("\n"); + debug_printf("Dhrystone Benchmark, Version %s\n", Version); + if (Reg) + { + debug_printf("Program compiled with 'register' attribute\n"); + } + else + { + debug_printf("Program compiled without 'register' attribute\n"); + } + debug_printf("Using %s, HZ=%d\n", CLOCK_TYPE, HZ); + debug_printf("\n"); + + Done = false; + while (!Done) { + debug_printf("Trying %d runs through Dhrystone:\n", Number_Of_Runs); + + /***************/ + /* Start timer */ + /***************/ + + setStats(1); + Start_Timer(); + + for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) + { + + Proc_5(); + Proc_4(); + /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */ + Int_1_Loc = 2; + Int_2_Loc = 3; + strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING"); + Enum_Loc = Ident_2; + Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc); + /* Bool_Glob == 1 */ + while (Int_1_Loc < Int_2_Loc) /* loop body executed once */ + { + Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc; + /* Int_3_Loc == 7 */ + Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc); + /* Int_3_Loc == 7 */ + Int_1_Loc += 1; + } /* while */ + /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ + Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc); + /* Int_Glob == 5 */ + Proc_1 (Ptr_Glob); + for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index) + /* loop body executed twice */ + { + if (Enum_Loc == Func_1 (Ch_Index, 'C')) + /* then, not executed */ + { + Proc_6 (Ident_1, &Enum_Loc); + strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING"); + Int_2_Loc = Run_Index; + Int_Glob = Run_Index; + } + } + /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ + Int_2_Loc = Int_2_Loc * Int_1_Loc; + Int_1_Loc = Int_2_Loc / Int_3_Loc; + Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; + /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */ + Proc_2 (&Int_1_Loc); + /* Int_1_Loc == 5 */ + + } /* loop "for Run_Index" */ + + /**************/ + /* Stop timer */ + /**************/ + + Stop_Timer(); + setStats(0); + + User_Time = End_Time - Begin_Time; + + if (User_Time < Too_Small_Time) + { + printf("Measured time too small to obtain meaningful results\n"); + Number_Of_Runs = Number_Of_Runs * 10; + printf("\n"); + } else Done = true; + } + + debug_printf("Final values of the variables used in the benchmark:\n"); + debug_printf("\n"); + debug_printf("Int_Glob: %d\n", Int_Glob); + debug_printf(" should be: %d\n", 5); + debug_printf("Bool_Glob: %d\n", Bool_Glob); + debug_printf(" should be: %d\n", 1); + debug_printf("Ch_1_Glob: %c\n", Ch_1_Glob); + debug_printf(" should be: %c\n", 'A'); + debug_printf("Ch_2_Glob: %c\n", Ch_2_Glob); + debug_printf(" should be: %c\n", 'B'); + debug_printf("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]); + debug_printf(" should be: %d\n", 7); + debug_printf("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]); + debug_printf(" should be: Number_Of_Runs + 10\n"); + debug_printf("Ptr_Glob->\n"); + debug_printf(" Ptr_Comp: %d\n", (long) Ptr_Glob->Ptr_Comp); + debug_printf(" should be: (implementation-dependent)\n"); + debug_printf(" Discr: %d\n", Ptr_Glob->Discr); + debug_printf(" should be: %d\n", 0); + debug_printf(" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp); + debug_printf(" should be: %d\n", 2); + debug_printf(" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp); + debug_printf(" should be: %d\n", 17); + debug_printf(" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp); + debug_printf(" should be: DHRYSTONE PROGRAM, SOME STRING\n"); + debug_printf("Next_Ptr_Glob->\n"); + debug_printf(" Ptr_Comp: %d\n", (long) Next_Ptr_Glob->Ptr_Comp); + debug_printf(" should be: (implementation-dependent), same as above\n"); + debug_printf(" Discr: %d\n", Next_Ptr_Glob->Discr); + debug_printf(" should be: %d\n", 0); + debug_printf(" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp); + debug_printf(" should be: %d\n", 1); + debug_printf(" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp); + debug_printf(" should be: %d\n", 18); + debug_printf(" Str_Comp: %s\n", + Next_Ptr_Glob->variant.var_1.Str_Comp); + debug_printf(" should be: DHRYSTONE PROGRAM, SOME STRING\n"); + debug_printf("Int_1_Loc: %d\n", Int_1_Loc); + debug_printf(" should be: %d\n", 5); + debug_printf("Int_2_Loc: %d\n", Int_2_Loc); + debug_printf(" should be: %d\n", 13); + debug_printf("Int_3_Loc: %d\n", Int_3_Loc); + debug_printf(" should be: %d\n", 7); + debug_printf("Enum_Loc: %d\n", Enum_Loc); + debug_printf(" should be: %d\n", 1); + debug_printf("Str_1_Loc: %s\n", Str_1_Loc); + debug_printf(" should be: DHRYSTONE PROGRAM, 1'ST STRING\n"); + debug_printf("Str_2_Loc: %s\n", Str_2_Loc); + debug_printf(" should be: DHRYSTONE PROGRAM, 2'ND STRING\n"); + debug_printf("\n"); + + + Microseconds = ((User_Time / Number_Of_Runs) * Mic_secs_Per_Second) / HZ; + Dhrystones_Per_Second = (HZ * Number_Of_Runs) / User_Time; + + printf("Microseconds for one run through Dhrystone: %ld\n", Microseconds); + printf("Dhrystones per Second: %ld\n", Dhrystones_Per_Second); + + return 0; +} + + +Proc_1 (Ptr_Val_Par) +/******************/ + +REG Rec_Pointer Ptr_Val_Par; + /* executed once */ +{ + REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; + /* == Ptr_Glob_Next */ + /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ + /* corresponds to "rename" in Ada, "with" in Pascal */ + + structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); + Ptr_Val_Par->variant.var_1.Int_Comp = 5; + Next_Record->variant.var_1.Int_Comp + = Ptr_Val_Par->variant.var_1.Int_Comp; + Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; + Proc_3 (&Next_Record->Ptr_Comp); + /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp + == Ptr_Glob->Ptr_Comp */ + if (Next_Record->Discr == Ident_1) + /* then, executed */ + { + Next_Record->variant.var_1.Int_Comp = 6; + Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, + &Next_Record->variant.var_1.Enum_Comp); + Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; + Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, + &Next_Record->variant.var_1.Int_Comp); + } + else /* not executed */ + structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); +} /* Proc_1 */ + + +Proc_2 (Int_Par_Ref) +/******************/ + /* executed once */ + /* *Int_Par_Ref == 1, becomes 4 */ + +One_Fifty *Int_Par_Ref; +{ + One_Fifty Int_Loc; + Enumeration Enum_Loc; + + Int_Loc = *Int_Par_Ref + 10; + do /* executed once */ + if (Ch_1_Glob == 'A') + /* then, executed */ + { + Int_Loc -= 1; + *Int_Par_Ref = Int_Loc - Int_Glob; + Enum_Loc = Ident_1; + } /* if */ + while (Enum_Loc != Ident_1); /* true */ +} /* Proc_2 */ + + +Proc_3 (Ptr_Ref_Par) +/******************/ + /* executed once */ + /* Ptr_Ref_Par becomes Ptr_Glob */ + +Rec_Pointer *Ptr_Ref_Par; + +{ + if (Ptr_Glob != Null) + /* then, executed */ + *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp; + Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp); +} /* Proc_3 */ + + +Proc_4 () /* without parameters */ +/*******/ + /* executed once */ +{ + Boolean Bool_Loc; + + Bool_Loc = Ch_1_Glob == 'A'; + Bool_Glob = Bool_Loc | Bool_Glob; + Ch_2_Glob = 'B'; +} /* Proc_4 */ + + +Proc_5 () /* without parameters */ +/*******/ + /* executed once */ +{ + Ch_1_Glob = 'A'; + Bool_Glob = false; +} /* Proc_5 */ diff --git a/apps/riscv-tests/benchmarks/median/dataset1.h b/apps/riscv-tests/benchmarks/median/dataset1.h new file mode 100644 index 0000000..b1e1491 --- /dev/null +++ b/apps/riscv-tests/benchmarks/median/dataset1.h @@ -0,0 +1,53 @@ +// See LICENSE for license details. + + +#define DATA_SIZE 400 + +int input_data[DATA_SIZE] = +{ + 41, 454, 833, 335, 564, 1, 187, 989, 749, 365, 350, 572, 132, 64, 949, 153, 584, 216, 805, 140, + 621, 210, 6, 572, 931, 339, 890, 593, 392, 898, 694, 228, 961, 12, 110, 883, 116, 750, 296, 646, + 426, 500, 314, 436, 659, 701, 774, 812, 319, 981, 678, 150, 875, 696, 376, 564, 474, 272, 938, 258, + 539, 647, 569, 509, 203, 88, 280, 703, 759, 669, 606, 375, 511, 551, 657, 936, 195, 592, 81, 569, + 267, 952, 229, 800, 337, 584, 944, 643, 902, 368, 241, 489, 913, 328, 826, 313, 933, 592, 985, 388, + 195, 543, 960, 649, 566, 979, 350, 997, 649, 814, 657, 79, 181, 208, 111, 998, 859, 629, 65, 847, + 288, 704, 349, 997, 141, 253, 905, 715, 886, 430, 264, 415, 576, 538, 979, 700, 761, 4, 241, 494, + 478, 100, 499, 864, 403, 693, 222, 416, 444, 296, 721, 285, 676, 620, 317, 78, 224, 351, 937, 540, + 288, 646, 119, 169, 615, 527, 606, 289, 389, 796, 351, 801, 455, 720, 278, 758, 367, 745, 358, 92, + 584, 989, 62, 271, 985, 853, 403, 788, 346, 531, 517, 222, 559, 461, 908, 241, 775, 358, 255, 332, + 778, 684, 598, 740, 143, 446, 33, 311, 125, 743, 941, 557, 933, 479, 799, 557, 553, 925, 431, 796, + 648, 357, 952, 891, 287, 666, 19, 514, 49, 557, 86, 870, 95, 853, 441, 440, 587, 61, 614, 678, + 382, 396, 280, 9, 808, 17, 971, 170, 819, 291, 344, 380, 450, 536, 512, 185, 965, 917, 347, 539, + 808, 983, 882, 887, 537, 54, 946, 612, 701, 951, 356, 479, 567, 151, 891, 7, 22, 641, 568, 335, + 665, 730, 423, 95, 434, 728, 158, 280, 2, 395, 84, 688, 247, 911, 49, 476, 435, 815, 792, 729, + 869, 265, 486, 127, 414, 236, 369, 214, 548, 180, 518, 6, 888, 503, 682, 596, 284, 173, 264, 643, + 499, 346, 290, 599, 897, 68, 215, 849, 731, 658, 688, 619, 251, 121, 786, 131, 555, 828, 302, 667, + 528, 433, 544, 487, 322, 753, 947, 125, 287, 626, 824, 14, 304, 10, 788, 403, 733, 106, 959, 703, + 366, 818, 722, 964, 294, 406, 975, 874, 653, 856, 748, 86, 91, 60, 378, 660, 105, 667, 102, 153, + 381, 121, 651, 98, 825, 412, 840, 236, 356, 12, 148, 423, 54, 965, 140, 216, 955, 621, 343, 361 +}; + +int verify_data[DATA_SIZE] = +{ + 0, 454, 454, 564, 335, 187, 187, 749, 749, 365, 365, 350, 132, 132, 153, 584, 216, 584, 216, 621, + 210, 210, 210, 572, 572, 890, 593, 593, 593, 694, 694, 694, 228, 110, 110, 116, 750, 296, 646, 426, + 500, 426, 436, 436, 659, 701, 774, 774, 812, 678, 678, 678, 696, 696, 564, 474, 474, 474, 272, 539, + 539, 569, 569, 509, 203, 203, 280, 703, 703, 669, 606, 511, 511, 551, 657, 657, 592, 195, 569, 267, + 569, 267, 800, 337, 584, 584, 643, 902, 643, 368, 368, 489, 489, 826, 328, 826, 592, 933, 592, 388, + 388, 543, 649, 649, 649, 566, 979, 649, 814, 657, 657, 181, 181, 181, 208, 859, 859, 629, 629, 288, + 704, 349, 704, 349, 253, 253, 715, 886, 715, 430, 415, 415, 538, 576, 700, 761, 700, 241, 241, 478, + 478, 478, 499, 499, 693, 403, 416, 416, 416, 444, 296, 676, 620, 620, 317, 224, 224, 351, 540, 540, + 540, 288, 169, 169, 527, 606, 527, 389, 389, 389, 796, 455, 720, 455, 720, 367, 745, 367, 358, 358, + 584, 584, 271, 271, 853, 853, 788, 403, 531, 517, 517, 517, 461, 559, 461, 775, 358, 358, 332, 332, + 684, 684, 684, 598, 446, 143, 311, 125, 311, 743, 743, 933, 557, 799, 557, 557, 557, 553, 796, 648, + 648, 648, 891, 891, 666, 287, 514, 49, 514, 86, 557, 95, 853, 441, 441, 441, 440, 587, 614, 614, + 396, 382, 280, 280, 17, 808, 170, 819, 291, 344, 344, 380, 450, 512, 512, 512, 917, 917, 539, 539, + 808, 882, 887, 882, 537, 537, 612, 701, 701, 701, 479, 479, 479, 567, 151, 22, 22, 568, 568, 568, + 665, 665, 423, 423, 434, 434, 280, 158, 280, 84, 395, 247, 688, 247, 476, 435, 476, 792, 792, 792, + 729, 486, 265, 414, 236, 369, 236, 369, 214, 518, 180, 518, 503, 682, 596, 596, 284, 264, 264, 499, + 499, 346, 346, 599, 599, 215, 215, 731, 731, 688, 658, 619, 251, 251, 131, 555, 555, 555, 667, 528, + 528, 528, 487, 487, 487, 753, 753, 287, 287, 626, 626, 304, 14, 304, 403, 733, 403, 733, 703, 703, + 703, 722, 818, 722, 406, 406, 874, 874, 856, 748, 748, 91, 86, 91, 378, 378, 660, 105, 153, 153, + 153, 381, 121, 651, 412, 825, 412, 356, 236, 148, 148, 148, 423, 140, 216, 216, 621, 621, 361, 0 +}; + diff --git a/apps/riscv-tests/benchmarks/median/median.c b/apps/riscv-tests/benchmarks/median/median.c new file mode 100644 index 0000000..1999185 --- /dev/null +++ b/apps/riscv-tests/benchmarks/median/median.c @@ -0,0 +1,42 @@ +// See LICENSE for license details. + +//************************************************************************** +// Median filter (c version) +//-------------------------------------------------------------------------- + +void median( int n, int input[], int results[] ) +{ + int A, B, C, i; + + // Zero the ends + results[0] = 0; + results[n-1] = 0; + + // Do the filter + for ( i = 1; i < (n-1); i++ ) { + + A = input[i-1]; + B = input[i]; + C = input[i+1]; + + if ( A < B ) { + if ( B < C ) + results[i] = B; + else if ( C < A ) + results[i] = A; + else + results[i] = C; + } + + else { + if ( A < C ) + results[i] = A; + else if ( C < B ) + results[i] = B; + else + results[i] = C; + } + + } + +} diff --git a/apps/riscv-tests/benchmarks/median/median.h b/apps/riscv-tests/benchmarks/median/median.h new file mode 100644 index 0000000..7f9791c --- /dev/null +++ b/apps/riscv-tests/benchmarks/median/median.h @@ -0,0 +1,11 @@ +// See LICENSE for license details. + +//************************************************************************** +// Median filters +//-------------------------------------------------------------------------- + +// Simple C version +void median( int n, int input[], int results[] ); + +// Simple assembly version +void median_asm( int n, int input[], int results[] ); diff --git a/apps/riscv-tests/benchmarks/median/median_gendata.pl b/apps/riscv-tests/benchmarks/median/median_gendata.pl new file mode 100755 index 0000000..373904e --- /dev/null +++ b/apps/riscv-tests/benchmarks/median/median_gendata.pl @@ -0,0 +1,140 @@ +#!/usr/bin/perl -w +#========================================================================== +# median_gendata.pl +# +# Author : Christopher Batten (cbatten@mit.edu) +# Date : May 9, 2005 +# +(our $usageMsg = <<'ENDMSG') =~ s/^\#//gm; +# +# Simple script which creates an input data set and the reference data +# for the median benchmark. +# +ENDMSG + +use strict "vars"; +use warnings; +no warnings("once"); +use Getopt::Long; + +#-------------------------------------------------------------------------- +# Command line processing +#-------------------------------------------------------------------------- + +our %opts; + +sub usage() +{ + + print "\n"; + print " Usage: median_gendata.pl [options] \n"; + print "\n"; + print " Options:\n"; + print " --help print this message\n"; + print " --size size of input data [750]\n"; + print " --seed random seed [1]\n"; + print "$usageMsg"; + + exit(); +} + +sub processCommandLine() +{ + + $opts{"help"} = 0; + $opts{"size"} = 750; + $opts{"seed"} = 1; + Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage(); + $opts{"help"} and usage(); + +} + +#-------------------------------------------------------------------------- +# Helper Functions +#-------------------------------------------------------------------------- + +sub printArray +{ + my $arrayName = $_[0]; + my $arrayRef = $_[1]; + + my $numCols = 20; + my $arrayLen = scalar(@{$arrayRef}); + + print "int ".$arrayName."[DATA_SIZE] = \n"; + print "{\n"; + + if ( $arrayLen <= $numCols ) { + print " "; + for ( my $i = 0; $i < $arrayLen; $i++ ) { + print sprintf("%3d",$arrayRef->[$i]); + if ( $i != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + else { + my $numRows = int($arrayLen/$numCols); + for ( my $j = 0; $j < $numRows; $j++ ) { + print " "; + for ( my $i = 0; $i < $numCols; $i++ ) { + my $index = $j*$numCols + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + if ( $arrayLen > ($numRows*$numCols) ) { + print " "; + for ( my $i = 0; $i < ($arrayLen-($numRows*$numCols)); $i++ ) { + my $index = $numCols*$numRows + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + } + + print "};\n\n"; +} + +#-------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------- + +sub main() +{ + + processCommandLine(); + srand($opts{"seed"}); + + my @values; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + push( @values, int(rand(999)) ); + } + + my @median; + $median[0] = 0; + $median[$opts{"size"}-1] = 0; + for ( my $i = 1; $i < $opts{"size"}-1; $i++ ) { + my @tempList = ( $values[$i-1], $values[$i], $values[$i+1] ); + my @sorted = sort { $a <=> $b } @tempList; + $median[$i] = $sorted[1]; + } + + print "\n\#define DATA_SIZE ".$opts{"size"}." \n\n"; + printArray( "input_data", \@values ); + printArray( "verify_data", \@median ); + +} + +main(); + diff --git a/apps/riscv-tests/benchmarks/median/median_main.c b/apps/riscv-tests/benchmarks/median/median_main.c new file mode 100644 index 0000000..b62ecd1 --- /dev/null +++ b/apps/riscv-tests/benchmarks/median/median_main.c @@ -0,0 +1,40 @@ +// See LICENSE for license details. + +//************************************************************************** +// Median filter bencmark +//-------------------------------------------------------------------------- +// +// This benchmark performs a 1D three element median filter. The +// input data (and reference data) should be generated using the +// median_gendata.pl perl script and dumped to a file named +// dataset1.h. + +#include "util.h" + +#include "median.h" + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#include "dataset1.h" + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ + int results_data[DATA_SIZE]; + +#if PREALLOCATE + // If needed we preallocate everything in the caches + median( DATA_SIZE, input_data, results_data ); +#endif + + // Do the filter + setStats(1); + median( DATA_SIZE, input_data, results_data ); + setStats(0); + + // Check the results + return verify( DATA_SIZE, results_data, verify_data ); +} diff --git a/apps/riscv-tests/benchmarks/mm/common.h b/apps/riscv-tests/benchmarks/mm/common.h new file mode 100644 index 0000000..01b9f3f --- /dev/null +++ b/apps/riscv-tests/benchmarks/mm/common.h @@ -0,0 +1,36 @@ +// See LICENSE for license details. + +#ifndef _MM_H +#define _MM_H + +#include +#include +#include + +#ifdef SP +typedef float t; +#define fma fmaf +#else +typedef double t; +#endif + +#define inline inline __attribute__((always_inline)) + +#define alloca_aligned(s, a) ((void*)(((uintptr_t)alloca((s)+(a)-1)+(a)-1)&~((a)-1))) + +#include "rb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void mm(size_t m, size_t n, size_t p, + t* a, size_t lda, t* b, size_t ldb, t* c, size_t ldc); + +#ifdef __cplusplus +} +#endif + +//void rb(t* a, t* b, t* c, size_t lda, size_t ldb, size_t ldc); + +#endif diff --git a/apps/riscv-tests/benchmarks/mm/gen.scala b/apps/riscv-tests/benchmarks/mm/gen.scala new file mode 100644 index 0000000..982daa8 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mm/gen.scala @@ -0,0 +1,81 @@ +import scala.sys.process._ +object MMGen { + implicit def i2s(i: Int) = i.toString + def writeFile(name: String, contents: String) = { + val f = new java.io.FileWriter(name) + f.write(contents) + f.close + } + + var indent = 0 + def spacing = " " * indent + def assign(lhs: String, rhs: String) = + spacing + lhs + " = " + rhs + ";\n" + def init(t: String, n: String, v: String) = + assign(t+" "+n, v) + def open_block(s: String = "") = { + val result = (if (s != "") spacing + s else "") + spacing + "{\n" + indent = indent + 1 + result + } + def close_block = { + indent = indent - 1 + spacing + "}\n" + } + + def ar(m: String, i: String) = m+"["+i+"]" + def r(a: String, b: String*) = (a :: b.toList).reduceLeft(_+"_"+_) + + def rb(m: Int, n: Int, p: Int) = { + var s = open_block("static inline void kloop(size_t p, t* a0, size_t lda, t* b0, size_t ldb, t* c, size_t ldc)\n") + + for (i <- 0 until m) + s += init("t*", r("c", i), "&"+ar("c", "ldc*"+i)) + for (i <- 0 until m; j <- 0 until n) + s += init("t", r("c", i, j), ar(r("c", i), j)) + + def doit(m: Int, n: Int, p: Int) = { + for (i <- 0 until m) + s += init("t*", r("a", i), "&"+ar("a", "lda*"+i)) + for (k <- 0 until p) + s += init("t*", r("b", k), "&"+ar("b", "ldb*"+k)) + for (k <- 0 until p; i <- 0 until m; j <- 0 until n) + s += assign(r("c", i, j), "fma(" + ar(r("a", i), k) + ", " + ar(r("b", k), j) + ", " + r("c", i, j) + ")") + } + + s += open_block("for (t *a = a0, *b = b0; a < a0 + p/RBK*RBK; a += RBK, b += RBK*ldb)\n") + doit(m, n, p) + s += close_block + + s += open_block("for (t *a = a0 + p/RBK*RBK, *b = b0 + p/RBK*RBK*ldb; a < a0 + p; a++, b += ldb)\n") + doit(m, n, 1) + s += close_block + + for (i <- 0 until m; j <- 0 until n) + s += assign(ar(r("c", i), j), r("c", i, j)) + s += close_block + + s + } + def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a%b) + def lcm(a: Int, b: Int): Int = a*b/gcd(a, b) + def lcm(a: Seq[Int]): Int = { + if (a.tail.isEmpty) a.head + else lcm(a.head, lcm(a.tail)) + } + def test1(m: Int, n: Int, p: Int, m1: Int, n1: Int, p1: Int) = { + val decl = "static const int RBM = "+m+", RBN = "+n+", RBK = "+p+";\n" + + "static const int CBM = "+m1+", CBN = "+n1+", CBK = "+p1+";\n" + writeFile("rb.h", decl + rb(m, n, p)) + //"make"!! + + "make run"! + + ("cp a.out " + Seq("b", m, n, p, m1, n1, p1, "run").reduce(_+"."+_))! + } + def main(args: Array[String]): Unit = { + test1(4, 5, 6, 24, 25, 24) + //for (i <- 4 to 6; j <- 4 to 6; k <- 4 to 6) + // test1(i, j, k, if (i == 5) 35 else 36, if (j == 5) 35 else 36, if (k == 5) 35 else 36) + } +} diff --git a/apps/riscv-tests/benchmarks/mm/mm.c b/apps/riscv-tests/benchmarks/mm/mm.c new file mode 100644 index 0000000..e5edd8a --- /dev/null +++ b/apps/riscv-tests/benchmarks/mm/mm.c @@ -0,0 +1,152 @@ +// See LICENSE for license details. + +#include "common.h" +#include +#include +#include +#include + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +static void mm_naive(size_t m, size_t n, size_t p, + t* a, size_t lda, t* b, size_t ldb, t* c, size_t ldc) +{ + for (size_t i = 0; i < m; i++) + { + for (size_t j = 0; j < n; j++) + { + t s0 = c[i*ldc+j], s1 = 0, s2 = 0, s3 = 0; + for (size_t k = 0; k < p/4*4; k+=4) + { + s0 = fma(a[i*lda+k+0], b[(k+0)*ldb+j], s0); + s1 = fma(a[i*lda+k+1], b[(k+1)*ldb+j], s1); + s2 = fma(a[i*lda+k+2], b[(k+2)*ldb+j], s2); + s3 = fma(a[i*lda+k+3], b[(k+3)*ldb+j], s3); + } + for (size_t k = p/4*4; k < p; k++) + s0 = fma(a[i*lda+k], b[k*ldb+j], s0); + c[i*ldc+j] = (s0 + s1) + (s2 + s3); + } + } +} + +static inline void mm_rb(size_t m, size_t n, size_t p, + t* a, size_t lda, t* b, size_t ldb, t* c, size_t ldc) +{ + size_t mb = m/RBM*RBM, nb = n/RBN*RBN; + for (size_t i = 0; i < mb; i += RBM) + { + for (size_t j = 0; j < nb; j += RBN) + kloop(p, a+i*lda, lda, b+j, ldb, c+i*ldc+j, ldc); + mm_naive(RBM, n - nb, p, a+i*lda, lda, b+nb, ldb, c+i*ldc+nb, ldc); + } + mm_naive(m - mb, n, p, a+mb*lda, lda, b, ldb, c+mb*ldc, ldc); +} + +static inline void repack(t* a, size_t lda, const t* a0, size_t lda0, size_t m, size_t p) +{ + for (size_t i = 0; i < m; i++) + { + for (size_t j = 0; j < p/8*8; j+=8) + { + t t0 = a0[i*lda0+j+0]; + t t1 = a0[i*lda0+j+1]; + t t2 = a0[i*lda0+j+2]; + t t3 = a0[i*lda0+j+3]; + t t4 = a0[i*lda0+j+4]; + t t5 = a0[i*lda0+j+5]; + t t6 = a0[i*lda0+j+6]; + t t7 = a0[i*lda0+j+7]; + a[i*lda+j+0] = t0; + a[i*lda+j+1] = t1; + a[i*lda+j+2] = t2; + a[i*lda+j+3] = t3; + a[i*lda+j+4] = t4; + a[i*lda+j+5] = t5; + a[i*lda+j+6] = t6; + a[i*lda+j+7] = t7; + } + for (size_t j = p/8*8; j < p; j++) + a[i*lda+j] = a0[i*lda0+j]; + } +} + +static void mm_cb(size_t m, size_t n, size_t p, + t* a, size_t lda, t* b, size_t ldb, t* c, size_t ldc) +{ + size_t nmb = m/CBM, nnb = n/CBN, npb = p/CBK; + size_t mb = nmb*CBM, nb = nnb*CBN, pb = npb*CBK; + //t a1[mb*pb], b1[pb*nb], c1[mb*nb]; + t* a1 = (t*)alloca_aligned(sizeof(t)*mb*pb, 8192); + t* b1 = (t*)alloca_aligned(sizeof(t)*pb*nb, 8192); + t* c1 = (t*)alloca_aligned(sizeof(t)*mb*nb, 8192); + + for (size_t i = 0; i < mb; i += CBM) + for (size_t j = 0; j < pb; j += CBK) + repack(a1 + (npb*(i/CBM) + j/CBK)*(CBM*CBK), CBK, a + i*lda + j, lda, CBM, CBK); + + for (size_t i = 0; i < pb; i += CBK) + for (size_t j = 0; j < nb; j += CBN) + repack(b1 + (nnb*(i/CBK) + j/CBN)*(CBK*CBN), CBN, b + i*ldb + j, ldb, CBK, CBN); + + for (size_t i = 0; i < mb; i += CBM) + for (size_t j = 0; j < nb; j += CBN) + repack(c1 + (nnb*(i/CBM) + j/CBN)*(CBM*CBN), CBN, c + i*ldc + j, ldc, CBM, CBN); + + for (size_t i = 0; i < mb; i += CBM) + { + for (size_t j = 0; j < nb; j += CBN) + { + for (size_t k = 0; k < pb; k += CBK) + { + mm_rb(CBM, CBN, CBK, + a1 + (npb*(i/CBM) + k/CBK)*(CBM*CBK), CBK, + b1 + (nnb*(k/CBK) + j/CBN)*(CBK*CBN), CBN, + c1 + (nnb*(i/CBM) + j/CBN)*(CBM*CBN), CBN); + } + if (pb < p) + { + mm_rb(CBM, CBN, p - pb, + a + i*lda + pb, lda, + b + pb*ldb + j, ldb, + c1 + (nnb*(i/CBM) + j/CBN)*(CBM*CBN), CBN); + } + } + if (nb < n) + { + for (size_t k = 0; k < p; k += CBK) + { + mm_rb(CBM, n - nb, MIN(p - k, CBK), + a + i*lda + k, lda, + b + k*ldb + nb, ldb, + c + i*ldc + nb, ldc); + } + } + } + if (mb < m) + { + for (size_t j = 0; j < n; j += CBN) + { + for (size_t k = 0; k < p; k += CBK) + { + mm_rb(m - mb, MIN(n - j, CBN), MIN(p - k, CBK), + a + mb*lda + k, lda, + b + k*ldb + j, ldb, + c + mb*ldc + j, ldc); + } + } + } + + for (size_t i = 0; i < mb; i += CBM) + for (size_t j = 0; j < nb; j += CBN) + repack(c + i*ldc + j, ldc, c1 + (nnb*(i/CBM) + j/CBN)*(CBM*CBN), CBN, CBM, CBN); +} + +void mm(size_t m, size_t n, size_t p, + t* a, size_t lda, t* b, size_t ldb, t* c, size_t ldc) +{ + if (__builtin_expect(m <= 2*CBM && n <= 2*CBN && p <= 2*CBK, 1)) + mm_rb(m, n, p, a, lda, b, ldb, c, ldc); + else + mm_cb(m, n, p, a, lda, b, ldb, c, ldc); +} diff --git a/apps/riscv-tests/benchmarks/mm/mm_main.c b/apps/riscv-tests/benchmarks/mm/mm_main.c new file mode 100644 index 0000000..133b5a2 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mm/mm_main.c @@ -0,0 +1,72 @@ +// See LICENSE for license details. + +#include "common.h" +#include +#include +#include +#include "util.h" + +#pragma GCC optimize ("unroll-loops") + +void thread_entry(int cid, int nc) +{ + const int R = 8; + int m, n, p; + uint64_t s = 0xdeadbeefU; + + m = CBM; + n = CBN; + p = CBK; + + t a[m*p]; + t b[p*n]; + t c[m*n]; + + for (size_t i = 0; i < m; i++) + for (size_t j = 0; j < p; j++) + a[i*p+j] = (t)(s = lfsr(s)); + for (size_t i = 0; i < p; i++) + for (size_t j = 0; j < n; j++) + b[i*n+j] = (t)(s = lfsr(s)); + memset(c, 0, m*n*sizeof(c[0])); + + size_t instret, cycles; + for (int i = 0; i < R; i++) + { + instret = -read_csr(minstret); + cycles = -read_csr(mcycle); + mm(m, n, p, a, p, b, n, c, n); + instret += read_csr(minstret); + cycles += read_csr(mcycle); + } + + asm volatile("fence"); + + printf("C%d: reg block %dx%dx%d, cache block %dx%dx%d\n", + cid, RBM, RBN, RBK, CBM, CBN, CBK); + printf("C%d: %d instructions\n", cid, (int)(instret)); + printf("C%d: %d cycles\n", cid, (int)(cycles)); + printf("C%d: %d flops\n", cid, 2*m*n*p); + printf("C%d: %d Mflops @ 1 GHz\n", cid, 2000*m*n*p/(cycles)); + +#if 1 + for (size_t i = 0; i < m; i++) + { + for (size_t j = 0; j < n; j++) + { + t s = 0; + for (size_t k = 0; k < p; k++) + s += a[i*p+k] * b[k*n+j]; + s *= R; + if (fabs(c[i*n+j]-s) > fabs(1e-6*s)) + { + printf("C%d: c[%lu][%lu] %f != %f\n", cid, i, j, c[i*n+j], s); + exit(1); + } + } + } +#endif + + barrier(nc); + exit(0); +} diff --git a/apps/riscv-tests/benchmarks/mm/rb.h b/apps/riscv-tests/benchmarks/mm/rb.h new file mode 100644 index 0000000..421c964 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mm/rb.h @@ -0,0 +1,210 @@ +static const int RBM = 4, RBN = 5, RBK = 6; +static const int CBM = 24, CBN = 25, CBK = 24; +static inline void kloop(size_t p, t* a0, size_t lda, t* b0, size_t ldb, t* c, size_t ldc) +{ + t* c_0 = &c[ldc*0]; + t* c_1 = &c[ldc*1]; + t* c_2 = &c[ldc*2]; + t* c_3 = &c[ldc*3]; + t c_0_0 = c_0[0]; + t c_0_1 = c_0[1]; + t c_0_2 = c_0[2]; + t c_0_3 = c_0[3]; + t c_0_4 = c_0[4]; + t c_1_0 = c_1[0]; + t c_1_1 = c_1[1]; + t c_1_2 = c_1[2]; + t c_1_3 = c_1[3]; + t c_1_4 = c_1[4]; + t c_2_0 = c_2[0]; + t c_2_1 = c_2[1]; + t c_2_2 = c_2[2]; + t c_2_3 = c_2[3]; + t c_2_4 = c_2[4]; + t c_3_0 = c_3[0]; + t c_3_1 = c_3[1]; + t c_3_2 = c_3[2]; + t c_3_3 = c_3[3]; + t c_3_4 = c_3[4]; + for (t *a = a0, *b = b0; a < a0 + p/RBK*RBK; a += RBK, b += RBK*ldb) + { + t* a_0 = &a[lda*0]; + t* a_1 = &a[lda*1]; + t* a_2 = &a[lda*2]; + t* a_3 = &a[lda*3]; + t* b_0 = &b[ldb*0]; + t* b_1 = &b[ldb*1]; + t* b_2 = &b[ldb*2]; + t* b_3 = &b[ldb*3]; + t* b_4 = &b[ldb*4]; + t* b_5 = &b[ldb*5]; + c_0_0 = fma(a_0[0], b_0[0], c_0_0); + c_0_1 = fma(a_0[0], b_0[1], c_0_1); + c_0_2 = fma(a_0[0], b_0[2], c_0_2); + c_0_3 = fma(a_0[0], b_0[3], c_0_3); + c_0_4 = fma(a_0[0], b_0[4], c_0_4); + c_1_0 = fma(a_1[0], b_0[0], c_1_0); + c_1_1 = fma(a_1[0], b_0[1], c_1_1); + c_1_2 = fma(a_1[0], b_0[2], c_1_2); + c_1_3 = fma(a_1[0], b_0[3], c_1_3); + c_1_4 = fma(a_1[0], b_0[4], c_1_4); + c_2_0 = fma(a_2[0], b_0[0], c_2_0); + c_2_1 = fma(a_2[0], b_0[1], c_2_1); + c_2_2 = fma(a_2[0], b_0[2], c_2_2); + c_2_3 = fma(a_2[0], b_0[3], c_2_3); + c_2_4 = fma(a_2[0], b_0[4], c_2_4); + c_3_0 = fma(a_3[0], b_0[0], c_3_0); + c_3_1 = fma(a_3[0], b_0[1], c_3_1); + c_3_2 = fma(a_3[0], b_0[2], c_3_2); + c_3_3 = fma(a_3[0], b_0[3], c_3_3); + c_3_4 = fma(a_3[0], b_0[4], c_3_4); + c_0_0 = fma(a_0[1], b_1[0], c_0_0); + c_0_1 = fma(a_0[1], b_1[1], c_0_1); + c_0_2 = fma(a_0[1], b_1[2], c_0_2); + c_0_3 = fma(a_0[1], b_1[3], c_0_3); + c_0_4 = fma(a_0[1], b_1[4], c_0_4); + c_1_0 = fma(a_1[1], b_1[0], c_1_0); + c_1_1 = fma(a_1[1], b_1[1], c_1_1); + c_1_2 = fma(a_1[1], b_1[2], c_1_2); + c_1_3 = fma(a_1[1], b_1[3], c_1_3); + c_1_4 = fma(a_1[1], b_1[4], c_1_4); + c_2_0 = fma(a_2[1], b_1[0], c_2_0); + c_2_1 = fma(a_2[1], b_1[1], c_2_1); + c_2_2 = fma(a_2[1], b_1[2], c_2_2); + c_2_3 = fma(a_2[1], b_1[3], c_2_3); + c_2_4 = fma(a_2[1], b_1[4], c_2_4); + c_3_0 = fma(a_3[1], b_1[0], c_3_0); + c_3_1 = fma(a_3[1], b_1[1], c_3_1); + c_3_2 = fma(a_3[1], b_1[2], c_3_2); + c_3_3 = fma(a_3[1], b_1[3], c_3_3); + c_3_4 = fma(a_3[1], b_1[4], c_3_4); + c_0_0 = fma(a_0[2], b_2[0], c_0_0); + c_0_1 = fma(a_0[2], b_2[1], c_0_1); + c_0_2 = fma(a_0[2], b_2[2], c_0_2); + c_0_3 = fma(a_0[2], b_2[3], c_0_3); + c_0_4 = fma(a_0[2], b_2[4], c_0_4); + c_1_0 = fma(a_1[2], b_2[0], c_1_0); + c_1_1 = fma(a_1[2], b_2[1], c_1_1); + c_1_2 = fma(a_1[2], b_2[2], c_1_2); + c_1_3 = fma(a_1[2], b_2[3], c_1_3); + c_1_4 = fma(a_1[2], b_2[4], c_1_4); + c_2_0 = fma(a_2[2], b_2[0], c_2_0); + c_2_1 = fma(a_2[2], b_2[1], c_2_1); + c_2_2 = fma(a_2[2], b_2[2], c_2_2); + c_2_3 = fma(a_2[2], b_2[3], c_2_3); + c_2_4 = fma(a_2[2], b_2[4], c_2_4); + c_3_0 = fma(a_3[2], b_2[0], c_3_0); + c_3_1 = fma(a_3[2], b_2[1], c_3_1); + c_3_2 = fma(a_3[2], b_2[2], c_3_2); + c_3_3 = fma(a_3[2], b_2[3], c_3_3); + c_3_4 = fma(a_3[2], b_2[4], c_3_4); + c_0_0 = fma(a_0[3], b_3[0], c_0_0); + c_0_1 = fma(a_0[3], b_3[1], c_0_1); + c_0_2 = fma(a_0[3], b_3[2], c_0_2); + c_0_3 = fma(a_0[3], b_3[3], c_0_3); + c_0_4 = fma(a_0[3], b_3[4], c_0_4); + c_1_0 = fma(a_1[3], b_3[0], c_1_0); + c_1_1 = fma(a_1[3], b_3[1], c_1_1); + c_1_2 = fma(a_1[3], b_3[2], c_1_2); + c_1_3 = fma(a_1[3], b_3[3], c_1_3); + c_1_4 = fma(a_1[3], b_3[4], c_1_4); + c_2_0 = fma(a_2[3], b_3[0], c_2_0); + c_2_1 = fma(a_2[3], b_3[1], c_2_1); + c_2_2 = fma(a_2[3], b_3[2], c_2_2); + c_2_3 = fma(a_2[3], b_3[3], c_2_3); + c_2_4 = fma(a_2[3], b_3[4], c_2_4); + c_3_0 = fma(a_3[3], b_3[0], c_3_0); + c_3_1 = fma(a_3[3], b_3[1], c_3_1); + c_3_2 = fma(a_3[3], b_3[2], c_3_2); + c_3_3 = fma(a_3[3], b_3[3], c_3_3); + c_3_4 = fma(a_3[3], b_3[4], c_3_4); + c_0_0 = fma(a_0[4], b_4[0], c_0_0); + c_0_1 = fma(a_0[4], b_4[1], c_0_1); + c_0_2 = fma(a_0[4], b_4[2], c_0_2); + c_0_3 = fma(a_0[4], b_4[3], c_0_3); + c_0_4 = fma(a_0[4], b_4[4], c_0_4); + c_1_0 = fma(a_1[4], b_4[0], c_1_0); + c_1_1 = fma(a_1[4], b_4[1], c_1_1); + c_1_2 = fma(a_1[4], b_4[2], c_1_2); + c_1_3 = fma(a_1[4], b_4[3], c_1_3); + c_1_4 = fma(a_1[4], b_4[4], c_1_4); + c_2_0 = fma(a_2[4], b_4[0], c_2_0); + c_2_1 = fma(a_2[4], b_4[1], c_2_1); + c_2_2 = fma(a_2[4], b_4[2], c_2_2); + c_2_3 = fma(a_2[4], b_4[3], c_2_3); + c_2_4 = fma(a_2[4], b_4[4], c_2_4); + c_3_0 = fma(a_3[4], b_4[0], c_3_0); + c_3_1 = fma(a_3[4], b_4[1], c_3_1); + c_3_2 = fma(a_3[4], b_4[2], c_3_2); + c_3_3 = fma(a_3[4], b_4[3], c_3_3); + c_3_4 = fma(a_3[4], b_4[4], c_3_4); + c_0_0 = fma(a_0[5], b_5[0], c_0_0); + c_0_1 = fma(a_0[5], b_5[1], c_0_1); + c_0_2 = fma(a_0[5], b_5[2], c_0_2); + c_0_3 = fma(a_0[5], b_5[3], c_0_3); + c_0_4 = fma(a_0[5], b_5[4], c_0_4); + c_1_0 = fma(a_1[5], b_5[0], c_1_0); + c_1_1 = fma(a_1[5], b_5[1], c_1_1); + c_1_2 = fma(a_1[5], b_5[2], c_1_2); + c_1_3 = fma(a_1[5], b_5[3], c_1_3); + c_1_4 = fma(a_1[5], b_5[4], c_1_4); + c_2_0 = fma(a_2[5], b_5[0], c_2_0); + c_2_1 = fma(a_2[5], b_5[1], c_2_1); + c_2_2 = fma(a_2[5], b_5[2], c_2_2); + c_2_3 = fma(a_2[5], b_5[3], c_2_3); + c_2_4 = fma(a_2[5], b_5[4], c_2_4); + c_3_0 = fma(a_3[5], b_5[0], c_3_0); + c_3_1 = fma(a_3[5], b_5[1], c_3_1); + c_3_2 = fma(a_3[5], b_5[2], c_3_2); + c_3_3 = fma(a_3[5], b_5[3], c_3_3); + c_3_4 = fma(a_3[5], b_5[4], c_3_4); + } + for (t *a = a0 + p/RBK*RBK, *b = b0 + p/RBK*RBK*ldb; a < a0 + p; a++, b += ldb) + { + t* a_0 = &a[lda*0]; + t* a_1 = &a[lda*1]; + t* a_2 = &a[lda*2]; + t* a_3 = &a[lda*3]; + t* b_0 = &b[ldb*0]; + c_0_0 = fma(a_0[0], b_0[0], c_0_0); + c_0_1 = fma(a_0[0], b_0[1], c_0_1); + c_0_2 = fma(a_0[0], b_0[2], c_0_2); + c_0_3 = fma(a_0[0], b_0[3], c_0_3); + c_0_4 = fma(a_0[0], b_0[4], c_0_4); + c_1_0 = fma(a_1[0], b_0[0], c_1_0); + c_1_1 = fma(a_1[0], b_0[1], c_1_1); + c_1_2 = fma(a_1[0], b_0[2], c_1_2); + c_1_3 = fma(a_1[0], b_0[3], c_1_3); + c_1_4 = fma(a_1[0], b_0[4], c_1_4); + c_2_0 = fma(a_2[0], b_0[0], c_2_0); + c_2_1 = fma(a_2[0], b_0[1], c_2_1); + c_2_2 = fma(a_2[0], b_0[2], c_2_2); + c_2_3 = fma(a_2[0], b_0[3], c_2_3); + c_2_4 = fma(a_2[0], b_0[4], c_2_4); + c_3_0 = fma(a_3[0], b_0[0], c_3_0); + c_3_1 = fma(a_3[0], b_0[1], c_3_1); + c_3_2 = fma(a_3[0], b_0[2], c_3_2); + c_3_3 = fma(a_3[0], b_0[3], c_3_3); + c_3_4 = fma(a_3[0], b_0[4], c_3_4); + } + c_0[0] = c_0_0; + c_0[1] = c_0_1; + c_0[2] = c_0_2; + c_0[3] = c_0_3; + c_0[4] = c_0_4; + c_1[0] = c_1_0; + c_1[1] = c_1_1; + c_1[2] = c_1_2; + c_1[3] = c_1_3; + c_1[4] = c_1_4; + c_2[0] = c_2_0; + c_2[1] = c_2_1; + c_2[2] = c_2_2; + c_2[3] = c_2_3; + c_2[4] = c_2_4; + c_3[0] = c_3_0; + c_3[1] = c_3_1; + c_3[2] = c_3_2; + c_3[3] = c_3_3; + c_3[4] = c_3_4; +} diff --git a/apps/riscv-tests/benchmarks/mt-matmul/dataset.h b/apps/riscv-tests/benchmarks/mt-matmul/dataset.h new file mode 100644 index 0000000..72fbc28 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-matmul/dataset.h @@ -0,0 +1,63 @@ +// See LICENSE for license details. + +#ifndef __DATASET_H +#define __DATASET_H +#define ARRAY_SIZE 256 + + +#define DIM_SIZE 16 + + +typedef int data_t;static data_t input1_data[ARRAY_SIZE] = +{ + 0, 3, 2, 0, 3, 1, 0, 3, 2, 3, 2, 0, 3, 3, 1, 2, 3, 0, 0, 1, + 1, 1, 2, 3, 1, 2, 3, 1, 1, 3, 2, 2, 0, 1, 3, 2, 2, 2, 0, 0, + 1, 0, 1, 3, 3, 0, 3, 3, 3, 3, 0, 3, 2, 1, 2, 2, 0, 0, 3, 0, + 1, 1, 0, 3, 3, 1, 2, 3, 3, 0, 1, 2, 1, 0, 1, 2, 2, 1, 0, 3, + 1, 0, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 3, 1, 1, 2, 2, 3, 3, 1, + 3, 2, 0, 0, 0, 3, 3, 3, 2, 1, 2, 3, 1, 0, 0, 0, 0, 1, 2, 2, + 1, 1, 3, 3, 3, 1, 1, 2, 3, 1, 3, 3, 2, 3, 2, 1, 2, 3, 0, 2, + 2, 1, 1, 0, 0, 0, 0, 0, 1, 3, 3, 1, 1, 1, 2, 2, 3, 2, 1, 1, + 1, 1, 3, 0, 2, 2, 1, 3, 2, 1, 2, 2, 1, 3, 1, 3, 1, 3, 2, 3, + 1, 2, 1, 3, 2, 2, 0, 1, 0, 0, 1, 2, 3, 3, 1, 0, 0, 0, 3, 1, + 2, 3, 2, 3, 2, 0, 0, 0, 0, 0, 3, 1, 3, 0, 0, 0, 3, 1, 1, 1, + 1, 2, 1, 2, 3, 2, 0, 0, 2, 2, 3, 0, 3, 0, 0, 3, 0, 3, 1, 3, + 3, 1, 1, 1, 2, 2, 1, 3, 0, 3, 3, 1, 0, 0, 3, 2 +}; + +static data_t input2_data[ARRAY_SIZE] = +{ + 1, 1, 0, 3, 1, 2, 0, 0, 0, 0, 0, 2, 1, 2, 3, 0, 0, 3, 3, 2, + 2, 1, 2, 3, 3, 0, 2, 2, 1, 1, 2, 2, 0, 2, 2, 1, 2, 3, 2, 2, + 3, 3, 2, 2, 1, 1, 1, 1, 2, 1, 2, 2, 3, 3, 3, 0, 0, 3, 2, 3, + 2, 3, 1, 2, 1, 1, 2, 2, 0, 1, 0, 3, 2, 1, 1, 1, 2, 0, 1, 2, + 2, 0, 2, 1, 3, 3, 2, 3, 2, 0, 3, 1, 3, 3, 2, 0, 1, 0, 1, 1, + 2, 2, 1, 1, 2, 2, 1, 2, 3, 3, 1, 3, 2, 2, 2, 3, 3, 1, 0, 2, + 1, 0, 0, 0, 1, 1, 2, 0, 3, 2, 3, 3, 0, 2, 3, 1, 0, 0, 2, 1, + 2, 0, 2, 1, 1, 2, 3, 1, 3, 2, 1, 0, 0, 0, 0, 0, 2, 2, 0, 2, + 1, 2, 0, 3, 2, 2, 0, 0, 3, 2, 1, 1, 3, 0, 2, 0, 0, 1, 0, 2, + 3, 3, 1, 3, 3, 0, 0, 2, 2, 0, 0, 0, 1, 0, 0, 1, 3, 0, 2, 1, + 3, 2, 2, 1, 3, 2, 0, 1, 2, 2, 3, 2, 1, 1, 1, 1, 3, 0, 1, 3, + 2, 2, 3, 1, 1, 2, 0, 2, 1, 1, 2, 3, 1, 0, 1, 0, 1, 1, 0, 0, + 2, 0, 3, 0, 3, 0, 3, 2, 2, 3, 3, 2, 1, 0, 2, 2 +}; + +static data_t verify_data[ARRAY_SIZE] = +{ + 36, 44, 57, 50, 54, 36, 38, 46, 55, 25, 38, 34, 51, 30, 40, 32, 37, 34, 38, 52, + 51, 40, 28, 32, 41, 22, 26, 35, 49, 35, 42, 23, 26, 26, 33, 36, 52, 40, 45, 49, + 50, 34, 41, 35, 44, 25, 23, 23, 31, 29, 39, 46, 50, 36, 31, 32, 42, 32, 34, 41, + 44, 33, 43, 30, 31, 28, 39, 46, 50, 40, 35, 37, 43, 35, 33, 43, 43, 29, 37, 29, + 27, 22, 30, 33, 43, 31, 32, 25, 36, 31, 31, 29, 40, 28, 26, 22, 29, 42, 48, 51, + 65, 52, 43, 54, 63, 34, 42, 44, 56, 33, 38, 32, 26, 22, 23, 38, 49, 32, 26, 30, + 43, 22, 24, 27, 45, 24, 26, 17, 35, 35, 47, 51, 59, 59, 43, 42, 43, 28, 37, 43, + 56, 48, 36, 32, 28, 19, 28, 34, 46, 34, 28, 34, 45, 20, 29, 28, 50, 32, 26, 21, + 37, 38, 51, 50, 55, 45, 38, 49, 56, 28, 38, 40, 50, 29, 44, 26, 32, 35, 50, 43, + 53, 44, 41, 41, 34, 24, 35, 34, 39, 33, 34, 29, 21, 33, 31, 45, 48, 42, 27, 29, + 40, 17, 21, 32, 45, 30, 29, 26, 26, 27, 38, 33, 29, 31, 32, 31, 35, 25, 29, 29, + 34, 15, 25, 23, 34, 28, 44, 45, 41, 41, 37, 45, 45, 17, 34, 44, 46, 30, 43, 29, + 31, 36, 37, 50, 54, 44, 28, 40, 38, 22, 27, 28, 45, 32, 36, 22 +}; + + +#endif //__DATASET_H \ No newline at end of file diff --git a/apps/riscv-tests/benchmarks/mt-matmul/matmul.c b/apps/riscv-tests/benchmarks/mt-matmul/matmul.c new file mode 100644 index 0000000..6d7b978 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-matmul/matmul.c @@ -0,0 +1,23 @@ +// See LICENSE for license details. + +#include "dataset.h" +#include "util.h" +#include + +#pragma GCC optimize ("unroll-loops") + +void matmul(const size_t coreid, const size_t ncores, const size_t lda, const data_t A[], const data_t B[], data_t C[]) +{ + size_t i, j, k; + size_t block = lda / ncores; + size_t start = block * coreid; + + for (i = 0; i < lda; i++) { + for (j = start; j < (start+block); j++) { + data_t sum = 0; + for (k = 0; k < lda; k++) + sum += A[j*lda + k] * B[k*lda + i]; + C[i + j*lda] = sum; + } + } +} diff --git a/apps/riscv-tests/benchmarks/mt-matmul/matmul_gendata.pl b/apps/riscv-tests/benchmarks/mt-matmul/matmul_gendata.pl new file mode 100755 index 0000000..798d992 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-matmul/matmul_gendata.pl @@ -0,0 +1,205 @@ +#!/usr/bin/perl -w +#========================================================================== +# matmul_gendata.pl +# +# Author : Christopher Batten (cbatten@mit.edu) +# Date : April 29, 2005 +# +(our $usageMsg = <<'ENDMSG') =~ s/^\#//gm; +# +# Simple script which creates an input data set and the reference data +# for the matmul benchmark. +# +ENDMSG + +use strict "vars"; +use warnings; +no warnings("once"); +use Getopt::Long; + +#-------------------------------------------------------------------------- +# Command line processing +#-------------------------------------------------------------------------- + +our %opts; + +sub usage() +{ + + print "\n"; + print " Usage: matmul_gendata.pl [options] \n"; + print "\n"; + print " Options:\n"; + print " --help print this message\n"; + print " --size size of input data [1000]\n"; + print " --seed random seed [1]\n"; + print "$usageMsg"; + + exit(); +} + +sub processCommandLine() +{ + + $opts{"help"} = 0; + $opts{"size"} = 1000; + $opts{"seed"} = 1; + Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage(); + $opts{"help"} and usage(); + +} + +#-------------------------------------------------------------------------- +# Helper Functions +#-------------------------------------------------------------------------- + +sub printArray +{ + my $arrayName = $_[0]; + my $arrayRef = $_[1]; + + my $numCols = 20; + my $arrayLen = scalar(@{$arrayRef}); + + print "static data_t ".$arrayName."[ARRAY_SIZE] = \n"; + print "{\n"; + + if ( $arrayLen <= $numCols ) { + print " "; + for ( my $i = 0; $i < $arrayLen; $i++ ) { + print sprintf("%3d",$arrayRef->[$i]); + if ( $i != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + else { + my $numRows = int($arrayLen/$numCols); + for ( my $j = 0; $j < $numRows; $j++ ) { + print " "; + for ( my $i = 0; $i < $numCols; $i++ ) { + my $index = $j*$numCols + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + if ( $arrayLen > ($numRows*$numCols) ) { + print " "; + for ( my $i = 0; $i < ($arrayLen-($numRows*$numCols)); $i++ ) { + my $index = $numCols*$numRows + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + } + + print "};\n\n"; +} + + + +#-------------------------------------------------------------------------- +# Matmul +#-------------------------------------------------------------------------- + +# http://answers.oreilly.com/topic/418-how-to-multiply-matrices-in-perl/ + +sub mmult { + my ($m1,$m2) = @_; + my ($m1rows,$m1cols) = matdim($m1); + my ($m2rows,$m2cols) = matdim($m2); + + my $result = [ ]; + my ($i, $j, $k); + + for $i (range($m1rows)) { + for $j (range($m2cols)) { + for $k (range($m1cols)) { + $result->[$i][$j] += $m1->[$i][$k] * $m2->[$k][$j]; + } + } + } + return $result; +} + +sub range { 0 .. ($_[0] - 1) } + + +sub veclen { + my $ary_ref = $_[0]; + my $type = ref $ary_ref; + if ($type ne "ARRAY") { die "$type is bad array ref for $ary_ref" } + return scalar(@$ary_ref); +} + +sub matdim { + my $matrix = $_[0]; + my $rows = veclen($matrix); + my $cols = veclen($matrix->[0]); + return ($rows, $cols); +} + +#-------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------- + +sub main() +{ + + processCommandLine(); + srand($opts{"seed"}); + + # create random input arrays + my $mat_values1; + my $mat_values2; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + for ( my $j = 0; $j < $opts{"size"}; $j++ ) { + $mat_values1->[$i][$j] = int(rand(4)); + $mat_values2->[$i][$j] = int(rand(4)); + } + } + + # perform matmul + my $mat_results = mmult( $mat_values1, $mat_values2 ); + + # translate 2d arrays to 1d-somethings (I don't know how to code in perl - Chris) + my @values1; + my @values2; + my @results; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + for ( my $j = 0; $j < $opts{"size"}; $j++ ) { + my $value1 = $mat_values1->[$i][$j]; + my $value2 = $mat_values2->[$i][$j]; + my $result = $mat_results->[$i][$j]; + push( @values1, $value1 ); + push( @values2, $value2 ); + push( @results, $result ); + } + } + + print "\n#ifndef __DATASET_H"; + print "\n#define __DATASET_H"; + print "\n\#define ARRAY_SIZE ".($opts{"size"}*$opts{"size"})." \n\n"; + print "\n\#define DIM_SIZE ".$opts{"size"}." \n\n"; + print "\ntypedef int data_t;"; + + printArray( "input1_data", \@values1 ); + printArray( "input2_data", \@values2 ); + printArray( "verify_data", \@results); + + print "\n#endif //__DATASET_H"; + +} + +main(); + diff --git a/apps/riscv-tests/benchmarks/mt-matmul/mt-matmul.c b/apps/riscv-tests/benchmarks/mt-matmul/mt-matmul.c new file mode 100644 index 0000000..dbb7562 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-matmul/mt-matmul.c @@ -0,0 +1,57 @@ +// See LICENSE for license details. + +//************************************************************************** +// Multi-threaded Matrix Multiply benchmark +//-------------------------------------------------------------------------- +// TA : Christopher Celio +// Student: +// +// +// This benchmark multiplies two 2-D arrays together and writes the results to +// a third vector. The input data (and reference data) should be generated +// using the matmul_gendata.pl perl script and dumped to a file named +// dataset.h. + +//-------------------------------------------------------------------------- +// Includes + +#include +#include +#include +#include + + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#include "dataset.h" + + +//-------------------------------------------------------------------------- +// Basic Utilities and Multi-thread Support + +#include "util.h" + + +//-------------------------------------------------------------------------- +// matmul function + +extern void matmul(const size_t coreid, const size_t ncores, const size_t lda, const data_t A[], const data_t B[], data_t C[] ); + + +//-------------------------------------------------------------------------- +// Main +// +// all threads start executing thread_entry(). Use their "coreid" to +// differentiate between threads (each thread is running on a separate core). + +void thread_entry(int cid, int nc) +{ + static data_t results_data[ARRAY_SIZE]; + + stats(matmul(cid, nc, DIM_SIZE, input1_data, input2_data, results_data); barrier(nc), DIM_SIZE/DIM_SIZE/DIM_SIZE); + + int res = verify(ARRAY_SIZE, results_data, verify_data); + + exit(res); +} diff --git a/apps/riscv-tests/benchmarks/mt-vvadd/dataset.h b/apps/riscv-tests/benchmarks/mt-vvadd/dataset.h new file mode 100644 index 0000000..a421b7b --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-vvadd/dataset.h @@ -0,0 +1,173 @@ +// See LICENSE for license details. + +#ifndef __DATASET_H +#define __DATASET_H + +#define DATA_SIZE 1000 + +typedef double data_t; + +static data_t input1_data[DATA_SIZE] = +{ + 0.00, 15.00, 10.00, 3.00, 14.00, 6.00, 2.00, 18.00, 11.00, 15.00, 11.00, 0.00, 17.00, 16.00, 7.00, 13.00, 18.00, 2.00, 2.00, 5.00, + 8.00, 5.00, 12.00, 14.00, 6.00, 12.00, 16.00, 7.00, 9.00, 17.00, 10.00, 10.00, 3.00, 5.00, 14.00, 11.00, 9.00, 12.00, 3.00, 1.00, + 5.00, 4.00, 6.00, 17.00, 17.00, 4.00, 17.00, 15.00, 17.00, 18.00, 3.00, 18.00, 10.00, 6.00, 12.00, 12.00, 3.00, 2.00, 16.00, 1.00, + 5.00, 6.00, 2.00, 17.00, 16.00, 5.00, 10.00, 18.00, 14.00, 4.00, 9.00, 9.00, 7.00, 4.00, 8.00, 13.00, 12.00, 6.00, 4.00, 17.00, + 5.00, 2.00, 11.00, 11.00, 7.00, 6.00, 8.00, 5.00, 6.00, 6.00, 11.00, 1.00, 18.00, 7.00, 6.00, 9.00, 10.00, 17.00, 14.00, 4.00, + 14.00, 11.00, 2.00, 0.00, 2.00, 17.00, 17.00, 15.00, 10.00, 8.00, 12.00, 18.00, 5.00, 0.00, 0.00, 1.00, 1.00, 8.00, 11.00, 11.00, + 7.00, 5.00, 15.00, 18.00, 15.00, 6.00, 8.00, 9.00, 18.00, 6.00, 15.00, 16.00, 10.00, 18.00, 13.00, 6.00, 10.00, 16.00, 0.00, 10.00, + 12.00, 8.00, 8.00, 3.00, 0.00, 1.00, 4.00, 0.00, 8.00, 15.00, 16.00, 9.00, 7.00, 7.00, 10.00, 9.00, 16.00, 12.00, 5.00, 5.00, + 9.00, 5.00, 17.00, 4.00, 13.00, 13.00, 4.00, 14.00, 10.00, 5.00, 10.00, 10.00, 6.00, 18.00, 5.00, 15.00, 5.00, 15.00, 13.00, 18.00, + 6.00, 13.00, 5.00, 18.00, 12.00, 14.00, 1.00, 7.00, 2.00, 1.00, 7.00, 12.00, 15.00, 15.00, 6.00, 2.00, 1.00, 2.00, 18.00, 6.00, + 10.00, 14.00, 9.00, 15.00, 11.00, 0.00, 3.00, 1.00, 2.00, 2.00, 14.00, 7.00, 18.00, 0.00, 2.00, 2.00, 16.00, 8.00, 4.00, 5.00, + 7.00, 11.00, 7.00, 10.00, 14.00, 10.00, 3.00, 0.00, 13.00, 9.00, 14.00, 0.00, 14.00, 1.00, 3.00, 16.00, 2.00, 14.00, 6.00, 17.00, + 17.00, 6.00, 9.00, 8.00, 9.00, 12.00, 5.00, 14.00, 2.00, 16.00, 17.00, 5.00, 4.00, 0.00, 14.00, 10.00, 6.00, 15.00, 15.00, 14.00, + 5.00, 1.00, 8.00, 8.00, 13.00, 8.00, 0.00, 4.00, 7.00, 9.00, 13.00, 16.00, 9.00, 14.00, 9.00, 13.00, 0.00, 7.00, 16.00, 17.00, + 18.00, 10.00, 13.00, 8.00, 4.00, 9.00, 13.00, 0.00, 6.00, 4.00, 6.00, 4.00, 10.00, 14.00, 14.00, 9.00, 15.00, 15.00, 3.00, 3.00, + 12.00, 0.00, 3.00, 2.00, 16.00, 1.00, 7.00, 2.00, 16.00, 2.00, 2.00, 0.00, 14.00, 3.00, 3.00, 10.00, 4.00, 10.00, 3.00, 4.00, + 13.00, 14.00, 13.00, 0.00, 1.00, 15.00, 16.00, 9.00, 7.00, 9.00, 0.00, 11.00, 1.00, 1.00, 15.00, 17.00, 12.00, 16.00, 15.00, 4.00, + 8.00, 2.00, 10.00, 10.00, 0.00, 18.00, 17.00, 7.00, 7.00, 2.00, 10.00, 17.00, 9.00, 7.00, 5.00, 3.00, 8.00, 11.00, 6.00, 9.00, + 13.00, 0.00, 3.00, 5.00, 2.00, 5.00, 7.00, 4.00, 9.00, 2.00, 13.00, 17.00, 14.00, 12.00, 1.00, 3.00, 7.00, 17.00, 0.00, 14.00, + 16.00, 2.00, 2.00, 1.00, 2.00, 15.00, 16.00, 8.00, 2.00, 4.00, 15.00, 15.00, 10.00, 6.00, 11.00, 9.00, 15.00, 17.00, 3.00, 8.00, + 15.00, 3.00, 10.00, 15.00, 8.00, 14.00, 16.00, 15.00, 15.00, 14.00, 1.00, 7.00, 4.00, 18.00, 2.00, 13.00, 11.00, 15.00, 7.00, 10.00, + 13.00, 10.00, 7.00, 14.00, 18.00, 4.00, 18.00, 4.00, 3.00, 9.00, 1.00, 13.00, 15.00, 2.00, 5.00, 15.00, 12.00, 10.00, 2.00, 0.00, + 10.00, 15.00, 0.00, 11.00, 14.00, 11.00, 14.00, 9.00, 1.00, 18.00, 14.00, 18.00, 15.00, 5.00, 1.00, 15.00, 18.00, 14.00, 3.00, 15.00, + 11.00, 2.00, 15.00, 0.00, 13.00, 1.00, 4.00, 14.00, 14.00, 5.00, 2.00, 13.00, 17.00, 8.00, 7.00, 6.00, 5.00, 10.00, 14.00, 14.00, + 17.00, 0.00, 0.00, 17.00, 18.00, 15.00, 10.00, 16.00, 18.00, 5.00, 9.00, 10.00, 18.00, 7.00, 11.00, 5.00, 4.00, 16.00, 2.00, 8.00, + 13.00, 1.00, 12.00, 3.00, 4.00, 6.00, 15.00, 12.00, 0.00, 6.00, 18.00, 12.00, 14.00, 18.00, 3.00, 2.00, 3.00, 5.00, 3.00, 14.00, + 18.00, 12.00, 10.00, 11.00, 8.00, 4.00, 10.00, 10.00, 9.00, 18.00, 14.00, 3.00, 7.00, 17.00, 12.00, 0.00, 10.00, 9.00, 17.00, 3.00, + 0.00, 4.00, 6.00, 16.00, 14.00, 12.00, 13.00, 13.00, 18.00, 7.00, 0.00, 1.00, 9.00, 7.00, 12.00, 6.00, 18.00, 8.00, 9.00, 13.00, + 13.00, 17.00, 10.00, 16.00, 1.00, 10.00, 17.00, 16.00, 2.00, 18.00, 4.00, 2.00, 6.00, 1.00, 1.00, 1.00, 8.00, 14.00, 6.00, 6.00, + 13.00, 14.00, 13.00, 6.00, 5.00, 10.00, 11.00, 11.00, 16.00, 1.00, 5.00, 9.00, 13.00, 8.00, 10.00, 2.00, 12.00, 15.00, 5.00, 14.00, + 3.00, 7.00, 9.00, 18.00, 2.00, 11.00, 16.00, 4.00, 5.00, 10.00, 17.00, 10.00, 3.00, 4.00, 14.00, 18.00, 13.00, 6.00, 8.00, 11.00, + 14.00, 3.00, 5.00, 6.00, 6.00, 5.00, 13.00, 0.00, 9.00, 9.00, 1.00, 7.00, 5.00, 5.00, 1.00, 6.00, 18.00, 11.00, 17.00, 7.00, + 1.00, 10.00, 5.00, 12.00, 6.00, 16.00, 16.00, 5.00, 1.00, 10.00, 10.00, 15.00, 7.00, 18.00, 8.00, 17.00, 3.00, 5.00, 3.00, 14.00, + 0.00, 16.00, 12.00, 0.00, 14.00, 17.00, 16.00, 2.00, 18.00, 13.00, 10.00, 13.00, 4.00, 14.00, 2.00, 3.00, 4.00, 8.00, 17.00, 0.00, + 6.00, 11.00, 5.00, 3.00, 3.00, 2.00, 15.00, 13.00, 10.00, 4.00, 1.00, 11.00, 6.00, 17.00, 1.00, 0.00, 18.00, 3.00, 3.00, 11.00, + 7.00, 7.00, 11.00, 14.00, 7.00, 16.00, 11.00, 10.00, 8.00, 6.00, 11.00, 5.00, 17.00, 10.00, 7.00, 8.00, 14.00, 2.00, 9.00, 17.00, + 15.00, 13.00, 10.00, 6.00, 0.00, 15.00, 11.00, 10.00, 11.00, 18.00, 2.00, 5.00, 17.00, 18.00, 11.00, 15.00, 3.00, 17.00, 9.00, 17.00, + 8.00, 6.00, 2.00, 4.00, 2.00, 11.00, 15.00, 2.00, 18.00, 3.00, 9.00, 7.00, 15.00, 9.00, 14.00, 10.00, 9.00, 6.00, 13.00, 8.00, + 15.00, 14.00, 0.00, 11.00, 5.00, 2.00, 12.00, 14.00, 10.00, 16.00, 9.00, 7.00, 9.00, 17.00, 4.00, 4.00, 7.00, 8.00, 4.00, 4.00, + 9.00, 7.00, 3.00, 5.00, 11.00, 11.00, 10.00, 13.00, 3.00, 14.00, 15.00, 8.00, 1.00, 1.00, 3.00, 0.00, 16.00, 9.00, 6.00, 1.00, + 0.00, 2.00, 0.00, 6.00, 13.00, 12.00, 5.00, 18.00, 1.00, 11.00, 17.00, 11.00, 16.00, 14.00, 14.00, 9.00, 11.00, 9.00, 17.00, 15.00, + 5.00, 18.00, 2.00, 11.00, 10.00, 16.00, 18.00, 5.00, 11.00, 12.00, 11.00, 18.00, 7.00, 6.00, 8.00, 3.00, 4.00, 3.00, 16.00, 4.00, + 6.00, 2.00, 15.00, 6.00, 7.00, 16.00, 0.00, 7.00, 11.00, 10.00, 3.00, 0.00, 14.00, 16.00, 15.00, 15.00, 12.00, 7.00, 1.00, 4.00, + 8.00, 4.00, 12.00, 0.00, 7.00, 8.00, 1.00, 1.00, 14.00, 15.00, 9.00, 8.00, 6.00, 6.00, 4.00, 7.00, 8.00, 13.00, 10.00, 5.00, + 8.00, 11.00, 2.00, 16.00, 7.00, 17.00, 5.00, 2.00, 17.00, 0.00, 18.00, 6.00, 7.00, 4.00, 4.00, 12.00, 0.00, 18.00, 8.00, 4.00, + 7.00, 0.00, 11.00, 1.00, 11.00, 17.00, 18.00, 15.00, 8.00, 11.00, 15.00, 9.00, 12.00, 1.00, 5.00, 6.00, 1.00, 18.00, 14.00, 7.00, + 16.00, 16.00, 10.00, 3.00, 13.00, 0.00, 12.00, 9.00, 18.00, 14.00, 15.00, 4.00, 11.00, 15.00, 15.00, 8.00, 16.00, 11.00, 13.00, 12.00, + 1.00, 13.00, 14.00, 2.00, 11.00, 0.00, 17.00, 11.00, 12.00, 6.00, 4.00, 4.00, 11.00, 13.00, 10.00, 2.00, 10.00, 14.00, 0.00, 6.00, + 18.00, 10.00, 7.00, 14.00, 12.00, 9.00, 4.00, 16.00, 17.00, 8.00, 14.00, 9.00, 0.00, 4.00, 15.00, 13.00, 8.00, 13.00, 13.00, 8.00, + 15.00, 6.00, 11.00, 4.00, 2.00, 6.00, 5.00, 14.00, 5.00, 17.00, 12.00, 11.00, 17.00, 4.00, 13.00, 7.00, 16.00, 12.00, 7.00, 18.00 +}; + +static data_t input2_data[DATA_SIZE] = +{ + 8.00, 6.00, 0.00, 18.00, 6.00, 10.00, 1.00, 2.00, 4.00, 2.00, 4.00, 10.00, 6.00, 11.00, 17.00, 4.00, 0.00, 16.00, 14.00, 12.00, + 9.00, 8.00, 13.00, 15.00, 18.00, 2.00, 13.00, 10.00, 5.00, 4.00, 12.00, 9.00, 1.00, 13.00, 12.00, 7.00, 10.00, 17.00, 11.00, 10.00, + 18.00, 15.00, 11.00, 12.00, 7.00, 9.00, 6.00, 5.00, 11.00, 7.00, 10.00, 12.00, 18.00, 18.00, 15.00, 1.00, 3.00, 18.00, 11.00, 16.00, + 13.00, 18.00, 4.00, 13.00, 8.00, 7.00, 10.00, 13.00, 0.00, 9.00, 1.00, 16.00, 13.00, 7.00, 5.00, 5.00, 11.00, 1.00, 6.00, 10.00, + 12.00, 3.00, 10.00, 5.00, 15.00, 15.00, 13.00, 14.00, 14.00, 1.00, 18.00, 5.00, 16.00, 14.00, 10.00, 4.00, 8.00, 4.00, 6.00, 6.00, + 13.00, 14.00, 8.00, 5.00, 14.00, 10.00, 9.00, 10.00, 17.00, 15.00, 6.00, 16.00, 12.00, 9.00, 10.00, 16.00, 16.00, 8.00, 1.00, 12.00, + 7.00, 0.00, 0.00, 3.00, 5.00, 7.00, 10.00, 3.00, 17.00, 10.00, 18.00, 16.00, 1.00, 11.00, 18.00, 9.00, 2.00, 0.00, 12.00, 6.00, + 13.00, 1.00, 13.00, 5.00, 7.00, 13.00, 17.00, 9.00, 15.00, 13.00, 5.00, 2.00, 4.00, 4.00, 3.00, 0.00, 9.00, 11.00, 3.00, 12.00, + 6.00, 11.00, 1.00, 16.00, 12.00, 11.00, 2.00, 2.00, 15.00, 12.00, 8.00, 9.00, 14.00, 2.00, 11.00, 0.00, 0.00, 7.00, 2.00, 13.00, + 15.00, 18.00, 7.00, 16.00, 16.00, 1.00, 1.00, 12.00, 12.00, 2.00, 2.00, 1.00, 7.00, 4.00, 0.00, 8.00, 18.00, 4.00, 11.00, 6.00, + 17.00, 13.00, 12.00, 5.00, 16.00, 12.00, 0.00, 9.00, 10.00, 10.00, 18.00, 12.00, 8.00, 7.00, 5.00, 8.00, 16.00, 3.00, 9.00, 18.00, + 12.00, 13.00, 18.00, 6.00, 8.00, 12.00, 2.00, 12.00, 8.00, 8.00, 9.00, 18.00, 8.00, 0.00, 9.00, 2.00, 6.00, 7.00, 0.00, 3.00, + 11.00, 2.00, 18.00, 2.00, 16.00, 1.00, 16.00, 11.00, 11.00, 16.00, 16.00, 11.00, 7.00, 4.00, 14.00, 10.00, 5.00, 8.00, 4.00, 14.00, + 17.00, 13.00, 13.00, 3.00, 1.00, 14.00, 1.00, 7.00, 0.00, 2.00, 7.00, 14.00, 4.00, 9.00, 14.00, 3.00, 9.00, 13.00, 13.00, 3.00, + 3.00, 17.00, 0.00, 18.00, 4.00, 8.00, 6.00, 9.00, 4.00, 2.00, 0.00, 14.00, 3.00, 3.00, 14.00, 8.00, 6.00, 7.00, 2.00, 12.00, + 5.00, 14.00, 6.00, 12.00, 2.00, 16.00, 1.00, 15.00, 7.00, 18.00, 0.00, 0.00, 13.00, 13.00, 12.00, 11.00, 16.00, 15.00, 14.00, 8.00, + 9.00, 10.00, 8.00, 8.00, 13.00, 13.00, 13.00, 10.00, 1.00, 15.00, 4.00, 0.00, 12.00, 1.00, 8.00, 12.00, 1.00, 18.00, 12.00, 18.00, + 9.00, 1.00, 11.00, 5.00, 13.00, 7.00, 1.00, 13.00, 5.00, 8.00, 17.00, 11.00, 13.00, 15.00, 9.00, 3.00, 17.00, 18.00, 9.00, 3.00, + 15.00, 11.00, 12.00, 0.00, 2.00, 15.00, 3.00, 0.00, 13.00, 1.00, 14.00, 14.00, 15.00, 8.00, 6.00, 0.00, 0.00, 11.00, 17.00, 0.00, + 1.00, 8.00, 6.00, 6.00, 10.00, 6.00, 18.00, 12.00, 7.00, 18.00, 4.00, 6.00, 15.00, 18.00, 7.00, 5.00, 8.00, 6.00, 6.00, 7.00, + 4.00, 4.00, 10.00, 17.00, 12.00, 13.00, 11.00, 15.00, 12.00, 18.00, 7.00, 12.00, 17.00, 10.00, 14.00, 12.00, 2.00, 7.00, 17.00, 3.00, + 8.00, 6.00, 3.00, 9.00, 3.00, 7.00, 7.00, 15.00, 18.00, 5.00, 13.00, 13.00, 15.00, 10.00, 0.00, 11.00, 10.00, 1.00, 5.00, 16.00, + 2.00, 7.00, 14.00, 12.00, 7.00, 17.00, 17.00, 11.00, 0.00, 5.00, 16.00, 14.00, 1.00, 9.00, 8.00, 8.00, 3.00, 17.00, 0.00, 8.00, + 6.00, 5.00, 7.00, 6.00, 17.00, 3.00, 3.00, 8.00, 3.00, 12.00, 17.00, 5.00, 14.00, 3.00, 11.00, 5.00, 17.00, 2.00, 15.00, 1.00, + 18.00, 11.00, 12.00, 0.00, 0.00, 14.00, 7.00, 17.00, 15.00, 10.00, 18.00, 10.00, 11.00, 7.00, 12.00, 10.00, 17.00, 2.00, 18.00, 9.00, + 11.00, 4.00, 17.00, 10.00, 15.00, 12.00, 4.00, 1.00, 5.00, 10.00, 4.00, 2.00, 11.00, 3.00, 4.00, 15.00, 16.00, 10.00, 2.00, 2.00, + 15.00, 16.00, 0.00, 13.00, 16.00, 9.00, 1.00, 7.00, 3.00, 10.00, 7.00, 2.00, 12.00, 8.00, 1.00, 5.00, 0.00, 16.00, 4.00, 14.00, + 13.00, 16.00, 3.00, 0.00, 10.00, 6.00, 3.00, 9.00, 1.00, 3.00, 0.00, 13.00, 12.00, 17.00, 11.00, 4.00, 15.00, 15.00, 12.00, 4.00, + 4.00, 2.00, 16.00, 6.00, 11.00, 17.00, 14.00, 7.00, 4.00, 14.00, 8.00, 8.00, 3.00, 18.00, 17.00, 17.00, 12.00, 10.00, 11.00, 1.00, + 8.00, 13.00, 1.00, 14.00, 0.00, 9.00, 0.00, 7.00, 9.00, 0.00, 7.00, 12.00, 0.00, 18.00, 10.00, 1.00, 5.00, 13.00, 13.00, 2.00, + 10.00, 4.00, 2.00, 6.00, 0.00, 16.00, 2.00, 15.00, 13.00, 6.00, 8.00, 5.00, 6.00, 15.00, 12.00, 6.00, 6.00, 7.00, 8.00, 1.00, + 11.00, 9.00, 7.00, 18.00, 14.00, 4.00, 9.00, 6.00, 4.00, 2.00, 10.00, 13.00, 6.00, 17.00, 2.00, 11.00, 7.00, 3.00, 8.00, 9.00, + 2.00, 6.00, 18.00, 12.00, 18.00, 13.00, 8.00, 1.00, 11.00, 4.00, 13.00, 14.00, 16.00, 8.00, 6.00, 18.00, 14.00, 15.00, 9.00, 11.00, + 2.00, 13.00, 4.00, 3.00, 3.00, 15.00, 14.00, 3.00, 13.00, 12.00, 14.00, 16.00, 18.00, 12.00, 5.00, 11.00, 2.00, 3.00, 15.00, 1.00, + 12.00, 1.00, 15.00, 13.00, 12.00, 18.00, 4.00, 17.00, 13.00, 7.00, 11.00, 13.00, 7.00, 10.00, 1.00, 3.00, 18.00, 6.00, 10.00, 3.00, + 9.00, 16.00, 12.00, 10.00, 6.00, 6.00, 7.00, 16.00, 16.00, 16.00, 17.00, 18.00, 8.00, 18.00, 0.00, 6.00, 17.00, 13.00, 14.00, 8.00, + 0.00, 7.00, 5.00, 13.00, 8.00, 12.00, 14.00, 9.00, 10.00, 10.00, 9.00, 9.00, 8.00, 6.00, 0.00, 14.00, 16.00, 8.00, 7.00, 16.00, + 10.00, 3.00, 1.00, 9.00, 11.00, 2.00, 6.00, 18.00, 5.00, 4.00, 2.00, 11.00, 10.00, 17.00, 16.00, 2.00, 12.00, 15.00, 14.00, 6.00, + 6.00, 17.00, 3.00, 10.00, 9.00, 18.00, 18.00, 6.00, 11.00, 16.00, 18.00, 17.00, 7.00, 14.00, 1.00, 16.00, 7.00, 9.00, 11.00, 12.00, + 10.00, 6.00, 1.00, 16.00, 9.00, 18.00, 0.00, 9.00, 16.00, 10.00, 14.00, 6.00, 9.00, 14.00, 15.00, 7.00, 12.00, 8.00, 1.00, 1.00, + 1.00, 17.00, 17.00, 17.00, 18.00, 1.00, 15.00, 18.00, 16.00, 16.00, 11.00, 7.00, 4.00, 15.00, 3.00, 14.00, 13.00, 14.00, 9.00, 2.00, + 4.00, 8.00, 14.00, 7.00, 0.00, 12.00, 14.00, 15.00, 8.00, 2.00, 11.00, 5.00, 6.00, 16.00, 6.00, 4.00, 16.00, 7.00, 9.00, 5.00, + 1.00, 0.00, 16.00, 10.00, 9.00, 6.00, 5.00, 8.00, 15.00, 13.00, 7.00, 18.00, 18.00, 8.00, 0.00, 15.00, 4.00, 6.00, 14.00, 3.00, + 3.00, 2.00, 9.00, 14.00, 18.00, 13.00, 10.00, 15.00, 0.00, 11.00, 16.00, 7.00, 16.00, 18.00, 0.00, 12.00, 6.00, 13.00, 12.00, 12.00, + 5.00, 3.00, 5.00, 16.00, 13.00, 16.00, 8.00, 5.00, 12.00, 8.00, 8.00, 0.00, 2.00, 9.00, 18.00, 11.00, 8.00, 4.00, 14.00, 6.00, + 17.00, 2.00, 6.00, 8.00, 11.00, 13.00, 6.00, 18.00, 17.00, 6.00, 8.00, 0.00, 1.00, 14.00, 18.00, 4.00, 0.00, 4.00, 3.00, 3.00, + 16.00, 8.00, 16.00, 1.00, 2.00, 0.00, 15.00, 14.00, 10.00, 9.00, 15.00, 3.00, 5.00, 18.00, 5.00, 6.00, 7.00, 3.00, 7.00, 2.00, + 6.00, 12.00, 10.00, 10.00, 18.00, 16.00, 0.00, 9.00, 17.00, 10.00, 9.00, 14.00, 15.00, 5.00, 8.00, 15.00, 3.00, 15.00, 14.00, 11.00, + 6.00, 6.00, 14.00, 0.00, 14.00, 0.00, 7.00, 12.00, 8.00, 7.00, 1.00, 3.00, 6.00, 10.00, 12.00, 1.00, 16.00, 5.00, 5.00, 6.00, + 17.00, 15.00, 15.00, 9.00, 4.00, 18.00, 17.00, 13.00, 12.00, 9.00, 7.00, 10.00, 2.00, 5.00, 8.00, 18.00, 1.00, 15.00, 8.00, 0.00 +}; + +static data_t verify_data[DATA_SIZE] = +{ + 8.00, 21.00, 10.00, 21.00, 20.00, 16.00, 3.00, 20.00, 15.00, 17.00, 15.00, 10.00, 23.00, 27.00, 24.00, 17.00, 18.00, 18.00, 16.00, 17.00, + 17.00, 13.00, 25.00, 29.00, 24.00, 14.00, 29.00, 17.00, 14.00, 21.00, 22.00, 19.00, 4.00, 18.00, 26.00, 18.00, 19.00, 29.00, 14.00, 11.00, + 23.00, 19.00, 17.00, 29.00, 24.00, 13.00, 23.00, 20.00, 28.00, 25.00, 13.00, 30.00, 28.00, 24.00, 27.00, 13.00, 6.00, 20.00, 27.00, 17.00, + 18.00, 24.00, 6.00, 30.00, 24.00, 12.00, 20.00, 31.00, 14.00, 13.00, 10.00, 25.00, 20.00, 11.00, 13.00, 18.00, 23.00, 7.00, 10.00, 27.00, + 17.00, 5.00, 21.00, 16.00, 22.00, 21.00, 21.00, 19.00, 20.00, 7.00, 29.00, 6.00, 34.00, 21.00, 16.00, 13.00, 18.00, 21.00, 20.00, 10.00, + 27.00, 25.00, 10.00, 5.00, 16.00, 27.00, 26.00, 25.00, 27.00, 23.00, 18.00, 34.00, 17.00, 9.00, 10.00, 17.00, 17.00, 16.00, 12.00, 23.00, + 14.00, 5.00, 15.00, 21.00, 20.00, 13.00, 18.00, 12.00, 35.00, 16.00, 33.00, 32.00, 11.00, 29.00, 31.00, 15.00, 12.00, 16.00, 12.00, 16.00, + 25.00, 9.00, 21.00, 8.00, 7.00, 14.00, 21.00, 9.00, 23.00, 28.00, 21.00, 11.00, 11.00, 11.00, 13.00, 9.00, 25.00, 23.00, 8.00, 17.00, + 15.00, 16.00, 18.00, 20.00, 25.00, 24.00, 6.00, 16.00, 25.00, 17.00, 18.00, 19.00, 20.00, 20.00, 16.00, 15.00, 5.00, 22.00, 15.00, 31.00, + 21.00, 31.00, 12.00, 34.00, 28.00, 15.00, 2.00, 19.00, 14.00, 3.00, 9.00, 13.00, 22.00, 19.00, 6.00, 10.00, 19.00, 6.00, 29.00, 12.00, + 27.00, 27.00, 21.00, 20.00, 27.00, 12.00, 3.00, 10.00, 12.00, 12.00, 32.00, 19.00, 26.00, 7.00, 7.00, 10.00, 32.00, 11.00, 13.00, 23.00, + 19.00, 24.00, 25.00, 16.00, 22.00, 22.00, 5.00, 12.00, 21.00, 17.00, 23.00, 18.00, 22.00, 1.00, 12.00, 18.00, 8.00, 21.00, 6.00, 20.00, + 28.00, 8.00, 27.00, 10.00, 25.00, 13.00, 21.00, 25.00, 13.00, 32.00, 33.00, 16.00, 11.00, 4.00, 28.00, 20.00, 11.00, 23.00, 19.00, 28.00, + 22.00, 14.00, 21.00, 11.00, 14.00, 22.00, 1.00, 11.00, 7.00, 11.00, 20.00, 30.00, 13.00, 23.00, 23.00, 16.00, 9.00, 20.00, 29.00, 20.00, + 21.00, 27.00, 13.00, 26.00, 8.00, 17.00, 19.00, 9.00, 10.00, 6.00, 6.00, 18.00, 13.00, 17.00, 28.00, 17.00, 21.00, 22.00, 5.00, 15.00, + 17.00, 14.00, 9.00, 14.00, 18.00, 17.00, 8.00, 17.00, 23.00, 20.00, 2.00, 0.00, 27.00, 16.00, 15.00, 21.00, 20.00, 25.00, 17.00, 12.00, + 22.00, 24.00, 21.00, 8.00, 14.00, 28.00, 29.00, 19.00, 8.00, 24.00, 4.00, 11.00, 13.00, 2.00, 23.00, 29.00, 13.00, 34.00, 27.00, 22.00, + 17.00, 3.00, 21.00, 15.00, 13.00, 25.00, 18.00, 20.00, 12.00, 10.00, 27.00, 28.00, 22.00, 22.00, 14.00, 6.00, 25.00, 29.00, 15.00, 12.00, + 28.00, 11.00, 15.00, 5.00, 4.00, 20.00, 10.00, 4.00, 22.00, 3.00, 27.00, 31.00, 29.00, 20.00, 7.00, 3.00, 7.00, 28.00, 17.00, 14.00, + 17.00, 10.00, 8.00, 7.00, 12.00, 21.00, 34.00, 20.00, 9.00, 22.00, 19.00, 21.00, 25.00, 24.00, 18.00, 14.00, 23.00, 23.00, 9.00, 15.00, + 19.00, 7.00, 20.00, 32.00, 20.00, 27.00, 27.00, 30.00, 27.00, 32.00, 8.00, 19.00, 21.00, 28.00, 16.00, 25.00, 13.00, 22.00, 24.00, 13.00, + 21.00, 16.00, 10.00, 23.00, 21.00, 11.00, 25.00, 19.00, 21.00, 14.00, 14.00, 26.00, 30.00, 12.00, 5.00, 26.00, 22.00, 11.00, 7.00, 16.00, + 12.00, 22.00, 14.00, 23.00, 21.00, 28.00, 31.00, 20.00, 1.00, 23.00, 30.00, 32.00, 16.00, 14.00, 9.00, 23.00, 21.00, 31.00, 3.00, 23.00, + 17.00, 7.00, 22.00, 6.00, 30.00, 4.00, 7.00, 22.00, 17.00, 17.00, 19.00, 18.00, 31.00, 11.00, 18.00, 11.00, 22.00, 12.00, 29.00, 15.00, + 35.00, 11.00, 12.00, 17.00, 18.00, 29.00, 17.00, 33.00, 33.00, 15.00, 27.00, 20.00, 29.00, 14.00, 23.00, 15.00, 21.00, 18.00, 20.00, 17.00, + 24.00, 5.00, 29.00, 13.00, 19.00, 18.00, 19.00, 13.00, 5.00, 16.00, 22.00, 14.00, 25.00, 21.00, 7.00, 17.00, 19.00, 15.00, 5.00, 16.00, + 33.00, 28.00, 10.00, 24.00, 24.00, 13.00, 11.00, 17.00, 12.00, 28.00, 21.00, 5.00, 19.00, 25.00, 13.00, 5.00, 10.00, 25.00, 21.00, 17.00, + 13.00, 20.00, 9.00, 16.00, 24.00, 18.00, 16.00, 22.00, 19.00, 10.00, 0.00, 14.00, 21.00, 24.00, 23.00, 10.00, 33.00, 23.00, 21.00, 17.00, + 17.00, 19.00, 26.00, 22.00, 12.00, 27.00, 31.00, 23.00, 6.00, 32.00, 12.00, 10.00, 9.00, 19.00, 18.00, 18.00, 20.00, 24.00, 17.00, 7.00, + 21.00, 27.00, 14.00, 20.00, 5.00, 19.00, 11.00, 18.00, 25.00, 1.00, 12.00, 21.00, 13.00, 26.00, 20.00, 3.00, 17.00, 28.00, 18.00, 16.00, + 13.00, 11.00, 11.00, 24.00, 2.00, 27.00, 18.00, 19.00, 18.00, 16.00, 25.00, 15.00, 9.00, 19.00, 26.00, 24.00, 19.00, 13.00, 16.00, 12.00, + 25.00, 12.00, 12.00, 24.00, 20.00, 9.00, 22.00, 6.00, 13.00, 11.00, 11.00, 20.00, 11.00, 22.00, 3.00, 17.00, 25.00, 14.00, 25.00, 16.00, + 3.00, 16.00, 23.00, 24.00, 24.00, 29.00, 24.00, 6.00, 12.00, 14.00, 23.00, 29.00, 23.00, 26.00, 14.00, 35.00, 17.00, 20.00, 12.00, 25.00, + 2.00, 29.00, 16.00, 3.00, 17.00, 32.00, 30.00, 5.00, 31.00, 25.00, 24.00, 29.00, 22.00, 26.00, 7.00, 14.00, 6.00, 11.00, 32.00, 1.00, + 18.00, 12.00, 20.00, 16.00, 15.00, 20.00, 19.00, 30.00, 23.00, 11.00, 12.00, 24.00, 13.00, 27.00, 2.00, 3.00, 36.00, 9.00, 13.00, 14.00, + 16.00, 23.00, 23.00, 24.00, 13.00, 22.00, 18.00, 26.00, 24.00, 22.00, 28.00, 23.00, 25.00, 28.00, 7.00, 14.00, 31.00, 15.00, 23.00, 25.00, + 15.00, 20.00, 15.00, 19.00, 8.00, 27.00, 25.00, 19.00, 21.00, 28.00, 11.00, 14.00, 25.00, 24.00, 11.00, 29.00, 19.00, 25.00, 16.00, 33.00, + 18.00, 9.00, 3.00, 13.00, 13.00, 13.00, 21.00, 20.00, 23.00, 7.00, 11.00, 18.00, 25.00, 26.00, 30.00, 12.00, 21.00, 21.00, 27.00, 14.00, + 21.00, 31.00, 3.00, 21.00, 14.00, 20.00, 30.00, 20.00, 21.00, 32.00, 27.00, 24.00, 16.00, 31.00, 5.00, 20.00, 14.00, 17.00, 15.00, 16.00, + 19.00, 13.00, 4.00, 21.00, 20.00, 29.00, 10.00, 22.00, 19.00, 24.00, 29.00, 14.00, 10.00, 15.00, 18.00, 7.00, 28.00, 17.00, 7.00, 2.00, + 1.00, 19.00, 17.00, 23.00, 31.00, 13.00, 20.00, 36.00, 17.00, 27.00, 28.00, 18.00, 20.00, 29.00, 17.00, 23.00, 24.00, 23.00, 26.00, 17.00, + 9.00, 26.00, 16.00, 18.00, 10.00, 28.00, 32.00, 20.00, 19.00, 14.00, 22.00, 23.00, 13.00, 22.00, 14.00, 7.00, 20.00, 10.00, 25.00, 9.00, + 7.00, 2.00, 31.00, 16.00, 16.00, 22.00, 5.00, 15.00, 26.00, 23.00, 10.00, 18.00, 32.00, 24.00, 15.00, 30.00, 16.00, 13.00, 15.00, 7.00, + 11.00, 6.00, 21.00, 14.00, 25.00, 21.00, 11.00, 16.00, 14.00, 26.00, 25.00, 15.00, 22.00, 24.00, 4.00, 19.00, 14.00, 26.00, 22.00, 17.00, + 13.00, 14.00, 7.00, 32.00, 20.00, 33.00, 13.00, 7.00, 29.00, 8.00, 26.00, 6.00, 9.00, 13.00, 22.00, 23.00, 8.00, 22.00, 22.00, 10.00, + 24.00, 2.00, 17.00, 9.00, 22.00, 30.00, 24.00, 33.00, 25.00, 17.00, 23.00, 9.00, 13.00, 15.00, 23.00, 10.00, 1.00, 22.00, 17.00, 10.00, + 32.00, 24.00, 26.00, 4.00, 15.00, 0.00, 27.00, 23.00, 28.00, 23.00, 30.00, 7.00, 16.00, 33.00, 20.00, 14.00, 23.00, 14.00, 20.00, 14.00, + 7.00, 25.00, 24.00, 12.00, 29.00, 16.00, 17.00, 20.00, 29.00, 16.00, 13.00, 18.00, 26.00, 18.00, 18.00, 17.00, 13.00, 29.00, 14.00, 17.00, + 24.00, 16.00, 21.00, 14.00, 26.00, 9.00, 11.00, 28.00, 25.00, 15.00, 15.00, 12.00, 6.00, 14.00, 27.00, 14.00, 24.00, 18.00, 18.00, 14.00, + 32.00, 21.00, 26.00, 13.00, 6.00, 24.00, 22.00, 27.00, 17.00, 26.00, 19.00, 21.00, 19.00, 9.00, 21.00, 25.00, 17.00, 27.00, 15.00, 18.00 +}; + + +#endif //__DATASET_H diff --git a/apps/riscv-tests/benchmarks/mt-vvadd/mt-vvadd.c b/apps/riscv-tests/benchmarks/mt-vvadd/mt-vvadd.c new file mode 100644 index 0000000..54c9602 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-vvadd/mt-vvadd.c @@ -0,0 +1,78 @@ +// See LICENSE for license details. + +//************************************************************************** +// Vector-vector add benchmark +//-------------------------------------------------------------------------- +// Author : Andrew Waterman +// TA : Christopher Celio +// Student : +// +// This benchmark adds two vectors and writes the results to a +// third vector. The input data (and reference data) should be +// generated using the vvadd_gendata.pl perl script and dumped +// to a file named dataset.h + +//-------------------------------------------------------------------------- +// Includes + +#include +#include +#include + + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#include "dataset.h" + + +//-------------------------------------------------------------------------- +// Basic Utilities and Multi-thread Support + +#include "util.h" + + +//-------------------------------------------------------------------------- +// vvadd function + +extern void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z); + + +//-------------------------------------------------------------------------- +// Main +// +// all threads start executing thread_entry(). Use their "coreid" to +// differentiate between threads (each thread is running on a separate core). + +void thread_entry(int cid, int nc) +{ + // static allocates data in the binary, which is visible to both threads + static data_t results_data[DATA_SIZE]; + + // First do out-of-place vvadd + barrier(nc); + stats(vvadd(cid, nc, DATA_SIZE, input1_data, input2_data, results_data); barrier(nc), DATA_SIZE); + + if(cid == 0) { + int res = verifyDouble(DATA_SIZE, results_data, verify_data); + if(res) exit(res); + } + + // Second do in-place vvadd + // Copying input + size_t i; + if(cid == 0) { + for (i = 0; i < DATA_SIZE; i++) + results_data[i] = input1_data[i]; + } + barrier(nc); + stats(vvadd(cid, nc, DATA_SIZE, results_data, input2_data, results_data); barrier(nc), DATA_SIZE); + + if(cid == 0) { + int res = verifyDouble(DATA_SIZE, results_data, verify_data); + if(res) exit(res); + } + + barrier(nc); + exit(0); +} diff --git a/apps/riscv-tests/benchmarks/mt-vvadd/vvadd.c b/apps/riscv-tests/benchmarks/mt-vvadd/vvadd.c new file mode 100644 index 0000000..5b74dd0 --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-vvadd/vvadd.c @@ -0,0 +1,18 @@ +// See LICENSE for license details. + +#include "stdlib.h" +#include "dataset.h" + +//-------------------------------------------------------------------------- +// vvadd function + +void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z) +{ + size_t i; + + // interleave accesses + for (i = coreid; i < n; i+=ncores) + { + z[i] = x[i] + y[i]; + } +} diff --git a/apps/riscv-tests/benchmarks/mt-vvadd/vvadd_gendata.pl b/apps/riscv-tests/benchmarks/mt-vvadd/vvadd_gendata.pl new file mode 100755 index 0000000..a9fceac --- /dev/null +++ b/apps/riscv-tests/benchmarks/mt-vvadd/vvadd_gendata.pl @@ -0,0 +1,139 @@ +#!/usr/bin/perl -w +#========================================================================== +# vvadd_gendata.pl +# +# Author : Christopher Batten (cbatten@mit.edu) +# Date : April 29, 2005 +# +(our $usageMsg = <<'ENDMSG') =~ s/^\#//gm; +# +# Simple script which creates an input data set and the reference data +# for the vvadd benchmark. +# +ENDMSG + +use strict "vars"; +use warnings; +no warnings("once"); +use Getopt::Long; + +#-------------------------------------------------------------------------- +# Command line processing +#-------------------------------------------------------------------------- + +our %opts; + +sub usage() +{ + + print "\n"; + print " Usage: vvadd_gendata.pl [options] \n"; + print "\n"; + print " Options:\n"; + print " --help print this message\n"; + print " --size size of input data [1000]\n"; + print " --seed random seed [1]\n"; + print "$usageMsg"; + + exit(); +} + +sub processCommandLine() +{ + + $opts{"help"} = 0; + $opts{"size"} = 1000; + $opts{"seed"} = 1; + Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage(); + $opts{"help"} and usage(); + +} + +#-------------------------------------------------------------------------- +# Helper Functions +#-------------------------------------------------------------------------- + +sub printArray +{ + my $arrayName = $_[0]; + my $arrayRef = $_[1]; + + my $numCols = 20; + my $arrayLen = scalar(@{$arrayRef}); + + print "static data_t ".$arrayName."[DATA_SIZE] = \n"; + print "{\n"; + + if ( $arrayLen <= $numCols ) { + print " "; + for ( my $i = 0; $i < $arrayLen; $i++ ) { + print sprintf("%3.2f",$arrayRef->[$i]); + if ( $i != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + else { + my $numRows = int($arrayLen/$numCols); + for ( my $j = 0; $j < $numRows; $j++ ) { + print " "; + for ( my $i = 0; $i < $numCols; $i++ ) { + my $index = $j*$numCols + $i; + print sprintf("%3.2f",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + if ( $arrayLen > ($numRows*$numCols) ) { + print " "; + for ( my $i = 0; $i < ($arrayLen-($numRows*$numCols)); $i++ ) { + my $index = $numCols*$numRows + $i; + print sprintf("%3.2f",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + } + + print "};\n\n"; +} + +#-------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------- + +sub main() +{ + + processCommandLine(); + srand($opts{"seed"}); + + my @values1; + my @values2; + my @sum; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + my $value1 = int(rand(19)); + my $value2 = int(rand(19)); + push( @values1, $value1 ); + push( @values2, $value2 ); + push( @sum, $value1 + $value2 ); + } + + + print "\n\#define DATA_SIZE ".$opts{"size"}." \n\n"; + printArray( "input1_data", \@values1 ); + printArray( "input2_data", \@values2 ); + printArray( "verify_data", \@sum ); + +} + +main(); + diff --git a/apps/riscv-tests/benchmarks/multiply/dataset1.h b/apps/riscv-tests/benchmarks/multiply/dataset1.h new file mode 100644 index 0000000..2b0850e --- /dev/null +++ b/apps/riscv-tests/benchmarks/multiply/dataset1.h @@ -0,0 +1,32 @@ +// See LICENSE for license details. + + +#define DATA_SIZE 100 + +int input_data1[DATA_SIZE] = +{ + 41, 454, 833, 335, 564, 1, 187, 989, 749, 365, 350, 572, 132, 64, 949, 153, 584, 216, 805, 140, + 621, 210, 6, 572, 931, 339, 890, 593, 392, 898, 694, 228, 961, 12, 110, 883, 116, 750, 296, 646, + 426, 500, 314, 436, 659, 701, 774, 812, 319, 981, 678, 150, 875, 696, 376, 564, 474, 272, 938, 258, + 539, 647, 569, 509, 203, 88, 280, 703, 759, 669, 606, 375, 511, 551, 657, 936, 195, 592, 81, 569, + 267, 952, 229, 800, 337, 584, 944, 643, 902, 368, 241, 489, 913, 328, 826, 313, 933, 592, 985, 388 +}; + +int input_data2[DATA_SIZE] = +{ + 195, 543, 960, 649, 566, 979, 350, 997, 649, 814, 657, 79, 181, 208, 111, 998, 859, 629, 65, 847, + 288, 704, 349, 997, 141, 253, 905, 715, 886, 430, 264, 415, 576, 538, 979, 700, 761, 4, 241, 494, + 478, 100, 499, 864, 403, 693, 222, 416, 444, 296, 721, 285, 676, 620, 317, 78, 224, 351, 937, 540, + 288, 646, 119, 169, 615, 527, 606, 289, 389, 796, 351, 801, 455, 720, 278, 758, 367, 745, 358, 92, + 584, 989, 62, 271, 985, 853, 403, 788, 346, 531, 517, 222, 559, 461, 908, 241, 775, 358, 255, 332 +}; + +int verify_data[DATA_SIZE] = +{ + 7995, 246522, 799680, 217415, 319224, 979, 65450, 986033, 486101, 297110, 229950, 45188, 23892, 13312, 105339, 152694, 501656, 135864, 52325, 118580, + 178848, 147840, 2094, 570284, 131271, 85767, 805450, 423995, 347312, 386140, 183216, 94620, 553536, 6456, 107690, 618100, 88276, 3000, 71336, 319124, + 203628, 50000, 156686, 376704, 265577, 485793, 171828, 337792, 141636, 290376, 488838, 42750, 591500, 431520, 119192, 43992, 106176, 95472, 878906, 139320, + 155232, 417962, 67711, 86021, 124845, 46376, 169680, 203167, 295251, 532524, 212706, 300375, 232505, 396720, 182646, 709488, 71565, 441040, 28998, 52348, + 155928, 941528, 14198, 216800, 331945, 498152, 380432, 506684, 312092, 195408, 124597, 108558, 510367, 151208, 750008, 75433, 723075, 211936, 251175, 128816 +}; + diff --git a/apps/riscv-tests/benchmarks/multiply/multiply.c b/apps/riscv-tests/benchmarks/multiply/multiply.c new file mode 100644 index 0000000..3a0b903 --- /dev/null +++ b/apps/riscv-tests/benchmarks/multiply/multiply.c @@ -0,0 +1,24 @@ +// See LICENSE for license details. + +// ************************************************************************* +// multiply function (c version) +// ------------------------------------------------------------------------- + +int multiply( int x, int y ) +{ + + int i; + int result = 0; + + for (i = 0; i < 32; i++) { + if ((x & 0x1) == 1) + result = result + y; + + x = x >> 1; + y = y << 1; + } + + return result; + +} + diff --git a/apps/riscv-tests/benchmarks/multiply/multiply.h b/apps/riscv-tests/benchmarks/multiply/multiply.h new file mode 100644 index 0000000..b2b1cf7 --- /dev/null +++ b/apps/riscv-tests/benchmarks/multiply/multiply.h @@ -0,0 +1,11 @@ +// See LICENSE for license details. + +//************************************************************************** +// Software multiply function +//-------------------------------------------------------------------------- + +// Simple C version +int multiply(int x, int y); + +// Simple assembly version +int multiply_asm(int x, int y); diff --git a/apps/riscv-tests/benchmarks/multiply/multiply_gendata.pl b/apps/riscv-tests/benchmarks/multiply/multiply_gendata.pl new file mode 100755 index 0000000..b8d8ed5 --- /dev/null +++ b/apps/riscv-tests/benchmarks/multiply/multiply_gendata.pl @@ -0,0 +1,142 @@ +#!/usr/bin/perl -w +#========================================================================== +# multiply_gendata.pl +# +# Author : Christopher Batten (cbatten@mit.edu) +# Date : May 9, 2005 +# +(our $usageMsg = <<'ENDMSG') =~ s/^\#//gm; +# +# Simple script which creates an input data set and the reference data +# for the multiply benchmark. +# +ENDMSG + +use strict "vars"; +use warnings; +no warnings("once"); +use Getopt::Long; + +#-------------------------------------------------------------------------- +# Command line processing +#-------------------------------------------------------------------------- + +our %opts; + +sub usage() +{ + + print "\n"; + print " Usage: multiply_gendata.pl [options] \n"; + print "\n"; + print " Options:\n"; + print " --help print this message\n"; + print " --size size of input data [750]\n"; + print " --seed random seed [1]\n"; + print "$usageMsg"; + + exit(); +} + +sub processCommandLine() +{ + + $opts{"help"} = 0; + $opts{"size"} = 750; + $opts{"seed"} = 1; + Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage(); + $opts{"help"} and usage(); + +} + +#-------------------------------------------------------------------------- +# Helper Functions +#-------------------------------------------------------------------------- + +sub printArray +{ + my $arrayName = $_[0]; + my $arrayRef = $_[1]; + + my $numCols = 20; + my $arrayLen = scalar(@{$arrayRef}); + + print "int ".$arrayName."[DATA_SIZE] = \n"; + print "{\n"; + + if ( $arrayLen <= $numCols ) { + print " "; + for ( my $i = 0; $i < $arrayLen; $i++ ) { + print sprintf("%3d",$arrayRef->[$i]); + if ( $i != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + else { + my $numRows = int($arrayLen/$numCols); + for ( my $j = 0; $j < $numRows; $j++ ) { + print " "; + for ( my $i = 0; $i < $numCols; $i++ ) { + my $index = $j*$numCols + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + if ( $arrayLen > ($numRows*$numCols) ) { + print " "; + for ( my $i = 0; $i < ($arrayLen-($numRows*$numCols)); $i++ ) { + my $index = $numCols*$numRows + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + } + + print "};\n\n"; +} + +#-------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------- + +sub main() +{ + + processCommandLine(); + srand($opts{"seed"}); + + my @values1; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + push( @values1, int(rand(999)) ); + } + + my @values2; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + push( @values2, int(rand(999)) ); + } + + my @multiply; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + $multiply[$i] = $values1[$i] * $values2[$i]; + } + + print "\n\#define DATA_SIZE ".$opts{"size"}." \n\n"; + printArray( "input_data1", \@values1 ); + printArray( "input_data2", \@values2 ); + printArray( "verify_data", \@multiply ); + +} + +main(); + diff --git a/apps/riscv-tests/benchmarks/multiply/multiply_main.c b/apps/riscv-tests/benchmarks/multiply/multiply_main.c new file mode 100644 index 0000000..ea225eb --- /dev/null +++ b/apps/riscv-tests/benchmarks/multiply/multiply_main.c @@ -0,0 +1,45 @@ +// See LICENSE for license details. + +// ************************************************************************* +// multiply filter bencmark +// ------------------------------------------------------------------------- +// +// This benchmark tests the software multiply implemenation. The +// input data (and reference data) should be generated using the +// multiply_gendata.pl perl script and dumped to a file named +// dataset1.h + +#include "util.h" + +#include "multiply.h" + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#include "dataset1.h" + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ + int i; + int results_data[DATA_SIZE]; + +#if PREALLOCATE + for (i = 0; i < DATA_SIZE; i++) + { + results_data[i] = multiply( input_data1[i], input_data2[i] ); + } +#endif + + setStats(1); + for (i = 0; i < DATA_SIZE; i++) + { + results_data[i] = multiply( input_data1[i], input_data2[i] ); + } + setStats(0); + + // Check the results + return verify( DATA_SIZE, results_data, verify_data ); +} diff --git a/apps/riscv-tests/benchmarks/pmp/pmp.c b/apps/riscv-tests/benchmarks/pmp/pmp.c new file mode 100644 index 0000000..ec07e4a --- /dev/null +++ b/apps/riscv-tests/benchmarks/pmp/pmp.c @@ -0,0 +1,212 @@ +// See LICENSE for license details. + +// Test of PMP functionality. + +#include +#include +#include +#include "util.h" + +volatile int trap_expected; +volatile int granule; + +#define INLINE inline __attribute__((always_inline)) + +uintptr_t handle_trap(uintptr_t cause, uintptr_t epc, uintptr_t regs[32]) +{ + if (cause == CAUSE_ILLEGAL_INSTRUCTION) + exit(0); // no PMP support + + if (!trap_expected || cause != CAUSE_LOAD_ACCESS) + exit(1); + trap_expected = 0; + return epc + insn_len(epc); +} + +#define SCRATCH RISCV_PGSIZE +uintptr_t scratch[RISCV_PGSIZE / sizeof(uintptr_t)] __attribute__((aligned(RISCV_PGSIZE))); +uintptr_t l1pt[RISCV_PGSIZE / sizeof(uintptr_t)] __attribute__((aligned(RISCV_PGSIZE))); +uintptr_t l2pt[RISCV_PGSIZE / sizeof(uintptr_t)] __attribute__((aligned(RISCV_PGSIZE))); +#if __riscv_xlen == 64 +uintptr_t l3pt[RISCV_PGSIZE / sizeof(uintptr_t)] __attribute__((aligned(RISCV_PGSIZE))); +#else +#define l3pt l2pt +#endif + +static void init_pt() +{ + l1pt[0] = ((uintptr_t)l2pt >> RISCV_PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + l3pt[SCRATCH / RISCV_PGSIZE] = ((uintptr_t)scratch >> RISCV_PGSHIFT << PTE_PPN_SHIFT) | PTE_A | PTE_D | PTE_V | PTE_R | PTE_W; +#if __riscv_xlen == 64 + l2pt[0] = ((uintptr_t)l3pt >> RISCV_PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + uintptr_t vm_choice = SATP_MODE_SV39; +#else + uintptr_t vm_choice = SATP_MODE_SV32; +#endif + write_csr(sptbr, ((uintptr_t)l1pt >> RISCV_PGSHIFT) | + (vm_choice * (SATP_MODE & ~(SATP_MODE<<1)))); + write_csr(pmpaddr2, -1); + write_csr(pmpcfg0, (PMP_NAPOT | PMP_R) << 16); +} + +INLINE uintptr_t va2pa(uintptr_t va) +{ + if (va < SCRATCH || va >= SCRATCH + RISCV_PGSIZE) + exit(3); + return va - SCRATCH + (uintptr_t)scratch; +} + +typedef struct { + uintptr_t cfg; + uintptr_t a0; + uintptr_t a1; +} pmpcfg_t; + +INLINE int pmp_ok(pmpcfg_t p, uintptr_t addr, uintptr_t size) +{ + if ((p.cfg & PMP_A) == 0) + return 1; + + if ((p.cfg & PMP_A) != PMP_TOR) { + uintptr_t range = 1; + + if ((p.cfg & PMP_A) == PMP_NAPOT) { + range <<= 1; + for (uintptr_t i = 1; i; i <<= 1) { + if ((p.a1 & i) == 0) + break; + p.a1 &= ~i; + range <<= 1; + } + } + + p.a0 = p.a1; + p.a1 = p.a0 + range; + } + + p.a0 *= granule; + p.a1 *= granule; + addr = va2pa(addr); + + uintptr_t hits = 0; + for (uintptr_t i = 0; i < size; i += granule) { + if (p.a0 <= addr + i && addr + i < p.a1) + hits += granule; + } + + return hits == 0 || hits >= size; +} + +INLINE void test_one(uintptr_t addr, uintptr_t size) +{ + uintptr_t new_mstatus = (read_csr(mstatus) & ~MSTATUS_MPP) | (MSTATUS_MPP & (MSTATUS_MPP >> 1)) | MSTATUS_MPRV; + switch (size) { + case 1: asm volatile ("csrrw %0, mstatus, %0; lb x0, (%1); csrw mstatus, %0" : "+&r" (new_mstatus) : "r" (addr)); break; + case 2: asm volatile ("csrrw %0, mstatus, %0; lh x0, (%1); csrw mstatus, %0" : "+&r" (new_mstatus) : "r" (addr)); break; + case 4: asm volatile ("csrrw %0, mstatus, %0; lw x0, (%1); csrw mstatus, %0" : "+&r" (new_mstatus) : "r" (addr)); break; +#if __riscv_xlen >= 64 + case 8: asm volatile ("csrrw %0, mstatus, %0; ld x0, (%1); csrw mstatus, %0" : "+&r" (new_mstatus) : "r" (addr)); break; +#endif + default: __builtin_unreachable(); + } +} + +INLINE void test_all_sizes(pmpcfg_t p, uintptr_t addr) +{ + for (size_t size = 1; size <= sizeof(uintptr_t); size *= 2) { + if (addr & (size - 1)) + continue; + trap_expected = !pmp_ok(p, addr, size); + test_one(addr, size); + if (trap_expected) + exit(2); + } +} + +INLINE void test_range_once(pmpcfg_t p, uintptr_t base, uintptr_t range) +{ + for (uintptr_t addr = base; addr < base + range; addr += granule) + test_all_sizes(p, addr); +} + +INLINE pmpcfg_t set_pmp(pmpcfg_t p) +{ + uintptr_t cfg0 = read_csr(pmpcfg0); + write_csr(pmpcfg0, cfg0 & ~0xff00); + write_csr(pmpaddr0, p.a0); + write_csr(pmpaddr1, p.a1); + write_csr(pmpcfg0, ((p.cfg << 8) & 0xff00) | (cfg0 & ~0xff00)); + asm volatile ("sfence.vma" ::: "memory"); + return p; +} + +INLINE pmpcfg_t set_pmp_range(uintptr_t base, uintptr_t range) +{ + pmpcfg_t p; + p.cfg = PMP_TOR | PMP_R; + p.a0 = base >> PMP_SHIFT; + p.a1 = (base + range) >> PMP_SHIFT; + return set_pmp(p); +} + +INLINE pmpcfg_t set_pmp_napot(uintptr_t base, uintptr_t range) +{ + pmpcfg_t p; + p.cfg = PMP_R | (range > granule ? PMP_NAPOT : PMP_NA4); + p.a0 = 0; + p.a1 = (base + (range/2 - 1)) >> PMP_SHIFT; + return set_pmp(p); +} + +static void test_range(uintptr_t addr, uintptr_t range) +{ + pmpcfg_t p = set_pmp_range(va2pa(addr), range); + test_range_once(p, addr, range); + + if ((range & (range - 1)) == 0 && (addr & (range - 1)) == 0) { + p = set_pmp_napot(va2pa(addr), range); + test_range_once(p, addr, range); + } +} + +static void test_ranges(uintptr_t addr, uintptr_t size) +{ + for (uintptr_t range = granule; range <= size; range += granule) + test_range(addr, range); +} + +static void exhaustive_test(uintptr_t addr, uintptr_t size) +{ + for (uintptr_t base = addr; base < addr + size; base += granule) + test_ranges(base, size - (base - addr)); +} + +static void detect_granule() +{ + write_csr(pmpcfg0, NULL); + write_csr(pmpaddr0, 0xffffffffffffffffULL); + uintptr_t ret = read_csr(pmpaddr0); + int g = 2; + for(uintptr_t i = 1; i; i<<=1) { + if((ret & i) != 0) + break; + g++; + } + granule = 1UL << g; +} + +int main() +{ + detect_granule(); + init_pt(); + + const int max_exhaustive = 32; + exhaustive_test(SCRATCH, max_exhaustive); + exhaustive_test(SCRATCH + RISCV_PGSIZE - max_exhaustive, max_exhaustive); + + test_range(SCRATCH, RISCV_PGSIZE); + test_range(SCRATCH, RISCV_PGSIZE / 2); + test_range(SCRATCH + RISCV_PGSIZE / 2, RISCV_PGSIZE / 2); + + return 0; +} diff --git a/apps/riscv-tests/benchmarks/qsort/dataset1.h b/apps/riscv-tests/benchmarks/qsort/dataset1.h new file mode 100644 index 0000000..dd1c634 --- /dev/null +++ b/apps/riscv-tests/benchmarks/qsort/dataset1.h @@ -0,0 +1,219 @@ +// See LICENSE for license details. + + +#define DATA_SIZE 2048 + +type input_data[DATA_SIZE] = +{ + 89400484, 976015092, 1792756324, 721524505, 1214379246, 3794415, 402845420, 2126940990, 1611680320, 786566648, 754215794, 1231249235, 284658041, 137796456, 2041942843, 329767814, 1255524953, 465119445, 1731949250, 301663421, + 1335861008, 452888789, 14125900, 1231149357, 2002881120, 730845665, 1913581092, 1275331596, 843738737, 1931282005, 1492488573, 490920543, 2066865713, 25885333, 238278880, 1898582764, 250731366, 1612593993, 637659983, 1388759892, + 916073297, 1075762632, 675549432, 937987129, 1417415680, 1508705426, 1663890071, 1746476698, 686797873, 2109530615, 1459500136, 324215873, 1881253854, 1496277718, 810387144, 1212974417, 1020037994, 585169793, 2017191527, 556328195, + 1160036198, 1391095995, 1223583276, 1094283114, 436580096, 190215907, 603159718, 1513255537, 1631935240, 1440145706, 1303736105, 806638567, 1100041120, 1185825535, 1414141069, 2014090929, 419476096, 1273955724, 175753599, 1223475486, + 574236644, 2046759770, 492507266, 1721767511, 726141970, 1256152080, 2029909894, 1382429941, 1939683211, 791188057, 519699747, 1051184301, 1962689485, 706913763, 1776471922, 672906535, 2005817027, 1274190723, 2119425672, 835063788, + 421198539, 1169327477, 2064145552, 1396662140, 1218522465, 2105638337, 754247044, 2143968639, 1395289708, 1750443194, 1412540552, 170281493, 389233190, 448284065, 240618723, 2145930822, 1846605728, 1353999206, 140536987, 1821559709, + 619972089, 1514278798, 750919339, 2143343312, 304427548, 545066288, 1946004194, 1538069400, 1904770864, 924541465, 567779677, 893302687, 1239665569, 1157666831, 2105814934, 1505475223, 1636203720, 9736243, 518073650, 1063743848, + 1029176122, 215018112, 1073871430, 1858933377, 866478506, 1491477359, 477407584, 895562064, 954441852, 638167485, 1550159640, 614612685, 1453397990, 1334857284, 683536723, 168771888, 481561285, 755798022, 2016161810, 1162679490, + 619428858, 1390306889, 256860662, 365275089, 1322281086, 1134185180, 1302724177, 621921213, 837554186, 1711761015, 754896618, 1723143470, 978247260, 1548804416, 598016845, 1631405417, 790929190, 1602517354, 770957259, 198186681, + 1256015513, 2126029304, 135012885, 583112200, 2118203528, 1834388383, 866964848, 1695191950, 745183293, 1143511498, 1112731797, 478721193, 1202162389, 991159735, 1952364329, 519344323, 1667102296, 770412991, 548632788, 714042223, + 1674045273, 1471598258, 1286989824, 1590771096, 308832070, 959354209, 72802865, 670621648, 269167950, 1598436917, 2023498746, 1198213061, 2006856683, 1029832956, 1719009954, 1198254803, 1188748563, 1989240516, 927524181, 1711765426, + 1394929399, 769005536, 2047006719, 1915435344, 618681206, 1431814151, 42021322, 1106678970, 107160610, 1199317660, 185592115, 1870214195, 205008108, 1834318089, 948686793, 946311527, 1262399341, 131405125, 1321897861, 1459138745, + 821481684, 852388468, 603907009, 20643769, 1737931879, 37141933, 2088576982, 366700722, 1761289401, 625991894, 741078359, 817417567, 969305448, 1152416171, 1101933540, 399456957, 2074896270, 1971484382, 747592875, 1160333307, + 1738353358, 2113434968, 1896952705, 1908093581, 1155544307, 117766047, 2034767768, 1316120929, 1507433029, 2045407567, 765386206, 1031625002, 1220915309, 325667019, 1916602098, 16411608, 47463938, 1379995885, 1221108420, 721046824, + 1431492783, 1569479928, 909415369, 204514903, 933673987, 1565700239, 341674967, 602907378, 5309142, 849489374, 180599971, 1480437960, 532467027, 1958396887, 106223060, 1025117441, 935689637, 1752088215, 1704561346, 1568395337, + 1868289345, 569949159, 1045658065, 274746405, 890461390, 507848158, 793505636, 460893030, 1179525294, 388855203, 1113693824, 13887419, 1909681194, 1082499152, 1466632447, 1281443423, 612289854, 373305330, 568652142, 1383640563, + 1073695485, 745777837, 624939139, 1289308008, 1928550562, 148113917, 462743614, 1826880531, 1571598133, 1415390230, 1480273562, 1331593955, 540006359, 261556590, 1690167792, 283430575, 1194709162, 1781233744, 649754857, 1434046375, + 1135793759, 932423857, 1170759710, 1048943084, 692845661, 1620562432, 2036750157, 270410557, 617995659, 1347284277, 1771614266, 30992839, 655445946, 22762734, 1695617313, 867628573, 1577034674, 227870124, 2063408339, 1512163910, + 787913688, 1758748737, 1553547892, 2072440819, 632611704, 873623623, 2097057488, 1879635915, 1404727477, 1840896199, 1609955669, 186112992, 196401930, 130001148, 814302898, 1420810050, 226906236, 1435859758, 221330186, 329049266, + 820933470, 260792255, 1401058771, 210908782, 1774652096, 886978116, 1807085904, 508041515, 767233910, 26687179, 318750634, 910677024, 117260224, 2074840378, 301350822, 464795711, 2053899162, 1335298265, 737518341, 777433215, + 1147341731, 1981481446, 1628389501, 1537459540, 1121432739, 1392162662, 1800522575, 644293952, 1273223611, 1906345724, 28256901, 1467376771, 372465453, 78348530, 135678410, 1061864942, 260267972, 1184561748, 287497702, 1154842325, + 1629914848, 2084953915, 799717076, 1382484003, 2045821218, 933603111, 84924801, 892939912, 279252402, 651750790, 238566180, 942977997, 1822612008, 1849675857, 939497524, 436630343, 549253917, 1028937430, 579174666, 2124749673, + 880456526, 1451442832, 1350653461, 1546104436, 858045289, 2129513521, 1181191604, 727587915, 1619598456, 969076419, 1212628403, 1361078114, 368541415, 333906659, 41714278, 1390274260, 1563717683, 973769771, 1078197595, 918378387, + 1672192305, 1094531762, 92620223, 2125958841, 1620803320, 915948205, 174965839, 27377406, 435236973, 1038830638, 1834161399, 305750851, 330474090, 730422541, 1634445325, 840106059, 767880329, 109526756, 2027814180, 367923081, + 1983379601, 1293091635, 705851791, 226723092, 1067775613, 2082760612, 951663731, 260670135, 1111213862, 1891630185, 1379259015, 176024101, 594814862, 1870859970, 1689946986, 1290969161, 244975305, 1296857499, 1811088032, 1873900475, + 1949896838, 1907793490, 592006699, 1312471120, 509744705, 869853078, 70894786, 503368137, 1686479103, 1602967659, 1214950832, 1131661227, 768185796, 592234826, 1727583308, 949222447, 1760851607, 487888229, 1614780688, 1618378831, + 602368560, 2028116487, 183679578, 1561251584, 986240059, 1525451290, 977907387, 432609664, 1528031307, 116766659, 987761406, 1630293700, 90063199, 114202152, 543952312, 855107605, 812328969, 88823122, 1092881031, 304131252, + 1505022272, 894769708, 1849495275, 1607515830, 1032748996, 472872107, 1593359038, 1027760887, 1074205225, 1657001479, 1524491858, 387061281, 107095939, 1038018856, 798445606, 1486594282, 1878434988, 1558695709, 2033003588, 373226849, + 2133066804, 399991238, 1132597050, 1965358941, 1551661799, 3522194, 935939763, 2070467093, 500734709, 533101409, 1068798385, 998931662, 1500102591, 779093898, 66579049, 1121960111, 749415493, 502323961, 538932155, 259768753, + 753296935, 87897457, 539429964, 1675300017, 1232992084, 420106224, 1685350721, 346598567, 1610244183, 1597506096, 1079859867, 944382193, 1770497338, 764935753, 1776794410, 866854601, 365854486, 304211060, 344860208, 1361012693, + 1450892344, 622170346, 70003859, 1681866717, 435288306, 687941098, 308700094, 1367731096, 1834285819, 255226842, 193873940, 1833603743, 848402819, 152273285, 231181585, 1754447491, 1838218199, 834410115, 229905664, 2052321529, + 338532526, 77482422, 12937811, 35859252, 1645969422, 1501181424, 438711458, 1496078411, 419109342, 1455756978, 1234944834, 1287171290, 470090505, 1900162831, 1130850177, 1772760484, 381571915, 1605369007, 514914429, 994291574, + 1502557594, 1099847920, 1627355806, 1148699143, 1519017268, 946489895, 106595511, 921573402, 181567810, 1575380740, 1719573683, 1561730727, 1920182565, 1510133268, 1102603775, 1175885101, 802730854, 185979744, 1058937717, 1716853034, + 31596852, 462857778, 1335652095, 47036070, 178901145, 1399673078, 222529745, 128036841, 1708126014, 923768127, 1980923963, 1413860940, 1382551511, 208160226, 1892370478, 2091626028, 1793190956, 1417601340, 515811664, 2076612603, + 993525189, 1127173529, 245334962, 134453363, 1206302514, 1344125357, 1139159604, 651536866, 22136821, 1536213818, 2143324534, 879878312, 1944679691, 119285206, 832081018, 1566878909, 876130333, 656954306, 226726100, 937976428, + 1202009920, 1938258683, 2014129292, 1274436639, 1102423908, 1485740112, 879552408, 1712269139, 650513248, 1068587688, 434850545, 382422699, 919736727, 2022291557, 1319798607, 2139976479, 772059719, 1033910502, 1120963974, 340231765, + 1471131758, 1767380006, 47452797, 1313871880, 399114073, 1462921857, 671848647, 31574181, 230340298, 239990424, 590690783, 1714295540, 833019845, 398244682, 522160389, 900852, 1045627895, 1545555937, 226986415, 208433088, + 1502480836, 1611500622, 1933923245, 1588715179, 1655277291, 1749972876, 1386258142, 935490932, 173822937, 702380578, 348131466, 81402251, 875481479, 72939206, 2033828953, 1302272656, 64795664, 2010549018, 1652108025, 58217952, + 1871684562, 190536346, 244709448, 949010757, 320137025, 729474445, 133790520, 740536012, 316479300, 1191513656, 1802197319, 785398708, 1816641611, 2052328978, 930367387, 1374125186, 303845878, 852835634, 454359988, 2131761201, + 1757028186, 536063430, 1765354961, 726869128, 1209784819, 1790557628, 783427298, 2094085507, 1323798820, 846127236, 1065481253, 572240371, 1745543275, 1011417836, 1970797151, 748527394, 343119399, 723323690, 925975225, 901789102, + 1726987516, 535828217, 387611445, 464171383, 1170510314, 1166227930, 1807172811, 1942089394, 985305323, 1368235387, 1691486500, 1568900638, 1876255297, 1249183285, 1710305778, 1763785295, 1733366374, 1444076976, 1629633514, 2105321510, + 225091211, 898893218, 863551327, 1441811554, 546340809, 1977865396, 2116495484, 1221726287, 293109484, 1601617797, 1568176414, 1424797596, 1256372950, 298799048, 1708002892, 829450571, 891710357, 1994402695, 1136264020, 372280769, + 1520667645, 983043723, 1191079043, 680172541, 813511681, 395360213, 1648575360, 1026342885, 2100497812, 422047044, 509116230, 859612092, 2037182006, 895080280, 494367164, 1732028080, 355614494, 2141591317, 1087251698, 580692625, + 225934851, 1581062145, 1515262458, 1497680539, 1711718534, 1774796872, 301673313, 1136356724, 653050943, 109035776, 1709823304, 1340949553, 1365423458, 1155459206, 1203897636, 188016786, 256210446, 633075975, 19227407, 1864952910, + 1143853106, 237020443, 1750197960, 856837002, 80321564, 1679324299, 1257507406, 1390040163, 1590461855, 806384435, 1331383316, 2027828650, 1649392096, 1928309762, 1027758817, 1267173039, 123889599, 95752736, 2060969286, 619461174, + 1686215900, 1817156134, 2118821565, 1596821127, 1800186189, 212821393, 661318748, 1123331233, 146002907, 953877041, 1771924274, 929351822, 2142357746, 356638683, 1610539590, 2001056977, 368889391, 62209567, 1775608361, 992410365, + 1336108161, 696448050, 333820982, 585804640, 1775805177, 809604334, 93191015, 732444124, 1492071476, 1930662128, 174082258, 340442582, 507936866, 362748128, 1607204293, 953383750, 1599876594, 416457166, 571635069, 1356847855, + 267174620, 2011827638, 1572212863, 589049769, 2024853642, 1680251429, 914906004, 398911194, 795915364, 1332467446, 688483428, 628445699, 578787063, 2006320950, 1167207852, 336213879, 1640952769, 1778544166, 1617229086, 190807078, + 1968608155, 2122852959, 31153367, 1353144470, 2196420, 1395155215, 1948121717, 69118708, 2140091269, 2530146, 1740778973, 1601247294, 1205895814, 858150908, 1878253960, 1967705762, 2090543533, 1702425249, 622114437, 1192155877, + 1095403694, 2115445751, 1201124879, 1140728569, 2085323316, 1291025252, 871908043, 863647665, 1245819051, 1468486929, 631022494, 1161580432, 539942311, 1943137808, 1826628136, 259775677, 277497333, 2140756121, 973493986, 1121800211, + 1539560507, 1337406065, 186178768, 482917205, 1459100749, 1924603748, 390743779, 1140008063, 517767440, 1764436465, 722260205, 1400929335, 1706528514, 486165509, 1379460673, 206653795, 3159407, 565150174, 688338919, 1223572435, + 2122262571, 513009937, 1390656632, 271906847, 1622692876, 1313115559, 2061144988, 411864717, 437710825, 513582947, 305489695, 1713188647, 387273799, 1901537567, 644842409, 1231932661, 356672421, 232170581, 1636860706, 302219842, + 2094591332, 1697686200, 1390477985, 1833543700, 1203377492, 50968578, 1332379148, 1514582723, 909273561, 1914809801, 560663378, 1032914339, 1216475831, 113462155, 1165446977, 800591831, 1058677375, 432102601, 2131797509, 1175004233, + 1602827413, 878884686, 446372159, 257728183, 800661980, 1387864976, 2004770236, 999229412, 1428223489, 175843632, 74887898, 630393584, 1147793249, 112648605, 1028529524, 1891904961, 1953919896, 481563348, 436476038, 1601134240, + 72319656, 1581118537, 460420451, 1904576737, 786297537, 359735266, 1918354829, 4031164, 1679777458, 1144017176, 1462192184, 690865719, 1515933932, 363508800, 1480324438, 1044088643, 2036061488, 218671081, 830595166, 381933797, + 108346070, 92271196, 217762975, 1522316172, 1021014457, 1407094080, 857894203, 1968623233, 1459620801, 1345014111, 709651138, 520511102, 2048560397, 1768795266, 1013901419, 1709697877, 1026380990, 1377995642, 1560142576, 542609105, + 1534330971, 528024121, 2015847175, 325324443, 1137511396, 1883999260, 1871060346, 715940689, 167653495, 1292049996, 1172290275, 2018336444, 1951228823, 1666074170, 1834852613, 854475547, 308857120, 502558280, 2105718728, 1624653209, + 514214340, 976063110, 227427283, 912381406, 785989696, 451448729, 212046016, 2068743361, 117280545, 1936668087, 210748671, 1984152603, 945948973, 1409001936, 1644353864, 1139018167, 678475375, 1279061703, 723930558, 195379046, + 1498554338, 999346398, 1665914525, 1473735214, 1561422777, 151416112, 697817760, 1622758049, 607761482, 69889880, 1152335090, 1063657548, 1338090388, 55461678, 1278053582, 837024327, 1914764659, 1049475248, 161502390, 80404202, + 624714335, 879380479, 1066787659, 1375470750, 1561212123, 59384706, 966363087, 2044016080, 1178086274, 1159745061, 291298358, 173062659, 1385675177, 652078020, 1802327778, 1555660285, 623909040, 1579725218, 1649344003, 270814499, + 350182379, 1188076819, 893957771, 534384094, 1057003814, 230634042, 2117880007, 778834747, 250859482, 104637677, 1328272543, 1869264274, 1847908587, 311127477, 506466155, 1808237662, 607471900, 1558244592, 1228817775, 720339756, + 1963053072, 1011473945, 1204992245, 566166447, 419053054, 737377568, 520329478, 1740099311, 1682700783, 1455316979, 2118805956, 729509794, 1565610678, 722347551, 739596391, 882282387, 926200942, 999899279, 1318032594, 122124863, + 1633512617, 1269707634, 380070610, 1043920511, 665601851, 873976891, 717911282, 2135673182, 761851297, 1604330946, 666624765, 513561613, 1504023310, 1128895624, 99511825, 722919148, 1047336724, 550532376, 1082864732, 289686472, + 216557804, 1174587016, 845698678, 1554106660, 577410402, 790256415, 675663963, 2029133999, 161450336, 228960529, 743745539, 1352833750, 2123379476, 852338021, 1291070368, 448708980, 1953450944, 923478775, 827496819, 1126017956, + 197964832, 281317274, 1171925835, 764902582, 595717488, 2129930580, 1437147036, 1447469119, 755554593, 2130879949, 1835203128, 1547662666, 1855359256, 965490116, 672323245, 182598318, 216435361, 1324723894, 1144669754, 454438520, + 1220523503, 1520886946, 1797641070, 1585050246, 797060176, 1821482472, 2128078174, 973367349, 991874801, 679519053, 1961647235, 2094159153, 391321675, 1604357658, 576906032, 1712341869, 344515114, 1122768484, 1659079595, 1328885292, + 48775768, 247448424, 1836119534, 1564061243, 1386366954, 485818381, 37017340, 356546370, 1675494182, 430093707, 1959222232, 1784682542, 1839063567, 1596042792, 295666215, 403378386, 2114587535, 1515528736, 1541546082, 1444048519, + 1215103809, 1687941280, 1546057655, 1905279500, 544899032, 2069178089, 1688652157, 1414160501, 332201519, 631936923, 423299667, 1332937015, 545602285, 310273032, 960982228, 372501343, 1933532372, 1711569347, 11476473, 155845605, + 700725671, 1457464894, 1325083914, 172109594, 664387510, 1705378439, 376781122, 1472567100, 343682568, 1370528050, 265363198, 2079492652, 1803183394, 519194709, 1538391713, 1931493432, 1183464058, 1489699243, 495097609, 801046035, + 177100916, 1292413659, 1348373925, 1550525411, 697685269, 856621012, 1992941115, 1189141368, 221661515, 156760399, 38620214, 375863194, 2078528215, 2103236982, 341987235, 698660475, 381094614, 1201152163, 1275500498, 398211404, + 801610475, 1087556673, 846650758, 1848681194, 1287830283, 1400070607, 1603428054, 1233022905, 810516965, 690710531, 1860435620, 750631050, 1271370220, 860360715, 1189323192, 1913926325, 946425090, 1815408878, 743572345, 1902501708, + 1276205250, 2005653265, 624614472, 2108439398, 1952177514, 964348374, 1171051384, 2126963607, 812288356, 108628319, 980702956, 714456194, 1678967663, 1935271536, 236851791, 1541132933, 1066014062, 1607628402, 1926717418, 954942098, + 1733982669, 14239125, 1506716966, 848141854, 1178260876, 614222093, 731606176, 1512135729, 63244522, 968848252, 1783943137, 1402735006, 1355391150, 1659137391, 1173889730, 1042942541, 1318900244, 1149113346, 2090025563, 1201659316, + 250022739, 1035075488, 674580901, 1090386021, 1943651015, 934048997, 2087660971, 738682048, 1305071296, 91177380, 1708106609, 1685880008, 364589031, 1860839427, 1927367009, 906899219, 1090443335, 892574149, 1969729134, 1874026715, + 927045887, 1159898528, 730296520, 349249331, 317980803, 225908941, 483348027, 1035956563, 241537930, 1279981214, 1247518755, 247447060, 1793747608, 752388169, 288054543, 2073482870, 2039012903, 617768643, 433412593, 499898207, + 1050512245, 331284679, 851322111, 1294873695, 1715379173, 1159675637, 1029338154, 2027445678, 1653332243, 1874855959, 1234157881, 260674360, 1042790263, 1401980800, 730090881, 1745393357, 1550721460, 1607677838, 969500483, 778702716, + 1765830270, 731763278, 1600023202, 1957728250, 690983, 444361278, 1278777407, 1231639101, 597427397, 1087245613, 258177907, 2093472294, 1462778368, 2067100479, 1628387880, 762564955, 1194041213, 1348361229, 1822279764, 1826590258, + 1112056034, 2088786920, 815110420, 1957877704, 1087195269, 881982271, 1945110368, 1656527154, 529233847, 137046551, 522408049, 1880577483, 847255974, 851716534, 925604268, 1037521069, 461527795, 1332620900, 525605961, 1389787451, + 1127911377, 1198857033, 859385989, 706825946, 371790550, 145611377, 655200896, 1900613055, 1333790305, 1101722351, 1278794420, 2089981667, 1150780072, 13180701, 1502266386, 1103013140, 343038558, 1897907456, 1612609979, 1209991461, + 1740783613, 1643991754, 977454680, 787842886, 163362230, 1087742330, 200253206, 1691676526, 360632817, 1787338655, 35595330, 822635252, 1834254978, 1372169786, 1063768444, 973490494, 697866347, 156498369, 169293723, 180549009, + 112035400, 127867199, 241711645, 2004664325, 23288667, 1997381015, 736455241, 1986921372, 1570645300, 2067499753, 1463269859, 148527979, 618168829, 1715279374, 2066440075, 2118433006, 198233440, 1835860030, 1345873587, 1902595458, + 1961619988, 1291438802, 1325008187, 836983022, 1849657867, 500376868, 1599565995, 1705905941, 1600493361, 386733714, 1028820236, 1663100626, 1322696419, 1482983072, 1092382563, 1667679197, 1965855212, 1063839036, 1742032331, 300191208, + 620497725, 503895325, 2094864173, 928179911, 277942057, 1677449797, 1249086623, 799527371, 1180063064, 48311975, 1866094167, 1405763119, 2109851473, 1594621666, 580464203, 1752598186, 1339293088, 922186026, 1403771494, 299505702, + 1345987999, 1298200648, 2128826472, 677220745, 831273447, 741184696, 696188251, 1912065710, 1016469330, 682018288, 353946286, 559509624, 515414188, 1852181952, 407771887, 812094461, 1859683061, 1100089300, 498702377, 653626077, + 765701205, 150878039, 328551896, 77104822, 1775331228, 1835977906, 706357381, 1240287664, 839507573, 1054066034, 1823053058, 701959731, 82879528, 652404808, 866097476, 926939064, 1326017288, 1747861289, 1173840088, 1524006589, + 443704960, 835506582, 5363460, 2068343250, 1683915700, 2080735477, 1913489530, 951256529, 1752318678, 105384223, 1788389051, 1787391786, 1430821640, 540952308, 882484999, 690806365, 202502890, 1593837351, 530093821, 385878401, + 907401151, 378912543, 454746323, 251514112, 1451277631, 1125822965, 21289266, 1642884452, 804368379, 2048205721, 917508270, 1514792012, 139494505, 1143168018, 115016418, 1730333306, 1630776459, 50748643, 1745247524, 1313640711, + 1076198976, 1820281480, 941471466, 806673335, 722162727, 1837280287, 705508794, 2088955494, 510497580, 51692325, 893597382, 1373978529, 1007042224, 685006165, 1471461419, 1555325521, 1215063385, 1424859828, 657251271, 1391827090, + 965562483, 604275115, 1285258674, 341475746, 294191106, 633240394, 1897691227, 1904243956, 823532901, 1577955754, 2016464961, 1862876260, 577384103, 1012611702, 247243083, 636485510, 1952805989, 1447876480, 108021700, 1016615447, + 2047769687, 943871886, 787537653, 12744598, 853545598, 334037304, 553373537, 1089408490, 497867498, 2038925801, 1434633879, 1290629443, 75922980, 957037315, 2130252471, 477317888, 952824381, 1686570783, 459340678, 751885764, + 836307572, 2027909489, 28791588, 322748588, 1335236478, 787106123, 113580144, 954915740, 1317077622, 1299667896, 2009244921, 1548588723, 2049698913, 732388681, 1781891230, 2090684129, 993786972, 1959292396, 1336513734, 691093904, + 1746904676, 935573751, 1123555638, 108413311, 1445352642, 169726789, 123352211, 1635952299, 673775121, 2042861943, 757787251, 512494446, 119656942, 58159196, 2090570016, 486181025, 1619641914, 432990571, 894937325, 379470588, + 1890938638, 1886317932, 1858637614, 969358207, 1230449468, 1890889527, 351741654, 214725897, 1550012286, 308005013, 26292400, 68067591, 1383307838, 1746273091, 1090104632, 1658037573, 2081544705, 1133473813, 1680294422, 1050373352, + 1806061681, 1713475126, 520699193, 417568373, 1355086853, 631399565, 1742434188, 2077667592, 1709019727, 594054971, 937081176, 742185643, 1904514273, 887841601, 1288684086, 424587711, 1497926365, 829844031, 1384314543, 250129297, + 200083737, 693737559, 1527022962, 1462501905, 1687540458, 1156824624, 241481265, 1190890142, 1250360726, 2064308502, 27563032, 1880483834, 1984143440, 104727360, 1324123626, 1089710430, 1403206383, 1930880552, 773197243, 1160186023, + 562994480, 1065136414, 502237764, 1642338733, 1310177444, 1730721241, 1475638246, 615734453, 1160537912, 928836931, 253898558, 1799210492, 1205522527, 413058646, 1589194592, 1774218355, 43955934, 1673314595, 683393460, 1260859787, + 2098829619, 772503535, 1232567659, 758174758, 831270563, 1605294199, 1660678300, 24379565, 1426483935, 1611558740, 1085326591, 12849216, 455856722, 878692218, 1910978116, 1382893830, 1950124297, 950009818, 904287249, 791384486, + 1584408128, 210098472, 1110387095, 364620240, 53868166, 772251062, 472745168, 1133910514, 1715402379, 1445225855, 1541125975, 149171217, 972058766, 1893095488, 1487620835, 640835502, 1470285405, 646688705, 988431201, 703130341, + 1753125385, 1985895474, 696002734, 1783233173, 1317201705, 1755204784, 532132334, 1069450170, 249700039, 524320231, 757959820, 2109052886, 604977130, 1971654864, 1588222158, 1533496974, 623670976, 1405668251, 1955436051, 1082881617, + 1387039848, 874153641, 1345378476, 1168465459, 2005021017, 234039217, 473318229, 654912216, 1473166451, 997649666, 801824335, 2052343947, 1883168929, 185658088, 1389954587, 1725541486, 885873448, 958774566, 2054212564, 60536525, + 1427504270, 1160285859, 1827651881, 1408805003, 1684018729, 61716770, 844057079, 1011596733, 1521350211, 1581801257, 907554175, 2022973269, 1125104871, 1312064004, 1466679625, 970194422, 80900939, 1445279202, 335456148, 510478312, + 92860378, 1646704157, 1650899832, 1533447203, 268087516, 880688023, 1180525723, 1868151949, 1750955971, 401446720, 540093580, 1022861633, 461442838, 1222554291, 456462271, 94760711, 1231111410, 2145073408, 1932108837, 300618464, + 2055783490, 980863365, 1308872551, 1010427073, 1399854717, 1217804021, 934700736, 878744414 +}; + +type verify_data[DATA_SIZE] = +{ + 690983, 900852, 2196420, 2530146, 3159407, 3522194, 3794415, 4031164, 5309142, 5363460, 9736243, 11476473, 12744598, 12849216, 12937811, 13180701, 13887419, 14125900, 14239125, 16411608, + 19227407, 20643769, 21289266, 22136821, 22762734, 23288667, 24379565, 25885333, 26292400, 26687179, 27377406, 27563032, 28256901, 28791588, 30992839, 31153367, 31574181, 31596852, 35595330, 35859252, + 37017340, 37141933, 38620214, 41714278, 42021322, 43955934, 47036070, 47452797, 47463938, 48311975, 48775768, 50748643, 50968578, 51692325, 53868166, 55461678, 58159196, 58217952, 59384706, 60536525, + 61716770, 62209567, 63244522, 64795664, 66579049, 68067591, 69118708, 69889880, 70003859, 70894786, 72319656, 72802865, 72939206, 74887898, 75922980, 77104822, 77482422, 78348530, 80321564, 80404202, + 80900939, 81402251, 82879528, 84924801, 87897457, 88823122, 89400484, 90063199, 91177380, 92271196, 92620223, 92860378, 93191015, 94760711, 95752736, 99511825, 104637677, 104727360, 105384223, 106223060, + 106595511, 107095939, 107160610, 108021700, 108346070, 108413311, 108628319, 109035776, 109526756, 112035400, 112648605, 113462155, 113580144, 114202152, 115016418, 116766659, 117260224, 117280545, 117766047, 119285206, + 119656942, 122124863, 123352211, 123889599, 127867199, 128036841, 130001148, 131405125, 133790520, 134453363, 135012885, 135678410, 137046551, 137796456, 139494505, 140536987, 145611377, 146002907, 148113917, 148527979, + 149171217, 150878039, 151416112, 152273285, 155845605, 156498369, 156760399, 161450336, 161502390, 163362230, 167653495, 168771888, 169293723, 169726789, 170281493, 172109594, 173062659, 173822937, 174082258, 174965839, + 175753599, 175843632, 176024101, 177100916, 178901145, 180549009, 180599971, 181567810, 182598318, 183679578, 185592115, 185658088, 185979744, 186112992, 186178768, 188016786, 190215907, 190536346, 190807078, 193873940, + 195379046, 196401930, 197964832, 198186681, 198233440, 200083737, 200253206, 202502890, 204514903, 205008108, 206653795, 208160226, 208433088, 210098472, 210748671, 210908782, 212046016, 212821393, 214725897, 215018112, + 216435361, 216557804, 217762975, 218671081, 221330186, 221661515, 222529745, 225091211, 225908941, 225934851, 226723092, 226726100, 226906236, 226986415, 227427283, 227870124, 228960529, 229905664, 230340298, 230634042, + 231181585, 232170581, 234039217, 236851791, 237020443, 238278880, 238566180, 239990424, 240618723, 241481265, 241537930, 241711645, 244709448, 244975305, 245334962, 247243083, 247447060, 247448424, 249700039, 250022739, + 250129297, 250731366, 250859482, 251514112, 253898558, 255226842, 256210446, 256860662, 257728183, 258177907, 259768753, 259775677, 260267972, 260670135, 260674360, 260792255, 261556590, 265363198, 267174620, 268087516, + 269167950, 270410557, 270814499, 271906847, 274746405, 277497333, 277942057, 279252402, 281317274, 283430575, 284658041, 287497702, 288054543, 289686472, 291298358, 293109484, 294191106, 295666215, 298799048, 299505702, + 300191208, 300618464, 301350822, 301663421, 301673313, 302219842, 303845878, 304131252, 304211060, 304427548, 305489695, 305750851, 308005013, 308700094, 308832070, 308857120, 310273032, 311127477, 316479300, 317980803, + 318750634, 320137025, 322748588, 324215873, 325324443, 325667019, 328551896, 329049266, 329767814, 330474090, 331284679, 332201519, 333820982, 333906659, 334037304, 335456148, 336213879, 338532526, 340231765, 340442582, + 341475746, 341674967, 341987235, 343038558, 343119399, 343682568, 344515114, 344860208, 346598567, 348131466, 349249331, 350182379, 351741654, 353946286, 355614494, 356546370, 356638683, 356672421, 359735266, 360632817, + 362748128, 363508800, 364589031, 364620240, 365275089, 365854486, 366700722, 367923081, 368541415, 368889391, 371790550, 372280769, 372465453, 372501343, 373226849, 373305330, 375863194, 376781122, 378912543, 379470588, + 380070610, 381094614, 381571915, 381933797, 382422699, 385878401, 386733714, 387061281, 387273799, 387611445, 388855203, 389233190, 390743779, 391321675, 395360213, 398211404, 398244682, 398911194, 399114073, 399456957, + 399991238, 401446720, 402845420, 403378386, 407771887, 411864717, 413058646, 416457166, 417568373, 419053054, 419109342, 419476096, 420106224, 421198539, 422047044, 423299667, 424587711, 430093707, 432102601, 432609664, + 432990571, 433412593, 434850545, 435236973, 435288306, 436476038, 436580096, 436630343, 437710825, 438711458, 443704960, 444361278, 446372159, 448284065, 448708980, 451448729, 452888789, 454359988, 454438520, 454746323, + 455856722, 456462271, 459340678, 460420451, 460893030, 461442838, 461527795, 462743614, 462857778, 464171383, 464795711, 465119445, 470090505, 472745168, 472872107, 473318229, 477317888, 477407584, 478721193, 481561285, + 481563348, 482917205, 483348027, 485818381, 486165509, 486181025, 487888229, 490920543, 492507266, 494367164, 495097609, 497867498, 498702377, 499898207, 500376868, 500734709, 502237764, 502323961, 502558280, 503368137, + 503895325, 506466155, 507848158, 507936866, 508041515, 509116230, 509744705, 510478312, 510497580, 512494446, 513009937, 513561613, 513582947, 514214340, 514914429, 515414188, 515811664, 517767440, 518073650, 519194709, + 519344323, 519699747, 520329478, 520511102, 520699193, 522160389, 522408049, 524320231, 525605961, 528024121, 529233847, 530093821, 532132334, 532467027, 533101409, 534384094, 535828217, 536063430, 538932155, 539429964, + 539942311, 540006359, 540093580, 540952308, 542609105, 543952312, 544899032, 545066288, 545602285, 546340809, 548632788, 549253917, 550532376, 553373537, 556328195, 559509624, 560663378, 562994480, 565150174, 566166447, + 567779677, 568652142, 569949159, 571635069, 572240371, 574236644, 576906032, 577384103, 577410402, 578787063, 579174666, 580464203, 580692625, 583112200, 585169793, 585804640, 589049769, 590690783, 592006699, 592234826, + 594054971, 594814862, 595717488, 597427397, 598016845, 602368560, 602907378, 603159718, 603907009, 604275115, 604977130, 607471900, 607761482, 612289854, 614222093, 614612685, 615734453, 617768643, 617995659, 618168829, + 618681206, 619428858, 619461174, 619972089, 620497725, 621921213, 622114437, 622170346, 623670976, 623909040, 624614472, 624714335, 624939139, 625991894, 628445699, 630393584, 631022494, 631399565, 631936923, 632611704, + 633075975, 633240394, 636485510, 637659983, 638167485, 640835502, 644293952, 644842409, 646688705, 649754857, 650513248, 651536866, 651750790, 652078020, 652404808, 653050943, 653626077, 654912216, 655200896, 655445946, + 656954306, 657251271, 661318748, 664387510, 665601851, 666624765, 670621648, 671848647, 672323245, 672906535, 673775121, 674580901, 675549432, 675663963, 677220745, 678475375, 679519053, 680172541, 682018288, 683393460, + 683536723, 685006165, 686797873, 687941098, 688338919, 688483428, 690710531, 690806365, 690865719, 691093904, 692845661, 693737559, 696002734, 696188251, 696448050, 697685269, 697817760, 697866347, 698660475, 700725671, + 701959731, 702380578, 703130341, 705508794, 705851791, 706357381, 706825946, 706913763, 709651138, 714042223, 714456194, 715940689, 717911282, 720339756, 721046824, 721524505, 722162727, 722260205, 722347551, 722919148, + 723323690, 723930558, 726141970, 726869128, 727587915, 729474445, 729509794, 730090881, 730296520, 730422541, 730845665, 731606176, 731763278, 732388681, 732444124, 736455241, 737377568, 737518341, 738682048, 739596391, + 740536012, 741078359, 741184696, 742185643, 743572345, 743745539, 745183293, 745777837, 747592875, 748527394, 749415493, 750631050, 750919339, 751885764, 752388169, 753296935, 754215794, 754247044, 754896618, 755554593, + 755798022, 757787251, 757959820, 758174758, 761851297, 762564955, 764902582, 764935753, 765386206, 765701205, 767233910, 767880329, 768185796, 769005536, 770412991, 770957259, 772059719, 772251062, 772503535, 773197243, + 777433215, 778702716, 778834747, 779093898, 783427298, 785398708, 785989696, 786297537, 786566648, 787106123, 787537653, 787842886, 787913688, 790256415, 790929190, 791188057, 791384486, 793505636, 795915364, 797060176, + 798445606, 799527371, 799717076, 800591831, 800661980, 801046035, 801610475, 801824335, 802730854, 804368379, 806384435, 806638567, 806673335, 809604334, 810387144, 810516965, 812094461, 812288356, 812328969, 813511681, + 814302898, 815110420, 817417567, 820933470, 821481684, 822635252, 823532901, 827496819, 829450571, 829844031, 830595166, 831270563, 831273447, 832081018, 833019845, 834410115, 835063788, 835506582, 836307572, 836983022, + 837024327, 837554186, 839507573, 840106059, 843738737, 844057079, 845698678, 846127236, 846650758, 847255974, 848141854, 848402819, 849489374, 851322111, 851716534, 852338021, 852388468, 852835634, 853545598, 854475547, + 855107605, 856621012, 856837002, 857894203, 858045289, 858150908, 859385989, 859612092, 860360715, 863551327, 863647665, 866097476, 866478506, 866854601, 866964848, 867628573, 869853078, 871908043, 873623623, 873976891, + 874153641, 875481479, 876130333, 878692218, 878744414, 878884686, 879380479, 879552408, 879878312, 880456526, 880688023, 881982271, 882282387, 882484999, 885873448, 886978116, 887841601, 890461390, 891710357, 892574149, + 892939912, 893302687, 893597382, 893957771, 894769708, 894937325, 895080280, 895562064, 898893218, 901789102, 904287249, 906899219, 907401151, 907554175, 909273561, 909415369, 910677024, 912381406, 914906004, 915948205, + 916073297, 917508270, 918378387, 919736727, 921573402, 922186026, 923478775, 923768127, 924541465, 925604268, 925975225, 926200942, 926939064, 927045887, 927524181, 928179911, 928836931, 929351822, 930367387, 932423857, + 933603111, 933673987, 934048997, 934700736, 935490932, 935573751, 935689637, 935939763, 937081176, 937976428, 937987129, 939497524, 941471466, 942977997, 943871886, 944382193, 945948973, 946311527, 946425090, 946489895, + 948686793, 949010757, 949222447, 950009818, 951256529, 951663731, 952824381, 953383750, 953877041, 954441852, 954915740, 954942098, 957037315, 958774566, 959354209, 960982228, 964348374, 965490116, 965562483, 966363087, + 968848252, 969076419, 969305448, 969358207, 969500483, 970194422, 972058766, 973367349, 973490494, 973493986, 973769771, 976015092, 976063110, 977454680, 977907387, 978247260, 980702956, 980863365, 983043723, 985305323, + 986240059, 987761406, 988431201, 991159735, 991874801, 992410365, 993525189, 993786972, 994291574, 997649666, 998931662, 999229412, 999346398, 999899279, 1007042224, 1010427073, 1011417836, 1011473945, 1011596733, 1012611702, + 1013901419, 1016469330, 1016615447, 1020037994, 1021014457, 1022861633, 1025117441, 1026342885, 1026380990, 1027758817, 1027760887, 1028529524, 1028820236, 1028937430, 1029176122, 1029338154, 1029832956, 1031625002, 1032748996, 1032914339, + 1033910502, 1035075488, 1035956563, 1037521069, 1038018856, 1038830638, 1042790263, 1042942541, 1043920511, 1044088643, 1045627895, 1045658065, 1047336724, 1048943084, 1049475248, 1050373352, 1050512245, 1051184301, 1054066034, 1057003814, + 1058677375, 1058937717, 1061864942, 1063657548, 1063743848, 1063768444, 1063839036, 1065136414, 1065481253, 1066014062, 1066787659, 1067775613, 1068587688, 1068798385, 1069450170, 1073695485, 1073871430, 1074205225, 1075762632, 1076198976, + 1078197595, 1079859867, 1082499152, 1082864732, 1082881617, 1085326591, 1087195269, 1087245613, 1087251698, 1087556673, 1087742330, 1089408490, 1089710430, 1090104632, 1090386021, 1090443335, 1092382563, 1092881031, 1094283114, 1094531762, + 1095403694, 1099847920, 1100041120, 1100089300, 1101722351, 1101933540, 1102423908, 1102603775, 1103013140, 1106678970, 1110387095, 1111213862, 1112056034, 1112731797, 1113693824, 1120963974, 1121432739, 1121800211, 1121960111, 1122768484, + 1123331233, 1123555638, 1125104871, 1125822965, 1126017956, 1127173529, 1127911377, 1128895624, 1130850177, 1131661227, 1132597050, 1133473813, 1133910514, 1134185180, 1135793759, 1136264020, 1136356724, 1137511396, 1139018167, 1139159604, + 1140008063, 1140728569, 1143168018, 1143511498, 1143853106, 1144017176, 1144669754, 1147341731, 1147793249, 1148699143, 1149113346, 1150780072, 1152335090, 1152416171, 1154842325, 1155459206, 1155544307, 1156824624, 1157666831, 1159675637, + 1159745061, 1159898528, 1160036198, 1160186023, 1160285859, 1160333307, 1160537912, 1161580432, 1162679490, 1165446977, 1166227930, 1167207852, 1168465459, 1169327477, 1170510314, 1170759710, 1171051384, 1171925835, 1172290275, 1173840088, + 1173889730, 1174587016, 1175004233, 1175885101, 1178086274, 1178260876, 1179525294, 1180063064, 1180525723, 1181191604, 1183464058, 1184561748, 1185825535, 1188076819, 1188748563, 1189141368, 1189323192, 1190890142, 1191079043, 1191513656, + 1192155877, 1194041213, 1194709162, 1198213061, 1198254803, 1198857033, 1199317660, 1201124879, 1201152163, 1201659316, 1202009920, 1202162389, 1203377492, 1203897636, 1204992245, 1205522527, 1205895814, 1206302514, 1209784819, 1209991461, + 1212628403, 1212974417, 1214379246, 1214950832, 1215063385, 1215103809, 1216475831, 1217804021, 1218522465, 1220523503, 1220915309, 1221108420, 1221726287, 1222554291, 1223475486, 1223572435, 1223583276, 1228817775, 1230449468, 1231111410, + 1231149357, 1231249235, 1231639101, 1231932661, 1232567659, 1232992084, 1233022905, 1234157881, 1234944834, 1239665569, 1240287664, 1245819051, 1247518755, 1249086623, 1249183285, 1250360726, 1255524953, 1256015513, 1256152080, 1256372950, + 1257507406, 1260859787, 1262399341, 1267173039, 1269707634, 1271370220, 1273223611, 1273955724, 1274190723, 1274436639, 1275331596, 1275500498, 1276205250, 1278053582, 1278777407, 1278794420, 1279061703, 1279981214, 1281443423, 1285258674, + 1286989824, 1287171290, 1287830283, 1288684086, 1289308008, 1290629443, 1290969161, 1291025252, 1291070368, 1291438802, 1292049996, 1292413659, 1293091635, 1294873695, 1296857499, 1298200648, 1299667896, 1302272656, 1302724177, 1303736105, + 1305071296, 1308872551, 1310177444, 1312064004, 1312471120, 1313115559, 1313640711, 1313871880, 1316120929, 1317077622, 1317201705, 1318032594, 1318900244, 1319798607, 1321897861, 1322281086, 1322696419, 1323798820, 1324123626, 1324723894, + 1325008187, 1325083914, 1326017288, 1328272543, 1328885292, 1331383316, 1331593955, 1332379148, 1332467446, 1332620900, 1332937015, 1333790305, 1334857284, 1335236478, 1335298265, 1335652095, 1335861008, 1336108161, 1336513734, 1337406065, + 1338090388, 1339293088, 1340949553, 1344125357, 1345014111, 1345378476, 1345873587, 1345987999, 1347284277, 1348361229, 1348373925, 1350653461, 1352833750, 1353144470, 1353999206, 1355086853, 1355391150, 1356847855, 1361012693, 1361078114, + 1365423458, 1367731096, 1368235387, 1370528050, 1372169786, 1373978529, 1374125186, 1375470750, 1377995642, 1379259015, 1379460673, 1379995885, 1382429941, 1382484003, 1382551511, 1382893830, 1383307838, 1383640563, 1384314543, 1385675177, + 1386258142, 1386366954, 1387039848, 1387864976, 1388759892, 1389787451, 1389954587, 1390040163, 1390274260, 1390306889, 1390477985, 1390656632, 1391095995, 1391827090, 1392162662, 1394929399, 1395155215, 1395289708, 1396662140, 1399673078, + 1399854717, 1400070607, 1400929335, 1401058771, 1401980800, 1402735006, 1403206383, 1403771494, 1404727477, 1405668251, 1405763119, 1407094080, 1408805003, 1409001936, 1412540552, 1413860940, 1414141069, 1414160501, 1415390230, 1417415680, + 1417601340, 1420810050, 1424797596, 1424859828, 1426483935, 1427504270, 1428223489, 1430821640, 1431492783, 1431814151, 1434046375, 1434633879, 1435859758, 1437147036, 1440145706, 1441811554, 1444048519, 1444076976, 1445225855, 1445279202, + 1445352642, 1447469119, 1447876480, 1450892344, 1451277631, 1451442832, 1453397990, 1455316979, 1455756978, 1457464894, 1459100749, 1459138745, 1459500136, 1459620801, 1462192184, 1462501905, 1462778368, 1462921857, 1463269859, 1466632447, + 1466679625, 1467376771, 1468486929, 1470285405, 1471131758, 1471461419, 1471598258, 1472567100, 1473166451, 1473735214, 1475638246, 1480273562, 1480324438, 1480437960, 1482983072, 1485740112, 1486594282, 1487620835, 1489699243, 1491477359, + 1492071476, 1492488573, 1496078411, 1496277718, 1497680539, 1497926365, 1498554338, 1500102591, 1501181424, 1502266386, 1502480836, 1502557594, 1504023310, 1505022272, 1505475223, 1506716966, 1507433029, 1508705426, 1510133268, 1512135729, + 1512163910, 1513255537, 1514278798, 1514582723, 1514792012, 1515262458, 1515528736, 1515933932, 1519017268, 1520667645, 1520886946, 1521350211, 1522316172, 1524006589, 1524491858, 1525451290, 1527022962, 1528031307, 1533447203, 1533496974, + 1534330971, 1536213818, 1537459540, 1538069400, 1538391713, 1539560507, 1541125975, 1541132933, 1541546082, 1545555937, 1546057655, 1546104436, 1547662666, 1548588723, 1548804416, 1550012286, 1550159640, 1550525411, 1550721460, 1551661799, + 1553547892, 1554106660, 1555325521, 1555660285, 1558244592, 1558695709, 1560142576, 1561212123, 1561251584, 1561422777, 1561730727, 1563717683, 1564061243, 1565610678, 1565700239, 1566878909, 1568176414, 1568395337, 1568900638, 1569479928, + 1570645300, 1571598133, 1572212863, 1575380740, 1577034674, 1577955754, 1579725218, 1581062145, 1581118537, 1581801257, 1584408128, 1585050246, 1588222158, 1588715179, 1589194592, 1590461855, 1590771096, 1593359038, 1593837351, 1594621666, + 1596042792, 1596821127, 1597506096, 1598436917, 1599565995, 1599876594, 1600023202, 1600493361, 1601134240, 1601247294, 1601617797, 1602517354, 1602827413, 1602967659, 1603428054, 1604330946, 1604357658, 1605294199, 1605369007, 1607204293, + 1607515830, 1607628402, 1607677838, 1609955669, 1610244183, 1610539590, 1611500622, 1611558740, 1611680320, 1612593993, 1612609979, 1614780688, 1617229086, 1618378831, 1619598456, 1619641914, 1620562432, 1620803320, 1622692876, 1622758049, + 1624653209, 1627355806, 1628387880, 1628389501, 1629633514, 1629914848, 1630293700, 1630776459, 1631405417, 1631935240, 1633512617, 1634445325, 1635952299, 1636203720, 1636860706, 1640952769, 1642338733, 1642884452, 1643991754, 1644353864, + 1645969422, 1646704157, 1648575360, 1649344003, 1649392096, 1650899832, 1652108025, 1653332243, 1655277291, 1656527154, 1657001479, 1658037573, 1659079595, 1659137391, 1660678300, 1663100626, 1663890071, 1665914525, 1666074170, 1667102296, + 1667679197, 1672192305, 1673314595, 1674045273, 1675300017, 1675494182, 1677449797, 1678967663, 1679324299, 1679777458, 1680251429, 1680294422, 1681866717, 1682700783, 1683915700, 1684018729, 1685350721, 1685880008, 1686215900, 1686479103, + 1686570783, 1687540458, 1687941280, 1688652157, 1689946986, 1690167792, 1691486500, 1691676526, 1695191950, 1695617313, 1697686200, 1702425249, 1704561346, 1705378439, 1705905941, 1706528514, 1708002892, 1708106609, 1708126014, 1709019727, + 1709697877, 1709823304, 1710305778, 1711569347, 1711718534, 1711761015, 1711765426, 1712269139, 1712341869, 1713188647, 1713475126, 1714295540, 1715279374, 1715379173, 1715402379, 1716853034, 1719009954, 1719573683, 1721767511, 1723143470, + 1725541486, 1726987516, 1727583308, 1730333306, 1730721241, 1731949250, 1732028080, 1733366374, 1733982669, 1737931879, 1738353358, 1740099311, 1740778973, 1740783613, 1742032331, 1742434188, 1745247524, 1745393357, 1745543275, 1746273091, + 1746476698, 1746904676, 1747861289, 1749972876, 1750197960, 1750443194, 1750955971, 1752088215, 1752318678, 1752598186, 1753125385, 1754447491, 1755204784, 1757028186, 1758748737, 1760851607, 1761289401, 1763785295, 1764436465, 1765354961, + 1765830270, 1767380006, 1768795266, 1770497338, 1771614266, 1771924274, 1772760484, 1774218355, 1774652096, 1774796872, 1775331228, 1775608361, 1775805177, 1776471922, 1776794410, 1778544166, 1781233744, 1781891230, 1783233173, 1783943137, + 1784682542, 1787338655, 1787391786, 1788389051, 1790557628, 1792756324, 1793190956, 1793747608, 1797641070, 1799210492, 1800186189, 1800522575, 1802197319, 1802327778, 1803183394, 1806061681, 1807085904, 1807172811, 1808237662, 1811088032, + 1815408878, 1816641611, 1817156134, 1820281480, 1821482472, 1821559709, 1822279764, 1822612008, 1823053058, 1826590258, 1826628136, 1826880531, 1827651881, 1833543700, 1833603743, 1834161399, 1834254978, 1834285819, 1834318089, 1834388383, + 1834852613, 1835203128, 1835860030, 1835977906, 1836119534, 1837280287, 1838218199, 1839063567, 1840896199, 1846605728, 1847908587, 1848681194, 1849495275, 1849657867, 1849675857, 1852181952, 1855359256, 1858637614, 1858933377, 1859683061, + 1860435620, 1860839427, 1862876260, 1864952910, 1866094167, 1868151949, 1868289345, 1869264274, 1870214195, 1870859970, 1871060346, 1871684562, 1873900475, 1874026715, 1874855959, 1876255297, 1878253960, 1878434988, 1879635915, 1880483834, + 1880577483, 1881253854, 1883168929, 1883999260, 1886317932, 1890889527, 1890938638, 1891630185, 1891904961, 1892370478, 1893095488, 1896952705, 1897691227, 1897907456, 1898582764, 1900162831, 1900613055, 1901537567, 1902501708, 1902595458, + 1904243956, 1904514273, 1904576737, 1904770864, 1905279500, 1906345724, 1907793490, 1908093581, 1909681194, 1910978116, 1912065710, 1913489530, 1913581092, 1913926325, 1914764659, 1914809801, 1915435344, 1916602098, 1918354829, 1920182565, + 1924603748, 1926717418, 1927367009, 1928309762, 1928550562, 1930662128, 1930880552, 1931282005, 1931493432, 1932108837, 1933532372, 1933923245, 1935271536, 1936668087, 1938258683, 1939683211, 1942089394, 1943137808, 1943651015, 1944679691, + 1945110368, 1946004194, 1948121717, 1949896838, 1950124297, 1951228823, 1952177514, 1952364329, 1952805989, 1953450944, 1953919896, 1955436051, 1957728250, 1957877704, 1958396887, 1959222232, 1959292396, 1961619988, 1961647235, 1962689485, + 1963053072, 1965358941, 1965855212, 1967705762, 1968608155, 1968623233, 1969729134, 1970797151, 1971484382, 1971654864, 1977865396, 1980923963, 1981481446, 1983379601, 1984143440, 1984152603, 1985895474, 1986921372, 1989240516, 1992941115, + 1994402695, 1997381015, 2001056977, 2002881120, 2004664325, 2004770236, 2005021017, 2005653265, 2005817027, 2006320950, 2006856683, 2009244921, 2010549018, 2011827638, 2014090929, 2014129292, 2015847175, 2016161810, 2016464961, 2017191527, + 2018336444, 2022291557, 2022973269, 2023498746, 2024853642, 2027445678, 2027814180, 2027828650, 2027909489, 2028116487, 2029133999, 2029909894, 2033003588, 2033828953, 2034767768, 2036061488, 2036750157, 2037182006, 2038925801, 2039012903, + 2041942843, 2042861943, 2044016080, 2045407567, 2045821218, 2046759770, 2047006719, 2047769687, 2048205721, 2048560397, 2049698913, 2052321529, 2052328978, 2052343947, 2053899162, 2054212564, 2055783490, 2060969286, 2061144988, 2063408339, + 2064145552, 2064308502, 2066440075, 2066865713, 2067100479, 2067499753, 2068343250, 2068743361, 2069178089, 2070467093, 2072440819, 2073482870, 2074840378, 2074896270, 2076612603, 2077667592, 2078528215, 2079492652, 2080735477, 2081544705, + 2082760612, 2084953915, 2085323316, 2087660971, 2088576982, 2088786920, 2088955494, 2089981667, 2090025563, 2090543533, 2090570016, 2090684129, 2091626028, 2093472294, 2094085507, 2094159153, 2094591332, 2094864173, 2097057488, 2098829619, + 2100497812, 2103236982, 2105321510, 2105638337, 2105718728, 2105814934, 2108439398, 2109052886, 2109530615, 2109851473, 2113434968, 2114587535, 2115445751, 2116495484, 2117880007, 2118203528, 2118433006, 2118805956, 2118821565, 2119425672, + 2122262571, 2122852959, 2123379476, 2124749673, 2125958841, 2126029304, 2126940990, 2126963607, 2128078174, 2128826472, 2129513521, 2129930580, 2130252471, 2130879949, 2131761201, 2131797509, 2133066804, 2135673182, 2139976479, 2140091269, + 2140756121, 2141591317, 2142357746, 2143324534, 2143343312, 2143968639, 2145073408, 2145930822 +}; + diff --git a/apps/riscv-tests/benchmarks/qsort/qsort_gendata.pl b/apps/riscv-tests/benchmarks/qsort/qsort_gendata.pl new file mode 100755 index 0000000..92fc8fa --- /dev/null +++ b/apps/riscv-tests/benchmarks/qsort/qsort_gendata.pl @@ -0,0 +1,132 @@ +#!/usr/bin/perl -w +#========================================================================== +# qsort_gendata.pl +# +# Author : Christopher Batten (cbatten@mit.edu) +# Date : April 29, 2005 +# +(our $usageMsg = <<'ENDMSG') =~ s/^\#//gm; +# +# Simple script which creates an input data set and the reference data +# for the qsort benchmark. +# +ENDMSG + +use strict "vars"; +use warnings; +no warnings("once"); +use Getopt::Long; + +#-------------------------------------------------------------------------- +# Command line processing +#-------------------------------------------------------------------------- + +our %opts; + +sub usage() +{ + + print "\n"; + print " Usage: qsort_gendata.pl [options] \n"; + print "\n"; + print " Options:\n"; + print " --help print this message\n"; + print " --size size of input data [250]\n"; + print " --seed random seed [1]\n"; + print "$usageMsg"; + + exit(); +} + +sub processCommandLine() +{ + + $opts{"help"} = 0; + $opts{"size"} = 250; + $opts{"seed"} = 1; + Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage(); + $opts{"help"} and usage(); + +} + +#-------------------------------------------------------------------------- +# Helper Functions +#-------------------------------------------------------------------------- + +sub printArray +{ + my $arrayName = $_[0]; + my $arrayRef = $_[1]; + + my $numCols = 20; + my $arrayLen = scalar(@{$arrayRef}); + + print "type ".$arrayName."[DATA_SIZE] = \n"; + print "{\n"; + + if ( $arrayLen <= $numCols ) { + print " "; + for ( my $i = 0; $i < $arrayLen; $i++ ) { + print sprintf("%3d",$arrayRef->[$i]); + if ( $i != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + else { + my $numRows = int($arrayLen/$numCols); + for ( my $j = 0; $j < $numRows; $j++ ) { + print " "; + for ( my $i = 0; $i < $numCols; $i++ ) { + my $index = $j*$numCols + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + if ( $arrayLen > ($numRows*$numCols) ) { + print " "; + for ( my $i = 0; $i < ($arrayLen-($numRows*$numCols)); $i++ ) { + my $index = $numCols*$numRows + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + } + + print "};\n\n"; +} + +#-------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------- + +sub main() +{ + + processCommandLine(); + srand($opts{"seed"}); + + my @values; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + push( @values, int(rand((1<<31)-1)) ); + } + my @sorted = sort { $a <=> $b } @values; + + print "\n\#define DATA_SIZE ".$opts{"size"}." \n\n"; + printArray( "input_data", \@values ); + printArray( "verify_data", \@sorted ); + +} + +main(); + diff --git a/apps/riscv-tests/benchmarks/qsort/qsort_main.c b/apps/riscv-tests/benchmarks/qsort/qsort_main.c new file mode 100644 index 0000000..18adc25 --- /dev/null +++ b/apps/riscv-tests/benchmarks/qsort/qsort_main.c @@ -0,0 +1,153 @@ +// See LICENSE for license details. + +//************************************************************************** +// Quicksort benchmark +//-------------------------------------------------------------------------- +// +// This benchmark uses quicksort to sort an array of integers. The +// implementation is largely adapted from Numerical Recipes for C. The +// input data (and reference data) should be generated using the +// qsort_gendata.pl perl script and dumped to a file named +// dataset1.h. + +#include "util.h" +#include +#include + +// The INSERTION_THRESHOLD is the size of the subarray when the +// algorithm switches to using an insertion sort instead of +// quick sort. + +#define INSERTION_THRESHOLD 10 + +// NSTACK is the required auxiliary storage. +// It must be at least 2*lg(DATA_SIZE) + +#define NSTACK 50 + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#define type int +#include "dataset1.h" + +// Swap macro for swapping two values. + +#define SWAP(a,b) do { typeof(a) temp=(a);(a)=(b);(b)=temp; } while (0) +#define SWAP_IF_GREATER(a, b) do { if ((a) > (b)) SWAP(a, b); } while (0) + +//-------------------------------------------------------------------------- +// Quicksort function + +static void insertion_sort(size_t n, type arr[]) +{ + type *i, *j; + type value; + for (i = arr+1; i < arr+n; i++) + { + value = *i; + j = i; + while (value < *(j-1)) + { + *j = *(j-1); + if (--j == arr) + break; + } + *j = value; + } +} + +static void selection_sort(size_t n, type arr[]) +{ + for (type* i = arr; i < arr+n-1; i++) + for (type* j = i+1; j < arr+n; j++) + SWAP_IF_GREATER(*i, *j); +} + +void sort(size_t n, type arr[]) +{ + type* ir = arr+n; + type* l = arr+1; + type* stack[NSTACK]; + type** stackp = stack; + + for (;;) + { + // Insertion sort when subarray small enough. + if ( ir-l < INSERTION_THRESHOLD ) + { + insertion_sort(ir - l + 1, l - 1); + + if ( stackp == stack ) break; + + // Pop stack and begin a new round of partitioning. + ir = *stackp--; + l = *stackp--; + } + else + { + // Choose median of left, center, and right elements as + // partitioning element a. Also rearrange so that a[l-1] <= a[l] <= a[ir-]. + SWAP(arr[((l-arr) + (ir-arr))/2-1], l[0]); + SWAP_IF_GREATER(l[-1], ir[-1]); + SWAP_IF_GREATER(l[0], ir[-1]); + SWAP_IF_GREATER(l[-1], l[0]); + + // Initialize pointers for partitioning. + type* i = l+1; + type* j = ir; + + // Partitioning element. + type a = l[0]; + + for (;;) { // Beginning of innermost loop. + while (*i++ < a); // Scan up to find element > a. + while (*(j-- - 2) > a); // Scan down to find element < a. + if (j < i) break; // Pointers crossed. Partitioning complete. + SWAP(i[-1], j[-1]); // Exchange elements. + } // End of innermost loop. + + // Insert partitioning element. + l[0] = j[-1]; + j[-1] = a; + stackp += 2; + + // Push pointers to larger subarray on stack, + // process smaller subarray immediately. + + if ( ir-i+1 >= j-l ) + { + stackp[0] = ir; + stackp[-1] = i; + ir = j-1; + } + else + { + stackp[0] = j-1; + stackp[-1] = l; + l = i; + } + } + } +} + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ +#if PREALLOCATE + // If needed we preallocate everything in the caches + sort(DATA_SIZE, verify_data); + if (verify(DATA_SIZE, input_data, input_data)) + return 1; +#endif + + // Do the sort + setStats(1); + sort( DATA_SIZE, input_data ); + setStats(0); + + // Check the results + return verify( DATA_SIZE, input_data, verify_data ); +} diff --git a/apps/riscv-tests/benchmarks/readme.txt b/apps/riscv-tests/benchmarks/readme.txt new file mode 100644 index 0000000..d90fe2d --- /dev/null +++ b/apps/riscv-tests/benchmarks/readme.txt @@ -0,0 +1,48 @@ +************************************************************************* +Benchmarks for RISCV Processor +------------------------------------------------------------------------- + +The benchmarks make use of the RISCV C compiler toolchain. You will need +to include a bmark.mk makefile fragment in each benchmark directory. The +fragment should include the object files and a rule to actually link +these object files into an executable. There are a couple important +points to make about the toolchain. + + + The toolchain sets the stack pointer to memory address 0x20000 so your + main memory _must_ be larger than 0x20000 bytes or else the stack will + get wrapped around and overwrite program data. + + + The stack grows down from 0x20000 and your program is loaded at 0x1000. + If you have a very large program and have lots of very big arrays + declared on the stack your stack could overwrite your program. Be aware. + + + You cannot use standard clib functions (like memcopy or strcat). You + cannot use system calls and thus cannot use printf. + + + You cannot access the simulated command line - ie you cannot use argc + and argv within main. + + + You may have to increase the timeout check in your test harness to + allow longer programs to run (you can do this from the command line + option +max-cycles with the standard test harness) + + + The compiler loads the program at 0x1000. It does not insert exception + setup code. So if you are careful with what C you use it will only + generate code in the riscv lab1 subset. If you use multiplies, shorts, + and chars it could generate mul, lh, and lb instructions. Be aware. + + + You can write assembly in C - you need to do this to write tohost to 1 + to indicate when the benchmark is done. Look at the example + benchmarks to see how this is done. You can find more information + about how to write assembly in C here: + http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html + + + Debugging C compiled code on the RISCV processor is a real pain. It is + hard to associate the assembly with the C code and there is no + debugger. So if you encounter a bug in your processor when running a C + benchmark you can try to debug it, but you might have better luck + adding more assembly tests to your test suite. + + + To avoid having the compiler try and use a global pointer (ie using + register 28 to point to a space where small global variables are + stored) you need to use the -G 0 command line option. diff --git a/apps/riscv-tests/benchmarks/rsort/dataset1.h b/apps/riscv-tests/benchmarks/rsort/dataset1.h new file mode 100644 index 0000000..dd1c634 --- /dev/null +++ b/apps/riscv-tests/benchmarks/rsort/dataset1.h @@ -0,0 +1,219 @@ +// See LICENSE for license details. + + +#define DATA_SIZE 2048 + +type input_data[DATA_SIZE] = +{ + 89400484, 976015092, 1792756324, 721524505, 1214379246, 3794415, 402845420, 2126940990, 1611680320, 786566648, 754215794, 1231249235, 284658041, 137796456, 2041942843, 329767814, 1255524953, 465119445, 1731949250, 301663421, + 1335861008, 452888789, 14125900, 1231149357, 2002881120, 730845665, 1913581092, 1275331596, 843738737, 1931282005, 1492488573, 490920543, 2066865713, 25885333, 238278880, 1898582764, 250731366, 1612593993, 637659983, 1388759892, + 916073297, 1075762632, 675549432, 937987129, 1417415680, 1508705426, 1663890071, 1746476698, 686797873, 2109530615, 1459500136, 324215873, 1881253854, 1496277718, 810387144, 1212974417, 1020037994, 585169793, 2017191527, 556328195, + 1160036198, 1391095995, 1223583276, 1094283114, 436580096, 190215907, 603159718, 1513255537, 1631935240, 1440145706, 1303736105, 806638567, 1100041120, 1185825535, 1414141069, 2014090929, 419476096, 1273955724, 175753599, 1223475486, + 574236644, 2046759770, 492507266, 1721767511, 726141970, 1256152080, 2029909894, 1382429941, 1939683211, 791188057, 519699747, 1051184301, 1962689485, 706913763, 1776471922, 672906535, 2005817027, 1274190723, 2119425672, 835063788, + 421198539, 1169327477, 2064145552, 1396662140, 1218522465, 2105638337, 754247044, 2143968639, 1395289708, 1750443194, 1412540552, 170281493, 389233190, 448284065, 240618723, 2145930822, 1846605728, 1353999206, 140536987, 1821559709, + 619972089, 1514278798, 750919339, 2143343312, 304427548, 545066288, 1946004194, 1538069400, 1904770864, 924541465, 567779677, 893302687, 1239665569, 1157666831, 2105814934, 1505475223, 1636203720, 9736243, 518073650, 1063743848, + 1029176122, 215018112, 1073871430, 1858933377, 866478506, 1491477359, 477407584, 895562064, 954441852, 638167485, 1550159640, 614612685, 1453397990, 1334857284, 683536723, 168771888, 481561285, 755798022, 2016161810, 1162679490, + 619428858, 1390306889, 256860662, 365275089, 1322281086, 1134185180, 1302724177, 621921213, 837554186, 1711761015, 754896618, 1723143470, 978247260, 1548804416, 598016845, 1631405417, 790929190, 1602517354, 770957259, 198186681, + 1256015513, 2126029304, 135012885, 583112200, 2118203528, 1834388383, 866964848, 1695191950, 745183293, 1143511498, 1112731797, 478721193, 1202162389, 991159735, 1952364329, 519344323, 1667102296, 770412991, 548632788, 714042223, + 1674045273, 1471598258, 1286989824, 1590771096, 308832070, 959354209, 72802865, 670621648, 269167950, 1598436917, 2023498746, 1198213061, 2006856683, 1029832956, 1719009954, 1198254803, 1188748563, 1989240516, 927524181, 1711765426, + 1394929399, 769005536, 2047006719, 1915435344, 618681206, 1431814151, 42021322, 1106678970, 107160610, 1199317660, 185592115, 1870214195, 205008108, 1834318089, 948686793, 946311527, 1262399341, 131405125, 1321897861, 1459138745, + 821481684, 852388468, 603907009, 20643769, 1737931879, 37141933, 2088576982, 366700722, 1761289401, 625991894, 741078359, 817417567, 969305448, 1152416171, 1101933540, 399456957, 2074896270, 1971484382, 747592875, 1160333307, + 1738353358, 2113434968, 1896952705, 1908093581, 1155544307, 117766047, 2034767768, 1316120929, 1507433029, 2045407567, 765386206, 1031625002, 1220915309, 325667019, 1916602098, 16411608, 47463938, 1379995885, 1221108420, 721046824, + 1431492783, 1569479928, 909415369, 204514903, 933673987, 1565700239, 341674967, 602907378, 5309142, 849489374, 180599971, 1480437960, 532467027, 1958396887, 106223060, 1025117441, 935689637, 1752088215, 1704561346, 1568395337, + 1868289345, 569949159, 1045658065, 274746405, 890461390, 507848158, 793505636, 460893030, 1179525294, 388855203, 1113693824, 13887419, 1909681194, 1082499152, 1466632447, 1281443423, 612289854, 373305330, 568652142, 1383640563, + 1073695485, 745777837, 624939139, 1289308008, 1928550562, 148113917, 462743614, 1826880531, 1571598133, 1415390230, 1480273562, 1331593955, 540006359, 261556590, 1690167792, 283430575, 1194709162, 1781233744, 649754857, 1434046375, + 1135793759, 932423857, 1170759710, 1048943084, 692845661, 1620562432, 2036750157, 270410557, 617995659, 1347284277, 1771614266, 30992839, 655445946, 22762734, 1695617313, 867628573, 1577034674, 227870124, 2063408339, 1512163910, + 787913688, 1758748737, 1553547892, 2072440819, 632611704, 873623623, 2097057488, 1879635915, 1404727477, 1840896199, 1609955669, 186112992, 196401930, 130001148, 814302898, 1420810050, 226906236, 1435859758, 221330186, 329049266, + 820933470, 260792255, 1401058771, 210908782, 1774652096, 886978116, 1807085904, 508041515, 767233910, 26687179, 318750634, 910677024, 117260224, 2074840378, 301350822, 464795711, 2053899162, 1335298265, 737518341, 777433215, + 1147341731, 1981481446, 1628389501, 1537459540, 1121432739, 1392162662, 1800522575, 644293952, 1273223611, 1906345724, 28256901, 1467376771, 372465453, 78348530, 135678410, 1061864942, 260267972, 1184561748, 287497702, 1154842325, + 1629914848, 2084953915, 799717076, 1382484003, 2045821218, 933603111, 84924801, 892939912, 279252402, 651750790, 238566180, 942977997, 1822612008, 1849675857, 939497524, 436630343, 549253917, 1028937430, 579174666, 2124749673, + 880456526, 1451442832, 1350653461, 1546104436, 858045289, 2129513521, 1181191604, 727587915, 1619598456, 969076419, 1212628403, 1361078114, 368541415, 333906659, 41714278, 1390274260, 1563717683, 973769771, 1078197595, 918378387, + 1672192305, 1094531762, 92620223, 2125958841, 1620803320, 915948205, 174965839, 27377406, 435236973, 1038830638, 1834161399, 305750851, 330474090, 730422541, 1634445325, 840106059, 767880329, 109526756, 2027814180, 367923081, + 1983379601, 1293091635, 705851791, 226723092, 1067775613, 2082760612, 951663731, 260670135, 1111213862, 1891630185, 1379259015, 176024101, 594814862, 1870859970, 1689946986, 1290969161, 244975305, 1296857499, 1811088032, 1873900475, + 1949896838, 1907793490, 592006699, 1312471120, 509744705, 869853078, 70894786, 503368137, 1686479103, 1602967659, 1214950832, 1131661227, 768185796, 592234826, 1727583308, 949222447, 1760851607, 487888229, 1614780688, 1618378831, + 602368560, 2028116487, 183679578, 1561251584, 986240059, 1525451290, 977907387, 432609664, 1528031307, 116766659, 987761406, 1630293700, 90063199, 114202152, 543952312, 855107605, 812328969, 88823122, 1092881031, 304131252, + 1505022272, 894769708, 1849495275, 1607515830, 1032748996, 472872107, 1593359038, 1027760887, 1074205225, 1657001479, 1524491858, 387061281, 107095939, 1038018856, 798445606, 1486594282, 1878434988, 1558695709, 2033003588, 373226849, + 2133066804, 399991238, 1132597050, 1965358941, 1551661799, 3522194, 935939763, 2070467093, 500734709, 533101409, 1068798385, 998931662, 1500102591, 779093898, 66579049, 1121960111, 749415493, 502323961, 538932155, 259768753, + 753296935, 87897457, 539429964, 1675300017, 1232992084, 420106224, 1685350721, 346598567, 1610244183, 1597506096, 1079859867, 944382193, 1770497338, 764935753, 1776794410, 866854601, 365854486, 304211060, 344860208, 1361012693, + 1450892344, 622170346, 70003859, 1681866717, 435288306, 687941098, 308700094, 1367731096, 1834285819, 255226842, 193873940, 1833603743, 848402819, 152273285, 231181585, 1754447491, 1838218199, 834410115, 229905664, 2052321529, + 338532526, 77482422, 12937811, 35859252, 1645969422, 1501181424, 438711458, 1496078411, 419109342, 1455756978, 1234944834, 1287171290, 470090505, 1900162831, 1130850177, 1772760484, 381571915, 1605369007, 514914429, 994291574, + 1502557594, 1099847920, 1627355806, 1148699143, 1519017268, 946489895, 106595511, 921573402, 181567810, 1575380740, 1719573683, 1561730727, 1920182565, 1510133268, 1102603775, 1175885101, 802730854, 185979744, 1058937717, 1716853034, + 31596852, 462857778, 1335652095, 47036070, 178901145, 1399673078, 222529745, 128036841, 1708126014, 923768127, 1980923963, 1413860940, 1382551511, 208160226, 1892370478, 2091626028, 1793190956, 1417601340, 515811664, 2076612603, + 993525189, 1127173529, 245334962, 134453363, 1206302514, 1344125357, 1139159604, 651536866, 22136821, 1536213818, 2143324534, 879878312, 1944679691, 119285206, 832081018, 1566878909, 876130333, 656954306, 226726100, 937976428, + 1202009920, 1938258683, 2014129292, 1274436639, 1102423908, 1485740112, 879552408, 1712269139, 650513248, 1068587688, 434850545, 382422699, 919736727, 2022291557, 1319798607, 2139976479, 772059719, 1033910502, 1120963974, 340231765, + 1471131758, 1767380006, 47452797, 1313871880, 399114073, 1462921857, 671848647, 31574181, 230340298, 239990424, 590690783, 1714295540, 833019845, 398244682, 522160389, 900852, 1045627895, 1545555937, 226986415, 208433088, + 1502480836, 1611500622, 1933923245, 1588715179, 1655277291, 1749972876, 1386258142, 935490932, 173822937, 702380578, 348131466, 81402251, 875481479, 72939206, 2033828953, 1302272656, 64795664, 2010549018, 1652108025, 58217952, + 1871684562, 190536346, 244709448, 949010757, 320137025, 729474445, 133790520, 740536012, 316479300, 1191513656, 1802197319, 785398708, 1816641611, 2052328978, 930367387, 1374125186, 303845878, 852835634, 454359988, 2131761201, + 1757028186, 536063430, 1765354961, 726869128, 1209784819, 1790557628, 783427298, 2094085507, 1323798820, 846127236, 1065481253, 572240371, 1745543275, 1011417836, 1970797151, 748527394, 343119399, 723323690, 925975225, 901789102, + 1726987516, 535828217, 387611445, 464171383, 1170510314, 1166227930, 1807172811, 1942089394, 985305323, 1368235387, 1691486500, 1568900638, 1876255297, 1249183285, 1710305778, 1763785295, 1733366374, 1444076976, 1629633514, 2105321510, + 225091211, 898893218, 863551327, 1441811554, 546340809, 1977865396, 2116495484, 1221726287, 293109484, 1601617797, 1568176414, 1424797596, 1256372950, 298799048, 1708002892, 829450571, 891710357, 1994402695, 1136264020, 372280769, + 1520667645, 983043723, 1191079043, 680172541, 813511681, 395360213, 1648575360, 1026342885, 2100497812, 422047044, 509116230, 859612092, 2037182006, 895080280, 494367164, 1732028080, 355614494, 2141591317, 1087251698, 580692625, + 225934851, 1581062145, 1515262458, 1497680539, 1711718534, 1774796872, 301673313, 1136356724, 653050943, 109035776, 1709823304, 1340949553, 1365423458, 1155459206, 1203897636, 188016786, 256210446, 633075975, 19227407, 1864952910, + 1143853106, 237020443, 1750197960, 856837002, 80321564, 1679324299, 1257507406, 1390040163, 1590461855, 806384435, 1331383316, 2027828650, 1649392096, 1928309762, 1027758817, 1267173039, 123889599, 95752736, 2060969286, 619461174, + 1686215900, 1817156134, 2118821565, 1596821127, 1800186189, 212821393, 661318748, 1123331233, 146002907, 953877041, 1771924274, 929351822, 2142357746, 356638683, 1610539590, 2001056977, 368889391, 62209567, 1775608361, 992410365, + 1336108161, 696448050, 333820982, 585804640, 1775805177, 809604334, 93191015, 732444124, 1492071476, 1930662128, 174082258, 340442582, 507936866, 362748128, 1607204293, 953383750, 1599876594, 416457166, 571635069, 1356847855, + 267174620, 2011827638, 1572212863, 589049769, 2024853642, 1680251429, 914906004, 398911194, 795915364, 1332467446, 688483428, 628445699, 578787063, 2006320950, 1167207852, 336213879, 1640952769, 1778544166, 1617229086, 190807078, + 1968608155, 2122852959, 31153367, 1353144470, 2196420, 1395155215, 1948121717, 69118708, 2140091269, 2530146, 1740778973, 1601247294, 1205895814, 858150908, 1878253960, 1967705762, 2090543533, 1702425249, 622114437, 1192155877, + 1095403694, 2115445751, 1201124879, 1140728569, 2085323316, 1291025252, 871908043, 863647665, 1245819051, 1468486929, 631022494, 1161580432, 539942311, 1943137808, 1826628136, 259775677, 277497333, 2140756121, 973493986, 1121800211, + 1539560507, 1337406065, 186178768, 482917205, 1459100749, 1924603748, 390743779, 1140008063, 517767440, 1764436465, 722260205, 1400929335, 1706528514, 486165509, 1379460673, 206653795, 3159407, 565150174, 688338919, 1223572435, + 2122262571, 513009937, 1390656632, 271906847, 1622692876, 1313115559, 2061144988, 411864717, 437710825, 513582947, 305489695, 1713188647, 387273799, 1901537567, 644842409, 1231932661, 356672421, 232170581, 1636860706, 302219842, + 2094591332, 1697686200, 1390477985, 1833543700, 1203377492, 50968578, 1332379148, 1514582723, 909273561, 1914809801, 560663378, 1032914339, 1216475831, 113462155, 1165446977, 800591831, 1058677375, 432102601, 2131797509, 1175004233, + 1602827413, 878884686, 446372159, 257728183, 800661980, 1387864976, 2004770236, 999229412, 1428223489, 175843632, 74887898, 630393584, 1147793249, 112648605, 1028529524, 1891904961, 1953919896, 481563348, 436476038, 1601134240, + 72319656, 1581118537, 460420451, 1904576737, 786297537, 359735266, 1918354829, 4031164, 1679777458, 1144017176, 1462192184, 690865719, 1515933932, 363508800, 1480324438, 1044088643, 2036061488, 218671081, 830595166, 381933797, + 108346070, 92271196, 217762975, 1522316172, 1021014457, 1407094080, 857894203, 1968623233, 1459620801, 1345014111, 709651138, 520511102, 2048560397, 1768795266, 1013901419, 1709697877, 1026380990, 1377995642, 1560142576, 542609105, + 1534330971, 528024121, 2015847175, 325324443, 1137511396, 1883999260, 1871060346, 715940689, 167653495, 1292049996, 1172290275, 2018336444, 1951228823, 1666074170, 1834852613, 854475547, 308857120, 502558280, 2105718728, 1624653209, + 514214340, 976063110, 227427283, 912381406, 785989696, 451448729, 212046016, 2068743361, 117280545, 1936668087, 210748671, 1984152603, 945948973, 1409001936, 1644353864, 1139018167, 678475375, 1279061703, 723930558, 195379046, + 1498554338, 999346398, 1665914525, 1473735214, 1561422777, 151416112, 697817760, 1622758049, 607761482, 69889880, 1152335090, 1063657548, 1338090388, 55461678, 1278053582, 837024327, 1914764659, 1049475248, 161502390, 80404202, + 624714335, 879380479, 1066787659, 1375470750, 1561212123, 59384706, 966363087, 2044016080, 1178086274, 1159745061, 291298358, 173062659, 1385675177, 652078020, 1802327778, 1555660285, 623909040, 1579725218, 1649344003, 270814499, + 350182379, 1188076819, 893957771, 534384094, 1057003814, 230634042, 2117880007, 778834747, 250859482, 104637677, 1328272543, 1869264274, 1847908587, 311127477, 506466155, 1808237662, 607471900, 1558244592, 1228817775, 720339756, + 1963053072, 1011473945, 1204992245, 566166447, 419053054, 737377568, 520329478, 1740099311, 1682700783, 1455316979, 2118805956, 729509794, 1565610678, 722347551, 739596391, 882282387, 926200942, 999899279, 1318032594, 122124863, + 1633512617, 1269707634, 380070610, 1043920511, 665601851, 873976891, 717911282, 2135673182, 761851297, 1604330946, 666624765, 513561613, 1504023310, 1128895624, 99511825, 722919148, 1047336724, 550532376, 1082864732, 289686472, + 216557804, 1174587016, 845698678, 1554106660, 577410402, 790256415, 675663963, 2029133999, 161450336, 228960529, 743745539, 1352833750, 2123379476, 852338021, 1291070368, 448708980, 1953450944, 923478775, 827496819, 1126017956, + 197964832, 281317274, 1171925835, 764902582, 595717488, 2129930580, 1437147036, 1447469119, 755554593, 2130879949, 1835203128, 1547662666, 1855359256, 965490116, 672323245, 182598318, 216435361, 1324723894, 1144669754, 454438520, + 1220523503, 1520886946, 1797641070, 1585050246, 797060176, 1821482472, 2128078174, 973367349, 991874801, 679519053, 1961647235, 2094159153, 391321675, 1604357658, 576906032, 1712341869, 344515114, 1122768484, 1659079595, 1328885292, + 48775768, 247448424, 1836119534, 1564061243, 1386366954, 485818381, 37017340, 356546370, 1675494182, 430093707, 1959222232, 1784682542, 1839063567, 1596042792, 295666215, 403378386, 2114587535, 1515528736, 1541546082, 1444048519, + 1215103809, 1687941280, 1546057655, 1905279500, 544899032, 2069178089, 1688652157, 1414160501, 332201519, 631936923, 423299667, 1332937015, 545602285, 310273032, 960982228, 372501343, 1933532372, 1711569347, 11476473, 155845605, + 700725671, 1457464894, 1325083914, 172109594, 664387510, 1705378439, 376781122, 1472567100, 343682568, 1370528050, 265363198, 2079492652, 1803183394, 519194709, 1538391713, 1931493432, 1183464058, 1489699243, 495097609, 801046035, + 177100916, 1292413659, 1348373925, 1550525411, 697685269, 856621012, 1992941115, 1189141368, 221661515, 156760399, 38620214, 375863194, 2078528215, 2103236982, 341987235, 698660475, 381094614, 1201152163, 1275500498, 398211404, + 801610475, 1087556673, 846650758, 1848681194, 1287830283, 1400070607, 1603428054, 1233022905, 810516965, 690710531, 1860435620, 750631050, 1271370220, 860360715, 1189323192, 1913926325, 946425090, 1815408878, 743572345, 1902501708, + 1276205250, 2005653265, 624614472, 2108439398, 1952177514, 964348374, 1171051384, 2126963607, 812288356, 108628319, 980702956, 714456194, 1678967663, 1935271536, 236851791, 1541132933, 1066014062, 1607628402, 1926717418, 954942098, + 1733982669, 14239125, 1506716966, 848141854, 1178260876, 614222093, 731606176, 1512135729, 63244522, 968848252, 1783943137, 1402735006, 1355391150, 1659137391, 1173889730, 1042942541, 1318900244, 1149113346, 2090025563, 1201659316, + 250022739, 1035075488, 674580901, 1090386021, 1943651015, 934048997, 2087660971, 738682048, 1305071296, 91177380, 1708106609, 1685880008, 364589031, 1860839427, 1927367009, 906899219, 1090443335, 892574149, 1969729134, 1874026715, + 927045887, 1159898528, 730296520, 349249331, 317980803, 225908941, 483348027, 1035956563, 241537930, 1279981214, 1247518755, 247447060, 1793747608, 752388169, 288054543, 2073482870, 2039012903, 617768643, 433412593, 499898207, + 1050512245, 331284679, 851322111, 1294873695, 1715379173, 1159675637, 1029338154, 2027445678, 1653332243, 1874855959, 1234157881, 260674360, 1042790263, 1401980800, 730090881, 1745393357, 1550721460, 1607677838, 969500483, 778702716, + 1765830270, 731763278, 1600023202, 1957728250, 690983, 444361278, 1278777407, 1231639101, 597427397, 1087245613, 258177907, 2093472294, 1462778368, 2067100479, 1628387880, 762564955, 1194041213, 1348361229, 1822279764, 1826590258, + 1112056034, 2088786920, 815110420, 1957877704, 1087195269, 881982271, 1945110368, 1656527154, 529233847, 137046551, 522408049, 1880577483, 847255974, 851716534, 925604268, 1037521069, 461527795, 1332620900, 525605961, 1389787451, + 1127911377, 1198857033, 859385989, 706825946, 371790550, 145611377, 655200896, 1900613055, 1333790305, 1101722351, 1278794420, 2089981667, 1150780072, 13180701, 1502266386, 1103013140, 343038558, 1897907456, 1612609979, 1209991461, + 1740783613, 1643991754, 977454680, 787842886, 163362230, 1087742330, 200253206, 1691676526, 360632817, 1787338655, 35595330, 822635252, 1834254978, 1372169786, 1063768444, 973490494, 697866347, 156498369, 169293723, 180549009, + 112035400, 127867199, 241711645, 2004664325, 23288667, 1997381015, 736455241, 1986921372, 1570645300, 2067499753, 1463269859, 148527979, 618168829, 1715279374, 2066440075, 2118433006, 198233440, 1835860030, 1345873587, 1902595458, + 1961619988, 1291438802, 1325008187, 836983022, 1849657867, 500376868, 1599565995, 1705905941, 1600493361, 386733714, 1028820236, 1663100626, 1322696419, 1482983072, 1092382563, 1667679197, 1965855212, 1063839036, 1742032331, 300191208, + 620497725, 503895325, 2094864173, 928179911, 277942057, 1677449797, 1249086623, 799527371, 1180063064, 48311975, 1866094167, 1405763119, 2109851473, 1594621666, 580464203, 1752598186, 1339293088, 922186026, 1403771494, 299505702, + 1345987999, 1298200648, 2128826472, 677220745, 831273447, 741184696, 696188251, 1912065710, 1016469330, 682018288, 353946286, 559509624, 515414188, 1852181952, 407771887, 812094461, 1859683061, 1100089300, 498702377, 653626077, + 765701205, 150878039, 328551896, 77104822, 1775331228, 1835977906, 706357381, 1240287664, 839507573, 1054066034, 1823053058, 701959731, 82879528, 652404808, 866097476, 926939064, 1326017288, 1747861289, 1173840088, 1524006589, + 443704960, 835506582, 5363460, 2068343250, 1683915700, 2080735477, 1913489530, 951256529, 1752318678, 105384223, 1788389051, 1787391786, 1430821640, 540952308, 882484999, 690806365, 202502890, 1593837351, 530093821, 385878401, + 907401151, 378912543, 454746323, 251514112, 1451277631, 1125822965, 21289266, 1642884452, 804368379, 2048205721, 917508270, 1514792012, 139494505, 1143168018, 115016418, 1730333306, 1630776459, 50748643, 1745247524, 1313640711, + 1076198976, 1820281480, 941471466, 806673335, 722162727, 1837280287, 705508794, 2088955494, 510497580, 51692325, 893597382, 1373978529, 1007042224, 685006165, 1471461419, 1555325521, 1215063385, 1424859828, 657251271, 1391827090, + 965562483, 604275115, 1285258674, 341475746, 294191106, 633240394, 1897691227, 1904243956, 823532901, 1577955754, 2016464961, 1862876260, 577384103, 1012611702, 247243083, 636485510, 1952805989, 1447876480, 108021700, 1016615447, + 2047769687, 943871886, 787537653, 12744598, 853545598, 334037304, 553373537, 1089408490, 497867498, 2038925801, 1434633879, 1290629443, 75922980, 957037315, 2130252471, 477317888, 952824381, 1686570783, 459340678, 751885764, + 836307572, 2027909489, 28791588, 322748588, 1335236478, 787106123, 113580144, 954915740, 1317077622, 1299667896, 2009244921, 1548588723, 2049698913, 732388681, 1781891230, 2090684129, 993786972, 1959292396, 1336513734, 691093904, + 1746904676, 935573751, 1123555638, 108413311, 1445352642, 169726789, 123352211, 1635952299, 673775121, 2042861943, 757787251, 512494446, 119656942, 58159196, 2090570016, 486181025, 1619641914, 432990571, 894937325, 379470588, + 1890938638, 1886317932, 1858637614, 969358207, 1230449468, 1890889527, 351741654, 214725897, 1550012286, 308005013, 26292400, 68067591, 1383307838, 1746273091, 1090104632, 1658037573, 2081544705, 1133473813, 1680294422, 1050373352, + 1806061681, 1713475126, 520699193, 417568373, 1355086853, 631399565, 1742434188, 2077667592, 1709019727, 594054971, 937081176, 742185643, 1904514273, 887841601, 1288684086, 424587711, 1497926365, 829844031, 1384314543, 250129297, + 200083737, 693737559, 1527022962, 1462501905, 1687540458, 1156824624, 241481265, 1190890142, 1250360726, 2064308502, 27563032, 1880483834, 1984143440, 104727360, 1324123626, 1089710430, 1403206383, 1930880552, 773197243, 1160186023, + 562994480, 1065136414, 502237764, 1642338733, 1310177444, 1730721241, 1475638246, 615734453, 1160537912, 928836931, 253898558, 1799210492, 1205522527, 413058646, 1589194592, 1774218355, 43955934, 1673314595, 683393460, 1260859787, + 2098829619, 772503535, 1232567659, 758174758, 831270563, 1605294199, 1660678300, 24379565, 1426483935, 1611558740, 1085326591, 12849216, 455856722, 878692218, 1910978116, 1382893830, 1950124297, 950009818, 904287249, 791384486, + 1584408128, 210098472, 1110387095, 364620240, 53868166, 772251062, 472745168, 1133910514, 1715402379, 1445225855, 1541125975, 149171217, 972058766, 1893095488, 1487620835, 640835502, 1470285405, 646688705, 988431201, 703130341, + 1753125385, 1985895474, 696002734, 1783233173, 1317201705, 1755204784, 532132334, 1069450170, 249700039, 524320231, 757959820, 2109052886, 604977130, 1971654864, 1588222158, 1533496974, 623670976, 1405668251, 1955436051, 1082881617, + 1387039848, 874153641, 1345378476, 1168465459, 2005021017, 234039217, 473318229, 654912216, 1473166451, 997649666, 801824335, 2052343947, 1883168929, 185658088, 1389954587, 1725541486, 885873448, 958774566, 2054212564, 60536525, + 1427504270, 1160285859, 1827651881, 1408805003, 1684018729, 61716770, 844057079, 1011596733, 1521350211, 1581801257, 907554175, 2022973269, 1125104871, 1312064004, 1466679625, 970194422, 80900939, 1445279202, 335456148, 510478312, + 92860378, 1646704157, 1650899832, 1533447203, 268087516, 880688023, 1180525723, 1868151949, 1750955971, 401446720, 540093580, 1022861633, 461442838, 1222554291, 456462271, 94760711, 1231111410, 2145073408, 1932108837, 300618464, + 2055783490, 980863365, 1308872551, 1010427073, 1399854717, 1217804021, 934700736, 878744414 +}; + +type verify_data[DATA_SIZE] = +{ + 690983, 900852, 2196420, 2530146, 3159407, 3522194, 3794415, 4031164, 5309142, 5363460, 9736243, 11476473, 12744598, 12849216, 12937811, 13180701, 13887419, 14125900, 14239125, 16411608, + 19227407, 20643769, 21289266, 22136821, 22762734, 23288667, 24379565, 25885333, 26292400, 26687179, 27377406, 27563032, 28256901, 28791588, 30992839, 31153367, 31574181, 31596852, 35595330, 35859252, + 37017340, 37141933, 38620214, 41714278, 42021322, 43955934, 47036070, 47452797, 47463938, 48311975, 48775768, 50748643, 50968578, 51692325, 53868166, 55461678, 58159196, 58217952, 59384706, 60536525, + 61716770, 62209567, 63244522, 64795664, 66579049, 68067591, 69118708, 69889880, 70003859, 70894786, 72319656, 72802865, 72939206, 74887898, 75922980, 77104822, 77482422, 78348530, 80321564, 80404202, + 80900939, 81402251, 82879528, 84924801, 87897457, 88823122, 89400484, 90063199, 91177380, 92271196, 92620223, 92860378, 93191015, 94760711, 95752736, 99511825, 104637677, 104727360, 105384223, 106223060, + 106595511, 107095939, 107160610, 108021700, 108346070, 108413311, 108628319, 109035776, 109526756, 112035400, 112648605, 113462155, 113580144, 114202152, 115016418, 116766659, 117260224, 117280545, 117766047, 119285206, + 119656942, 122124863, 123352211, 123889599, 127867199, 128036841, 130001148, 131405125, 133790520, 134453363, 135012885, 135678410, 137046551, 137796456, 139494505, 140536987, 145611377, 146002907, 148113917, 148527979, + 149171217, 150878039, 151416112, 152273285, 155845605, 156498369, 156760399, 161450336, 161502390, 163362230, 167653495, 168771888, 169293723, 169726789, 170281493, 172109594, 173062659, 173822937, 174082258, 174965839, + 175753599, 175843632, 176024101, 177100916, 178901145, 180549009, 180599971, 181567810, 182598318, 183679578, 185592115, 185658088, 185979744, 186112992, 186178768, 188016786, 190215907, 190536346, 190807078, 193873940, + 195379046, 196401930, 197964832, 198186681, 198233440, 200083737, 200253206, 202502890, 204514903, 205008108, 206653795, 208160226, 208433088, 210098472, 210748671, 210908782, 212046016, 212821393, 214725897, 215018112, + 216435361, 216557804, 217762975, 218671081, 221330186, 221661515, 222529745, 225091211, 225908941, 225934851, 226723092, 226726100, 226906236, 226986415, 227427283, 227870124, 228960529, 229905664, 230340298, 230634042, + 231181585, 232170581, 234039217, 236851791, 237020443, 238278880, 238566180, 239990424, 240618723, 241481265, 241537930, 241711645, 244709448, 244975305, 245334962, 247243083, 247447060, 247448424, 249700039, 250022739, + 250129297, 250731366, 250859482, 251514112, 253898558, 255226842, 256210446, 256860662, 257728183, 258177907, 259768753, 259775677, 260267972, 260670135, 260674360, 260792255, 261556590, 265363198, 267174620, 268087516, + 269167950, 270410557, 270814499, 271906847, 274746405, 277497333, 277942057, 279252402, 281317274, 283430575, 284658041, 287497702, 288054543, 289686472, 291298358, 293109484, 294191106, 295666215, 298799048, 299505702, + 300191208, 300618464, 301350822, 301663421, 301673313, 302219842, 303845878, 304131252, 304211060, 304427548, 305489695, 305750851, 308005013, 308700094, 308832070, 308857120, 310273032, 311127477, 316479300, 317980803, + 318750634, 320137025, 322748588, 324215873, 325324443, 325667019, 328551896, 329049266, 329767814, 330474090, 331284679, 332201519, 333820982, 333906659, 334037304, 335456148, 336213879, 338532526, 340231765, 340442582, + 341475746, 341674967, 341987235, 343038558, 343119399, 343682568, 344515114, 344860208, 346598567, 348131466, 349249331, 350182379, 351741654, 353946286, 355614494, 356546370, 356638683, 356672421, 359735266, 360632817, + 362748128, 363508800, 364589031, 364620240, 365275089, 365854486, 366700722, 367923081, 368541415, 368889391, 371790550, 372280769, 372465453, 372501343, 373226849, 373305330, 375863194, 376781122, 378912543, 379470588, + 380070610, 381094614, 381571915, 381933797, 382422699, 385878401, 386733714, 387061281, 387273799, 387611445, 388855203, 389233190, 390743779, 391321675, 395360213, 398211404, 398244682, 398911194, 399114073, 399456957, + 399991238, 401446720, 402845420, 403378386, 407771887, 411864717, 413058646, 416457166, 417568373, 419053054, 419109342, 419476096, 420106224, 421198539, 422047044, 423299667, 424587711, 430093707, 432102601, 432609664, + 432990571, 433412593, 434850545, 435236973, 435288306, 436476038, 436580096, 436630343, 437710825, 438711458, 443704960, 444361278, 446372159, 448284065, 448708980, 451448729, 452888789, 454359988, 454438520, 454746323, + 455856722, 456462271, 459340678, 460420451, 460893030, 461442838, 461527795, 462743614, 462857778, 464171383, 464795711, 465119445, 470090505, 472745168, 472872107, 473318229, 477317888, 477407584, 478721193, 481561285, + 481563348, 482917205, 483348027, 485818381, 486165509, 486181025, 487888229, 490920543, 492507266, 494367164, 495097609, 497867498, 498702377, 499898207, 500376868, 500734709, 502237764, 502323961, 502558280, 503368137, + 503895325, 506466155, 507848158, 507936866, 508041515, 509116230, 509744705, 510478312, 510497580, 512494446, 513009937, 513561613, 513582947, 514214340, 514914429, 515414188, 515811664, 517767440, 518073650, 519194709, + 519344323, 519699747, 520329478, 520511102, 520699193, 522160389, 522408049, 524320231, 525605961, 528024121, 529233847, 530093821, 532132334, 532467027, 533101409, 534384094, 535828217, 536063430, 538932155, 539429964, + 539942311, 540006359, 540093580, 540952308, 542609105, 543952312, 544899032, 545066288, 545602285, 546340809, 548632788, 549253917, 550532376, 553373537, 556328195, 559509624, 560663378, 562994480, 565150174, 566166447, + 567779677, 568652142, 569949159, 571635069, 572240371, 574236644, 576906032, 577384103, 577410402, 578787063, 579174666, 580464203, 580692625, 583112200, 585169793, 585804640, 589049769, 590690783, 592006699, 592234826, + 594054971, 594814862, 595717488, 597427397, 598016845, 602368560, 602907378, 603159718, 603907009, 604275115, 604977130, 607471900, 607761482, 612289854, 614222093, 614612685, 615734453, 617768643, 617995659, 618168829, + 618681206, 619428858, 619461174, 619972089, 620497725, 621921213, 622114437, 622170346, 623670976, 623909040, 624614472, 624714335, 624939139, 625991894, 628445699, 630393584, 631022494, 631399565, 631936923, 632611704, + 633075975, 633240394, 636485510, 637659983, 638167485, 640835502, 644293952, 644842409, 646688705, 649754857, 650513248, 651536866, 651750790, 652078020, 652404808, 653050943, 653626077, 654912216, 655200896, 655445946, + 656954306, 657251271, 661318748, 664387510, 665601851, 666624765, 670621648, 671848647, 672323245, 672906535, 673775121, 674580901, 675549432, 675663963, 677220745, 678475375, 679519053, 680172541, 682018288, 683393460, + 683536723, 685006165, 686797873, 687941098, 688338919, 688483428, 690710531, 690806365, 690865719, 691093904, 692845661, 693737559, 696002734, 696188251, 696448050, 697685269, 697817760, 697866347, 698660475, 700725671, + 701959731, 702380578, 703130341, 705508794, 705851791, 706357381, 706825946, 706913763, 709651138, 714042223, 714456194, 715940689, 717911282, 720339756, 721046824, 721524505, 722162727, 722260205, 722347551, 722919148, + 723323690, 723930558, 726141970, 726869128, 727587915, 729474445, 729509794, 730090881, 730296520, 730422541, 730845665, 731606176, 731763278, 732388681, 732444124, 736455241, 737377568, 737518341, 738682048, 739596391, + 740536012, 741078359, 741184696, 742185643, 743572345, 743745539, 745183293, 745777837, 747592875, 748527394, 749415493, 750631050, 750919339, 751885764, 752388169, 753296935, 754215794, 754247044, 754896618, 755554593, + 755798022, 757787251, 757959820, 758174758, 761851297, 762564955, 764902582, 764935753, 765386206, 765701205, 767233910, 767880329, 768185796, 769005536, 770412991, 770957259, 772059719, 772251062, 772503535, 773197243, + 777433215, 778702716, 778834747, 779093898, 783427298, 785398708, 785989696, 786297537, 786566648, 787106123, 787537653, 787842886, 787913688, 790256415, 790929190, 791188057, 791384486, 793505636, 795915364, 797060176, + 798445606, 799527371, 799717076, 800591831, 800661980, 801046035, 801610475, 801824335, 802730854, 804368379, 806384435, 806638567, 806673335, 809604334, 810387144, 810516965, 812094461, 812288356, 812328969, 813511681, + 814302898, 815110420, 817417567, 820933470, 821481684, 822635252, 823532901, 827496819, 829450571, 829844031, 830595166, 831270563, 831273447, 832081018, 833019845, 834410115, 835063788, 835506582, 836307572, 836983022, + 837024327, 837554186, 839507573, 840106059, 843738737, 844057079, 845698678, 846127236, 846650758, 847255974, 848141854, 848402819, 849489374, 851322111, 851716534, 852338021, 852388468, 852835634, 853545598, 854475547, + 855107605, 856621012, 856837002, 857894203, 858045289, 858150908, 859385989, 859612092, 860360715, 863551327, 863647665, 866097476, 866478506, 866854601, 866964848, 867628573, 869853078, 871908043, 873623623, 873976891, + 874153641, 875481479, 876130333, 878692218, 878744414, 878884686, 879380479, 879552408, 879878312, 880456526, 880688023, 881982271, 882282387, 882484999, 885873448, 886978116, 887841601, 890461390, 891710357, 892574149, + 892939912, 893302687, 893597382, 893957771, 894769708, 894937325, 895080280, 895562064, 898893218, 901789102, 904287249, 906899219, 907401151, 907554175, 909273561, 909415369, 910677024, 912381406, 914906004, 915948205, + 916073297, 917508270, 918378387, 919736727, 921573402, 922186026, 923478775, 923768127, 924541465, 925604268, 925975225, 926200942, 926939064, 927045887, 927524181, 928179911, 928836931, 929351822, 930367387, 932423857, + 933603111, 933673987, 934048997, 934700736, 935490932, 935573751, 935689637, 935939763, 937081176, 937976428, 937987129, 939497524, 941471466, 942977997, 943871886, 944382193, 945948973, 946311527, 946425090, 946489895, + 948686793, 949010757, 949222447, 950009818, 951256529, 951663731, 952824381, 953383750, 953877041, 954441852, 954915740, 954942098, 957037315, 958774566, 959354209, 960982228, 964348374, 965490116, 965562483, 966363087, + 968848252, 969076419, 969305448, 969358207, 969500483, 970194422, 972058766, 973367349, 973490494, 973493986, 973769771, 976015092, 976063110, 977454680, 977907387, 978247260, 980702956, 980863365, 983043723, 985305323, + 986240059, 987761406, 988431201, 991159735, 991874801, 992410365, 993525189, 993786972, 994291574, 997649666, 998931662, 999229412, 999346398, 999899279, 1007042224, 1010427073, 1011417836, 1011473945, 1011596733, 1012611702, + 1013901419, 1016469330, 1016615447, 1020037994, 1021014457, 1022861633, 1025117441, 1026342885, 1026380990, 1027758817, 1027760887, 1028529524, 1028820236, 1028937430, 1029176122, 1029338154, 1029832956, 1031625002, 1032748996, 1032914339, + 1033910502, 1035075488, 1035956563, 1037521069, 1038018856, 1038830638, 1042790263, 1042942541, 1043920511, 1044088643, 1045627895, 1045658065, 1047336724, 1048943084, 1049475248, 1050373352, 1050512245, 1051184301, 1054066034, 1057003814, + 1058677375, 1058937717, 1061864942, 1063657548, 1063743848, 1063768444, 1063839036, 1065136414, 1065481253, 1066014062, 1066787659, 1067775613, 1068587688, 1068798385, 1069450170, 1073695485, 1073871430, 1074205225, 1075762632, 1076198976, + 1078197595, 1079859867, 1082499152, 1082864732, 1082881617, 1085326591, 1087195269, 1087245613, 1087251698, 1087556673, 1087742330, 1089408490, 1089710430, 1090104632, 1090386021, 1090443335, 1092382563, 1092881031, 1094283114, 1094531762, + 1095403694, 1099847920, 1100041120, 1100089300, 1101722351, 1101933540, 1102423908, 1102603775, 1103013140, 1106678970, 1110387095, 1111213862, 1112056034, 1112731797, 1113693824, 1120963974, 1121432739, 1121800211, 1121960111, 1122768484, + 1123331233, 1123555638, 1125104871, 1125822965, 1126017956, 1127173529, 1127911377, 1128895624, 1130850177, 1131661227, 1132597050, 1133473813, 1133910514, 1134185180, 1135793759, 1136264020, 1136356724, 1137511396, 1139018167, 1139159604, + 1140008063, 1140728569, 1143168018, 1143511498, 1143853106, 1144017176, 1144669754, 1147341731, 1147793249, 1148699143, 1149113346, 1150780072, 1152335090, 1152416171, 1154842325, 1155459206, 1155544307, 1156824624, 1157666831, 1159675637, + 1159745061, 1159898528, 1160036198, 1160186023, 1160285859, 1160333307, 1160537912, 1161580432, 1162679490, 1165446977, 1166227930, 1167207852, 1168465459, 1169327477, 1170510314, 1170759710, 1171051384, 1171925835, 1172290275, 1173840088, + 1173889730, 1174587016, 1175004233, 1175885101, 1178086274, 1178260876, 1179525294, 1180063064, 1180525723, 1181191604, 1183464058, 1184561748, 1185825535, 1188076819, 1188748563, 1189141368, 1189323192, 1190890142, 1191079043, 1191513656, + 1192155877, 1194041213, 1194709162, 1198213061, 1198254803, 1198857033, 1199317660, 1201124879, 1201152163, 1201659316, 1202009920, 1202162389, 1203377492, 1203897636, 1204992245, 1205522527, 1205895814, 1206302514, 1209784819, 1209991461, + 1212628403, 1212974417, 1214379246, 1214950832, 1215063385, 1215103809, 1216475831, 1217804021, 1218522465, 1220523503, 1220915309, 1221108420, 1221726287, 1222554291, 1223475486, 1223572435, 1223583276, 1228817775, 1230449468, 1231111410, + 1231149357, 1231249235, 1231639101, 1231932661, 1232567659, 1232992084, 1233022905, 1234157881, 1234944834, 1239665569, 1240287664, 1245819051, 1247518755, 1249086623, 1249183285, 1250360726, 1255524953, 1256015513, 1256152080, 1256372950, + 1257507406, 1260859787, 1262399341, 1267173039, 1269707634, 1271370220, 1273223611, 1273955724, 1274190723, 1274436639, 1275331596, 1275500498, 1276205250, 1278053582, 1278777407, 1278794420, 1279061703, 1279981214, 1281443423, 1285258674, + 1286989824, 1287171290, 1287830283, 1288684086, 1289308008, 1290629443, 1290969161, 1291025252, 1291070368, 1291438802, 1292049996, 1292413659, 1293091635, 1294873695, 1296857499, 1298200648, 1299667896, 1302272656, 1302724177, 1303736105, + 1305071296, 1308872551, 1310177444, 1312064004, 1312471120, 1313115559, 1313640711, 1313871880, 1316120929, 1317077622, 1317201705, 1318032594, 1318900244, 1319798607, 1321897861, 1322281086, 1322696419, 1323798820, 1324123626, 1324723894, + 1325008187, 1325083914, 1326017288, 1328272543, 1328885292, 1331383316, 1331593955, 1332379148, 1332467446, 1332620900, 1332937015, 1333790305, 1334857284, 1335236478, 1335298265, 1335652095, 1335861008, 1336108161, 1336513734, 1337406065, + 1338090388, 1339293088, 1340949553, 1344125357, 1345014111, 1345378476, 1345873587, 1345987999, 1347284277, 1348361229, 1348373925, 1350653461, 1352833750, 1353144470, 1353999206, 1355086853, 1355391150, 1356847855, 1361012693, 1361078114, + 1365423458, 1367731096, 1368235387, 1370528050, 1372169786, 1373978529, 1374125186, 1375470750, 1377995642, 1379259015, 1379460673, 1379995885, 1382429941, 1382484003, 1382551511, 1382893830, 1383307838, 1383640563, 1384314543, 1385675177, + 1386258142, 1386366954, 1387039848, 1387864976, 1388759892, 1389787451, 1389954587, 1390040163, 1390274260, 1390306889, 1390477985, 1390656632, 1391095995, 1391827090, 1392162662, 1394929399, 1395155215, 1395289708, 1396662140, 1399673078, + 1399854717, 1400070607, 1400929335, 1401058771, 1401980800, 1402735006, 1403206383, 1403771494, 1404727477, 1405668251, 1405763119, 1407094080, 1408805003, 1409001936, 1412540552, 1413860940, 1414141069, 1414160501, 1415390230, 1417415680, + 1417601340, 1420810050, 1424797596, 1424859828, 1426483935, 1427504270, 1428223489, 1430821640, 1431492783, 1431814151, 1434046375, 1434633879, 1435859758, 1437147036, 1440145706, 1441811554, 1444048519, 1444076976, 1445225855, 1445279202, + 1445352642, 1447469119, 1447876480, 1450892344, 1451277631, 1451442832, 1453397990, 1455316979, 1455756978, 1457464894, 1459100749, 1459138745, 1459500136, 1459620801, 1462192184, 1462501905, 1462778368, 1462921857, 1463269859, 1466632447, + 1466679625, 1467376771, 1468486929, 1470285405, 1471131758, 1471461419, 1471598258, 1472567100, 1473166451, 1473735214, 1475638246, 1480273562, 1480324438, 1480437960, 1482983072, 1485740112, 1486594282, 1487620835, 1489699243, 1491477359, + 1492071476, 1492488573, 1496078411, 1496277718, 1497680539, 1497926365, 1498554338, 1500102591, 1501181424, 1502266386, 1502480836, 1502557594, 1504023310, 1505022272, 1505475223, 1506716966, 1507433029, 1508705426, 1510133268, 1512135729, + 1512163910, 1513255537, 1514278798, 1514582723, 1514792012, 1515262458, 1515528736, 1515933932, 1519017268, 1520667645, 1520886946, 1521350211, 1522316172, 1524006589, 1524491858, 1525451290, 1527022962, 1528031307, 1533447203, 1533496974, + 1534330971, 1536213818, 1537459540, 1538069400, 1538391713, 1539560507, 1541125975, 1541132933, 1541546082, 1545555937, 1546057655, 1546104436, 1547662666, 1548588723, 1548804416, 1550012286, 1550159640, 1550525411, 1550721460, 1551661799, + 1553547892, 1554106660, 1555325521, 1555660285, 1558244592, 1558695709, 1560142576, 1561212123, 1561251584, 1561422777, 1561730727, 1563717683, 1564061243, 1565610678, 1565700239, 1566878909, 1568176414, 1568395337, 1568900638, 1569479928, + 1570645300, 1571598133, 1572212863, 1575380740, 1577034674, 1577955754, 1579725218, 1581062145, 1581118537, 1581801257, 1584408128, 1585050246, 1588222158, 1588715179, 1589194592, 1590461855, 1590771096, 1593359038, 1593837351, 1594621666, + 1596042792, 1596821127, 1597506096, 1598436917, 1599565995, 1599876594, 1600023202, 1600493361, 1601134240, 1601247294, 1601617797, 1602517354, 1602827413, 1602967659, 1603428054, 1604330946, 1604357658, 1605294199, 1605369007, 1607204293, + 1607515830, 1607628402, 1607677838, 1609955669, 1610244183, 1610539590, 1611500622, 1611558740, 1611680320, 1612593993, 1612609979, 1614780688, 1617229086, 1618378831, 1619598456, 1619641914, 1620562432, 1620803320, 1622692876, 1622758049, + 1624653209, 1627355806, 1628387880, 1628389501, 1629633514, 1629914848, 1630293700, 1630776459, 1631405417, 1631935240, 1633512617, 1634445325, 1635952299, 1636203720, 1636860706, 1640952769, 1642338733, 1642884452, 1643991754, 1644353864, + 1645969422, 1646704157, 1648575360, 1649344003, 1649392096, 1650899832, 1652108025, 1653332243, 1655277291, 1656527154, 1657001479, 1658037573, 1659079595, 1659137391, 1660678300, 1663100626, 1663890071, 1665914525, 1666074170, 1667102296, + 1667679197, 1672192305, 1673314595, 1674045273, 1675300017, 1675494182, 1677449797, 1678967663, 1679324299, 1679777458, 1680251429, 1680294422, 1681866717, 1682700783, 1683915700, 1684018729, 1685350721, 1685880008, 1686215900, 1686479103, + 1686570783, 1687540458, 1687941280, 1688652157, 1689946986, 1690167792, 1691486500, 1691676526, 1695191950, 1695617313, 1697686200, 1702425249, 1704561346, 1705378439, 1705905941, 1706528514, 1708002892, 1708106609, 1708126014, 1709019727, + 1709697877, 1709823304, 1710305778, 1711569347, 1711718534, 1711761015, 1711765426, 1712269139, 1712341869, 1713188647, 1713475126, 1714295540, 1715279374, 1715379173, 1715402379, 1716853034, 1719009954, 1719573683, 1721767511, 1723143470, + 1725541486, 1726987516, 1727583308, 1730333306, 1730721241, 1731949250, 1732028080, 1733366374, 1733982669, 1737931879, 1738353358, 1740099311, 1740778973, 1740783613, 1742032331, 1742434188, 1745247524, 1745393357, 1745543275, 1746273091, + 1746476698, 1746904676, 1747861289, 1749972876, 1750197960, 1750443194, 1750955971, 1752088215, 1752318678, 1752598186, 1753125385, 1754447491, 1755204784, 1757028186, 1758748737, 1760851607, 1761289401, 1763785295, 1764436465, 1765354961, + 1765830270, 1767380006, 1768795266, 1770497338, 1771614266, 1771924274, 1772760484, 1774218355, 1774652096, 1774796872, 1775331228, 1775608361, 1775805177, 1776471922, 1776794410, 1778544166, 1781233744, 1781891230, 1783233173, 1783943137, + 1784682542, 1787338655, 1787391786, 1788389051, 1790557628, 1792756324, 1793190956, 1793747608, 1797641070, 1799210492, 1800186189, 1800522575, 1802197319, 1802327778, 1803183394, 1806061681, 1807085904, 1807172811, 1808237662, 1811088032, + 1815408878, 1816641611, 1817156134, 1820281480, 1821482472, 1821559709, 1822279764, 1822612008, 1823053058, 1826590258, 1826628136, 1826880531, 1827651881, 1833543700, 1833603743, 1834161399, 1834254978, 1834285819, 1834318089, 1834388383, + 1834852613, 1835203128, 1835860030, 1835977906, 1836119534, 1837280287, 1838218199, 1839063567, 1840896199, 1846605728, 1847908587, 1848681194, 1849495275, 1849657867, 1849675857, 1852181952, 1855359256, 1858637614, 1858933377, 1859683061, + 1860435620, 1860839427, 1862876260, 1864952910, 1866094167, 1868151949, 1868289345, 1869264274, 1870214195, 1870859970, 1871060346, 1871684562, 1873900475, 1874026715, 1874855959, 1876255297, 1878253960, 1878434988, 1879635915, 1880483834, + 1880577483, 1881253854, 1883168929, 1883999260, 1886317932, 1890889527, 1890938638, 1891630185, 1891904961, 1892370478, 1893095488, 1896952705, 1897691227, 1897907456, 1898582764, 1900162831, 1900613055, 1901537567, 1902501708, 1902595458, + 1904243956, 1904514273, 1904576737, 1904770864, 1905279500, 1906345724, 1907793490, 1908093581, 1909681194, 1910978116, 1912065710, 1913489530, 1913581092, 1913926325, 1914764659, 1914809801, 1915435344, 1916602098, 1918354829, 1920182565, + 1924603748, 1926717418, 1927367009, 1928309762, 1928550562, 1930662128, 1930880552, 1931282005, 1931493432, 1932108837, 1933532372, 1933923245, 1935271536, 1936668087, 1938258683, 1939683211, 1942089394, 1943137808, 1943651015, 1944679691, + 1945110368, 1946004194, 1948121717, 1949896838, 1950124297, 1951228823, 1952177514, 1952364329, 1952805989, 1953450944, 1953919896, 1955436051, 1957728250, 1957877704, 1958396887, 1959222232, 1959292396, 1961619988, 1961647235, 1962689485, + 1963053072, 1965358941, 1965855212, 1967705762, 1968608155, 1968623233, 1969729134, 1970797151, 1971484382, 1971654864, 1977865396, 1980923963, 1981481446, 1983379601, 1984143440, 1984152603, 1985895474, 1986921372, 1989240516, 1992941115, + 1994402695, 1997381015, 2001056977, 2002881120, 2004664325, 2004770236, 2005021017, 2005653265, 2005817027, 2006320950, 2006856683, 2009244921, 2010549018, 2011827638, 2014090929, 2014129292, 2015847175, 2016161810, 2016464961, 2017191527, + 2018336444, 2022291557, 2022973269, 2023498746, 2024853642, 2027445678, 2027814180, 2027828650, 2027909489, 2028116487, 2029133999, 2029909894, 2033003588, 2033828953, 2034767768, 2036061488, 2036750157, 2037182006, 2038925801, 2039012903, + 2041942843, 2042861943, 2044016080, 2045407567, 2045821218, 2046759770, 2047006719, 2047769687, 2048205721, 2048560397, 2049698913, 2052321529, 2052328978, 2052343947, 2053899162, 2054212564, 2055783490, 2060969286, 2061144988, 2063408339, + 2064145552, 2064308502, 2066440075, 2066865713, 2067100479, 2067499753, 2068343250, 2068743361, 2069178089, 2070467093, 2072440819, 2073482870, 2074840378, 2074896270, 2076612603, 2077667592, 2078528215, 2079492652, 2080735477, 2081544705, + 2082760612, 2084953915, 2085323316, 2087660971, 2088576982, 2088786920, 2088955494, 2089981667, 2090025563, 2090543533, 2090570016, 2090684129, 2091626028, 2093472294, 2094085507, 2094159153, 2094591332, 2094864173, 2097057488, 2098829619, + 2100497812, 2103236982, 2105321510, 2105638337, 2105718728, 2105814934, 2108439398, 2109052886, 2109530615, 2109851473, 2113434968, 2114587535, 2115445751, 2116495484, 2117880007, 2118203528, 2118433006, 2118805956, 2118821565, 2119425672, + 2122262571, 2122852959, 2123379476, 2124749673, 2125958841, 2126029304, 2126940990, 2126963607, 2128078174, 2128826472, 2129513521, 2129930580, 2130252471, 2130879949, 2131761201, 2131797509, 2133066804, 2135673182, 2139976479, 2140091269, + 2140756121, 2141591317, 2142357746, 2143324534, 2143343312, 2143968639, 2145073408, 2145930822 +}; + diff --git a/apps/riscv-tests/benchmarks/rsort/rsort.c b/apps/riscv-tests/benchmarks/rsort/rsort.c new file mode 100644 index 0000000..7ffc12a --- /dev/null +++ b/apps/riscv-tests/benchmarks/rsort/rsort.c @@ -0,0 +1,122 @@ +// See LICENSE for license details. + +//************************************************************************** +// Quicksort benchmark +//-------------------------------------------------------------------------- +// +// This benchmark uses quicksort to sort an array of integers. The +// implementation is largely adapted from Numerical Recipes for C. The +// input data (and reference data) should be generated using the +// qsort_gendata.pl perl script and dumped to a file named +// dataset1.h + +#include "util.h" +#include +#include + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#define type unsigned int +#include "dataset1.h" + +#define LOG_BASE 8 +#define BASE (1 << LOG_BASE) + +#if 0 +# define fetch_add(ptr, inc) __sync_fetch_and_add(ptr, inc) +#else +# define fetch_add(ptr, inc) ((*(ptr) += (inc)) - (inc)) +#endif + +void sort(size_t n, type* arrIn, type* scratchIn) +{ + size_t log_exp = 0; + size_t buckets[BASE]; + size_t *bucket = buckets; + asm("":"+r"(bucket)); + type *arr = arrIn, *scratch = scratchIn, *p; + size_t *b; + + while (log_exp < CHAR_BIT * sizeof(type)) + { + for (b = bucket; b < bucket + BASE; b++) + *b = 0; + + for (p = arr; p < &arr[n-3]; p += 4) + { + type a0 = p[0]; + type a1 = p[1]; + type a2 = p[2]; + type a3 = p[3]; + fetch_add(&bucket[(a0 >> log_exp) % BASE], 1); + fetch_add(&bucket[(a1 >> log_exp) % BASE], 1); + fetch_add(&bucket[(a2 >> log_exp) % BASE], 1); + fetch_add(&bucket[(a3 >> log_exp) % BASE], 1); + } + for ( ; p < &arr[n]; p++) + bucket[(*p >> log_exp) % BASE]++; + + size_t prev = bucket[0]; + prev += fetch_add(&bucket[1], prev); + for (b = &bucket[2]; b < bucket + BASE; b += 2) + { + prev += fetch_add(&b[0], prev); + prev += fetch_add(&b[1], prev); + } + static_assert(BASE % 2 == 0); + + for (p = &arr[n-1]; p >= &arr[3]; p -= 4) + { + type a0 = p[-0]; + type a1 = p[-1]; + type a2 = p[-2]; + type a3 = p[-3]; + size_t* pb0 = &bucket[(a0 >> log_exp) % BASE]; + size_t* pb1 = &bucket[(a1 >> log_exp) % BASE]; + size_t* pb2 = &bucket[(a2 >> log_exp) % BASE]; + size_t* pb3 = &bucket[(a3 >> log_exp) % BASE]; + type* s0 = scratch + fetch_add(pb0, -1); + type* s1 = scratch + fetch_add(pb1, -1); + type* s2 = scratch + fetch_add(pb2, -1); + type* s3 = scratch + fetch_add(pb3, -1); + s0[-1] = a0; + s1[-1] = a1; + s2[-1] = a2; + s3[-1] = a3; + } + for ( ; p >= &arr[0]; p--) + scratch[--bucket[(*p >> log_exp) % BASE]] = *p; + + type* tmp = arr; + arr = scratch; + scratch = tmp; + + log_exp += LOG_BASE; + } + if (arr != arrIn) + memcpy(arr, scratch, n*sizeof(type)); +} + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ + static type scratch[DATA_SIZE]; + +#if PREALLOCATE + // If needed we preallocate everything in the caches + sort(DATA_SIZE, verify_data, scratch); + if (verify(DATA_SIZE, input_data, input_data)) + return 1; +#endif + + // Do the sort + setStats(1); + sort(DATA_SIZE, input_data, scratch); + setStats(0); + + // Check the results + return verify( DATA_SIZE, input_data, verify_data ); +} diff --git a/apps/riscv-tests/benchmarks/spmv/dataset1.h b/apps/riscv-tests/benchmarks/spmv/dataset1.h new file mode 100644 index 0000000..52e49c5 --- /dev/null +++ b/apps/riscv-tests/benchmarks/spmv/dataset1.h @@ -0,0 +1,6312 @@ +#define R 500 +#define C 500 +#define NNZ 2399 +const double val[2399] = { + 566, + 508, + 850, + 780, + 944, + 598, + 772, + 880, + 764, + 656, + 138, + 757, + 929, + 234, + 168, + 629, + 639, + 434, + 849, + 793, + 203, + 811, + 250, + 770, + 322, + 535, + 826, + 609, + 899, + 926, + 211, + 755, + 900, + 691, + 386, + 821, + 454, + 791, + 849, + 256, + 821, + 29, + 679, + 944, + 55, + 689, + 453, + 631, + 799, + 854, + 545, + 97, + 337, + 258, + 695, + 667, + 581, + 104, + 491, + 517, + 761, + 369, + 316, + 42, + 86, + 432, + 954, + 736, + 333, + 321, + 184, + 920, + 258, + 949, + 604, + 907, + 70, + 453, + 796, + 102, + 3, + 105, + 371, + 388, + 153, + 908, + 176, + 567, + 334, + 973, + 911, + 323, + 681, + 300, + 265, + 711, + 871, + 870, + 463, + 969, + 535, + 688, + 276, + 908, + 384, + 988, + 256, + 416, + 258, + 523, + 80, + 911, + 241, + 191, + 411, + 127, + 894, + 259, + 664, + 129, + 609, + 146, + 763, + 109, + 369, + 881, + 878, + 224, + 635, + 498, + 460, + 363, + 481, + 222, + 761, + 489, + 753, + 62, + 261, + 389, + 351, + 189, + 319, + 557, + 5, + 485, + 806, + 119, + 366, + 85, + 123, + 918, + 66, + 205, + 786, + 313, + 555, + 22, + 760, + 904, + 255, + 912, + 950, + 676, + 342, + 736, + 251, + 170, + 923, + 790, + 312, + 716, + 648, + 57, + 676, + 972, + 250, + 215, + 792, + 798, + 915, + 61, + 381, + 897, + 686, + 568, + 393, + 969, + 893, + 205, + 721, + 684, + 38, + 667, + 704, + 750, + 364, + 123, + 158, + 892, + 306, + 409, + 188, + 394, + 554, + 602, + 59, + 9, + 987, + 897, + 332, + 873, + 770, + 632, + 434, + 598, + 599, + 207, + 211, + 410, + 768, + 708, + 462, + 687, + 300, + 864, + 839, + 183, + 21, + 282, + 990, + 578, + 952, + 42, + 149, + 235, + 777, + 156, + 568, + 400, + 783, + 238, + 390, + 108, + 422, + 392, + 414, + 338, + 524, + 535, + 893, + 160, + 163, + 798, + 836, + 662, + 181, + 946, + 774, + 113, + 438, + 721, + 631, + 577, + 739, + 62, + 928, + 523, + 352, + 603, + 974, + 291, + 47, + 875, + 260, + 754, + 13, + 890, + 989, + 104, + 22, + 36, + 803, + 39, + 241, + 95, + 589, + 603, + 230, + 471, + 978, + 617, + 603, + 652, + 21, + 755, + 294, + 753, + 609, + 494, + 93, + 387, + 243, + 128, + 777, + 636, + 303, + 665, + 761, + 355, + 611, + 605, + 627, + 834, + 616, + 59, + 109, + 268, + 638, + 117, + 338, + 89, + 95, + 4, + 64, + 575, + 300, + 783, + 453, + 878, + 939, + 984, + 338, + 344, + 138, + 291, + 440, + 748, + 277, + 628, + 511, + 894, + 68, + 412, + 958, + 540, + 672, + 935, + 316, + 519, + 4, + 613, + 501, + 908, + 984, + 820, + 424, + 726, + 592, + 526, + 869, + 330, + 419, + 28, + 540, + 143, + 279, + 79, + 712, + 760, + 306, + 806, + 507, + 807, + 716, + 729, + 163, + 151, + 256, + 873, + 90, + 374, + 89, + 122, + 819, + 253, + 961, + 62, + 208, + 830, + 365, + 231, + 905, + 961, + 340, + 928, + 911, + 83, + 118, + 864, + 310, + 699, + 138, + 221, + 928, + 130, + 775, + 425, + 783, + 519, + 852, + 187, + 795, + 772, + 627, + 709, + 81, + 264, + 359, + 149, + 692, + 178, + 247, + 51, + 869, + 30, + 659, + 190, + 494, + 80, + 531, + 883, + 557, + 170, + 759, + 331, + 588, + 939, + 953, + 407, + 453, + 223, + 919, + 147, + 666, + 165, + 204, + 924, + 178, + 361, + 766, + 455, + 232, + 86, + 194, + 536, + 942, + 671, + 595, + 420, + 543, + 490, + 570, + 547, + 273, + 465, + 776, + 845, + 753, + 591, + 22, + 320, + 569, + 964, + 701, + 483, + 100, + 757, + 514, + 850, + 50, + 451, + 993, + 79, + 79, + 790, + 410, + 409, + 494, + 245, + 881, + 676, + 484, + 821, + 183, + 45, + 343, + 76, + 423, + 855, + 188, + 16, + 355, + 159, + 255, + 705, + 147, + 400, + 997, + 264, + 831, + 644, + 390, + 395, + 485, + 457, + 879, + 478, + 900, + 187, + 699, + 559, + 681, + 947, + 137, + 637, + 150, + 700, + 729, + 166, + 120, + 325, + 841, + 956, + 74, + 576, + 532, + 396, + 157, + 327, + 601, + 707, + 681, + 813, + 593, + 452, + 45, + 936, + 466, + 706, + 546, + 265, + 769, + 71, + 862, + 37, + 764, + 111, + 468, + 844, + 693, + 740, + 128, + 19, + 579, + 894, + 928, + 160, + 787, + 438, + 814, + 274, + 675, + 128, + 451, + 626, + 879, + 931, + 894, + 57, + 181, + 839, + 121, + 728, + 410, + 793, + 292, + 566, + 472, + 893, + 579, + 986, + 159, + 585, + 34, + 485, + 279, + 634, + 353, + 626, + 504, + 574, + 19, + 54, + 489, + 829, + 768, + 246, + 421, + 116, + 267, + 801, + 299, + 279, + 397, + 331, + 396, + 11, + 80, + 682, + 752, + 101, + 832, + 673, + 521, + 42, + 883, + 663, + 905, + 284, + 218, + 59, + 888, + 86, + 623, + 878, + 117, + 157, + 70, + 309, + 877, + 803, + 529, + 666, + 274, + 192, + 667, + 558, + 938, + 383, + 542, + 237, + 377, + 674, + 783, + 638, + 609, + 419, + 359, + 309, + 53, + 65, + 277, + 526, + 853, + 659, + 263, + 280, + 332, + 940, + 336, + 748, + 645, + 227, + 475, + 945, + 924, + 845, + 253, + 798, + 49, + 241, + 761, + 379, + 423, + 680, + 837, + 116, + 378, + 416, + 553, + 802, + 839, + 339, + 424, + 40, + 101, + 744, + 934, + 119, + 217, + 478, + 850, + 998, + 513, + 320, + 966, + 306, + 774, + 442, + 417, + 646, + 652, + 15, + 637, + 199, + 653, + 516, + 380, + 983, + 281, + 196, + 973, + 604, + 378, + 824, + 773, + 835, + 724, + 450, + 321, + 446, + 778, + 935, + 296, + 752, + 27, + 824, + 933, + 145, + 708, + 691, + 433, + 627, + 511, + 619, + 415, + 263, + 680, + 880, + 201, + 700, + 440, + 579, + 545, + 445, + 483, + 499, + 953, + 518, + 77, + 237, + 980, + 923, + 809, + 532, + 877, + 965, + 865, + 597, + 773, + 378, + 177, + 101, + 899, + 448, + 430, + 217, + 403, + 21, + 837, + 410, + 345, + 606, + 373, + 179, + 310, + 634, + 894, + 512, + 289, + 946, + 243, + 725, + 458, + 680, + 579, + 304, + 199, + 721, + 22, + 452, + 761, + 945, + 547, + 418, + 137, + 209, + 622, + 174, + 468, + 223, + 525, + 84, + 470, + 266, + 812, + 950, + 18, + 983, + 319, + 843, + 423, + 862, + 469, + 957, + 919, + 387, + 900, + 382, + 561, + 337, + 711, + 352, + 206, + 737, + 412, + 40, + 17, + 851, + 825, + 910, + 839, + 207, + 879, + 588, + 77, + 867, + 255, + 577, + 1, + 609, + 473, + 88, + 249, + 491, + 180, + 594, + 872, + 870, + 528, + 68, + 31, + 208, + 854, + 190, + 32, + 200, + 225, + 322, + 869, + 425, + 62, + 653, + 919, + 138, + 246, + 501, + 995, + 133, + 852, + 903, + 694, + 482, + 818, + 820, + 922, + 839, + 870, + 391, + 880, + 478, + 602, + 774, + 989, + 139, + 457, + 114, + 282, + 632, + 245, + 452, + 987, + 920, + 134, + 94, + 409, + 124, + 389, + 36, + 434, + 885, + 486, + 269, + 510, + 487, + 644, + 122, + 773, + 13, + 326, + 369, + 252, + 407, + 599, + 182, + 319, + 229, + 684, + 895, + 760, + 703, + 982, + 282, + 645, + 835, + 415, + 182, + 792, + 681, + 113, + 659, + 312, + 998, + 954, + 655, + 588, + 3, + 268, + 125, + 832, + 346, + 832, + 972, + 488, + 709, + 491, + 913, + 441, + 187, + 177, + 90, + 55, + 959, + 126, + 73, + 409, + 606, + 732, + 985, + 833, + 381, + 542, + 559, + 375, + 829, + 50, + 432, + 549, + 996, + 517, + 3, + 366, + 33, + 737, + 451, + 111, + 380, + 362, + 884, + 511, + 199, + 262, + 647, + 531, + 717, + 810, + 675, + 946, + 614, + 425, + 282, + 31, + 436, + 695, + 701, + 653, + 629, + 284, + 109, + 237, + 909, + 269, + 495, + 386, + 327, + 620, + 947, + 782, + 663, + 471, + 818, + 517, + 768, + 494, + 249, + 815, + 725, + 822, + 614, + 324, + 22, + 675, + 118, + 143, + 929, + 498, + 368, + 469, + 482, + 964, + 554, + 999, + 265, + 686, + 782, + 754, + 247, + 125, + 960, + 808, + 788, + 647, + 623, + 615, + 727, + 573, + 813, + 200, + 371, + 141, + 733, + 450, + 515, + 940, + 304, + 13, + 522, + 489, + 948, + 906, + 529, + 500, + 98, + 719, + 174, + 269, + 170, + 609, + 789, + 169, + 645, + 514, + 438, + 254, + 103, + 938, + 306, + 608, + 367, + 889, + 667, + 621, + 276, + 346, + 736, + 210, + 13, + 356, + 914, + 377, + 613, + 714, + 949, + 386, + 770, + 738, + 310, + 382, + 145, + 163, + 470, + 34, + 855, + 951, + 672, + 192, + 942, + 936, + 429, + 906, + 378, + 159, + 665, + 208, + 223, + 575, + 977, + 937, + 81, + 24, + 484, + 941, + 128, + 544, + 811, + 905, + 110, + 707, + 806, + 996, + 509, + 283, + 493, + 846, + 466, + 356, + 807, + 993, + 616, + 790, + 163, + 7, + 931, + 661, + 353, + 499, + 186, + 309, + 107, + 556, + 104, + 702, + 61, + 963, + 255, + 279, + 454, + 941, + 817, + 447, + 786, + 788, + 372, + 919, + 14, + 113, + 41, + 412, + 744, + 372, + 282, + 648, + 248, + 484, + 830, + 104, + 742, + 425, + 802, + 216, + 561, + 103, + 781, + 602, + 201, + 317, + 408, + 461, + 91, + 691, + 168, + 850, + 935, + 171, + 929, + 482, + 790, + 701, + 81, + 556, + 85, + 342, + 703, + 99, + 937, + 556, + 14, + 203, + 974, + 200, + 145, + 276, + 408, + 174, + 573, + 775, + 893, + 448, + 21, + 389, + 813, + 62, + 134, + 911, + 119, + 138, + 201, + 200, + 105, + 0, + 958, + 439, + 635, + 723, + 930, + 361, + 745, + 251, + 608, + 179, + 19, + 170, + 405, + 461, + 643, + 517, + 379, + 481, + 899, + 896, + 396, + 675, + 536, + 978, + 513, + 459, + 454, + 704, + 398, + 5, + 786, + 45, + 843, + 674, + 758, + 919, + 250, + 655, + 980, + 789, + 55, + 467, + 459, + 284, + 1, + 951, + 447, + 729, + 756, + 581, + 992, + 961, + 744, + 531, + 169, + 484, + 346, + 289, + 18, + 143, + 653, + 221, + 669, + 537, + 565, + 552, + 874, + 502, + 352, + 458, + 183, + 975, + 521, + 272, + 336, + 930, + 129, + 678, + 670, + 821, + 692, + 463, + 175, + 958, + 110, + 393, + 123, + 174, + 768, + 70, + 942, + 237, + 787, + 788, + 462, + 471, + 160, + 526, + 579, + 835, + 889, + 764, + 878, + 532, + 151, + 390, + 607, + 272, + 49, + 166, + 399, + 950, + 566, + 866, + 446, + 188, + 552, + 984, + 530, + 711, + 541, + 357, + 30, + 212, + 675, + 750, + 746, + 67, + 55, + 184, + 788, + 27, + 314, + 650, + 403, + 24, + 72, + 872, + 260, + 313, + 446, + 235, + 275, + 422, + 727, + 779, + 192, + 215, + 92, + 534, + 619, + 192, + 502, + 139, + 125, + 921, + 953, + 463, + 909, + 961, + 191, + 281, + 619, + 978, + 221, + 841, + 540, + 959, + 422, + 610, + 323, + 162, + 642, + 817, + 961, + 699, + 955, + 341, + 480, + 379, + 28, + 150, + 386, + 447, + 871, + 491, + 632, + 759, + 785, + 827, + 50, + 877, + 771, + 397, + 67, + 827, + 448, + 627, + 85, + 830, + 646, + 353, + 304, + 671, + 963, + 764, + 58, + 136, + 838, + 597, + 932, + 212, + 558, + 276, + 73, + 926, + 403, + 946, + 268, + 779, + 559, + 887, + 213, + 436, + 529, + 929, + 295, + 76, + 78, + 982, + 105, + 688, + 420, + 105, + 815, + 572, + 172, + 584, + 412, + 314, + 219, + 182, + 238, + 789, + 877, + 844, + 62, + 124, + 711, + 787, + 315, + 954, + 296, + 453, + 842, + 681, + 282, + 945, + 132, + 695, + 443, + 837, + 92, + 545, + 363, + 253, + 515, + 341, + 409, + 817, + 578, + 868, + 542, + 805, + 508, + 987, + 286, + 451, + 157, + 58, + 126, + 707, + 874, + 501, + 982, + 986, + 382, + 41, + 829, + 616, + 895, + 505, + 627, + 795, + 555, + 774, + 968, + 377, + 762, + 317, + 742, + 635, + 481, + 850, + 989, + 438, + 72, + 210, + 611, + 451, + 521, + 454, + 85, + 277, + 797, + 147, + 31, + 74, + 621, + 119, + 180, + 571, + 234, + 358, + 131, + 70, + 857, + 330, + 438, + 379, + 166, + 33, + 920, + 139, + 316, + 776, + 266, + 284, + 247, + 949, + 689, + 857, + 534, + 355, + 648, + 302, + 840, + 847, + 958, + 2, + 602, + 455, + 372, + 229, + 370, + 417, + 221, + 792, + 91, + 217, + 154, + 508, + 45, + 317, + 33, + 819, + 48, + 243, + 601, + 291, + 613, + 242, + 333, + 505, + 537, + 301, + 299, + 466, + 927, + 92, + 775, + 212, + 985, + 173, + 32, + 595, + 643, + 416, + 911, + 959, + 252, + 832, + 808, + 907, + 761, + 548, + 551, + 664, + 728, + 190, + 280, + 384, + 822, + 715, + 834, + 191, + 437, + 241, + 529, + 268, + 38, + 151, + 14, + 269, + 679, + 357, + 110, + 200, + 393, + 837, + 212, + 46, + 336, + 193, + 291, + 985, + 975, + 524, + 149, + 599, + 424, + 141, + 729, + 703, + 238, + 589, + 660, + 263, + 319, + 946, + 238, + 368, + 728, + 660, + 168, + 66, + 679, + 500, + 359, + 281, + 159, + 189, + 608, + 793, + 204, + 706, + 72, + 77, + 660, + 751, + 38, + 154, + 437, + 76, + 264, + 859, + 216, + 156, + 983, + 886, + 802, + 924, + 144, + 995, + 643, + 614, + 295, + 229, + 125, + 29, + 106, + 625, + 27, + 203, + 327, + 995, + 123, + 975, + 379, + 576, + 258, + 186, + 545, + 719, + 530, + 832, + 867, + 144, + 146, + 619, + 623, + 110, + 218, + 779, + 481, + 281, + 826, + 771, + 569, + 907, + 342, + 317, + 353, + 5, + 360, + 421, + 70, + 130, + 42, + 514, + 648, + 409, + 909, + 401, + 487, + 72, + 580, + 4, + 76, + 515, + 382, + 64, + 193, + 212, + 20, + 604, + 478, + 901, + 784, + 277, + 761, + 681, + 429, + 470, + 57, + 648, + 609, + 997, + 71, + 745, + 876, + 41, + 946, + 522, + 339, + 247, + 221, + 962, + 110, + 844, + 679, + 416, + 522, + 429, + 767, + 5, + 819, + 450, + 66, + 644, + 722, + 937, + 539, + 977, + 727, + 846, + 973, + 391, + 699, + 656, + 496, + 444, + 173, + 415, + 717, + 463, + 935, + 954, + 248, + 450, + 892, + 733, + 537, + 434, + 920, + 671, + 223, + 891, + 252, + 313, + 122, + 393, + 156, + 131, + 595, + 81, + 71, + 936, + 906, + 590, + 187, + 810, + 812, + 639, + 626, + 233, + 335, + 341, + 253, + 956, + 363, + 995, + 971, + 810, + 478, + 206, + 382, + 874, + 580, + 308, + 178, + 734, + 834, + 576, + 938, + 126, + 877, + 939, + 274, + 793, + 364, + 64, + 347, + 470, + 975, + 22, + 14, + 297, + 674, + 400, + 8, + 274, + 842, + 128, + 102, + 183, + 978, + 687, + 614, + 545, + 770, + 18, + 353, + 892, + 301, + 327, + 497, + 271, + 822, + 509, + 154, + 588, + 543, + 561, + 632, + 90, + 413, + 29, + 462, + 925, + 667, + 203, + 846, + 271, + 353, + 647, + 434, + 888, + 392, + 82, + 445, + 865, + 709, + 515, + 382, + 799, + 672, + 975, + 466, + 482, + 168, + 10, + 150, + 317, + 606, + 550, + 166, + 672, + 522, + 968, + 605, + 945, + 949, + 506, + 353, + 905, + 660, + 906, + 490, + 74, + 493, + 82, + 47, + 526, + 850, + 257, + 308, + 227, + 343, + 95, + 260, + 539, + 593, + 197, + 304, + 384, + 589, + 179, + 553, + 389, + 851, + 731, + 831, + 711, + 357, + 554, + 982, + 2, + 351, + 879, + 42, + 400, + 205, + 228, + 328, + 820, + 275, + 850, + 320, + 253, + 621, + 873, + 842, + 846, + 108, + 180, + 300, + 514, + 658, + 211, + 373, + 301, + 202, + 930, + 489, + 581, + 815, + 175, + 738, + 551, + 711, + 609, + 343, + 606, + 123, + 411, + 851, + 207, + 742, + 296, + 741, + 184, + 175, + 497, + 32, + 550, + 37, + 970, + 526, + 430, + 575, + 242, + 934, + 283, + 965, + 561, + 702, + 750, + 902, + 964, + 711, + 92, + 670, + 243, + 188, + 481, + 460, + 556, + 886, + 890, + 502, + 473, + 8, + 288, + 57, + 356, + 721, + 112, + 817, + 282, + 123, + 680, + 344, + 21, + 935, + 60, + 287, + 444, + 267, + 30, + 447, + 310, + 922, + 284, + 442, + 651, + 454, + 924, + 771, + 611, + 852, + 986, + 367, + 399, + 115, + 370, + 326, + 765, + 323, + 640, + 906, + 242, + 526, + 876, + 899, + 624, + 166, + 796, + 252, + 431, + 99, + 626, + 870, + 928, + 935, + 229, + 286, + 20, + 648, + 539, + 533, + 379, + 64, + 179, + 317, + 896, + 293, + 144, + 971, + 401, + 720, + 986, + 286, + 277, + 828, + 671, + 66, + 566, + 461, + 847, + 904, + 318, + 59, + 621, + 958, + 590, + 905, + 849, + 718, + 338, + 342, + 730, + 22, + 944, + 544, + 25, + 348, + 39, + 719, + 705, + 596, + 908, + 805, + 594, + 7, + 47, + 744, + 148, + 177, + 476, + 866, + 849, + 88, + 246, + 438, + 523, + 156, + 886, + 758, + 605, + 39, + 209, + 29, + 678, + 98, + 879, + 286, + 447, + 105, + 832, + 303, + 190, + 164, + 969, + 222, + 995, + 331, + 492, + 399, + 824, + 14, + 405, + 831, + 597, + 670, + 857, + 120, + 873, + 171, + 890, + 905, + 637, + 115, + 605, + 336, + 114, + 828, + 284, + 303, + 883, + 158, + 494, + 153, + 549, + 232, + 556, + 695, + 58, + 29, + 504, + 252, + 77, + 35, + 646, + 137, + 448, + 400, + 468, + 237, + 258, + 857, + 150, + 981, + 756, + 616, + 138, + 188, + 386, + 721, + 370, + 71, + 911, + 73, + 967, + 568, + 504, + 164, + 770, + 100, + 179, + 753, + 551, + 67, + 657, + 652, + 243, + 444, + 398, + 865, + 772, + 427, + 338, + 592, + 63, + 536, + 519, + 721, + 83, + 212, + 451, + 148, + 117, + 98, + 888, + 61, + 734, + 672, + 502, + 723, + 783, + 345, + 338, + 740, + 909, + 505, + 839, + 975, + 654, + 804, + 611, + 69, + 11, + 523, + 629, + 404, + 856, + 620, + 442, + 578, + 574, + 149, + 135, + 970, + 938, + 492, + 713, + 886, + 639, + 454, + 376, + 594, + 374, + 530, + 634, + 168, + 566, + 809, + 268, + 110, + 766, + 381, + 754, + 592, + 582, + 283, + 0, + 298, + 246, + 854, + 1, + 663, + 430, + 801, + 700, + 519, + 357, + 169, + 8, + 136, + 246, + 613, + 300, + 148, + 884, + 563, + 392, + 99, + 846, + 824, + 322, + 293, + 341, + 555, + 193, + 718, + 570, + 822, + 222, + 854, + 12, + 226, + 16, + 516, + 920, + 639, + 838, + 670, + 529, + 485, + 959, + 912, + 543, + 706, + 877, + 863, + 852, + 351, + 912, + 640, + 705, + 697, + 687, + 241, + 287, + 290, + 930, + 964, + 1 +}; +const int idx[2399] = { + 220, + 336, + 347, + 422, + 44, + 128, + 145, + 234, + 259, + 315, + 64, + 103, + 378, + 469, + 477, + 33, + 108, + 126, + 173, + 196, + 328, + 331, + 52, + 55, + 109, + 306, + 337, + 412, + 443, + 364, + 456, + 487, + 496, + 299, + 23, + 259, + 67, + 196, + 409, + 51, + 77, + 147, + 301, + 362, + 26, + 106, + 239, + 39, + 81, + 118, + 187, + 290, + 339, + 395, + 443, + 36, + 45, + 195, + 210, + 244, + 273, + 22, + 92, + 215, + 306, + 364, + 66, + 216, + 5, + 25, + 145, + 171, + 330, + 401, + 412, + 75, + 148, + 180, + 204, + 231, + 432, + 443, + 100, + 232, + 400, + 467, + 114, + 284, + 300, + 330, + 370, + 49, + 135, + 183, + 191, + 268, + 423, + 491, + 104, + 280, + 393, + 442, + 443, + 461, + 136, + 175, + 205, + 216, + 466, + 5, + 85, + 429, + 491, + 0, + 36, + 78, + 95, + 161, + 169, + 219, + 231, + 250, + 336, + 341, + 360, + 495, + 59, + 134, + 213, + 319, + 409, + 93, + 104, + 256, + 223, + 226, + 8, + 115, + 185, + 216, + 320, + 399, + 461, + 14, + 60, + 87, + 93, + 134, + 170, + 391, + 399, + 416, + 455, + 3, + 86, + 99, + 304, + 471, + 488, + 0, + 102, + 132, + 179, + 303, + 312, + 313, + 320, + 389, + 279, + 473, + 180, + 303, + 310, + 326, + 7, + 136, + 239, + 256, + 276, + 350, + 21, + 32, + 79, + 209, + 270, + 314, + 463, + 87, + 134, + 188, + 212, + 418, + 13, + 76, + 124, + 179, + 409, + 411, + 19, + 299, + 207, + 266, + 329, + 468, + 29, + 45, + 265, + 310, + 384, + 429, + 480, + 191, + 347, + 61, + 66, + 219, + 228, + 277, + 289, + 308, + 402, + 409, + 133, + 382, + 488, + 18, + 310, + 439, + 206, + 257, + 290, + 356, + 443, + 43, + 140, + 184, + 187, + 278, + 286, + 341, + 354, + 126, + 201, + 208, + 239, + 454, + 485, + 40, + 87, + 222, + 367, + 398, + 457, + 299, + 423, + 440, + 44, + 115, + 126, + 147, + 291, + 411, + 64, + 480, + 1, + 67, + 80, + 91, + 163, + 239, + 42, + 350, + 361, + 427, + 67, + 169, + 270, + 15, + 44, + 223, + 378, + 452, + 471, + 31, + 67, + 274, + 292, + 457, + 58, + 107, + 183, + 222, + 347, + 407, + 27, + 65, + 84, + 208, + 273, + 385, + 441, + 43, + 97, + 226, + 305, + 360, + 492, + 26, + 88, + 284, + 369, + 476, + 21, + 48, + 478, + 230, + 312, + 409, + 475, + 42, + 53, + 78, + 259, + 268, + 489, + 3, + 37, + 60, + 141, + 132, + 150, + 157, + 328, + 353, + 357, + 422, + 466, + 480, + 154, + 455, + 295, + 411, + 249, + 320, + 359, + 381, + 401, + 451, + 210, + 231, + 253, + 323, + 330, + 5, + 55, + 79, + 105, + 298, + 496, + 160, + 229, + 425, + 30, + 63, + 115, + 129, + 280, + 458, + 31, + 68, + 254, + 360, + 420, + 490, + 2, + 172, + 180, + 209, + 223, + 228, + 265, + 357, + 369, + 380, + 443, + 453, + 483, + 36, + 110, + 129, + 135, + 246, + 305, + 36, + 211, + 239, + 254, + 392, + 403, + 494, + 255, + 332, + 485, + 110, + 360, + 498, + 0, + 11, + 37, + 106, + 182, + 308, + 14, + 41, + 75, + 218, + 256, + 259, + 294, + 462, + 218, + 231, + 248, + 392, + 427, + 21, + 234, + 406, + 29, + 171, + 248, + 255, + 352, + 34, + 57, + 122, + 173, + 254, + 308, + 380, + 393, + 278, + 28, + 62, + 129, + 296, + 455, + 474, + 15, + 47, + 128, + 133, + 300, + 390, + 459, + 468, + 35, + 48, + 70, + 287, + 299, + 318, + 22, + 108, + 171, + 195, + 460, + 496, + 188, + 21, + 31, + 86, + 338, + 420, + 422, + 486, + 495, + 245, + 445, + 22, + 85, + 92, + 337, + 381, + 387, + 7, + 9, + 231, + 425, + 430, + 56, + 196, + 344, + 354, + 377, + 91, + 107, + 177, + 221, + 295, + 321, + 5, + 35, + 48, + 90, + 290, + 432, + 447, + 51, + 322, + 324, + 364, + 482, + 59, + 303, + 334, + 444, + 450, + 55, + 125, + 319, + 380, + 394, + 431, + 82, + 112, + 157, + 187, + 261, + 326, + 347, + 366, + 18, + 124, + 490, + 8, + 218, + 291, + 35, + 132, + 322, + 425, + 147, + 150, + 242, + 472, + 186, + 195, + 201, + 216, + 251, + 458, + 33, + 46, + 153, + 297, + 298, + 311, + 322, + 399, + 426, + 65, + 230, + 9, + 32, + 69, + 391, + 70, + 126, + 147, + 222, + 86, + 261, + 412, + 183, + 474, + 110, + 125, + 172, + 185, + 402, + 363, + 403, + 462, + 40, + 274, + 386, + 449, + 333, + 340, + 421, + 424, + 410, + 30, + 86, + 262, + 374, + 23, + 72, + 9, + 47, + 86, + 93, + 286, + 304, + 402, + 420, + 118, + 265, + 276, + 283, + 455, + 20, + 36, + 391, + 115, + 137, + 305, + 334, + 10, + 188, + 237, + 271, + 393, + 422, + 497, + 21, + 30, + 99, + 109, + 175, + 198, + 467, + 3, + 19, + 63, + 82, + 115, + 149, + 265, + 24, + 151, + 217, + 252, + 307, + 421, + 146, + 333, + 381, + 434, + 32, + 311, + 361, + 93, + 142, + 152, + 395, + 422, + 467, + 91, + 181, + 244, + 294, + 332, + 390, + 97, + 177, + 296, + 323, + 428, + 27, + 215, + 318, + 66, + 193, + 216, + 333, + 416, + 127, + 171, + 209, + 219, + 333, + 377, + 401, + 9, + 103, + 129, + 135, + 290, + 438, + 33, + 107, + 221, + 351, + 392, + 406, + 91, + 170, + 182, + 313, + 419, + 465, + 28, + 74, + 175, + 231, + 270, + 30, + 34, + 240, + 253, + 63, + 133, + 337, + 369, + 416, + 255, + 445, + 145, + 350, + 416, + 183, + 257, + 414, + 136, + 164, + 255, + 300, + 434, + 438, + 447, + 60, + 157, + 396, + 412, + 25, + 343, + 42, + 105, + 361, + 472, + 34, + 74, + 136, + 436, + 474, + 94, + 177, + 205, + 225, + 227, + 319, + 23, + 245, + 383, + 426, + 31, + 190, + 215, + 228, + 324, + 416, + 7, + 12, + 260, + 470, + 13, + 290, + 9, + 44, + 117, + 166, + 186, + 260, + 361, + 372, + 224, + 241, + 369, + 1, + 87, + 297, + 457, + 29, + 98, + 118, + 158, + 226, + 286, + 74, + 167, + 241, + 328, + 370, + 412, + 454, + 1, + 37, + 183, + 228, + 311, + 336, + 345, + 413, + 430, + 446, + 211, + 327, + 375, + 84, + 195, + 219, + 430, + 447, + 195, + 384, + 50, + 93, + 224, + 349, + 479, + 6, + 56, + 105, + 118, + 170, + 286, + 468, + 466, + 153, + 224, + 240, + 400, + 444, + 63, + 158, + 196, + 237, + 284, + 296, + 405, + 407, + 480, + 26, + 56, + 233, + 428, + 370, + 398, + 491, + 159, + 184, + 488, + 131, + 134, + 138, + 276, + 344, + 372, + 428, + 494, + 269, + 486, + 136, + 139, + 163, + 201, + 253, + 272, + 374, + 398, + 487, + 307, + 375, + 487, + 168, + 284, + 346, + 420, + 451, + 134, + 175, + 284, + 88, + 105, + 286, + 448, + 96, + 117, + 177, + 240, + 285, + 325, + 455, + 51, + 228, + 298, + 421, + 150, + 433, + 182, + 362, + 410, + 58, + 262, + 352, + 439, + 43, + 70, + 134, + 278, + 152, + 210, + 283, + 310, + 333, + 334, + 469, + 20, + 42, + 69, + 222, + 283, + 320, + 330, + 376, + 218, + 285, + 413, + 434, + 5, + 175, + 180, + 265, + 440, + 474, + 241, + 255, + 377, + 479, + 307, + 317, + 457, + 0, + 232, + 342, + 496, + 25, + 292, + 105, + 169, + 208, + 300, + 439, + 21, + 65, + 120, + 249, + 273, + 191, + 302, + 376, + 56, + 92, + 240, + 371, + 391, + 446, + 489, + 84, + 241, + 322, + 473, + 475, + 16, + 92, + 214, + 239, + 50, + 158, + 175, + 452, + 51, + 360, + 25, + 39, + 90, + 99, + 133, + 408, + 491, + 430, + 12, + 64, + 76, + 189, + 481, + 128, + 306, + 442, + 77, + 276, + 337, + 356, + 380, + 389, + 445, + 61, + 158, + 194, + 445, + 303, + 398, + 143, + 163, + 199, + 343, + 236, + 246, + 340, + 382, + 446, + 38, + 154, + 196, + 202, + 266, + 367, + 369, + 117, + 136, + 250, + 272, + 413, + 481, + 0, + 199, + 205, + 412, + 39, + 177, + 198, + 369, + 448, + 91, + 153, + 167, + 187, + 203, + 265, + 328, + 218, + 222, + 261, + 413, + 419, + 447, + 128, + 228, + 498, + 0, + 148, + 198, + 486, + 497, + 50, + 398, + 457, + 283, + 460, + 43, + 116, + 246, + 248, + 305, + 447, + 106, + 131, + 317, + 126, + 199, + 235, + 293, + 34, + 108, + 226, + 3, + 108, + 129, + 155, + 174, + 162, + 239, + 490, + 124, + 214, + 346, + 469, + 497, + 274, + 316, + 122, + 144, + 149, + 290, + 337, + 362, + 371, + 466, + 67, + 248, + 276, + 332, + 360, + 387, + 405, + 31, + 56, + 65, + 90, + 200, + 64, + 176, + 203, + 215, + 236, + 240, + 337, + 383, + 198, + 411, + 431, + 36, + 90, + 350, + 356, + 497, + 33, + 120, + 130, + 183, + 409, + 493, + 8, + 35, + 254, + 277, + 321, + 341, + 388, + 423, + 497, + 143, + 163, + 391, + 446, + 492, + 9, + 270, + 42, + 52, + 116, + 396, + 456, + 478, + 491, + 143, + 148, + 286, + 328, + 384, + 35, + 127, + 351, + 452, + 7, + 46, + 259, + 35, + 290, + 370, + 420, + 104, + 258, + 278, + 340, + 481, + 169, + 264, + 368, + 232, + 471, + 1, + 135, + 211, + 152, + 174, + 177, + 187, + 292, + 411, + 430, + 461, + 4, + 92, + 205, + 237, + 247, + 333, + 53, + 91, + 289, + 334, + 425, + 491, + 118, + 175, + 490, + 36, + 361, + 33, + 186, + 213, + 471, + 3, + 73, + 163, + 409, + 235, + 384, + 410, + 470, + 480, + 59, + 469, + 97, + 344, + 372, + 33, + 107, + 179, + 397, + 470, + 291, + 340, + 361, + 385, + 25, + 111, + 158, + 331, + 471, + 28, + 87, + 307, + 69, + 105, + 159, + 284, + 311, + 312, + 359, + 465, + 17, + 133, + 302, + 324, + 274, + 325, + 421, + 252, + 4, + 96, + 409, + 206, + 246, + 288, + 58, + 81, + 150, + 226, + 232, + 380, + 168, + 229, + 367, + 210, + 248, + 405, + 420, + 163, + 212, + 320, + 340, + 448, + 68, + 222, + 439, + 494, + 70, + 94, + 116, + 471, + 284, + 380, + 13, + 26, + 120, + 276, + 394, + 432, + 492, + 281, + 297, + 300, + 355, + 29, + 32, + 156, + 182, + 467, + 203, + 234, + 420, + 429, + 210, + 224, + 248, + 273, + 326, + 349, + 37, + 202, + 377, + 380, + 43, + 55, + 139, + 141, + 170, + 232, + 292, + 322, + 77, + 214, + 241, + 279, + 326, + 18, + 46, + 55, + 107, + 227, + 238, + 250, + 146, + 168, + 402, + 444, + 459, + 487, + 495, + 6, + 121, + 256, + 303, + 457, + 461, + 69, + 122, + 193, + 204, + 240, + 347, + 412, + 418, + 476, + 169, + 187, + 400, + 97, + 290, + 364, + 394, + 153, + 184, + 187, + 9, + 13, + 65, + 89, + 120, + 221, + 484, + 6, + 120, + 180, + 419, + 15, + 86, + 104, + 193, + 276, + 324, + 437, + 443, + 62, + 97, + 193, + 288, + 315, + 318, + 414, + 24, + 170, + 189, + 196, + 216, + 228, + 270, + 420, + 214, + 407, + 466, + 2, + 77, + 127, + 188, + 230, + 310, + 464, + 469, + 80, + 204, + 138, + 171, + 252, + 424, + 0, + 95, + 363, + 395, + 408, + 430, + 96, + 143, + 289, + 97, + 183, + 341, + 399, + 460, + 84, + 243, + 498, + 28, + 65, + 77, + 84, + 139, + 147, + 171, + 214, + 256, + 348, + 408, + 444, + 449, + 457, + 120, + 342, + 38, + 217, + 465, + 8, + 212, + 268, + 346, + 486, + 491, + 49, + 77, + 90, + 222, + 291, + 383, + 130, + 405, + 431, + 473, + 78, + 290, + 351, + 189, + 304, + 498, + 336, + 10, + 219, + 257, + 402, + 437, + 65, + 69, + 168, + 198, + 65, + 241, + 242, + 290, + 360, + 402, + 254, + 256, + 398, + 407, + 66, + 97, + 164, + 222, + 316, + 390, + 429, + 24, + 81, + 133, + 207, + 313, + 67, + 108, + 204, + 303, + 494, + 43, + 194, + 198, + 285, + 294, + 347, + 356, + 394, + 83, + 92, + 147, + 167, + 386, + 20, + 225, + 400, + 172, + 363, + 99, + 64, + 373, + 377, + 6, + 63, + 206, + 107, + 149, + 230, + 428, + 41, + 56, + 77, + 78, + 311, + 413, + 476, + 477, + 81, + 130, + 145, + 167, + 247, + 416, + 56, + 289, + 339, + 27, + 47, + 132, + 309, + 392, + 36, + 55, + 73, + 352, + 358, + 25, + 58, + 352, + 430, + 58, + 171, + 221, + 334, + 379, + 453, + 288, + 479, + 109, + 134, + 143, + 174, + 285, + 313, + 468, + 495, + 258, + 289, + 334, + 382, + 483, + 46, + 136, + 264, + 417, + 458, + 36, + 59, + 88, + 173, + 310, + 316, + 354, + 471, + 46, + 225, + 262, + 335, + 364, + 468, + 121, + 341, + 349, + 7, + 14, + 21, + 99, + 135, + 142, + 207, + 209, + 272, + 294, + 456, + 491, + 208, + 248, + 321, + 43, + 129, + 188, + 362, + 191, + 279, + 294, + 307, + 324, + 362, + 140, + 422, + 56, + 169, + 188, + 232, + 328, + 449, + 14, + 134, + 369, + 375, + 48, + 164, + 224, + 260, + 20, + 93, + 157, + 219, + 262, + 274, + 362, + 473, + 484, + 103, + 125, + 140, + 174, + 175, + 191, + 226, + 358, + 408, + 450, + 20, + 94, + 289, + 310, + 311, + 448, + 478, + 36, + 175, + 185, + 337, + 391, + 48, + 72, + 184, + 233, + 345, + 485, + 231, + 242, + 339, + 451, + 456, + 152, + 158, + 398, + 458, + 488, + 151, + 240, + 357, + 1, + 33, + 139, + 141, + 177, + 223, + 289, + 479, + 90, + 115, + 461, + 480, + 24, + 26, + 44, + 72, + 213, + 361, + 445, + 34, + 119, + 470, + 19, + 56, + 405, + 464, + 47, + 112, + 163, + 235, + 342, + 462, + 103, + 192, + 225, + 23, + 458, + 68, + 270, + 363, + 422, + 427, + 449, + 450, + 477, + 105, + 131, + 139, + 198, + 212, + 413, + 429, + 435, + 43, + 278, + 19, + 113, + 192, + 327, + 347, + 44, + 67, + 160, + 225, + 263, + 330, + 344, + 158, + 274, + 303, + 317, + 350, + 379, + 409, + 33, + 53, + 217, + 273, + 304, + 352, + 461, + 495, + 101, + 168, + 370, + 395, + 458, + 156, + 301, + 319, + 324, + 347, + 73, + 127, + 253, + 272, + 128, + 212, + 237, + 257, + 351, + 77, + 106, + 216, + 270, + 368, + 371, + 400, + 223, + 355, + 384, + 30, + 268, + 307, + 368, + 79, + 300, + 317, + 327, + 15, + 376, + 31, + 80, + 160, + 206, + 227, + 103, + 231, + 435, + 481, + 499, + 182, + 186, + 189, + 442, + 7, + 59, + 65, + 117, + 225, + 298, + 304, + 364, + 457, + 489, + 186, + 198, + 265, + 309, + 336, + 391, + 457, + 314, + 418, + 81, + 133, + 186, + 190, + 227, + 258, + 277, + 419, + 492, + 82, + 222, + 239, + 315, + 71, + 92, + 122, + 220, + 252, + 272, + 311, + 391, + 433, + 97, + 137, + 244, + 267, + 426, + 34, + 202, + 234, + 426, + 428, + 51, + 109, + 267, + 377, + 382, + 107, + 166, + 203, + 337, + 0, + 127, + 247, + 404, + 64, + 94, + 373, + 430, + 448, + 17, + 37, + 57, + 102, + 352, + 354, + 114, + 174, + 193, + 241, + 284, + 74, + 94, + 213, + 238, + 475, + 476, + 140, + 247, + 280, + 302, + 328, + 49, + 197, + 201, + 222, + 280, + 457, + 167, + 445, + 465, + 478, + 499, + 25, + 215, + 438, + 8, + 129, + 153, + 171, + 316, + 328, + 158, + 215, + 303, + 328, + 353, + 479, + 62, + 251, + 271, + 4, + 119, + 262, + 303, + 311, + 405, + 419, + 277, + 461, + 236, + 248, + 445, + 15, + 108, + 227, + 309, + 362, + 378, + 424, + 78, + 94, + 109, + 118, + 124, + 247, + 253, + 315, + 478, + 13, + 154, + 170, + 331, + 365, + 386, + 264, + 268, + 300, + 305, + 429, + 463, + 499, + 52, + 105, + 135, + 181, + 111, + 156, + 183, + 231, + 350, + 388, + 461, + 291, + 360, + 80, + 106, + 138, + 197, + 242, + 255, + 260, + 381, + 415, + 447, + 499, + 41, + 266, + 341, + 391, + 410, + 448, + 495, + 58, + 146, + 286, + 351, + 419, + 436, + 464, + 483, + 251, + 252, + 444, + 492, + 184, + 200, + 57, + 75, + 170, + 186, + 187, + 275, + 314, + 364, + 407, + 162, + 173, + 232, + 211, + 355, + 445, + 448, + 308, + 98, + 280, + 397, + 431, + 112, + 122, + 157, + 209, + 338, + 388, + 429, + 112, + 213, + 349, + 470, + 69, + 70, + 119, + 222, + 251, + 453, + 81, + 173, + 482, + 105, + 147, + 10, + 229, + 462, + 467, + 98, + 421, + 479, + 203, + 498, + 499, + 93, + 130, + 142, + 270, + 278, + 336, + 419, + 73, + 134, + 142, + 177, + 192, + 335, + 490, + 45, + 140, + 143, + 195, + 274, + 284, + 324, + 56, + 94, + 171, + 28, + 135, + 258, + 277, + 284, + 333, + 370, + 421, + 432, + 465, + 31, + 46, + 222, + 331, + 387, + 432, + 18, + 56, + 82, + 95, + 258, + 261, + 356, + 378, + 484, + 60, + 285, + 298, + 347, + 0, + 200, + 307, + 372, + 2, + 89, + 201, + 291, + 298, + 382, + 455, + 121, + 145, + 155, + 47, + 226, + 236, + 396, + 398, + 137, + 311, + 381, + 429, + 45, + 109, + 141, + 173, + 207, + 464, + 471, + 499, + 37, + 45, + 268, + 447, + 496, + 41, + 163, + 387, + 484, + 30, + 48, + 91, + 146, + 261, + 313, + 401, + 11, + 78, + 122, + 144, + 450, + 499, + 75, + 82, + 131, + 218, + 257, + 285, + 294, + 362, + 442, + 213, + 255, + 291, + 492, + 63, + 80, + 282, + 418, + 1, + 60, + 87, + 102, + 111, + 180, + 272, + 281, + 324, + 380, + 458, + 185, + 216, + 475, + 12, + 62, + 109, + 143, + 195, + 257, + 271, + 324, + 385, + 410, + 226, + 330, + 404, + 54, + 158, + 374, + 221, + 320, + 340, + 86, + 93, + 236, + 94, + 159, + 238, + 242, + 318, + 356, + 40, + 75, + 168, + 211, + 294, + 32, + 164, + 174, + 198, + 421, + 13, + 102, + 314, + 379, + 418, + 439, + 485, + 6, + 53, + 104, + 123, + 208, + 436, + 452, + 59, + 141, + 204, + 402, + 498, + 134, + 335, + 429, + 240, + 391, + 461, + 14, + 16, + 46, + 371, + 376, + 37, + 172, + 227, + 343, + 397, + 435, + 39, + 136, + 202, + 262, + 339, + 445, + 474, + 145, + 272, + 342, + 121, + 127, + 12, + 125, + 155, + 186, + 234, + 64, + 96, + 97, + 108, + 213, + 350, + 410, + 485, + 35, + 56, + 57, + 167, + 169, + 399, + 478, + 60, + 103, + 307, + 92, + 104, + 150, + 211, + 260, + 8, + 64, + 73, + 222, + 273, + 423, + 179, + 184, + 190, + 193, + 265, + 271, + 305, + 318, + 344, + 14, + 75, + 124, + 317, + 343, + 404, + 4, + 141, + 167, + 212, + 496 +}; +const double x[500] = { + 737, + 519, + 538, + 486, + 557, + 31, + 651, + 101, + 310, + 729, + 721, + 164, + 577, + 411, + 104, + 891, + 988, + 370, + 788, + 898, + 576, + 674, + 7, + 10, + 91, + 253, + 9, + 54, + 105, + 36, + 799, + 188, + 651, + 92, + 766, + 394, + 8, + 823, + 242, + 334, + 639, + 462, + 111, + 847, + 919, + 681, + 392, + 657, + 358, + 203, + 453, + 897, + 965, + 316, + 759, + 894, + 893, + 44, + 743, + 736, + 970, + 473, + 229, + 120, + 485, + 174, + 405, + 514, + 984, + 200, + 723, + 867, + 259, + 997, + 191, + 340, + 75, + 763, + 579, + 216, + 154, + 331, + 338, + 184, + 786, + 56, + 235, + 880, + 810, + 544, + 522, + 358, + 219, + 566, + 632, + 422, + 636, + 760, + 657, + 117, + 138, + 228, + 163, + 336, + 572, + 722, + 438, + 280, + 234, + 454, + 967, + 148, + 325, + 142, + 790, + 3, + 497, + 770, + 936, + 101, + 696, + 108, + 255, + 140, + 320, + 29, + 36, + 228, + 468, + 24, + 183, + 844, + 513, + 856, + 102, + 9, + 526, + 50, + 73, + 366, + 599, + 246, + 662, + 473, + 651, + 568, + 575, + 972, + 352, + 341, + 897, + 15, + 73, + 764, + 768, + 879, + 886, + 906, + 718, + 621, + 529, + 282, + 339, + 165, + 137, + 999, + 215, + 33, + 639, + 999, + 906, + 210, + 62, + 655, + 996, + 675, + 552, + 333, + 176, + 426, + 891, + 638, + 571, + 715, + 18, + 708, + 795, + 26, + 31, + 250, + 18, + 949, + 183, + 968, + 394, + 580, + 766, + 686, + 162, + 134, + 185, + 943, + 919, + 577, + 539, + 180, + 750, + 285, + 591, + 881, + 381, + 118, + 852, + 696, + 617, + 941, + 767, + 592, + 650, + 74, + 961, + 881, + 891, + 71, + 905, + 575, + 598, + 523, + 477, + 561, + 948, + 762, + 570, + 773, + 146, + 894, + 203, + 610, + 471, + 669, + 189, + 473, + 650, + 606, + 385, + 288, + 360, + 648, + 115, + 836, + 139, + 530, + 248, + 331, + 286, + 849, + 812, + 356, + 884, + 33, + 57, + 147, + 297, + 826, + 916, + 581, + 0, + 918, + 81, + 12, + 956, + 309, + 550, + 15, + 243, + 294, + 893, + 290, + 227, + 826, + 843, + 789, + 744, + 494, + 742, + 643, + 126, + 861, + 444, + 506, + 417, + 215, + 246, + 9, + 244, + 283, + 595, + 635, + 494, + 612, + 737, + 311, + 896, + 834, + 222, + 121, + 595, + 680, + 309, + 729, + 263, + 142, + 804, + 262, + 343, + 179, + 649, + 118, + 360, + 536, + 669, + 429, + 359, + 667, + 313, + 671, + 506, + 951, + 461, + 291, + 359, + 237, + 727, + 143, + 968, + 769, + 97, + 842, + 752, + 803, + 299, + 154, + 384, + 23, + 567, + 339, + 778, + 492, + 116, + 320, + 967, + 526, + 66, + 761, + 908, + 345, + 885, + 193, + 894, + 547, + 124, + 18, + 254, + 947, + 192, + 111, + 384, + 204, + 338, + 574, + 749, + 816, + 717, + 457, + 353, + 163, + 979, + 896, + 679, + 342, + 932, + 100, + 216, + 531, + 320, + 122, + 594, + 956, + 638, + 450, + 733, + 643, + 293, + 891, + 633, + 901, + 815, + 676, + 307, + 144, + 286, + 106, + 182, + 605, + 575, + 129, + 390, + 212, + 843, + 225, + 544, + 468, + 203, + 223, + 862, + 795, + 36, + 348, + 743, + 528, + 904, + 126, + 802, + 82, + 156, + 369, + 986, + 332, + 977, + 570, + 421, + 345, + 401, + 480, + 63, + 518, + 667, + 31, + 909, + 552, + 994, + 314, + 891, + 642, + 439, + 132, + 670, + 402, + 263, + 140, + 549, + 905, + 712, + 299, + 986, + 86, + 709, + 786, + 47, + 679, + 864, + 13, + 140, + 659, + 479, + 838, + 988, + 846, + 855, + 367, + 935, + 657, + 453, + 400, + 851, + 749, + 500, + 673, + 523, + 708, + 568, + 76, + 18, + 589, + 689, + 195, + 504, + 402, + 835, + 705, + 187, + 615, + 482, + 160, + 609, + 761, + 907, + 294, + 538, + 545 +}; +const int ptr[501] = { + 0, + 4, + 8, + 10, + 15, + 22, + 29, + 33, + 34, + 36, + 39, + 44, + 44, + 47, + 55, + 61, + 66, + 68, + 75, + 82, + 86, + 91, + 98, + 104, + 109, + 113, + 126, + 131, + 134, + 136, + 143, + 153, + 159, + 168, + 170, + 174, + 176, + 180, + 187, + 192, + 198, + 200, + 204, + 211, + 213, + 222, + 225, + 228, + 233, + 241, + 247, + 253, + 256, + 262, + 264, + 270, + 274, + 277, + 283, + 288, + 294, + 301, + 307, + 312, + 315, + 319, + 325, + 329, + 332, + 338, + 340, + 342, + 348, + 353, + 359, + 362, + 366, + 368, + 374, + 387, + 393, + 400, + 403, + 406, + 412, + 420, + 425, + 428, + 433, + 441, + 442, + 448, + 456, + 462, + 468, + 469, + 477, + 479, + 485, + 490, + 495, + 501, + 508, + 513, + 518, + 524, + 532, + 535, + 538, + 542, + 546, + 552, + 561, + 563, + 567, + 571, + 574, + 576, + 581, + 584, + 588, + 592, + 593, + 597, + 599, + 607, + 612, + 615, + 619, + 626, + 633, + 640, + 646, + 650, + 653, + 659, + 665, + 670, + 673, + 678, + 685, + 691, + 697, + 703, + 708, + 712, + 717, + 719, + 722, + 725, + 732, + 736, + 738, + 742, + 747, + 753, + 757, + 763, + 767, + 769, + 769, + 777, + 780, + 784, + 790, + 797, + 807, + 810, + 813, + 815, + 817, + 822, + 829, + 830, + 835, + 844, + 848, + 851, + 854, + 862, + 864, + 873, + 876, + 881, + 884, + 888, + 895, + 899, + 901, + 904, + 908, + 912, + 919, + 927, + 931, + 937, + 941, + 944, + 948, + 950, + 955, + 960, + 963, + 970, + 975, + 979, + 983, + 985, + 992, + 993, + 998, + 1001, + 1008, + 1012, + 1014, + 1018, + 1023, + 1030, + 1036, + 1040, + 1045, + 1052, + 1058, + 1061, + 1066, + 1069, + 1071, + 1077, + 1080, + 1084, + 1087, + 1090, + 1092, + 1095, + 1100, + 1102, + 1110, + 1117, + 1122, + 1130, + 1133, + 1138, + 1142, + 1144, + 1146, + 1153, + 1158, + 1160, + 1167, + 1172, + 1176, + 1179, + 1183, + 1188, + 1191, + 1193, + 1196, + 1204, + 1210, + 1216, + 1219, + 1221, + 1225, + 1229, + 1234, + 1236, + 1239, + 1244, + 1248, + 1253, + 1256, + 1264, + 1268, + 1271, + 1272, + 1275, + 1278, + 1284, + 1287, + 1291, + 1296, + 1300, + 1304, + 1306, + 1313, + 1317, + 1322, + 1326, + 1332, + 1336, + 1344, + 1349, + 1356, + 1363, + 1368, + 1369, + 1378, + 1381, + 1385, + 1388, + 1395, + 1399, + 1407, + 1414, + 1422, + 1425, + 1433, + 1435, + 1438, + 1439, + 1445, + 1448, + 1450, + 1453, + 1456, + 1470, + 1472, + 1475, + 1481, + 1487, + 1491, + 1494, + 1497, + 1498, + 1503, + 1507, + 1513, + 1517, + 1524, + 1529, + 1534, + 1542, + 1547, + 1550, + 1550, + 1552, + 1553, + 1556, + 1559, + 1563, + 1571, + 1577, + 1580, + 1585, + 1590, + 1594, + 1598, + 1600, + 1602, + 1610, + 1615, + 1620, + 1628, + 1634, + 1637, + 1649, + 1652, + 1656, + 1662, + 1664, + 1670, + 1674, + 1678, + 1687, + 1697, + 1704, + 1709, + 1715, + 1720, + 1725, + 1728, + 1736, + 1740, + 1747, + 1750, + 1754, + 1760, + 1763, + 1765, + 1773, + 1781, + 1783, + 1788, + 1795, + 1802, + 1810, + 1815, + 1820, + 1824, + 1829, + 1836, + 1839, + 1843, + 1847, + 1849, + 1854, + 1859, + 1863, + 1873, + 1880, + 1882, + 1891, + 1895, + 1899, + 1904, + 1909, + 1914, + 1919, + 1923, + 1927, + 1932, + 1938, + 1943, + 1949, + 1954, + 1960, + 1965, + 1968, + 1974, + 1980, + 1983, + 1990, + 1992, + 1995, + 2002, + 2011, + 2017, + 2024, + 2028, + 2035, + 2037, + 2048, + 2055, + 2063, + 2067, + 2069, + 2078, + 2081, + 2085, + 2086, + 2090, + 2097, + 2101, + 2107, + 2110, + 2112, + 2116, + 2119, + 2122, + 2129, + 2136, + 2143, + 2146, + 2156, + 2162, + 2171, + 2175, + 2179, + 2186, + 2189, + 2194, + 2198, + 2206, + 2211, + 2215, + 2222, + 2228, + 2237, + 2241, + 2245, + 2256, + 2259, + 2269, + 2272, + 2275, + 2278, + 2279, + 2281, + 2287, + 2292, + 2297, + 2304, + 2311, + 2316, + 2319, + 2322, + 2327, + 2333, + 2340, + 2343, + 2345, + 2350, + 2358, + 2365, + 2365, + 2368, + 2373, + 2379, + 2388, + 2394, + 2399 +}; +const double verify_data[500] = { + 1636962, + 1714376, + 142636, + 1151015, + 1672341, + 2790420, + 1447201, + 422892, + 30953, + 1030287, + 1335188, + 0, + 605334, + 2278445, + 858848, + 245423, + 950882, + 705076, + 1312024, + 1084284, + 1837558, + 1201746, + 2360392, + 1488940, + 688178, + 2632122, + 1481444, + 660854, + 346453, + 982949, + 1400599, + 1093225, + 2856372, + 1078398, + 1074402, + 579548, + 1820752, + 2638601, + 2072665, + 749887, + 687788, + 478788, + 1482258, + 1207317, + 1397243, + 794364, + 1002505, + 1651686, + 1028801, + 1189726, + 1513197, + 1214956, + 738475, + 633771, + 1207042, + 680857, + 899314, + 2277406, + 773143, + 1986687, + 907216, + 907940, + 1539019, + 1043338, + 681730, + 219905, + 1397298, + 2184201, + 1537202, + 266744, + 563005, + 1827909, + 1105928, + 2286680, + 887533, + 343193, + 238910, + 1678393, + 2600003, + 417502, + 1551071, + 798273, + 398719, + 2056881, + 1296314, + 917292, + 190534, + 882078, + 1979139, + 50621, + 1048185, + 1967771, + 1911887, + 1895897, + 23343, + 2658748, + 285864, + 1027049, + 975769, + 2488413, + 832738, + 844130, + 1379856, + 1785889, + 2463463, + 782430, + 982466, + 609500, + 706251, + 1981399, + 1861430, + 2146667, + 250104, + 1166284, + 1295022, + 189599, + 855191, + 1005718, + 969658, + 707377, + 561273, + 86496, + 717937, + 97767, + 1893638, + 779229, + 429727, + 99564, + 1863565, + 2267656, + 950026, + 780700, + 581248, + 393282, + 2134865, + 1244700, + 1894843, + 954212, + 1439102, + 779512, + 1459287, + 881497, + 2202043, + 1447401, + 1249637, + 765168, + 488244, + 837127, + 1236555, + 2281259, + 1995666, + 25783, + 534020, + 1486259, + 1268571, + 875283, + 744594, + 1410335, + 757320, + 0, + 1922627, + 399058, + 1490594, + 1475527, + 1587557, + 1695667, + 644546, + 536038, + 224304, + 414120, + 2029077, + 3930385, + 377416, + 1059074, + 1960417, + 1439575, + 368749, + 460183, + 2479302, + 105204, + 1426355, + 649313, + 2194338, + 918200, + 1591449, + 2229266, + 434520, + 684504, + 1009270, + 222922, + 600674, + 1011867, + 1321434, + 836127, + 2493805, + 1448674, + 1269364, + 1304961, + 98554, + 2423810, + 1570229, + 302458, + 2806045, + 1534004, + 1463827, + 1085011, + 120989, + 1701753, + 110302, + 938429, + 1186733, + 2255246, + 425960, + 376311, + 341394, + 1061333, + 2025091, + 522270, + 598604, + 1000824, + 2254049, + 1857539, + 346425, + 1345187, + 550497, + 1251096, + 943720, + 681558, + 555972, + 779590, + 299796, + 1445763, + 459865, + 774572, + 489448, + 2407693, + 1574903, + 1630452, + 1907397, + 555045, + 1902494, + 1172223, + 142555, + 445864, + 1376151, + 1200389, + 327553, + 1548402, + 1106503, + 888650, + 41081, + 1245270, + 845610, + 1232215, + 387441, + 434475, + 1204003, + 1333189, + 1672468, + 567827, + 11392, + 631046, + 1299298, + 719608, + 714169, + 362247, + 1308257, + 530903, + 398202, + 885445, + 2606806, + 1354354, + 438760, + 194928, + 712863, + 1010340, + 2245646, + 376041, + 876890, + 1683404, + 955032, + 1065455, + 925034, + 1731713, + 1152271, + 2093865, + 1221433, + 629438, + 2054936, + 2643313, + 1322567, + 1492288, + 1844514, + 1802382, + 871, + 1350044, + 967406, + 756881, + 574442, + 1295864, + 1815978, + 2822668, + 2201377, + 2729436, + 616018, + 2318346, + 332717, + 289665, + 97812, + 1881483, + 1003188, + 702530, + 409314, + 645118, + 3645947, + 723792, + 503126, + 1609036, + 1647277, + 587437, + 735899, + 666552, + 27354, + 1045106, + 397951, + 1087090, + 1173872, + 1629962, + 1334261, + 1855668, + 2856970, + 1341188, + 336968, + 0, + 521349, + 53118, + 881926, + 154917, + 942966, + 1237636, + 820836, + 579583, + 1436861, + 2025006, + 634434, + 829152, + 298073, + 205380, + 1622350, + 1171051, + 848451, + 2417009, + 2016092, + 390510, + 2721874, + 359761, + 309038, + 1061522, + 297026, + 1311767, + 305305, + 854945, + 1773244, + 2656339, + 896058, + 1069160, + 1552917, + 1421821, + 440874, + 216699, + 1654864, + 521705, + 807422, + 1242602, + 1329872, + 308130, + 526463, + 27937, + 1450630, + 1621987, + 799154, + 1378289, + 2519996, + 1149046, + 579937, + 1841561, + 1895047, + 1009234, + 1922198, + 2570006, + 409696, + 442495, + 277484, + 979605, + 1392287, + 1023715, + 1881778, + 2432703, + 2297384, + 542451, + 1368100, + 833048, + 1038108, + 742376, + 1542317, + 2230186, + 1249077, + 884020, + 1286059, + 1102407, + 1651393, + 1787846, + 1370154, + 2734166, + 2935249, + 447485, + 736859, + 828966, + 1547038, + 765990, + 1427773, + 255456, + 134871, + 1597546, + 2173052, + 1187286, + 2364828, + 1220233, + 1760369, + 75080, + 2799969, + 1363310, + 2347168, + 272279, + 33698, + 1192053, + 342501, + 356092, + 136578, + 1701048, + 2216796, + 1340150, + 1852854, + 580862, + 407410, + 1860346, + 200649, + 954363, + 955621, + 2234154, + 2007706, + 646339, + 2712491, + 1259244, + 2368138, + 1550431, + 1160903, + 987838, + 650293, + 833228, + 368144, + 1998925, + 1733716, + 1050000, + 1061635, + 1144649, + 1260205, + 851043, + 1417512, + 2826918, + 1059350, + 1522135, + 1039943, + 703837, + 1035006, + 19505, + 211545, + 1461101, + 1238659, + 1414306, + 1151385, + 2169011, + 1101116, + 1118290, + 335296, + 1502266, + 1405699, + 1762457, + 530338, + 246108, + 484583, + 2164048, + 1614511, + 0, + 1446940, + 575450, + 2043329, + 2057251, + 774670, + 1084124 +}; diff --git a/apps/riscv-tests/benchmarks/spmv/spmv_gendata.scala b/apps/riscv-tests/benchmarks/spmv/spmv_gendata.scala new file mode 100644 index 0000000..f777445 --- /dev/null +++ b/apps/riscv-tests/benchmarks/spmv/spmv_gendata.scala @@ -0,0 +1,48 @@ +#!/usr/bin/env scala +!# + +val m = args(0).toInt +val n = args(1).toInt +val approx_nnz = args(2).toInt + +val pnnz = approx_nnz.toDouble/(m*n) +val idx = collection.mutable.ArrayBuffer[Int]() +val p = collection.mutable.ArrayBuffer(0) + +for (i <- 0 until m) { + for (j <- 0 until n) { + if (util.Random.nextDouble < pnnz) + idx += j + } + p += idx.length +} + +val nnz = idx.length +val v = Array.tabulate(n)(i => util.Random.nextInt(1000)) +val d = Array.tabulate(nnz)(i => util.Random.nextInt(1000)) + +def printVec(t: String, name: String, data: Seq[Int]) = { + println("const " + t + " " + name + "[" + data.length + "] = {") + println(" "+data.map(_.toString).reduceLeft(_+",\n "+_)) + println("};") +} + +def spmv(p: Seq[Int], d: Seq[Int], idx: Seq[Int], v: Seq[Int]) = { + val y = collection.mutable.ArrayBuffer[Int]() + for (i <- 0 until p.length-1) { + var yi = 0 + for (k <- p(i) until p(i+1)) + yi = yi + d(k)*v(idx(k)) + y += yi + } + y +} + +println("#define R " + m) +println("#define C " + n) +println("#define NNZ " + nnz) +printVec("double", "val", d) +printVec("int", "idx", idx) +printVec("double", "x", v) +printVec("int", "ptr", p) +printVec("double", "verify_data", spmv(p, d, idx, v)) diff --git a/apps/riscv-tests/benchmarks/spmv/spmv_main.c b/apps/riscv-tests/benchmarks/spmv/spmv_main.c new file mode 100644 index 0000000..5232f68 --- /dev/null +++ b/apps/riscv-tests/benchmarks/spmv/spmv_main.c @@ -0,0 +1,52 @@ +// See LICENSE for license details. + +//************************************************************************** +// Double-precision sparse matrix-vector multiplication benchmark +//-------------------------------------------------------------------------- + +#include "util.h" + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#include "dataset1.h" + +void spmv(int r, const double* val, const int* idx, const double* x, + const int* ptr, double* y) +{ + for (int i = 0; i < r; i++) + { + int k; + double yi0 = 0, yi1 = 0, yi2 = 0, yi3 = 0; + for (k = ptr[i]; k < ptr[i+1]-3; k+=4) + { + yi0 += val[k+0]*x[idx[k+0]]; + yi1 += val[k+1]*x[idx[k+1]]; + yi2 += val[k+2]*x[idx[k+2]]; + yi3 += val[k+3]*x[idx[k+3]]; + } + for ( ; k < ptr[i+1]; k++) + { + yi0 += val[k]*x[idx[k]]; + } + y[i] = (yi0+yi1)+(yi2+yi3); + } +} + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ + double y[R]; + +#if PREALLOCATE + spmv(R, val, idx, x, ptr, y); +#endif + + setStats(1); + spmv(R, val, idx, x, ptr, y); + setStats(0); + + return verifyDouble(R, y, verify_data); +} diff --git a/apps/riscv-tests/benchmarks/towers/towers_main.c b/apps/riscv-tests/benchmarks/towers/towers_main.c new file mode 100644 index 0000000..8c2355a --- /dev/null +++ b/apps/riscv-tests/benchmarks/towers/towers_main.c @@ -0,0 +1,234 @@ +// See LICENSE for license details. + +//************************************************************************** +// Towers of Hanoi benchmark +//-------------------------------------------------------------------------- +// +// Towers of Hanoi is a classic puzzle problem. The game consists of +// three pegs and a set of discs. Each disc is a different size, and +// initially all of the discs are on the left most peg with the smallest +// disc on top and the largest disc on the bottom. The goal is to move all +// of the discs onto the right most peg. The catch is that you are only +// allowed to move one disc at a time and you can never place a larger +// disc on top of a smaller disc. +// +// This implementation starts with NUM_DISC discs and uses a recursive +// algorithm to sovel the puzzle. + +#include "util.h" + +// This is the number of discs in the puzzle. + +#define NUM_DISCS 7 + +//-------------------------------------------------------------------------- +// List data structure and functions + +struct Node +{ + int val; + struct Node* next; +}; + +struct List +{ + int size; + struct Node* head; +}; + +struct List g_nodeFreeList; +struct Node g_nodePool[NUM_DISCS]; + +int list_getSize( struct List* list ) +{ + return list->size; +} + +void list_init( struct List* list ) +{ + list->size = 0; + list->head = 0; +} + +void list_push( struct List* list, int val ) +{ + struct Node* newNode; + + // Pop the next free node off the free list + newNode = g_nodeFreeList.head; + g_nodeFreeList.head = g_nodeFreeList.head->next; + + // Push the new node onto the given list + newNode->next = list->head; + list->head = newNode; + + // Assign the value + list->head->val = val; + + // Increment size + list->size++; + +} + +int list_pop( struct List* list ) +{ + struct Node* freedNode; + int val; + + // Get the value from the->head of given list + val = list->head->val; + + // Pop the head node off the given list + freedNode = list->head; + list->head = list->head->next; + + // Push the freed node onto the free list + freedNode->next = g_nodeFreeList.head; + g_nodeFreeList.head = freedNode; + + // Decrement size + list->size--; + + return val; +} + +void list_clear( struct List* list ) +{ + while ( list_getSize(list) > 0 ) + list_pop(list); +} + +//-------------------------------------------------------------------------- +// Tower data structure and functions + +struct Towers +{ + int numDiscs; + int numMoves; + struct List pegA; + struct List pegB; + struct List pegC; +}; + +void towers_init( struct Towers* this, int n ) +{ + int i; + + this->numDiscs = n; + this->numMoves = 0; + + list_init( &(this->pegA) ); + list_init( &(this->pegB) ); + list_init( &(this->pegC) ); + + for ( i = 0; i < n; i++ ) + list_push( &(this->pegA), n-i ); + +} + +void towers_clear( struct Towers* this ) +{ + + list_clear( &(this->pegA) ); + list_clear( &(this->pegB) ); + list_clear( &(this->pegC) ); + + towers_init( this, this->numDiscs ); + +} + +void towers_solve_h( struct Towers* this, int n, + struct List* startPeg, + struct List* tempPeg, + struct List* destPeg ) +{ + int val; + + if ( n == 1 ) { + val = list_pop(startPeg); + list_push(destPeg,val); + this->numMoves++; + } + else { + towers_solve_h( this, n-1, startPeg, destPeg, tempPeg ); + towers_solve_h( this, 1, startPeg, tempPeg, destPeg ); + towers_solve_h( this, n-1, tempPeg, startPeg, destPeg ); + } + +} + +void towers_solve( struct Towers* this ) +{ + towers_solve_h( this, this->numDiscs, &(this->pegA), &(this->pegB), &(this->pegC) ); +} + +int towers_verify( struct Towers* this ) +{ + struct Node* ptr; + int numDiscs = 0; + + if ( list_getSize(&this->pegA) != 0 ) { + return 2; + } + + if ( list_getSize(&this->pegB) != 0 ) { + return 3; + } + + if ( list_getSize(&this->pegC) != this->numDiscs ) { + return 4; + } + + for ( ptr = this->pegC.head; ptr != 0; ptr = ptr->next ) { + numDiscs++; + if ( ptr->val != numDiscs ) { + return 5; + } + } + + if ( this->numMoves != ((1 << this->numDiscs) - 1) ) { + return 6; + } + + return 0; +} + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ + struct Towers towers; + int i; + + // Initialize free list + + list_init( &g_nodeFreeList ); + g_nodeFreeList.head = &(g_nodePool[0]); + g_nodeFreeList.size = NUM_DISCS; + g_nodePool[NUM_DISCS-1].next = 0; + g_nodePool[NUM_DISCS-1].val = 99; + for ( i = 0; i < (NUM_DISCS-1); i++ ) { + g_nodePool[i].next = &(g_nodePool[i+1]); + g_nodePool[i].val = i; + } + + towers_init( &towers, NUM_DISCS ); + + // If needed we preallocate everything in the caches + +#if PREALLOCATE + towers_solve( &towers ); +#endif + + // Solve it + + towers_clear( &towers ); + setStats(1); + towers_solve( &towers ); + setStats(0); + + // Check the results + return towers_verify( &towers ); +} + diff --git a/apps/riscv-tests/benchmarks/vvadd/dataset1-large.h b/apps/riscv-tests/benchmarks/vvadd/dataset1-large.h new file mode 100644 index 0000000..5a008c1 --- /dev/null +++ b/apps/riscv-tests/benchmarks/vvadd/dataset1-large.h @@ -0,0 +1,167 @@ +// See LICENSE for license details. + + +#define DATA_SIZE 1000 + +int input1_data[DATA_SIZE] = +{ + 41, 833, 564, 187, 749, 350, 132, 949, 584, 805, 621, 6, 931, 890, 392, 694, 961, 110, 116, 296, + 426, 314, 659, 774, 319, 678, 875, 376, 474, 938, 539, 569, 203, 280, 759, 606, 511, 657, 195, 81, + 267, 229, 337, 944, 902, 241, 913, 826, 933, 985, 195, 960, 566, 350, 649, 657, 181, 111, 859, 65, + 288, 349, 141, 905, 886, 264, 576, 979, 761, 241, 478, 499, 403, 222, 444, 721, 676, 317, 224, 937, + 288, 119, 615, 606, 389, 351, 455, 278, 367, 358, 584, 62, 985, 403, 346, 517, 559, 908, 775, 255, + 778, 598, 143, 33, 125, 941, 933, 799, 553, 431, 648, 952, 287, 19, 49, 86, 95, 441, 587, 614, + 382, 280, 808, 971, 819, 344, 450, 512, 965, 347, 808, 882, 537, 946, 701, 356, 567, 891, 22, 568, + 665, 423, 434, 158, 2, 84, 247, 49, 435, 792, 869, 486, 414, 369, 548, 518, 888, 682, 284, 264, + 499, 290, 897, 215, 731, 688, 251, 786, 555, 302, 528, 544, 322, 947, 287, 824, 304, 788, 733, 959, + 366, 722, 294, 975, 653, 748, 91, 378, 105, 102, 381, 651, 825, 840, 356, 148, 54, 140, 955, 343, + 533, 757, 521, 837, 592, 13, 173, 63, 121, 133, 758, 372, 951, 39, 129, 110, 847, 437, 255, 269, + 409, 628, 399, 549, 753, 564, 171, 19, 727, 501, 777, 43, 753, 81, 202, 853, 153, 760, 357, 943, + 922, 328, 496, 442, 516, 641, 276, 786, 113, 842, 907, 275, 237, 32, 784, 565, 357, 803, 819, 751, + 280, 85, 458, 454, 710, 459, 41, 253, 377, 508, 700, 860, 480, 741, 499, 709, 49, 371, 873, 945, + 992, 526, 721, 435, 232, 497, 697, 30, 348, 250, 350, 250, 573, 784, 749, 502, 823, 826, 170, 160, + 674, 32, 202, 143, 853, 90, 394, 107, 855, 106, 157, 6, 765, 204, 194, 574, 218, 526, 177, 239, + 698, 757, 706, 49, 84, 799, 893, 512, 373, 492, 14, 621, 83, 103, 794, 921, 643, 880, 834, 239, + 462, 114, 561, 529, 10, 997, 904, 387, 407, 105, 559, 936, 512, 409, 302, 202, 427, 613, 359, 521, + 684, 22, 185, 312, 107, 274, 387, 242, 486, 105, 698, 899, 770, 644, 80, 161, 407, 946, 30, 768, + 870, 113, 148, 62, 147, 838, 845, 432, 141, 211, 817, 821, 562, 364, 615, 495, 812, 916, 159, 430, + 803, 180, 544, 840, 458, 786, 872, 795, 806, 758, 104, 401, 254, 984, 136, 729, 584, 794, 414, 528, + 707, 554, 378, 766, 977, 236, 947, 229, 165, 505, 105, 704, 796, 140, 303, 795, 635, 560, 119, 8, + 532, 814, 37, 584, 739, 619, 767, 478, 57, 958, 784, 985, 837, 307, 67, 824, 996, 749, 171, 826, + 621, 155, 826, 43, 694, 80, 236, 747, 744, 265, 124, 731, 941, 425, 370, 320, 269, 542, 763, 752, + 915, 14, 1, 906, 995, 809, 560, 873, 972, 289, 509, 558, 970, 405, 579, 293, 251, 849, 129, 452, + 716, 86, 678, 181, 240, 335, 793, 641, 1, 320, 987, 646, 754, 958, 203, 142, 180, 299, 165, 761, + 974, 646, 559, 619, 422, 260, 565, 542, 492, 991, 745, 207, 372, 932, 664, 34, 533, 478, 908, 203, + 33, 214, 365, 892, 781, 680, 705, 688, 947, 386, 50, 101, 474, 399, 679, 330, 952, 471, 477, 725, + 713, 937, 529, 870, 77, 545, 907, 853, 143, 979, 239, 105, 365, 98, 54, 98, 440, 764, 315, 336, + 697, 774, 726, 324, 282, 536, 622, 594, 890, 75, 290, 496, 726, 449, 548, 135, 644, 838, 290, 767, + 162, 415, 491, 985, 116, 617, 859, 235, 282, 571, 913, 560, 194, 242, 782, 985, 728, 344, 430, 613, + 759, 176, 309, 333, 354, 310, 699, 46, 487, 503, 100, 393, 268, 314, 75, 345, 987, 600, 908, 384, + 92, 545, 277, 668, 351, 853, 863, 312, 100, 532, 567, 836, 370, 989, 461, 912, 182, 268, 160, 771, + 22, 854, 644, 17, 779, 911, 855, 137, 983, 717, 565, 719, 253, 785, 154, 196, 253, 447, 899, 5, + 325, 616, 309, 175, 159, 123, 838, 715, 550, 230, 82, 627, 324, 927, 103, 17, 966, 159, 177, 593, + 372, 393, 599, 745, 377, 865, 591, 553, 440, 345, 593, 290, 908, 544, 377, 456, 781, 110, 495, 896, + 806, 700, 548, 340, 29, 829, 630, 546, 613, 972, 116, 313, 904, 971, 607, 794, 169, 896, 507, 916, + 431, 339, 147, 224, 112, 580, 834, 134, 948, 201, 488, 396, 797, 478, 769, 574, 485, 339, 721, 451, + 821, 744, 0, 594, 277, 120, 680, 757, 555, 847, 517, 379, 505, 904, 246, 243, 394, 430, 214, 244, + 524, 399, 172, 304, 620, 594, 535, 698, 159, 750, 809, 454, 75, 93, 167, 16, 853, 494, 324, 78, + 52, 112, 10, 342, 730, 680, 287, 961, 92, 626, 912, 616, 860, 744, 744, 478, 615, 508, 914, 810, + 288, 974, 129, 581, 548, 868, 981, 270, 623, 653, 626, 990, 386, 323, 472, 164, 239, 189, 865, 231, + 356, 152, 825, 328, 390, 848, 38, 402, 616, 546, 206, 2, 783, 890, 815, 831, 665, 410, 94, 246, + 422, 211, 675, 9, 374, 426, 64, 53, 758, 811, 500, 437, 335, 328, 237, 415, 468, 684, 565, 305, + 449, 597, 136, 882, 383, 938, 268, 115, 908, 50, 952, 366, 397, 257, 231, 667, 35, 990, 443, 213, + 389, 13, 621, 52, 612, 934, 953, 828, 462, 621, 812, 522, 672, 57, 313, 352, 55, 972, 753, 416, + 879, 864, 572, 163, 721, 12, 643, 507, 968, 781, 840, 242, 630, 810, 795, 435, 885, 599, 696, 643, + 93, 710, 785, 112, 581, 12, 923, 615, 652, 359, 261, 233, 609, 686, 539, 118, 560, 739, 20, 317, + 976, 573, 386, 772, 663, 504, 212, 888, 907, 420, 737, 516, 25, 219, 797, 716, 452, 692, 683, 459, + 815, 323, 612, 247, 116, 352, 281, 738, 290, 909, 645, 625, 932, 220, 685, 373, 876, 646, 412, 955 +}; + +int input2_data[DATA_SIZE] = +{ + 454, 335, 1, 989, 365, 572, 64, 153, 216, 140, 210, 572, 339, 593, 898, 228, 12, 883, 750, 646, + 500, 436, 701, 812, 981, 150, 696, 564, 272, 258, 647, 509, 88, 703, 669, 375, 551, 936, 592, 569, + 952, 800, 584, 643, 368, 489, 328, 313, 592, 388, 543, 649, 979, 997, 814, 79, 208, 998, 629, 847, + 704, 997, 253, 715, 430, 415, 538, 700, 4, 494, 100, 864, 693, 416, 296, 285, 620, 78, 351, 540, + 646, 169, 527, 289, 796, 801, 720, 758, 745, 92, 989, 271, 853, 788, 531, 222, 461, 241, 358, 332, + 684, 740, 446, 311, 743, 557, 479, 557, 925, 796, 357, 891, 666, 514, 557, 870, 853, 440, 61, 678, + 396, 9, 17, 170, 291, 380, 536, 185, 917, 539, 983, 887, 54, 612, 951, 479, 151, 7, 641, 335, + 730, 95, 728, 280, 395, 688, 911, 476, 815, 729, 265, 127, 236, 214, 180, 6, 503, 596, 173, 643, + 346, 599, 68, 849, 658, 619, 121, 131, 828, 667, 433, 487, 753, 125, 626, 14, 10, 403, 106, 703, + 818, 964, 406, 874, 856, 86, 60, 660, 667, 153, 121, 98, 412, 236, 12, 423, 965, 216, 621, 361, + 921, 715, 647, 299, 886, 682, 36, 493, 551, 537, 969, 643, 434, 415, 303, 438, 860, 203, 478, 988, + 675, 719, 990, 338, 450, 633, 155, 646, 452, 427, 509, 988, 426, 12, 483, 142, 339, 390, 50, 171, + 601, 105, 968, 121, 879, 81, 870, 600, 603, 871, 887, 610, 404, 234, 745, 526, 275, 441, 226, 752, + 943, 726, 709, 201, 54, 758, 53, 397, 41, 141, 416, 747, 219, 478, 770, 180, 482, 691, 725, 173, + 186, 914, 1, 963, 247, 464, 362, 521, 233, 120, 40, 779, 195, 161, 743, 439, 355, 403, 141, 633, + 289, 782, 320, 636, 118, 852, 70, 816, 388, 954, 36, 16, 698, 695, 677, 598, 883, 824, 746, 462, + 511, 534, 440, 428, 732, 726, 702, 547, 86, 798, 215, 21, 651, 59, 429, 657, 96, 973, 659, 966, + 524, 62, 625, 303, 714, 409, 55, 728, 305, 436, 901, 592, 691, 796, 497, 177, 940, 995, 480, 158, + 822, 611, 680, 14, 111, 797, 185, 0, 718, 96, 749, 739, 814, 435, 326, 37, 33, 605, 935, 27, + 88, 441, 339, 344, 554, 365, 954, 639, 396, 991, 249, 338, 832, 974, 393, 266, 470, 348, 336, 419, + 249, 215, 542, 903, 636, 729, 581, 820, 671, 979, 418, 670, 920, 568, 745, 662, 139, 385, 927, 173, + 457, 316, 183, 477, 196, 399, 416, 805, 996, 270, 735, 696, 825, 528, 50, 623, 537, 87, 294, 867, + 110, 398, 781, 646, 375, 943, 897, 589, 44, 288, 845, 742, 99, 522, 443, 432, 165, 930, 28, 461, + 323, 272, 376, 340, 898, 158, 168, 443, 193, 631, 935, 274, 781, 185, 619, 292, 933, 156, 827, 88, + 987, 629, 649, 32, 1, 744, 399, 915, 791, 554, 984, 530, 600, 401, 683, 540, 903, 120, 995, 521, + 622, 224, 895, 530, 820, 651, 226, 96, 262, 569, 238, 126, 610, 191, 238, 796, 884, 573, 108, 140, + 789, 852, 23, 704, 890, 480, 52, 372, 201, 546, 408, 119, 645, 464, 81, 293, 52, 880, 224, 744, + 735, 886, 167, 1, 532, 321, 169, 485, 101, 177, 42, 708, 654, 915, 625, 242, 822, 795, 641, 252, + 245, 151, 876, 333, 601, 938, 775, 397, 233, 755, 454, 424, 210, 962, 900, 923, 655, 529, 595, 90, + 464, 685, 70, 754, 32, 494, 25, 389, 488, 37, 409, 639, 27, 950, 539, 80, 303, 723, 734, 125, + 552, 248, 107, 362, 48, 869, 144, 841, 724, 335, 470, 263, 343, 809, 677, 339, 336, 410, 465, 56, + 590, 485, 406, 993, 746, 238, 525, 336, 256, 134, 546, 722, 367, 943, 106, 629, 396, 208, 429, 523, + 130, 355, 990, 673, 991, 719, 449, 84, 616, 211, 707, 737, 847, 452, 316, 974, 746, 796, 522, 618, + 115, 727, 226, 165, 200, 830, 742, 187, 705, 671, 785, 886, 962, 657, 293, 620, 144, 173, 796, 72, + 678, 80, 793, 685, 637, 967, 241, 898, 693, 372, 601, 721, 398, 553, 72, 174, 978, 325, 558, 185, + 505, 859, 651, 573, 321, 349, 400, 890, 844, 885, 933, 980, 448, 989, 50, 332, 900, 716, 747, 444, + 6, 394, 285, 703, 450, 652, 771, 485, 534, 559, 481, 507, 434, 343, 42, 784, 865, 421, 415, 871, + 539, 162, 105, 481, 595, 115, 350, 964, 287, 232, 154, 602, 539, 943, 872, 121, 652, 811, 747, 362, + 340, 910, 206, 572, 505, 973, 961, 354, 627, 849, 971, 910, 410, 770, 63, 874, 396, 482, 619, 646, + 557, 328, 67, 884, 512, 972, 6, 513, 882, 562, 764, 366, 506, 786, 831, 382, 638, 452, 72, 83, + 59, 932, 929, 924, 961, 69, 797, 985, 854, 885, 600, 389, 232, 793, 179, 773, 689, 775, 494, 139, + 234, 431, 780, 371, 22, 653, 741, 815, 428, 139, 603, 315, 344, 889, 317, 260, 861, 377, 511, 304, + 70, 35, 854, 576, 490, 326, 303, 431, 813, 708, 388, 962, 967, 442, 49, 831, 251, 321, 741, 179, + 176, 117, 523, 764, 952, 704, 531, 804, 23, 611, 846, 375, 854, 971, 24, 639, 318, 723, 662, 647, + 281, 158, 294, 885, 734, 866, 471, 296, 673, 472, 439, 5, 155, 506, 948, 600, 445, 222, 784, 349, + 943, 150, 366, 444, 604, 720, 340, 972, 911, 321, 435, 50, 78, 761, 950, 238, 27, 226, 201, 176, + 877, 450, 879, 99, 143, 31, 812, 771, 527, 488, 797, 194, 293, 966, 276, 345, 413, 197, 386, 116, + 322, 680, 538, 553, 960, 874, 48, 506, 898, 539, 495, 764, 805, 286, 432, 836, 192, 825, 778, 586, + 359, 352, 746, 11, 749, 5, 408, 643, 441, 368, 97, 169, 359, 527, 672, 69, 880, 298, 300, 327, + 923, 829, 816, 497, 243, 981, 917, 713, 653, 503, 406, 543, 108, 304, 464, 954, 86, 802, 446, 28 +}; + +int verify_data[DATA_SIZE] = +{ + 495, 1168, 565, 1176, 1114, 922, 196, 1102, 800, 945, 831, 578, 1270, 1483, 1290, 922, 973, 993, 866, 942, + 926, 750, 1360, 1586, 1300, 828, 1571, 940, 746, 1196, 1186, 1078, 291, 983, 1428, 981, 1062, 1593, 787, 650, + 1219, 1029, 921, 1587, 1270, 730, 1241, 1139, 1525, 1373, 738, 1609, 1545, 1347, 1463, 736, 389, 1109, 1488, 912, + 992, 1346, 394, 1620, 1316, 679, 1114, 1679, 765, 735, 578, 1363, 1096, 638, 740, 1006, 1296, 395, 575, 1477, + 934, 288, 1142, 895, 1185, 1152, 1175, 1036, 1112, 450, 1573, 333, 1838, 1191, 877, 739, 1020, 1149, 1133, 587, + 1462, 1338, 589, 344, 868, 1498, 1412, 1356, 1478, 1227, 1005, 1843, 953, 533, 606, 956, 948, 881, 648, 1292, + 778, 289, 825, 1141, 1110, 724, 986, 697, 1882, 886, 1791, 1769, 591, 1558, 1652, 835, 718, 898, 663, 903, + 1395, 518, 1162, 438, 397, 772, 1158, 525, 1250, 1521, 1134, 613, 650, 583, 728, 524, 1391, 1278, 457, 907, + 845, 889, 965, 1064, 1389, 1307, 372, 917, 1383, 969, 961, 1031, 1075, 1072, 913, 838, 314, 1191, 839, 1662, + 1184, 1686, 700, 1849, 1509, 834, 151, 1038, 772, 255, 502, 749, 1237, 1076, 368, 571, 1019, 356, 1576, 704, + 1454, 1472, 1168, 1136, 1478, 695, 209, 556, 672, 670, 1727, 1015, 1385, 454, 432, 548, 1707, 640, 733, 1257, + 1084, 1347, 1389, 887, 1203, 1197, 326, 665, 1179, 928, 1286, 1031, 1179, 93, 685, 995, 492, 1150, 407, 1114, + 1523, 433, 1464, 563, 1395, 722, 1146, 1386, 716, 1713, 1794, 885, 641, 266, 1529, 1091, 632, 1244, 1045, 1503, + 1223, 811, 1167, 655, 764, 1217, 94, 650, 418, 649, 1116, 1607, 699, 1219, 1269, 889, 531, 1062, 1598, 1118, + 1178, 1440, 722, 1398, 479, 961, 1059, 551, 581, 370, 390, 1029, 768, 945, 1492, 941, 1178, 1229, 311, 793, + 963, 814, 522, 779, 971, 942, 464, 923, 1243, 1060, 193, 22, 1463, 899, 871, 1172, 1101, 1350, 923, 701, + 1209, 1291, 1146, 477, 816, 1525, 1595, 1059, 459, 1290, 229, 642, 734, 162, 1223, 1578, 739, 1853, 1493, 1205, + 986, 176, 1186, 832, 724, 1406, 959, 1115, 712, 541, 1460, 1528, 1203, 1205, 799, 379, 1367, 1608, 839, 679, + 1506, 633, 865, 326, 218, 1071, 572, 242, 1204, 201, 1447, 1638, 1584, 1079, 406, 198, 440, 1551, 965, 795, + 958, 554, 487, 406, 701, 1203, 1799, 1071, 537, 1202, 1066, 1159, 1394, 1338, 1008, 761, 1282, 1264, 495, 849, + 1052, 395, 1086, 1743, 1094, 1515, 1453, 1615, 1477, 1737, 522, 1071, 1174, 1552, 881, 1391, 723, 1179, 1341, 701, + 1164, 870, 561, 1243, 1173, 635, 1363, 1034, 1161, 775, 840, 1400, 1621, 668, 353, 1418, 1172, 647, 413, 875, + 642, 1212, 818, 1230, 1114, 1562, 1664, 1067, 101, 1246, 1629, 1727, 936, 829, 510, 1256, 1161, 1679, 199, 1287, + 944, 427, 1202, 383, 1592, 238, 404, 1190, 937, 896, 1059, 1005, 1722, 610, 989, 612, 1202, 698, 1590, 840, + 1902, 643, 650, 938, 996, 1553, 959, 1788, 1763, 843, 1493, 1088, 1570, 806, 1262, 833, 1154, 969, 1124, 973, + 1338, 310, 1573, 711, 1060, 986, 1019, 737, 263, 889, 1225, 772, 1364, 1149, 441, 938, 1064, 872, 273, 901, + 1763, 1498, 582, 1323, 1312, 740, 617, 914, 693, 1537, 1153, 326, 1017, 1396, 745, 327, 585, 1358, 1132, 947, + 768, 1100, 532, 893, 1313, 1001, 874, 1173, 1048, 563, 92, 809, 1128, 1314, 1304, 572, 1774, 1266, 1118, 977, + 958, 1088, 1405, 1203, 678, 1483, 1682, 1250, 376, 1734, 693, 529, 575, 1060, 954, 1021, 1095, 1293, 910, 426, + 1161, 1459, 796, 1078, 314, 1030, 647, 983, 1378, 112, 699, 1135, 753, 1399, 1087, 215, 947, 1561, 1024, 892, + 714, 663, 598, 1347, 164, 1486, 1003, 1076, 1006, 906, 1383, 823, 537, 1051, 1459, 1324, 1064, 754, 895, 669, + 1349, 661, 715, 1326, 1100, 548, 1224, 382, 743, 637, 646, 1115, 635, 1257, 181, 974, 1383, 808, 1337, 907, + 222, 900, 1267, 1341, 1342, 1572, 1312, 396, 716, 743, 1274, 1573, 1217, 1441, 777, 1886, 928, 1064, 682, 1389, + 137, 1581, 870, 182, 979, 1741, 1597, 324, 1688, 1388, 1350, 1605, 1215, 1442, 447, 816, 397, 620, 1695, 77, + 1003, 696, 1102, 860, 796, 1090, 1079, 1613, 1243, 602, 683, 1348, 722, 1480, 175, 191, 1944, 484, 735, 778, + 877, 1252, 1250, 1318, 698, 1214, 991, 1443, 1284, 1230, 1526, 1270, 1356, 1533, 427, 788, 1681, 826, 1242, 1340, + 812, 1094, 833, 1043, 479, 1481, 1401, 1031, 1147, 1531, 597, 820, 1338, 1314, 649, 1578, 1034, 1317, 922, 1787, + 970, 501, 252, 705, 707, 695, 1184, 1098, 1235, 433, 642, 998, 1336, 1421, 1641, 695, 1137, 1150, 1468, 813, + 1161, 1654, 206, 1166, 782, 1093, 1641, 1111, 1182, 1696, 1488, 1289, 915, 1674, 309, 1117, 790, 912, 833, 890, + 1081, 727, 239, 1188, 1132, 1566, 541, 1211, 1041, 1312, 1573, 820, 581, 879, 998, 398, 1491, 946, 396, 161, + 111, 1044, 939, 1266, 1691, 749, 1084, 1946, 946, 1511, 1512, 1005, 1092, 1537, 923, 1251, 1304, 1283, 1408, 949, + 522, 1405, 909, 952, 570, 1521, 1722, 1085, 1051, 792, 1229, 1305, 730, 1212, 789, 424, 1100, 566, 1376, 535, + 426, 187, 1679, 904, 880, 1174, 341, 833, 1429, 1254, 594, 964, 1750, 1332, 864, 1662, 916, 731, 835, 425, + 598, 328, 1198, 773, 1326, 1130, 595, 857, 781, 1422, 1346, 812, 1189, 1299, 261, 1054, 786, 1407, 1227, 952, + 730, 755, 430, 1767, 1117, 1804, 739, 411, 1581, 522, 1391, 371, 552, 763, 1179, 1267, 480, 1212, 1227, 562, + 1332, 163, 987, 496, 1216, 1654, 1293, 1800, 1373, 942, 1247, 572, 750, 818, 1263, 590, 82, 1198, 954, 592, + 1756, 1314, 1451, 262, 864, 43, 1455, 1278, 1495, 1269, 1637, 436, 923, 1776, 1071, 780, 1298, 796, 1082, 759, + 415, 1390, 1323, 665, 1541, 886, 971, 1121, 1550, 898, 756, 997, 1414, 972, 971, 954, 752, 1564, 798, 903, + 1335, 925, 1132, 783, 1412, 509, 620, 1531, 1348, 788, 834, 685, 384, 746, 1469, 785, 1332, 990, 983, 786, + 1738, 1152, 1428, 744, 359, 1333, 1198, 1451, 943, 1412, 1051, 1168, 1040, 524, 1149, 1327, 962, 1448, 858, 983 +}; + diff --git a/apps/riscv-tests/benchmarks/vvadd/dataset1.h b/apps/riscv-tests/benchmarks/vvadd/dataset1.h new file mode 100644 index 0000000..a34cb96 --- /dev/null +++ b/apps/riscv-tests/benchmarks/vvadd/dataset1.h @@ -0,0 +1,62 @@ +// See LICENSE for license details. + + +#define DATA_SIZE 300 + +int input1_data[DATA_SIZE] = +{ + 41, 833, 564, 187, 749, 350, 132, 949, 584, 805, 621, 6, 931, 890, 392, 694, 961, 110, 116, 296, + 426, 314, 659, 774, 319, 678, 875, 376, 474, 938, 539, 569, 203, 280, 759, 606, 511, 657, 195, 81, + 267, 229, 337, 944, 902, 241, 913, 826, 933, 985, 195, 960, 566, 350, 649, 657, 181, 111, 859, 65, + 288, 349, 141, 905, 886, 264, 576, 979, 761, 241, 478, 499, 403, 222, 444, 721, 676, 317, 224, 937, + 288, 119, 615, 606, 389, 351, 455, 278, 367, 358, 584, 62, 985, 403, 346, 517, 559, 908, 775, 255, + 778, 598, 143, 33, 125, 941, 933, 799, 553, 431, 648, 952, 287, 19, 49, 86, 95, 441, 587, 614, + 382, 280, 808, 971, 819, 344, 450, 512, 965, 347, 808, 882, 537, 946, 701, 356, 567, 891, 22, 568, + 665, 423, 434, 158, 2, 84, 247, 49, 435, 792, 869, 486, 414, 369, 548, 518, 888, 682, 284, 264, + 499, 290, 897, 215, 731, 688, 251, 786, 555, 302, 528, 544, 322, 947, 287, 824, 304, 788, 733, 959, + 366, 722, 294, 975, 653, 748, 91, 378, 105, 102, 381, 651, 825, 840, 356, 148, 54, 140, 955, 343, + 533, 757, 521, 837, 592, 13, 173, 63, 121, 133, 758, 372, 951, 39, 129, 110, 847, 437, 255, 269, + 409, 628, 399, 549, 753, 564, 171, 19, 727, 501, 777, 43, 753, 81, 202, 853, 153, 760, 357, 943, + 922, 328, 496, 442, 516, 641, 276, 786, 113, 842, 907, 275, 237, 32, 784, 565, 357, 803, 819, 751, + 280, 85, 458, 454, 710, 459, 41, 253, 377, 508, 700, 860, 480, 741, 499, 709, 49, 371, 873, 945, + 992, 526, 721, 435, 232, 497, 697, 30, 348, 250, 350, 250, 573, 784, 749, 502, 823, 826, 170, 160 +}; + +int input2_data[DATA_SIZE] = +{ + 454, 335, 1, 989, 365, 572, 64, 153, 216, 140, 210, 572, 339, 593, 898, 228, 12, 883, 750, 646, + 500, 436, 701, 812, 981, 150, 696, 564, 272, 258, 647, 509, 88, 703, 669, 375, 551, 936, 592, 569, + 952, 800, 584, 643, 368, 489, 328, 313, 592, 388, 543, 649, 979, 997, 814, 79, 208, 998, 629, 847, + 704, 997, 253, 715, 430, 415, 538, 700, 4, 494, 100, 864, 693, 416, 296, 285, 620, 78, 351, 540, + 646, 169, 527, 289, 796, 801, 720, 758, 745, 92, 989, 271, 853, 788, 531, 222, 461, 241, 358, 332, + 684, 740, 446, 311, 743, 557, 479, 557, 925, 796, 357, 891, 666, 514, 557, 870, 853, 440, 61, 678, + 396, 9, 17, 170, 291, 380, 536, 185, 917, 539, 983, 887, 54, 612, 951, 479, 151, 7, 641, 335, + 730, 95, 728, 280, 395, 688, 911, 476, 815, 729, 265, 127, 236, 214, 180, 6, 503, 596, 173, 643, + 346, 599, 68, 849, 658, 619, 121, 131, 828, 667, 433, 487, 753, 125, 626, 14, 10, 403, 106, 703, + 818, 964, 406, 874, 856, 86, 60, 660, 667, 153, 121, 98, 412, 236, 12, 423, 965, 216, 621, 361, + 921, 715, 647, 299, 886, 682, 36, 493, 551, 537, 969, 643, 434, 415, 303, 438, 860, 203, 478, 988, + 675, 719, 990, 338, 450, 633, 155, 646, 452, 427, 509, 988, 426, 12, 483, 142, 339, 390, 50, 171, + 601, 105, 968, 121, 879, 81, 870, 600, 603, 871, 887, 610, 404, 234, 745, 526, 275, 441, 226, 752, + 943, 726, 709, 201, 54, 758, 53, 397, 41, 141, 416, 747, 219, 478, 770, 180, 482, 691, 725, 173, + 186, 914, 1, 963, 247, 464, 362, 521, 233, 120, 40, 779, 195, 161, 743, 439, 355, 403, 141, 633 +}; + +int verify_data[DATA_SIZE] = +{ + 495, 1168, 565, 1176, 1114, 922, 196, 1102, 800, 945, 831, 578, 1270, 1483, 1290, 922, 973, 993, 866, 942, + 926, 750, 1360, 1586, 1300, 828, 1571, 940, 746, 1196, 1186, 1078, 291, 983, 1428, 981, 1062, 1593, 787, 650, + 1219, 1029, 921, 1587, 1270, 730, 1241, 1139, 1525, 1373, 738, 1609, 1545, 1347, 1463, 736, 389, 1109, 1488, 912, + 992, 1346, 394, 1620, 1316, 679, 1114, 1679, 765, 735, 578, 1363, 1096, 638, 740, 1006, 1296, 395, 575, 1477, + 934, 288, 1142, 895, 1185, 1152, 1175, 1036, 1112, 450, 1573, 333, 1838, 1191, 877, 739, 1020, 1149, 1133, 587, + 1462, 1338, 589, 344, 868, 1498, 1412, 1356, 1478, 1227, 1005, 1843, 953, 533, 606, 956, 948, 881, 648, 1292, + 778, 289, 825, 1141, 1110, 724, 986, 697, 1882, 886, 1791, 1769, 591, 1558, 1652, 835, 718, 898, 663, 903, + 1395, 518, 1162, 438, 397, 772, 1158, 525, 1250, 1521, 1134, 613, 650, 583, 728, 524, 1391, 1278, 457, 907, + 845, 889, 965, 1064, 1389, 1307, 372, 917, 1383, 969, 961, 1031, 1075, 1072, 913, 838, 314, 1191, 839, 1662, + 1184, 1686, 700, 1849, 1509, 834, 151, 1038, 772, 255, 502, 749, 1237, 1076, 368, 571, 1019, 356, 1576, 704, + 1454, 1472, 1168, 1136, 1478, 695, 209, 556, 672, 670, 1727, 1015, 1385, 454, 432, 548, 1707, 640, 733, 1257, + 1084, 1347, 1389, 887, 1203, 1197, 326, 665, 1179, 928, 1286, 1031, 1179, 93, 685, 995, 492, 1150, 407, 1114, + 1523, 433, 1464, 563, 1395, 722, 1146, 1386, 716, 1713, 1794, 885, 641, 266, 1529, 1091, 632, 1244, 1045, 1503, + 1223, 811, 1167, 655, 764, 1217, 94, 650, 418, 649, 1116, 1607, 699, 1219, 1269, 889, 531, 1062, 1598, 1118, + 1178, 1440, 722, 1398, 479, 961, 1059, 551, 581, 370, 390, 1029, 768, 945, 1492, 941, 1178, 1229, 311, 793 +}; + diff --git a/apps/riscv-tests/benchmarks/vvadd/vvadd_gendata.pl b/apps/riscv-tests/benchmarks/vvadd/vvadd_gendata.pl new file mode 100755 index 0000000..f23cdf4 --- /dev/null +++ b/apps/riscv-tests/benchmarks/vvadd/vvadd_gendata.pl @@ -0,0 +1,139 @@ +#!/usr/bin/perl -w +#========================================================================== +# vvadd_gendata.pl +# +# Author : Christopher Batten (cbatten@mit.edu) +# Date : April 29, 2005 +# +(our $usageMsg = <<'ENDMSG') =~ s/^\#//gm; +# +# Simple script which creates an input data set and the reference data +# for the vvadd benchmark. +# +ENDMSG + +use strict "vars"; +use warnings; +no warnings("once"); +use Getopt::Long; + +#-------------------------------------------------------------------------- +# Command line processing +#-------------------------------------------------------------------------- + +our %opts; + +sub usage() +{ + + print "\n"; + print " Usage: vvadd_gendata.pl [options] \n"; + print "\n"; + print " Options:\n"; + print " --help print this message\n"; + print " --size size of input data [1000]\n"; + print " --seed random seed [1]\n"; + print "$usageMsg"; + + exit(); +} + +sub processCommandLine() +{ + + $opts{"help"} = 0; + $opts{"size"} = 1000; + $opts{"seed"} = 1; + Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage(); + $opts{"help"} and usage(); + +} + +#-------------------------------------------------------------------------- +# Helper Functions +#-------------------------------------------------------------------------- + +sub printArray +{ + my $arrayName = $_[0]; + my $arrayRef = $_[1]; + + my $numCols = 20; + my $arrayLen = scalar(@{$arrayRef}); + + print "int ".$arrayName."[DATA_SIZE] = \n"; + print "{\n"; + + if ( $arrayLen <= $numCols ) { + print " "; + for ( my $i = 0; $i < $arrayLen; $i++ ) { + print sprintf("%3d",$arrayRef->[$i]); + if ( $i != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + else { + my $numRows = int($arrayLen/$numCols); + for ( my $j = 0; $j < $numRows; $j++ ) { + print " "; + for ( my $i = 0; $i < $numCols; $i++ ) { + my $index = $j*$numCols + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + if ( $arrayLen > ($numRows*$numCols) ) { + print " "; + for ( my $i = 0; $i < ($arrayLen-($numRows*$numCols)); $i++ ) { + my $index = $numCols*$numRows + $i; + print sprintf("%3d",$arrayRef->[$index]); + if ( $index != $arrayLen-1 ) { + print ", "; + } + } + print "\n"; + } + + } + + print "};\n\n"; +} + +#-------------------------------------------------------------------------- +# Main +#-------------------------------------------------------------------------- + +sub main() +{ + + processCommandLine(); + srand($opts{"seed"}); + + my @values1; + my @values2; + my @sum; + for ( my $i = 0; $i < $opts{"size"}; $i++ ) { + my $value1 = int(rand(999)); + my $value2 = int(rand(999)); + push( @values1, $value1 ); + push( @values2, $value2 ); + push( @sum, $value1 + $value2 ); + } + + + print "\n\#define DATA_SIZE ".$opts{"size"}." \n\n"; + printArray( "input1_data", \@values1 ); + printArray( "input2_data", \@values2 ); + printArray( "verify_data", \@sum ); + +} + +main(); + diff --git a/apps/riscv-tests/benchmarks/vvadd/vvadd_main.c b/apps/riscv-tests/benchmarks/vvadd/vvadd_main.c new file mode 100644 index 0000000..d8ff01c --- /dev/null +++ b/apps/riscv-tests/benchmarks/vvadd/vvadd_main.c @@ -0,0 +1,48 @@ +// See LICENSE for license details. + +//************************************************************************** +// Vector-vector add benchmark +//-------------------------------------------------------------------------- +// +// This benchmark uses adds to vectors and writes the results to a +// third vector. The input data (and reference data) should be +// generated using the vvadd_gendata.pl perl script and dumped +// to a file named dataset1.h. + +#include "util.h" + +//-------------------------------------------------------------------------- +// Input/Reference Data + +#include "dataset1.h" + +//-------------------------------------------------------------------------- +// vvadd function + +void vvadd( int n, int a[], int b[], int c[] ) +{ + int i; + for ( i = 0; i < n; i++ ) + c[i] = a[i] + b[i]; +} + +//-------------------------------------------------------------------------- +// Main + +int main( int argc, char* argv[] ) +{ + int results_data[DATA_SIZE]; + +#if PREALLOCATE + // If needed we preallocate everything in the caches + vvadd( DATA_SIZE, input1_data, input2_data, results_data ); +#endif + + // Do the vvadd + setStats(1); + vvadd( DATA_SIZE, input1_data, input2_data, results_data ); + setStats(0); + + // Check the results + return verify( DATA_SIZE, results_data, verify_data ); +} diff --git a/apps/riscv-tests/configure b/apps/riscv-tests/configure new file mode 100755 index 0000000..db0969e --- /dev/null +++ b/apps/riscv-tests/configure @@ -0,0 +1,3694 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for riscv-tests 1.0. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='riscv-tests' +PACKAGE_TARNAME='riscv-tests' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='riscv-tests 1.0' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_subst_vars='LTLIBOBJS +LIBOBJS +XLEN +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_xlen +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures riscv-tests 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/riscv-tests] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of riscv-tests 1.0:";; + esac + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-xlen=XLEN Set XLEN, the X-register bit width (default is 64) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +riscv-tests configure 1.0 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by riscv-tests $as_me 1.0, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +cross_compiling=yes +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Check whether --with-xlen was given. +if test "${with_xlen+set}" = set; then : + withval=$with_xlen; XLEN=$withval + +else + XLEN=64 + + +fi + + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by riscv-tests $as_me 1.0, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +riscv-tests config.status 1.0 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/apps/riscv-tests/configure.ac b/apps/riscv-tests/configure.ac new file mode 100644 index 0000000..ebfd649 --- /dev/null +++ b/apps/riscv-tests/configure.ac @@ -0,0 +1,16 @@ +AC_INIT(riscv-tests, 1.0) + +cross_compiling=yes +AC_PROG_CC + +AC_ARG_WITH(xlen, + [AS_HELP_STRING([--with-xlen=XLEN], + [Set XLEN, the X-register bit width (default is 64)])], + AC_SUBST(XLEN, $withval), + AC_SUBST(XLEN, 64) + ) + + +AC_OUTPUT( + Makefile +) diff --git a/apps/riscv-tests/debug/Makefile b/apps/riscv-tests/debug/Makefile new file mode 100644 index 0000000..3efdea8 --- /dev/null +++ b/apps/riscv-tests/debug/Makefile @@ -0,0 +1,35 @@ +RISCV_SIM ?= spike +XLEN ?= 64 + +src_dir ?= . +GDBSERVER_PY = $(src_dir)/gdbserver.py +TESTS = $(shell $(GDBSERVER_PY) --list-tests $(src_dir)/targets/RISC-V/spike32.py) + +default: spike$(XLEN) spike$(XLEN)-2 + +all-tests: spike32 spike32-2 spike32-2-rtos spike32-2-hwthread \ + spike64 spike64-2 spike64-2-rtos spike64-2-hwthread + +all: pylint all-tests + +run.%: + echo $@ + $(GDBSERVER_PY) \ + $(src_dir)/targets/RISC-V/$(word 2, $(subst ., ,$@)).py \ + $(word 3, $(subst ., ,$@)) \ + --isolate \ + --print-failures \ + --sim_cmd $(RISCV)/bin/$(RISCV_SIM) \ + --server_cmd $(RISCV)/bin/openocd + +# Target to check all the multicore options. +multi-tests: spike32-2 spike64-2-rtos spike32-2-hwthread + +pylint: + pylint --rcfile=pylint.rc `git ls-files '*.py'` + +spike%: $(foreach test, $(TESTS), run.spike%.$(test)) + echo Finished $@ + +clean: + rm -f *.pyc diff --git a/apps/riscv-tests/debug/README.md b/apps/riscv-tests/debug/README.md new file mode 100644 index 0000000..7dd6790 --- /dev/null +++ b/apps/riscv-tests/debug/README.md @@ -0,0 +1,58 @@ +Debug Tests +=========== + +Debugging requires many system components to all work together. The tests here +perform an end-to-end test, communicating with gdb and OpenOCD. +If a simulator or hardware passes all these tests, then you can be pretty +confident that the actual debug interface is functioning correctly. + +Requirements +============ +The following should be in the user's path: +* riscv64-unknown-elf-gcc (`rvv-0.9.x` branch for riscv-gnu-toolchain should + work if master does not have vector support yet) +* riscv64-unknown-elf-gdb (can be overridden with `--gdb` when running + gdbserver.py manually), which should be the latest from + git://sourceware.org/git/binutils-gdb.git. +* spike (can be overridden with `--sim_cmd` when running gdbserver.py + manually), which should be the latest from + https://github.com/riscv/riscv-isa-sim.git. +* openocd (can be overridden with `--server_cmd` when running gdbserver.py + manually), which should be the latest from + https://github.com/riscv/riscv-openocd.git. + +Usage +===== +To run a quick smoke test against spike, run `make`. For a more comprehensive +test against a variety of spike configurations, run `make all`. + +To run tests against hardware, or a specific spike configuration, manually +invoke gdbserver.py: `./gdbserver.py targets/.py` + +You can run just a single test by specifying any part of its name on the +command line, eg: `./gdbserver.py targets/RISC-V/spike64.py S0` runs +SimpleS0Test. Once that test has failed, you can look at the log file to get +an idea of what might have gone wrong. + +For custom targets, you can create a .py file anywhere and pass its path on the +command line. The Targets class in `targets.py` contains documentation on what +every variable means. + +Log Files +========= + +All output from tests ends up in the `logs/` subdirectory, with one log file +per test. If a test fails, this is where to look. + +Debug Tips +========== + +You can see what spike is doing by adding `-l` to the spike command, eg.: +`./gdbserver.py --sim_cmd "$RISCV/bin/spike -l" targets/RISC-V/spike32.py Breakpoint` + +You can see what OpenOCD is doing by adding `-d` to the OpenOCD command, eg.: +`./gdbserver.py --server_cmd "openocd -d" targets/RISC-V/spike32.py Breakpoint` + +You can run gdb under valgrind by passing --gdb, eg.: `./gdbserver.py +--gdb "valgrind riscv64-unknown-elf-gdb" targets/RISC-V/spike64.py +DownloadTest` diff --git a/apps/riscv-tests/debug/gdbserver.py b/apps/riscv-tests/debug/gdbserver.py new file mode 100755 index 0000000..5a0c378 --- /dev/null +++ b/apps/riscv-tests/debug/gdbserver.py @@ -0,0 +1,1607 @@ +#!/usr/bin/env python3 + +import argparse +import binascii +import random +import struct +import sys +import tempfile +import time +import os + +import targets +import testlib +from testlib import assertEqual, assertNotEqual, assertIn, assertNotIn +from testlib import assertGreater, assertRegex, assertLess +from testlib import GdbTest, GdbSingleHartTest, TestFailed +from testlib import assertTrue, TestNotApplicable, CompileError + +MSTATUS_UIE = 0x00000001 +MSTATUS_SIE = 0x00000002 +MSTATUS_HIE = 0x00000004 +MSTATUS_MIE = 0x00000008 +MSTATUS_UPIE = 0x00000010 +MSTATUS_SPIE = 0x00000020 +MSTATUS_HPIE = 0x00000040 +MSTATUS_MPIE = 0x00000080 +MSTATUS_SPP = 0x00000100 +MSTATUS_HPP = 0x00000600 +MSTATUS_MPP = 0x00001800 +MSTATUS_FS = 0x00006000 +MSTATUS_XS = 0x00018000 +MSTATUS_MPRV = 0x00020000 +MSTATUS_PUM = 0x00040000 +MSTATUS_MXR = 0x00080000 +MSTATUS_VM = 0x1F000000 +MSTATUS32_SD = 0x80000000 +MSTATUS64_SD = 0x8000000000000000 + +# pylint: disable=abstract-method + +def ihex_line(address, record_type, data): + assert len(data) < 128 + line = ":%02X%04X%02X" % (len(data), address, record_type) + check = len(data) + check += address % 256 + check += address >> 8 + check += record_type + for char in data: + value = ord(char) + check += value + line += "%02X" % value + line += "%02X\n" % ((256-check)%256) + return line + +def srec_parse(line): + assert line.startswith(b'S') + typ = line[:2] + count = int(line[2:4], 16) + data = "" + if typ == b'S0': + # header + return 0, 0, 0 + elif typ == b'S3': + # data with 32-bit address + # Any higher bits were chopped off. + address = int(line[4:12], 16) + for i in range(6, count+1): + data += "%c" % int(line[2*i:2*i+2], 16) + # Ignore the checksum. + return 3, address, data + elif typ == b'S7': + # ignore execution start field + return 7, 0, 0 + else: + raise TestFailed("Unsupported SREC type %r." % typ) + +def readable_binary_string(s): + return "".join("%02x" % ord(c) for c in s) + +class SimpleRegisterTest(GdbTest): + def check_reg(self, name, alias): + a = random.randrange(1< last_pc and pc - last_pc <= 4: + advances += 1 + else: + jumps += 1 + last_pc = pc + # Some basic sanity that we're not running between breakpoints or + # something. + assertGreater(jumps, 1) + assertGreater(advances, 5) + +class DebugExit(DebugTest): + def test(self): + self.exit() + +class DebugSymbols(DebugTest): + def test(self): + bp = self.gdb.b("main") + output = self.gdb.c() + assertIn(", main ", output) + self.gdb.command("delete %d" % bp) + bp = self.gdb.b("rot13") + output = self.gdb.c() + assertIn(", rot13 ", output) + self.gdb.command("delete %d" % bp) + +class DebugBreakpoint(DebugTest): + def test(self): + self.gdb.b("rot13") + # The breakpoint should be hit exactly 2 times. + for _ in range(2): + output = self.gdb.c() + self.gdb.p("$pc") + assertIn("Breakpoint ", output) + assertIn("rot13 ", output) + self.exit() + +class Hwbp1(DebugTest): + def test(self): + if self.hart.instruction_hardware_breakpoint_count < 1: + raise TestNotApplicable + + if not self.hart.honors_tdata1_hmode: + # Run to main before setting the breakpoint, because startup code + # will otherwise clear the trigger that we set. + self.gdb.b("main") + self.gdb.c() + + self.gdb.command("delete") + self.gdb.hbreak("rot13") + # The breakpoint should be hit exactly 2 times. + for _ in range(2): + output = self.gdb.c() + self.gdb.p("$pc") + assertRegex(output, r"[bB]reakpoint") + assertIn("rot13 ", output) + self.gdb.b("_exit") + self.exit() + +def MCONTROL_TYPE(xlen): + return 0xf<<((xlen)-4) +def MCONTROL_DMODE(xlen): + return 1<<((xlen)-5) +def MCONTROL_MASKMAX(xlen): + return 0x3<<((xlen)-11) + +MCONTROL_SELECT = (1<<19) +MCONTROL_TIMING = (1<<18) +MCONTROL_ACTION = (0x3f<<12) +MCONTROL_CHAIN = (1<<11) +MCONTROL_MATCH = (0xf<<7) +MCONTROL_M = (1<<6) +MCONTROL_H = (1<<5) +MCONTROL_S = (1<<4) +MCONTROL_U = (1<<3) +MCONTROL_EXECUTE = (1<<2) +MCONTROL_STORE = (1<<1) +MCONTROL_LOAD = (1<<0) + +MCONTROL_TYPE_NONE = 0 +MCONTROL_TYPE_MATCH = 2 + +MCONTROL_ACTION_DEBUG_EXCEPTION = 0 +MCONTROL_ACTION_DEBUG_MODE = 1 +MCONTROL_ACTION_TRACE_START = 2 +MCONTROL_ACTION_TRACE_STOP = 3 +MCONTROL_ACTION_TRACE_EMIT = 4 + +MCONTROL_MATCH_EQUAL = 0 +MCONTROL_MATCH_NAPOT = 1 +MCONTROL_MATCH_GE = 2 +MCONTROL_MATCH_LT = 3 +MCONTROL_MATCH_MASK_LOW = 4 +MCONTROL_MATCH_MASK_HIGH = 5 + +def set_field(reg, mask, val): + return ((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask)) + +class HwbpManual(DebugTest): + """Make sure OpenOCD behaves "normal" when the user sets a trigger by + writing the trigger registers themselves directly.""" + def early_applicable(self): + return self.target.support_manual_hwbp and \ + self.hart.instruction_hardware_breakpoint_count >= 1 + + def test(self): + if not self.hart.honors_tdata1_hmode: + # Run to main before setting the breakpoint, because startup code + # will otherwise clear the trigger that we set. + self.gdb.b("main") + self.gdb.c() + + self.gdb.command("delete") + #self.gdb.hbreak("rot13") + tdata1 = MCONTROL_DMODE(self.hart.xlen) + tdata1 = set_field(tdata1, MCONTROL_ACTION, MCONTROL_ACTION_DEBUG_MODE) + tdata1 = set_field(tdata1, MCONTROL_MATCH, MCONTROL_MATCH_EQUAL) + tdata1 |= MCONTROL_M | MCONTROL_S | MCONTROL_U | MCONTROL_EXECUTE + + tselect = 0 + while True: + self.gdb.p("$tselect=%d" % tselect) + value = self.gdb.p("$tselect") + if value != tselect: + raise TestNotApplicable + self.gdb.p("$tdata1=0x%x" % tdata1) + value = self.gdb.p("$tselect") + if value == tdata1: + break + self.gdb.p("$tdata1=0") + tselect += 1 + + self.gdb.p("$tdata2=&rot13") + # The breakpoint should be hit exactly 2 times. + for _ in range(2): + output = self.gdb.c(ops=2) + self.gdb.p("$pc") + assertRegex(output, r"[bB]reakpoint") + assertIn("rot13 ", output) + self.gdb.p("$tdata2=&crc32a") + self.gdb.c() + before = self.gdb.p("$pc") + assertEqual(before, self.gdb.p("&crc32a")) + self.gdb.stepi() + after = self.gdb.p("$pc") + assertNotEqual(before, after) + + self.gdb.b("_exit") + self.exit() + + +class Hwbp2(DebugTest): + def test(self): + if self.hart.instruction_hardware_breakpoint_count < 2: + raise TestNotApplicable + + self.gdb.command("delete") + self.gdb.hbreak("main") + self.gdb.hbreak("rot13") + # We should hit 3 breakpoints. + for expected in ("main", "rot13", "rot13"): + output = self.gdb.c() + self.gdb.p("$pc") + assertRegex(output, r"[bB]reakpoint") + assertIn("%s " % expected, output) + self.gdb.command("delete") + self.gdb.b("_exit") + self.exit() + +class TooManyHwbp(DebugTest): + def test(self): + for i in range(30): + self.gdb.hbreak("*rot13 + %d" % (i * 4)) + + output = self.gdb.c(checkOutput=False) + assertIn("Cannot insert hardware breakpoint", output) + # There used to be a bug where this would fail if done twice in a row. + output = self.gdb.c(checkOutput=False) + assertIn("Cannot insert hardware breakpoint", output) + # Clean up, otherwise the hardware breakpoints stay set and future + # tests may fail. + self.gdb.command("delete") + self.gdb.b("_exit") + self.exit() + +class Registers(DebugTest): + def test(self): + # Get to a point in the code where some registers have actually been + # used. + self.gdb.b("rot13") + self.gdb.c() + self.gdb.c() + # Try both forms to test gdb. + for cmd in ("info all-registers", "info registers all"): + output = self.gdb.command(cmd, ops=20) + for reg in ('zero', 'ra', 'sp', 'gp', 'tp'): + assertIn(reg, output) + for line in output.splitlines(): + assertRegex(line, r"^\S") + + #TODO + # mcpuid is one of the few registers that should have the high bit set + # (for rv64). + # Leave this commented out until gdb and spike agree on the encoding of + # mcpuid (which is going to be renamed to misa in any case). + #assertRegex(output, ".*mcpuid *0x80") + + #TODO: + # The instret register should always be changing. + #last_instret = None + #for _ in range(5): + # instret = self.gdb.p("$instret") + # assertNotEqual(instret, last_instret) + # last_instret = instret + # self.gdb.stepi() + + self.exit() + +class UserInterrupt(DebugTest): + def test(self): + """Sending gdb ^C while the program is running should cause it to + halt.""" + self.gdb.b("main:start") + self.gdb.c() + self.gdb.p("i=123") + self.gdb.c(wait=False) + time.sleep(2) + output = self.gdb.interrupt() + assert "main" in output + assertGreater(self.gdb.p("j"), 10) + self.gdb.p("i=0") + self.exit() + +class RepeatReadTest(DebugTest): + def early_applicable(self): + return self.target.supports_clint_mtime + + def test(self): + self.gdb.b("main:start") + self.gdb.c() + mtime_addr = 0x02000000 + 0xbff8 + count = 1024 + output = self.gdb.command("monitor riscv repeat_read %d 0x%x 4" % + (count, mtime_addr)) + values = [] + for line in output.splitlines(): + # Ignore warnings + if line.startswith("Batch memory"): + continue + for v in line.split(): + values.append(int(v, 16)) + + assertEqual(len(values), count) + # mtime should only ever increase, unless it wraps + slop = 0x100000 + for i in range(1, len(values)): + if values[i] < values[i-1]: + # wrapped + assertLess(values[i], slop) + else: + assertGreater(values[i], values[i-1]) + assertLess(values[i], values[i-1] + slop) + + output = self.gdb.command("monitor riscv repeat_read 0 0x%x 4" % + mtime_addr) + assertEqual(output, "") + +class Semihosting(GdbSingleHartTest): + # Include malloc so that gdb can assign a string. + compile_args = ("programs/semihosting.c", "programs/tiny-malloc.c", + "-DDEFINE_MALLOC", "-DDEFINE_FREE") + + def early_applicable(self): + return self.target.test_semihosting + + def setup(self): + self.gdb.load() + self.parkOtherHarts() + self.gdb.b("_exit") + + def exit(self, expected_result=0): + output = self.gdb.c() + assertIn("Breakpoint", output) + assertIn("_exit", output) + assertEqual(self.gdb.p("status"), expected_result) + + def test(self): + """Sending gdb ^C while the program is running should cause it to + halt.""" + temp = tempfile.NamedTemporaryFile(suffix=".data") + + self.gdb.b("main:begin") + self.gdb.c() + self.gdb.p('filename="%s"' % temp.name) + self.exit() + + contents = open(temp.name, "r").readlines() + assertIn("Hello, world!\n", contents) + +class InterruptTest(GdbSingleHartTest): + compile_args = ("programs/interrupt.c",) + + def early_applicable(self): + return self.target.supports_clint_mtime + + def setup(self): + self.gdb.load() + + def test(self): + self.gdb.b("main") + output = self.gdb.c() + assertIn(" main ", output) + self.gdb.b("trap_entry") + output = self.gdb.c() + assertIn(" trap_entry ", output) + assertEqual(self.gdb.p("$mip") & 0x80, 0x80) + assertEqual(self.gdb.p("interrupt_count"), 0) + # You'd expect local to still be 0, but it looks like spike doesn't + # jump to the interrupt handler immediately after the write to + # mtimecmp. + assertLess(self.gdb.p("local"), 1000) + self.gdb.command("delete breakpoints") + for _ in range(10): + self.gdb.c(wait=False) + time.sleep(2) + self.gdb.interrupt() + interrupt_count = self.gdb.p("interrupt_count") + local = self.gdb.p("local") + if interrupt_count > 1000 and \ + local > 1000: + return + + assertGreater(interrupt_count, 1000) + assertGreater(local, 1000) + + def postMortem(self): + GdbSingleHartTest.postMortem(self) + self.gdb.p("*((long long*) 0x200bff8)") + self.gdb.p("*((long long*) 0x2004000)") + self.gdb.p("interrupt_count") + self.gdb.p("local") + +class MulticoreRegTest(GdbTest): + compile_args = ("programs/infinite_loop.S", "-DMULTICORE") + + def early_applicable(self): + return len(self.target.harts) > 1 + + def setup(self): + self.gdb.load() + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.p("$pc=_start") + + def test(self): + # Run to main + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.b("main") + self.gdb.c() + assertIn("main", self.gdb.where()) + self.gdb.command("delete breakpoints") + + # Run through the entire loop. + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.b("main_end") + self.gdb.c() + assertIn("main_end", self.gdb.where()) + + hart_ids = [] + for hart in self.target.harts: + self.gdb.select_hart(hart) + # Check register values. + x1 = self.gdb.p("$x1") + hart_id = self.gdb.p("$mhartid") + assertEqual(x1, hart_id << 8) + assertNotIn(hart_id, hart_ids) + hart_ids.append(hart_id) + for n in range(2, 32): + value = self.gdb.p("$x%d" % n) + assertEqual(value, (hart_ids[-1] << 8) + n - 1) + + # Confirmed that we read different register values for different harts. + # Write a new value to x1, and run through the add sequence again. + + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.p("$x1=0x%x" % (hart.index * 0x1000)) + self.gdb.p("$pc=main_post_csrr") + self.gdb.c() + for hart in self.target.harts: + self.gdb.select_hart(hart) + assertIn("main", self.gdb.where()) + # Check register values. + for n in range(1, 32): + value = self.gdb.p("$x%d" % n) + assertEqual(value, hart.index * 0x1000 + n - 1) + +#class MulticoreRunHaltStepiTest(GdbTest): +# compile_args = ("programs/multicore.c", "-DMULTICORE") +# +# def early_applicable(self): +# return len(self.target.harts) > 1 +# +# def setup(self): +# self.gdb.load() +# for hart in self.target.harts: +# self.gdb.select_hart(hart) +# self.gdb.p("$mhartid") +# self.gdb.p("$pc=_start") +# +# def test(self): +# previous_hart_count = [0 for h in self.target.harts] +# previous_interrupt_count = [0 for h in self.target.harts] +# # Check 10 times +# for i in range(10): +# # 3 attempts for each time we want the check to pass +# for attempt in range(3): +# self.gdb.global_command("echo round %d attempt %d\\n" % (i, +# attempt)) +# self.gdb.c_all(wait=False) +# time.sleep(2) +# self.gdb.interrupt_all() +# hart_count = self.gdb.p("hart_count") +# interrupt_count = self.gdb.p("interrupt_count") +# ok = True +# for i, h in enumerate(self.target.harts): +# if hart_count[i] <= previous_hart_count[i]: +# ok = False +# break +# if interrupt_count[i] <= previous_interrupt_count[i]: +# ok = False +# break +# self.gdb.p("$mie") +# self.gdb.p("$mip") +# self.gdb.p("$mstatus") +# self.gdb.p("$priv") +# self.gdb.p("buf", fmt="") +# self.gdb.select_hart(h) +# pc = self.gdb.p("$pc") +# self.gdb.stepi() +# stepped_pc = self.gdb.p("$pc") +# assertNotEqual(pc, stepped_pc) +# previous_hart_count = hart_count +# previous_interrupt_count = interrupt_count +# if ok: +# break +# else: +# assert False, \ +# "hart count or interrupt didn't increment as expected" + +class MulticoreRunAllHaltOne(GdbTest): + compile_args = ("programs/multicore.c", "-DMULTICORE") + + def early_applicable(self): + return len(self.target.harts) > 1 + + def setup(self): + self.gdb.select_hart(self.target.harts[0]) + self.gdb.load() + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.p("$pc=_start") + + def test(self): + if not self.gdb.one_hart_per_gdb(): + raise TestNotApplicable + + # Run harts in reverse order + for h in reversed(self.target.harts): + self.gdb.select_hart(h) + self.gdb.c(wait=False) + + self.gdb.interrupt() + # Give OpenOCD time to call poll() on both harts, which is what causes + # the bug. + time.sleep(1) + self.gdb.p("buf", fmt="") + +class MulticoreRtosSwitchActiveHartTest(GdbTest): + compile_args = ("programs/multicore.c", "-DMULTICORE") + + def early_applicable(self): + return len(self.target.harts) > 1 + + def setup(self): + self.gdb.select_hart(self.target.harts[0]) + self.gdb.load() + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.p("$pc=_start") + + def test(self): + if self.gdb.one_hart_per_gdb(): + raise TestNotApplicable + + # Set breakpoint near '_start' label to increase the chances of a + # situation when all harts hit breakpoint immediately and + # simultaneously. + self.gdb.b("set_trap_handler") + + # Check that all harts hit breakpoint one by one. + for _ in range(len(self.target.harts)): + output = self.gdb.c() + assertIn("hit Breakpoint", output) + assertIn("set_trap_handler", output) + assertNotIn("received signal SIGTRAP", output) + +class SmpSimultaneousRunHalt(GdbTest): + compile_args = ("programs/run_halt_timing.S", "-DMULTICORE") + + def early_applicable(self): + return len(self.target.harts) > 1 and self.target.support_hasel + + def setup(self): + self.gdb.select_hart(self.target.harts[0]) + self.gdb.load() + for hart in self.target.harts: + self.gdb.select_hart(hart) + self.gdb.p("$pc=_start") + + def test(self): + if self.gdb.one_hart_per_gdb() or not self.server.smp(): + raise TestNotApplicable + + old_mtime = set() + for _ in range(5): + self.gdb.c_all(wait=False) + time.sleep(2) + self.gdb.interrupt_all() + + mtime_value = [] + counter = [] + for hart in self.target.harts: + self.gdb.select_hart(hart) + mv = self.gdb.p("$s2") + assertNotIn(mv, old_mtime, + "mtime doesn't appear to be changing at all") + mtime_value.append(mv) + c = self.gdb.p("$s0") + assertNotEqual(c, 0, + "counter didn't increment; code didn't run?") + counter.append(c) + # Reset the counter for the next round. + self.gdb.p("$s0=0") + + old_mtime.update(mtime_value) + + mtime_spread = max(mtime_value) - min(mtime_value) + print("mtime_spread:", mtime_spread) + counter_spread = max(counter) - min(counter) + print("counter_spread:", counter_spread) + + assertLess(mtime_spread, 101 * (len(self.target.harts) - 1), + "Harts don't halt around the same time.") + # spike executes normal code 5000 instructions at a time, so we + # expect 5k instructions to be executed on one hart before the + # other gets to go. Our loop (unoptimized) is quite a few + # instructions, but allow for 5k anyway. + assertLess(counter_spread, 5001 * (len(self.target.harts) - 1), + "Harts don't resume around the same time.") + +class StepTest(GdbSingleHartTest): + compile_args = ("programs/step.S", ) + + def setup(self): + self.gdb.load() + self.gdb.b("main") + self.gdb.c() + + def test(self): + main_address = self.gdb.p("$pc") + if self.hart.extensionSupported("c"): + sequence = (4, 8, 0xc, 0xe, 0x14, 0x18, 0x22, 0x1c, 0x24, 0x24) + else: + sequence = (4, 8, 0xc, 0x10, 0x18, 0x1c, 0x28, 0x20, 0x2c, 0x2c) + for expected in sequence: + self.gdb.stepi() + pc = self.gdb.p("$pc") + assertEqual("%x" % (pc - main_address), "%x" % expected) + +class JumpHbreak(GdbSingleHartTest): + """'jump' resumes execution at location. Execution stops again immediately + if there is a breakpoint there. + That second line can be trouble.""" + compile_args = ("programs/trigger.S", ) + + def early_applicable(self): + return self.hart.instruction_hardware_breakpoint_count >= 1 + + def setup(self): + self.gdb.load() + self.gdb.hbreak("main") + self.gdb.c() + self.gdb.command("delete 1") + + def test(self): + self.gdb.b("read_loop") + self.gdb.command("hbreak just_before_read_loop") + output = self.gdb.command("jump just_before_read_loop") + assertRegex(output, r"Breakpoint \d, just_before_read_loop ") + output = self.gdb.c() + assertRegex(output, r"Breakpoint \d, read_loop ") + +class TriggerTest(GdbSingleHartTest): + compile_args = ("programs/trigger.S", ) + def setup(self): + self.gdb.load() + self.gdb.b("main") + self.gdb.c() + self.gdb.command("delete") + + def exit(self): + self.gdb.command("delete") + self.gdb.b("_exit") + output = self.gdb.c() + assertIn("Breakpoint", output) + assertIn("_exit", output) + +class TriggerExecuteInstant(TriggerTest): + """Test an execute breakpoint on the first instruction executed out of + debug mode.""" + def test(self): + main_address = self.gdb.p("$pc") + self.gdb.command("hbreak *0x%x" % (main_address + 4)) + self.gdb.c() + assertEqual(self.gdb.p("$pc"), main_address+4) + +# FIXME: Triggers aren't quite working yet +#class TriggerLoadAddress(TriggerTest): +# def test(self): +# self.gdb.command("rwatch *((&data)+1)") +# output = self.gdb.c() +# assertIn("read_loop", output) +# assertEqual(self.gdb.p("$a0"), +# self.gdb.p("(&data)+1")) +# self.exit() + +class TriggerLoadAddressInstant(TriggerTest): + """Test a load address breakpoint on the first instruction executed out of + debug mode.""" + def test(self): + self.gdb.command("b just_before_read_loop") + self.gdb.c() + read_loop = self.gdb.p("&read_loop") + read_again = self.gdb.p("&read_again") + data = self.gdb.p("&data") + self.gdb.command("rwatch *0x%x" % data) + self.gdb.c() + # Accept hitting the breakpoint before or after the load instruction. + assertIn(self.gdb.p("$pc"), [read_loop, read_loop + 4]) + assertEqual(self.gdb.p("$a0"), self.gdb.p("&data")) + + self.gdb.c() + assertIn(self.gdb.p("$pc"), [read_again, read_again + 4]) + assertEqual(self.gdb.p("$a0"), self.gdb.p("&data")) + +# FIXME: Triggers aren't quite working yet +#class TriggerStoreAddress(TriggerTest): +# def test(self): +# self.gdb.command("watch *((&data)+3)") +# output = self.gdb.c() +# assertIn("write_loop", output) +# assertEqual(self.gdb.p("$a0"), +# self.gdb.p("(&data)+3")) +# self.exit() + +class TriggerStoreAddressInstant(TriggerTest): + def test(self): + """Test a store address breakpoint on the first instruction executed out + of debug mode.""" + self.gdb.command("b just_before_write_loop") + self.gdb.c() + write_loop = self.gdb.p("&write_loop") + data = self.gdb.p("&data") + self.gdb.command("watch *0x%x" % data) + self.gdb.c() + + # Accept hitting the breakpoint before or after the store instruction. + assertIn(self.gdb.p("$pc"), [write_loop, write_loop + 4]) + assertEqual(self.gdb.p("$a0"), self.gdb.p("&data")) + +class TriggerDmode(TriggerTest): + def early_applicable(self): + return self.hart.honors_tdata1_hmode + + def check_triggers(self, tdata1_lsbs, tdata2): + dmode = 1 << (self.hart.xlen-5) + + triggers = [] + + if self.hart.xlen == 32: + xlen_type = 'int' + elif self.hart.xlen == 64: + xlen_type = 'long long' + else: + raise NotImplementedError + + dmode_count = 0 + i = 0 + for i in range(16): + tdata1 = self.gdb.p("((%s *)&data)[%d]" % (xlen_type, 2*i)) + if tdata1 == 0: + break + tdata2 = self.gdb.p("((%s *)&data)[%d]" % (xlen_type, 2*i+1)) + + if tdata1 & dmode: + dmode_count += 1 + else: + assertEqual(tdata1 & 0xffff, tdata1_lsbs) + assertEqual(tdata2, tdata2) + + assertGreater(i, 1) + assertEqual(dmode_count, 1) + + return triggers + + def test(self): + # If we want this test to run from flash, we can't have any software + # breakpoints set. + + self.gdb.command("hbreak write_load_trigger") + self.gdb.p("$pc=write_store_trigger") + output = self.gdb.c() + assertIn("write_load_trigger", output) + self.check_triggers((1<<6) | (1<<1), 0xdeadbee0) + self.gdb.command("delete") + self.gdb.command("hbreak clear_triggers") + output = self.gdb.c() + assertIn("clear_triggers", output) + self.check_triggers((1<<6) | (1<<0), 0xfeedac00) + self.gdb.command("delete") + self.exit() + +class RegsTest(GdbSingleHartTest): + compile_args = ("programs/regs.S", ) + def setup(self): + self.gdb.load() + main_bp = self.gdb.b("main") + output = self.gdb.c() + assertIn("Breakpoint ", output) + assertIn("main", output) + self.gdb.command("delete %d" % main_bp) + self.gdb.b("handle_trap") + +class WriteGprs(RegsTest): + def test(self): + if self.hart.extensionSupported('E'): + regs = [("x%d" % n) for n in range(2, 16)] + else: + regs = [("x%d" % n) for n in range(2, 32)] + + self.gdb.p("$pc=write_regs") + for i, r in enumerate(regs): + self.gdb.p("$%s=%d" % (r, (0xdeadbeef<\n") + self.download_c.write( + b"unsigned int crc32a(uint8_t *message, unsigned int size);\n") + self.download_c.write(b"uint32_t length = %d;\n" % length) + self.download_c.write(b"uint8_t d[%d] = {\n" % length) + self.crc = 0 + assert length % 16 == 0 + for i in range(length // 16): + self.download_c.write((" /* 0x%04x */ " % (i * 16)).encode()) + for _ in range(16): + value = random.randrange(1<<8) + self.download_c.write(("0x%02x, " % value).encode()) + self.crc = binascii.crc32(struct.pack("B", value), self.crc) + self.download_c.write(b"\n") + self.download_c.write(b"};\n") + self.download_c.write(b"uint8_t *data = &d[0];\n") + self.download_c.write( + b"uint32_t main() { return crc32a(data, length); }\n") + self.download_c.flush() + + if self.crc < 0: + self.crc += 2**32 + + self.binary = self.target.compile(self.hart, self.download_c.name, + "programs/checksum.c") + self.gdb.global_command("file %s" % self.binary) + + def test(self): + self.gdb.load() + self.parkOtherHarts() + self.gdb.command("b _exit") + self.gdb.c(ops=100) + assertEqual(self.gdb.p("status"), self.crc) + os.unlink(self.download_c.name) + +#class MprvTest(GdbSingleHartTest): +# compile_args = ("programs/mprv.S", ) +# def setup(self): +# self.gdb.load() +# +# def test(self): +# """Test that the debugger can access memory when MPRV is set.""" +# self.gdb.c(wait=False) +# time.sleep(0.5) +# self.gdb.interrupt() +# output = self.gdb.command("p/x *(int*)(((char*)&data)-0x80000000)") +# assertIn("0xbead", output) + +class PrivTest(GdbSingleHartTest): + compile_args = ("programs/priv.S", ) + def setup(self): + # pylint: disable=attribute-defined-outside-init + self.gdb.load() + + misa = self.hart.misa + self.supported = set() + if misa & (1<<20): + self.supported.add(0) + if misa & (1<<18): + self.supported.add(1) + if misa & (1<<7): + self.supported.add(2) + self.supported.add(3) + + self.disable_pmp() + + # Ensure Virtual Memory is disabled if applicable (SATP register is not + # reset) + try: + self.gdb.p("$satp=0") + except testlib.CouldNotFetch: + # SATP only exists if you have S mode. + pass + +class PrivRw(PrivTest): + def test(self): + """Test reading/writing priv.""" + self.write_nop_program(4) + for privilege in range(4): + self.gdb.p("$priv=%d" % privilege) + self.gdb.stepi() + actual = self.gdb.p("$priv") + assertIn(actual, self.supported) + if privilege in self.supported: + assertEqual(actual, privilege) + +class PrivChange(PrivTest): + def test(self): + """Test that the core's privilege level actually changes.""" + + if 0 not in self.supported: + raise TestNotApplicable + + self.gdb.b("main") + self.gdb.c() + + # Machine mode + self.gdb.p("$priv=3") + main_address = self.gdb.p("$pc") + self.gdb.stepi() + assertEqual("%x" % self.gdb.p("$pc"), "%x" % (main_address+4)) + + # User mode + self.gdb.p("$priv=0") + self.gdb.stepi() + # Should have taken an exception, so be nowhere near main. + pc = self.gdb.p("$pc") + assertTrue(pc < main_address or pc > main_address + 0x100) + +class CheckMisa(GdbTest): + """Make sure the misa we're using is actually what the target exposes.""" + def test(self): + for hart in self.target.harts: + self.gdb.select_hart(hart) + misa = self.gdb.p("$misa") + assertEqual(misa, hart.misa) + +class TranslateTest(GdbTest): + compile_args = ("programs/translate.c", ) + + def setup(self): + self.disable_pmp() + + self.gdb.load() + self.gdb.b("main") + output = self.gdb.c() + assertRegex(output, r"\bmain\b") + + def check_satp(self, mode): + if self.hart.xlen == 32: + satp = mode << 31 + else: + satp = mode << 60 + try: + self.gdb.p("$satp=0x%x" % satp) + except testlib.CouldNotFetch: + raise TestNotApplicable + readback = self.gdb.p("$satp") + self.gdb.p("$satp=0") + if readback != satp: + raise TestNotApplicable + + def test_translation(self): + self.gdb.b("error") + self.gdb.b("handle_trap") + self.gdb.b("main:active") + output = self.gdb.c() + assertRegex(output, r"\bmain\b") + assertEqual(0xdeadbeef, self.gdb.p("physical[0]")) + assertEqual(0x55667788, self.gdb.p("physical[1]")) + assertEqual(0xdeadbeef, self.gdb.p("virtual[0]")) + assertEqual(0x55667788, self.gdb.p("virtual[1]")) + +SATP_MODE_OFF = 0 +SATP_MODE_SV32 = 1 +SATP_MODE_SV39 = 8 +SATP_MODE_SV48 = 9 +SATP_MODE_SV57 = 10 +SATP_MODE_SV64 = 11 + +class Sv32Test(TranslateTest): + def early_applicable(self): + return self.hart.xlen == 32 + + def test(self): + self.check_satp(SATP_MODE_SV32) + self.gdb.p("vms=&sv32") + self.test_translation() + +class Sv39Test(TranslateTest): + def early_applicable(self): + return self.hart.xlen > 32 + + def test(self): + self.check_satp(SATP_MODE_SV39) + self.gdb.p("vms=&sv39") + self.test_translation() + +class Sv48Test(TranslateTest): + def early_applicable(self): + return self.hart.xlen > 32 + + def test(self): + self.check_satp(SATP_MODE_SV48) + self.gdb.p("vms=&sv48") + self.test_translation() + +class VectorTest(GdbSingleHartTest): + compile_args = ("programs/vectors.S", ) + + def early_applicable(self): + if not self.hart.extensionSupported('V'): + return False + # If the compiler can't build this test, say it's not applicable. At + # some time all compilers will support the V extension, but we're not + # there yet. + try: + self.compile() + except CompileError as e: + if b"Error: unknown CSR `vlenb'" in e.stderr: + return False + return True + + def setup(self): + self.gdb.load() + self.gdb.b("main") + self.gdb.c() + + def test(self): + vlenb = self.gdb.p("$vlenb") + self.gdb.command("delete") + self.gdb.b("_exit") + self.gdb.b("trap_entry") + + self.gdb.b("test0") + + output = self.gdb.c() + assertIn("Breakpoint", output) + assertIn("test0", output) + + assertEqual(self.gdb.p("$a0"), 0) + a = self.gdb.x("&a", 'b', vlenb) + b = self.gdb.x("&b", 'b', vlenb) + v4 = self.gdb.p("$v4") + assertEqual(a, b) + assertEqual(b, v4["b"]) + assertEqual(0, self.gdb.p("$a0")) + + self.gdb.b("test1") + + output = self.gdb.c() + assertIn("Breakpoint", output) + assertIn("test1", output) + + assertEqual(self.gdb.p("$a0"), 0) + b = self.gdb.x("&b", 'b', vlenb) + c = self.gdb.x("&c", 'b', vlenb) + v4 = self.gdb.p("$v4") + assertEqual(b, c) + assertEqual(c, v4["b"]) + assertEqual(0, self.gdb.p("$a0")) + + output = self.gdb.c() + assertIn("Breakpoint", output) + assertIn("_exit", output) + assertEqual(self.gdb.p("status"), 0) + +parsed = None +def main(): + parser = argparse.ArgumentParser( + description="Test that gdb can talk to a RISC-V target.", + epilog=""" + Example command line from the real world: + Run all RegsTest cases against a physical FPGA, with custom openocd command: + ./gdbserver.py --freedom-e300 --server_cmd "$HOME/SiFive/openocd/src/openocd -s $HOME/SiFive/openocd/tcl -d" Simple + """) + targets.add_target_options(parser) + + testlib.add_test_run_options(parser) + + # TODO: remove global + global parsed # pylint: disable=global-statement + parsed = parser.parse_args() + target = targets.target(parsed) + testlib.print_log_names = parsed.print_log_names + + module = sys.modules[__name__] + + return testlib.run_all_tests(module, target, parsed) + +# TROUBLESHOOTING TIPS +# If a particular test fails, run just that one test, eg.: +# ./gdbserver.py MprvTest.test_mprv +# Then inspect gdb.log and spike.log to see what happened in more detail. + +if __name__ == '__main__': + sys.exit(main()) diff --git a/apps/riscv-tests/debug/openocd.py b/apps/riscv-tests/debug/openocd.py new file mode 100755 index 0000000..1b7c8fd --- /dev/null +++ b/apps/riscv-tests/debug/openocd.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +"""Test that OpenOCD can talk to a RISC-V target.""" + +import argparse +import sys + +import targets +import testlib +from testlib import assertIn, assertEqual + +class OpenOcdTest(testlib.BaseTest): + def __init__(self, target): + testlib.BaseTest.__init__(self, target) + self.gdb = None + + def early_applicable(self): + return self.target.openocd_config + + def setup(self): + # pylint: disable=attribute-defined-outside-init + self.cli = testlib.OpenocdCli() + self.cli.command("halt") + + def write_nops(self, count): + for address in range(self.target.ram, self.target.ram + 4 * count, 4): + # 0x13 is nop + self.cli.command("mww 0x%x 0x13" % address) + +class RegTest(OpenOcdTest): + def test(self): + self.write_nops(4) + + regs = self.cli.reg() + assertIn("x18", regs) + + self.cli.command("reg x18 0x11782") + self.cli.command("step 0x%x" % self.target.ram) + + assertEqual(self.cli.reg("x18"), 0x11782) + +class StepTest(OpenOcdTest): + def test(self): + self.write_nops(4) + + self.cli.command("step 0x%x" % self.target.ram) + for i in range(4): + pc = self.cli.reg("pc") + assertEqual(pc, self.target.ram + 4 * (i+1)) + self.cli.command("step") + +class ResumeTest(OpenOcdTest): + def test(self): + self.write_nops(16) + + self.cli.command("bp 0x%x 4" % (self.target.ram + 12)) + self.cli.command("bp 0x%x 4" % (self.target.ram + 24)) + + self.cli.command("resume 0x%x" % self.target.ram) + assertEqual(self.cli.reg("pc"), self.target.ram + 12) + + self.cli.command("resume") + assertEqual(self.cli.reg("pc"), self.target.ram + 24) + + self.cli.command("resume 0x%x" % self.target.ram) + assertEqual(self.cli.reg("pc"), self.target.ram + 12) + +def main(): + parser = argparse.ArgumentParser( + description="Test that OpenOCD can talk to a RISC-V target.") + targets.add_target_options(parser) + testlib.add_test_run_options(parser) + + parsed = parser.parse_args() + + target = parsed.target(parsed.server_cmd, parsed.sim_cmd, parsed.isolate) + if parsed.xlen: + target.xlen = parsed.xlen + + module = sys.modules[__name__] + + return testlib.run_all_tests(module, target, parsed) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/apps/riscv-tests/debug/programs/checksum.c b/apps/riscv-tests/debug/programs/checksum.c new file mode 100644 index 0000000..e076f8a --- /dev/null +++ b/apps/riscv-tests/debug/programs/checksum.c @@ -0,0 +1,38 @@ +#include + +// CRC code from http://www.hackersdelight.org/hdcodetxt/crc.c.txt + +// Reverses (reflects) bits in a 32-bit word. +unsigned reverse(unsigned x) { + x = ((x & 0x55555555) << 1) | ((x >> 1) & 0x55555555); + x = ((x & 0x33333333) << 2) | ((x >> 2) & 0x33333333); + x = ((x & 0x0F0F0F0F) << 4) | ((x >> 4) & 0x0F0F0F0F); + x = (x << 24) | ((x & 0xFF00) << 8) | + ((x >> 8) & 0xFF00) | (x >> 24); + return x; +} + +// ----------------------------- crc32a -------------------------------- + +/* This is the basic CRC algorithm with no optimizations. It follows the +logic circuit as closely as possible. */ + +unsigned int crc32a(uint8_t *message, unsigned int size) { + int i, j; + unsigned int byte, crc; + + i = 0; + crc = 0xFFFFFFFF; + while (i < size) { + byte = message[i]; // Get next byte. + byte = reverse(byte); // 32-bit reversal. + for (j = 0; j <= 7; j++) { // Do eight times. + if ((int)(crc ^ byte) < 0) + crc = (crc << 1) ^ 0x04C11DB7; + else crc = crc << 1; + byte = byte << 1; // Ready next msg bit. + } + i = i + 1; + } + return reverse(~crc); +} diff --git a/apps/riscv-tests/debug/programs/counting_loop.c b/apps/riscv-tests/debug/programs/counting_loop.c new file mode 100644 index 0000000..7c7d600 --- /dev/null +++ b/apps/riscv-tests/debug/programs/counting_loop.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include + +int main() +{ + int sum = 0; + int counter = 0; + + while (counter < 10) { + counter = counter + 1; + sum = sum + counter; + } + + return counter; +} diff --git a/apps/riscv-tests/debug/programs/debug.c b/apps/riscv-tests/debug/programs/debug.c new file mode 100644 index 0000000..8a4aa73 --- /dev/null +++ b/apps/riscv-tests/debug/programs/debug.c @@ -0,0 +1,69 @@ +#include +#include +#include +#include + +unsigned int crc32a(uint8_t *message, unsigned int size); + +unsigned int fib(unsigned int n) +{ + if (n == 0) { + return 0; + } + + unsigned int a = 0; + unsigned int b = 1; + + for (unsigned int i = 1; i < n; i++) { + unsigned int next = a + b; + a = b; + b = next; + } + + return b; +} + +void rot13(char *buf) +{ + while (*buf) { + if ((*buf >= 'a' && *buf <= 'm') || + (*buf >= 'A' && *buf <= 'M')) { + *buf += 13; + } else if ((*buf >= 'n' && *buf <= 'z') || + (*buf >= 'N' && *buf <= 'Z')) { + *buf -= 13; + } + buf++; + } +} + +size_t strlen(const char *buf) +{ + int len = 0; + while (buf[len]) + len++; + return len; +} + +extern void *__malloc_freelist; + +int main() +{ + __malloc_freelist = 0; + + volatile int i = 0; + int j = 0; + char fox[] = "The quick brown fox jumps of the lazy dog."; + unsigned int checksum = 0; + +start: + while (i) + j++; + + rot13(fox); + checksum ^= crc32a(fox, strlen(fox)); + rot13(fox); + checksum ^= crc32a(fox, strlen(fox)); + + return checksum; +} diff --git a/apps/riscv-tests/debug/programs/encoding.h b/apps/riscv-tests/debug/programs/encoding.h new file mode 120000 index 0000000..56fa44a --- /dev/null +++ b/apps/riscv-tests/debug/programs/encoding.h @@ -0,0 +1 @@ +../../env/encoding.h \ No newline at end of file diff --git a/apps/riscv-tests/debug/programs/entry.S b/apps/riscv-tests/debug/programs/entry.S new file mode 100755 index 0000000..3796b3b --- /dev/null +++ b/apps/riscv-tests/debug/programs/entry.S @@ -0,0 +1,207 @@ +#include "encoding.h" + +#define STACK_SIZE (90 * XLEN / 8) + +#if XLEN == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + + .section .text.entry + .globl _start +_start: + j handle_reset + +nmi_vector: + j nmi_vector + +trap_vector: + j trap_entry + +handle_reset: + // If misa doesn't exist (or is following an old spec where it has a + // different number), skip the next block. + la t0, 3f + csrw mtvec, t0 + csrwi mstatus, 0 + + // make sure these registers exist by seeing if either S or U bits + // are set before attempting to zero them out. + csrr t1, misa + addi t2, x0, 1 + slli t2, t2, 20 // U_EXTENSION + and t2, t1, t2 + bne x0, t2, 1f + addi t2, x0, 1 + slli t2, t2, 18 // S_EXTENSION + and t2, t1, t2 + bne x0, t2, 1f + j 2f +1: + csrwi mideleg, 0 + csrwi medeleg, 0 +2: + csrwi mie, 0 +3: + la t0, trap_entry + csrw mtvec, t0 + csrwi mstatus, 0 + + # initialize global pointer +.option push +.option norelax + la gp, __global_pointer$ +.option pop + + # Initialize stack pointer. + la sp, stack_bottom + # Give each hart STACK_SIZE of stack. + # Assume hart IDs are contiguous and start at 0. + li t1, STACK_SIZE + csrr t0, CSR_MHARTID + # Don't use mul instruction because not all harts support it. + addi t0, t0, 1 +1: + add sp, sp, t1 + addi t0, t0, -1 + bnez t0, 1b + + # Clear all hardware triggers + li t0, ~0 +1: + addi t0, t0, 1 + csrw CSR_TSELECT, t0 + csrw CSR_TDATA1, zero + csrr t1, CSR_TSELECT + beq t0, t1, 1b + +#ifdef MULTICORE + csrr t0, CSR_MHARTID + bnez t0, wait_until_initialized +#endif + + la t0, __bss_start + la t1, __bss_end +1: + bge t0, t1, 2f + sb zero, 0(t0) + addi t0, t0, 1 + j 1b +2: +#ifdef MULTICORE + la t0, initialized + li t1, 1 + sw t1, 0(t0) + +wait_until_initialized: # Wait for hart 0 to perform initialization. + la t0, initialized +1: + lw t1, 0(t0) + beqz t1, 1b +#endif + + # perform the rest of initialization in C + j _init + + +.align 2 +trap_entry: + addi sp, sp, -32*REGBYTES + + SREG x1, 1*REGBYTES(sp) + SREG x2, 2*REGBYTES(sp) + SREG x3, 3*REGBYTES(sp) + SREG x4, 4*REGBYTES(sp) + SREG x5, 5*REGBYTES(sp) + SREG x6, 6*REGBYTES(sp) + SREG x7, 7*REGBYTES(sp) + SREG x8, 8*REGBYTES(sp) + SREG x9, 9*REGBYTES(sp) + SREG x10, 10*REGBYTES(sp) + SREG x11, 11*REGBYTES(sp) + SREG x12, 12*REGBYTES(sp) + SREG x13, 13*REGBYTES(sp) + SREG x14, 14*REGBYTES(sp) + SREG x15, 15*REGBYTES(sp) +#ifndef RV32E + SREG x16, 16*REGBYTES(sp) + SREG x17, 17*REGBYTES(sp) + SREG x18, 18*REGBYTES(sp) + SREG x19, 19*REGBYTES(sp) + SREG x20, 20*REGBYTES(sp) + SREG x21, 21*REGBYTES(sp) + SREG x22, 22*REGBYTES(sp) + SREG x23, 23*REGBYTES(sp) + SREG x24, 24*REGBYTES(sp) + SREG x25, 25*REGBYTES(sp) + SREG x26, 26*REGBYTES(sp) + SREG x27, 27*REGBYTES(sp) + SREG x28, 28*REGBYTES(sp) + SREG x29, 29*REGBYTES(sp) + SREG x30, 30*REGBYTES(sp) + SREG x31, 31*REGBYTES(sp) +#endif + + csrr a0, mcause + csrr a1, mepc + mv a2, sp + jal handle_trap + csrw mepc, a0 + + # Remain in M-mode after mret + li t0, MSTATUS_MPP + csrs mstatus, t0 + + LREG x1, 1*REGBYTES(sp) + LREG x2, 2*REGBYTES(sp) + LREG x3, 3*REGBYTES(sp) + LREG x4, 4*REGBYTES(sp) + LREG x5, 5*REGBYTES(sp) + LREG x6, 6*REGBYTES(sp) + LREG x7, 7*REGBYTES(sp) + LREG x8, 8*REGBYTES(sp) + LREG x9, 9*REGBYTES(sp) + LREG x10, 10*REGBYTES(sp) + LREG x11, 11*REGBYTES(sp) + LREG x12, 12*REGBYTES(sp) + LREG x13, 13*REGBYTES(sp) + LREG x14, 14*REGBYTES(sp) + LREG x15, 15*REGBYTES(sp) +#ifndef RV32E + LREG x16, 16*REGBYTES(sp) + LREG x17, 17*REGBYTES(sp) + LREG x18, 18*REGBYTES(sp) + LREG x19, 19*REGBYTES(sp) + LREG x20, 20*REGBYTES(sp) + LREG x21, 21*REGBYTES(sp) + LREG x22, 22*REGBYTES(sp) + LREG x23, 23*REGBYTES(sp) + LREG x24, 24*REGBYTES(sp) + LREG x25, 25*REGBYTES(sp) + LREG x26, 26*REGBYTES(sp) + LREG x27, 27*REGBYTES(sp) + LREG x28, 28*REGBYTES(sp) + LREG x29, 29*REGBYTES(sp) + LREG x30, 30*REGBYTES(sp) + LREG x31, 31*REGBYTES(sp) +#endif + + addi sp, sp, 32*REGBYTES + mret + +loop_forever: + j loop_forever + + // Fill the stack with data so we can see if it was overrun. + .section .data + .align 4 +stack_bottom: + .fill NHARTS * STACK_SIZE/4, 4, 0x22446688 +stack_top: +initialized: + .word 0 diff --git a/apps/riscv-tests/debug/programs/infinite_loop.S b/apps/riscv-tests/debug/programs/infinite_loop.S new file mode 100644 index 0000000..5cc377c --- /dev/null +++ b/apps/riscv-tests/debug/programs/infinite_loop.S @@ -0,0 +1,44 @@ +#include "encoding.h" + + .global main + .global main_end + .global main_post_csrr + + // Load constants into all registers so we can test no register are + // clobbered after attaching. +main: + csrr x1, CSR_MHARTID + slli x1, x1, 8 +main_post_csrr: + addi x2, x1, 1 + addi x3, x2, 1 + addi x4, x3, 1 + addi x5, x4, 1 + addi x6, x5, 1 + addi x7, x6, 1 + addi x8, x7, 1 + addi x9, x8, 1 + addi x10, x9, 1 + addi x11, x10, 1 + addi x12, x11, 1 + addi x13, x12, 1 + addi x14, x13, 1 + addi x15, x14, 1 + addi x16, x15, 1 + addi x17, x16, 1 + addi x18, x17, 1 + addi x19, x18, 1 + addi x20, x19, 1 + addi x21, x20, 1 + addi x22, x21, 1 + addi x23, x22, 1 + addi x24, x23, 1 + addi x25, x24, 1 + addi x26, x25, 1 + addi x27, x26, 1 + addi x28, x27, 1 + addi x29, x28, 1 + addi x30, x29, 1 + addi x31, x30, 1 +main_end: + j main diff --git a/apps/riscv-tests/debug/programs/init.c b/apps/riscv-tests/debug/programs/init.c new file mode 100644 index 0000000..e3efc8e --- /dev/null +++ b/apps/riscv-tests/debug/programs/init.c @@ -0,0 +1,47 @@ +#include "init.h" +#include "encoding.h" + +int main(void); + +trap_handler_t trap_handler[NHARTS] = {0}; + +void set_trap_handler(trap_handler_t handler) +{ + unsigned hartid = read_csr(mhartid); + trap_handler[hartid] = handler; +} + +void enable_timer_interrupts() +{ + set_csr(mie, MIP_MTIP); + set_csr(mstatus, MSTATUS_MIE); +} + +void handle_trap(unsigned int mcause, void *mepc, void *sp) +{ + unsigned hartid = read_csr(mhartid); + if (trap_handler[hartid]) { + trap_handler[hartid](hartid, mcause, mepc, sp); + return; + } + + while (1) + ; +} + +void _exit(int status) +{ + // Make sure gcc doesn't inline _exit, so we can actually set a breakpoint + // on it. + volatile int i = 42; + while (i) + ; + // _exit isn't supposed to return. + while (1) + ; +} + +void _init() +{ + _exit(main()); +} diff --git a/apps/riscv-tests/debug/programs/init.h b/apps/riscv-tests/debug/programs/init.h new file mode 100644 index 0000000..06d5384 --- /dev/null +++ b/apps/riscv-tests/debug/programs/init.h @@ -0,0 +1,12 @@ +#ifndef INIT_H +#define INIT_H + +#define MTIME (*(volatile long long *)(0x02000000 + 0xbff8)) +#define MTIMECMP ((volatile long long *)(0x02000000 + 0x4000)) + +typedef void* (*trap_handler_t)(unsigned hartid, unsigned mcause, void *mepc, + void *sp); +void set_trap_handler(trap_handler_t handler); +void enable_timer_interrupts(); + +#endif diff --git a/apps/riscv-tests/debug/programs/interrupt.c b/apps/riscv-tests/debug/programs/interrupt.c new file mode 100644 index 0000000..8378576 --- /dev/null +++ b/apps/riscv-tests/debug/programs/interrupt.c @@ -0,0 +1,32 @@ +#include "init.h" +#include "encoding.h" + +static volatile unsigned interrupt_count; +static volatile unsigned local; + +static unsigned delta = 0x100; +void *increment_count(unsigned hartid, unsigned mcause, void *mepc, void *sp) +{ + interrupt_count++; + // There is no guarantee that the interrupt is cleared immediately when + // MTIMECMP is written, so stick around here until that happens. + while (read_csr(mip) & MIP_MTIP) { + MTIMECMP[hartid] = MTIME + delta; + } + return mepc; +} + +int main() +{ + interrupt_count = 0; + local = 0; + unsigned hartid = read_csr(mhartid); + + set_trap_handler(increment_count); + MTIMECMP[hartid] = MTIME - 1; + enable_timer_interrupts(); + + while (1) { + local++; + } +} diff --git a/apps/riscv-tests/debug/programs/mprv.S b/apps/riscv-tests/debug/programs/mprv.S new file mode 100644 index 0000000..8ec261e --- /dev/null +++ b/apps/riscv-tests/debug/programs/mprv.S @@ -0,0 +1,46 @@ +#include "encoding.h" +#define PGSHIFT 12 + + .global main + + .section .text +main: + # Set up a page table entry that maps 0x0... to 0x8... + la t0, page_table + srli t0, t0, PGSHIFT + csrw CSR_SATP, t0 + + # update mstatus + csrr t1, CSR_MSTATUS +#if XLEN == 32 + li t0, (MSTATUS_MPRV | (SATP_MODE_SV32 << 24)) +#else + li t0, (MSTATUS_MPRV | (SATP_MODE_SV39 << 24)) +#endif + #li t0, ((VM_SV39 << 24)) + or t1, t0, t1 + csrw CSR_MSTATUS, t1 + + la t0, (loop - 0x80000000) + csrw CSR_MEPC, t0 + + # Exit supervisor mode, entering user mode at loop. + mret + +loop: + la t0, data + lw t1, 0(t0) + j loop + + .section .data +data: + .word 0xbead + + .balign 0x1000 +page_table: +#if XLEN == 32 + .word ((0x80000000 >> 2) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_G | PTE_U) +#else + .word ((0x80000000 >> 2) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_G | PTE_U) + .word 0 +#endif diff --git a/apps/riscv-tests/debug/programs/multicore.c b/apps/riscv-tests/debug/programs/multicore.c new file mode 100644 index 0000000..a51ee4a --- /dev/null +++ b/apps/riscv-tests/debug/programs/multicore.c @@ -0,0 +1,89 @@ +#include + +#include "init.h" +#include "encoding.h" + +typedef struct { + int counter; +} atomic_t; + +static inline int atomic_xchg(atomic_t *v, int n) +{ + register int c; + + __asm__ __volatile__ ( + "amoswap.w.aqrl %0, %2, %1" + : "=r" (c), "+A" (v->counter) + : "r" (n)); + return c; +} + +static inline void mb(void) +{ + __asm__ __volatile__ ("fence"); +} + +void get_lock(atomic_t *lock) +{ + while (atomic_xchg(lock, 1) == 1) + ; + mb(); +} + +void put_lock(atomic_t *lock) +{ + mb(); + atomic_xchg(lock, 0); +} + +static atomic_t buf_lock = { .counter = 0 }; +static char buf[32]; +static int buf_initialized; +static unsigned hart_count[NHARTS]; +static unsigned interrupt_count[NHARTS]; + +static unsigned delta = 0x100; +void *increment_count(unsigned hartid, unsigned mcause, void *mepc, void *sp) +{ + interrupt_count[hartid]++; + MTIMECMP[hartid] = MTIME + delta; + return mepc; +} + +int main() +{ + uint32_t hartid = read_csr(mhartid); + hart_count[hartid] = 0; + interrupt_count[hartid] = 0; + + set_trap_handler(increment_count); + // Despite being memory-mapped, there appears to be one mtimecmp + // register per hart. The spec does not address this. + MTIMECMP[hartid] = MTIME + delta; + enable_timer_interrupts(); + + while (1) { + get_lock(&buf_lock); + + if (!buf_initialized) { + for (unsigned i = 0; i < sizeof(buf); i++) { + buf[i] = 'A' + (i % 26); + } + buf_initialized = 1; + } + + char first = buf[0]; + int offset = (first & ~0x20) - 'A'; + for (unsigned i = 0; i < sizeof(buf); i++) { + while (buf[i] != (first - offset + ((offset + i) % 26))) + ; + + if (hartid & 1) + buf[i] = 'A' + ((i + hartid + hart_count[hartid]) % 26); + else + buf[i] = 'a' + ((i + hartid + hart_count[hartid]) % 26); + } + put_lock(&buf_lock); + hart_count[hartid]++; + } +} diff --git a/apps/riscv-tests/debug/programs/priv.S b/apps/riscv-tests/debug/programs/priv.S new file mode 100644 index 0000000..75481be --- /dev/null +++ b/apps/riscv-tests/debug/programs/priv.S @@ -0,0 +1,11 @@ +#include "encoding.h" + + .global main + + .section .text +main: + # MISA is only readable from machine mode + csrr t0, CSR_MISA + csrr t0, CSR_MISA + csrr t0, CSR_MISA + csrr t0, CSR_MISA diff --git a/apps/riscv-tests/debug/programs/regs.S b/apps/riscv-tests/debug/programs/regs.S new file mode 100644 index 0000000..cfa1179 --- /dev/null +++ b/apps/riscv-tests/debug/programs/regs.S @@ -0,0 +1,60 @@ +#if XLEN == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + +#include "encoding.h" + + .global main +main: + nop + j main + +write_regs: + SREG x2, 0(x1) + SREG x3, 8(x1) + SREG x4, 16(x1) + SREG x5, 24(x1) + SREG x6, 32(x1) + SREG x7, 40(x1) + SREG x8, 48(x1) + SREG x9, 56(x1) + SREG x10, 64(x1) + SREG x11, 72(x1) + SREG x12, 80(x1) + SREG x13, 88(x1) + SREG x14, 96(x1) + SREG x15, 104(x1) +#ifndef RV32E + SREG x16, 112(x1) + SREG x17, 120(x1) + SREG x18, 128(x1) + SREG x19, 136(x1) + SREG x20, 144(x1) + SREG x21, 152(x1) + SREG x22, 160(x1) + SREG x23, 168(x1) + SREG x24, 176(x1) + SREG x25, 184(x1) + SREG x26, 192(x1) + SREG x27, 200(x1) + SREG x28, 208(x1) + SREG x29, 216(x1) + SREG x30, 224(x1) + SREG x31, 232(x1) +#endif + + csrr x1, CSR_MSCRATCH + +all_done: + j all_done + + .section .bss + .balign 16 +data: + .fill 64, 8, 0 diff --git a/apps/riscv-tests/debug/programs/run_halt_timing.S b/apps/riscv-tests/debug/programs/run_halt_timing.S new file mode 100644 index 0000000..ce4000a --- /dev/null +++ b/apps/riscv-tests/debug/programs/run_halt_timing.S @@ -0,0 +1,18 @@ +#if XLEN == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + + .global main +main: + li s0, 0 + li s1, 0x0200bff8 +loop: + addi s0, s0, 1 + LREG s2, 0(s1) + j loop diff --git a/apps/riscv-tests/debug/programs/semihosting.c b/apps/riscv-tests/debug/programs/semihosting.c new file mode 100644 index 0000000..2ceea8c --- /dev/null +++ b/apps/riscv-tests/debug/programs/semihosting.c @@ -0,0 +1,73 @@ +#include + +#include "semihosting.h" + +size_t strlen(const char *buf) +{ + int len = 0; + while (buf[len]) + len++; + return len; +} + +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 +#define O_RDWR 2 +#define O_TRUNC 0x0800 + +int errno; + +/* These semihosting functions came from the Freedom Metal source. */ +static int open(const char *name, int flags, int mode) { + int semiflags = 0; + + switch (flags & (O_RDONLY | O_WRONLY | O_RDWR)) { + case O_RDONLY: + semiflags = 0; /* 'r' */ + break; + case O_WRONLY: + if (flags & O_TRUNC) + semiflags = 4; /* 'w' */ + else + semiflags = 8; /* 'a' */ + break; + default: + if (flags & O_TRUNC) + semiflags = 6; /* 'w+' */ + else + semiflags = 10; /* 'a+' */ + break; + } + + volatile semihostparam_t arg = {.param1 = (uintptr_t)name, + .param2 = (uintptr_t)semiflags, + .param3 = (uintptr_t)strlen(name)}; + + int ret = (int)semihost_call_host(SEMIHOST_SYS_OPEN, (uintptr_t)&arg); + if (ret == -1) + errno = semihost_call_host(SEMIHOST_SYS_ERRNO, 0); + return ret; +} + +static ssize_t write(int file, const void *ptr, size_t len) +{ + volatile semihostparam_t arg = {.param1 = (uintptr_t)file, + .param2 = (uintptr_t)ptr, + .param3 = (uintptr_t)len}; + ssize_t ret = + (ssize_t)semihost_call_host(SEMIHOST_SYS_WRITE, (uintptr_t)&arg); + + return (len - ret); +} + +int main() +{ + char *filename = NULL; + const char *message = "Hello, world!\n"; + int fd; + +begin: + fd = open(filename, O_WRONLY, 0644); + write(fd, message, strlen(message)); +} \ No newline at end of file diff --git a/apps/riscv-tests/debug/programs/semihosting.h b/apps/riscv-tests/debug/programs/semihosting.h new file mode 100644 index 0000000..201e414 --- /dev/null +++ b/apps/riscv-tests/debug/programs/semihosting.h @@ -0,0 +1,82 @@ +#include + +#ifndef _SEMIHOSTING_H_ +#define _SEMIHOSTING_H_ + +// ---------------------------------------------------------------------------- + +// Semihosting operations. +enum Semihost_Sys_Op { + // Regular operations + SEMIHOST_SYS_CLOCK = 0x10, + SEMIHOST_SYS_CLOSE = 0x02, + SEMIHOST_SYS_ELAPSED = 0x30, + SEMIHOST_SYS_ERRNO = 0x13, + SEMIHOST_SYS_EXIT = 0x18, + SEMIHOST_SYS_EXIT_EXTENDED = 0x20, + SEMIHOST_SYS_FLEN = 0x0C, + SEMIHOST_SYS_GET_CMDLINE = 0x15, + SEMIHOST_SYS_HEAPINFO = 0x16, + SEMIHOST_SYS_ISERROR = 0x08, + SEMIHOST_SYS_ISTTY = 0x09, + SEMIHOST_SYS_OPEN = 0x01, + SEMIHOST_SYS_READ = 0x06, + SEMIHOST_SYS_READC = 0x07, + SEMIHOST_SYS_REMOVE = 0x0E, + SEMIHOST_SYS_RENAME = 0x0F, + SEMIHOST_SYS_SEEK = 0x0A, + SEMIHOST_SYS_SYSTEM = 0x12, + SEMIHOST_SYS_TICKFREQ = 0x31, + SEMIHOST_SYS_TIME = 0x11, + SEMIHOST_SYS_TMPNAM = 0x0D, + SEMIHOST_SYS_WRITE = 0x05, + SEMIHOST_SYS_WRITEC = 0x03, + SEMIHOST_SYS_WRITE0 = 0x04, +}; + +enum ADP_Code { + ADP_Stopped_BranchThroughZero = 0x20000, + ADP_Stopped_UndefinedInstr = 0x20001, + ADP_Stopped_SoftwareInterrupt = 0x20002, + ADP_Stopped_PrefetchAbort = 0x20003, + ADP_Stopped_DataAbort = 0x20004, + ADP_Stopped_AddressException = 0x20005, + ADP_Stopped_IRQ = 0x20006, + ADP_Stopped_FIQ = 0x20007, + ADP_Stopped_BreakPoint = 0x20020, + ADP_Stopped_WatchPoint = 0x20021, + ADP_Stopped_StepComplete = 0x20022, + ADP_Stopped_RunTimeErrorUnknown = 0x20023, + ADP_Stopped_InternalError = 0x20024, + ADP_Stopped_UserInterruption = 0x20025, + ADP_Stopped_ApplicationExit = 0x20026, + ADP_Stopped_StackOverflow = 0x20027, + ADP_Stopped_DivisionByZero = 0x20028, + ADP_Stopped_OSSpecific = 0x20029, +}; + +typedef struct { + uintptr_t param1; + uintptr_t param2; + uintptr_t param3; +} semihostparam_t; + +static inline uintptr_t __attribute__((always_inline)) +semihost_call_host(uintptr_t op, uintptr_t arg) { + register uintptr_t r0 asm("a0") = op; + register uintptr_t r1 asm("a1") = arg; + + asm volatile(".option push \n" + ".option norvc \n" + " slli zero,zero,0x1f \n" + " ebreak \n" + " srai zero,zero,0x7 \n" + ".option pop \n" + + : "=r"(r0) /* Outputs */ + : "r"(r0), "r"(r1) /* Inputs */ + : "memory"); + return r0; +} + +#endif \ No newline at end of file diff --git a/apps/riscv-tests/debug/programs/step.S b/apps/riscv-tests/debug/programs/step.S new file mode 100644 index 0000000..3e7b42e --- /dev/null +++ b/apps/riscv-tests/debug/programs/step.S @@ -0,0 +1,28 @@ +// Test stepping over a variety of instructions. + + .global main + +main: + la t0, trap_entry // 0, 4 + csrw mtvec, t0 // 0x8 + + li t0, 5 // 0xc + beq zero, zero, one // 0x10 + nop // 0x14 +one: + beq zero, t0, one // 0x18 + // Use t0 instead of ra to force a 32-bit opcode in C mode. Otherwise + // 32-bit and 64-bit binaries end up with different instructions (I + // didn't pursue this). + jal t0, two // 0x1c + +three: + .word 0 // 0x20 + nop // 0x24 + +two: + jr t0 // 0x28 + + .align 2 +trap_entry: + j trap_entry // 0x2c diff --git a/apps/riscv-tests/debug/programs/tiny-malloc.c b/apps/riscv-tests/debug/programs/tiny-malloc.c new file mode 100644 index 0000000..699660c --- /dev/null +++ b/apps/riscv-tests/debug/programs/tiny-malloc.c @@ -0,0 +1,600 @@ +// https://github.com/32bitmicro/newlib-nano-1.0/blob/master/newlib/libc/machine/xstormy16/tiny-malloc.c + +/* A replacement malloc with: + - Much reduced code size; + - Smaller RAM footprint; + - The ability to handle downward-growing heaps; + but + - Slower; + - Probably higher memory fragmentation; + - Doesn't support threads (but, if it did support threads, + it wouldn't need a global lock, only a compare-and-swap instruction); + - Assumes the maximum alignment required is the alignment of a pointer; + - Assumes that memory is already there and doesn't need to be allocated. + +* Synopsis of public routines + + malloc(size_t n); + Return a pointer to a newly allocated chunk of at least n bytes, or null + if no space is available. + free(void* p); + Release the chunk of memory pointed to by p, or no effect if p is null. + realloc(void* p, size_t n); + Return a pointer to a chunk of size n that contains the same data + as does chunk p up to the minimum of (n, p's size) bytes, or null + if no space is available. The returned pointer may or may not be + the same as p. If p is null, equivalent to malloc. Unless the + #define REALLOC_ZERO_BYTES_FREES below is set, realloc with a + size argument of zero (re)allocates a minimum-sized chunk. + memalign(size_t alignment, size_t n); + Return a pointer to a newly allocated chunk of n bytes, aligned + in accord with the alignment argument, which must be a power of + two. Will fail if 'alignment' is too large. + calloc(size_t unit, size_t quantity); + Returns a pointer to quantity * unit bytes, with all locations + set to zero. + cfree(void* p); + Equivalent to free(p). + malloc_trim(size_t pad); + Release all but pad bytes of freed top-most memory back + to the system. Return 1 if successful, else 0. + malloc_usable_size(void* p); + Report the number usable allocated bytes associated with allocated + chunk p. This may or may not report more bytes than were requested, + due to alignment and minimum size constraints. + malloc_stats(); + Prints brief summary statistics on stderr. + mallinfo() + Returns (by copy) a struct containing various summary statistics. + mallopt(int parameter_number, int parameter_value) + Changes one of the tunable parameters described below. Returns + 1 if successful in changing the parameter, else 0. Actually, returns 0 + always, as no parameter can be changed. +*/ + +#ifdef __xstormy16__ +#define MALLOC_DIRECTION -1 +#endif + +#ifndef MALLOC_DIRECTION +#define MALLOC_DIRECTION 1 +#endif + +#include + +void* malloc(size_t); +void free(void*); +void* realloc(void*, size_t); +void* memalign(size_t, size_t); +void* valloc(size_t); +void* pvalloc(size_t); +void* calloc(size_t, size_t); +void cfree(void*); +int malloc_trim(size_t); +size_t malloc_usable_size(void*); +void malloc_stats(void); +int mallopt(int, int); +struct mallinfo mallinfo(void); + +typedef struct freelist_entry { + size_t size; + struct freelist_entry *next; +} *fle; + +extern void * __malloc_end; +extern fle __malloc_freelist; + +/* Return the number of bytes that need to be added to X to make it + aligned to an ALIGN boundary. ALIGN must be a power of 2. */ +#define M_ALIGN(x, align) (-(size_t)(x) & ((align) - 1)) + +/* Return the number of bytes that need to be subtracted from X to make it + aligned to an ALIGN boundary. ALIGN must be a power of 2. */ +#define M_ALIGN_SUB(x, align) ((size_t)(x) & ((align) - 1)) + +extern char *__malloc_start; + +/* This is the minimum gap allowed between __malloc_end and the top of + the stack. This is only checked for when __malloc_end is + decreased; if instead the stack grows into the heap, silent data + corruption will result. */ +#define MALLOC_MINIMUM_GAP 32 + +#ifdef __xstormy16__ +register void * stack_pointer asm ("r15"); +#define MALLOC_LIMIT stack_pointer +#else +#define MALLOC_LIMIT __builtin_frame_address (0) +#endif + +#if MALLOC_DIRECTION < 0 +#define CAN_ALLOC_P(required) \ + (((size_t) __malloc_end - (size_t)MALLOC_LIMIT \ + - MALLOC_MINIMUM_GAP) >= (required)) +#else +#define CAN_ALLOC_P(required) \ + (((size_t)MALLOC_LIMIT - (size_t) __malloc_end \ + - MALLOC_MINIMUM_GAP) >= (required)) +#endif + +/* real_size is the size we actually have to allocate, allowing for + overhead and alignment. */ +#define REAL_SIZE(sz) \ + ((sz) < sizeof (struct freelist_entry) - sizeof (size_t) \ + ? sizeof (struct freelist_entry) \ + : sz + sizeof (size_t) + M_ALIGN(sz, sizeof (size_t))) + +#ifdef DEFINE_MALLOC + +void * __malloc_end = &__malloc_start; +fle __malloc_freelist; + +void * +malloc (size_t sz) +{ + fle *nextfree; + fle block; + + /* real_size is the size we actually have to allocate, allowing for + overhead and alignment. */ + size_t real_size = REAL_SIZE (sz); + + /* Look for the first block on the freelist that is large enough. */ + for (nextfree = &__malloc_freelist; + *nextfree; + nextfree = &(*nextfree)->next) + { + block = *nextfree; + + if (block->size >= real_size) + { + /* If the block found is just the right size, remove it from + the free list. Otherwise, split it. */ + if (block->size < real_size + sizeof (struct freelist_entry)) + { + *nextfree = block->next; + return (void *)&block->next; + } + else + { + size_t newsize = block->size - real_size; + fle newnext = block->next; + *nextfree = (fle)((size_t)block + real_size); + (*nextfree)->size = newsize; + (*nextfree)->next = newnext; + goto done; + } + } + + /* If this is the last block on the freelist, and it was too small, + enlarge it. */ + if (! block->next + && __malloc_end == (void *)((size_t)block + block->size)) + { + size_t moresize = real_size - block->size; + if (! CAN_ALLOC_P (moresize)) + return NULL; + + *nextfree = NULL; + if (MALLOC_DIRECTION < 0) + { + block = __malloc_end = (void *)((size_t)block - moresize); + } + else + { + __malloc_end = (void *)((size_t)block + real_size); + } + + goto done; + } + } + + /* No free space at the end of the free list. Allocate new space + and use that. */ + + if (! CAN_ALLOC_P (real_size)) + return NULL; + + if (MALLOC_DIRECTION > 0) + { + block = __malloc_end; + __malloc_end = (void *)((size_t)__malloc_end + real_size); + } + else + { + block = __malloc_end = (void *)((size_t)__malloc_end - real_size); + } + done: + block->size = real_size; + return (void *)&block->next; +} + +#endif + +#ifdef DEFINE_FREE + +void +free (void *block_p) +{ + fle *nextfree; + fle block = (fle)((size_t) block_p - offsetof (struct freelist_entry, next)); + + if (block_p == NULL) + return; + + /* Look on the freelist to see if there's a free block just before + or just after this block. */ + for (nextfree = &__malloc_freelist; + *nextfree; + nextfree = &(*nextfree)->next) + { + fle thisblock = *nextfree; + if ((size_t)thisblock + thisblock->size == (size_t) block) + { + thisblock->size += block->size; + if (MALLOC_DIRECTION > 0 + && thisblock->next + && (size_t) block + block->size == (size_t) thisblock->next) + { + thisblock->size += thisblock->next->size; + thisblock->next = thisblock->next->next; + } + return; + } + else if ((size_t) thisblock == (size_t) block + block->size) + { + if (MALLOC_DIRECTION < 0 + && thisblock->next + && (size_t) block == ((size_t) thisblock->next + + thisblock->next->size)) + { + *nextfree = thisblock->next; + thisblock->next->size += block->size + thisblock->size; + } + else + { + block->size += thisblock->size; + block->next = thisblock->next; + *nextfree = block; + } + return; + } + else if ((MALLOC_DIRECTION > 0 + && (size_t) thisblock > (size_t) block) + || (MALLOC_DIRECTION < 0 + && (size_t) thisblock < (size_t) block)) + break; + } + + block->next = *nextfree; + *nextfree = block; + return; +} +#endif + +#ifdef DEFINE_REALLOC +void * +realloc (void *block_p, size_t sz) +{ + fle block = (fle)((size_t) block_p - offsetof (struct freelist_entry, next)); + size_t real_size = REAL_SIZE (sz); + size_t old_real_size; + + if (block_p == NULL) + return malloc (sz); + + old_real_size = block->size; + + /* Perhaps we need to allocate more space. */ + if (old_real_size < real_size) + { + void *result; + size_t old_size = old_real_size - sizeof (size_t); + + /* Need to allocate, copy, and free. */ + result = malloc (sz); + if (result == NULL) + return NULL; + memcpy (result, block_p, old_size < sz ? old_size : sz); + free (block_p); + return result; + } + /* Perhaps we can free some space. */ + if (old_real_size - real_size >= sizeof (struct freelist_entry)) + { + fle newblock = (fle)((size_t)block + real_size); + block->size = real_size; + newblock->size = old_real_size - real_size; + free (&newblock->next); + } + return block_p; +} +#endif + +#ifdef DEFINE_CALLOC +void * +calloc (size_t n, size_t elem_size) +{ + void *result; + size_t sz = n * elem_size; + result = malloc (sz); + if (result != NULL) + memset (result, 0, sz); + return result; +} +#endif + +#ifdef DEFINE_CFREE +void +cfree (void *p) +{ + free (p); +} +#endif + +#ifdef DEFINE_MEMALIGN +void * +memalign (size_t align, size_t sz) +{ + fle *nextfree; + fle block; + + /* real_size is the size we actually have to allocate, allowing for + overhead and alignment. */ + size_t real_size = REAL_SIZE (sz); + + /* Some sanity checking on 'align'. */ + if ((align & (align - 1)) != 0 + || align <= 0) + return NULL; + + /* Look for the first block on the freelist that is large enough. */ + /* One tricky part is this: We want the result to be a valid pointer + to free. That means that there has to be room for a size_t + before the block. If there's additional space before the block, + it should go on the freelist, or it'll be lost---we could add it + to the size of the block before it in memory, but finding the + previous block is expensive. */ + for (nextfree = &__malloc_freelist; + ; + nextfree = &(*nextfree)->next) + { + size_t before_size; + size_t old_size; + + /* If we've run out of free blocks, allocate more space. */ + if (! *nextfree) + { + old_size = real_size; + if (MALLOC_DIRECTION < 0) + { + old_size += M_ALIGN_SUB (((size_t)__malloc_end + - old_size + sizeof (size_t)), + align); + if (! CAN_ALLOC_P (old_size)) + return NULL; + block = __malloc_end = (void *)((size_t)__malloc_end - old_size); + } + else + { + block = __malloc_end; + old_size += M_ALIGN ((size_t)__malloc_end + sizeof (size_t), + align); + if (! CAN_ALLOC_P (old_size)) + return NULL; + __malloc_end = (void *)((size_t)__malloc_end + old_size); + } + *nextfree = block; + block->size = old_size; + block->next = NULL; + } + else + { + block = *nextfree; + old_size = block->size; + } + + + before_size = M_ALIGN (&block->next, align); + if (before_size != 0) + before_size = sizeof (*block) + M_ALIGN (&(block+1)->next, align); + + /* If this is the last block on the freelist, and it is too small, + enlarge it. */ + if (! block->next + && old_size < real_size + before_size + && __malloc_end == (void *)((size_t)block + block->size)) + { + if (MALLOC_DIRECTION < 0) + { + size_t moresize = real_size - block->size; + moresize += M_ALIGN_SUB ((size_t)&block->next - moresize, align); + if (! CAN_ALLOC_P (moresize)) + return NULL; + block = __malloc_end = (void *)((size_t)block - moresize); + block->next = NULL; + block->size = old_size = old_size + moresize; + before_size = 0; + } + else + { + if (! CAN_ALLOC_P (before_size + real_size - block->size)) + return NULL; + __malloc_end = (void *)((size_t)block + before_size + real_size); + block->size = old_size = before_size + real_size; + } + + /* Two out of the four cases below will now be possible; which + two depends on MALLOC_DIRECTION. */ + } + + if (old_size >= real_size + before_size) + { + /* This block will do. If there needs to be space before it, + split the block. */ + if (before_size != 0) + { + fle old_block = block; + + old_block->size = before_size; + block = (fle)((size_t)block + before_size); + + /* If there's no space after the block, we're now nearly + done; just make a note of the size required. + Otherwise, we need to create a new free space block. */ + if (old_size - before_size + <= real_size + sizeof (struct freelist_entry)) + { + block->size = old_size - before_size; + return (void *)&block->next; + } + else + { + fle new_block; + new_block = (fle)((size_t)block + real_size); + new_block->size = old_size - before_size - real_size; + if (MALLOC_DIRECTION > 0) + { + new_block->next = old_block->next; + old_block->next = new_block; + } + else + { + new_block->next = old_block; + *nextfree = new_block; + } + goto done; + } + } + else + { + /* If the block found is just the right size, remove it from + the free list. Otherwise, split it. */ + if (old_size <= real_size + sizeof (struct freelist_entry)) + { + *nextfree = block->next; + return (void *)&block->next; + } + else + { + size_t newsize = old_size - real_size; + fle newnext = block->next; + *nextfree = (fle)((size_t)block + real_size); + (*nextfree)->size = newsize; + (*nextfree)->next = newnext; + goto done; + } + } + } + } + + done: + block->size = real_size; + return (void *)&block->next; +} +#endif + +#ifdef DEFINE_VALLOC +void * +valloc (size_t sz) +{ + return memalign (128, sz); +} +#endif +#ifdef DEFINE_PVALLOC +void * +pvalloc (size_t sz) +{ + return memalign (128, sz + M_ALIGN (sz, 128)); +} +#endif + +#ifdef DEFINE_MALLINFO +#include "malloc.h" + +struct mallinfo +mallinfo (void) +{ + struct mallinfo r; + fle fr; + size_t free_size; + size_t total_size; + size_t free_blocks; + + memset (&r, 0, sizeof (r)); + + free_size = 0; + free_blocks = 0; + for (fr = __malloc_freelist; fr; fr = fr->next) + { + free_size += fr->size; + free_blocks++; + if (! fr->next) + { + int atend; + if (MALLOC_DIRECTION > 0) + atend = (void *)((size_t)fr + fr->size) == __malloc_end; + else + atend = (void *)fr == __malloc_end; + if (atend) + r.keepcost = fr->size; + } + } + + if (MALLOC_DIRECTION > 0) + total_size = (char *)__malloc_end - (char *)&__malloc_start; + else + total_size = (char *)&__malloc_start - (char *)__malloc_end; + +#ifdef DEBUG + /* Fixme: should walk through all the in-use blocks and see if + they're valid. */ +#endif + + r.arena = total_size; + r.fordblks = free_size; + r.uordblks = total_size - free_size; + r.ordblks = free_blocks; + return r; +} +#endif + +#ifdef DEFINE_MALLOC_STATS +#include "malloc.h" +#include + +void +malloc_stats(void) +{ + struct mallinfo i; + FILE *fp; + + fp = stderr; + i = mallinfo(); + fprintf (fp, "malloc has reserved %u bytes between %p and %p\n", + i.arena, &__malloc_start, __malloc_end); + fprintf (fp, "there are %u bytes free in %u chunks\n", + i.fordblks, i.ordblks); + fprintf (fp, "of which %u bytes are at the end of the reserved space\n", + i.keepcost); + fprintf (fp, "and %u bytes are in use.\n", i.uordblks); +} +#endif + +#ifdef DEFINE_MALLOC_USABLE_SIZE +size_t +malloc_usable_size (void *block_p) +{ + fle block = (fle)((size_t) block_p - offsetof (struct freelist_entry, next)); + return block->size - sizeof (size_t); +} +#endif + +#ifdef DEFINE_MALLOPT +int +mallopt (int n, int v) +{ + (void)n; (void)v; + return 0; +} +#endif diff --git a/apps/riscv-tests/debug/programs/translate.c b/apps/riscv-tests/debug/programs/translate.c new file mode 100644 index 0000000..c0424bf --- /dev/null +++ b/apps/riscv-tests/debug/programs/translate.c @@ -0,0 +1,188 @@ +#include + +#include "encoding.h" + +#define get_field(reg, mask) (((reg) & (mask)) / ((mask) & ~((mask) << 1))) +#define set_field(reg, mask, val) (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask))) + +#if __riscv_xlen == 64 +# define SATP_PPN SATP64_PPN +typedef uint64_t reg_t; +#else +# define SATP_PPN SATP32_PPN +typedef uint32_t reg_t; +#endif + +static char page_buffer[4096 * 8]; +static char *page_buffer_next = page_buffer; + +typedef struct { + unsigned mode; + unsigned levels; + unsigned ppn_width_bits[5]; + unsigned ppn_offset_bits[5]; + unsigned entry_width_bytes; + unsigned vpn_width_bits; + unsigned vaddr_bits; +} virtual_memory_system_t; + +static virtual_memory_system_t sv32 = { + .mode = SATP_MODE_SV32, + .levels = 2, + .ppn_width_bits = {12, 10, 10}, + .ppn_offset_bits = {0, 12, 22}, + .entry_width_bytes = 4, + .vpn_width_bits = 10, + .vaddr_bits = 32 +}; + +static virtual_memory_system_t sv39 = { + .mode = SATP_MODE_SV39, + .levels = 3, + .ppn_width_bits = {12, 9, 9, 26}, + .ppn_offset_bits = {0, 12, 21, 30}, + .entry_width_bytes = 8, + .vpn_width_bits = 9, + .vaddr_bits = 39 +}; + +static virtual_memory_system_t sv48 = { + .mode = SATP_MODE_SV48, + .levels = 4, + .ppn_width_bits = {12, 9, 9, 9, 26}, + .ppn_offset_bits = {0, 12, 21, 30, 39}, + .entry_width_bytes = 8, + .vpn_width_bits = 9, + .vaddr_bits = 48 +}; + +static virtual_memory_system_t *vms; + +void error() +{ + while (1) + ; +} + +void assert(int condition) +{ + if (!condition) + error(); +} + +// Return a 4Kb, aligned, page. +void *get_page() +{ + page_buffer_next = (char *) (((unsigned long) page_buffer_next + 4095) & ~0xfff); + while (page_buffer_next + 4096 >= page_buffer + sizeof(page_buffer)) + ; + void *result = page_buffer_next; + page_buffer_next += 4096; + return result; +} + +reg_t entry(char *table, unsigned index) +{ + if (vms->entry_width_bytes == 4) + return ((uint32_t *) table)[index]; + else if (vms->entry_width_bytes == 8) + return ((uint64_t *) table)[index]; + else + assert(0); +} + +void entry_set(char *table, unsigned index, uint64_t value) +{ + if (vms->entry_width_bytes == 4) + ((uint32_t *) table)[index] = value; + else if (vms->entry_width_bytes == 8) + ((uint64_t *) table)[index] = value; + else + assert(0); +} + +// Set up 1-to-1 for this entire table. +void setup_page_table(char *table, unsigned level, uint64_t physical) +{ + for (unsigned i = 0; i < (1<vpn_width_bits); i++) { + uint64_t pte = PTE_V | PTE_R | PTE_W | PTE_X | PTE_U | PTE_A | PTE_D; + // Add in portion of physical address. + pte |= physical & (((1LL<vpn_width_bits)-1) << + (PTE_PPN_SHIFT + (level+1) * vms->vpn_width_bits)); + // Add in the index. + pte |= ((reg_t) i) << (PTE_PPN_SHIFT + level * vms->vpn_width_bits); + entry_set(table, i, pte); + } +} + +// Return contents of vpn field for the given virtual address and level. +unsigned vpn(uint64_t virtual, unsigned level) +{ + virtual >>= 12 + vms->vpn_width_bits * level; + return virtual & ((1<vpn_width_bits)-1); +} + +// Add an entry to the given table, at the given level (0 for 4Kb page). +void add_entry(char *table, unsigned level, uint64_t virtual, uint64_t physical) +{ + unsigned current_level = vms->levels - 1; + while (1) { + unsigned index = vpn(virtual, current_level); + if (current_level <= level) { + // Add the new entry. + entry_set(table, index, PTE_V | PTE_R | PTE_W | PTE_X | PTE_U | PTE_A | PTE_D | + ((physical >> 2) & ~((1 << + (PTE_PPN_SHIFT + current_level * vms->vpn_width_bits)) - 1))); + return; + } + reg_t pte = entry(table, index); + if (!(pte & PTE_V) || + ((pte & PTE_R) && (pte & PTE_W))) { + // Create a new page + void *new_page = get_page(); + setup_page_table(new_page, current_level - 1, virtual); + entry_set(table, index, PTE_V | PTE_U | PTE_A | PTE_D | + ((((reg_t) new_page) >> 2) & ~((1 << 10) - 1))); + table = new_page; + } else { + table = (char *) (pte & ~0xfff); + } + current_level--; + } +} + +int main() +{ + void *master_table = get_page(); + setup_page_table(master_table, vms->levels-1, 0); + uint32_t *physical = get_page(); + //uint32_t *virtual = (uint32_t *) (((reg_t) physical) ^ ((reg_t) 0x40000000)); + uint32_t *virtual = (uint32_t *) (((reg_t) physical) ^ (((reg_t) 0xf) << (vms->vaddr_bits - 4))); + // Virtual addresses must be sign-extended. + if (vms->vaddr_bits < sizeof(virtual) * 8 && (reg_t) virtual & ((reg_t) 1<<(vms->vaddr_bits-1))) + virtual = (uint32_t *) ( + (reg_t) virtual | ~(((reg_t) 1 << vms->vaddr_bits) - 1)); + add_entry(master_table, 0, (reg_t) virtual, (reg_t) physical); + + unsigned long satp = set_field(0, SATP_MODE, vms->mode); + satp = set_field(satp, SATP_PPN, ((unsigned long) master_table) >> 12); + write_csr(satp, satp); + satp = read_csr(satp); + if (get_field(satp, SATP_MODE) != vms->mode) + error(); + + reg_t mstatus = read_csr(mstatus); + mstatus |= MSTATUS_MPRV; + write_csr(mstatus, mstatus); + + // Address translation is enabled. + physical[0] = 0xdeadbeef; + assert(virtual[0] == physical[0]); + virtual[1] = 0x55667788; + assert(virtual[1] == physical[1]); + +active: +end: + while (1) + ; +} diff --git a/apps/riscv-tests/debug/programs/trigger.S b/apps/riscv-tests/debug/programs/trigger.S new file mode 100644 index 0000000..2ccfd21 --- /dev/null +++ b/apps/riscv-tests/debug/programs/trigger.S @@ -0,0 +1,113 @@ +#include "encoding.h" + +#if XLEN == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + + .global main + + .section .text +main: + + la a0, data + li t0, 0 +just_before_read_loop: + li t2, 16 +read_loop: + lw t1, 0(a0) + addi t1, t1, 1 + addi t0, t0, 1 +read_again: + lw t1, 0(a0) + addi a0, a0, 4 + blt t0, t2, read_loop + + la a0, data +just_before_write_loop: + li t0, 1 +write_loop: + sw t0, 0(a0) + addi t0, t0, 1 + addi a0, a0, 4 + blt t0, t2, write_loop + + j main_exit + +write_store_trigger: + li a0, (1<<6) | (1<<1) + li a1, 0xdeadbee0 + jal write_triggers + la a0, data + jal read_triggers + +write_load_trigger: + li a0, (1<<6) | (1<<0) + li a1, 0xfeedac00 + jal write_triggers + la a0, data + jal read_triggers + +// Clear triggers so the next test can use them. +clear_triggers: + li a0, 0 + jal write_triggers + +main_exit: + li a0, 0 + j _exit + +write_triggers: + // a0: value to write to each tdata1 + // a1: value to write to each tdata2 + li t0, 0 +2: + csrw CSR_TSELECT, t0 + csrr t1, CSR_TSELECT + bne t0, t1, 1f + addi t0, t0, 1 + csrw CSR_TDATA2, a1 + csrw CSR_TDATA1, a0 + j 2b +1: ret + +read_triggers: + // a0: address where data should be written + li t0, 0 +2: + csrw CSR_TSELECT, t0 + csrr t1, CSR_TSELECT + bne t0, t1, 1f + addi t0, t0, 1 + csrr t1, CSR_TDATA1 + SREG t1, 0(a0) + csrr t1, CSR_TDATA2 + SREG t1, REGBYTES(a0) + addi a0, a0, 2*REGBYTES + j 2b +1: SREG zero, 0(a0) + ret + + .section .data + .align 3 +data: .word 0x40 + .word 0x41 + .word 0x42 + .word 0x43 + .word 0x44 + .word 0x45 + .word 0x46 + .word 0x47 + .word 0x48 + .word 0x49 + .word 0x4a + .word 0x4b + .word 0x4c + .word 0x4d + .word 0x4e + .word 0x4f diff --git a/apps/riscv-tests/debug/programs/vectors.S b/apps/riscv-tests/debug/programs/vectors.S new file mode 100644 index 0000000..53e53be --- /dev/null +++ b/apps/riscv-tests/debug/programs/vectors.S @@ -0,0 +1,159 @@ +#include "encoding.h" + +#if XLEN == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + +#define get_field(reg, mask) (((reg) & (mask)) / ((mask) & ~((mask) << 1))) +#define set_field(reg, mask, val) (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask))) + + .global main + .global main_end + .global main_post_csrr + + // Load constants into all registers so we can test no register are + // clobbered after attaching. +main: + SREG ra, 0(sp) + addi sp, sp, REGBYTES + + // Set VS=1 + csrr t0, CSR_MSTATUS + li t1, set_field(0, MSTATUS_VS, 1) + or t0, t0, t1 + csrw CSR_MSTATUS, t0 + + // copy a to b + la a0, a + jal vector_load_v4 + la a0, b + jal shift_store_v4 + + // assert a == b + la a0, a + la a1, b + jal check_equal +test0: + bne a0, zero, return_from_main + + // copy b to c + la a0, b + jal shift_load_v4 + la a0, c + jal vector_store_v4 + + // assert b == c + la a0, b + la a1, c + jal check_equal +test1: + bne a0, zero, return_from_main + +return_from_main: + addi sp, sp, -REGBYTES + LREG ra, 0(sp) + ret + +vector_load_v4: + // a0: point to memory to load from + csrr s0, vlenb + vsetvli zero, s0, e8, m1 # Vectors of 8b + vle8.v v4, 0(a0) # Load bytes + ret + +vector_store_v4: + // a0: point to memory to store to + csrr s0, vlenb + vsetvli zero, s0, e8, m1 # Vectors of 8b + vse8.v v4, 0(a0) # Load bytes + ret + +shift_load_v4: + // a0: pointer to memory to load from + + // Configure all elements in the chain + csrr s0, vlenb +#if XLEN == 32 + vsetvli zero, s0, e32 +#else + vsetvli zero, s0, e64 +#endif + + // Figure out how long the chain is. + csrr s0, vlenb + li s1, XLEN/8 + divu s0, s0, s1 + +1: + LREG s2, 0(a0) + vslide1down.vx v4, v4, s2 + addi a0, a0, REGBYTES + addi s0, s0, -1 + bne s0, zero, 1b + + ret + +shift_store_v4: + // a0: pointer to memory to store to + + // Configure all elements in the chain + csrr s0, vlenb +#if XLEN == 32 + vsetvli zero, s0, e32 +#else + vsetvli zero, s0, e64 +#endif + + // Figure out how long the chain is. + csrr s0, vlenb + li s1, XLEN/8 + divu s0, s0, s1 + +1: + vmv.x.s s2, v4 + SREG s2, 0(a0) + vslide1down.vx v4, v4, s2 + addi a0, a0, REGBYTES + addi s0, s0, -1 + bne s0, zero, 1b + + ret + +check_equal: + csrr s0, vlenb +1: + lb s1, 0(a0) + lb s2, 0(a1) + bne s1, s2, 2f + addi a0, a0, 1 + addi a1, a1, 1 + addi s0, s0, -1 + bne s0, zero, 1b + li a0, 0 // equal + ret +2: // unequal + li a0, 1 + ret + + .data + .align 6 +a: .word 0xaa00, 0xaa01, 0xaa02, 0xaa03, 0xaa04, 0xaa05, 0xaa06, 0xaa07 + .word 0xaa08, 0xaa09, 0xaa0a, 0xaa0b, 0xaa0c, 0xaa0d, 0xaa0e, 0xaa0f + .word 0xaa10, 0xaa11, 0xaa12, 0xaa13, 0xaa14, 0xaa15, 0xaa16, 0xaa17 + .word 0xaa18, 0xaa19, 0xaa1a, 0xaa1b, 0xaa1c, 0xaa1d, 0xaa1e, 0xaa1f + +b: .word 0xbb00, 0xbb01, 0xbb02, 0xbb03, 0xbb04, 0xbb05, 0xbb06, 0xbb07 + .word 0xbb08, 0xbb09, 0xbb0b, 0xbb0b, 0xbb0c, 0xbb0d, 0xbb0e, 0xbb0f + .word 0xbb10, 0xbb11, 0xbb13, 0xbb13, 0xbb14, 0xbb15, 0xbb16, 0xbb17 + .word 0xbb18, 0xbb19, 0xbb1b, 0xbb1b, 0xbb1c, 0xbb1d, 0xbb1e, 0xbb1f + +c: .word 0xcc00, 0xcc01, 0xcc02, 0xcc03, 0xcc04, 0xcc05, 0xcc06, 0xcc07 + .word 0xcc08, 0xcc09, 0xcc0c, 0xcc0c, 0xcc0c, 0xcc0d, 0xcc0e, 0xcc0f + .word 0xcc10, 0xcc11, 0xcc13, 0xcc13, 0xcc14, 0xcc15, 0xcc16, 0xcc17 + .word 0xcc18, 0xcc19, 0xcc1c, 0xcc1c, 0xcc1c, 0xcc1d, 0xcc1e, 0xcc1f \ No newline at end of file diff --git a/apps/riscv-tests/debug/pylint.rc b/apps/riscv-tests/debug/pylint.rc new file mode 100644 index 0000000..cf07149 --- /dev/null +++ b/apps/riscv-tests/debug/pylint.rc @@ -0,0 +1,341 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Profiled execution. +profile=no + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=.git + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist= + + +[MESSAGES CONTROL] + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. See also the "--disable" option for examples. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +disable=bad-continuation, missing-docstring, invalid-name, locally-disabled, + too-few-public-methods, too-many-arguments, fixme, duplicate-code, + no-else-return + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Add a comment according to your evaluation note. This is used by the global +# evaluation report (RP0004). +comment=no + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the name of dummy variables (i.e. expectedly +# not used). +dummy-variables-rgx=_$|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis +ignored-modules= + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes=SQLObject + +# When zope mode is activated, add a predefined set of Zope acquired attributes +# to generated-members. +zope=no + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members=REQUEST,acl_users,aq_parent + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=80 + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + +# List of optional constructs for which whitespace checking is disabled +no-space-check=trailing-comma,dict-separator + +# Maximum number of lines in a module +max-module-lines=10000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format +logging-modules=logging + + +[BASIC] + +# Required attributes for module, separated by a comma +#required-attributes= + +# List of builtins function names that should not be used, separated by a comma +bad-functions=map,filter,apply,input,file + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Include a hint for the correct naming format with invalid-name +include-naming-hint=no + +# Regular expression matching correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for function names +function-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for variable names +variable-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct constant names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Naming hint for constant names +const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression matching correct attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for attribute names +attr-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for argument names +argument-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct class attribute names +class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Naming hint for class attribute names +class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Regular expression matching correct inline iteration names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Naming hint for inline iteration names +inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ + +# Regular expression matching correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Naming hint for class names +class-name-hint=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression matching correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Naming hint for module names +module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression matching correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for method names +method-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=__.*__ + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,TERMIOS,Bastion,rexec + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + + +[CLASSES] + +# List of interface methods to ignore, separated by a comma. This is used for +# instance to not check methods defines in Zope's Interface base class. +#ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branches=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/apps/riscv-tests/debug/requirements.txt b/apps/riscv-tests/debug/requirements.txt new file mode 100644 index 0000000..8fbeb99 --- /dev/null +++ b/apps/riscv-tests/debug/requirements.txt @@ -0,0 +1 @@ +pexpect>=4.0.0 diff --git a/apps/riscv-tests/debug/targets.py b/apps/riscv-tests/debug/targets.py new file mode 100644 index 0000000..8b64e14 --- /dev/null +++ b/apps/riscv-tests/debug/targets.py @@ -0,0 +1,227 @@ +import importlib +import os.path +import sys +import tempfile + +import testlib + +class Hart: + # XLEN of the hart. May be overridden with --32 or --64 command line + # options. + xlen = 0 + + # Will be autodetected (by running ExamineTarget) if left unset. Set to + # save a little time. + misa = None + + # Path to linker script relative to the .py file where the target is + # defined. Defaults to .lds. + link_script_path = None + + # Implements dmode in tdata1 as described in the spec. Harts that need + # this value set to False are not compliant with the spec (but still usable + # as long as running code doesn't try to mess with triggers set by an + # external debugger). + honors_tdata1_hmode = True + + # Address where a r/w/x block of RAM starts, together with its size. + ram = None + ram_size = None + + # Number of instruction triggers the hart supports. + instruction_hardware_breakpoint_count = 0 + + # Defaults to target- + name = None + + # When reset, the PC must be at one of the values listed here. + # This is a list because on some boards the reset vector depends on + # jumpers. + reset_vectors = [] + + def extensionSupported(self, letter): + # target.misa is set by testlib.ExamineTarget + if self.misa: + return self.misa & (1 << (ord(letter.upper()) - ord('A'))) + return False + +class Target: + # pylint: disable=too-many-instance-attributes + + # List of Hart object instances, one for each hart in the target. + harts = [] + + # Name of the target. Defaults to the name of the class. + name = None + + # GDB remotetimeout setting. + timeout_sec = 2 + + # Timeout waiting for the server to start up. This is different than the + # GDB timeout, which is how long GDB waits for commands to execute. + # The server_timeout is how long this script waits for the server to be + # ready for GDB connections. + server_timeout_sec = 60 + + # Path to OpenOCD configuration file relative to the .py file where the + # target is defined. Defaults to .cfg. + openocd_config_path = None + + # List of commands that should be executed in gdb after connecting but + # before starting the test. + gdb_setup = [] + + # Supports mtime at 0x2004000 + supports_clint_mtime = True + + # Implements custom debug registers like spike does. It seems unlikely any + # hardware will every do that. + implements_custom_test = False + + # When true it indicates that reading invalid memory doesn't return an error + invalid_memory_returns_zero = False + + # Supports simultaneous resume through hasel. + support_hasel = True + + # Tests whose names are mentioned in this list will be skipped and marked + # as not applicable. This is a crude mechanism that can be handy, but in + # general it's better to define some property like those above that + # describe behavior of this target, and tests can use that to decide + # whether they are applicable or not. + skip_tests = [] + + # Set False if semihosting should not be tested in this configuration, + # because it doesn't work and isn't expected to work. + test_semihosting = True + + # Set False if manual hwbps (breakpoints set by directly writing tdata*) + # isn't supposed to work. + support_manual_hwbp = True + + # Internal variables: + directory = None + temporary_files = [] + + def __init__(self, path, parsed): + # Path to module. + self.path = path + self.directory = os.path.dirname(path) + self.server_cmd = parsed.server_cmd + self.sim_cmd = parsed.sim_cmd + self.temporary_binary = None + Target.isolate = parsed.isolate + if not self.name: + self.name = type(self).__name__ + # Default OpenOCD config file to .cfg + if not self.openocd_config_path: + self.openocd_config_path = "%s.cfg" % self.name + self.openocd_config_path = os.path.join(self.directory, + self.openocd_config_path) + for i, hart in enumerate(self.harts): + hart.index = i + if not hasattr(hart, 'id'): + hart.id = i + if not hart.name: + hart.name = "%s-%d" % (self.name, i) + # Default link script to .lds + if not hart.link_script_path: + hart.link_script_path = "%s.lds" % self.name + hart.link_script_path = os.path.join(self.directory, + hart.link_script_path) + + def create(self): + """Create the target out of thin air, eg. start a simulator.""" + + def server(self): + """Start the debug server that gdb connects to, eg. OpenOCD.""" + return testlib.Openocd(server_cmd=self.server_cmd, + config=self.openocd_config_path, + timeout=self.server_timeout_sec) + + def compile(self, hart, *sources): + binary_name = "%s_%s-%d" % ( + self.name, + os.path.basename(os.path.splitext(sources[0])[0]), + hart.xlen) + if Target.isolate: + self.temporary_binary = tempfile.NamedTemporaryFile( + prefix=binary_name + "_") + binary_name = self.temporary_binary.name + Target.temporary_files.append(self.temporary_binary) + + args = list(sources) + [ + "programs/entry.S", "programs/init.c", + "-DNHARTS=%d" % len(self.harts), + "-I", "../env", + "-T", hart.link_script_path, + "-nostartfiles", + "-mcmodel=medany", + "-DXLEN=%d" % hart.xlen, + "-o", binary_name] + + if hart.extensionSupported('e'): + args.append("-march=rv32e") + args.append("-mabi=ilp32e") + args.append("-DRV32E") + else: + march = "rv%dima" % hart.xlen + for letter in "fdcv": + if hart.extensionSupported(letter): + march += letter + args.append("-march=%s" % march) + if hart.xlen == 32: + args.append("-mabi=ilp32") + else: + args.append("-mabi=lp%d" % hart.xlen) + + testlib.compile(args) + return binary_name + +def add_target_options(parser): + parser.add_argument("target", help=".py file that contains definition for " + "the target to test with.") + parser.add_argument("--sim_cmd", + help="The command to use to start the actual target (e.g. " + "simulation)", default="spike") + parser.add_argument("--server_cmd", + help="The command to use to start the debug server (e.g. OpenOCD)") + + xlen_group = parser.add_mutually_exclusive_group() + xlen_group.add_argument("--32", action="store_const", const=32, + dest="xlen", default=0, help="Force the target to be 32-bit.") + xlen_group.add_argument("--64", action="store_const", const=64, + dest="xlen", default=0, help="Force the target to be 64-bit.") + + parser.add_argument("--isolate", action="store_true", + help="Try to run in such a way that multiple instances can run at " + "the same time. This may make it harder to debug a failure if it " + "does occur.") + +def target(parsed): + directory = os.path.dirname(parsed.target) + filename = os.path.basename(parsed.target) + module_name = os.path.splitext(filename)[0] + + sys.path.append(directory) + module = importlib.import_module(module_name) + found = [] + for name in dir(module): + definition = getattr(module, name) + if isinstance(definition, type) and issubclass(definition, Target): + found.append(definition) + assert len(found) == 1, "%s does not define exactly one subclass of " \ + "targets.Target" % parsed.target + + t = found[0](parsed.target, parsed) + assert t.harts, "%s doesn't have any harts defined!" % t.name + if parsed.xlen > 0: + for h in t.harts: + if h.xlen == 0: + h.xlen = parsed.xlen + elif h.xlen != parsed.xlen: + raise Exception("The target hart specified an XLEN of %d, but "\ + "the command line specified an XLEN of %d. They must "\ + "match." % (h.xlen, parsed.xlen)) + + return t diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike-1.cfg b/apps/riscv-tests/debug/targets/RISC-V/spike-1.cfg new file mode 100644 index 0000000..3bc32d1 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike-1.cfg @@ -0,0 +1,30 @@ +adapter_khz 10000 + +interface remote_bitbang +remote_bitbang_host $::env(REMOTE_BITBANG_HOST) +remote_bitbang_port $::env(REMOTE_BITBANG_PORT) + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913 + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME +$_TARGETNAME configure -work-area-phys $::env(WORK_AREA) -work-area-size 8096 -work-area-backup 1 + + +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Expose an unimplemented CSR so we can test non-existent register access +# behavior. +riscv expose_csrs 2288 +riscv expose_custom 1,12345-12348 + +init + +set challenge [riscv authdata_read] +riscv authdata_write [expr $challenge + 1] + +halt + +arm semihosting enable diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike-2-hwthread.cfg b/apps/riscv-tests/debug/targets/RISC-V/spike-2-hwthread.cfg new file mode 100644 index 0000000..c378a45 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike-2-hwthread.cfg @@ -0,0 +1,38 @@ +# Connect to a mult-icore RISC-V target, exposing each hart as a thread. +adapter_khz 10000 + +interface remote_bitbang +remote_bitbang_host $::env(REMOTE_BITBANG_HOST) +remote_bitbang_port $::env(REMOTE_BITBANG_PORT) + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913 + +set _TARGETNAME_0 $_CHIPNAME.cpu0 +set _TARGETNAME_1 $_CHIPNAME.cpu1 +target create $_TARGETNAME_0 riscv -chain-position $_CHIPNAME.cpu -rtos hwthread +target create $_TARGETNAME_1 riscv -chain-position $_CHIPNAME.cpu -coreid 1 +target smp $_TARGETNAME_0 $_TARGETNAME_1 + +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Expose an unimplemented CSR so we can test non-existent register access +# behavior. +foreach t [target names] { + targets $t + riscv expose_csrs 2288 + riscv expose_custom 1,12345-12348 +} + +init + +set challenge [riscv authdata_read] +riscv authdata_write [expr $challenge + 1] + +halt + +foreach t [target names] { + targets $t + arm semihosting enable +} diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike-2.cfg b/apps/riscv-tests/debug/targets/RISC-V/spike-2.cfg new file mode 100644 index 0000000..640fba9 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike-2.cfg @@ -0,0 +1,36 @@ +# Connect to a mult-icore RISC-V target, exposing each hart as a thread. +adapter_khz 10000 + +interface remote_bitbang +remote_bitbang_host $::env(REMOTE_BITBANG_HOST) +remote_bitbang_port $::env(REMOTE_BITBANG_PORT) + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913 + +set _TARGETNAME_0 $_CHIPNAME.cpu0 +set _TARGETNAME_1 $_CHIPNAME.cpu1 +target create $_TARGETNAME_0 riscv -chain-position $_CHIPNAME.cpu -coreid 0 +target create $_TARGETNAME_1 riscv -chain-position $_CHIPNAME.cpu -coreid 1 + +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Expose an unimplemented CSR so we can test non-existent register access +# behavior. +foreach t [target names] { + targets $t + riscv expose_csrs 2288 + riscv expose_custom 1,12345-12348 +} + +init + +set challenge [riscv authdata_read] +riscv authdata_write [expr $challenge + 1] + +foreach t [target names] { + targets $t + halt + arm semihosting enable +} diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike-rtos.cfg b/apps/riscv-tests/debug/targets/RISC-V/spike-rtos.cfg new file mode 100644 index 0000000..395a9f8 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike-rtos.cfg @@ -0,0 +1,29 @@ +# Connect to a mult-icore RISC-V target, exposing each hart as a thread. +adapter_khz 10000 + +interface remote_bitbang +remote_bitbang_host $::env(REMOTE_BITBANG_HOST) +remote_bitbang_port $::env(REMOTE_BITBANG_PORT) + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913 + +enable_rtos_riscv + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME -rtos riscv + +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Expose an unimplemented CSR so we can test non-existent register access +# behavior. +riscv expose_csrs 2288 +riscv expose_custom 1,12345-12348 + +init + +set challenge [riscv authdata_read] +riscv authdata_write [expr $challenge + 1] + +halt diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike32-2-hwthread.py b/apps/riscv-tests/debug/targets/RISC-V/spike32-2-hwthread.py new file mode 100644 index 0000000..2ad2998 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike32-2-hwthread.py @@ -0,0 +1,15 @@ +import targets +import testlib + +import spike32 # pylint: disable=import-error + +class spike32_2(targets.Target): + harts = [spike32.spike32_hart(misa=0x40341101), + spike32.spike32_hart(misa=0x40341101)] + openocd_config_path = "spike-2-hwthread.cfg" + timeout_sec = 5 + implements_custom_test = True + + def create(self): + return testlib.Spike(self, isa="RV32IMAV", support_hasel=True, + support_haltgroups=False) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike32-2-rtos.py b/apps/riscv-tests/debug/targets/RISC-V/spike32-2-rtos.py new file mode 100644 index 0000000..ce0d56d --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike32-2-rtos.py @@ -0,0 +1,19 @@ +import targets +import testlib + +import spike32 # pylint: disable=import-error + +class spike32_2(targets.Target): + harts = [spike32.spike32_hart(misa=0x40141129), + spike32.spike32_hart(misa=0x40141129)] + openocd_config_path = "spike-rtos.cfg" + timeout_sec = 30 + implements_custom_test = True + support_hasel = False + test_semihosting = False + support_manual_hwbp = False # not supported with `-rtos riscv` + + def create(self): + return testlib.Spike(self, progbufsize=0, dmi_rti=4, + support_hasel=False, support_abstract_csr=True, + support_haltgroups=False) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike32-2.py b/apps/riscv-tests/debug/targets/RISC-V/spike32-2.py new file mode 100644 index 0000000..ca198d7 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike32-2.py @@ -0,0 +1,15 @@ +import targets +import testlib + +import spike32 # pylint: disable=import-error + +class spike32_2(targets.Target): + harts = [spike32.spike32_hart(misa=0x40141125), + spike32.spike32_hart(misa=0x40141125)] + openocd_config_path = "spike-2.cfg" + timeout_sec = 30 + implements_custom_test = True + + def create(self): + return testlib.Spike(self, isa="RV32IMAFC", progbufsize=0, dmi_rti=4, + support_abstract_csr=True, support_haltgroups=False) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike32.lds b/apps/riscv-tests/debug/targets/RISC-V/spike32.lds new file mode 100755 index 0000000..84216db --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike32.lds @@ -0,0 +1,38 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + /* Leave some space for pk's data structures, which includes tohost/fromhost + * which are special addresses we ought to leave alone. */ + . = 0x10010000; + .text : + { + *(.text.entry) + *(.text) + } + + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike32.py b/apps/riscv-tests/debug/targets/RISC-V/spike32.py new file mode 100644 index 0000000..b261f6c --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike32.py @@ -0,0 +1,26 @@ +import targets +import testlib + +class spike32_hart(targets.Hart): + xlen = 32 + ram = 0x10000000 + ram_size = 0x10000000 + instruction_hardware_breakpoint_count = 4 + reset_vectors = [0x1000] + link_script_path = "spike32.lds" + + def __init__(self, misa): + self.misa = misa + +class spike32(targets.Target): + harts = [spike32_hart(misa=0x4034112d)] + openocd_config_path = "spike-1.cfg" + timeout_sec = 30 + implements_custom_test = True + + def create(self): + # 64-bit FPRs on 32-bit target + return testlib.Spike(self, isa="RV32IMAFDCV", dmi_rti=4, + support_abstract_csr=True, support_haltgroups=False, + # elen must be at least 64 because D is supported. + elen=64) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike64-2-hwthread.py b/apps/riscv-tests/debug/targets/RISC-V/spike64-2-hwthread.py new file mode 100644 index 0000000..5d8d6e6 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike64-2-hwthread.py @@ -0,0 +1,14 @@ +import targets +import testlib + +import spike64 # pylint: disable=import-error + +class spike64_2(targets.Target): + harts = [spike64.spike64_hart(misa=0x8000000000141129), + spike64.spike64_hart(misa=0x8000000000141129)] + openocd_config_path = "spike-2-hwthread.cfg" + timeout_sec = 5 + implements_custom_test = True + + def create(self): + return testlib.Spike(self) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike64-2-rtos.py b/apps/riscv-tests/debug/targets/RISC-V/spike64-2-rtos.py new file mode 100644 index 0000000..2062f6d --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike64-2-rtos.py @@ -0,0 +1,18 @@ +import targets +import testlib + +import spike64 # pylint: disable=import-error + +class spike64_2_rtos(targets.Target): + harts = [spike64.spike64_hart(misa=0x8000000000141129), + spike64.spike64_hart(misa=0x8000000000141129)] + openocd_config_path = "spike-rtos.cfg" + timeout_sec = 60 + implements_custom_test = True + support_hasel = False + test_semihosting = False + support_manual_hwbp = False # not supported with `-rtos riscv` + + def create(self): + return testlib.Spike(self, abstract_rti=30, support_hasel=False, + support_abstract_csr=False) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike64-2.py b/apps/riscv-tests/debug/targets/RISC-V/spike64-2.py new file mode 100644 index 0000000..5dc0e7b --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike64-2.py @@ -0,0 +1,21 @@ +import targets +import testlib + +import spike64 # pylint: disable=import-error + +class spike64_2(targets.Target): + harts = [spike64.spike64_hart(misa=0x8000000000341129), + spike64.spike64_hart(misa=0x8000000000341129)] + openocd_config_path = "spike-2.cfg" + # Increased timeout because we use abstract_rti to artificially slow things + # down. + timeout_sec = 20 + implements_custom_test = True + support_hasel = False + + def create(self): + # TODO: It would be nice to test with slen=128, but spike currently + # requires vlen==slen. + return testlib.Spike(self, isa="RV64IMAFDV", abstract_rti=30, + support_hasel=False, support_abstract_csr=False, + vlen=512, elen=64, slen=512) diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike64.lds b/apps/riscv-tests/debug/targets/RISC-V/spike64.lds new file mode 100755 index 0000000..2e7d65d --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike64.lds @@ -0,0 +1,36 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + . = 0x1212340000; + .text : + { + *(.text.entry) + *(.text) + } + + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} diff --git a/apps/riscv-tests/debug/targets/RISC-V/spike64.py b/apps/riscv-tests/debug/targets/RISC-V/spike64.py new file mode 100644 index 0000000..ec43a11 --- /dev/null +++ b/apps/riscv-tests/debug/targets/RISC-V/spike64.py @@ -0,0 +1,24 @@ +import targets +import testlib + +class spike64_hart(targets.Hart): + xlen = 64 + ram = 0x1212340000 + ram_size = 0x10000000 + instruction_hardware_breakpoint_count = 4 + reset_vectors = [0x1000] + link_script_path = "spike64.lds" + + def __init__(self, misa=0x8000000000141125): + self.misa = misa + +class spike64(targets.Target): + harts = [spike64_hart()] + openocd_config_path = "spike-1.cfg" + timeout_sec = 30 + implements_custom_test = True + + def create(self): + # 32-bit FPRs only + return testlib.Spike(self, isa="RV64IMAFC", progbufsize=0, + abstract_rti=30, support_abstract_csr=True) diff --git a/apps/riscv-tests/debug/targets/SiFive/Freedom/E300.py b/apps/riscv-tests/debug/targets/SiFive/Freedom/E300.py new file mode 100644 index 0000000..5f1c418 --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/Freedom/E300.py @@ -0,0 +1,13 @@ +import targets + +class E300Hart(targets.Hart): + xlen = 32 + ram = 0x80000000 + ram_size = 64 * 1024 + instruction_hardware_breakpoint_count = 2 + link_script_path = "Freedom.lds" + +class E300(targets.Target): + openocd_config_path = "Freedom.cfg" + harts = [E300Hart()] + invalid_memory_returns_zero = True diff --git a/apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.cfg b/apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.cfg new file mode 100644 index 0000000..8947bf5 --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.cfg @@ -0,0 +1,14 @@ +adapter_khz 10000 + +source [find interface/ftdi/olimex-arm-usb-tiny-h.cfg] + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913 + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME -rtos riscv + +init + +halt +echo "Ready for Remote Connections" diff --git a/apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.lds b/apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.lds new file mode 100644 index 0000000..9354d3f --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/Freedom/Freedom.lds @@ -0,0 +1,36 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + . = 0x80000000; + .text : + { + *(.text.entry) + *(.text) + } + + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} diff --git a/apps/riscv-tests/debug/targets/SiFive/Freedom/U500.py b/apps/riscv-tests/debug/targets/SiFive/Freedom/U500.py new file mode 100644 index 0000000..4442af7 --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/Freedom/U500.py @@ -0,0 +1,13 @@ +import targets + +class U500Hart(targets.Hart): + xlen = 64 + ram = 0x80000000 + ram_size = 64 * 1024 + instruction_hardware_breakpoint_count = 2 + link_script_path = "Freedom.lds" + +class U500(targets.Target): + openocd_config_path = "Freedom.cfg" + harts = [U500Hart()] + invalid_memory_returns_zero = True diff --git a/apps/riscv-tests/debug/targets/SiFive/Freedom/U500Sim.py b/apps/riscv-tests/debug/targets/SiFive/Freedom/U500Sim.py new file mode 100644 index 0000000..065ab08 --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/Freedom/U500Sim.py @@ -0,0 +1,17 @@ +import targets +import testlib + +class U500Hart(targets.Hart): + xlen = 64 + ram = 0x80000000 + ram_size = 256 * 1024 * 1024 + instruction_hardware_breakpoint_count = 2 + link_script_path = "Freedom.lds" + +class U500Sim(targets.Target): + timeout_sec = 6000 + openocd_config_path = "Freedom.cfg" + harts = [U500Hart()] + + def target(self): + return testlib.VcsSim(sim_cmd=self.sim_cmd, debug=False) diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.lds b/apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.lds new file mode 100644 index 0000000..e4074be --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.lds @@ -0,0 +1,44 @@ +OUTPUT_ARCH( "riscv" ) + +MEMORY +{ + flash (rxl) : ORIGIN = 0x20400000, LENGTH = 128K + ram (wx) : ORIGIN = 0x80000000, LENGTH = 16K +} + +SECTIONS +{ + flash_text : { + *(.text.entry) + *(.text) + } >flash + + /* data segment */ + .data : { *(.data) } >ram + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } >ram + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } >ram + .bss : { *(.bss) } >ram + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} + +ENTRY(_start) + +ASSERT(_end < 0x80004000, "program is too large") diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.py b/apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.py new file mode 100644 index 0000000..06dfcfc --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFive1-flash.py @@ -0,0 +1,15 @@ +import targets + +# Like HiFive1, but put code in flash + +class HiFive1FlashHart(targets.Hart): + xlen = 32 + ram = 0x80000000 + ram_size = 16 * 1024 + instruction_hardware_breakpoint_count = 2 + misa = 0x40001105 + link_script_path = "HiFive1-flash.lds" + +class HiFive1Flash(targets.Target): + harts = [HiFive1FlashHart()] + openocd_config_path = "HiFive1.cfg" diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFive1.cfg b/apps/riscv-tests/debug/targets/SiFive/HiFive1.cfg new file mode 100644 index 0000000..333c82e --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFive1.cfg @@ -0,0 +1,33 @@ +adapter_khz 10000 + +interface ftdi +ftdi_device_desc "Dual RS232-HS" +ftdi_vid_pid 0x0403 0x6010 + +ftdi_layout_init 0x0008 0x001b +ftdi_layout_signal nSRST -oe 0x0020 + +# ... + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913 + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME +$_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 8096 -work-area-backup 1 +#-rtos riscv + +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Expose an unimplemented CSR so we can test non-existent register access +# behavior. +riscv expose_csrs 2288 + +flash bank my_first_flash fespi 0x20000000 0 0 0 $_TARGETNAME +init +#reset +halt +flash protect 0 64 last off + +echo "Ready for Remote Connections" diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFive1.lds b/apps/riscv-tests/debug/targets/SiFive/HiFive1.lds new file mode 100644 index 0000000..a37ca0c --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFive1.lds @@ -0,0 +1,38 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + . = 0x80000000; + .text : + { + *(.text.entry) + *(.text) + } + + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} + +ASSERT(_end < 0x80004000, "program is too large") diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFive1.py b/apps/riscv-tests/debug/targets/SiFive/HiFive1.py new file mode 100644 index 0000000..3cb508c --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFive1.py @@ -0,0 +1,11 @@ +import targets + +class HiFive1Hart(targets.Hart): + xlen = 32 + ram = 0x80000000 + ram_size = 16 * 1024 + instruction_hardware_breakpoint_count = 2 + misa = 0x40001105 + +class HiFive1(targets.Target): + harts = [HiFive1Hart()] diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.lds b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.lds new file mode 100644 index 0000000..fa30c6a --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.lds @@ -0,0 +1,41 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + . = 0x20000000; + .text : + { + *(.text.entry) + *(.text) + } + _text_end = .; + + . = 0x80000000; + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} + +ASSERT(_text_end < 0x20100000, "program is too large") +ASSERT(_end < 0x80100000, "program is too large") diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.py b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.py new file mode 100644 index 0000000..cb2741e --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed-flash.py @@ -0,0 +1,22 @@ +import targets + +class E51(targets.Hart): + xlen = 64 + ram = 0x80000000 + ram_size = 1024 * 1024 + instruction_hardware_breakpoint_count = 2 + link_script_path = "HiFiveUnleashed-flash.lds" + reset_vectors = [0x1004] + +class U54(targets.Hart): + xlen = 64 + ram = 0x80000000 + ram_size = 1024 * 1024 + instruction_hardware_breakpoint_count = 2 + link_script_path = "HiFiveUnleashed-flash.lds" + reset_vectors = [0x1004] + +class HiFiveUnleashedFlash(targets.Target): + support_hasel = False + harts = [E51(), U54(), U54(), U54(), U54()] + openocd_config_path = "HiFiveUnleashed.cfg" diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.cfg b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.cfg new file mode 100644 index 0000000..3aa5538 --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.cfg @@ -0,0 +1,64 @@ +adapter_khz 10000 + +interface ftdi +ftdi_device_desc "Dual RS232-HS" +ftdi_vid_pid 0x0403 0x6010 + +ftdi_layout_init 0x0008 0x001b +ftdi_layout_signal nSRST -oe 0x0020 + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000913 + +set _TARGETNAME_0 $_CHIPNAME.cpu0 +set _TARGETNAME_1 $_CHIPNAME.cpu1 +set _TARGETNAME_2 $_CHIPNAME.cpu2 +set _TARGETNAME_3 $_CHIPNAME.cpu3 +set _TARGETNAME_4 $_CHIPNAME.cpu4 +target create $_TARGETNAME_0 riscv -chain-position $_CHIPNAME.cpu -rtos hwthread +target create $_TARGETNAME_1 riscv -chain-position $_CHIPNAME.cpu -coreid 1 +target create $_TARGETNAME_2 riscv -chain-position $_CHIPNAME.cpu -coreid 2 +target create $_TARGETNAME_3 riscv -chain-position $_CHIPNAME.cpu -coreid 3 +target create $_TARGETNAME_4 riscv -chain-position $_CHIPNAME.cpu -coreid 4 +target smp $_TARGETNAME_0 $_TARGETNAME_1 $_TARGETNAME_2 $_TARGETNAME_3 $_TARGETNAME_4 + +#set _TARGETNAME_0 $_CHIPNAME.cpu +#target create $_TARGETNAME_0 riscv -chain-position $_TARGETNAME_0 -rtos riscv + +$_TARGETNAME_0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1 + + +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Expose an unimplemented CSR so we can test non-existent register access +# behavior. +riscv expose_csrs 2288 + +flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME_0 0x10040000 +init + +# Clear reset on these events, because that messes with memory which we don't +# want in these tests. We want gdb be able to "download" to flash as well as +# RAM, and then simply execute the program. +# This must happen after init, where blank events get overwritten with reset. +set targets [target names] +foreach t $targets { + $t configure -event gdb-flash-erase-start "" + $t configure -event gdb-flash-write-end "" +} + +reset halt + +# Use a modified bootloader to configure the hardware, especially the DDR controller. +load_image targets/SiFive/HiFiveUnleashed_setup.bin 0x08000000 +foreach t [target names] { + targets $t + reg pc 0x08000000 +} +resume +wait_halt + +# Uncomment this if you want to be able to clobber your SPI Flash, which +# probably you don't since you can do it through Linux +#flash protect 0 0 last off diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.lds b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.lds new file mode 100644 index 0000000..9298153 --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.lds @@ -0,0 +1,38 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + . = 0x80000000; + .text : + { + *(.text.entry) + *(.text) + } + + /* data segment */ + .data : { *(.data) } + + .sdata : { + __global_pointer$ = . + 0x800; + *(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) + *(.srodata*) + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + + /* bss segment */ + __bss_start = .; + .sbss : { + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : { *(.bss) } + __bss_end = .; + + __malloc_start = .; + . = . + 512; + + /* End of uninitalized data segement */ + _end = .; +} + +ASSERT(_end < 0x80100000, "program is too large") diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.py b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.py new file mode 100644 index 0000000..9bf7cae --- /dev/null +++ b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed.py @@ -0,0 +1,21 @@ +import targets + +class E51(targets.Hart): + xlen = 64 + ram = 0x80000000 + ram_size = 1024 * 1024 + instruction_hardware_breakpoint_count = 2 + reset_vectors = [0x1004] + misa = 0x8000000000101105 + +class U54(targets.Hart): + xlen = 64 + ram = 0x80000000 + ram_size = 1024 * 1024 + instruction_hardware_breakpoint_count = 2 + reset_vectors = [0x1004] + misa = 0x800000000014112d + +class HiFiveUnleashed(targets.Target): + support_hasel = False + harts = [E51(), U54(), U54(), U54(), U54()] diff --git a/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed_setup.bin b/apps/riscv-tests/debug/targets/SiFive/HiFiveUnleashed_setup.bin new file mode 100755 index 0000000000000000000000000000000000000000..893e57455d6836d4fcdc20f407878af7e0581148 GIT binary patch literal 25296 zcmeHv4R}<=)$rVV_ujh+2}xWa=mrT{35qNxBoG9o%TE&IPpcx;qGfZl2@Cn(gn$*@ zP1r2qFW?daT`d6=l)k0aRJZCUNGYaP{A(YGwpvLx5VRDMN)oV1_B&_py}O$jmHIyY z`aGXbxOe8voH=v;X6DS?)z1^6lidGgS;@tc-C4GJHpv#9L>wk&mSYw(+cBG&sZJu zDz39_yC-SPown#ZlN@txx0pJlJvZ@n3E1|#$XEj*I&My+v^9&kE1C7uBR0YvVTmE> zIJ1`>!}(U)`rH-FdR?W%DRpNN!>?Jgm-YQ4tIw+;EPtn={w8L-CM}Gx`mivq?+-Wm zZRGA~7$sG=wwn0D!zdn(8XlIo+Ylc{xaTy)cVk#zNUz45{ITX}qGM*=_<4eTlY?;}io6lsszo;4h5?_FZ3 z&w?7;SX0NP=%R?h@sYdEqYTjzkXw0TiiOsp7p`j`aruTTH}>p1bD;Im`NJ1pXn*PQ zD_4&6%x=y&JO9(g|G1~){>}%lKHS^VeD3ULpI-dOKRdcQzqs1h8}7UmO-lAHZ!xna z`$}fpT5Ll0f$R*+Ig7CR!0L?hbLHVH4y~AP{mdHv$e~B(|Mat;4$V89w>bY|{?Nw` zKeqVsi;u^cZ6rSF^Mv@+6#j0Kd=%J%q^}!J)=hp@JWHf=ZDjhXHg?_Q3OkctVRws8 z&94r6O}aXf_01RiD(sJ@yLXDL-X#*>TSA|%tUKz6Z$OuDmoBUw*JJ3)yP|YeFhb%vlWw>GBk(xF z2pmD^bH1Z@cKO-i%yyoiSnJ5pxd3xqlZm#^7Z7tKNGO1W3$%R(`w8OYeLsJuXV+a! zda-BMyA}3djeAkn$U@Y}vRPl&NM$2WcE9E1ZyVQXa^tusg+8q7?XIwQWQ?6xeE;;O zQ{;|KZn2z~vdV~yFcJ(tN0%bg0Is7{z6W{*H`fbu{)Mb zUwV2FYvrk+797x%|}v=XLo(V}4&=Q=eB9qxsAa-W`^O?OXb_@tN5A!Cyya zdEX$cPE6w}y;XkS#kQ}dW;i6Wa*r@k#YZ}Z!y*ALu=K1*4E69Fg6Drk*6_5*4$hsz zL8DC17@+qRbPk9F>7abbad3PYf5UNg6nE7WE>sKhIJ@2&lyBg6!(GhS0b@Q5yzdLj z5SF>CNu@rhh8txKKR<|ucl}u&cT_+=#VUVQ#snRywEJ6#YO`KsW!g{mqfOgDBZJBW z8dr64cmuOIjTfVF1b&{5gB4dCN=BY=qN8B>IjoW8 zQEI4v$sA&hbF6QVu>KKC|HQ6w+`h{w@@H(#(NPL9W zFk^dyAvNYELy`lYSq8(5AC56hHIF&8{!+XDl?R$fJSg0EZsl~%Tu!gKJX(L>4s!nv zscWO48$#msJAXzZv~Hl2=)BZE`nS{XU%|VB-9>W|B6$%e2Lhn@+S_tBGVmj>tMuDTMvkd zLIZ!9z<6X^Hj}=uh%If&PB&NB5Gx!Y92-TCK5!8;Nk@3}+ z$a@RJ-gIV4Lp!zAnNnD%HaWfe*`27N?CF~O0vbx(A$`7H)=-rOG~~>f4}3)5IsN`0 z%lgrPevG5uu6^6dH&i`i(hEHKlM`{?%eZFU_|{Y1@R<_qD`A;F{n;*K`upBn(vNv( z#R#nlXFg9fb?iOo%t#ZM=wWY+cO7=^J|@lP1>Fu82OAP`WtEG!qg|JL%MfY{i3~5u7R(i56 zVtB4z=x(mfeYNTYal5*k9qCeAlMwOxjJw_Zav{Na)idM0OYJ|{?B=(HC7|zZ@{U^t znC03>-vgYsSTf_iDDrwlV$~m=_dxq6A2MU5VSKdgC9|#jtn5nkl;N3DZJWSu8(6Ow z#g^%(&#@l9%Ww4#!p)T?5{fgBvpp3mXMTrQL^Ns3A$3uus+2J?}ANV?Mt9S-sfl_lP`6PM6MoO7zZ5g8Q}utmFSHmOeg; zYZUjQ%a2ireP+s%PI+B~^*#++oZ`&d$~4&5E*^v(YF5mcKYFxX{)&ATGK+y($@5yB zR;%@m7~adCVO!OD!_z#hW>2P{ee20Z`oDG0(m#BWnLf0S=pUYF3Lh#x^m^njYvoLy zq;ZVjtM!vXkj*uNE^K%+h^lhIlx?-~9x~ zy8pzox((NnaP4Ee9;j+~8AM~vW!brJni7fC6PWg5D3$%i%iI+5`-iOh#J6|oNY zOLacI(5rWGAXm8fSe<0;B%`)$Xl@WMntXHHuYlf0+y)-^hJPd5P_fk1w{zznPpp&Z z?{|`v)gvg)_iOY!Wt#8T7!G&!b&O!P`+ojOkKxxmu^g?iKjun5`by37UM6P#8SZu` zNo+m59%pdEdAHM&K7Rdtr*Hw*xrvd@+7(#ucAlLJurcgYXXcZ?Z&^M&dtWwd<-w2T zR_7dCYqs6Gu4CkixP{oh>->`^S?j)R#BpXO7gxk4Tutn(7QGrjNz*X?`5h27e|rDf z2b=%a({kn9<Jn0Iv$i4n@lun~*-?A`fzVpuB2P+Q_ zA^Ij4@zl9UbB(3up&C!D$mo}%?i}MJdmS%*)&pmyG#$+Ay0&O3Dssg3A)gh^FFjNm zzV}7T`~MA~S0HkR@L3;3mQySOC(#MN}(UYMN_2 zBdX9!_g6vOEi%npEnCrA?{9_CpAr~0)^l257$&**!)GK-gn-(a z=5#y9PMX#V`nf(KH?q0%08p>1BA(M#Mc=ng1C17qh-~H# z_U9(lUku}W$QGlgsdtvAsf~HncoA{3oE3GaUX=8aL<)-_*izl7)&oRz&IM$A`*vD)v$mp+ExSb8^~Jl# z@PDaF(*Du;aP6h`$6G4XHZkM3><(Z_WC{1#CVtWO*L+;Wc{*N=cuu9e# zG~0(54*#pqH)@^#&7=IHQ7 z(W~BkX5_3i0enfz_&qS2bV65@J{EGVwmqd>WIAd>^^_(Kea|sYCpKM_cC@i07oEsZ z?OR;a(2d>`oP*#;pLfB!uq?guW+ypZr3YX0oI;=5Ks+C8fO!klx1?MVnUt+cts2e!Ulql*<-cdf`ewlnTSwM@pe+K*pGu3o(z&n?0 z!RQCihjDirk^~~%+b-xUyZ!Ewuuj3s>eO!3dWSOpw4r`-c-O=Yj!gH~q3yb%eNo&v zEurg{RvkH|yb;!zrhYn8)~y>x_VQdfm*TXLxRwh0L?>wR|M_^*kJ>eQSGS*y-6*=N zPWT!3k)7cp`biq^Cr4^`Z$%%`@tskgSeVgEtBCbWK43W9+1D|gdBV5nrJf4=+TyrH z3GKwXxK+4}kw-(=WgYB%2=)!}isjU#byPg*~v8e;P^{=RoGnm+S*pJ&N>21}pxdX{JycV}l5LjE48 zCn_|$$6a=r)<6C)8ik+nf1%UZXU5crokZ%i|5ezRU`DuRtsCY$A@&7h9cFAgUM1v8~Cx1V*Ud0)GA#Nd`$){tx?}^qf zw@{?j3H3L)c{{}&{b>;QC!ealj-FRbqt73rR-ogxVZ`Ki<#zTCYe;J+4XN9RjQ8I~kVltJ7R`-U(a^Oop2;5|P8B%>nu?C_#~!CJ>V> z!#0Rs!FN6h^7Y9lfOGjWcml|At5l=TBwm;QR$L^A!K15d4qg77mvs-mGbT z?M1gpCQV=3#d^eU|3j}mR6PI6{TC)yzqHZK$MepN#Gb0weP;I=e~8ih_ExrIrYEOK7G2MnHzvld6upx37UsC-?Dl3 zuvyzYOXrf;Hr=t=9s7H7$7WBghOW7ux}~I{JB`V5-2qs9gn=9+v$pweobWG|j{iM< zoRjJ`(K$O#w=9CYbmr*04Y~hAeiwVpEj{JZG_z|A>CyXN`SsvCF@^rrEPsoLP6IR?3NGD(vH3zQ>09@zx3= zVt#*Acb{)%EX3KBZ(xnPyqxThf)hP|;?DzXuKJ6;J1mti@TBr6&u~YbOyv=t<&HR6 zu7T&c-#WQrZND)al9m#~)NaNwqm3~nHF1X2M$Rxbmo>}~xm2G{bZOx1r}5==fAO66 zjydC9Qt@%tUEWQO`Ce;wuNM4wYWhILqCq%r+9=>%^v<2R_5;Kq zddYslOAPSr=OKq@zXo!6_H&TKv!8_=p8X8u@a!j$!vk?KtW@ruPI79CdneD(H+yQ! z177#eaYP=Ys-n%F_{C29vDi^HGk5xmk6(Gpo09t?>AiQrQd~FDEd`t=flJ}LP42SJsO_J^`Nw_C9e|tRBm?)X?(Xg= ztgEnd8DKB8E$`$d-DzU^B85K<^<((GyzjcxeYoGx;*asZxYIrKZkYPl%YW}(LM44^ zTurnzMr;qo_#2TjktQJGQaf9jpejDvnGduh4R&t)|Ex%4)F z?K@+BmomAY%&c8Iyu$wR>B>wzhq+gmlg@vI)#&(c@H?Hej=u4%r*nGg`yhQc(svWQ z@n*p`Ha^vv4*ShjhRA>WmgBk2BXmBh6Wbq^N}9Afk*s^Q=^U#Y!Lx3yeJ1mSm*=9J zbM&q*>vZi|V$Rix-PROg1lOD9zS14Fw-WVas2|RJbgUy6_L9*r)JbJxn5RluIep0o zY?`QvUN>2LJS|oe4R4W$cQMcq;~SdV;I_Qm?-iNoUGI8h@eRHe%d>E=z}sgwxDG;Z zF4_0M=QNdWtAu`sfRP4 z@2+}!20rA(TN9xbG*r89IiHTYVd}jiiT-G5S+Q_7q4_}1AFsS~`A_YqFZ|{F-&$MF zWCU zwPUOFgpd(;H`Hy1y8F_e5n(mtuLEwX#niA&!*81_@Z8|7i(%a^@xrp#(?F7Cb1=&E zeJsFjHnGPwdShc)&@N(pMB5veW%k2(D{iU0pT{-fcODsPBQgX#Q#3<*(>nciX?S`S zHEF_-XrKivRQl{uTX)P!5xdBCaoBO6$J>WEyalv0H#U>5+_$AA4vE%@2c?;{qqauO zX%HGojJWxCKK;Qyr^W5$63rbHZ#-rJO)|{5MKy-{wi~Z3a0;;h z0=(99j*cprey8@1Fg)Fq3itV`aF3q~cluKRcd8@teW2bnwfBC*zNV>AlZrhB zpw*PBLL-n4LJ71@i&S^a!SV>Q<9Ovbag4iLj6VAbSaeOTnC2Q1-6f_?7!n=l(?x97 z?p?sl=NEX^Z}PWPb5Dm6$D&uOo+A1%4RMFJbNc%<%uAakXJlN0>%+`fmtMs$NF2;* zP8u%8NmWaA()N6P^-bHud{20K_TCD2Ng7>5M7(d;zrOI+T?hV4(B2o8y}RtLetz?3 z*;7O|u8D)W=5^f&k(W465O>%3?rH~1%J-6d;9hdCsNO^(zFRa2p}6bHpBLAqDHz#< zVLUIYwA$v<5!+gE#JC_8n1>=^z~V#MZA|*1<>A@qN;B3TSSvhoZe_-*1FM9*mPco= z+qdpcbA^2`%x2fn$d`3|bohryd1W^3`6bR5D(`^VwCH7ik;H|E-;(ia_er*n2T#wO z9@|9kVcpJWj43NWBd>mRlJ&Sm&Jfi>Jewo9{ZZSQOJ}0qb@Lqzy{|oU*E?>$St-}N zEeVkVQi9$77Nz~<0QfCmWqzBJTJ)vOzCDpG^Ig09SWtlCLk|*UPWu>O1B&nlJN=m-nn4D}(o-$GCDz_+r zG22>Fx)!R^OG*k$;*-{>{XlJBN(|IM2t*%^(#k=OWy}XY{sBqp0(&Q+57G*ysnW(A zs7BK)TFD77!?cpV;+0}R)?gDM_cq)&vG}^#^X!GKQ%?WN3RjNT|9DN$+a^1EJ}>=8 zLo#o+jXyT}%AaChSwQOFocZSTY|Cn^Wcf+y+9C@jlW)l{ECI!oSaK7&KL{C*WTz66xDE1~;faAq(F6B$sQ(eb0~4wglWH0)qe@jcDg@R;S#PuESXWyn zX@UQU~H75)y$#T|`<@XtNXq;T&s8e!00sHk3?f2(-?40FrUh zBIDe-L0qY*j4}i@s{Gi9I#OZO2PPGsN1|q%0A`@CNnu27`!UpGLKx*!byrd-t+JFR zkrJy-T8#*h)IO_#PAFUsfGMPXBb4nSaGl&t`)i^8X?WCWqSAa3>M$W32G7eStEZ$| z^UV@gLQ?ULD`gda7hrX|;uQaD;VLsue@u+EpcGuUtfV$hENY5Srr(6#~lP67ZD@_>APZ{PmwFwSAr z73$}k>z= zJ`}1bT?qNGRrMPzW4#KiaR9=&Md|7JOe6M&P&6rtmgJaIDdrdDS&Ug~ zK!^PyF^}S_#F8WBt)dmmI7}sl8uhvLqZ%?N5h~@bp+mI%tDW_lptSOI2jNb65=DC z%2x;~MZxwUKSS&QV!|rgcOXA>JjpDrfOBIYzBa)DeSj`-O~IJlq|ia0--L3A&dFvf zZa^lon?{*345-X0rSEXaRsJP9b`qf()MHY0;)62AAPB=;VJ<_CHdV(|>gibo=Tam* zINz~89v-?ju-Jnpssl6#O-KY1;zA4&^lO_n+mdB2$fm79Ua%W>!6)E9aQY57j}%lG z(u{>CAfxPVfE{!k#0lC7xu@wH?6ksKlxHniWlF`tAjzGO7TO1ssvCqu*EBuA0e%!R zunhEDypYav5D(WbEYPIp@iM3kNz|M&j7=uFJ&?!Cu#zdBpg1BlDLm7)0qrL16@)7V z=Nlj!wyS44#8AgZ8g~P~e#lW)gfYjx0{KE1bA&NYL>O~~F|I%ubA)jnLKt&|)xNS1 zK?O~+FJarD^9VerEH`u>$($no7D-Kn|J%|1<}_ zX%76-ydS?Z8GNJol-}U{=9^6^L2V-q@EaC&fRZAN^H0%zcD^|%58~YjZRlrezgwY< zNr4$3l-2ng4A_pdgrA0Vu8fsL< zMO~_P52DE4S)N+|cmT~9A%7uY7iT~8KL4AS&LS@i+%73u?%mG%HX z(HK3@6pwG@XD~a%d6S)o2ueach>h3>bMvj%kUE$ntW<7$q2V>ESwaP`DibL%PI0(av&K5#GTrLNElj<_J$XbY= zGNr#BL;Vv`6w|3Z^_x#7UmIIk=#MBT@`dpb@*1=Q zp6F@9D%v)f9iWN*snU+?z$UCvV8}x6*houA8`>Xv#jyi=Fv10Pskx*S>M$WcR1c_t zLE2ESWq^Y;RJ&1H)=3holrCq`h6!nnfk&MWfRaQCiy-tXgh3|&Xe^{fM26H~7YNbx zwYor=ehFx*E>RzF{}#{(!g~Qm|3ZoY(-aD;z9q{s$bF}Y1{dmfAE1M}Rq3G3m310I z1dtPwD#7PU8Rkx4uS7pV!PFf62Ym!#%n?R^K^Sv{(RUEW9N~WYLIyA?0%F@>zJvNW z3~lNji|{dkC&Q!Yhx!PPBkO~%&8R-hK@&r zI;g{h{jN>E3W^UeI~KlfJX}}kc=A>p8iavrvjPh((ujvgT@&z341sySBQb>mM;*@x zW%NfC#&vhJ0^=Nd5grna7&Mvijkp8-pYm5ESs}tzqAog3Rl3-XmX&en+NsWO4Yc7p zfi$ok*KmEl%~+H(!Mw(51gaJze37EdsM>!O)B>8y3wsjENbhl_ZaI)U4du{;?HHqB z9-44mtj9bw;aFIYd1yj@u^w}513j^=kcXy_HK5<#27Tz>77xhS7ve+aQFUMwRA4gE zw`@!(B3?W^Xp4ARt%0=&>*a*jl5t_V3ZD7QMOj#XE#D##4-<}uvbDg2xkbS1eS|F8{&~J`(LBkG^urG3^`lNzJrBK^sA47^XQ9-b6a33qD;qSmXNB0ON z{w*q(!(XIFKPe9KhYIphne zsrV=*hN!a66j^YAggQ)!_wULw5&GN)57J162WcSVvR+v#gHlD?2I^Ji?OJ6~dC#+C z+kh^miF>9V6mL{30cKWMAo$6$n3VuXk&Q#YQNwg7(*9s44$n$>9z;Bdf4Ex*^rz$I zmu5pV#Q{A9XsL5rk)kJ5lp9}XEv=1X+29n)ZRU`}(lhV+&7U@ovq!9Jlp zAq`A}(SkjTyR|6T7im#?C57_wj`o!MVoajWpZvmXi_MZ}k(8SPq#dxeT*RK#=E}H% z^IbpsNr)!XN8|u~vuzcyKwJCMRy9oQYCq8Hmub_B#^4zdZLKepva-x26X-pdISa0o zAF-4uCxCuqV9<*R8HF^Ee-*|#q|Pg5ke@mrUg#cN241L$8=&a}9Cb}VIdI>DoVKGr z1DxvU+}Ca`ND}FY=)j`NsPc zz13#3PO#c0O)f8*Gf&uTsXg zEGT0i6&DvdgweLLeHC4*##M0tU0tRs{o)~4blK0gbU}wUc{a=Zz!?8)U53g4pMAb^ z@3|I#z}Or0gpA8FpvTfgWx=*@nlp-?X{SMLpPw(umY2t(a~tZ6XlYwsp|ZWG_WH7| znPejpS9sypgWI>t53R!{x6%&!4V=MoeL#K!b}xnFJRImt%WU+P8k%VT(6t6plCS|% zKfMrQqLm?Q^FY0*<6s^(;P-E#KYx=7^NY--R#-?0ZU=cpUT+}Ir$75jRzHE|*s}5n zoFC!N-)1r9lvs+(;C^5&p&#Tz;LxAqS&ej+mOs%L@i%uwt+H84Z9xEA3M^|%VZ&c- z$&-80AMeROxUt&IDjRqmsh06LOJo%iL&(pc=x_W&;K1h^QnUg-Sb(JP9g%*?q2G>V z#?&gxSO7rAvW=yASw^Lv7G*&KwN@DcYxDEVjPzHCv=J^CN=b>iAQygCXOI;o{{T@g z7nYS4m6aL`%=yp`KUGvpw9%$0Hru*dDdm^tmC9d#WGyM>vI6))pCy|F6A*Ayi>h)hpM8<H3fZD#lkXqJr1 z4=O>UYmMkP3X`fVpe-X_OxXy%o(g_3BL=yG+6ZN~!4DEaNl=1ota591=?Z1keDfM( zQHiy%#0o!gmHhx1Urq2s9@S}3Ea0f9KLj!qo9J8$yv}Mkw2&F&> zn3ILT9wng_s|)i=&AAqtchEC9HAXMxML3hyU`3hLYKGNWe`bjdF1?qqap6Q07dK?L zM#F3PTW{1x3>^ml$E%TTy@U@RNrvh+k&*BpwlHHjyxWF?N=2d0q%%_>D#j&Mz~dIT z7%&))424lxPBR)-7!AE{3iSJr6>fqZkb#v+OP6&R23ILa4%`{x`KI=M($Sv(`4=w0 zgCx))FwEMi3?@VX8-O_Bem@gPLr~MWqYq4+Ocnoor2lqe8HSA%MTTfJ8je@@vQVxf zZw81mdX4D0JCUD5XrWf}6|0xwuPBeXQ|L?H<4SdFT%>IGt`~CbU zBz~49?R)!wcjy1zxyd(uZ~yPE{o^xYCx37M@2>qqz zf5=Yx-u~ZR`v(p~^cFV=1#d~<@+bRl!p0;p33wBPY4i~IH+qO39`z5uR^#mn^y~j8 z_vrWL@bbz3g9Jb1kHh6LKK{o!`b5tKIs+cHtsfEjn@Fq1Rtr(5p V{|MQo= len(fullpath): + relpath = fullpath + if os.path.exists(relpath): + return relpath + return None + +class CompileError(Exception): + def __init__(self, stdout, stderr): + super().__init__() + self.stdout = stdout + self.stderr = stderr + +gcc_cmd = None +def compile(args): # pylint: disable=redefined-builtin + if gcc_cmd: + cmd = [gcc_cmd] + else: + cmd = ["riscv64-unknown-elf-gcc"] + cmd.append("-g") + for arg in args: + found = find_file(arg) + if found: + cmd.append(found) + else: + cmd.append(arg) + header("Compile") + print("+", " ".join(cmd)) + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = process.communicate() + if process.returncode: + print(stdout.decode('ascii'), end=" ") + print(stderr.decode('ascii'), end=" ") + header("") + raise CompileError(stdout, stderr) + +class Spike: + # pylint: disable=too-many-instance-attributes + # pylint: disable=too-many-locals + def __init__(self, target, halted=False, timeout=None, with_jtag_gdb=True, + isa=None, progbufsize=None, dmi_rti=None, abstract_rti=None, + support_hasel=True, support_abstract_csr=True, + support_haltgroups=True, vlen=128, elen=64, slen=128): + """Launch spike. Return tuple of its process and the port it's running + on.""" + self.process = None + self.isa = isa + self.progbufsize = progbufsize + self.dmi_rti = dmi_rti + self.abstract_rti = abstract_rti + self.support_abstract_csr = support_abstract_csr + self.support_hasel = support_hasel + self.support_haltgroups = support_haltgroups + self.vlen = vlen + self.elen = elen + self.slen = slen + + if target.harts: + harts = target.harts + else: + harts = [target] + + cmd = self.command(target, harts, halted, timeout, with_jtag_gdb) + self.infinite_loop = target.compile(harts[0], + "programs/checksum.c", "programs/tiny-malloc.c", + "programs/infinite_loop.S", "-DDEFINE_MALLOC", "-DDEFINE_FREE") + cmd.append(self.infinite_loop) + self.logfile = tempfile.NamedTemporaryFile(prefix="spike-", + suffix=".log") + self.logname = self.logfile.name + if print_log_names: + real_stdout.write("Temporary spike log: %s\n" % self.logname) + self.logfile.write(("+ %s\n" % " ".join(cmd)).encode()) + self.logfile.flush() + self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE, + stdout=self.logfile, stderr=self.logfile) + + if with_jtag_gdb: + self.port = None + for _ in range(30): + m = re.search(r"Listening for remote bitbang connection on " + r"port (\d+).", open(self.logname).read()) + if m: + self.port = int(m.group(1)) + os.environ['REMOTE_BITBANG_PORT'] = m.group(1) + break + time.sleep(0.11) + if not self.port: + print_log(self.logname) + raise Exception("Didn't get spike message about bitbang " + "connection") + + # pylint: disable=too-many-branches + def command(self, target, harts, halted, timeout, with_jtag_gdb): + # pylint: disable=no-self-use + if target.sim_cmd: + cmd = shlex.split(target.sim_cmd) + else: + cmd = ["spike"] + + cmd += ["-p%d" % len(harts)] + + assert len(set(t.xlen for t in harts)) == 1, \ + "All spike harts must have the same XLEN" + + if self.isa: + isa = self.isa + else: + isa = "RV%dG" % harts[0].xlen + + cmd += ["--isa", isa] + cmd += ["--dm-auth"] + + if not self.progbufsize is None: + cmd += ["--dm-progsize", str(self.progbufsize)] + cmd += ["--dm-sba", "32"] + + if not self.dmi_rti is None: + cmd += ["--dmi-rti", str(self.dmi_rti)] + + if not self.abstract_rti is None: + cmd += ["--dm-abstract-rti", str(self.abstract_rti)] + + if not self.support_abstract_csr: + cmd.append("--dm-no-abstract-csr") + + if not self.support_hasel: + cmd.append("--dm-no-hasel") + + if not self.support_haltgroups: + cmd.append("--dm-no-halt-groups") + + if 'V' in isa[2:]: + cmd.append("--varch=vlen:%d,elen:%d,slen:%d" % (self.vlen, + self.elen, self.slen)) + + assert len(set(t.ram for t in harts)) == 1, \ + "All spike harts must have the same RAM layout" + assert len(set(t.ram_size for t in harts)) == 1, \ + "All spike harts must have the same RAM layout" + os.environ['WORK_AREA'] = '0x%x' % harts[0].ram + cmd += ["-m0x%x:0x%x" % (harts[0].ram, harts[0].ram_size)] + + if timeout: + cmd = ["timeout", str(timeout)] + cmd + + if halted: + cmd.append('-H') + if with_jtag_gdb: + cmd += ['--rbb-port', '0'] + os.environ['REMOTE_BITBANG_HOST'] = 'localhost' + + return cmd + + def __del__(self): + if self.process: + try: + self.process.kill() + self.process.wait() + except OSError: + pass + + def wait(self, *args, **kwargs): + return self.process.wait(*args, **kwargs) + +class VcsSim: + logfile = tempfile.NamedTemporaryFile(prefix='simv', suffix='.log') + logname = logfile.name + + def __init__(self, sim_cmd=None, debug=False, timeout=300): + if sim_cmd: + cmd = shlex.split(sim_cmd) + else: + cmd = ["simv"] + cmd += ["+jtag_vpi_enable"] + if debug: + cmd[0] = cmd[0] + "-debug" + cmd += ["+vcdplusfile=output/gdbserver.vpd"] + + logfile = open(self.logname, "w") + if print_log_names: + real_stdout.write("Temporary VCS log: %s\n" % self.logname) + logfile.write("+ %s\n" % " ".join(cmd)) + logfile.flush() + + listenfile = open(self.logname, "r") + listenfile.seek(0, 2) + self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE, + stdout=logfile, stderr=logfile) + done = False + start = time.time() + while not done: + # Fail if VCS exits early + exit_code = self.process.poll() + if exit_code is not None: + raise RuntimeError('VCS simulator exited early with status %d' + % exit_code) + + line = listenfile.readline() + if not line: + time.sleep(1) + match = re.match(r"^Listening on port (\d+)$", line) + if match: + done = True + self.port = int(match.group(1)) + os.environ['JTAG_VPI_PORT'] = str(self.port) + + if (time.time() - start) > timeout: + raise Exception("Timed out waiting for VCS to listen for JTAG " + "vpi") + + def __del__(self): + try: + self.process.kill() + self.process.wait() + except OSError: + pass + +class Openocd: + logfile = tempfile.NamedTemporaryFile(prefix='openocd', suffix='.log') + logname = logfile.name + + def __init__(self, server_cmd=None, config=None, debug=False, timeout=60): + self.timeout = timeout + + if server_cmd: + cmd = shlex.split(server_cmd) + else: + cmd = ["openocd"] + if debug: + cmd.append("-d") + + # This command needs to come before any config scripts on the command + # line, since they are executed in order. + cmd += [ + # Tell OpenOCD to bind gdb to an unused, ephemeral port. + "--command", + "gdb_port 0", + # Disable tcl and telnet servers, since they are unused and because + # the port numbers will conflict if multiple OpenOCD processes are + # running on the same server. + "--command", + "tcl_port disabled", + "--command", + "telnet_port disabled", + ] + + if config: + self.config_file = find_file(config) + if self.config_file is None: + print("Unable to read file", config) + sys.exit(1) + + cmd += ["-f", self.config_file] + if debug: + cmd.append("-d") + + raw_logfile = open(Openocd.logname, "wb") + try: + spike_dasm = subprocess.Popen("spike-dasm", stdin=subprocess.PIPE, + stdout=raw_logfile, stderr=raw_logfile) + logfile = spike_dasm.stdin + except FileNotFoundError: + logfile = raw_logfile + if print_log_names: + real_stdout.write("Temporary OpenOCD log: %s\n" % Openocd.logname) + env_entries = ("REMOTE_BITBANG_HOST", "REMOTE_BITBANG_PORT", + "WORK_AREA") + env_entries = [key for key in env_entries if key in os.environ] + logfile.write(("+ %s%s\n" % ( + "".join("%s=%s " % (key, os.environ[key]) for key in env_entries), + " ".join(map(pipes.quote, cmd)))).encode()) + logfile.flush() + + self.gdb_ports = [] + self.process = self.start(cmd, logfile) + + def start(self, cmd, logfile): + process = subprocess.Popen(cmd, stdin=subprocess.PIPE, + stdout=logfile, stderr=logfile) + + try: + # Wait for OpenOCD to have made it through riscv_examine(). When + # using OpenOCD to communicate with a simulator this may take a + # long time, and gdb will time out when trying to connect if we + # attempt too early. + start = time.time() + messaged = False + fd = open(Openocd.logname, "r") + while True: + line = fd.readline() + if not line: + if not process.poll() is None: + raise Exception("OpenOCD exited early.") + time.sleep(0.1) + continue + + m = re.search(r"Listening on port (\d+) for gdb connections", + line) + if m: + self.gdb_ports.append(int(m.group(1))) + + if "telnet server disabled" in line: + return process + + if not messaged and time.time() - start > 1: + messaged = True + print("Waiting for OpenOCD to start...") + if (time.time() - start) > self.timeout: + raise Exception("Timed out waiting for OpenOCD to " + "listen for gdb") + + except Exception: + print_log(Openocd.logname) + raise + + def __del__(self): + try: + self.process.terminate() + start = time.time() + while time.time() < start + 10: + if self.process.poll(): + break + else: + self.process.kill() + except (OSError, AttributeError): + pass + + def smp(self): + """Return true iff OpenOCD internally sees the harts as part of an SMP + group.""" + for line in open(self.config_file, "r"): + if "target smp" in line: + return True + return False + +class OpenocdCli: + def __init__(self, port=4444): + self.child = pexpect.spawn( + "sh -c 'telnet localhost %d | tee openocd-cli.log'" % port) + self.child.expect("> ") + + def command(self, cmd): + self.child.sendline(cmd) + self.child.expect(cmd) + self.child.expect("\n") + self.child.expect("> ") + return self.child.before.strip("\t\r\n \0").decode("utf-8") + + def reg(self, reg=''): + output = self.command("reg %s" % reg) + matches = re.findall(r"(\w+) \(/\d+\): (0x[0-9A-F]+)", output) + values = {r: int(v, 0) for r, v in matches} + if reg: + return values[reg] + return values + + def load_image(self, image): + output = self.command("load_image %s" % image) + if 'invalid ELF file, only 32bits files are supported' in output: + raise TestNotApplicable(output) + +class CannotAccess(Exception): + def __init__(self, address): + Exception.__init__(self) + self.address = address + +class CannotInsertBreakpoint(Exception): + def __init__(self, number): + Exception.__init__(self) + self.number = number + +class CouldNotFetch(Exception): + def __init__(self, regname, explanation): + Exception.__init__(self) + self.regname = regname + self.explanation = explanation + +class NoSymbol(Exception): + def __init__(self, symbol): + Exception.__init__(self) + self.symbol = symbol + +Thread = collections.namedtuple('Thread', ('id', 'description', 'target_id', + 'name', 'frame')) + +class Repeat: + def __init__(self, count): + self.count = count + +def tokenize(text): + index = 0 + while index < len(text): + for regex, fn in ( + (r"[\s]+", lambda m: None), + (r"[,{}=]", lambda m: m.group(0)), + (r"0x[\da-fA-F]+", lambda m: int(m.group(0)[2:], 16)), + (r"-?\d*\.\d+(e[-+]\d+)?", lambda m: float(m.group(0))), + (r"-?\d+", lambda m: int(m.group(0))), + (r"-?nan\(0x[a-f0-9]+\)", lambda m: float("nan")), + (r"", lambda m: Repeat(int(m.group(1)))), + (r"Could not fetch register \"(\w+)\"; (.*)$", + lambda m: CouldNotFetch(m.group(1), m.group(2))), + (r"Cannot access memory at address (0x[0-9a-f]+)", + lambda m: CannotAccess(int(m.group(1), 0))), + (r"Cannot insert breakpoint (\d+).", + lambda m: CannotInsertBreakpoint(int(m.group(1)))), + (r'No symbol "(\w+)" in current context.', + lambda m: NoSymbol(m.group(1))), + (r'"([^"]*)"', lambda m: m.group(1)), + (r"[a-zA-Z][a-zA-Z\d]*", lambda m: m.group(0)), + ): + m = re.match(regex, text[index:]) + if m: + index += len(m.group(0)) + token = fn(m) + if not token is None: + yield token + break + else: + raise Exception(repr(text[index:])) + +def parse_dict(tokens): + assert tokens[0] == "{" + tokens.pop(0) + result = {} + while True: + key = tokens.pop(0) + assert tokens.pop(0) == "=" + value = parse_tokens(tokens) + result[key] = value + token = tokens.pop(0) + if token == "}": + return result + assert token == "," + +def parse_list(tokens): + assert tokens[0] == "{" + tokens.pop(0) + result = [] + while True: + result.append(tokens.pop(0)) + token = tokens.pop(0) + if isinstance(token, Repeat): + result += [result[-1]] * (token.count - 1) + token = tokens.pop(0) + if token == "}": + return result + assert token == "," + +def parse_dict_or_list(tokens): + assert tokens[0] == "{" + if tokens[2] == "=": + return parse_dict(tokens) + else: + return parse_list(tokens) + +def parse_tokens(tokens): + if isinstance(tokens[0], Exception): + raise tokens[0] + if isinstance(tokens[0], (float, int)): + return tokens.pop(0) + if tokens[0] == "{": + return parse_dict_or_list(tokens) + if isinstance(tokens[0], str): + return tokens.pop(0) + raise Exception("Unsupported tokens: %r" % tokens) + +def parse_rhs(text): + tokens = list(tokenize(text)) + result = parse_tokens(tokens) + if tokens: + raise Exception("Unexpected input: %r" % tokens) + return result + +class Gdb: + """A single gdb class which can interact with one or more gdb instances.""" + + # pylint: disable=too-many-public-methods + # pylint: disable=too-many-instance-attributes + + reset_delays = (127, 181, 17, 13, 83, 151, 31, 67, 131, 167, 23, 41, 61, + 11, 149, 107, 163, 73, 47, 43, 173, 7, 109, 101, 103, 191, 2, 139, + 97, 193, 157, 3, 29, 79, 113, 5, 89, 19, 37, 71, 179, 59, 137, 53) + + def __init__(self, ports, + cmd="riscv64-unknown-elf-gdb", + timeout=60, binary=None): + assert ports + + self.ports = ports + self.cmd = cmd + self.timeout = timeout + self.binary = binary + + self.reset_delay_index = 0 + self.stack = [] + self.harts = {} + + self.logfiles = [] + self.children = [] + for port in ports: + logfile = tempfile.NamedTemporaryFile(prefix="gdb@%d-" % port, + suffix=".log") + self.logfiles.append(logfile) + if print_log_names: + real_stdout.write("Temporary gdb log: %s\n" % logfile.name) + child = pexpect.spawn(cmd) + child.logfile = logfile + child.logfile.write(("+ %s\n" % cmd).encode()) + self.children.append(child) + self.active_child = self.children[0] + + def connect(self): + for port, child in zip(self.ports, self.children): + self.select_child(child) + self.wait() + self.command("set style enabled off") + self.command("set confirm off") + self.command("set width 0") + self.command("set height 0") + # Force consistency. + self.command("set print entry-values no") + self.command("set remotetimeout %d" % self.timeout) + self.command("target extended-remote localhost:%d" % port, ops=10) + if self.binary: + self.command("file %s" % self.binary) + threads = self.threads() + for t in threads: + hartid = None + if t.name: + m = re.search(r"Hart (\d+)", t.name) + if m: + hartid = int(m.group(1)) + if hartid is None: + if self.harts: + hartid = max(self.harts) + 1 + else: + hartid = 0 + # solo: True iff this is the only thread on this child + self.harts[hartid] = {'child': child, + 'thread': t, + 'solo': len(threads) == 1} + + def __del__(self): + for child in self.children: + del child + + def one_hart_per_gdb(self): + return all(h['solo'] for h in self.harts.values()) + + def lognames(self): + return [logfile.name for logfile in self.logfiles] + + def select_child(self, child): + self.active_child = child + + def select_hart(self, hart): + h = self.harts[hart.id] + self.select_child(h['child']) + if not h['solo']: + output = self.command("thread %s" % h['thread'].id, ops=5) + assert "Unknown" not in output + + def push_state(self): + self.stack.append({ + 'active_child': self.active_child + }) + + def pop_state(self): + state = self.stack.pop() + self.active_child = state['active_child'] + + def wait(self): + """Wait for prompt.""" + self.active_child.expect(r"\(gdb\)") + + def command(self, command, ops=1, reset_delays=0): + """ops is the estimated number of operations gdb will have to perform + to perform this command. It is used to compute a timeout based on + self.timeout.""" + if not reset_delays is None: + if reset_delays == 0: + reset_delays = self.reset_delays[self.reset_delay_index] + self.reset_delay_index = (self.reset_delay_index + 1) % \ + len(self.reset_delays) + self.command("monitor riscv reset_delays %d" % reset_delays, + reset_delays=None) + timeout = ops * self.timeout + self.active_child.sendline(command) + self.active_child.expect("\n", timeout=timeout) + self.active_child.expect(r"\(gdb\)", timeout=timeout) + return self.active_child.before.strip().decode("utf-8") + + def global_command(self, command): + """Execute this command on every gdb that we control.""" + with PrivateState(self): + for child in self.children: + self.select_child(child) + self.command(command) + + def c(self, wait=True, sync=True, checkOutput=True, ops=20): + """ + Dumb c command. + In RTOS mode, gdb will resume all harts. + In multi-gdb mode, this command will just go to the current gdb, so + will only resume one hart. + """ + if sync: + sync = "" + else: + sync = "&" + if wait: + output = self.command("c%s" % sync, ops=ops) + if checkOutput: + assert "Continuing" in output + assert "Could not insert hardware" not in output + return output + else: + self.active_child.sendline("c%s" % sync) + self.active_child.expect("Continuing", timeout=ops * self.timeout) + return "" + + def c_all(self, wait=True): + """ + Resume every hart. + + This function works fine when using multiple gdb sessions, but the + caller must be careful when using it nonetheless. gdb's behavior is to + not set breakpoints until just before the hart is resumed, and then + clears them as soon as the hart halts. That means that you can't set + one software breakpoint, and expect multiple harts to hit it. It's + possible that the first hart completes set/run/halt/clear before the + second hart even gets to resume, so it will never hit the breakpoint. + """ + with PrivateState(self): + for child in self.children: + child.sendline("c") + child.expect("Continuing") + + if wait: + for child in self.children: + child.expect(r"\(gdb\)") + + def interrupt(self, ops=1): + self.active_child.send("\003") + self.active_child.expect(r"\(gdb\)", timeout=self.timeout * ops) + return self.active_child.before.strip().decode() + + def interrupt_all(self): + for child in self.children: + self.select_child(child) + self.interrupt() + + def x(self, address, size='w', count=1): + output = self.command("x/%d%s %s" % (count, size, address)) + values = [] + for line in output.splitlines(): + for value in line.split(':')[1].strip().split(): + values.append(int(value, 0)) + if len(values) == 1: + return values[0] + return values + + def p_raw(self, obj): + output = self.command("p %s" % obj) + m = re.search("Cannot access memory at address (0x[0-9a-f]+)", output) + if m: + raise CannotAccess(int(m.group(1), 0)) + return output.split('=', 1)[-1].strip() + + def p(self, obj, fmt="/x", ops=1): + output = self.command("p%s %s" % (fmt, obj), ops=ops).splitlines()[-1] + rhs = output.split('=', 1)[-1] + return parse_rhs(rhs) + + def p_fpr(self, obj, ops=1): + result = self.p(obj, fmt="", ops=ops) + if isinstance(result, dict): + return result['double'] + return result + + def p_string(self, obj): + output = self.command("p %s" % obj) + value = shlex.split(output.split('=')[-1].strip())[1] + return value + + def info_registers(self, group): + output = self.command("info registers %s" % group, ops=5) + result = {} + for line in output.splitlines(): + m = re.match(r"(\w+)\s+({.*})(?:\s+(\(.*\)))?", line) + if m: + parts = m.groups() + else: + parts = line.split() + name = parts[0] + if "Could not fetch" in line: + result[name] = " ".join(parts[1:]) + else: + result[name] = parse_rhs(parts[1]) + return result + + def stepi(self): + output = self.command("stepi", ops=10) + return output + + def load(self): + output = self.command("load", ops=1000) + assert "failed" not in output + assert "Transfer rate" in output + output = self.command("compare-sections", ops=1000) + assert "matched" in output + assert "MIS" not in output + + def b(self, location): + output = self.command("b %s" % location, ops=5) + assert "not defined" not in output + assert "Breakpoint" in output + m = re.search(r"Breakpoint (\d+),? ", output) + assert m, output + return int(m.group(1)) + + def hbreak(self, location): + output = self.command("hbreak %s" % location, ops=5) + assert "not defined" not in output + assert "Hardware assisted breakpoint" in output + return output + + def watch(self, expr): + output = self.command("watch %s" % expr, ops=5) + assert "not defined" not in output + assert "atchpoint" in output + return output + + def swatch(self, expr): + self.command("show can-use-hw-watchpoints") + self.command("set can-use-hw-watchpoints 0") + output = self.command("watch %s" % expr, ops=5) + assert "not defined" not in output + assert "atchpoint" in output + self.command("set can-use-hw-watchpoints 1") + return output + + def threads(self): + output = self.command("info threads", ops=100) + threads = [] + for line in output.splitlines(): + m = re.match( + r"[\s\*]*(\d+)\s*" + r"(Remote target|Thread (\d+)\s*\(Name: ([^\)]+))" + r"\s*(.*)", line) + if m: + threads.append(Thread(*m.groups())) + assert threads + #>>>if not threads: + #>>> threads.append(Thread('1', '1', 'Default', '???')) + return threads + + def thread(self, thread): + return self.command("thread %s" % thread.id) + + def where(self): + return self.command("where 1") + +class PrivateState: + def __init__(self, gdb): + self.gdb = gdb + + def __enter__(self): + self.gdb.push_state() + + def __exit__(self, _type, _value, _traceback): + self.gdb.pop_state() + +def run_all_tests(module, target, parsed): + todo = [] + for name in dir(module): + definition = getattr(module, name) + if isinstance(definition, type) and hasattr(definition, 'test') and \ + (not parsed.test or any(test in name for test in parsed.test)): + todo.append((name, definition, None)) + + if parsed.list_tests: + for name, definition, hart in todo: + print(name) + return 0 + + try: + os.makedirs(parsed.logs) + except OSError: + # There's a race where multiple instances of the test program might + # decide to create the logs directory at the same time. + pass + + overall_start = time.time() + + global gdb_cmd # pylint: disable=global-statement + gdb_cmd = parsed.gdb + global gcc_cmd # pylint: disable=global-statement + gcc_cmd = parsed.gcc + + examine_added = False + for hart in target.harts: + if parsed.misaval: + hart.misa = int(parsed.misaval, 16) + print("Using $misa from command line: 0x%x" % hart.misa) + elif hart.misa: + print("Using $misa from hart definition: 0x%x" % hart.misa) + elif not examine_added: + todo.insert(0, ("ExamineTarget", ExamineTarget, None)) + examine_added = True + + results, count = run_tests(parsed, target, todo) + + header("ran %d tests in %.0fs" % (count, time.time() - overall_start), + dash=':') + + return print_results(results) + +good_results = set(('pass', 'not_applicable')) +def run_tests(parsed, target, todo): + results = {} + count = 0 + + for name, definition, hart in todo: + log_name = os.path.join(parsed.logs, "%s-%s-%s.log" % + (time.strftime("%Y%m%d-%H%M%S"), type(target).__name__, name)) + log_fd = open(log_name, 'w') + print("[%s] Starting > %s" % (name, log_name)) + instance = definition(target, hart) + sys.stdout.flush() + log_fd.write("Test: %s\n" % name) + log_fd.write("Target: %s\n" % type(target).__name__) + start = time.time() + global real_stdout # pylint: disable=global-statement + real_stdout = sys.stdout + sys.stdout = log_fd + try: + result = instance.run() + log_fd.write("Result: %s\n" % result) + log_fd.write("Logfile: %s\n" % log_name) + log_fd.write("Reproduce: %s %s %s\n" % (sys.argv[0], parsed.target, + name)) + finally: + sys.stdout = real_stdout + log_fd.write("Time elapsed: %.2fs\n" % (time.time() - start)) + log_fd.flush() + print("[%s] %s in %.2fs" % (name, result, time.time() - start)) + if result not in good_results and parsed.print_failures: + sys.stdout.write(open(log_name).read()) + sys.stdout.flush() + results.setdefault(result, []).append((name, log_name)) + count += 1 + if result not in good_results and parsed.fail_fast: + break + + return results, count + +def print_results(results): + result = 0 + for key, value in results.items(): + print("%d tests returned %s" % (len(value), key)) + if key not in good_results: + result = 1 + for name, log_name in value: + print(" %s > %s" % (name, log_name)) + + return result + +def add_test_run_options(parser): + parser.add_argument("--logs", default="logs", + help="Store logs in the specified directory.") + parser.add_argument("--fail-fast", "-f", action="store_true", + help="Exit as soon as any test fails.") + parser.add_argument("--print-failures", action="store_true", + help="When a test fails, print the log file to stdout.") + parser.add_argument("--print-log-names", "--pln", action="store_true", + help="Print names of temporary log files as soon as they are " + "created.") + parser.add_argument("--list-tests", action="store_true", + help="Print out a list of tests, and exit immediately.") + parser.add_argument("test", nargs='*', + help="Run only tests that are named here.") + parser.add_argument("--gcc", + help="The command to use to start gcc.") + parser.add_argument("--gdb", + help="The command to use to start gdb.") + parser.add_argument("--misaval", + help="Don't run ExamineTarget, just assume the misa value which is " + "specified.") + +def header(title, dash='-', length=78): + if title: + dashes = dash * (length - 4 - len(title)) + before = dashes[:len(dashes)//2] + after = dashes[len(dashes)//2:] + print("%s[ %s ]%s" % (before, title, after)) + else: + print(dash * length) + +def print_log_handle(name, handle): + header(name) + for l in handle: + sys.stdout.write(l) + print() + +def print_log(path): + print_log_handle(path, open(path, "r")) + +class BaseTest: + compiled = {} + + def __init__(self, target, hart=None): + self.target = target + if hart: + self.hart = hart + else: + self.hart = random.choice(target.harts) + self.server = None + self.target_process = None + self.binary = None + self.start = 0 + self.logs = [] + + def early_applicable(self): + """Return a false value if the test has determined it cannot run + without ever needing to talk to the target or server.""" + # pylint: disable=no-self-use + return True + + def setup(self): + pass + + def compile(self): + compile_args = getattr(self, 'compile_args', None) + if compile_args: + if compile_args not in BaseTest.compiled: + BaseTest.compiled[compile_args] = \ + self.target.compile(self.hart, *compile_args) + self.binary = BaseTest.compiled.get(compile_args) + + def classSetup(self): + self.compile() + self.target_process = self.target.create() + if self.target_process: + self.logs.append(self.target_process.logname) + try: + self.server = self.target.server() + self.logs.append(self.server.logname) + except Exception: + for log in self.logs: + print_log(log) + raise + + def classTeardown(self): + del self.server + del self.target_process + + def postMortem(self): + pass + + def run(self): + """ + If compile_args is set, compile a program and set self.binary. + + Call setup(). + + Then call test() and return the result, displaying relevant information + if an exception is raised. + """ + + sys.stdout.flush() + + if self.__class__.__name__ in self.target.skip_tests or \ + not self.early_applicable(): + return "not_applicable" + + self.start = time.time() + + try: + self.classSetup() + self.setup() + result = self.test() # pylint: disable=no-member + except TestNotApplicable: + result = "not_applicable" + except Exception as e: # pylint: disable=broad-except + if isinstance(e, TestFailed): + result = "fail" + else: + result = "exception" + if isinstance(e, TestFailed): + # pylint: disable=no-member + header("Message") + print(e.message) + header("Traceback") + traceback.print_exc(file=sys.stdout) + try: + self.postMortem() + except Exception as e: # pylint: disable=broad-except + header("postMortem Exception") + print(e) + traceback.print_exc(file=sys.stdout) + return result + + finally: + # Get handles to logs before the files are deleted. + logs = [] + for log in self.logs: + logs.append((log, open(log, "r"))) + + self.classTeardown() + for name, handle in logs: + print_log_handle(name, handle) + header("End of logs") + + if not result: + result = 'pass' + return result + +gdb_cmd = None +class GdbTest(BaseTest): + def __init__(self, target, hart=None): + BaseTest.__init__(self, target, hart=hart) + self.gdb = None + + def write_nop_program(self, count): + for i in range(count): + # 0x13 is nop + self.gdb.command("p *((int*) 0x%x)=0x13" % (self.hart.ram + i * 4)) + self.gdb.p("$pc=0x%x" % self.hart.ram) + + def classSetup(self): + BaseTest.classSetup(self) + + if gdb_cmd: + self.gdb = Gdb(self.server.gdb_ports, gdb_cmd, + timeout=self.target.timeout_sec, binary=self.binary) + else: + self.gdb = Gdb(self.server.gdb_ports, + timeout=self.target.timeout_sec, binary=self.binary) + + self.logs += self.gdb.lognames() + self.gdb.connect() + + self.gdb.global_command("set remotetimeout %d" % + self.target.timeout_sec) + + for cmd in self.target.gdb_setup: + self.gdb.command(cmd) + + self.gdb.select_hart(self.hart) + + # FIXME: OpenOCD doesn't handle PRIV now + #self.gdb.p("$priv=3") + + def postMortem(self): + if not self.gdb: + return + self.gdb.interrupt() + self.gdb.command("info breakpoints", reset_delays=None) + self.gdb.command("disassemble", ops=20, reset_delays=None) + self.gdb.command("info registers all", ops=20, reset_delays=None) + self.gdb.command("flush regs", reset_delays=None) + self.gdb.command("info threads", ops=20, reset_delays=None) + + def classTeardown(self): + del self.gdb + BaseTest.classTeardown(self) + + def parkOtherHarts(self): + """Park harts besides the currently selected one in loop_forever().""" + for hart in self.target.harts: + # Park all harts that we're not using in a safe place. + if hart != self.hart: + self.gdb.select_hart(hart) + self.gdb.p("$pc=loop_forever") + + self.gdb.select_hart(self.hart) + + def disable_pmp(self): + # Disable physical memory protection by allowing U mode access to all + # memory. + try: + self.gdb.p("$pmpcfg0=0xf") # TOR, R, W, X + self.gdb.p("$pmpaddr0=0x%x" % + ((self.hart.ram + self.hart.ram_size) >> 2)) + except CouldNotFetch: + # PMP registers are optional + pass + +class GdbSingleHartTest(GdbTest): + def classSetup(self): + GdbTest.classSetup(self) + self.parkOtherHarts() + +class ExamineTarget(GdbTest): + def test(self): + for hart in self.target.harts: + self.gdb.select_hart(hart) + + hart.misa = self.gdb.p("$misa") + + txt = "RV" + misa_xlen = 0 + if ((hart.misa & 0xFFFFFFFF) >> 30) == 1: + misa_xlen = 32 + elif ((hart.misa & 0xFFFFFFFFFFFFFFFF) >> 62) == 2: + misa_xlen = 64 + elif ((hart.misa & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) >> 126) == 3: + misa_xlen = 128 + else: + raise TestFailed("Couldn't determine XLEN from $misa (0x%x)" % + self.hart.misa) + + if misa_xlen != hart.xlen: + raise TestFailed("MISA reported XLEN of %d but we were "\ + "expecting XLEN of %d\n" % (misa_xlen, hart.xlen)) + + txt += ("%d" % misa_xlen) + + for i in range(26): + if hart.misa & (1< b: + raise TestFailed("%r not greater than %r" % (a, b)) + +def assertLess(a, b, comment=None): + if not a < b: + raise TestFailed("%r not less than %r" % (a, b), comment) + +def assertTrue(a): + if not a: + raise TestFailed("%r is not True" % a) + +def assertRegex(text, regexp): + if not re.search(regexp, text): + raise TestFailed("can't find %r in %r" % (regexp, text)) diff --git a/apps/riscv-tests/env/LICENSE b/apps/riscv-tests/env/LICENSE new file mode 100644 index 0000000..48fe522 --- /dev/null +++ b/apps/riscv-tests/env/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2012-2015, The Regents of the University of California (Regents). +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the Regents nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/apps/riscv-tests/env/encoding.h b/apps/riscv-tests/env/encoding.h new file mode 100644 index 0000000..584bc27 --- /dev/null +++ b/apps/riscv-tests/env/encoding.h @@ -0,0 +1,2828 @@ +/* See LICENSE for license details. */ + +#ifndef RISCV_CSR_ENCODING_H +#define RISCV_CSR_ENCODING_H + +#define MSTATUS_UIE 0x00000001 +#define MSTATUS_SIE 0x00000002 +#define MSTATUS_HIE 0x00000004 +#define MSTATUS_MIE 0x00000008 +#define MSTATUS_UPIE 0x00000010 +#define MSTATUS_SPIE 0x00000020 +#define MSTATUS_HPIE 0x00000040 +#define MSTATUS_MPIE 0x00000080 +#define MSTATUS_SPP 0x00000100 +#define MSTATUS_VS 0x00000600 +#define MSTATUS_MPP 0x00001800 +#define MSTATUS_FS 0x00006000 +#define MSTATUS_XS 0x00018000 +#define MSTATUS_MPRV 0x00020000 +#define MSTATUS_SUM 0x00040000 +#define MSTATUS_MXR 0x00080000 +#define MSTATUS_TVM 0x00100000 +#define MSTATUS_TW 0x00200000 +#define MSTATUS_TSR 0x00400000 +#define MSTATUS32_SD 0x80000000 +#define MSTATUS_UXL 0x0000000300000000 +#define MSTATUS_SXL 0x0000000C00000000 +#define MSTATUS64_SD 0x8000000000000000 + +#define SSTATUS_UIE 0x00000001 +#define SSTATUS_SIE 0x00000002 +#define SSTATUS_UPIE 0x00000010 +#define SSTATUS_SPIE 0x00000020 +#define SSTATUS_SPP 0x00000100 +#define SSTATUS_VS 0x00000600 +#define SSTATUS_FS 0x00006000 +#define SSTATUS_XS 0x00018000 +#define SSTATUS_SUM 0x00040000 +#define SSTATUS_MXR 0x00080000 +#define SSTATUS32_SD 0x80000000 +#define SSTATUS_UXL 0x0000000300000000 +#define SSTATUS64_SD 0x8000000000000000 + +#define USTATUS_UIE 0x00000001 +#define USTATUS_UPIE 0x00000010 + +#define DCSR_XDEBUGVER (3U<<30) +#define DCSR_NDRESET (1<<29) +#define DCSR_FULLRESET (1<<28) +#define DCSR_EBREAKM (1<<15) +#define DCSR_EBREAKH (1<<14) +#define DCSR_EBREAKS (1<<13) +#define DCSR_EBREAKU (1<<12) +#define DCSR_STOPCYCLE (1<<10) +#define DCSR_STOPTIME (1<<9) +#define DCSR_CAUSE (7<<6) +#define DCSR_DEBUGINT (1<<5) +#define DCSR_HALT (1<<3) +#define DCSR_STEP (1<<2) +#define DCSR_PRV (3<<0) + +#define DCSR_CAUSE_NONE 0 +#define DCSR_CAUSE_SWBP 1 +#define DCSR_CAUSE_HWBP 2 +#define DCSR_CAUSE_DEBUGINT 3 +#define DCSR_CAUSE_STEP 4 +#define DCSR_CAUSE_HALT 5 + +#define MCONTROL_TYPE(xlen) (0xfULL<<((xlen)-4)) +#define MCONTROL_DMODE(xlen) (1ULL<<((xlen)-5)) +#define MCONTROL_MASKMAX(xlen) (0x3fULL<<((xlen)-11)) + +#define MCONTROL_SELECT (1<<19) +#define MCONTROL_TIMING (1<<18) +#define MCONTROL_ACTION (0x3f<<12) +#define MCONTROL_CHAIN (1<<11) +#define MCONTROL_MATCH (0xf<<7) +#define MCONTROL_M (1<<6) +#define MCONTROL_H (1<<5) +#define MCONTROL_S (1<<4) +#define MCONTROL_U (1<<3) +#define MCONTROL_EXECUTE (1<<2) +#define MCONTROL_STORE (1<<1) +#define MCONTROL_LOAD (1<<0) + +#define MCONTROL_TYPE_NONE 0 +#define MCONTROL_TYPE_MATCH 2 + +#define MCONTROL_ACTION_DEBUG_EXCEPTION 0 +#define MCONTROL_ACTION_DEBUG_MODE 1 +#define MCONTROL_ACTION_TRACE_START 2 +#define MCONTROL_ACTION_TRACE_STOP 3 +#define MCONTROL_ACTION_TRACE_EMIT 4 + +#define MCONTROL_MATCH_EQUAL 0 +#define MCONTROL_MATCH_NAPOT 1 +#define MCONTROL_MATCH_GE 2 +#define MCONTROL_MATCH_LT 3 +#define MCONTROL_MATCH_MASK_LOW 4 +#define MCONTROL_MATCH_MASK_HIGH 5 + +#define MIP_USIP (1 << IRQ_U_SOFT) +#define MIP_SSIP (1 << IRQ_S_SOFT) +#define MIP_HSIP (1 << IRQ_H_SOFT) +#define MIP_MSIP (1 << IRQ_M_SOFT) +#define MIP_UTIP (1 << IRQ_U_TIMER) +#define MIP_STIP (1 << IRQ_S_TIMER) +#define MIP_HTIP (1 << IRQ_H_TIMER) +#define MIP_MTIP (1 << IRQ_M_TIMER) +#define MIP_UEIP (1 << IRQ_U_EXT) +#define MIP_SEIP (1 << IRQ_S_EXT) +#define MIP_HEIP (1 << IRQ_H_EXT) +#define MIP_MEIP (1 << IRQ_M_EXT) + +#define SIP_SSIP MIP_SSIP +#define SIP_STIP MIP_STIP + +#define PRV_U 0 +#define PRV_S 1 +#define PRV_H 2 +#define PRV_M 3 + +#define SATP32_MODE 0x80000000 +#define SATP32_ASID 0x7FC00000 +#define SATP32_PPN 0x003FFFFF +#define SATP64_MODE 0xF000000000000000 +#define SATP64_ASID 0x0FFFF00000000000 +#define SATP64_PPN 0x00000FFFFFFFFFFF + +#define SATP_MODE_OFF 0 +#define SATP_MODE_SV32 1 +#define SATP_MODE_SV39 8 +#define SATP_MODE_SV48 9 +#define SATP_MODE_SV57 10 +#define SATP_MODE_SV64 11 + +#define PMP_R 0x01 +#define PMP_W 0x02 +#define PMP_X 0x04 +#define PMP_A 0x18 +#define PMP_L 0x80 +#define PMP_SHIFT 2 + +#define PMP_TOR 0x08 +#define PMP_NA4 0x10 +#define PMP_NAPOT 0x18 + +#define IRQ_U_SOFT 0 +#define IRQ_S_SOFT 1 +#define IRQ_H_SOFT 2 +#define IRQ_M_SOFT 3 +#define IRQ_U_TIMER 4 +#define IRQ_S_TIMER 5 +#define IRQ_H_TIMER 6 +#define IRQ_M_TIMER 7 +#define IRQ_U_EXT 8 +#define IRQ_S_EXT 9 +#define IRQ_H_EXT 10 +#define IRQ_M_EXT 11 +#define IRQ_COP 12 +#define IRQ_HOST 13 + +#define DEFAULT_RSTVEC 0x00001000 +#define CLINT_BASE 0x02000000 +#define CLINT_SIZE 0x000c0000 +#define EXT_IO_BASE 0x40000000 +#define DRAM_BASE 0x80000000 + +/* page table entry (PTE) fields */ +#define PTE_V 0x001 /* Valid */ +#define PTE_R 0x002 /* Read */ +#define PTE_W 0x004 /* Write */ +#define PTE_X 0x008 /* Execute */ +#define PTE_U 0x010 /* User */ +#define PTE_G 0x020 /* Global */ +#define PTE_A 0x040 /* Accessed */ +#define PTE_D 0x080 /* Dirty */ +#define PTE_SOFT 0x300 /* Reserved for Software */ + +#define PTE_PPN_SHIFT 10 + +#define PTE_TABLE(PTE) (((PTE) & (PTE_V | PTE_R | PTE_W | PTE_X)) == PTE_V) + +#ifdef __riscv + +#if __riscv_xlen == 64 +# define MSTATUS_SD MSTATUS64_SD +# define SSTATUS_SD SSTATUS64_SD +# define RISCV_PGLEVEL_BITS 9 +# define SATP_MODE SATP64_MODE +#else +# define MSTATUS_SD MSTATUS32_SD +# define SSTATUS_SD SSTATUS32_SD +# define RISCV_PGLEVEL_BITS 10 +# define SATP_MODE SATP32_MODE +#endif +#define RISCV_PGSHIFT 12 +#define RISCV_PGSIZE (1 << RISCV_PGSHIFT) + +#ifndef __ASSEMBLER__ + +#ifdef __GNUC__ + +#define read_csr(reg) ({ unsigned long __tmp; \ + asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \ + __tmp; }) + +#define write_csr(reg, val) ({ \ + asm volatile ("csrw " #reg ", %0" :: "rK"(val)); }) + +#define swap_csr(reg, val) ({ unsigned long __tmp; \ + asm volatile ("csrrw %0, " #reg ", %1" : "=r"(__tmp) : "rK"(val)); \ + __tmp; }) + +#define set_csr(reg, bit) ({ unsigned long __tmp; \ + asm volatile ("csrrs %0, " #reg ", %1" : "=r"(__tmp) : "rK"(bit)); \ + __tmp; }) + +#define clear_csr(reg, bit) ({ unsigned long __tmp; \ + asm volatile ("csrrc %0, " #reg ", %1" : "=r"(__tmp) : "rK"(bit)); \ + __tmp; }) + +#define rdtime() read_csr(time) +#define rdcycle() read_csr(cycle) +#define rdinstret() read_csr(instret) + +#endif + +#endif + +#endif + +#endif +/* Automatically generated by parse_opcodes. */ +#ifndef RISCV_ENCODING_H +#define RISCV_ENCODING_H +#define MATCH_SLLI_RV32 0x1013 +#define MASK_SLLI_RV32 0xfe00707f +#define MATCH_SRLI_RV32 0x5013 +#define MASK_SRLI_RV32 0xfe00707f +#define MATCH_SRAI_RV32 0x40005013 +#define MASK_SRAI_RV32 0xfe00707f +#define MATCH_FRFLAGS 0x102073 +#define MASK_FRFLAGS 0xfffff07f +#define MATCH_FSFLAGS 0x101073 +#define MASK_FSFLAGS 0xfff0707f +#define MATCH_FSFLAGSI 0x105073 +#define MASK_FSFLAGSI 0xfff0707f +#define MATCH_FRRM 0x202073 +#define MASK_FRRM 0xfffff07f +#define MATCH_FSRM 0x201073 +#define MASK_FSRM 0xfff0707f +#define MATCH_FSRMI 0x205073 +#define MASK_FSRMI 0xfff0707f +#define MATCH_FSCSR 0x301073 +#define MASK_FSCSR 0xfff0707f +#define MATCH_FRCSR 0x302073 +#define MASK_FRCSR 0xfffff07f +#define MATCH_RDCYCLE 0xc0002073 +#define MASK_RDCYCLE 0xfffff07f +#define MATCH_RDTIME 0xc0102073 +#define MASK_RDTIME 0xfffff07f +#define MATCH_RDINSTRET 0xc0202073 +#define MASK_RDINSTRET 0xfffff07f +#define MATCH_RDCYCLEH 0xc8002073 +#define MASK_RDCYCLEH 0xfffff07f +#define MATCH_RDTIMEH 0xc8102073 +#define MASK_RDTIMEH 0xfffff07f +#define MATCH_RDINSTRETH 0xc8202073 +#define MASK_RDINSTRETH 0xfffff07f +#define MATCH_SCALL 0x73 +#define MASK_SCALL 0xffffffff +#define MATCH_SBREAK 0x100073 +#define MASK_SBREAK 0xffffffff +#define MATCH_FMV_X_S 0xe0000053 +#define MASK_FMV_X_S 0xfff0707f +#define MATCH_FMV_S_X 0xf0000053 +#define MASK_FMV_S_X 0xfff0707f +#define MATCH_FENCE_TSO 0x8330000f +#define MASK_FENCE_TSO 0xfff0707f +#define MATCH_PAUSE 0x100000f +#define MASK_PAUSE 0xffffffff +#define MATCH_BEQ 0x63 +#define MASK_BEQ 0x707f +#define MATCH_BNE 0x1063 +#define MASK_BNE 0x707f +#define MATCH_BLT 0x4063 +#define MASK_BLT 0x707f +#define MATCH_BGE 0x5063 +#define MASK_BGE 0x707f +#define MATCH_BLTU 0x6063 +#define MASK_BLTU 0x707f +#define MATCH_BGEU 0x7063 +#define MASK_BGEU 0x707f +#define MATCH_JALR 0x67 +#define MASK_JALR 0x707f +#define MATCH_JAL 0x6f +#define MASK_JAL 0x7f +#define MATCH_LUI 0x37 +#define MASK_LUI 0x7f +#define MATCH_AUIPC 0x17 +#define MASK_AUIPC 0x7f +#define MATCH_ADDI 0x13 +#define MASK_ADDI 0x707f +#define MATCH_SLLI 0x1013 +#define MASK_SLLI 0xfc00707f +#define MATCH_SLTI 0x2013 +#define MASK_SLTI 0x707f +#define MATCH_SLTIU 0x3013 +#define MASK_SLTIU 0x707f +#define MATCH_XORI 0x4013 +#define MASK_XORI 0x707f +#define MATCH_SRLI 0x5013 +#define MASK_SRLI 0xfc00707f +#define MATCH_SRAI 0x40005013 +#define MASK_SRAI 0xfc00707f +#define MATCH_ORI 0x6013 +#define MASK_ORI 0x707f +#define MATCH_ANDI 0x7013 +#define MASK_ANDI 0x707f +#define MATCH_ADD 0x33 +#define MASK_ADD 0xfe00707f +#define MATCH_SUB 0x40000033 +#define MASK_SUB 0xfe00707f +#define MATCH_SLL 0x1033 +#define MASK_SLL 0xfe00707f +#define MATCH_SLT 0x2033 +#define MASK_SLT 0xfe00707f +#define MATCH_SLTU 0x3033 +#define MASK_SLTU 0xfe00707f +#define MATCH_XOR 0x4033 +#define MASK_XOR 0xfe00707f +#define MATCH_SRL 0x5033 +#define MASK_SRL 0xfe00707f +#define MATCH_SRA 0x40005033 +#define MASK_SRA 0xfe00707f +#define MATCH_OR 0x6033 +#define MASK_OR 0xfe00707f +#define MATCH_AND 0x7033 +#define MASK_AND 0xfe00707f +#define MATCH_LB 0x3 +#define MASK_LB 0x707f +#define MATCH_LH 0x1003 +#define MASK_LH 0x707f +#define MATCH_LW 0x2003 +#define MASK_LW 0x707f +#define MATCH_LBU 0x4003 +#define MASK_LBU 0x707f +#define MATCH_LHU 0x5003 +#define MASK_LHU 0x707f +#define MATCH_SB 0x23 +#define MASK_SB 0x707f +#define MATCH_SH 0x1023 +#define MASK_SH 0x707f +#define MATCH_SW 0x2023 +#define MASK_SW 0x707f +#define MATCH_FENCE 0xf +#define MASK_FENCE 0x707f +#define MATCH_FENCE_I 0x100f +#define MASK_FENCE_I 0x707f +#define MATCH_ADDIW 0x1b +#define MASK_ADDIW 0x707f +#define MATCH_SLLIW 0x101b +#define MASK_SLLIW 0xfe00707f +#define MATCH_SRLIW 0x501b +#define MASK_SRLIW 0xfe00707f +#define MATCH_SRAIW 0x4000501b +#define MASK_SRAIW 0xfe00707f +#define MATCH_ADDW 0x3b +#define MASK_ADDW 0xfe00707f +#define MATCH_SUBW 0x4000003b +#define MASK_SUBW 0xfe00707f +#define MATCH_SLLW 0x103b +#define MASK_SLLW 0xfe00707f +#define MATCH_SRLW 0x503b +#define MASK_SRLW 0xfe00707f +#define MATCH_SRAW 0x4000503b +#define MASK_SRAW 0xfe00707f +#define MATCH_LD 0x3003 +#define MASK_LD 0x707f +#define MATCH_LWU 0x6003 +#define MASK_LWU 0x707f +#define MATCH_SD 0x3023 +#define MASK_SD 0x707f +#define MATCH_MUL 0x2000033 +#define MASK_MUL 0xfe00707f +#define MATCH_MULH 0x2001033 +#define MASK_MULH 0xfe00707f +#define MATCH_MULHSU 0x2002033 +#define MASK_MULHSU 0xfe00707f +#define MATCH_MULHU 0x2003033 +#define MASK_MULHU 0xfe00707f +#define MATCH_DIV 0x2004033 +#define MASK_DIV 0xfe00707f +#define MATCH_DIVU 0x2005033 +#define MASK_DIVU 0xfe00707f +#define MATCH_REM 0x2006033 +#define MASK_REM 0xfe00707f +#define MATCH_REMU 0x2007033 +#define MASK_REMU 0xfe00707f +#define MATCH_MULW 0x200003b +#define MASK_MULW 0xfe00707f +#define MATCH_DIVW 0x200403b +#define MASK_DIVW 0xfe00707f +#define MATCH_DIVUW 0x200503b +#define MASK_DIVUW 0xfe00707f +#define MATCH_REMW 0x200603b +#define MASK_REMW 0xfe00707f +#define MATCH_REMUW 0x200703b +#define MASK_REMUW 0xfe00707f +#define MATCH_AMOADD_W 0x202f +#define MASK_AMOADD_W 0xf800707f +#define MATCH_AMOXOR_W 0x2000202f +#define MASK_AMOXOR_W 0xf800707f +#define MATCH_AMOOR_W 0x4000202f +#define MASK_AMOOR_W 0xf800707f +#define MATCH_AMOAND_W 0x6000202f +#define MASK_AMOAND_W 0xf800707f +#define MATCH_AMOMIN_W 0x8000202f +#define MASK_AMOMIN_W 0xf800707f +#define MATCH_AMOMAX_W 0xa000202f +#define MASK_AMOMAX_W 0xf800707f +#define MATCH_AMOMINU_W 0xc000202f +#define MASK_AMOMINU_W 0xf800707f +#define MATCH_AMOMAXU_W 0xe000202f +#define MASK_AMOMAXU_W 0xf800707f +#define MATCH_AMOSWAP_W 0x800202f +#define MASK_AMOSWAP_W 0xf800707f +#define MATCH_LR_W 0x1000202f +#define MASK_LR_W 0xf9f0707f +#define MATCH_SC_W 0x1800202f +#define MASK_SC_W 0xf800707f +#define MATCH_AMOADD_D 0x302f +#define MASK_AMOADD_D 0xf800707f +#define MATCH_AMOXOR_D 0x2000302f +#define MASK_AMOXOR_D 0xf800707f +#define MATCH_AMOOR_D 0x4000302f +#define MASK_AMOOR_D 0xf800707f +#define MATCH_AMOAND_D 0x6000302f +#define MASK_AMOAND_D 0xf800707f +#define MATCH_AMOMIN_D 0x8000302f +#define MASK_AMOMIN_D 0xf800707f +#define MATCH_AMOMAX_D 0xa000302f +#define MASK_AMOMAX_D 0xf800707f +#define MATCH_AMOMINU_D 0xc000302f +#define MASK_AMOMINU_D 0xf800707f +#define MATCH_AMOMAXU_D 0xe000302f +#define MASK_AMOMAXU_D 0xf800707f +#define MATCH_AMOSWAP_D 0x800302f +#define MASK_AMOSWAP_D 0xf800707f +#define MATCH_LR_D 0x1000302f +#define MASK_LR_D 0xf9f0707f +#define MATCH_SC_D 0x1800302f +#define MASK_SC_D 0xf800707f +#define MATCH_FADD_S 0x53 +#define MASK_FADD_S 0xfe00007f +#define MATCH_FSUB_S 0x8000053 +#define MASK_FSUB_S 0xfe00007f +#define MATCH_FMUL_S 0x10000053 +#define MASK_FMUL_S 0xfe00007f +#define MATCH_FDIV_S 0x18000053 +#define MASK_FDIV_S 0xfe00007f +#define MATCH_FSGNJ_S 0x20000053 +#define MASK_FSGNJ_S 0xfe00707f +#define MATCH_FSGNJN_S 0x20001053 +#define MASK_FSGNJN_S 0xfe00707f +#define MATCH_FSGNJX_S 0x20002053 +#define MASK_FSGNJX_S 0xfe00707f +#define MATCH_FMIN_S 0x28000053 +#define MASK_FMIN_S 0xfe00707f +#define MATCH_FMAX_S 0x28001053 +#define MASK_FMAX_S 0xfe00707f +#define MATCH_FSQRT_S 0x58000053 +#define MASK_FSQRT_S 0xfff0007f +#define MATCH_FLE_S 0xa0000053 +#define MASK_FLE_S 0xfe00707f +#define MATCH_FLT_S 0xa0001053 +#define MASK_FLT_S 0xfe00707f +#define MATCH_FEQ_S 0xa0002053 +#define MASK_FEQ_S 0xfe00707f +#define MATCH_FCVT_W_S 0xc0000053 +#define MASK_FCVT_W_S 0xfff0007f +#define MATCH_FCVT_WU_S 0xc0100053 +#define MASK_FCVT_WU_S 0xfff0007f +#define MATCH_FMV_X_W 0xe0000053 +#define MASK_FMV_X_W 0xfff0707f +#define MATCH_FCLASS_S 0xe0001053 +#define MASK_FCLASS_S 0xfff0707f +#define MATCH_FCVT_S_W 0xd0000053 +#define MASK_FCVT_S_W 0xfff0007f +#define MATCH_FCVT_S_WU 0xd0100053 +#define MASK_FCVT_S_WU 0xfff0007f +#define MATCH_FMV_W_X 0xf0000053 +#define MASK_FMV_W_X 0xfff0707f +#define MATCH_FLW 0x2007 +#define MASK_FLW 0x707f +#define MATCH_FSW 0x2027 +#define MASK_FSW 0x707f +#define MATCH_FMADD_S 0x43 +#define MASK_FMADD_S 0x600007f +#define MATCH_FMSUB_S 0x47 +#define MASK_FMSUB_S 0x600007f +#define MATCH_FNMSUB_S 0x4b +#define MASK_FNMSUB_S 0x600007f +#define MATCH_FNMADD_S 0x4f +#define MASK_FNMADD_S 0x600007f +#define MATCH_FCVT_L_S 0xc0200053 +#define MASK_FCVT_L_S 0xfff0007f +#define MATCH_FCVT_LU_S 0xc0300053 +#define MASK_FCVT_LU_S 0xfff0007f +#define MATCH_FCVT_S_L 0xd0200053 +#define MASK_FCVT_S_L 0xfff0007f +#define MATCH_FCVT_S_LU 0xd0300053 +#define MASK_FCVT_S_LU 0xfff0007f +#define MATCH_FADD_D 0x2000053 +#define MASK_FADD_D 0xfe00007f +#define MATCH_FSUB_D 0xa000053 +#define MASK_FSUB_D 0xfe00007f +#define MATCH_FMUL_D 0x12000053 +#define MASK_FMUL_D 0xfe00007f +#define MATCH_FDIV_D 0x1a000053 +#define MASK_FDIV_D 0xfe00007f +#define MATCH_FSGNJ_D 0x22000053 +#define MASK_FSGNJ_D 0xfe00707f +#define MATCH_FSGNJN_D 0x22001053 +#define MASK_FSGNJN_D 0xfe00707f +#define MATCH_FSGNJX_D 0x22002053 +#define MASK_FSGNJX_D 0xfe00707f +#define MATCH_FMIN_D 0x2a000053 +#define MASK_FMIN_D 0xfe00707f +#define MATCH_FMAX_D 0x2a001053 +#define MASK_FMAX_D 0xfe00707f +#define MATCH_FCVT_S_D 0x40100053 +#define MASK_FCVT_S_D 0xfff0007f +#define MATCH_FCVT_D_S 0x42000053 +#define MASK_FCVT_D_S 0xfff0007f +#define MATCH_FSQRT_D 0x5a000053 +#define MASK_FSQRT_D 0xfff0007f +#define MATCH_FLE_D 0xa2000053 +#define MASK_FLE_D 0xfe00707f +#define MATCH_FLT_D 0xa2001053 +#define MASK_FLT_D 0xfe00707f +#define MATCH_FEQ_D 0xa2002053 +#define MASK_FEQ_D 0xfe00707f +#define MATCH_FCVT_W_D 0xc2000053 +#define MASK_FCVT_W_D 0xfff0007f +#define MATCH_FCVT_WU_D 0xc2100053 +#define MASK_FCVT_WU_D 0xfff0007f +#define MATCH_FCLASS_D 0xe2001053 +#define MASK_FCLASS_D 0xfff0707f +#define MATCH_FCVT_D_W 0xd2000053 +#define MASK_FCVT_D_W 0xfff0007f +#define MATCH_FCVT_D_WU 0xd2100053 +#define MASK_FCVT_D_WU 0xfff0007f +#define MATCH_FLD 0x3007 +#define MASK_FLD 0x707f +#define MATCH_FSD 0x3027 +#define MASK_FSD 0x707f +#define MATCH_FMADD_D 0x2000043 +#define MASK_FMADD_D 0x600007f +#define MATCH_FMSUB_D 0x2000047 +#define MASK_FMSUB_D 0x600007f +#define MATCH_FNMSUB_D 0x200004b +#define MASK_FNMSUB_D 0x600007f +#define MATCH_FNMADD_D 0x200004f +#define MASK_FNMADD_D 0x600007f +#define MATCH_FCVT_L_D 0xc2200053 +#define MASK_FCVT_L_D 0xfff0007f +#define MATCH_FCVT_LU_D 0xc2300053 +#define MASK_FCVT_LU_D 0xfff0007f +#define MATCH_FMV_X_D 0xe2000053 +#define MASK_FMV_X_D 0xfff0707f +#define MATCH_FCVT_D_L 0xd2200053 +#define MASK_FCVT_D_L 0xfff0007f +#define MATCH_FCVT_D_LU 0xd2300053 +#define MASK_FCVT_D_LU 0xfff0007f +#define MATCH_FMV_D_X 0xf2000053 +#define MASK_FMV_D_X 0xfff0707f +#define MATCH_FADD_Q 0x6000053 +#define MASK_FADD_Q 0xfe00007f +#define MATCH_FSUB_Q 0xe000053 +#define MASK_FSUB_Q 0xfe00007f +#define MATCH_FMUL_Q 0x16000053 +#define MASK_FMUL_Q 0xfe00007f +#define MATCH_FDIV_Q 0x1e000053 +#define MASK_FDIV_Q 0xfe00007f +#define MATCH_FSGNJ_Q 0x26000053 +#define MASK_FSGNJ_Q 0xfe00707f +#define MATCH_FSGNJN_Q 0x26001053 +#define MASK_FSGNJN_Q 0xfe00707f +#define MATCH_FSGNJX_Q 0x26002053 +#define MASK_FSGNJX_Q 0xfe00707f +#define MATCH_FMIN_Q 0x2e000053 +#define MASK_FMIN_Q 0xfe00707f +#define MATCH_FMAX_Q 0x2e001053 +#define MASK_FMAX_Q 0xfe00707f +#define MATCH_FCVT_S_Q 0x40300053 +#define MASK_FCVT_S_Q 0xfff0007f +#define MATCH_FCVT_Q_S 0x46000053 +#define MASK_FCVT_Q_S 0xfff0007f +#define MATCH_FCVT_D_Q 0x42300053 +#define MASK_FCVT_D_Q 0xfff0007f +#define MATCH_FCVT_Q_D 0x46100053 +#define MASK_FCVT_Q_D 0xfff0007f +#define MATCH_FSQRT_Q 0x5e000053 +#define MASK_FSQRT_Q 0xfff0007f +#define MATCH_FLE_Q 0xa6000053 +#define MASK_FLE_Q 0xfe00707f +#define MATCH_FLT_Q 0xa6001053 +#define MASK_FLT_Q 0xfe00707f +#define MATCH_FEQ_Q 0xa6002053 +#define MASK_FEQ_Q 0xfe00707f +#define MATCH_FCVT_W_Q 0xc6000053 +#define MASK_FCVT_W_Q 0xfff0007f +#define MATCH_FCVT_WU_Q 0xc6100053 +#define MASK_FCVT_WU_Q 0xfff0007f +#define MATCH_FCLASS_Q 0xe6001053 +#define MASK_FCLASS_Q 0xfff0707f +#define MATCH_FCVT_Q_W 0xd6000053 +#define MASK_FCVT_Q_W 0xfff0007f +#define MATCH_FCVT_Q_WU 0xd6100053 +#define MASK_FCVT_Q_WU 0xfff0007f +#define MATCH_FLQ 0x4007 +#define MASK_FLQ 0x707f +#define MATCH_FSQ 0x4027 +#define MASK_FSQ 0x707f +#define MATCH_FMADD_Q 0x6000043 +#define MASK_FMADD_Q 0x600007f +#define MATCH_FMSUB_Q 0x6000047 +#define MASK_FMSUB_Q 0x600007f +#define MATCH_FNMSUB_Q 0x600004b +#define MASK_FNMSUB_Q 0x600007f +#define MATCH_FNMADD_Q 0x600004f +#define MASK_FNMADD_Q 0x600007f +#define MATCH_FCVT_L_Q 0xc6200053 +#define MASK_FCVT_L_Q 0xfff0007f +#define MATCH_FCVT_LU_Q 0xc6300053 +#define MASK_FCVT_LU_Q 0xfff0007f +#define MATCH_FCVT_Q_L 0xd6200053 +#define MASK_FCVT_Q_L 0xfff0007f +#define MATCH_FCVT_Q_LU 0xd6300053 +#define MASK_FCVT_Q_LU 0xfff0007f +#define MATCH_FMV_X_Q 0xe6000053 +#define MASK_FMV_X_Q 0xfff0707f +#define MATCH_FMV_Q_X 0xf6000053 +#define MASK_FMV_Q_X 0xfff0707f +#define MATCH_ECALL 0x73 +#define MASK_ECALL 0xffffffff +#define MATCH_EBREAK 0x100073 +#define MASK_EBREAK 0xffffffff +#define MATCH_URET 0x200073 +#define MASK_URET 0xffffffff +#define MATCH_SRET 0x10200073 +#define MASK_SRET 0xffffffff +#define MATCH_MRET 0x30200073 +#define MASK_MRET 0xffffffff +#define MATCH_DRET 0x7b200073 +#define MASK_DRET 0xffffffff +#define MATCH_SFENCE_VMA 0x12000073 +#define MASK_SFENCE_VMA 0xfe007fff +#define MATCH_WFI 0x10500073 +#define MASK_WFI 0xffffffff +#define MATCH_CSRRW 0x1073 +#define MASK_CSRRW 0x707f +#define MATCH_CSRRS 0x2073 +#define MASK_CSRRS 0x707f +#define MATCH_CSRRC 0x3073 +#define MASK_CSRRC 0x707f +#define MATCH_CSRRWI 0x5073 +#define MASK_CSRRWI 0x707f +#define MATCH_CSRRSI 0x6073 +#define MASK_CSRRSI 0x707f +#define MATCH_CSRRCI 0x7073 +#define MASK_CSRRCI 0x707f +#define MATCH_HFENCE_VVMA 0x22000073 +#define MASK_HFENCE_VVMA 0xfe007fff +#define MATCH_HFENCE_GVMA 0x62000073 +#define MASK_HFENCE_GVMA 0xfe007fff +#define MATCH_C_NOP 0x1 +#define MASK_C_NOP 0xffff +#define MATCH_C_ADDI16SP 0x6101 +#define MASK_C_ADDI16SP 0xef83 +#define MATCH_C_JR 0x8002 +#define MASK_C_JR 0xf07f +#define MATCH_C_JALR 0x9002 +#define MASK_C_JALR 0xf07f +#define MATCH_C_EBREAK 0x9002 +#define MASK_C_EBREAK 0xffff +#define MATCH_C_ADDI4SPN 0x0 +#define MASK_C_ADDI4SPN 0xe003 +#define MATCH_C_FLD 0x2000 +#define MASK_C_FLD 0xe003 +#define MATCH_C_LW 0x4000 +#define MASK_C_LW 0xe003 +#define MATCH_C_FLW 0x6000 +#define MASK_C_FLW 0xe003 +#define MATCH_C_FSD 0xa000 +#define MASK_C_FSD 0xe003 +#define MATCH_C_SW 0xc000 +#define MASK_C_SW 0xe003 +#define MATCH_C_FSW 0xe000 +#define MASK_C_FSW 0xe003 +#define MATCH_C_ADDI 0x1 +#define MASK_C_ADDI 0xe003 +#define MATCH_C_JAL 0x2001 +#define MASK_C_JAL 0xe003 +#define MATCH_C_LI 0x4001 +#define MASK_C_LI 0xe003 +#define MATCH_C_LUI 0x6001 +#define MASK_C_LUI 0xe003 +#define MATCH_C_SRLI 0x8001 +#define MASK_C_SRLI 0xec03 +#define MATCH_C_SRAI 0x8401 +#define MASK_C_SRAI 0xec03 +#define MATCH_C_ANDI 0x8801 +#define MASK_C_ANDI 0xec03 +#define MATCH_C_SUB 0x8c01 +#define MASK_C_SUB 0xfc63 +#define MATCH_C_XOR 0x8c21 +#define MASK_C_XOR 0xfc63 +#define MATCH_C_OR 0x8c41 +#define MASK_C_OR 0xfc63 +#define MATCH_C_AND 0x8c61 +#define MASK_C_AND 0xfc63 +#define MATCH_C_J 0xa001 +#define MASK_C_J 0xe003 +#define MATCH_C_BEQZ 0xc001 +#define MASK_C_BEQZ 0xe003 +#define MATCH_C_BNEZ 0xe001 +#define MASK_C_BNEZ 0xe003 +#define MATCH_C_SLLI 0x2 +#define MASK_C_SLLI 0xe003 +#define MATCH_C_FLDSP 0x2002 +#define MASK_C_FLDSP 0xe003 +#define MATCH_C_LWSP 0x4002 +#define MASK_C_LWSP 0xe003 +#define MATCH_C_FLWSP 0x6002 +#define MASK_C_FLWSP 0xe003 +#define MATCH_C_MV 0x8002 +#define MASK_C_MV 0xf003 +#define MATCH_C_ADD 0x9002 +#define MASK_C_ADD 0xf003 +#define MATCH_C_FSDSP 0xa002 +#define MASK_C_FSDSP 0xe003 +#define MATCH_C_SWSP 0xc002 +#define MASK_C_SWSP 0xe003 +#define MATCH_C_FSWSP 0xe002 +#define MASK_C_FSWSP 0xe003 +#define MATCH_C_SRLI_RV32 0x8001 +#define MASK_C_SRLI_RV32 0xfc03 +#define MATCH_C_SRAI_RV32 0x8401 +#define MASK_C_SRAI_RV32 0xfc03 +#define MATCH_C_SLLI_RV32 0x2 +#define MASK_C_SLLI_RV32 0xf003 +#define MATCH_C_LD 0x6000 +#define MASK_C_LD 0xe003 +#define MATCH_C_SD 0xe000 +#define MASK_C_SD 0xe003 +#define MATCH_C_SUBW 0x9c01 +#define MASK_C_SUBW 0xfc63 +#define MATCH_C_ADDW 0x9c21 +#define MASK_C_ADDW 0xfc63 +#define MATCH_C_ADDIW 0x2001 +#define MASK_C_ADDIW 0xe003 +#define MATCH_C_LDSP 0x6002 +#define MASK_C_LDSP 0xe003 +#define MATCH_C_SDSP 0xe002 +#define MASK_C_SDSP 0xe003 +#define MATCH_C_LQ 0x2000 +#define MASK_C_LQ 0xe003 +#define MATCH_C_SQ 0xa000 +#define MASK_C_SQ 0xe003 +#define MATCH_C_LQSP 0x2002 +#define MASK_C_LQSP 0xe003 +#define MATCH_C_SQSP 0xa002 +#define MASK_C_SQSP 0xe003 +#define MATCH_CUSTOM0 0xb +#define MASK_CUSTOM0 0x707f +#define MATCH_CUSTOM0_RS1 0x200b +#define MASK_CUSTOM0_RS1 0x707f +#define MATCH_CUSTOM0_RS1_RS2 0x300b +#define MASK_CUSTOM0_RS1_RS2 0x707f +#define MATCH_CUSTOM0_RD 0x400b +#define MASK_CUSTOM0_RD 0x707f +#define MATCH_CUSTOM0_RD_RS1 0x600b +#define MASK_CUSTOM0_RD_RS1 0x707f +#define MATCH_CUSTOM0_RD_RS1_RS2 0x700b +#define MASK_CUSTOM0_RD_RS1_RS2 0x707f +#define MATCH_CUSTOM1 0x2b +#define MASK_CUSTOM1 0x707f +#define MATCH_CUSTOM1_RS1 0x202b +#define MASK_CUSTOM1_RS1 0x707f +#define MATCH_CUSTOM1_RS1_RS2 0x302b +#define MASK_CUSTOM1_RS1_RS2 0x707f +#define MATCH_CUSTOM1_RD 0x402b +#define MASK_CUSTOM1_RD 0x707f +#define MATCH_CUSTOM1_RD_RS1 0x602b +#define MASK_CUSTOM1_RD_RS1 0x707f +#define MATCH_CUSTOM1_RD_RS1_RS2 0x702b +#define MASK_CUSTOM1_RD_RS1_RS2 0x707f +#define MATCH_CUSTOM2 0x5b +#define MASK_CUSTOM2 0x707f +#define MATCH_CUSTOM2_RS1 0x205b +#define MASK_CUSTOM2_RS1 0x707f +#define MATCH_CUSTOM2_RS1_RS2 0x305b +#define MASK_CUSTOM2_RS1_RS2 0x707f +#define MATCH_CUSTOM2_RD 0x405b +#define MASK_CUSTOM2_RD 0x707f +#define MATCH_CUSTOM2_RD_RS1 0x605b +#define MASK_CUSTOM2_RD_RS1 0x707f +#define MATCH_CUSTOM2_RD_RS1_RS2 0x705b +#define MASK_CUSTOM2_RD_RS1_RS2 0x707f +#define MATCH_CUSTOM3 0x7b +#define MASK_CUSTOM3 0x707f +#define MATCH_CUSTOM3_RS1 0x207b +#define MASK_CUSTOM3_RS1 0x707f +#define MATCH_CUSTOM3_RS1_RS2 0x307b +#define MASK_CUSTOM3_RS1_RS2 0x707f +#define MATCH_CUSTOM3_RD 0x407b +#define MASK_CUSTOM3_RD 0x707f +#define MATCH_CUSTOM3_RD_RS1 0x607b +#define MASK_CUSTOM3_RD_RS1 0x707f +#define MATCH_CUSTOM3_RD_RS1_RS2 0x707b +#define MASK_CUSTOM3_RD_RS1_RS2 0x707f +#define MATCH_VSETVLI 0x7057 +#define MASK_VSETVLI 0x8000707f +#define MATCH_VSETVL 0x80007057 +#define MASK_VSETVL 0xfe00707f +#define MATCH_VLB_V 0x10000007 +#define MASK_VLB_V 0x1df0707f +#define MATCH_VLH_V 0x10005007 +#define MASK_VLH_V 0x1df0707f +#define MATCH_VLW_V 0x10006007 +#define MASK_VLW_V 0x1df0707f +#define MATCH_VLE_V 0x7007 +#define MASK_VLE_V 0x1df0707f +#define MATCH_VLBU_V 0x7 +#define MASK_VLBU_V 0x1df0707f +#define MATCH_VLHU_V 0x5007 +#define MASK_VLHU_V 0x1df0707f +#define MATCH_VLWU_V 0x6007 +#define MASK_VLWU_V 0x1df0707f +#define MATCH_VSB_V 0x27 +#define MASK_VSB_V 0x1df0707f +#define MATCH_VSH_V 0x5027 +#define MASK_VSH_V 0x1df0707f +#define MATCH_VSW_V 0x6027 +#define MASK_VSW_V 0x1df0707f +#define MATCH_VSE_V 0x7027 +#define MASK_VSE_V 0x1df0707f +#define MATCH_VLSB_V 0x18000007 +#define MASK_VLSB_V 0x1c00707f +#define MATCH_VLSH_V 0x18005007 +#define MASK_VLSH_V 0x1c00707f +#define MATCH_VLSW_V 0x18006007 +#define MASK_VLSW_V 0x1c00707f +#define MATCH_VLSE_V 0x8007007 +#define MASK_VLSE_V 0x1c00707f +#define MATCH_VLSBU_V 0x8000007 +#define MASK_VLSBU_V 0x1c00707f +#define MATCH_VLSHU_V 0x8005007 +#define MASK_VLSHU_V 0x1c00707f +#define MATCH_VLSWU_V 0x8006007 +#define MASK_VLSWU_V 0x1c00707f +#define MATCH_VSSB_V 0x8000027 +#define MASK_VSSB_V 0x1c00707f +#define MATCH_VSSH_V 0x8005027 +#define MASK_VSSH_V 0x1c00707f +#define MATCH_VSSW_V 0x8006027 +#define MASK_VSSW_V 0x1c00707f +#define MATCH_VSSE_V 0x8007027 +#define MASK_VSSE_V 0x1c00707f +#define MATCH_VLXB_V 0x1c000007 +#define MASK_VLXB_V 0x1c00707f +#define MATCH_VLXH_V 0x1c005007 +#define MASK_VLXH_V 0x1c00707f +#define MATCH_VLXW_V 0x1c006007 +#define MASK_VLXW_V 0x1c00707f +#define MATCH_VLXE_V 0xc007007 +#define MASK_VLXE_V 0x1c00707f +#define MATCH_VLXBU_V 0xc000007 +#define MASK_VLXBU_V 0x1c00707f +#define MATCH_VLXHU_V 0xc005007 +#define MASK_VLXHU_V 0x1c00707f +#define MATCH_VLXWU_V 0xc006007 +#define MASK_VLXWU_V 0x1c00707f +#define MATCH_VSXB_V 0xc000027 +#define MASK_VSXB_V 0x1c00707f +#define MATCH_VSXH_V 0xc005027 +#define MASK_VSXH_V 0x1c00707f +#define MATCH_VSXW_V 0xc006027 +#define MASK_VSXW_V 0x1c00707f +#define MATCH_VSXE_V 0xc007027 +#define MASK_VSXE_V 0x1c00707f +#define MATCH_VSUXB_V 0x1c000027 +#define MASK_VSUXB_V 0xfc00707f +#define MATCH_VSUXH_V 0x1c005027 +#define MASK_VSUXH_V 0xfc00707f +#define MATCH_VSUXW_V 0x1c006027 +#define MASK_VSUXW_V 0xfc00707f +#define MATCH_VSUXE_V 0x1c007027 +#define MASK_VSUXE_V 0xfc00707f +#define MATCH_VLBFF_V 0x11000007 +#define MASK_VLBFF_V 0x1df0707f +#define MATCH_VLHFF_V 0x11005007 +#define MASK_VLHFF_V 0x1df0707f +#define MATCH_VLWFF_V 0x11006007 +#define MASK_VLWFF_V 0x1df0707f +#define MATCH_VLEFF_V 0x1007007 +#define MASK_VLEFF_V 0x1df0707f +#define MATCH_VLBUFF_V 0x1000007 +#define MASK_VLBUFF_V 0x1df0707f +#define MATCH_VLHUFF_V 0x1005007 +#define MASK_VLHUFF_V 0x1df0707f +#define MATCH_VLWUFF_V 0x1006007 +#define MASK_VLWUFF_V 0x1df0707f +#define MATCH_VL1R_V 0x2807007 +#define MASK_VL1R_V 0xfff0707f +#define MATCH_VS1R_V 0x2807027 +#define MASK_VS1R_V 0xfff0707f +#define MATCH_VFADD_VF 0x5057 +#define MASK_VFADD_VF 0xfc00707f +#define MATCH_VFSUB_VF 0x8005057 +#define MASK_VFSUB_VF 0xfc00707f +#define MATCH_VFMIN_VF 0x10005057 +#define MASK_VFMIN_VF 0xfc00707f +#define MATCH_VFMAX_VF 0x18005057 +#define MASK_VFMAX_VF 0xfc00707f +#define MATCH_VFSGNJ_VF 0x20005057 +#define MASK_VFSGNJ_VF 0xfc00707f +#define MATCH_VFSGNJN_VF 0x24005057 +#define MASK_VFSGNJN_VF 0xfc00707f +#define MATCH_VFSGNJX_VF 0x28005057 +#define MASK_VFSGNJX_VF 0xfc00707f +#define MATCH_VFSLIDE1UP_VF 0x38005057 +#define MASK_VFSLIDE1UP_VF 0xfc00707f +#define MATCH_VFSLIDE1DOWN_VF 0x3c005057 +#define MASK_VFSLIDE1DOWN_VF 0xfc00707f +#define MATCH_VFMV_S_F 0x42005057 +#define MASK_VFMV_S_F 0xfff0707f +#define MATCH_VFMERGE_VFM 0x5c005057 +#define MASK_VFMERGE_VFM 0xfe00707f +#define MATCH_VFMV_V_F 0x5e005057 +#define MASK_VFMV_V_F 0xfff0707f +#define MATCH_VMFEQ_VF 0x60005057 +#define MASK_VMFEQ_VF 0xfc00707f +#define MATCH_VMFLE_VF 0x64005057 +#define MASK_VMFLE_VF 0xfc00707f +#define MATCH_VMFLT_VF 0x6c005057 +#define MASK_VMFLT_VF 0xfc00707f +#define MATCH_VMFNE_VF 0x70005057 +#define MASK_VMFNE_VF 0xfc00707f +#define MATCH_VMFGT_VF 0x74005057 +#define MASK_VMFGT_VF 0xfc00707f +#define MATCH_VMFGE_VF 0x7c005057 +#define MASK_VMFGE_VF 0xfc00707f +#define MATCH_VFDIV_VF 0x80005057 +#define MASK_VFDIV_VF 0xfc00707f +#define MATCH_VFRDIV_VF 0x84005057 +#define MASK_VFRDIV_VF 0xfc00707f +#define MATCH_VFMUL_VF 0x90005057 +#define MASK_VFMUL_VF 0xfc00707f +#define MATCH_VFRSUB_VF 0x9c005057 +#define MASK_VFRSUB_VF 0xfc00707f +#define MATCH_VFMADD_VF 0xa0005057 +#define MASK_VFMADD_VF 0xfc00707f +#define MATCH_VFNMADD_VF 0xa4005057 +#define MASK_VFNMADD_VF 0xfc00707f +#define MATCH_VFMSUB_VF 0xa8005057 +#define MASK_VFMSUB_VF 0xfc00707f +#define MATCH_VFNMSUB_VF 0xac005057 +#define MASK_VFNMSUB_VF 0xfc00707f +#define MATCH_VFMACC_VF 0xb0005057 +#define MASK_VFMACC_VF 0xfc00707f +#define MATCH_VFNMACC_VF 0xb4005057 +#define MASK_VFNMACC_VF 0xfc00707f +#define MATCH_VFMSAC_VF 0xb8005057 +#define MASK_VFMSAC_VF 0xfc00707f +#define MATCH_VFNMSAC_VF 0xbc005057 +#define MASK_VFNMSAC_VF 0xfc00707f +#define MATCH_VFWADD_VF 0xc0005057 +#define MASK_VFWADD_VF 0xfc00707f +#define MATCH_VFWSUB_VF 0xc8005057 +#define MASK_VFWSUB_VF 0xfc00707f +#define MATCH_VFWADD_WF 0xd0005057 +#define MASK_VFWADD_WF 0xfc00707f +#define MATCH_VFWSUB_WF 0xd8005057 +#define MASK_VFWSUB_WF 0xfc00707f +#define MATCH_VFWMUL_VF 0xe0005057 +#define MASK_VFWMUL_VF 0xfc00707f +#define MATCH_VFWMACC_VF 0xf0005057 +#define MASK_VFWMACC_VF 0xfc00707f +#define MATCH_VFWNMACC_VF 0xf4005057 +#define MASK_VFWNMACC_VF 0xfc00707f +#define MATCH_VFWMSAC_VF 0xf8005057 +#define MASK_VFWMSAC_VF 0xfc00707f +#define MATCH_VFWNMSAC_VF 0xfc005057 +#define MASK_VFWNMSAC_VF 0xfc00707f +#define MATCH_VFADD_VV 0x1057 +#define MASK_VFADD_VV 0xfc00707f +#define MATCH_VFREDSUM_VS 0x4001057 +#define MASK_VFREDSUM_VS 0xfc00707f +#define MATCH_VFSUB_VV 0x8001057 +#define MASK_VFSUB_VV 0xfc00707f +#define MATCH_VFREDOSUM_VS 0xc001057 +#define MASK_VFREDOSUM_VS 0xfc00707f +#define MATCH_VFMIN_VV 0x10001057 +#define MASK_VFMIN_VV 0xfc00707f +#define MATCH_VFREDMIN_VS 0x14001057 +#define MASK_VFREDMIN_VS 0xfc00707f +#define MATCH_VFMAX_VV 0x18001057 +#define MASK_VFMAX_VV 0xfc00707f +#define MATCH_VFREDMAX_VS 0x1c001057 +#define MASK_VFREDMAX_VS 0xfc00707f +#define MATCH_VFSGNJ_VV 0x20001057 +#define MASK_VFSGNJ_VV 0xfc00707f +#define MATCH_VFSGNJN_VV 0x24001057 +#define MASK_VFSGNJN_VV 0xfc00707f +#define MATCH_VFSGNJX_VV 0x28001057 +#define MASK_VFSGNJX_VV 0xfc00707f +#define MATCH_VFMV_F_S 0x42001057 +#define MASK_VFMV_F_S 0xfe0ff07f +#define MATCH_VMFEQ_VV 0x60001057 +#define MASK_VMFEQ_VV 0xfc00707f +#define MATCH_VMFLE_VV 0x64001057 +#define MASK_VMFLE_VV 0xfc00707f +#define MATCH_VMFLT_VV 0x6c001057 +#define MASK_VMFLT_VV 0xfc00707f +#define MATCH_VMFNE_VV 0x70001057 +#define MASK_VMFNE_VV 0xfc00707f +#define MATCH_VFDIV_VV 0x80001057 +#define MASK_VFDIV_VV 0xfc00707f +#define MATCH_VFMUL_VV 0x90001057 +#define MASK_VFMUL_VV 0xfc00707f +#define MATCH_VFMADD_VV 0xa0001057 +#define MASK_VFMADD_VV 0xfc00707f +#define MATCH_VFNMADD_VV 0xa4001057 +#define MASK_VFNMADD_VV 0xfc00707f +#define MATCH_VFMSUB_VV 0xa8001057 +#define MASK_VFMSUB_VV 0xfc00707f +#define MATCH_VFNMSUB_VV 0xac001057 +#define MASK_VFNMSUB_VV 0xfc00707f +#define MATCH_VFMACC_VV 0xb0001057 +#define MASK_VFMACC_VV 0xfc00707f +#define MATCH_VFNMACC_VV 0xb4001057 +#define MASK_VFNMACC_VV 0xfc00707f +#define MATCH_VFMSAC_VV 0xb8001057 +#define MASK_VFMSAC_VV 0xfc00707f +#define MATCH_VFNMSAC_VV 0xbc001057 +#define MASK_VFNMSAC_VV 0xfc00707f +#define MATCH_VFCVT_XU_F_V 0x88001057 +#define MASK_VFCVT_XU_F_V 0xfc0ff07f +#define MATCH_VFCVT_X_F_V 0x88009057 +#define MASK_VFCVT_X_F_V 0xfc0ff07f +#define MATCH_VFCVT_F_XU_V 0x88011057 +#define MASK_VFCVT_F_XU_V 0xfc0ff07f +#define MATCH_VFCVT_F_X_V 0x88019057 +#define MASK_VFCVT_F_X_V 0xfc0ff07f +#define MATCH_VFCVT_RTZ_XU_F_V 0x88031057 +#define MASK_VFCVT_RTZ_XU_F_V 0xfc0ff07f +#define MATCH_VFCVT_RTZ_X_F_V 0x88039057 +#define MASK_VFCVT_RTZ_X_F_V 0xfc0ff07f +#define MATCH_VFWCVT_XU_F_V 0x88041057 +#define MASK_VFWCVT_XU_F_V 0xfc0ff07f +#define MATCH_VFWCVT_X_F_V 0x88049057 +#define MASK_VFWCVT_X_F_V 0xfc0ff07f +#define MATCH_VFWCVT_F_XU_V 0x88051057 +#define MASK_VFWCVT_F_XU_V 0xfc0ff07f +#define MATCH_VFWCVT_F_X_V 0x88059057 +#define MASK_VFWCVT_F_X_V 0xfc0ff07f +#define MATCH_VFWCVT_F_F_V 0x88061057 +#define MASK_VFWCVT_F_F_V 0xfc0ff07f +#define MATCH_VFWCVT_RTZ_XU_F_V 0x88071057 +#define MASK_VFWCVT_RTZ_XU_F_V 0xfc0ff07f +#define MATCH_VFWCVT_RTZ_X_F_V 0x88079057 +#define MASK_VFWCVT_RTZ_X_F_V 0xfc0ff07f +#define MATCH_VFNCVT_XU_F_W 0x88081057 +#define MASK_VFNCVT_XU_F_W 0xfc0ff07f +#define MATCH_VFNCVT_X_F_W 0x88089057 +#define MASK_VFNCVT_X_F_W 0xfc0ff07f +#define MATCH_VFNCVT_F_XU_W 0x88091057 +#define MASK_VFNCVT_F_XU_W 0xfc0ff07f +#define MATCH_VFNCVT_F_X_W 0x88099057 +#define MASK_VFNCVT_F_X_W 0xfc0ff07f +#define MATCH_VFNCVT_F_F_W 0x880a1057 +#define MASK_VFNCVT_F_F_W 0xfc0ff07f +#define MATCH_VFNCVT_ROD_F_F_W 0x880a9057 +#define MASK_VFNCVT_ROD_F_F_W 0xfc0ff07f +#define MATCH_VFNCVT_RTZ_XU_F_W 0x880b1057 +#define MASK_VFNCVT_RTZ_XU_F_W 0xfc0ff07f +#define MATCH_VFNCVT_RTZ_X_F_W 0x880b9057 +#define MASK_VFNCVT_RTZ_X_F_W 0xfc0ff07f +#define MATCH_VFSQRT_V 0x8c001057 +#define MASK_VFSQRT_V 0xfc0ff07f +#define MATCH_VFCLASS_V 0x8c081057 +#define MASK_VFCLASS_V 0xfc0ff07f +#define MATCH_VFWADD_VV 0xc0001057 +#define MASK_VFWADD_VV 0xfc00707f +#define MATCH_VFWREDSUM_VS 0xc4001057 +#define MASK_VFWREDSUM_VS 0xfc00707f +#define MATCH_VFWSUB_VV 0xc8001057 +#define MASK_VFWSUB_VV 0xfc00707f +#define MATCH_VFWREDOSUM_VS 0xcc001057 +#define MASK_VFWREDOSUM_VS 0xfc00707f +#define MATCH_VFWADD_WV 0xd0001057 +#define MASK_VFWADD_WV 0xfc00707f +#define MATCH_VFWSUB_WV 0xd8001057 +#define MASK_VFWSUB_WV 0xfc00707f +#define MATCH_VFWMUL_VV 0xe0001057 +#define MASK_VFWMUL_VV 0xfc00707f +#define MATCH_VFDOT_VV 0xe4001057 +#define MASK_VFDOT_VV 0xfc00707f +#define MATCH_VFWMACC_VV 0xf0001057 +#define MASK_VFWMACC_VV 0xfc00707f +#define MATCH_VFWNMACC_VV 0xf4001057 +#define MASK_VFWNMACC_VV 0xfc00707f +#define MATCH_VFWMSAC_VV 0xf8001057 +#define MASK_VFWMSAC_VV 0xfc00707f +#define MATCH_VFWNMSAC_VV 0xfc001057 +#define MASK_VFWNMSAC_VV 0xfc00707f +#define MATCH_VADD_VX 0x4057 +#define MASK_VADD_VX 0xfc00707f +#define MATCH_VSUB_VX 0x8004057 +#define MASK_VSUB_VX 0xfc00707f +#define MATCH_VRSUB_VX 0xc004057 +#define MASK_VRSUB_VX 0xfc00707f +#define MATCH_VMINU_VX 0x10004057 +#define MASK_VMINU_VX 0xfc00707f +#define MATCH_VMIN_VX 0x14004057 +#define MASK_VMIN_VX 0xfc00707f +#define MATCH_VMAXU_VX 0x18004057 +#define MASK_VMAXU_VX 0xfc00707f +#define MATCH_VMAX_VX 0x1c004057 +#define MASK_VMAX_VX 0xfc00707f +#define MATCH_VAND_VX 0x24004057 +#define MASK_VAND_VX 0xfc00707f +#define MATCH_VOR_VX 0x28004057 +#define MASK_VOR_VX 0xfc00707f +#define MATCH_VXOR_VX 0x2c004057 +#define MASK_VXOR_VX 0xfc00707f +#define MATCH_VRGATHER_VX 0x30004057 +#define MASK_VRGATHER_VX 0xfc00707f +#define MATCH_VSLIDEUP_VX 0x38004057 +#define MASK_VSLIDEUP_VX 0xfc00707f +#define MATCH_VSLIDEDOWN_VX 0x3c004057 +#define MASK_VSLIDEDOWN_VX 0xfc00707f +#define MATCH_VADC_VXM 0x40004057 +#define MASK_VADC_VXM 0xfe00707f +#define MATCH_VMADC_VXM 0x44004057 +#define MASK_VMADC_VXM 0xfc00707f +#define MATCH_VSBC_VXM 0x48004057 +#define MASK_VSBC_VXM 0xfe00707f +#define MATCH_VMSBC_VXM 0x4c004057 +#define MASK_VMSBC_VXM 0xfc00707f +#define MATCH_VMERGE_VXM 0x5c004057 +#define MASK_VMERGE_VXM 0xfe00707f +#define MATCH_VMV_V_X 0x5e004057 +#define MASK_VMV_V_X 0xfff0707f +#define MATCH_VMSEQ_VX 0x60004057 +#define MASK_VMSEQ_VX 0xfc00707f +#define MATCH_VMSNE_VX 0x64004057 +#define MASK_VMSNE_VX 0xfc00707f +#define MATCH_VMSLTU_VX 0x68004057 +#define MASK_VMSLTU_VX 0xfc00707f +#define MATCH_VMSLT_VX 0x6c004057 +#define MASK_VMSLT_VX 0xfc00707f +#define MATCH_VMSLEU_VX 0x70004057 +#define MASK_VMSLEU_VX 0xfc00707f +#define MATCH_VMSLE_VX 0x74004057 +#define MASK_VMSLE_VX 0xfc00707f +#define MATCH_VMSGTU_VX 0x78004057 +#define MASK_VMSGTU_VX 0xfc00707f +#define MATCH_VMSGT_VX 0x7c004057 +#define MASK_VMSGT_VX 0xfc00707f +#define MATCH_VSADDU_VX 0x80004057 +#define MASK_VSADDU_VX 0xfc00707f +#define MATCH_VSADD_VX 0x84004057 +#define MASK_VSADD_VX 0xfc00707f +#define MATCH_VSSUBU_VX 0x88004057 +#define MASK_VSSUBU_VX 0xfc00707f +#define MATCH_VSSUB_VX 0x8c004057 +#define MASK_VSSUB_VX 0xfc00707f +#define MATCH_VSLL_VX 0x94004057 +#define MASK_VSLL_VX 0xfc00707f +#define MATCH_VSMUL_VX 0x9c004057 +#define MASK_VSMUL_VX 0xfc00707f +#define MATCH_VSRL_VX 0xa0004057 +#define MASK_VSRL_VX 0xfc00707f +#define MATCH_VSRA_VX 0xa4004057 +#define MASK_VSRA_VX 0xfc00707f +#define MATCH_VSSRL_VX 0xa8004057 +#define MASK_VSSRL_VX 0xfc00707f +#define MATCH_VSSRA_VX 0xac004057 +#define MASK_VSSRA_VX 0xfc00707f +#define MATCH_VNSRL_WX 0xb0004057 +#define MASK_VNSRL_WX 0xfc00707f +#define MATCH_VNSRA_WX 0xb4004057 +#define MASK_VNSRA_WX 0xfc00707f +#define MATCH_VNCLIPU_WX 0xb8004057 +#define MASK_VNCLIPU_WX 0xfc00707f +#define MATCH_VNCLIP_WX 0xbc004057 +#define MASK_VNCLIP_WX 0xfc00707f +#define MATCH_VQMACCU_VX 0xf0004057 +#define MASK_VQMACCU_VX 0xfc00707f +#define MATCH_VQMACC_VX 0xf4004057 +#define MASK_VQMACC_VX 0xfc00707f +#define MATCH_VQMACCUS_VX 0xf8004057 +#define MASK_VQMACCUS_VX 0xfc00707f +#define MATCH_VQMACCSU_VX 0xfc004057 +#define MASK_VQMACCSU_VX 0xfc00707f +#define MATCH_VADD_VV 0x57 +#define MASK_VADD_VV 0xfc00707f +#define MATCH_VSUB_VV 0x8000057 +#define MASK_VSUB_VV 0xfc00707f +#define MATCH_VMINU_VV 0x10000057 +#define MASK_VMINU_VV 0xfc00707f +#define MATCH_VMIN_VV 0x14000057 +#define MASK_VMIN_VV 0xfc00707f +#define MATCH_VMAXU_VV 0x18000057 +#define MASK_VMAXU_VV 0xfc00707f +#define MATCH_VMAX_VV 0x1c000057 +#define MASK_VMAX_VV 0xfc00707f +#define MATCH_VAND_VV 0x24000057 +#define MASK_VAND_VV 0xfc00707f +#define MATCH_VOR_VV 0x28000057 +#define MASK_VOR_VV 0xfc00707f +#define MATCH_VXOR_VV 0x2c000057 +#define MASK_VXOR_VV 0xfc00707f +#define MATCH_VRGATHER_VV 0x30000057 +#define MASK_VRGATHER_VV 0xfc00707f +#define MATCH_VADC_VVM 0x40000057 +#define MASK_VADC_VVM 0xfe00707f +#define MATCH_VMADC_VVM 0x44000057 +#define MASK_VMADC_VVM 0xfc00707f +#define MATCH_VSBC_VVM 0x48000057 +#define MASK_VSBC_VVM 0xfe00707f +#define MATCH_VMSBC_VVM 0x4c000057 +#define MASK_VMSBC_VVM 0xfc00707f +#define MATCH_VMERGE_VVM 0x5c000057 +#define MASK_VMERGE_VVM 0xfe00707f +#define MATCH_VMV_V_V 0x5e000057 +#define MASK_VMV_V_V 0xfff0707f +#define MATCH_VMSEQ_VV 0x60000057 +#define MASK_VMSEQ_VV 0xfc00707f +#define MATCH_VMSNE_VV 0x64000057 +#define MASK_VMSNE_VV 0xfc00707f +#define MATCH_VMSLTU_VV 0x68000057 +#define MASK_VMSLTU_VV 0xfc00707f +#define MATCH_VMSLT_VV 0x6c000057 +#define MASK_VMSLT_VV 0xfc00707f +#define MATCH_VMSLEU_VV 0x70000057 +#define MASK_VMSLEU_VV 0xfc00707f +#define MATCH_VMSLE_VV 0x74000057 +#define MASK_VMSLE_VV 0xfc00707f +#define MATCH_VSADDU_VV 0x80000057 +#define MASK_VSADDU_VV 0xfc00707f +#define MATCH_VSADD_VV 0x84000057 +#define MASK_VSADD_VV 0xfc00707f +#define MATCH_VSSUBU_VV 0x88000057 +#define MASK_VSSUBU_VV 0xfc00707f +#define MATCH_VSSUB_VV 0x8c000057 +#define MASK_VSSUB_VV 0xfc00707f +#define MATCH_VSLL_VV 0x94000057 +#define MASK_VSLL_VV 0xfc00707f +#define MATCH_VSMUL_VV 0x9c000057 +#define MASK_VSMUL_VV 0xfc00707f +#define MATCH_VSRL_VV 0xa0000057 +#define MASK_VSRL_VV 0xfc00707f +#define MATCH_VSRA_VV 0xa4000057 +#define MASK_VSRA_VV 0xfc00707f +#define MATCH_VSSRL_VV 0xa8000057 +#define MASK_VSSRL_VV 0xfc00707f +#define MATCH_VSSRA_VV 0xac000057 +#define MASK_VSSRA_VV 0xfc00707f +#define MATCH_VNSRL_WV 0xb0000057 +#define MASK_VNSRL_WV 0xfc00707f +#define MATCH_VNSRA_WV 0xb4000057 +#define MASK_VNSRA_WV 0xfc00707f +#define MATCH_VNCLIPU_WV 0xb8000057 +#define MASK_VNCLIPU_WV 0xfc00707f +#define MATCH_VNCLIP_WV 0xbc000057 +#define MASK_VNCLIP_WV 0xfc00707f +#define MATCH_VWREDSUMU_VS 0xc0000057 +#define MASK_VWREDSUMU_VS 0xfc00707f +#define MATCH_VWREDSUM_VS 0xc4000057 +#define MASK_VWREDSUM_VS 0xfc00707f +#define MATCH_VDOTU_VV 0xe0000057 +#define MASK_VDOTU_VV 0xfc00707f +#define MATCH_VDOT_VV 0xe4000057 +#define MASK_VDOT_VV 0xfc00707f +#define MATCH_VQMACCU_VV 0xf0000057 +#define MASK_VQMACCU_VV 0xfc00707f +#define MATCH_VQMACC_VV 0xf4000057 +#define MASK_VQMACC_VV 0xfc00707f +#define MATCH_VQMACCSU_VV 0xfc000057 +#define MASK_VQMACCSU_VV 0xfc00707f +#define MATCH_VADD_VI 0x3057 +#define MASK_VADD_VI 0xfc00707f +#define MATCH_VRSUB_VI 0xc003057 +#define MASK_VRSUB_VI 0xfc00707f +#define MATCH_VAND_VI 0x24003057 +#define MASK_VAND_VI 0xfc00707f +#define MATCH_VOR_VI 0x28003057 +#define MASK_VOR_VI 0xfc00707f +#define MATCH_VXOR_VI 0x2c003057 +#define MASK_VXOR_VI 0xfc00707f +#define MATCH_VRGATHER_VI 0x30003057 +#define MASK_VRGATHER_VI 0xfc00707f +#define MATCH_VSLIDEUP_VI 0x38003057 +#define MASK_VSLIDEUP_VI 0xfc00707f +#define MATCH_VSLIDEDOWN_VI 0x3c003057 +#define MASK_VSLIDEDOWN_VI 0xfc00707f +#define MATCH_VADC_VIM 0x40003057 +#define MASK_VADC_VIM 0xfe00707f +#define MATCH_VMADC_VIM 0x44003057 +#define MASK_VMADC_VIM 0xfc00707f +#define MATCH_VMERGE_VIM 0x5c003057 +#define MASK_VMERGE_VIM 0xfe00707f +#define MATCH_VMV_V_I 0x5e003057 +#define MASK_VMV_V_I 0xfff0707f +#define MATCH_VMSEQ_VI 0x60003057 +#define MASK_VMSEQ_VI 0xfc00707f +#define MATCH_VMSNE_VI 0x64003057 +#define MASK_VMSNE_VI 0xfc00707f +#define MATCH_VMSLEU_VI 0x70003057 +#define MASK_VMSLEU_VI 0xfc00707f +#define MATCH_VMSLE_VI 0x74003057 +#define MASK_VMSLE_VI 0xfc00707f +#define MATCH_VMSGTU_VI 0x78003057 +#define MASK_VMSGTU_VI 0xfc00707f +#define MATCH_VMSGT_VI 0x7c003057 +#define MASK_VMSGT_VI 0xfc00707f +#define MATCH_VSADDU_VI 0x80003057 +#define MASK_VSADDU_VI 0xfc00707f +#define MATCH_VSADD_VI 0x84003057 +#define MASK_VSADD_VI 0xfc00707f +#define MATCH_VSLL_VI 0x94003057 +#define MASK_VSLL_VI 0xfc00707f +#define MATCH_VMV1R_V 0x9e003057 +#define MASK_VMV1R_V 0xfe0ff07f +#define MATCH_VMV2R_V 0x9e00b057 +#define MASK_VMV2R_V 0xfe0ff07f +#define MATCH_VMV4R_V 0x9e01b057 +#define MASK_VMV4R_V 0xfe0ff07f +#define MATCH_VMV8R_V 0x9e03b057 +#define MASK_VMV8R_V 0xfe0ff07f +#define MATCH_VSRL_VI 0xa0003057 +#define MASK_VSRL_VI 0xfc00707f +#define MATCH_VSRA_VI 0xa4003057 +#define MASK_VSRA_VI 0xfc00707f +#define MATCH_VSSRL_VI 0xa8003057 +#define MASK_VSSRL_VI 0xfc00707f +#define MATCH_VSSRA_VI 0xac003057 +#define MASK_VSSRA_VI 0xfc00707f +#define MATCH_VNSRL_WI 0xb0003057 +#define MASK_VNSRL_WI 0xfc00707f +#define MATCH_VNSRA_WI 0xb4003057 +#define MASK_VNSRA_WI 0xfc00707f +#define MATCH_VNCLIPU_WI 0xb8003057 +#define MASK_VNCLIPU_WI 0xfc00707f +#define MATCH_VNCLIP_WI 0xbc003057 +#define MASK_VNCLIP_WI 0xfc00707f +#define MATCH_VREDSUM_VS 0x2057 +#define MASK_VREDSUM_VS 0xfc00707f +#define MATCH_VREDAND_VS 0x4002057 +#define MASK_VREDAND_VS 0xfc00707f +#define MATCH_VREDOR_VS 0x8002057 +#define MASK_VREDOR_VS 0xfc00707f +#define MATCH_VREDXOR_VS 0xc002057 +#define MASK_VREDXOR_VS 0xfc00707f +#define MATCH_VREDMINU_VS 0x10002057 +#define MASK_VREDMINU_VS 0xfc00707f +#define MATCH_VREDMIN_VS 0x14002057 +#define MASK_VREDMIN_VS 0xfc00707f +#define MATCH_VREDMAXU_VS 0x18002057 +#define MASK_VREDMAXU_VS 0xfc00707f +#define MATCH_VREDMAX_VS 0x1c002057 +#define MASK_VREDMAX_VS 0xfc00707f +#define MATCH_VAADDU_VV 0x20002057 +#define MASK_VAADDU_VV 0xfc00707f +#define MATCH_VAADD_VV 0x24002057 +#define MASK_VAADD_VV 0xfc00707f +#define MATCH_VASUBU_VV 0x28002057 +#define MASK_VASUBU_VV 0xfc00707f +#define MATCH_VASUB_VV 0x2c002057 +#define MASK_VASUB_VV 0xfc00707f +#define MATCH_VMV_X_S 0x42002057 +#define MASK_VMV_X_S 0xfe0ff07f +#define MATCH_VCOMPRESS_VM 0x5e002057 +#define MASK_VCOMPRESS_VM 0xfe00707f +#define MATCH_VMANDNOT_MM 0x60002057 +#define MASK_VMANDNOT_MM 0xfc00707f +#define MATCH_VMAND_MM 0x64002057 +#define MASK_VMAND_MM 0xfc00707f +#define MATCH_VMOR_MM 0x68002057 +#define MASK_VMOR_MM 0xfc00707f +#define MATCH_VMXOR_MM 0x6c002057 +#define MASK_VMXOR_MM 0xfc00707f +#define MATCH_VMORNOT_MM 0x70002057 +#define MASK_VMORNOT_MM 0xfc00707f +#define MATCH_VMNAND_MM 0x74002057 +#define MASK_VMNAND_MM 0xfc00707f +#define MATCH_VMNOR_MM 0x78002057 +#define MASK_VMNOR_MM 0xfc00707f +#define MATCH_VMXNOR_MM 0x7c002057 +#define MASK_VMXNOR_MM 0xfc00707f +#define MATCH_VMSBF_M 0x5000a057 +#define MASK_VMSBF_M 0xfc0ff07f +#define MATCH_VMSOF_M 0x50012057 +#define MASK_VMSOF_M 0xfc0ff07f +#define MATCH_VMSIF_M 0x5001a057 +#define MASK_VMSIF_M 0xfc0ff07f +#define MATCH_VIOTA_M 0x50082057 +#define MASK_VIOTA_M 0xfc0ff07f +#define MATCH_VID_V 0x5008a057 +#define MASK_VID_V 0xfdfff07f +#define MATCH_VPOPC_M 0x40082057 +#define MASK_VPOPC_M 0xfc0ff07f +#define MATCH_VFIRST_M 0x4008a057 +#define MASK_VFIRST_M 0xfc0ff07f +#define MATCH_VDIVU_VV 0x80002057 +#define MASK_VDIVU_VV 0xfc00707f +#define MATCH_VDIV_VV 0x84002057 +#define MASK_VDIV_VV 0xfc00707f +#define MATCH_VREMU_VV 0x88002057 +#define MASK_VREMU_VV 0xfc00707f +#define MATCH_VREM_VV 0x8c002057 +#define MASK_VREM_VV 0xfc00707f +#define MATCH_VMULHU_VV 0x90002057 +#define MASK_VMULHU_VV 0xfc00707f +#define MATCH_VMUL_VV 0x94002057 +#define MASK_VMUL_VV 0xfc00707f +#define MATCH_VMULHSU_VV 0x98002057 +#define MASK_VMULHSU_VV 0xfc00707f +#define MATCH_VMULH_VV 0x9c002057 +#define MASK_VMULH_VV 0xfc00707f +#define MATCH_VMADD_VV 0xa4002057 +#define MASK_VMADD_VV 0xfc00707f +#define MATCH_VNMSUB_VV 0xac002057 +#define MASK_VNMSUB_VV 0xfc00707f +#define MATCH_VMACC_VV 0xb4002057 +#define MASK_VMACC_VV 0xfc00707f +#define MATCH_VNMSAC_VV 0xbc002057 +#define MASK_VNMSAC_VV 0xfc00707f +#define MATCH_VWADDU_VV 0xc0002057 +#define MASK_VWADDU_VV 0xfc00707f +#define MATCH_VWADD_VV 0xc4002057 +#define MASK_VWADD_VV 0xfc00707f +#define MATCH_VWSUBU_VV 0xc8002057 +#define MASK_VWSUBU_VV 0xfc00707f +#define MATCH_VWSUB_VV 0xcc002057 +#define MASK_VWSUB_VV 0xfc00707f +#define MATCH_VWADDU_WV 0xd0002057 +#define MASK_VWADDU_WV 0xfc00707f +#define MATCH_VWADD_WV 0xd4002057 +#define MASK_VWADD_WV 0xfc00707f +#define MATCH_VWSUBU_WV 0xd8002057 +#define MASK_VWSUBU_WV 0xfc00707f +#define MATCH_VWSUB_WV 0xdc002057 +#define MASK_VWSUB_WV 0xfc00707f +#define MATCH_VWMULU_VV 0xe0002057 +#define MASK_VWMULU_VV 0xfc00707f +#define MATCH_VWMULSU_VV 0xe8002057 +#define MASK_VWMULSU_VV 0xfc00707f +#define MATCH_VWMUL_VV 0xec002057 +#define MASK_VWMUL_VV 0xfc00707f +#define MATCH_VWMACCU_VV 0xf0002057 +#define MASK_VWMACCU_VV 0xfc00707f +#define MATCH_VWMACC_VV 0xf4002057 +#define MASK_VWMACC_VV 0xfc00707f +#define MATCH_VWMACCSU_VV 0xfc002057 +#define MASK_VWMACCSU_VV 0xfc00707f +#define MATCH_VAADDU_VX 0x20006057 +#define MASK_VAADDU_VX 0xfc00707f +#define MATCH_VAADD_VX 0x24006057 +#define MASK_VAADD_VX 0xfc00707f +#define MATCH_VASUBU_VX 0x28006057 +#define MASK_VASUBU_VX 0xfc00707f +#define MATCH_VASUB_VX 0x2c006057 +#define MASK_VASUB_VX 0xfc00707f +#define MATCH_VMV_S_X 0x42006057 +#define MASK_VMV_S_X 0xfff0707f +#define MATCH_VSLIDE1UP_VX 0x38006057 +#define MASK_VSLIDE1UP_VX 0xfc00707f +#define MATCH_VSLIDE1DOWN_VX 0x3c006057 +#define MASK_VSLIDE1DOWN_VX 0xfc00707f +#define MATCH_VDIVU_VX 0x80006057 +#define MASK_VDIVU_VX 0xfc00707f +#define MATCH_VDIV_VX 0x84006057 +#define MASK_VDIV_VX 0xfc00707f +#define MATCH_VREMU_VX 0x88006057 +#define MASK_VREMU_VX 0xfc00707f +#define MATCH_VREM_VX 0x8c006057 +#define MASK_VREM_VX 0xfc00707f +#define MATCH_VMULHU_VX 0x90006057 +#define MASK_VMULHU_VX 0xfc00707f +#define MATCH_VMUL_VX 0x94006057 +#define MASK_VMUL_VX 0xfc00707f +#define MATCH_VMULHSU_VX 0x98006057 +#define MASK_VMULHSU_VX 0xfc00707f +#define MATCH_VMULH_VX 0x9c006057 +#define MASK_VMULH_VX 0xfc00707f +#define MATCH_VMADD_VX 0xa4006057 +#define MASK_VMADD_VX 0xfc00707f +#define MATCH_VNMSUB_VX 0xac006057 +#define MASK_VNMSUB_VX 0xfc00707f +#define MATCH_VMACC_VX 0xb4006057 +#define MASK_VMACC_VX 0xfc00707f +#define MATCH_VNMSAC_VX 0xbc006057 +#define MASK_VNMSAC_VX 0xfc00707f +#define MATCH_VWADDU_VX 0xc0006057 +#define MASK_VWADDU_VX 0xfc00707f +#define MATCH_VWADD_VX 0xc4006057 +#define MASK_VWADD_VX 0xfc00707f +#define MATCH_VWSUBU_VX 0xc8006057 +#define MASK_VWSUBU_VX 0xfc00707f +#define MATCH_VWSUB_VX 0xcc006057 +#define MASK_VWSUB_VX 0xfc00707f +#define MATCH_VWADDU_WX 0xd0006057 +#define MASK_VWADDU_WX 0xfc00707f +#define MATCH_VWADD_WX 0xd4006057 +#define MASK_VWADD_WX 0xfc00707f +#define MATCH_VWSUBU_WX 0xd8006057 +#define MASK_VWSUBU_WX 0xfc00707f +#define MATCH_VWSUB_WX 0xdc006057 +#define MASK_VWSUB_WX 0xfc00707f +#define MATCH_VWMULU_VX 0xe0006057 +#define MASK_VWMULU_VX 0xfc00707f +#define MATCH_VWMULSU_VX 0xe8006057 +#define MASK_VWMULSU_VX 0xfc00707f +#define MATCH_VWMUL_VX 0xec006057 +#define MASK_VWMUL_VX 0xfc00707f +#define MATCH_VWMACCU_VX 0xf0006057 +#define MASK_VWMACCU_VX 0xfc00707f +#define MATCH_VWMACC_VX 0xf4006057 +#define MASK_VWMACC_VX 0xfc00707f +#define MATCH_VWMACCUS_VX 0xf8006057 +#define MASK_VWMACCUS_VX 0xfc00707f +#define MATCH_VWMACCSU_VX 0xfc006057 +#define MASK_VWMACCSU_VX 0xfc00707f +#define MATCH_VAMOSWAPW_V 0x800602f +#define MASK_VAMOSWAPW_V 0xf800707f +#define MATCH_VAMOADDW_V 0x602f +#define MASK_VAMOADDW_V 0xf800707f +#define MATCH_VAMOXORW_V 0x2000602f +#define MASK_VAMOXORW_V 0xf800707f +#define MATCH_VAMOANDW_V 0x6000602f +#define MASK_VAMOANDW_V 0xf800707f +#define MATCH_VAMOORW_V 0x4000602f +#define MASK_VAMOORW_V 0xf800707f +#define MATCH_VAMOMINW_V 0x8000602f +#define MASK_VAMOMINW_V 0xf800707f +#define MATCH_VAMOMAXW_V 0xa000602f +#define MASK_VAMOMAXW_V 0xf800707f +#define MATCH_VAMOMINUW_V 0xc000602f +#define MASK_VAMOMINUW_V 0xf800707f +#define MATCH_VAMOMAXUW_V 0xe000602f +#define MASK_VAMOMAXUW_V 0xf800707f +#define MATCH_VAMOSWAPE_V 0x800702f +#define MASK_VAMOSWAPE_V 0xf800707f +#define MATCH_VAMOADDE_V 0x702f +#define MASK_VAMOADDE_V 0xf800707f +#define MATCH_VAMOXORE_V 0x2000702f +#define MASK_VAMOXORE_V 0xf800707f +#define MATCH_VAMOANDE_V 0x6000702f +#define MASK_VAMOANDE_V 0xf800707f +#define MATCH_VAMOORE_V 0x4000702f +#define MASK_VAMOORE_V 0xf800707f +#define MATCH_VAMOMINE_V 0x8000702f +#define MASK_VAMOMINE_V 0xf800707f +#define MATCH_VAMOMAXE_V 0xa000702f +#define MASK_VAMOMAXE_V 0xf800707f +#define MATCH_VAMOMINUE_V 0xc000702f +#define MASK_VAMOMINUE_V 0xf800707f +#define MATCH_VAMOMAXUE_V 0xe000702f +#define MASK_VAMOMAXUE_V 0xf800707f +#define MATCH_VMVNFR_V 0x9e003057 +#define MASK_VMVNFR_V 0xfe00707f +#define CSR_FFLAGS 0x1 +#define CSR_FRM 0x2 +#define CSR_FCSR 0x3 +#define CSR_USTATUS 0x0 +#define CSR_UIE 0x4 +#define CSR_UTVEC 0x5 +#define CSR_VSTART 0x8 +#define CSR_VXSAT 0x9 +#define CSR_VXRM 0xa +#define CSR_VCSR 0xf +#define CSR_USCRATCH 0x40 +#define CSR_UEPC 0x41 +#define CSR_UCAUSE 0x42 +#define CSR_UTVAL 0x43 +#define CSR_UIP 0x44 +#define CSR_CYCLE 0xc00 +#define CSR_TIME 0xc01 +#define CSR_INSTRET 0xc02 +#define CSR_HPMCOUNTER3 0xc03 +#define CSR_HPMCOUNTER4 0xc04 +#define CSR_HPMCOUNTER5 0xc05 +#define CSR_HPMCOUNTER6 0xc06 +#define CSR_HPMCOUNTER7 0xc07 +#define CSR_HPMCOUNTER8 0xc08 +#define CSR_HPMCOUNTER9 0xc09 +#define CSR_HPMCOUNTER10 0xc0a +#define CSR_HPMCOUNTER11 0xc0b +#define CSR_HPMCOUNTER12 0xc0c +#define CSR_HPMCOUNTER13 0xc0d +#define CSR_HPMCOUNTER14 0xc0e +#define CSR_HPMCOUNTER15 0xc0f +#define CSR_HPMCOUNTER16 0xc10 +#define CSR_HPMCOUNTER17 0xc11 +#define CSR_HPMCOUNTER18 0xc12 +#define CSR_HPMCOUNTER19 0xc13 +#define CSR_HPMCOUNTER20 0xc14 +#define CSR_HPMCOUNTER21 0xc15 +#define CSR_HPMCOUNTER22 0xc16 +#define CSR_HPMCOUNTER23 0xc17 +#define CSR_HPMCOUNTER24 0xc18 +#define CSR_HPMCOUNTER25 0xc19 +#define CSR_HPMCOUNTER26 0xc1a +#define CSR_HPMCOUNTER27 0xc1b +#define CSR_HPMCOUNTER28 0xc1c +#define CSR_HPMCOUNTER29 0xc1d +#define CSR_HPMCOUNTER30 0xc1e +#define CSR_HPMCOUNTER31 0xc1f +#define CSR_VL 0xc20 +#define CSR_VTYPE 0xc21 +#define CSR_VLENB 0xc22 +#define CSR_SSTATUS 0x100 +#define CSR_SEDELEG 0x102 +#define CSR_SIDELEG 0x103 +#define CSR_SIE 0x104 +#define CSR_STVEC 0x105 +#define CSR_SCOUNTEREN 0x106 +#define CSR_SSCRATCH 0x140 +#define CSR_SEPC 0x141 +#define CSR_SCAUSE 0x142 +#define CSR_STVAL 0x143 +#define CSR_SIP 0x144 +#define CSR_SATP 0x180 +#define CSR_VSSTATUS 0x200 +#define CSR_VSIE 0x204 +#define CSR_VSTVEC 0x205 +#define CSR_VSSCRATCH 0x240 +#define CSR_VSEPC 0x241 +#define CSR_VSCAUSE 0x242 +#define CSR_VSTVAL 0x243 +#define CSR_VSIP 0x244 +#define CSR_VSATP 0x280 +#define CSR_HSTATUS 0x600 +#define CSR_HEDELEG 0x602 +#define CSR_HIDELEG 0x603 +#define CSR_HIE 0x604 +#define CSR_HTIMEDELTA 0x605 +#define CSR_HCOUNTEREN 0x606 +#define CSR_HGEIE 0x607 +#define CSR_HTVAL 0x643 +#define CSR_HIP 0x644 +#define CSR_HVIP 0x645 +#define CSR_HTINST 0x64a +#define CSR_HGATP 0x680 +#define CSR_HGEIP 0xe12 +#define CSR_UTVT 0x7 +#define CSR_UNXTI 0x45 +#define CSR_UINTSTATUS 0x46 +#define CSR_USCRATCHCSW 0x48 +#define CSR_USCRATCHCSWL 0x49 +#define CSR_STVT 0x107 +#define CSR_SNXTI 0x145 +#define CSR_SINTSTATUS 0x146 +#define CSR_SSCRATCHCSW 0x148 +#define CSR_SSCRATCHCSWL 0x149 +#define CSR_MTVT 0x307 +#define CSR_MNXTI 0x345 +#define CSR_MINTSTATUS 0x346 +#define CSR_MSCRATCHCSW 0x348 +#define CSR_MSCRATCHCSWL 0x349 +#define CSR_MSTATUS 0x300 +#define CSR_MISA 0x301 +#define CSR_MEDELEG 0x302 +#define CSR_MIDELEG 0x303 +#define CSR_MIE 0x304 +#define CSR_MTVEC 0x305 +#define CSR_MCOUNTEREN 0x306 +#define CSR_MCOUNTINHIBIT 0x320 +#define CSR_MSCRATCH 0x340 +#define CSR_MEPC 0x341 +#define CSR_MCAUSE 0x342 +#define CSR_MTVAL 0x343 +#define CSR_MIP 0x344 +#define CSR_MTINST 0x34a +#define CSR_MTVAL2 0x34b +#define CSR_PMPCFG0 0x3a0 +#define CSR_PMPCFG1 0x3a1 +#define CSR_PMPCFG2 0x3a2 +#define CSR_PMPCFG3 0x3a3 +#define CSR_PMPADDR0 0x3b0 +#define CSR_PMPADDR1 0x3b1 +#define CSR_PMPADDR2 0x3b2 +#define CSR_PMPADDR3 0x3b3 +#define CSR_PMPADDR4 0x3b4 +#define CSR_PMPADDR5 0x3b5 +#define CSR_PMPADDR6 0x3b6 +#define CSR_PMPADDR7 0x3b7 +#define CSR_PMPADDR8 0x3b8 +#define CSR_PMPADDR9 0x3b9 +#define CSR_PMPADDR10 0x3ba +#define CSR_PMPADDR11 0x3bb +#define CSR_PMPADDR12 0x3bc +#define CSR_PMPADDR13 0x3bd +#define CSR_PMPADDR14 0x3be +#define CSR_PMPADDR15 0x3bf +#define CSR_TSELECT 0x7a0 +#define CSR_TDATA1 0x7a1 +#define CSR_TDATA2 0x7a2 +#define CSR_TDATA3 0x7a3 +#define CSR_DCSR 0x7b0 +#define CSR_DPC 0x7b1 +#define CSR_DSCRATCH0 0x7b2 +#define CSR_DSCRATCH1 0x7b3 +#define CSR_MCYCLE 0xb00 +#define CSR_MINSTRET 0xb02 +#define CSR_MHPMCOUNTER3 0xb03 +#define CSR_MHPMCOUNTER4 0xb04 +#define CSR_MHPMCOUNTER5 0xb05 +#define CSR_MHPMCOUNTER6 0xb06 +#define CSR_MHPMCOUNTER7 0xb07 +#define CSR_MHPMCOUNTER8 0xb08 +#define CSR_MHPMCOUNTER9 0xb09 +#define CSR_MHPMCOUNTER10 0xb0a +#define CSR_MHPMCOUNTER11 0xb0b +#define CSR_MHPMCOUNTER12 0xb0c +#define CSR_MHPMCOUNTER13 0xb0d +#define CSR_MHPMCOUNTER14 0xb0e +#define CSR_MHPMCOUNTER15 0xb0f +#define CSR_MHPMCOUNTER16 0xb10 +#define CSR_MHPMCOUNTER17 0xb11 +#define CSR_MHPMCOUNTER18 0xb12 +#define CSR_MHPMCOUNTER19 0xb13 +#define CSR_MHPMCOUNTER20 0xb14 +#define CSR_MHPMCOUNTER21 0xb15 +#define CSR_MHPMCOUNTER22 0xb16 +#define CSR_MHPMCOUNTER23 0xb17 +#define CSR_MHPMCOUNTER24 0xb18 +#define CSR_MHPMCOUNTER25 0xb19 +#define CSR_MHPMCOUNTER26 0xb1a +#define CSR_MHPMCOUNTER27 0xb1b +#define CSR_MHPMCOUNTER28 0xb1c +#define CSR_MHPMCOUNTER29 0xb1d +#define CSR_MHPMCOUNTER30 0xb1e +#define CSR_MHPMCOUNTER31 0xb1f +#define CSR_MHPMEVENT3 0x323 +#define CSR_MHPMEVENT4 0x324 +#define CSR_MHPMEVENT5 0x325 +#define CSR_MHPMEVENT6 0x326 +#define CSR_MHPMEVENT7 0x327 +#define CSR_MHPMEVENT8 0x328 +#define CSR_MHPMEVENT9 0x329 +#define CSR_MHPMEVENT10 0x32a +#define CSR_MHPMEVENT11 0x32b +#define CSR_MHPMEVENT12 0x32c +#define CSR_MHPMEVENT13 0x32d +#define CSR_MHPMEVENT14 0x32e +#define CSR_MHPMEVENT15 0x32f +#define CSR_MHPMEVENT16 0x330 +#define CSR_MHPMEVENT17 0x331 +#define CSR_MHPMEVENT18 0x332 +#define CSR_MHPMEVENT19 0x333 +#define CSR_MHPMEVENT20 0x334 +#define CSR_MHPMEVENT21 0x335 +#define CSR_MHPMEVENT22 0x336 +#define CSR_MHPMEVENT23 0x337 +#define CSR_MHPMEVENT24 0x338 +#define CSR_MHPMEVENT25 0x339 +#define CSR_MHPMEVENT26 0x33a +#define CSR_MHPMEVENT27 0x33b +#define CSR_MHPMEVENT28 0x33c +#define CSR_MHPMEVENT29 0x33d +#define CSR_MHPMEVENT30 0x33e +#define CSR_MHPMEVENT31 0x33f +#define CSR_MVENDORID 0xf11 +#define CSR_MARCHID 0xf12 +#define CSR_MIMPID 0xf13 +#define CSR_MHARTID 0xf14 +#define CSR_HTIMEDELTAH 0x615 +#define CSR_CYCLEH 0xc80 +#define CSR_TIMEH 0xc81 +#define CSR_INSTRETH 0xc82 +#define CSR_HPMCOUNTER3H 0xc83 +#define CSR_HPMCOUNTER4H 0xc84 +#define CSR_HPMCOUNTER5H 0xc85 +#define CSR_HPMCOUNTER6H 0xc86 +#define CSR_HPMCOUNTER7H 0xc87 +#define CSR_HPMCOUNTER8H 0xc88 +#define CSR_HPMCOUNTER9H 0xc89 +#define CSR_HPMCOUNTER10H 0xc8a +#define CSR_HPMCOUNTER11H 0xc8b +#define CSR_HPMCOUNTER12H 0xc8c +#define CSR_HPMCOUNTER13H 0xc8d +#define CSR_HPMCOUNTER14H 0xc8e +#define CSR_HPMCOUNTER15H 0xc8f +#define CSR_HPMCOUNTER16H 0xc90 +#define CSR_HPMCOUNTER17H 0xc91 +#define CSR_HPMCOUNTER18H 0xc92 +#define CSR_HPMCOUNTER19H 0xc93 +#define CSR_HPMCOUNTER20H 0xc94 +#define CSR_HPMCOUNTER21H 0xc95 +#define CSR_HPMCOUNTER22H 0xc96 +#define CSR_HPMCOUNTER23H 0xc97 +#define CSR_HPMCOUNTER24H 0xc98 +#define CSR_HPMCOUNTER25H 0xc99 +#define CSR_HPMCOUNTER26H 0xc9a +#define CSR_HPMCOUNTER27H 0xc9b +#define CSR_HPMCOUNTER28H 0xc9c +#define CSR_HPMCOUNTER29H 0xc9d +#define CSR_HPMCOUNTER30H 0xc9e +#define CSR_HPMCOUNTER31H 0xc9f +#define CSR_MSTATUSH 0x310 +#define CSR_MCYCLEH 0xb80 +#define CSR_MINSTRETH 0xb82 +#define CSR_MHPMCOUNTER3H 0xb83 +#define CSR_MHPMCOUNTER4H 0xb84 +#define CSR_MHPMCOUNTER5H 0xb85 +#define CSR_MHPMCOUNTER6H 0xb86 +#define CSR_MHPMCOUNTER7H 0xb87 +#define CSR_MHPMCOUNTER8H 0xb88 +#define CSR_MHPMCOUNTER9H 0xb89 +#define CSR_MHPMCOUNTER10H 0xb8a +#define CSR_MHPMCOUNTER11H 0xb8b +#define CSR_MHPMCOUNTER12H 0xb8c +#define CSR_MHPMCOUNTER13H 0xb8d +#define CSR_MHPMCOUNTER14H 0xb8e +#define CSR_MHPMCOUNTER15H 0xb8f +#define CSR_MHPMCOUNTER16H 0xb90 +#define CSR_MHPMCOUNTER17H 0xb91 +#define CSR_MHPMCOUNTER18H 0xb92 +#define CSR_MHPMCOUNTER19H 0xb93 +#define CSR_MHPMCOUNTER20H 0xb94 +#define CSR_MHPMCOUNTER21H 0xb95 +#define CSR_MHPMCOUNTER22H 0xb96 +#define CSR_MHPMCOUNTER23H 0xb97 +#define CSR_MHPMCOUNTER24H 0xb98 +#define CSR_MHPMCOUNTER25H 0xb99 +#define CSR_MHPMCOUNTER26H 0xb9a +#define CSR_MHPMCOUNTER27H 0xb9b +#define CSR_MHPMCOUNTER28H 0xb9c +#define CSR_MHPMCOUNTER29H 0xb9d +#define CSR_MHPMCOUNTER30H 0xb9e +#define CSR_MHPMCOUNTER31H 0xb9f +#define CAUSE_MISALIGNED_FETCH 0x0 +#define CAUSE_FETCH_ACCESS 0x1 +#define CAUSE_ILLEGAL_INSTRUCTION 0x2 +#define CAUSE_BREAKPOINT 0x3 +#define CAUSE_MISALIGNED_LOAD 0x4 +#define CAUSE_LOAD_ACCESS 0x5 +#define CAUSE_MISALIGNED_STORE 0x6 +#define CAUSE_STORE_ACCESS 0x7 +#define CAUSE_USER_ECALL 0x8 +#define CAUSE_SUPERVISOR_ECALL 0x9 +#define CAUSE_HYPERVISOR_ECALL 0xa +#define CAUSE_MACHINE_ECALL 0xb +#define CAUSE_FETCH_PAGE_FAULT 0xc +#define CAUSE_LOAD_PAGE_FAULT 0xd +#define CAUSE_STORE_PAGE_FAULT 0xf +#endif +#ifdef DECLARE_INSN +DECLARE_INSN(slli_rv32, MATCH_SLLI_RV32, MASK_SLLI_RV32) +DECLARE_INSN(srli_rv32, MATCH_SRLI_RV32, MASK_SRLI_RV32) +DECLARE_INSN(srai_rv32, MATCH_SRAI_RV32, MASK_SRAI_RV32) +DECLARE_INSN(frflags, MATCH_FRFLAGS, MASK_FRFLAGS) +DECLARE_INSN(fsflags, MATCH_FSFLAGS, MASK_FSFLAGS) +DECLARE_INSN(fsflagsi, MATCH_FSFLAGSI, MASK_FSFLAGSI) +DECLARE_INSN(frrm, MATCH_FRRM, MASK_FRRM) +DECLARE_INSN(fsrm, MATCH_FSRM, MASK_FSRM) +DECLARE_INSN(fsrmi, MATCH_FSRMI, MASK_FSRMI) +DECLARE_INSN(fscsr, MATCH_FSCSR, MASK_FSCSR) +DECLARE_INSN(frcsr, MATCH_FRCSR, MASK_FRCSR) +DECLARE_INSN(rdcycle, MATCH_RDCYCLE, MASK_RDCYCLE) +DECLARE_INSN(rdtime, MATCH_RDTIME, MASK_RDTIME) +DECLARE_INSN(rdinstret, MATCH_RDINSTRET, MASK_RDINSTRET) +DECLARE_INSN(rdcycleh, MATCH_RDCYCLEH, MASK_RDCYCLEH) +DECLARE_INSN(rdtimeh, MATCH_RDTIMEH, MASK_RDTIMEH) +DECLARE_INSN(rdinstreth, MATCH_RDINSTRETH, MASK_RDINSTRETH) +DECLARE_INSN(scall, MATCH_SCALL, MASK_SCALL) +DECLARE_INSN(sbreak, MATCH_SBREAK, MASK_SBREAK) +DECLARE_INSN(fmv_x_s, MATCH_FMV_X_S, MASK_FMV_X_S) +DECLARE_INSN(fmv_s_x, MATCH_FMV_S_X, MASK_FMV_S_X) +DECLARE_INSN(fence_tso, MATCH_FENCE_TSO, MASK_FENCE_TSO) +DECLARE_INSN(pause, MATCH_PAUSE, MASK_PAUSE) +DECLARE_INSN(beq, MATCH_BEQ, MASK_BEQ) +DECLARE_INSN(bne, MATCH_BNE, MASK_BNE) +DECLARE_INSN(blt, MATCH_BLT, MASK_BLT) +DECLARE_INSN(bge, MATCH_BGE, MASK_BGE) +DECLARE_INSN(bltu, MATCH_BLTU, MASK_BLTU) +DECLARE_INSN(bgeu, MATCH_BGEU, MASK_BGEU) +DECLARE_INSN(jalr, MATCH_JALR, MASK_JALR) +DECLARE_INSN(jal, MATCH_JAL, MASK_JAL) +DECLARE_INSN(lui, MATCH_LUI, MASK_LUI) +DECLARE_INSN(auipc, MATCH_AUIPC, MASK_AUIPC) +DECLARE_INSN(addi, MATCH_ADDI, MASK_ADDI) +DECLARE_INSN(slli, MATCH_SLLI, MASK_SLLI) +DECLARE_INSN(slti, MATCH_SLTI, MASK_SLTI) +DECLARE_INSN(sltiu, MATCH_SLTIU, MASK_SLTIU) +DECLARE_INSN(xori, MATCH_XORI, MASK_XORI) +DECLARE_INSN(srli, MATCH_SRLI, MASK_SRLI) +DECLARE_INSN(srai, MATCH_SRAI, MASK_SRAI) +DECLARE_INSN(ori, MATCH_ORI, MASK_ORI) +DECLARE_INSN(andi, MATCH_ANDI, MASK_ANDI) +DECLARE_INSN(add, MATCH_ADD, MASK_ADD) +DECLARE_INSN(sub, MATCH_SUB, MASK_SUB) +DECLARE_INSN(sll, MATCH_SLL, MASK_SLL) +DECLARE_INSN(slt, MATCH_SLT, MASK_SLT) +DECLARE_INSN(sltu, MATCH_SLTU, MASK_SLTU) +DECLARE_INSN(xor, MATCH_XOR, MASK_XOR) +DECLARE_INSN(srl, MATCH_SRL, MASK_SRL) +DECLARE_INSN(sra, MATCH_SRA, MASK_SRA) +DECLARE_INSN(or, MATCH_OR, MASK_OR) +DECLARE_INSN(and, MATCH_AND, MASK_AND) +DECLARE_INSN(lb, MATCH_LB, MASK_LB) +DECLARE_INSN(lh, MATCH_LH, MASK_LH) +DECLARE_INSN(lw, MATCH_LW, MASK_LW) +DECLARE_INSN(lbu, MATCH_LBU, MASK_LBU) +DECLARE_INSN(lhu, MATCH_LHU, MASK_LHU) +DECLARE_INSN(sb, MATCH_SB, MASK_SB) +DECLARE_INSN(sh, MATCH_SH, MASK_SH) +DECLARE_INSN(sw, MATCH_SW, MASK_SW) +DECLARE_INSN(fence, MATCH_FENCE, MASK_FENCE) +DECLARE_INSN(fence_i, MATCH_FENCE_I, MASK_FENCE_I) +DECLARE_INSN(addiw, MATCH_ADDIW, MASK_ADDIW) +DECLARE_INSN(slliw, MATCH_SLLIW, MASK_SLLIW) +DECLARE_INSN(srliw, MATCH_SRLIW, MASK_SRLIW) +DECLARE_INSN(sraiw, MATCH_SRAIW, MASK_SRAIW) +DECLARE_INSN(addw, MATCH_ADDW, MASK_ADDW) +DECLARE_INSN(subw, MATCH_SUBW, MASK_SUBW) +DECLARE_INSN(sllw, MATCH_SLLW, MASK_SLLW) +DECLARE_INSN(srlw, MATCH_SRLW, MASK_SRLW) +DECLARE_INSN(sraw, MATCH_SRAW, MASK_SRAW) +DECLARE_INSN(ld, MATCH_LD, MASK_LD) +DECLARE_INSN(lwu, MATCH_LWU, MASK_LWU) +DECLARE_INSN(sd, MATCH_SD, MASK_SD) +DECLARE_INSN(mul, MATCH_MUL, MASK_MUL) +DECLARE_INSN(mulh, MATCH_MULH, MASK_MULH) +DECLARE_INSN(mulhsu, MATCH_MULHSU, MASK_MULHSU) +DECLARE_INSN(mulhu, MATCH_MULHU, MASK_MULHU) +DECLARE_INSN(div, MATCH_DIV, MASK_DIV) +DECLARE_INSN(divu, MATCH_DIVU, MASK_DIVU) +DECLARE_INSN(rem, MATCH_REM, MASK_REM) +DECLARE_INSN(remu, MATCH_REMU, MASK_REMU) +DECLARE_INSN(mulw, MATCH_MULW, MASK_MULW) +DECLARE_INSN(divw, MATCH_DIVW, MASK_DIVW) +DECLARE_INSN(divuw, MATCH_DIVUW, MASK_DIVUW) +DECLARE_INSN(remw, MATCH_REMW, MASK_REMW) +DECLARE_INSN(remuw, MATCH_REMUW, MASK_REMUW) +DECLARE_INSN(amoadd_w, MATCH_AMOADD_W, MASK_AMOADD_W) +DECLARE_INSN(amoxor_w, MATCH_AMOXOR_W, MASK_AMOXOR_W) +DECLARE_INSN(amoor_w, MATCH_AMOOR_W, MASK_AMOOR_W) +DECLARE_INSN(amoand_w, MATCH_AMOAND_W, MASK_AMOAND_W) +DECLARE_INSN(amomin_w, MATCH_AMOMIN_W, MASK_AMOMIN_W) +DECLARE_INSN(amomax_w, MATCH_AMOMAX_W, MASK_AMOMAX_W) +DECLARE_INSN(amominu_w, MATCH_AMOMINU_W, MASK_AMOMINU_W) +DECLARE_INSN(amomaxu_w, MATCH_AMOMAXU_W, MASK_AMOMAXU_W) +DECLARE_INSN(amoswap_w, MATCH_AMOSWAP_W, MASK_AMOSWAP_W) +DECLARE_INSN(lr_w, MATCH_LR_W, MASK_LR_W) +DECLARE_INSN(sc_w, MATCH_SC_W, MASK_SC_W) +DECLARE_INSN(amoadd_d, MATCH_AMOADD_D, MASK_AMOADD_D) +DECLARE_INSN(amoxor_d, MATCH_AMOXOR_D, MASK_AMOXOR_D) +DECLARE_INSN(amoor_d, MATCH_AMOOR_D, MASK_AMOOR_D) +DECLARE_INSN(amoand_d, MATCH_AMOAND_D, MASK_AMOAND_D) +DECLARE_INSN(amomin_d, MATCH_AMOMIN_D, MASK_AMOMIN_D) +DECLARE_INSN(amomax_d, MATCH_AMOMAX_D, MASK_AMOMAX_D) +DECLARE_INSN(amominu_d, MATCH_AMOMINU_D, MASK_AMOMINU_D) +DECLARE_INSN(amomaxu_d, MATCH_AMOMAXU_D, MASK_AMOMAXU_D) +DECLARE_INSN(amoswap_d, MATCH_AMOSWAP_D, MASK_AMOSWAP_D) +DECLARE_INSN(lr_d, MATCH_LR_D, MASK_LR_D) +DECLARE_INSN(sc_d, MATCH_SC_D, MASK_SC_D) +DECLARE_INSN(fadd_s, MATCH_FADD_S, MASK_FADD_S) +DECLARE_INSN(fsub_s, MATCH_FSUB_S, MASK_FSUB_S) +DECLARE_INSN(fmul_s, MATCH_FMUL_S, MASK_FMUL_S) +DECLARE_INSN(fdiv_s, MATCH_FDIV_S, MASK_FDIV_S) +DECLARE_INSN(fsgnj_s, MATCH_FSGNJ_S, MASK_FSGNJ_S) +DECLARE_INSN(fsgnjn_s, MATCH_FSGNJN_S, MASK_FSGNJN_S) +DECLARE_INSN(fsgnjx_s, MATCH_FSGNJX_S, MASK_FSGNJX_S) +DECLARE_INSN(fmin_s, MATCH_FMIN_S, MASK_FMIN_S) +DECLARE_INSN(fmax_s, MATCH_FMAX_S, MASK_FMAX_S) +DECLARE_INSN(fsqrt_s, MATCH_FSQRT_S, MASK_FSQRT_S) +DECLARE_INSN(fle_s, MATCH_FLE_S, MASK_FLE_S) +DECLARE_INSN(flt_s, MATCH_FLT_S, MASK_FLT_S) +DECLARE_INSN(feq_s, MATCH_FEQ_S, MASK_FEQ_S) +DECLARE_INSN(fcvt_w_s, MATCH_FCVT_W_S, MASK_FCVT_W_S) +DECLARE_INSN(fcvt_wu_s, MATCH_FCVT_WU_S, MASK_FCVT_WU_S) +DECLARE_INSN(fmv_x_w, MATCH_FMV_X_W, MASK_FMV_X_W) +DECLARE_INSN(fclass_s, MATCH_FCLASS_S, MASK_FCLASS_S) +DECLARE_INSN(fcvt_s_w, MATCH_FCVT_S_W, MASK_FCVT_S_W) +DECLARE_INSN(fcvt_s_wu, MATCH_FCVT_S_WU, MASK_FCVT_S_WU) +DECLARE_INSN(fmv_w_x, MATCH_FMV_W_X, MASK_FMV_W_X) +DECLARE_INSN(flw, MATCH_FLW, MASK_FLW) +DECLARE_INSN(fsw, MATCH_FSW, MASK_FSW) +DECLARE_INSN(fmadd_s, MATCH_FMADD_S, MASK_FMADD_S) +DECLARE_INSN(fmsub_s, MATCH_FMSUB_S, MASK_FMSUB_S) +DECLARE_INSN(fnmsub_s, MATCH_FNMSUB_S, MASK_FNMSUB_S) +DECLARE_INSN(fnmadd_s, MATCH_FNMADD_S, MASK_FNMADD_S) +DECLARE_INSN(fcvt_l_s, MATCH_FCVT_L_S, MASK_FCVT_L_S) +DECLARE_INSN(fcvt_lu_s, MATCH_FCVT_LU_S, MASK_FCVT_LU_S) +DECLARE_INSN(fcvt_s_l, MATCH_FCVT_S_L, MASK_FCVT_S_L) +DECLARE_INSN(fcvt_s_lu, MATCH_FCVT_S_LU, MASK_FCVT_S_LU) +DECLARE_INSN(fadd_d, MATCH_FADD_D, MASK_FADD_D) +DECLARE_INSN(fsub_d, MATCH_FSUB_D, MASK_FSUB_D) +DECLARE_INSN(fmul_d, MATCH_FMUL_D, MASK_FMUL_D) +DECLARE_INSN(fdiv_d, MATCH_FDIV_D, MASK_FDIV_D) +DECLARE_INSN(fsgnj_d, MATCH_FSGNJ_D, MASK_FSGNJ_D) +DECLARE_INSN(fsgnjn_d, MATCH_FSGNJN_D, MASK_FSGNJN_D) +DECLARE_INSN(fsgnjx_d, MATCH_FSGNJX_D, MASK_FSGNJX_D) +DECLARE_INSN(fmin_d, MATCH_FMIN_D, MASK_FMIN_D) +DECLARE_INSN(fmax_d, MATCH_FMAX_D, MASK_FMAX_D) +DECLARE_INSN(fcvt_s_d, MATCH_FCVT_S_D, MASK_FCVT_S_D) +DECLARE_INSN(fcvt_d_s, MATCH_FCVT_D_S, MASK_FCVT_D_S) +DECLARE_INSN(fsqrt_d, MATCH_FSQRT_D, MASK_FSQRT_D) +DECLARE_INSN(fle_d, MATCH_FLE_D, MASK_FLE_D) +DECLARE_INSN(flt_d, MATCH_FLT_D, MASK_FLT_D) +DECLARE_INSN(feq_d, MATCH_FEQ_D, MASK_FEQ_D) +DECLARE_INSN(fcvt_w_d, MATCH_FCVT_W_D, MASK_FCVT_W_D) +DECLARE_INSN(fcvt_wu_d, MATCH_FCVT_WU_D, MASK_FCVT_WU_D) +DECLARE_INSN(fclass_d, MATCH_FCLASS_D, MASK_FCLASS_D) +DECLARE_INSN(fcvt_d_w, MATCH_FCVT_D_W, MASK_FCVT_D_W) +DECLARE_INSN(fcvt_d_wu, MATCH_FCVT_D_WU, MASK_FCVT_D_WU) +DECLARE_INSN(fld, MATCH_FLD, MASK_FLD) +DECLARE_INSN(fsd, MATCH_FSD, MASK_FSD) +DECLARE_INSN(fmadd_d, MATCH_FMADD_D, MASK_FMADD_D) +DECLARE_INSN(fmsub_d, MATCH_FMSUB_D, MASK_FMSUB_D) +DECLARE_INSN(fnmsub_d, MATCH_FNMSUB_D, MASK_FNMSUB_D) +DECLARE_INSN(fnmadd_d, MATCH_FNMADD_D, MASK_FNMADD_D) +DECLARE_INSN(fcvt_l_d, MATCH_FCVT_L_D, MASK_FCVT_L_D) +DECLARE_INSN(fcvt_lu_d, MATCH_FCVT_LU_D, MASK_FCVT_LU_D) +DECLARE_INSN(fmv_x_d, MATCH_FMV_X_D, MASK_FMV_X_D) +DECLARE_INSN(fcvt_d_l, MATCH_FCVT_D_L, MASK_FCVT_D_L) +DECLARE_INSN(fcvt_d_lu, MATCH_FCVT_D_LU, MASK_FCVT_D_LU) +DECLARE_INSN(fmv_d_x, MATCH_FMV_D_X, MASK_FMV_D_X) +DECLARE_INSN(fadd_q, MATCH_FADD_Q, MASK_FADD_Q) +DECLARE_INSN(fsub_q, MATCH_FSUB_Q, MASK_FSUB_Q) +DECLARE_INSN(fmul_q, MATCH_FMUL_Q, MASK_FMUL_Q) +DECLARE_INSN(fdiv_q, MATCH_FDIV_Q, MASK_FDIV_Q) +DECLARE_INSN(fsgnj_q, MATCH_FSGNJ_Q, MASK_FSGNJ_Q) +DECLARE_INSN(fsgnjn_q, MATCH_FSGNJN_Q, MASK_FSGNJN_Q) +DECLARE_INSN(fsgnjx_q, MATCH_FSGNJX_Q, MASK_FSGNJX_Q) +DECLARE_INSN(fmin_q, MATCH_FMIN_Q, MASK_FMIN_Q) +DECLARE_INSN(fmax_q, MATCH_FMAX_Q, MASK_FMAX_Q) +DECLARE_INSN(fcvt_s_q, MATCH_FCVT_S_Q, MASK_FCVT_S_Q) +DECLARE_INSN(fcvt_q_s, MATCH_FCVT_Q_S, MASK_FCVT_Q_S) +DECLARE_INSN(fcvt_d_q, MATCH_FCVT_D_Q, MASK_FCVT_D_Q) +DECLARE_INSN(fcvt_q_d, MATCH_FCVT_Q_D, MASK_FCVT_Q_D) +DECLARE_INSN(fsqrt_q, MATCH_FSQRT_Q, MASK_FSQRT_Q) +DECLARE_INSN(fle_q, MATCH_FLE_Q, MASK_FLE_Q) +DECLARE_INSN(flt_q, MATCH_FLT_Q, MASK_FLT_Q) +DECLARE_INSN(feq_q, MATCH_FEQ_Q, MASK_FEQ_Q) +DECLARE_INSN(fcvt_w_q, MATCH_FCVT_W_Q, MASK_FCVT_W_Q) +DECLARE_INSN(fcvt_wu_q, MATCH_FCVT_WU_Q, MASK_FCVT_WU_Q) +DECLARE_INSN(fclass_q, MATCH_FCLASS_Q, MASK_FCLASS_Q) +DECLARE_INSN(fcvt_q_w, MATCH_FCVT_Q_W, MASK_FCVT_Q_W) +DECLARE_INSN(fcvt_q_wu, MATCH_FCVT_Q_WU, MASK_FCVT_Q_WU) +DECLARE_INSN(flq, MATCH_FLQ, MASK_FLQ) +DECLARE_INSN(fsq, MATCH_FSQ, MASK_FSQ) +DECLARE_INSN(fmadd_q, MATCH_FMADD_Q, MASK_FMADD_Q) +DECLARE_INSN(fmsub_q, MATCH_FMSUB_Q, MASK_FMSUB_Q) +DECLARE_INSN(fnmsub_q, MATCH_FNMSUB_Q, MASK_FNMSUB_Q) +DECLARE_INSN(fnmadd_q, MATCH_FNMADD_Q, MASK_FNMADD_Q) +DECLARE_INSN(fcvt_l_q, MATCH_FCVT_L_Q, MASK_FCVT_L_Q) +DECLARE_INSN(fcvt_lu_q, MATCH_FCVT_LU_Q, MASK_FCVT_LU_Q) +DECLARE_INSN(fcvt_q_l, MATCH_FCVT_Q_L, MASK_FCVT_Q_L) +DECLARE_INSN(fcvt_q_lu, MATCH_FCVT_Q_LU, MASK_FCVT_Q_LU) +DECLARE_INSN(fmv_x_q, MATCH_FMV_X_Q, MASK_FMV_X_Q) +DECLARE_INSN(fmv_q_x, MATCH_FMV_Q_X, MASK_FMV_Q_X) +DECLARE_INSN(ecall, MATCH_ECALL, MASK_ECALL) +DECLARE_INSN(ebreak, MATCH_EBREAK, MASK_EBREAK) +DECLARE_INSN(uret, MATCH_URET, MASK_URET) +DECLARE_INSN(sret, MATCH_SRET, MASK_SRET) +DECLARE_INSN(mret, MATCH_MRET, MASK_MRET) +DECLARE_INSN(dret, MATCH_DRET, MASK_DRET) +DECLARE_INSN(sfence_vma, MATCH_SFENCE_VMA, MASK_SFENCE_VMA) +DECLARE_INSN(wfi, MATCH_WFI, MASK_WFI) +DECLARE_INSN(csrrw, MATCH_CSRRW, MASK_CSRRW) +DECLARE_INSN(csrrs, MATCH_CSRRS, MASK_CSRRS) +DECLARE_INSN(csrrc, MATCH_CSRRC, MASK_CSRRC) +DECLARE_INSN(csrrwi, MATCH_CSRRWI, MASK_CSRRWI) +DECLARE_INSN(csrrsi, MATCH_CSRRSI, MASK_CSRRSI) +DECLARE_INSN(csrrci, MATCH_CSRRCI, MASK_CSRRCI) +DECLARE_INSN(hfence_vvma, MATCH_HFENCE_VVMA, MASK_HFENCE_VVMA) +DECLARE_INSN(hfence_gvma, MATCH_HFENCE_GVMA, MASK_HFENCE_GVMA) +DECLARE_INSN(c_nop, MATCH_C_NOP, MASK_C_NOP) +DECLARE_INSN(c_addi16sp, MATCH_C_ADDI16SP, MASK_C_ADDI16SP) +DECLARE_INSN(c_jr, MATCH_C_JR, MASK_C_JR) +DECLARE_INSN(c_jalr, MATCH_C_JALR, MASK_C_JALR) +DECLARE_INSN(c_ebreak, MATCH_C_EBREAK, MASK_C_EBREAK) +DECLARE_INSN(c_addi4spn, MATCH_C_ADDI4SPN, MASK_C_ADDI4SPN) +DECLARE_INSN(c_fld, MATCH_C_FLD, MASK_C_FLD) +DECLARE_INSN(c_lw, MATCH_C_LW, MASK_C_LW) +DECLARE_INSN(c_flw, MATCH_C_FLW, MASK_C_FLW) +DECLARE_INSN(c_fsd, MATCH_C_FSD, MASK_C_FSD) +DECLARE_INSN(c_sw, MATCH_C_SW, MASK_C_SW) +DECLARE_INSN(c_fsw, MATCH_C_FSW, MASK_C_FSW) +DECLARE_INSN(c_addi, MATCH_C_ADDI, MASK_C_ADDI) +DECLARE_INSN(c_jal, MATCH_C_JAL, MASK_C_JAL) +DECLARE_INSN(c_li, MATCH_C_LI, MASK_C_LI) +DECLARE_INSN(c_lui, MATCH_C_LUI, MASK_C_LUI) +DECLARE_INSN(c_srli, MATCH_C_SRLI, MASK_C_SRLI) +DECLARE_INSN(c_srai, MATCH_C_SRAI, MASK_C_SRAI) +DECLARE_INSN(c_andi, MATCH_C_ANDI, MASK_C_ANDI) +DECLARE_INSN(c_sub, MATCH_C_SUB, MASK_C_SUB) +DECLARE_INSN(c_xor, MATCH_C_XOR, MASK_C_XOR) +DECLARE_INSN(c_or, MATCH_C_OR, MASK_C_OR) +DECLARE_INSN(c_and, MATCH_C_AND, MASK_C_AND) +DECLARE_INSN(c_j, MATCH_C_J, MASK_C_J) +DECLARE_INSN(c_beqz, MATCH_C_BEQZ, MASK_C_BEQZ) +DECLARE_INSN(c_bnez, MATCH_C_BNEZ, MASK_C_BNEZ) +DECLARE_INSN(c_slli, MATCH_C_SLLI, MASK_C_SLLI) +DECLARE_INSN(c_fldsp, MATCH_C_FLDSP, MASK_C_FLDSP) +DECLARE_INSN(c_lwsp, MATCH_C_LWSP, MASK_C_LWSP) +DECLARE_INSN(c_flwsp, MATCH_C_FLWSP, MASK_C_FLWSP) +DECLARE_INSN(c_mv, MATCH_C_MV, MASK_C_MV) +DECLARE_INSN(c_add, MATCH_C_ADD, MASK_C_ADD) +DECLARE_INSN(c_fsdsp, MATCH_C_FSDSP, MASK_C_FSDSP) +DECLARE_INSN(c_swsp, MATCH_C_SWSP, MASK_C_SWSP) +DECLARE_INSN(c_fswsp, MATCH_C_FSWSP, MASK_C_FSWSP) +DECLARE_INSN(c_srli_rv32, MATCH_C_SRLI_RV32, MASK_C_SRLI_RV32) +DECLARE_INSN(c_srai_rv32, MATCH_C_SRAI_RV32, MASK_C_SRAI_RV32) +DECLARE_INSN(c_slli_rv32, MATCH_C_SLLI_RV32, MASK_C_SLLI_RV32) +DECLARE_INSN(c_ld, MATCH_C_LD, MASK_C_LD) +DECLARE_INSN(c_sd, MATCH_C_SD, MASK_C_SD) +DECLARE_INSN(c_subw, MATCH_C_SUBW, MASK_C_SUBW) +DECLARE_INSN(c_addw, MATCH_C_ADDW, MASK_C_ADDW) +DECLARE_INSN(c_addiw, MATCH_C_ADDIW, MASK_C_ADDIW) +DECLARE_INSN(c_ldsp, MATCH_C_LDSP, MASK_C_LDSP) +DECLARE_INSN(c_sdsp, MATCH_C_SDSP, MASK_C_SDSP) +DECLARE_INSN(c_lq, MATCH_C_LQ, MASK_C_LQ) +DECLARE_INSN(c_sq, MATCH_C_SQ, MASK_C_SQ) +DECLARE_INSN(c_lqsp, MATCH_C_LQSP, MASK_C_LQSP) +DECLARE_INSN(c_sqsp, MATCH_C_SQSP, MASK_C_SQSP) +DECLARE_INSN(custom0, MATCH_CUSTOM0, MASK_CUSTOM0) +DECLARE_INSN(custom0_rs1, MATCH_CUSTOM0_RS1, MASK_CUSTOM0_RS1) +DECLARE_INSN(custom0_rs1_rs2, MATCH_CUSTOM0_RS1_RS2, MASK_CUSTOM0_RS1_RS2) +DECLARE_INSN(custom0_rd, MATCH_CUSTOM0_RD, MASK_CUSTOM0_RD) +DECLARE_INSN(custom0_rd_rs1, MATCH_CUSTOM0_RD_RS1, MASK_CUSTOM0_RD_RS1) +DECLARE_INSN(custom0_rd_rs1_rs2, MATCH_CUSTOM0_RD_RS1_RS2, MASK_CUSTOM0_RD_RS1_RS2) +DECLARE_INSN(custom1, MATCH_CUSTOM1, MASK_CUSTOM1) +DECLARE_INSN(custom1_rs1, MATCH_CUSTOM1_RS1, MASK_CUSTOM1_RS1) +DECLARE_INSN(custom1_rs1_rs2, MATCH_CUSTOM1_RS1_RS2, MASK_CUSTOM1_RS1_RS2) +DECLARE_INSN(custom1_rd, MATCH_CUSTOM1_RD, MASK_CUSTOM1_RD) +DECLARE_INSN(custom1_rd_rs1, MATCH_CUSTOM1_RD_RS1, MASK_CUSTOM1_RD_RS1) +DECLARE_INSN(custom1_rd_rs1_rs2, MATCH_CUSTOM1_RD_RS1_RS2, MASK_CUSTOM1_RD_RS1_RS2) +DECLARE_INSN(custom2, MATCH_CUSTOM2, MASK_CUSTOM2) +DECLARE_INSN(custom2_rs1, MATCH_CUSTOM2_RS1, MASK_CUSTOM2_RS1) +DECLARE_INSN(custom2_rs1_rs2, MATCH_CUSTOM2_RS1_RS2, MASK_CUSTOM2_RS1_RS2) +DECLARE_INSN(custom2_rd, MATCH_CUSTOM2_RD, MASK_CUSTOM2_RD) +DECLARE_INSN(custom2_rd_rs1, MATCH_CUSTOM2_RD_RS1, MASK_CUSTOM2_RD_RS1) +DECLARE_INSN(custom2_rd_rs1_rs2, MATCH_CUSTOM2_RD_RS1_RS2, MASK_CUSTOM2_RD_RS1_RS2) +DECLARE_INSN(custom3, MATCH_CUSTOM3, MASK_CUSTOM3) +DECLARE_INSN(custom3_rs1, MATCH_CUSTOM3_RS1, MASK_CUSTOM3_RS1) +DECLARE_INSN(custom3_rs1_rs2, MATCH_CUSTOM3_RS1_RS2, MASK_CUSTOM3_RS1_RS2) +DECLARE_INSN(custom3_rd, MATCH_CUSTOM3_RD, MASK_CUSTOM3_RD) +DECLARE_INSN(custom3_rd_rs1, MATCH_CUSTOM3_RD_RS1, MASK_CUSTOM3_RD_RS1) +DECLARE_INSN(custom3_rd_rs1_rs2, MATCH_CUSTOM3_RD_RS1_RS2, MASK_CUSTOM3_RD_RS1_RS2) +DECLARE_INSN(vsetvli, MATCH_VSETVLI, MASK_VSETVLI) +DECLARE_INSN(vsetvl, MATCH_VSETVL, MASK_VSETVL) +DECLARE_INSN(vlb_v, MATCH_VLB_V, MASK_VLB_V) +DECLARE_INSN(vlh_v, MATCH_VLH_V, MASK_VLH_V) +DECLARE_INSN(vlw_v, MATCH_VLW_V, MASK_VLW_V) +DECLARE_INSN(vle_v, MATCH_VLE_V, MASK_VLE_V) +DECLARE_INSN(vlbu_v, MATCH_VLBU_V, MASK_VLBU_V) +DECLARE_INSN(vlhu_v, MATCH_VLHU_V, MASK_VLHU_V) +DECLARE_INSN(vlwu_v, MATCH_VLWU_V, MASK_VLWU_V) +DECLARE_INSN(vsb_v, MATCH_VSB_V, MASK_VSB_V) +DECLARE_INSN(vsh_v, MATCH_VSH_V, MASK_VSH_V) +DECLARE_INSN(vsw_v, MATCH_VSW_V, MASK_VSW_V) +DECLARE_INSN(vse_v, MATCH_VSE_V, MASK_VSE_V) +DECLARE_INSN(vlsb_v, MATCH_VLSB_V, MASK_VLSB_V) +DECLARE_INSN(vlsh_v, MATCH_VLSH_V, MASK_VLSH_V) +DECLARE_INSN(vlsw_v, MATCH_VLSW_V, MASK_VLSW_V) +DECLARE_INSN(vlse_v, MATCH_VLSE_V, MASK_VLSE_V) +DECLARE_INSN(vlsbu_v, MATCH_VLSBU_V, MASK_VLSBU_V) +DECLARE_INSN(vlshu_v, MATCH_VLSHU_V, MASK_VLSHU_V) +DECLARE_INSN(vlswu_v, MATCH_VLSWU_V, MASK_VLSWU_V) +DECLARE_INSN(vssb_v, MATCH_VSSB_V, MASK_VSSB_V) +DECLARE_INSN(vssh_v, MATCH_VSSH_V, MASK_VSSH_V) +DECLARE_INSN(vssw_v, MATCH_VSSW_V, MASK_VSSW_V) +DECLARE_INSN(vsse_v, MATCH_VSSE_V, MASK_VSSE_V) +DECLARE_INSN(vlxb_v, MATCH_VLXB_V, MASK_VLXB_V) +DECLARE_INSN(vlxh_v, MATCH_VLXH_V, MASK_VLXH_V) +DECLARE_INSN(vlxw_v, MATCH_VLXW_V, MASK_VLXW_V) +DECLARE_INSN(vlxe_v, MATCH_VLXE_V, MASK_VLXE_V) +DECLARE_INSN(vlxbu_v, MATCH_VLXBU_V, MASK_VLXBU_V) +DECLARE_INSN(vlxhu_v, MATCH_VLXHU_V, MASK_VLXHU_V) +DECLARE_INSN(vlxwu_v, MATCH_VLXWU_V, MASK_VLXWU_V) +DECLARE_INSN(vsxb_v, MATCH_VSXB_V, MASK_VSXB_V) +DECLARE_INSN(vsxh_v, MATCH_VSXH_V, MASK_VSXH_V) +DECLARE_INSN(vsxw_v, MATCH_VSXW_V, MASK_VSXW_V) +DECLARE_INSN(vsxe_v, MATCH_VSXE_V, MASK_VSXE_V) +DECLARE_INSN(vsuxb_v, MATCH_VSUXB_V, MASK_VSUXB_V) +DECLARE_INSN(vsuxh_v, MATCH_VSUXH_V, MASK_VSUXH_V) +DECLARE_INSN(vsuxw_v, MATCH_VSUXW_V, MASK_VSUXW_V) +DECLARE_INSN(vsuxe_v, MATCH_VSUXE_V, MASK_VSUXE_V) +DECLARE_INSN(vlbff_v, MATCH_VLBFF_V, MASK_VLBFF_V) +DECLARE_INSN(vlhff_v, MATCH_VLHFF_V, MASK_VLHFF_V) +DECLARE_INSN(vlwff_v, MATCH_VLWFF_V, MASK_VLWFF_V) +DECLARE_INSN(vleff_v, MATCH_VLEFF_V, MASK_VLEFF_V) +DECLARE_INSN(vlbuff_v, MATCH_VLBUFF_V, MASK_VLBUFF_V) +DECLARE_INSN(vlhuff_v, MATCH_VLHUFF_V, MASK_VLHUFF_V) +DECLARE_INSN(vlwuff_v, MATCH_VLWUFF_V, MASK_VLWUFF_V) +DECLARE_INSN(vl1r_v, MATCH_VL1R_V, MASK_VL1R_V) +DECLARE_INSN(vs1r_v, MATCH_VS1R_V, MASK_VS1R_V) +DECLARE_INSN(vfadd_vf, MATCH_VFADD_VF, MASK_VFADD_VF) +DECLARE_INSN(vfsub_vf, MATCH_VFSUB_VF, MASK_VFSUB_VF) +DECLARE_INSN(vfmin_vf, MATCH_VFMIN_VF, MASK_VFMIN_VF) +DECLARE_INSN(vfmax_vf, MATCH_VFMAX_VF, MASK_VFMAX_VF) +DECLARE_INSN(vfsgnj_vf, MATCH_VFSGNJ_VF, MASK_VFSGNJ_VF) +DECLARE_INSN(vfsgnjn_vf, MATCH_VFSGNJN_VF, MASK_VFSGNJN_VF) +DECLARE_INSN(vfsgnjx_vf, MATCH_VFSGNJX_VF, MASK_VFSGNJX_VF) +DECLARE_INSN(vfslide1up_vf, MATCH_VFSLIDE1UP_VF, MASK_VFSLIDE1UP_VF) +DECLARE_INSN(vfslide1down_vf, MATCH_VFSLIDE1DOWN_VF, MASK_VFSLIDE1DOWN_VF) +DECLARE_INSN(vfmv_s_f, MATCH_VFMV_S_F, MASK_VFMV_S_F) +DECLARE_INSN(vfmerge_vfm, MATCH_VFMERGE_VFM, MASK_VFMERGE_VFM) +DECLARE_INSN(vfmv_v_f, MATCH_VFMV_V_F, MASK_VFMV_V_F) +DECLARE_INSN(vmfeq_vf, MATCH_VMFEQ_VF, MASK_VMFEQ_VF) +DECLARE_INSN(vmfle_vf, MATCH_VMFLE_VF, MASK_VMFLE_VF) +DECLARE_INSN(vmflt_vf, MATCH_VMFLT_VF, MASK_VMFLT_VF) +DECLARE_INSN(vmfne_vf, MATCH_VMFNE_VF, MASK_VMFNE_VF) +DECLARE_INSN(vmfgt_vf, MATCH_VMFGT_VF, MASK_VMFGT_VF) +DECLARE_INSN(vmfge_vf, MATCH_VMFGE_VF, MASK_VMFGE_VF) +DECLARE_INSN(vfdiv_vf, MATCH_VFDIV_VF, MASK_VFDIV_VF) +DECLARE_INSN(vfrdiv_vf, MATCH_VFRDIV_VF, MASK_VFRDIV_VF) +DECLARE_INSN(vfmul_vf, MATCH_VFMUL_VF, MASK_VFMUL_VF) +DECLARE_INSN(vfrsub_vf, MATCH_VFRSUB_VF, MASK_VFRSUB_VF) +DECLARE_INSN(vfmadd_vf, MATCH_VFMADD_VF, MASK_VFMADD_VF) +DECLARE_INSN(vfnmadd_vf, MATCH_VFNMADD_VF, MASK_VFNMADD_VF) +DECLARE_INSN(vfmsub_vf, MATCH_VFMSUB_VF, MASK_VFMSUB_VF) +DECLARE_INSN(vfnmsub_vf, MATCH_VFNMSUB_VF, MASK_VFNMSUB_VF) +DECLARE_INSN(vfmacc_vf, MATCH_VFMACC_VF, MASK_VFMACC_VF) +DECLARE_INSN(vfnmacc_vf, MATCH_VFNMACC_VF, MASK_VFNMACC_VF) +DECLARE_INSN(vfmsac_vf, MATCH_VFMSAC_VF, MASK_VFMSAC_VF) +DECLARE_INSN(vfnmsac_vf, MATCH_VFNMSAC_VF, MASK_VFNMSAC_VF) +DECLARE_INSN(vfwadd_vf, MATCH_VFWADD_VF, MASK_VFWADD_VF) +DECLARE_INSN(vfwsub_vf, MATCH_VFWSUB_VF, MASK_VFWSUB_VF) +DECLARE_INSN(vfwadd_wf, MATCH_VFWADD_WF, MASK_VFWADD_WF) +DECLARE_INSN(vfwsub_wf, MATCH_VFWSUB_WF, MASK_VFWSUB_WF) +DECLARE_INSN(vfwmul_vf, MATCH_VFWMUL_VF, MASK_VFWMUL_VF) +DECLARE_INSN(vfwmacc_vf, MATCH_VFWMACC_VF, MASK_VFWMACC_VF) +DECLARE_INSN(vfwnmacc_vf, MATCH_VFWNMACC_VF, MASK_VFWNMACC_VF) +DECLARE_INSN(vfwmsac_vf, MATCH_VFWMSAC_VF, MASK_VFWMSAC_VF) +DECLARE_INSN(vfwnmsac_vf, MATCH_VFWNMSAC_VF, MASK_VFWNMSAC_VF) +DECLARE_INSN(vfadd_vv, MATCH_VFADD_VV, MASK_VFADD_VV) +DECLARE_INSN(vfredsum_vs, MATCH_VFREDSUM_VS, MASK_VFREDSUM_VS) +DECLARE_INSN(vfsub_vv, MATCH_VFSUB_VV, MASK_VFSUB_VV) +DECLARE_INSN(vfredosum_vs, MATCH_VFREDOSUM_VS, MASK_VFREDOSUM_VS) +DECLARE_INSN(vfmin_vv, MATCH_VFMIN_VV, MASK_VFMIN_VV) +DECLARE_INSN(vfredmin_vs, MATCH_VFREDMIN_VS, MASK_VFREDMIN_VS) +DECLARE_INSN(vfmax_vv, MATCH_VFMAX_VV, MASK_VFMAX_VV) +DECLARE_INSN(vfredmax_vs, MATCH_VFREDMAX_VS, MASK_VFREDMAX_VS) +DECLARE_INSN(vfsgnj_vv, MATCH_VFSGNJ_VV, MASK_VFSGNJ_VV) +DECLARE_INSN(vfsgnjn_vv, MATCH_VFSGNJN_VV, MASK_VFSGNJN_VV) +DECLARE_INSN(vfsgnjx_vv, MATCH_VFSGNJX_VV, MASK_VFSGNJX_VV) +DECLARE_INSN(vfmv_f_s, MATCH_VFMV_F_S, MASK_VFMV_F_S) +DECLARE_INSN(vmfeq_vv, MATCH_VMFEQ_VV, MASK_VMFEQ_VV) +DECLARE_INSN(vmfle_vv, MATCH_VMFLE_VV, MASK_VMFLE_VV) +DECLARE_INSN(vmflt_vv, MATCH_VMFLT_VV, MASK_VMFLT_VV) +DECLARE_INSN(vmfne_vv, MATCH_VMFNE_VV, MASK_VMFNE_VV) +DECLARE_INSN(vfdiv_vv, MATCH_VFDIV_VV, MASK_VFDIV_VV) +DECLARE_INSN(vfmul_vv, MATCH_VFMUL_VV, MASK_VFMUL_VV) +DECLARE_INSN(vfmadd_vv, MATCH_VFMADD_VV, MASK_VFMADD_VV) +DECLARE_INSN(vfnmadd_vv, MATCH_VFNMADD_VV, MASK_VFNMADD_VV) +DECLARE_INSN(vfmsub_vv, MATCH_VFMSUB_VV, MASK_VFMSUB_VV) +DECLARE_INSN(vfnmsub_vv, MATCH_VFNMSUB_VV, MASK_VFNMSUB_VV) +DECLARE_INSN(vfmacc_vv, MATCH_VFMACC_VV, MASK_VFMACC_VV) +DECLARE_INSN(vfnmacc_vv, MATCH_VFNMACC_VV, MASK_VFNMACC_VV) +DECLARE_INSN(vfmsac_vv, MATCH_VFMSAC_VV, MASK_VFMSAC_VV) +DECLARE_INSN(vfnmsac_vv, MATCH_VFNMSAC_VV, MASK_VFNMSAC_VV) +DECLARE_INSN(vfcvt_xu_f_v, MATCH_VFCVT_XU_F_V, MASK_VFCVT_XU_F_V) +DECLARE_INSN(vfcvt_x_f_v, MATCH_VFCVT_X_F_V, MASK_VFCVT_X_F_V) +DECLARE_INSN(vfcvt_f_xu_v, MATCH_VFCVT_F_XU_V, MASK_VFCVT_F_XU_V) +DECLARE_INSN(vfcvt_f_x_v, MATCH_VFCVT_F_X_V, MASK_VFCVT_F_X_V) +DECLARE_INSN(vfcvt_rtz_xu_f_v, MATCH_VFCVT_RTZ_XU_F_V, MASK_VFCVT_RTZ_XU_F_V) +DECLARE_INSN(vfcvt_rtz_x_f_v, MATCH_VFCVT_RTZ_X_F_V, MASK_VFCVT_RTZ_X_F_V) +DECLARE_INSN(vfwcvt_xu_f_v, MATCH_VFWCVT_XU_F_V, MASK_VFWCVT_XU_F_V) +DECLARE_INSN(vfwcvt_x_f_v, MATCH_VFWCVT_X_F_V, MASK_VFWCVT_X_F_V) +DECLARE_INSN(vfwcvt_f_xu_v, MATCH_VFWCVT_F_XU_V, MASK_VFWCVT_F_XU_V) +DECLARE_INSN(vfwcvt_f_x_v, MATCH_VFWCVT_F_X_V, MASK_VFWCVT_F_X_V) +DECLARE_INSN(vfwcvt_f_f_v, MATCH_VFWCVT_F_F_V, MASK_VFWCVT_F_F_V) +DECLARE_INSN(vfwcvt_rtz_xu_f_v, MATCH_VFWCVT_RTZ_XU_F_V, MASK_VFWCVT_RTZ_XU_F_V) +DECLARE_INSN(vfwcvt_rtz_x_f_v, MATCH_VFWCVT_RTZ_X_F_V, MASK_VFWCVT_RTZ_X_F_V) +DECLARE_INSN(vfncvt_xu_f_w, MATCH_VFNCVT_XU_F_W, MASK_VFNCVT_XU_F_W) +DECLARE_INSN(vfncvt_x_f_w, MATCH_VFNCVT_X_F_W, MASK_VFNCVT_X_F_W) +DECLARE_INSN(vfncvt_f_xu_w, MATCH_VFNCVT_F_XU_W, MASK_VFNCVT_F_XU_W) +DECLARE_INSN(vfncvt_f_x_w, MATCH_VFNCVT_F_X_W, MASK_VFNCVT_F_X_W) +DECLARE_INSN(vfncvt_f_f_w, MATCH_VFNCVT_F_F_W, MASK_VFNCVT_F_F_W) +DECLARE_INSN(vfncvt_rod_f_f_w, MATCH_VFNCVT_ROD_F_F_W, MASK_VFNCVT_ROD_F_F_W) +DECLARE_INSN(vfncvt_rtz_xu_f_w, MATCH_VFNCVT_RTZ_XU_F_W, MASK_VFNCVT_RTZ_XU_F_W) +DECLARE_INSN(vfncvt_rtz_x_f_w, MATCH_VFNCVT_RTZ_X_F_W, MASK_VFNCVT_RTZ_X_F_W) +DECLARE_INSN(vfsqrt_v, MATCH_VFSQRT_V, MASK_VFSQRT_V) +DECLARE_INSN(vfclass_v, MATCH_VFCLASS_V, MASK_VFCLASS_V) +DECLARE_INSN(vfwadd_vv, MATCH_VFWADD_VV, MASK_VFWADD_VV) +DECLARE_INSN(vfwredsum_vs, MATCH_VFWREDSUM_VS, MASK_VFWREDSUM_VS) +DECLARE_INSN(vfwsub_vv, MATCH_VFWSUB_VV, MASK_VFWSUB_VV) +DECLARE_INSN(vfwredosum_vs, MATCH_VFWREDOSUM_VS, MASK_VFWREDOSUM_VS) +DECLARE_INSN(vfwadd_wv, MATCH_VFWADD_WV, MASK_VFWADD_WV) +DECLARE_INSN(vfwsub_wv, MATCH_VFWSUB_WV, MASK_VFWSUB_WV) +DECLARE_INSN(vfwmul_vv, MATCH_VFWMUL_VV, MASK_VFWMUL_VV) +DECLARE_INSN(vfdot_vv, MATCH_VFDOT_VV, MASK_VFDOT_VV) +DECLARE_INSN(vfwmacc_vv, MATCH_VFWMACC_VV, MASK_VFWMACC_VV) +DECLARE_INSN(vfwnmacc_vv, MATCH_VFWNMACC_VV, MASK_VFWNMACC_VV) +DECLARE_INSN(vfwmsac_vv, MATCH_VFWMSAC_VV, MASK_VFWMSAC_VV) +DECLARE_INSN(vfwnmsac_vv, MATCH_VFWNMSAC_VV, MASK_VFWNMSAC_VV) +DECLARE_INSN(vadd_vx, MATCH_VADD_VX, MASK_VADD_VX) +DECLARE_INSN(vsub_vx, MATCH_VSUB_VX, MASK_VSUB_VX) +DECLARE_INSN(vrsub_vx, MATCH_VRSUB_VX, MASK_VRSUB_VX) +DECLARE_INSN(vminu_vx, MATCH_VMINU_VX, MASK_VMINU_VX) +DECLARE_INSN(vmin_vx, MATCH_VMIN_VX, MASK_VMIN_VX) +DECLARE_INSN(vmaxu_vx, MATCH_VMAXU_VX, MASK_VMAXU_VX) +DECLARE_INSN(vmax_vx, MATCH_VMAX_VX, MASK_VMAX_VX) +DECLARE_INSN(vand_vx, MATCH_VAND_VX, MASK_VAND_VX) +DECLARE_INSN(vor_vx, MATCH_VOR_VX, MASK_VOR_VX) +DECLARE_INSN(vxor_vx, MATCH_VXOR_VX, MASK_VXOR_VX) +DECLARE_INSN(vrgather_vx, MATCH_VRGATHER_VX, MASK_VRGATHER_VX) +DECLARE_INSN(vslideup_vx, MATCH_VSLIDEUP_VX, MASK_VSLIDEUP_VX) +DECLARE_INSN(vslidedown_vx, MATCH_VSLIDEDOWN_VX, MASK_VSLIDEDOWN_VX) +DECLARE_INSN(vadc_vxm, MATCH_VADC_VXM, MASK_VADC_VXM) +DECLARE_INSN(vmadc_vxm, MATCH_VMADC_VXM, MASK_VMADC_VXM) +DECLARE_INSN(vsbc_vxm, MATCH_VSBC_VXM, MASK_VSBC_VXM) +DECLARE_INSN(vmsbc_vxm, MATCH_VMSBC_VXM, MASK_VMSBC_VXM) +DECLARE_INSN(vmerge_vxm, MATCH_VMERGE_VXM, MASK_VMERGE_VXM) +DECLARE_INSN(vmv_v_x, MATCH_VMV_V_X, MASK_VMV_V_X) +DECLARE_INSN(vmseq_vx, MATCH_VMSEQ_VX, MASK_VMSEQ_VX) +DECLARE_INSN(vmsne_vx, MATCH_VMSNE_VX, MASK_VMSNE_VX) +DECLARE_INSN(vmsltu_vx, MATCH_VMSLTU_VX, MASK_VMSLTU_VX) +DECLARE_INSN(vmslt_vx, MATCH_VMSLT_VX, MASK_VMSLT_VX) +DECLARE_INSN(vmsleu_vx, MATCH_VMSLEU_VX, MASK_VMSLEU_VX) +DECLARE_INSN(vmsle_vx, MATCH_VMSLE_VX, MASK_VMSLE_VX) +DECLARE_INSN(vmsgtu_vx, MATCH_VMSGTU_VX, MASK_VMSGTU_VX) +DECLARE_INSN(vmsgt_vx, MATCH_VMSGT_VX, MASK_VMSGT_VX) +DECLARE_INSN(vsaddu_vx, MATCH_VSADDU_VX, MASK_VSADDU_VX) +DECLARE_INSN(vsadd_vx, MATCH_VSADD_VX, MASK_VSADD_VX) +DECLARE_INSN(vssubu_vx, MATCH_VSSUBU_VX, MASK_VSSUBU_VX) +DECLARE_INSN(vssub_vx, MATCH_VSSUB_VX, MASK_VSSUB_VX) +DECLARE_INSN(vsll_vx, MATCH_VSLL_VX, MASK_VSLL_VX) +DECLARE_INSN(vsmul_vx, MATCH_VSMUL_VX, MASK_VSMUL_VX) +DECLARE_INSN(vsrl_vx, MATCH_VSRL_VX, MASK_VSRL_VX) +DECLARE_INSN(vsra_vx, MATCH_VSRA_VX, MASK_VSRA_VX) +DECLARE_INSN(vssrl_vx, MATCH_VSSRL_VX, MASK_VSSRL_VX) +DECLARE_INSN(vssra_vx, MATCH_VSSRA_VX, MASK_VSSRA_VX) +DECLARE_INSN(vnsrl_wx, MATCH_VNSRL_WX, MASK_VNSRL_WX) +DECLARE_INSN(vnsra_wx, MATCH_VNSRA_WX, MASK_VNSRA_WX) +DECLARE_INSN(vnclipu_wx, MATCH_VNCLIPU_WX, MASK_VNCLIPU_WX) +DECLARE_INSN(vnclip_wx, MATCH_VNCLIP_WX, MASK_VNCLIP_WX) +DECLARE_INSN(vqmaccu_vx, MATCH_VQMACCU_VX, MASK_VQMACCU_VX) +DECLARE_INSN(vqmacc_vx, MATCH_VQMACC_VX, MASK_VQMACC_VX) +DECLARE_INSN(vqmaccus_vx, MATCH_VQMACCUS_VX, MASK_VQMACCUS_VX) +DECLARE_INSN(vqmaccsu_vx, MATCH_VQMACCSU_VX, MASK_VQMACCSU_VX) +DECLARE_INSN(vadd_vv, MATCH_VADD_VV, MASK_VADD_VV) +DECLARE_INSN(vsub_vv, MATCH_VSUB_VV, MASK_VSUB_VV) +DECLARE_INSN(vminu_vv, MATCH_VMINU_VV, MASK_VMINU_VV) +DECLARE_INSN(vmin_vv, MATCH_VMIN_VV, MASK_VMIN_VV) +DECLARE_INSN(vmaxu_vv, MATCH_VMAXU_VV, MASK_VMAXU_VV) +DECLARE_INSN(vmax_vv, MATCH_VMAX_VV, MASK_VMAX_VV) +DECLARE_INSN(vand_vv, MATCH_VAND_VV, MASK_VAND_VV) +DECLARE_INSN(vor_vv, MATCH_VOR_VV, MASK_VOR_VV) +DECLARE_INSN(vxor_vv, MATCH_VXOR_VV, MASK_VXOR_VV) +DECLARE_INSN(vrgather_vv, MATCH_VRGATHER_VV, MASK_VRGATHER_VV) +DECLARE_INSN(vadc_vvm, MATCH_VADC_VVM, MASK_VADC_VVM) +DECLARE_INSN(vmadc_vvm, MATCH_VMADC_VVM, MASK_VMADC_VVM) +DECLARE_INSN(vsbc_vvm, MATCH_VSBC_VVM, MASK_VSBC_VVM) +DECLARE_INSN(vmsbc_vvm, MATCH_VMSBC_VVM, MASK_VMSBC_VVM) +DECLARE_INSN(vmerge_vvm, MATCH_VMERGE_VVM, MASK_VMERGE_VVM) +DECLARE_INSN(vmv_v_v, MATCH_VMV_V_V, MASK_VMV_V_V) +DECLARE_INSN(vmseq_vv, MATCH_VMSEQ_VV, MASK_VMSEQ_VV) +DECLARE_INSN(vmsne_vv, MATCH_VMSNE_VV, MASK_VMSNE_VV) +DECLARE_INSN(vmsltu_vv, MATCH_VMSLTU_VV, MASK_VMSLTU_VV) +DECLARE_INSN(vmslt_vv, MATCH_VMSLT_VV, MASK_VMSLT_VV) +DECLARE_INSN(vmsleu_vv, MATCH_VMSLEU_VV, MASK_VMSLEU_VV) +DECLARE_INSN(vmsle_vv, MATCH_VMSLE_VV, MASK_VMSLE_VV) +DECLARE_INSN(vsaddu_vv, MATCH_VSADDU_VV, MASK_VSADDU_VV) +DECLARE_INSN(vsadd_vv, MATCH_VSADD_VV, MASK_VSADD_VV) +DECLARE_INSN(vssubu_vv, MATCH_VSSUBU_VV, MASK_VSSUBU_VV) +DECLARE_INSN(vssub_vv, MATCH_VSSUB_VV, MASK_VSSUB_VV) +DECLARE_INSN(vsll_vv, MATCH_VSLL_VV, MASK_VSLL_VV) +DECLARE_INSN(vsmul_vv, MATCH_VSMUL_VV, MASK_VSMUL_VV) +DECLARE_INSN(vsrl_vv, MATCH_VSRL_VV, MASK_VSRL_VV) +DECLARE_INSN(vsra_vv, MATCH_VSRA_VV, MASK_VSRA_VV) +DECLARE_INSN(vssrl_vv, MATCH_VSSRL_VV, MASK_VSSRL_VV) +DECLARE_INSN(vssra_vv, MATCH_VSSRA_VV, MASK_VSSRA_VV) +DECLARE_INSN(vnsrl_wv, MATCH_VNSRL_WV, MASK_VNSRL_WV) +DECLARE_INSN(vnsra_wv, MATCH_VNSRA_WV, MASK_VNSRA_WV) +DECLARE_INSN(vnclipu_wv, MATCH_VNCLIPU_WV, MASK_VNCLIPU_WV) +DECLARE_INSN(vnclip_wv, MATCH_VNCLIP_WV, MASK_VNCLIP_WV) +DECLARE_INSN(vwredsumu_vs, MATCH_VWREDSUMU_VS, MASK_VWREDSUMU_VS) +DECLARE_INSN(vwredsum_vs, MATCH_VWREDSUM_VS, MASK_VWREDSUM_VS) +DECLARE_INSN(vdotu_vv, MATCH_VDOTU_VV, MASK_VDOTU_VV) +DECLARE_INSN(vdot_vv, MATCH_VDOT_VV, MASK_VDOT_VV) +DECLARE_INSN(vqmaccu_vv, MATCH_VQMACCU_VV, MASK_VQMACCU_VV) +DECLARE_INSN(vqmacc_vv, MATCH_VQMACC_VV, MASK_VQMACC_VV) +DECLARE_INSN(vqmaccsu_vv, MATCH_VQMACCSU_VV, MASK_VQMACCSU_VV) +DECLARE_INSN(vadd_vi, MATCH_VADD_VI, MASK_VADD_VI) +DECLARE_INSN(vrsub_vi, MATCH_VRSUB_VI, MASK_VRSUB_VI) +DECLARE_INSN(vand_vi, MATCH_VAND_VI, MASK_VAND_VI) +DECLARE_INSN(vor_vi, MATCH_VOR_VI, MASK_VOR_VI) +DECLARE_INSN(vxor_vi, MATCH_VXOR_VI, MASK_VXOR_VI) +DECLARE_INSN(vrgather_vi, MATCH_VRGATHER_VI, MASK_VRGATHER_VI) +DECLARE_INSN(vslideup_vi, MATCH_VSLIDEUP_VI, MASK_VSLIDEUP_VI) +DECLARE_INSN(vslidedown_vi, MATCH_VSLIDEDOWN_VI, MASK_VSLIDEDOWN_VI) +DECLARE_INSN(vadc_vim, MATCH_VADC_VIM, MASK_VADC_VIM) +DECLARE_INSN(vmadc_vim, MATCH_VMADC_VIM, MASK_VMADC_VIM) +DECLARE_INSN(vmerge_vim, MATCH_VMERGE_VIM, MASK_VMERGE_VIM) +DECLARE_INSN(vmv_v_i, MATCH_VMV_V_I, MASK_VMV_V_I) +DECLARE_INSN(vmseq_vi, MATCH_VMSEQ_VI, MASK_VMSEQ_VI) +DECLARE_INSN(vmsne_vi, MATCH_VMSNE_VI, MASK_VMSNE_VI) +DECLARE_INSN(vmsleu_vi, MATCH_VMSLEU_VI, MASK_VMSLEU_VI) +DECLARE_INSN(vmsle_vi, MATCH_VMSLE_VI, MASK_VMSLE_VI) +DECLARE_INSN(vmsgtu_vi, MATCH_VMSGTU_VI, MASK_VMSGTU_VI) +DECLARE_INSN(vmsgt_vi, MATCH_VMSGT_VI, MASK_VMSGT_VI) +DECLARE_INSN(vsaddu_vi, MATCH_VSADDU_VI, MASK_VSADDU_VI) +DECLARE_INSN(vsadd_vi, MATCH_VSADD_VI, MASK_VSADD_VI) +DECLARE_INSN(vsll_vi, MATCH_VSLL_VI, MASK_VSLL_VI) +DECLARE_INSN(vmv1r_v, MATCH_VMV1R_V, MASK_VMV1R_V) +DECLARE_INSN(vmv2r_v, MATCH_VMV2R_V, MASK_VMV2R_V) +DECLARE_INSN(vmv4r_v, MATCH_VMV4R_V, MASK_VMV4R_V) +DECLARE_INSN(vmv8r_v, MATCH_VMV8R_V, MASK_VMV8R_V) +DECLARE_INSN(vsrl_vi, MATCH_VSRL_VI, MASK_VSRL_VI) +DECLARE_INSN(vsra_vi, MATCH_VSRA_VI, MASK_VSRA_VI) +DECLARE_INSN(vssrl_vi, MATCH_VSSRL_VI, MASK_VSSRL_VI) +DECLARE_INSN(vssra_vi, MATCH_VSSRA_VI, MASK_VSSRA_VI) +DECLARE_INSN(vnsrl_wi, MATCH_VNSRL_WI, MASK_VNSRL_WI) +DECLARE_INSN(vnsra_wi, MATCH_VNSRA_WI, MASK_VNSRA_WI) +DECLARE_INSN(vnclipu_wi, MATCH_VNCLIPU_WI, MASK_VNCLIPU_WI) +DECLARE_INSN(vnclip_wi, MATCH_VNCLIP_WI, MASK_VNCLIP_WI) +DECLARE_INSN(vredsum_vs, MATCH_VREDSUM_VS, MASK_VREDSUM_VS) +DECLARE_INSN(vredand_vs, MATCH_VREDAND_VS, MASK_VREDAND_VS) +DECLARE_INSN(vredor_vs, MATCH_VREDOR_VS, MASK_VREDOR_VS) +DECLARE_INSN(vredxor_vs, MATCH_VREDXOR_VS, MASK_VREDXOR_VS) +DECLARE_INSN(vredminu_vs, MATCH_VREDMINU_VS, MASK_VREDMINU_VS) +DECLARE_INSN(vredmin_vs, MATCH_VREDMIN_VS, MASK_VREDMIN_VS) +DECLARE_INSN(vredmaxu_vs, MATCH_VREDMAXU_VS, MASK_VREDMAXU_VS) +DECLARE_INSN(vredmax_vs, MATCH_VREDMAX_VS, MASK_VREDMAX_VS) +DECLARE_INSN(vaaddu_vv, MATCH_VAADDU_VV, MASK_VAADDU_VV) +DECLARE_INSN(vaadd_vv, MATCH_VAADD_VV, MASK_VAADD_VV) +DECLARE_INSN(vasubu_vv, MATCH_VASUBU_VV, MASK_VASUBU_VV) +DECLARE_INSN(vasub_vv, MATCH_VASUB_VV, MASK_VASUB_VV) +DECLARE_INSN(vmv_x_s, MATCH_VMV_X_S, MASK_VMV_X_S) +DECLARE_INSN(vcompress_vm, MATCH_VCOMPRESS_VM, MASK_VCOMPRESS_VM) +DECLARE_INSN(vmandnot_mm, MATCH_VMANDNOT_MM, MASK_VMANDNOT_MM) +DECLARE_INSN(vmand_mm, MATCH_VMAND_MM, MASK_VMAND_MM) +DECLARE_INSN(vmor_mm, MATCH_VMOR_MM, MASK_VMOR_MM) +DECLARE_INSN(vmxor_mm, MATCH_VMXOR_MM, MASK_VMXOR_MM) +DECLARE_INSN(vmornot_mm, MATCH_VMORNOT_MM, MASK_VMORNOT_MM) +DECLARE_INSN(vmnand_mm, MATCH_VMNAND_MM, MASK_VMNAND_MM) +DECLARE_INSN(vmnor_mm, MATCH_VMNOR_MM, MASK_VMNOR_MM) +DECLARE_INSN(vmxnor_mm, MATCH_VMXNOR_MM, MASK_VMXNOR_MM) +DECLARE_INSN(vmsbf_m, MATCH_VMSBF_M, MASK_VMSBF_M) +DECLARE_INSN(vmsof_m, MATCH_VMSOF_M, MASK_VMSOF_M) +DECLARE_INSN(vmsif_m, MATCH_VMSIF_M, MASK_VMSIF_M) +DECLARE_INSN(viota_m, MATCH_VIOTA_M, MASK_VIOTA_M) +DECLARE_INSN(vid_v, MATCH_VID_V, MASK_VID_V) +DECLARE_INSN(vpopc_m, MATCH_VPOPC_M, MASK_VPOPC_M) +DECLARE_INSN(vfirst_m, MATCH_VFIRST_M, MASK_VFIRST_M) +DECLARE_INSN(vdivu_vv, MATCH_VDIVU_VV, MASK_VDIVU_VV) +DECLARE_INSN(vdiv_vv, MATCH_VDIV_VV, MASK_VDIV_VV) +DECLARE_INSN(vremu_vv, MATCH_VREMU_VV, MASK_VREMU_VV) +DECLARE_INSN(vrem_vv, MATCH_VREM_VV, MASK_VREM_VV) +DECLARE_INSN(vmulhu_vv, MATCH_VMULHU_VV, MASK_VMULHU_VV) +DECLARE_INSN(vmul_vv, MATCH_VMUL_VV, MASK_VMUL_VV) +DECLARE_INSN(vmulhsu_vv, MATCH_VMULHSU_VV, MASK_VMULHSU_VV) +DECLARE_INSN(vmulh_vv, MATCH_VMULH_VV, MASK_VMULH_VV) +DECLARE_INSN(vmadd_vv, MATCH_VMADD_VV, MASK_VMADD_VV) +DECLARE_INSN(vnmsub_vv, MATCH_VNMSUB_VV, MASK_VNMSUB_VV) +DECLARE_INSN(vmacc_vv, MATCH_VMACC_VV, MASK_VMACC_VV) +DECLARE_INSN(vnmsac_vv, MATCH_VNMSAC_VV, MASK_VNMSAC_VV) +DECLARE_INSN(vwaddu_vv, MATCH_VWADDU_VV, MASK_VWADDU_VV) +DECLARE_INSN(vwadd_vv, MATCH_VWADD_VV, MASK_VWADD_VV) +DECLARE_INSN(vwsubu_vv, MATCH_VWSUBU_VV, MASK_VWSUBU_VV) +DECLARE_INSN(vwsub_vv, MATCH_VWSUB_VV, MASK_VWSUB_VV) +DECLARE_INSN(vwaddu_wv, MATCH_VWADDU_WV, MASK_VWADDU_WV) +DECLARE_INSN(vwadd_wv, MATCH_VWADD_WV, MASK_VWADD_WV) +DECLARE_INSN(vwsubu_wv, MATCH_VWSUBU_WV, MASK_VWSUBU_WV) +DECLARE_INSN(vwsub_wv, MATCH_VWSUB_WV, MASK_VWSUB_WV) +DECLARE_INSN(vwmulu_vv, MATCH_VWMULU_VV, MASK_VWMULU_VV) +DECLARE_INSN(vwmulsu_vv, MATCH_VWMULSU_VV, MASK_VWMULSU_VV) +DECLARE_INSN(vwmul_vv, MATCH_VWMUL_VV, MASK_VWMUL_VV) +DECLARE_INSN(vwmaccu_vv, MATCH_VWMACCU_VV, MASK_VWMACCU_VV) +DECLARE_INSN(vwmacc_vv, MATCH_VWMACC_VV, MASK_VWMACC_VV) +DECLARE_INSN(vwmaccsu_vv, MATCH_VWMACCSU_VV, MASK_VWMACCSU_VV) +DECLARE_INSN(vaaddu_vx, MATCH_VAADDU_VX, MASK_VAADDU_VX) +DECLARE_INSN(vaadd_vx, MATCH_VAADD_VX, MASK_VAADD_VX) +DECLARE_INSN(vasubu_vx, MATCH_VASUBU_VX, MASK_VASUBU_VX) +DECLARE_INSN(vasub_vx, MATCH_VASUB_VX, MASK_VASUB_VX) +DECLARE_INSN(vmv_s_x, MATCH_VMV_S_X, MASK_VMV_S_X) +DECLARE_INSN(vslide1up_vx, MATCH_VSLIDE1UP_VX, MASK_VSLIDE1UP_VX) +DECLARE_INSN(vslide1down_vx, MATCH_VSLIDE1DOWN_VX, MASK_VSLIDE1DOWN_VX) +DECLARE_INSN(vdivu_vx, MATCH_VDIVU_VX, MASK_VDIVU_VX) +DECLARE_INSN(vdiv_vx, MATCH_VDIV_VX, MASK_VDIV_VX) +DECLARE_INSN(vremu_vx, MATCH_VREMU_VX, MASK_VREMU_VX) +DECLARE_INSN(vrem_vx, MATCH_VREM_VX, MASK_VREM_VX) +DECLARE_INSN(vmulhu_vx, MATCH_VMULHU_VX, MASK_VMULHU_VX) +DECLARE_INSN(vmul_vx, MATCH_VMUL_VX, MASK_VMUL_VX) +DECLARE_INSN(vmulhsu_vx, MATCH_VMULHSU_VX, MASK_VMULHSU_VX) +DECLARE_INSN(vmulh_vx, MATCH_VMULH_VX, MASK_VMULH_VX) +DECLARE_INSN(vmadd_vx, MATCH_VMADD_VX, MASK_VMADD_VX) +DECLARE_INSN(vnmsub_vx, MATCH_VNMSUB_VX, MASK_VNMSUB_VX) +DECLARE_INSN(vmacc_vx, MATCH_VMACC_VX, MASK_VMACC_VX) +DECLARE_INSN(vnmsac_vx, MATCH_VNMSAC_VX, MASK_VNMSAC_VX) +DECLARE_INSN(vwaddu_vx, MATCH_VWADDU_VX, MASK_VWADDU_VX) +DECLARE_INSN(vwadd_vx, MATCH_VWADD_VX, MASK_VWADD_VX) +DECLARE_INSN(vwsubu_vx, MATCH_VWSUBU_VX, MASK_VWSUBU_VX) +DECLARE_INSN(vwsub_vx, MATCH_VWSUB_VX, MASK_VWSUB_VX) +DECLARE_INSN(vwaddu_wx, MATCH_VWADDU_WX, MASK_VWADDU_WX) +DECLARE_INSN(vwadd_wx, MATCH_VWADD_WX, MASK_VWADD_WX) +DECLARE_INSN(vwsubu_wx, MATCH_VWSUBU_WX, MASK_VWSUBU_WX) +DECLARE_INSN(vwsub_wx, MATCH_VWSUB_WX, MASK_VWSUB_WX) +DECLARE_INSN(vwmulu_vx, MATCH_VWMULU_VX, MASK_VWMULU_VX) +DECLARE_INSN(vwmulsu_vx, MATCH_VWMULSU_VX, MASK_VWMULSU_VX) +DECLARE_INSN(vwmul_vx, MATCH_VWMUL_VX, MASK_VWMUL_VX) +DECLARE_INSN(vwmaccu_vx, MATCH_VWMACCU_VX, MASK_VWMACCU_VX) +DECLARE_INSN(vwmacc_vx, MATCH_VWMACC_VX, MASK_VWMACC_VX) +DECLARE_INSN(vwmaccus_vx, MATCH_VWMACCUS_VX, MASK_VWMACCUS_VX) +DECLARE_INSN(vwmaccsu_vx, MATCH_VWMACCSU_VX, MASK_VWMACCSU_VX) +DECLARE_INSN(vamoswapw_v, MATCH_VAMOSWAPW_V, MASK_VAMOSWAPW_V) +DECLARE_INSN(vamoaddw_v, MATCH_VAMOADDW_V, MASK_VAMOADDW_V) +DECLARE_INSN(vamoxorw_v, MATCH_VAMOXORW_V, MASK_VAMOXORW_V) +DECLARE_INSN(vamoandw_v, MATCH_VAMOANDW_V, MASK_VAMOANDW_V) +DECLARE_INSN(vamoorw_v, MATCH_VAMOORW_V, MASK_VAMOORW_V) +DECLARE_INSN(vamominw_v, MATCH_VAMOMINW_V, MASK_VAMOMINW_V) +DECLARE_INSN(vamomaxw_v, MATCH_VAMOMAXW_V, MASK_VAMOMAXW_V) +DECLARE_INSN(vamominuw_v, MATCH_VAMOMINUW_V, MASK_VAMOMINUW_V) +DECLARE_INSN(vamomaxuw_v, MATCH_VAMOMAXUW_V, MASK_VAMOMAXUW_V) +DECLARE_INSN(vamoswape_v, MATCH_VAMOSWAPE_V, MASK_VAMOSWAPE_V) +DECLARE_INSN(vamoadde_v, MATCH_VAMOADDE_V, MASK_VAMOADDE_V) +DECLARE_INSN(vamoxore_v, MATCH_VAMOXORE_V, MASK_VAMOXORE_V) +DECLARE_INSN(vamoande_v, MATCH_VAMOANDE_V, MASK_VAMOANDE_V) +DECLARE_INSN(vamoore_v, MATCH_VAMOORE_V, MASK_VAMOORE_V) +DECLARE_INSN(vamomine_v, MATCH_VAMOMINE_V, MASK_VAMOMINE_V) +DECLARE_INSN(vamomaxe_v, MATCH_VAMOMAXE_V, MASK_VAMOMAXE_V) +DECLARE_INSN(vamominue_v, MATCH_VAMOMINUE_V, MASK_VAMOMINUE_V) +DECLARE_INSN(vamomaxue_v, MATCH_VAMOMAXUE_V, MASK_VAMOMAXUE_V) +DECLARE_INSN(vmvnfr_v, MATCH_VMVNFR_V, MASK_VMVNFR_V) +#endif +#ifdef DECLARE_CSR +DECLARE_CSR(fflags, CSR_FFLAGS) +DECLARE_CSR(frm, CSR_FRM) +DECLARE_CSR(fcsr, CSR_FCSR) +DECLARE_CSR(ustatus, CSR_USTATUS) +DECLARE_CSR(uie, CSR_UIE) +DECLARE_CSR(utvec, CSR_UTVEC) +DECLARE_CSR(vstart, CSR_VSTART) +DECLARE_CSR(vxsat, CSR_VXSAT) +DECLARE_CSR(vxrm, CSR_VXRM) +DECLARE_CSR(vcsr, CSR_VCSR) +DECLARE_CSR(uscratch, CSR_USCRATCH) +DECLARE_CSR(uepc, CSR_UEPC) +DECLARE_CSR(ucause, CSR_UCAUSE) +DECLARE_CSR(utval, CSR_UTVAL) +DECLARE_CSR(uip, CSR_UIP) +DECLARE_CSR(cycle, CSR_CYCLE) +DECLARE_CSR(time, CSR_TIME) +DECLARE_CSR(instret, CSR_INSTRET) +DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3) +DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4) +DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5) +DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6) +DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7) +DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8) +DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9) +DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10) +DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11) +DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12) +DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13) +DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14) +DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15) +DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16) +DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17) +DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18) +DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19) +DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20) +DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21) +DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22) +DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23) +DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24) +DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25) +DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26) +DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27) +DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28) +DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29) +DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30) +DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31) +DECLARE_CSR(vl, CSR_VL) +DECLARE_CSR(vtype, CSR_VTYPE) +DECLARE_CSR(vlenb, CSR_VLENB) +DECLARE_CSR(sstatus, CSR_SSTATUS) +DECLARE_CSR(sedeleg, CSR_SEDELEG) +DECLARE_CSR(sideleg, CSR_SIDELEG) +DECLARE_CSR(sie, CSR_SIE) +DECLARE_CSR(stvec, CSR_STVEC) +DECLARE_CSR(scounteren, CSR_SCOUNTEREN) +DECLARE_CSR(sscratch, CSR_SSCRATCH) +DECLARE_CSR(sepc, CSR_SEPC) +DECLARE_CSR(scause, CSR_SCAUSE) +DECLARE_CSR(stval, CSR_STVAL) +DECLARE_CSR(sip, CSR_SIP) +DECLARE_CSR(satp, CSR_SATP) +DECLARE_CSR(vsstatus, CSR_VSSTATUS) +DECLARE_CSR(vsie, CSR_VSIE) +DECLARE_CSR(vstvec, CSR_VSTVEC) +DECLARE_CSR(vsscratch, CSR_VSSCRATCH) +DECLARE_CSR(vsepc, CSR_VSEPC) +DECLARE_CSR(vscause, CSR_VSCAUSE) +DECLARE_CSR(vstval, CSR_VSTVAL) +DECLARE_CSR(vsip, CSR_VSIP) +DECLARE_CSR(vsatp, CSR_VSATP) +DECLARE_CSR(hstatus, CSR_HSTATUS) +DECLARE_CSR(hedeleg, CSR_HEDELEG) +DECLARE_CSR(hideleg, CSR_HIDELEG) +DECLARE_CSR(hie, CSR_HIE) +DECLARE_CSR(htimedelta, CSR_HTIMEDELTA) +DECLARE_CSR(hcounteren, CSR_HCOUNTEREN) +DECLARE_CSR(hgeie, CSR_HGEIE) +DECLARE_CSR(htval, CSR_HTVAL) +DECLARE_CSR(hip, CSR_HIP) +DECLARE_CSR(hvip, CSR_HVIP) +DECLARE_CSR(htinst, CSR_HTINST) +DECLARE_CSR(hgatp, CSR_HGATP) +DECLARE_CSR(hgeip, CSR_HGEIP) +DECLARE_CSR(utvt, CSR_UTVT) +DECLARE_CSR(unxti, CSR_UNXTI) +DECLARE_CSR(uintstatus, CSR_UINTSTATUS) +DECLARE_CSR(uscratchcsw, CSR_USCRATCHCSW) +DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL) +DECLARE_CSR(stvt, CSR_STVT) +DECLARE_CSR(snxti, CSR_SNXTI) +DECLARE_CSR(sintstatus, CSR_SINTSTATUS) +DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW) +DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL) +DECLARE_CSR(mtvt, CSR_MTVT) +DECLARE_CSR(mnxti, CSR_MNXTI) +DECLARE_CSR(mintstatus, CSR_MINTSTATUS) +DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW) +DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL) +DECLARE_CSR(mstatus, CSR_MSTATUS) +DECLARE_CSR(misa, CSR_MISA) +DECLARE_CSR(medeleg, CSR_MEDELEG) +DECLARE_CSR(mideleg, CSR_MIDELEG) +DECLARE_CSR(mie, CSR_MIE) +DECLARE_CSR(mtvec, CSR_MTVEC) +DECLARE_CSR(mcounteren, CSR_MCOUNTEREN) +DECLARE_CSR(mcountinhibit, CSR_MCOUNTINHIBIT) +DECLARE_CSR(mscratch, CSR_MSCRATCH) +DECLARE_CSR(mepc, CSR_MEPC) +DECLARE_CSR(mcause, CSR_MCAUSE) +DECLARE_CSR(mtval, CSR_MTVAL) +DECLARE_CSR(mip, CSR_MIP) +DECLARE_CSR(mtinst, CSR_MTINST) +DECLARE_CSR(mtval2, CSR_MTVAL2) +DECLARE_CSR(pmpcfg0, CSR_PMPCFG0) +DECLARE_CSR(pmpcfg1, CSR_PMPCFG1) +DECLARE_CSR(pmpcfg2, CSR_PMPCFG2) +DECLARE_CSR(pmpcfg3, CSR_PMPCFG3) +DECLARE_CSR(pmpaddr0, CSR_PMPADDR0) +DECLARE_CSR(pmpaddr1, CSR_PMPADDR1) +DECLARE_CSR(pmpaddr2, CSR_PMPADDR2) +DECLARE_CSR(pmpaddr3, CSR_PMPADDR3) +DECLARE_CSR(pmpaddr4, CSR_PMPADDR4) +DECLARE_CSR(pmpaddr5, CSR_PMPADDR5) +DECLARE_CSR(pmpaddr6, CSR_PMPADDR6) +DECLARE_CSR(pmpaddr7, CSR_PMPADDR7) +DECLARE_CSR(pmpaddr8, CSR_PMPADDR8) +DECLARE_CSR(pmpaddr9, CSR_PMPADDR9) +DECLARE_CSR(pmpaddr10, CSR_PMPADDR10) +DECLARE_CSR(pmpaddr11, CSR_PMPADDR11) +DECLARE_CSR(pmpaddr12, CSR_PMPADDR12) +DECLARE_CSR(pmpaddr13, CSR_PMPADDR13) +DECLARE_CSR(pmpaddr14, CSR_PMPADDR14) +DECLARE_CSR(pmpaddr15, CSR_PMPADDR15) +DECLARE_CSR(tselect, CSR_TSELECT) +DECLARE_CSR(tdata1, CSR_TDATA1) +DECLARE_CSR(tdata2, CSR_TDATA2) +DECLARE_CSR(tdata3, CSR_TDATA3) +DECLARE_CSR(dcsr, CSR_DCSR) +DECLARE_CSR(dpc, CSR_DPC) +DECLARE_CSR(dscratch0, CSR_DSCRATCH0) +DECLARE_CSR(dscratch1, CSR_DSCRATCH1) +DECLARE_CSR(mcycle, CSR_MCYCLE) +DECLARE_CSR(minstret, CSR_MINSTRET) +DECLARE_CSR(mhpmcounter3, CSR_MHPMCOUNTER3) +DECLARE_CSR(mhpmcounter4, CSR_MHPMCOUNTER4) +DECLARE_CSR(mhpmcounter5, CSR_MHPMCOUNTER5) +DECLARE_CSR(mhpmcounter6, CSR_MHPMCOUNTER6) +DECLARE_CSR(mhpmcounter7, CSR_MHPMCOUNTER7) +DECLARE_CSR(mhpmcounter8, CSR_MHPMCOUNTER8) +DECLARE_CSR(mhpmcounter9, CSR_MHPMCOUNTER9) +DECLARE_CSR(mhpmcounter10, CSR_MHPMCOUNTER10) +DECLARE_CSR(mhpmcounter11, CSR_MHPMCOUNTER11) +DECLARE_CSR(mhpmcounter12, CSR_MHPMCOUNTER12) +DECLARE_CSR(mhpmcounter13, CSR_MHPMCOUNTER13) +DECLARE_CSR(mhpmcounter14, CSR_MHPMCOUNTER14) +DECLARE_CSR(mhpmcounter15, CSR_MHPMCOUNTER15) +DECLARE_CSR(mhpmcounter16, CSR_MHPMCOUNTER16) +DECLARE_CSR(mhpmcounter17, CSR_MHPMCOUNTER17) +DECLARE_CSR(mhpmcounter18, CSR_MHPMCOUNTER18) +DECLARE_CSR(mhpmcounter19, CSR_MHPMCOUNTER19) +DECLARE_CSR(mhpmcounter20, CSR_MHPMCOUNTER20) +DECLARE_CSR(mhpmcounter21, CSR_MHPMCOUNTER21) +DECLARE_CSR(mhpmcounter22, CSR_MHPMCOUNTER22) +DECLARE_CSR(mhpmcounter23, CSR_MHPMCOUNTER23) +DECLARE_CSR(mhpmcounter24, CSR_MHPMCOUNTER24) +DECLARE_CSR(mhpmcounter25, CSR_MHPMCOUNTER25) +DECLARE_CSR(mhpmcounter26, CSR_MHPMCOUNTER26) +DECLARE_CSR(mhpmcounter27, CSR_MHPMCOUNTER27) +DECLARE_CSR(mhpmcounter28, CSR_MHPMCOUNTER28) +DECLARE_CSR(mhpmcounter29, CSR_MHPMCOUNTER29) +DECLARE_CSR(mhpmcounter30, CSR_MHPMCOUNTER30) +DECLARE_CSR(mhpmcounter31, CSR_MHPMCOUNTER31) +DECLARE_CSR(mhpmevent3, CSR_MHPMEVENT3) +DECLARE_CSR(mhpmevent4, CSR_MHPMEVENT4) +DECLARE_CSR(mhpmevent5, CSR_MHPMEVENT5) +DECLARE_CSR(mhpmevent6, CSR_MHPMEVENT6) +DECLARE_CSR(mhpmevent7, CSR_MHPMEVENT7) +DECLARE_CSR(mhpmevent8, CSR_MHPMEVENT8) +DECLARE_CSR(mhpmevent9, CSR_MHPMEVENT9) +DECLARE_CSR(mhpmevent10, CSR_MHPMEVENT10) +DECLARE_CSR(mhpmevent11, CSR_MHPMEVENT11) +DECLARE_CSR(mhpmevent12, CSR_MHPMEVENT12) +DECLARE_CSR(mhpmevent13, CSR_MHPMEVENT13) +DECLARE_CSR(mhpmevent14, CSR_MHPMEVENT14) +DECLARE_CSR(mhpmevent15, CSR_MHPMEVENT15) +DECLARE_CSR(mhpmevent16, CSR_MHPMEVENT16) +DECLARE_CSR(mhpmevent17, CSR_MHPMEVENT17) +DECLARE_CSR(mhpmevent18, CSR_MHPMEVENT18) +DECLARE_CSR(mhpmevent19, CSR_MHPMEVENT19) +DECLARE_CSR(mhpmevent20, CSR_MHPMEVENT20) +DECLARE_CSR(mhpmevent21, CSR_MHPMEVENT21) +DECLARE_CSR(mhpmevent22, CSR_MHPMEVENT22) +DECLARE_CSR(mhpmevent23, CSR_MHPMEVENT23) +DECLARE_CSR(mhpmevent24, CSR_MHPMEVENT24) +DECLARE_CSR(mhpmevent25, CSR_MHPMEVENT25) +DECLARE_CSR(mhpmevent26, CSR_MHPMEVENT26) +DECLARE_CSR(mhpmevent27, CSR_MHPMEVENT27) +DECLARE_CSR(mhpmevent28, CSR_MHPMEVENT28) +DECLARE_CSR(mhpmevent29, CSR_MHPMEVENT29) +DECLARE_CSR(mhpmevent30, CSR_MHPMEVENT30) +DECLARE_CSR(mhpmevent31, CSR_MHPMEVENT31) +DECLARE_CSR(mvendorid, CSR_MVENDORID) +DECLARE_CSR(marchid, CSR_MARCHID) +DECLARE_CSR(mimpid, CSR_MIMPID) +DECLARE_CSR(mhartid, CSR_MHARTID) +DECLARE_CSR(htimedeltah, CSR_HTIMEDELTAH) +DECLARE_CSR(cycleh, CSR_CYCLEH) +DECLARE_CSR(timeh, CSR_TIMEH) +DECLARE_CSR(instreth, CSR_INSTRETH) +DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H) +DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H) +DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H) +DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H) +DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H) +DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H) +DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H) +DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H) +DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H) +DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H) +DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H) +DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H) +DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H) +DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H) +DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H) +DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H) +DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H) +DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H) +DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H) +DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H) +DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H) +DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H) +DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H) +DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H) +DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H) +DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H) +DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H) +DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H) +DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H) +DECLARE_CSR(mstatush, CSR_MSTATUSH) +DECLARE_CSR(mcycleh, CSR_MCYCLEH) +DECLARE_CSR(minstreth, CSR_MINSTRETH) +DECLARE_CSR(mhpmcounter3h, CSR_MHPMCOUNTER3H) +DECLARE_CSR(mhpmcounter4h, CSR_MHPMCOUNTER4H) +DECLARE_CSR(mhpmcounter5h, CSR_MHPMCOUNTER5H) +DECLARE_CSR(mhpmcounter6h, CSR_MHPMCOUNTER6H) +DECLARE_CSR(mhpmcounter7h, CSR_MHPMCOUNTER7H) +DECLARE_CSR(mhpmcounter8h, CSR_MHPMCOUNTER8H) +DECLARE_CSR(mhpmcounter9h, CSR_MHPMCOUNTER9H) +DECLARE_CSR(mhpmcounter10h, CSR_MHPMCOUNTER10H) +DECLARE_CSR(mhpmcounter11h, CSR_MHPMCOUNTER11H) +DECLARE_CSR(mhpmcounter12h, CSR_MHPMCOUNTER12H) +DECLARE_CSR(mhpmcounter13h, CSR_MHPMCOUNTER13H) +DECLARE_CSR(mhpmcounter14h, CSR_MHPMCOUNTER14H) +DECLARE_CSR(mhpmcounter15h, CSR_MHPMCOUNTER15H) +DECLARE_CSR(mhpmcounter16h, CSR_MHPMCOUNTER16H) +DECLARE_CSR(mhpmcounter17h, CSR_MHPMCOUNTER17H) +DECLARE_CSR(mhpmcounter18h, CSR_MHPMCOUNTER18H) +DECLARE_CSR(mhpmcounter19h, CSR_MHPMCOUNTER19H) +DECLARE_CSR(mhpmcounter20h, CSR_MHPMCOUNTER20H) +DECLARE_CSR(mhpmcounter21h, CSR_MHPMCOUNTER21H) +DECLARE_CSR(mhpmcounter22h, CSR_MHPMCOUNTER22H) +DECLARE_CSR(mhpmcounter23h, CSR_MHPMCOUNTER23H) +DECLARE_CSR(mhpmcounter24h, CSR_MHPMCOUNTER24H) +DECLARE_CSR(mhpmcounter25h, CSR_MHPMCOUNTER25H) +DECLARE_CSR(mhpmcounter26h, CSR_MHPMCOUNTER26H) +DECLARE_CSR(mhpmcounter27h, CSR_MHPMCOUNTER27H) +DECLARE_CSR(mhpmcounter28h, CSR_MHPMCOUNTER28H) +DECLARE_CSR(mhpmcounter29h, CSR_MHPMCOUNTER29H) +DECLARE_CSR(mhpmcounter30h, CSR_MHPMCOUNTER30H) +DECLARE_CSR(mhpmcounter31h, CSR_MHPMCOUNTER31H) +#endif +#ifdef DECLARE_CAUSE +DECLARE_CAUSE("misaligned fetch", CAUSE_MISALIGNED_FETCH) +DECLARE_CAUSE("fetch access", CAUSE_FETCH_ACCESS) +DECLARE_CAUSE("illegal instruction", CAUSE_ILLEGAL_INSTRUCTION) +DECLARE_CAUSE("breakpoint", CAUSE_BREAKPOINT) +DECLARE_CAUSE("misaligned load", CAUSE_MISALIGNED_LOAD) +DECLARE_CAUSE("load access", CAUSE_LOAD_ACCESS) +DECLARE_CAUSE("misaligned store", CAUSE_MISALIGNED_STORE) +DECLARE_CAUSE("store access", CAUSE_STORE_ACCESS) +DECLARE_CAUSE("user_ecall", CAUSE_USER_ECALL) +DECLARE_CAUSE("supervisor_ecall", CAUSE_SUPERVISOR_ECALL) +DECLARE_CAUSE("hypervisor_ecall", CAUSE_HYPERVISOR_ECALL) +DECLARE_CAUSE("machine_ecall", CAUSE_MACHINE_ECALL) +DECLARE_CAUSE("fetch page fault", CAUSE_FETCH_PAGE_FAULT) +DECLARE_CAUSE("load page fault", CAUSE_LOAD_PAGE_FAULT) +DECLARE_CAUSE("store page fault", CAUSE_STORE_PAGE_FAULT) +#endif diff --git a/apps/riscv-tests/env/p/link.ld b/apps/riscv-tests/env/p/link.ld new file mode 100644 index 0000000..b3e315e --- /dev/null +++ b/apps/riscv-tests/env/p/link.ld @@ -0,0 +1,17 @@ +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS +{ + . = 0x80000000; + .text.init : { *(.text.init) } + . = ALIGN(0x1000); + .tohost : { *(.tohost) } + . = ALIGN(0x1000); + .text : { *(.text) } + . = ALIGN(0x1000); + .data : { *(.data) } + .bss : { *(.bss) } + _end = .; +} + diff --git a/apps/riscv-tests/env/p/riscv_test.h b/apps/riscv-tests/env/p/riscv_test.h new file mode 100644 index 0000000..2b6ff83 --- /dev/null +++ b/apps/riscv-tests/env/p/riscv_test.h @@ -0,0 +1,269 @@ +// See LICENSE for license details. + +#ifndef _ENV_PHYSICAL_SINGLE_CORE_H +#define _ENV_PHYSICAL_SINGLE_CORE_H + +#include "../encoding.h" + +//----------------------------------------------------------------------- +// Begin Macro +//----------------------------------------------------------------------- + +#define RVTEST_RV64U \ + .macro init; \ + .endm + +#define RVTEST_RV64UF \ + .macro init; \ + RVTEST_FP_ENABLE; \ + .endm + +#define RVTEST_RV64UV \ + .macro init; \ + RVTEST_VECTOR_ENABLE; \ + .endm + +#define RVTEST_RV32U \ + .macro init; \ + .endm + +#define RVTEST_RV32UF \ + .macro init; \ + RVTEST_FP_ENABLE; \ + .endm + +#define RVTEST_RV32UV \ + .macro init; \ + RVTEST_VECTOR_ENABLE; \ + .endm + +#define RVTEST_RV64M \ + .macro init; \ + RVTEST_ENABLE_MACHINE; \ + .endm + +#define RVTEST_RV64S \ + .macro init; \ + RVTEST_ENABLE_SUPERVISOR; \ + .endm + +#define RVTEST_RV32M \ + .macro init; \ + RVTEST_ENABLE_MACHINE; \ + .endm + +#define RVTEST_RV32S \ + .macro init; \ + RVTEST_ENABLE_SUPERVISOR; \ + .endm + +#if __riscv_xlen == 64 +# define CHECK_XLEN li a0, 1; slli a0, a0, 31; bgez a0, 1f; RVTEST_PASS; 1: +#else +# define CHECK_XLEN li a0, 1; slli a0, a0, 31; bltz a0, 1f; RVTEST_PASS; 1: +#endif + +#define INIT_XREG \ + li x1, 0; \ + li x2, 0; \ + li x3, 0; \ + li x4, 0; \ + li x5, 0; \ + li x6, 0; \ + li x7, 0; \ + li x8, 0; \ + li x9, 0; \ + li x10, 0; \ + li x11, 0; \ + li x12, 0; \ + li x13, 0; \ + li x14, 0; \ + li x15, 0; \ + li x16, 0; \ + li x17, 0; \ + li x18, 0; \ + li x19, 0; \ + li x20, 0; \ + li x21, 0; \ + li x22, 0; \ + li x23, 0; \ + li x24, 0; \ + li x25, 0; \ + li x26, 0; \ + li x27, 0; \ + li x28, 0; \ + li x29, 0; \ + li x30, 0; \ + li x31, 0; + +#define INIT_PMP \ + la t0, 1f; \ + csrw mtvec, t0; \ + /* Set up a PMP to permit all accesses */ \ + li t0, (1 << (31 + (__riscv_xlen / 64) * (53 - 31))) - 1; \ + csrw pmpaddr0, t0; \ + li t0, PMP_NAPOT | PMP_R | PMP_W | PMP_X; \ + csrw pmpcfg0, t0; \ + .align 2; \ +1: + +#define INIT_SATP \ + la t0, 1f; \ + csrw mtvec, t0; \ + csrwi sptbr, 0; \ + .align 2; \ +1: + +#define DELEGATE_NO_TRAPS \ + csrwi mie, 0; \ + la t0, 1f; \ + csrw mtvec, t0; \ + csrwi medeleg, 0; \ + csrwi mideleg, 0; \ + .align 2; \ +1: + +#define RVTEST_ENABLE_SUPERVISOR \ + li a0, MSTATUS_MPP & (MSTATUS_MPP >> 1); \ + csrs mstatus, a0; \ + li a0, SIP_SSIP | SIP_STIP; \ + csrs mideleg, a0; \ + +#define RVTEST_ENABLE_MACHINE \ + li a0, MSTATUS_MPP; \ + csrs mstatus, a0; \ + +#define RVTEST_FP_ENABLE \ + li a0, MSTATUS_FS & (MSTATUS_FS >> 1); \ + csrs mstatus, a0; \ + csrwi fcsr, 0 + +#define RVTEST_VECTOR_ENABLE \ + li a0, (MSTATUS_VS & (MSTATUS_VS >> 1)) | \ + (MSTATUS_FS & (MSTATUS_FS >> 1)); \ + csrs mstatus, a0; \ + csrwi fcsr, 0; \ + csrwi vcsr, 0; + +#define RISCV_MULTICORE_DISABLE \ + csrr a0, mhartid; \ + 1: bnez a0, 1b + +#define EXTRA_TVEC_USER +#define EXTRA_TVEC_MACHINE +#define EXTRA_INIT +#define EXTRA_INIT_TIMER + +#define INTERRUPT_HANDLER j other_exception /* No interrupts should occur */ + +#define RVTEST_CODE_BEGIN \ + .section .text.init; \ + .align 6; \ + .weak stvec_handler; \ + .weak mtvec_handler; \ + .globl _start; \ +_start: \ + /* reset vector */ \ + j reset_vector; \ + .align 2; \ +trap_vector: \ + /* test whether the test came from pass/fail */ \ + csrr t5, mcause; \ + li t6, CAUSE_USER_ECALL; \ + beq t5, t6, write_tohost; \ + li t6, CAUSE_SUPERVISOR_ECALL; \ + beq t5, t6, write_tohost; \ + li t6, CAUSE_MACHINE_ECALL; \ + beq t5, t6, write_tohost; \ + /* if an mtvec_handler is defined, jump to it */ \ + la t5, mtvec_handler; \ + beqz t5, 1f; \ + jr t5; \ + /* was it an interrupt or an exception? */ \ + 1: csrr t5, mcause; \ + bgez t5, handle_exception; \ + INTERRUPT_HANDLER; \ +handle_exception: \ + /* we don't know how to handle whatever the exception was */ \ + other_exception: \ + /* some unhandlable exception occurred */ \ + 1: ori TESTNUM, TESTNUM, 1337; \ + write_tohost: \ + sw TESTNUM, tohost, t5; \ + j write_tohost; \ +reset_vector: \ + INIT_XREG; \ + RISCV_MULTICORE_DISABLE; \ + INIT_SATP; \ + INIT_PMP; \ + DELEGATE_NO_TRAPS; \ + li TESTNUM, 0; \ + la t0, trap_vector; \ + csrw mtvec, t0; \ + CHECK_XLEN; \ + /* if an stvec_handler is defined, delegate exceptions to it */ \ + la t0, stvec_handler; \ + beqz t0, 1f; \ + csrw stvec, t0; \ + li t0, (1 << CAUSE_LOAD_PAGE_FAULT) | \ + (1 << CAUSE_STORE_PAGE_FAULT) | \ + (1 << CAUSE_FETCH_PAGE_FAULT) | \ + (1 << CAUSE_MISALIGNED_FETCH) | \ + (1 << CAUSE_USER_ECALL) | \ + (1 << CAUSE_BREAKPOINT); \ + csrw medeleg, t0; \ +1: csrwi mstatus, 0; \ + init; \ + EXTRA_INIT; \ + EXTRA_INIT_TIMER; \ + la t0, 1f; \ + csrw mepc, t0; \ + csrr a0, mhartid; \ + mret; \ +1: + +//----------------------------------------------------------------------- +// End Macro +//----------------------------------------------------------------------- + +#define RVTEST_CODE_END \ + unimp + +//----------------------------------------------------------------------- +// Pass/Fail Macro +//----------------------------------------------------------------------- + +#define RVTEST_PASS \ + fence; \ + li TESTNUM, 1; \ + li a7, 93; \ + li a0, 0; \ + ecall + +#define TESTNUM gp +#define RVTEST_FAIL \ + fence; \ +1: beqz TESTNUM, 1b; \ + sll TESTNUM, TESTNUM, 1; \ + or TESTNUM, TESTNUM, 1; \ + li a7, 93; \ + addi a0, TESTNUM, 0; \ + ecall + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#define EXTRA_DATA + +#define RVTEST_DATA_BEGIN \ + EXTRA_DATA \ + .pushsection .tohost,"aw",@progbits; \ + .align 6; .global tohost; tohost: .dword 0; \ + .align 6; .global fromhost; fromhost: .dword 0; \ + .popsection; \ + .align 4; .global begin_signature; begin_signature: + +#define RVTEST_DATA_END .align 4; .global end_signature; end_signature: + +#endif diff --git a/apps/riscv-tests/env/pm/link.ld b/apps/riscv-tests/env/pm/link.ld new file mode 120000 index 0000000..86b45f9 --- /dev/null +++ b/apps/riscv-tests/env/pm/link.ld @@ -0,0 +1 @@ +../p/link.ld \ No newline at end of file diff --git a/apps/riscv-tests/env/pm/riscv_test.h b/apps/riscv-tests/env/pm/riscv_test.h new file mode 100644 index 0000000..38a0e86 --- /dev/null +++ b/apps/riscv-tests/env/pm/riscv_test.h @@ -0,0 +1,11 @@ +// See LICENSE for license details. + +#ifndef _ENV_PHYSICAL_MULTI_CORE_H +#define _ENV_PHYSICAL_MULTI_CORE_H + +#include "../p/riscv_test.h" + +#undef RISCV_MULTICORE_DISABLE +#define RISCV_MULTICORE_DISABLE + +#endif diff --git a/apps/riscv-tests/env/pt/link.ld b/apps/riscv-tests/env/pt/link.ld new file mode 120000 index 0000000..86b45f9 --- /dev/null +++ b/apps/riscv-tests/env/pt/link.ld @@ -0,0 +1 @@ +../p/link.ld \ No newline at end of file diff --git a/apps/riscv-tests/env/pt/riscv_test.h b/apps/riscv-tests/env/pt/riscv_test.h new file mode 100644 index 0000000..34c2a33 --- /dev/null +++ b/apps/riscv-tests/env/pt/riscv_test.h @@ -0,0 +1,69 @@ +// See LICENSE for license details. + +#ifndef _ENV_PHYSICAL_SINGLE_CORE_TIMER_H +#define _ENV_PHYSICAL_SINGLE_CORE_TIMER_H + +#include "../p/riscv_test.h" + +#define TIMER_INTERVAL 2 + +#undef EXTRA_INIT_TIMER +#define EXTRA_INIT_TIMER \ + li a0, MIP_MTIP; \ + csrs mie, a0; \ + csrr a0, mtime; \ + addi a0, a0, TIMER_INTERVAL; \ + csrw mtimecmp, a0; \ + +#if SSTATUS_XS != 0x18000 +# error +#endif +#define XS_SHIFT 15 + +#undef INTERRUPT_HANDLER +#define INTERRUPT_HANDLER \ + slli t5, t5, 1; \ + srli t5, t5, 1; \ + add t5, t5, -IRQ_M_TIMER; \ + bnez t5, other_exception; /* other interrups shouldn't happen */\ + csrr t5, mtime; \ + addi t5, t5, TIMER_INTERVAL; \ + csrw mtimecmp, t5; \ + mret; \ + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#undef EXTRA_DATA +#define EXTRA_DATA \ + .align 3; \ +regspill: \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ +evac: \ + .skip 32768; \ + +#endif diff --git a/apps/riscv-tests/env/v/entry.S b/apps/riscv-tests/env/v/entry.S new file mode 100644 index 0000000..fa492e6 --- /dev/null +++ b/apps/riscv-tests/env/v/entry.S @@ -0,0 +1,162 @@ +#include "riscv_test.h" + +#if __riscv_xlen == 64 +# define STORE sd +# define LOAD ld +# define REGBYTES 8 +#else +# define STORE sw +# define LOAD lw +# define REGBYTES 4 +#endif + +#define STACK_TOP (_end + 4096) + + .section ".text.init","ax",@progbits + .globl _start + .align 2 +_start: + j handle_reset + + /* NMI vector */ + .align 2 +nmi_vector: + j wtf + + .align 2 +trap_vector: + j wtf + +handle_reset: + li x1, 0 + li x2, 0 + li x3, 0 + li x4, 0 + li x5, 0 + li x6, 0 + li x7, 0 + li x8, 0 + li x9, 0 + li x10, 0 + li x11, 0 + li x12, 0 + li x13, 0 + li x14, 0 + li x15, 0 + li x16, 0 + li x17, 0 + li x18, 0 + li x19, 0 + li x20, 0 + li x21, 0 + li x22, 0 + li x23, 0 + li x24, 0 + li x25, 0 + li x26, 0 + li x27, 0 + li x28, 0 + li x29, 0 + li x30, 0 + li x31, 0 + + la t0, trap_vector + csrw mtvec, t0 + la sp, STACK_TOP - SIZEOF_TRAPFRAME_T + csrr t0, mhartid + slli t0, t0, 12 + add sp, sp, t0 + csrw mscratch, sp + call extra_boot + la a0, userstart + j vm_boot + + .globl pop_tf +pop_tf: + LOAD t0,33*REGBYTES(a0) + csrw sepc,t0 + LOAD x1,1*REGBYTES(a0) + LOAD x2,2*REGBYTES(a0) + LOAD x3,3*REGBYTES(a0) + LOAD x4,4*REGBYTES(a0) + LOAD x5,5*REGBYTES(a0) + LOAD x6,6*REGBYTES(a0) + LOAD x7,7*REGBYTES(a0) + LOAD x8,8*REGBYTES(a0) + LOAD x9,9*REGBYTES(a0) + LOAD x11,11*REGBYTES(a0) + LOAD x12,12*REGBYTES(a0) + LOAD x13,13*REGBYTES(a0) + LOAD x14,14*REGBYTES(a0) + LOAD x15,15*REGBYTES(a0) + LOAD x16,16*REGBYTES(a0) + LOAD x17,17*REGBYTES(a0) + LOAD x18,18*REGBYTES(a0) + LOAD x19,19*REGBYTES(a0) + LOAD x20,20*REGBYTES(a0) + LOAD x21,21*REGBYTES(a0) + LOAD x22,22*REGBYTES(a0) + LOAD x23,23*REGBYTES(a0) + LOAD x24,24*REGBYTES(a0) + LOAD x25,25*REGBYTES(a0) + LOAD x26,26*REGBYTES(a0) + LOAD x27,27*REGBYTES(a0) + LOAD x28,28*REGBYTES(a0) + LOAD x29,29*REGBYTES(a0) + LOAD x30,30*REGBYTES(a0) + LOAD x31,31*REGBYTES(a0) + LOAD a0,10*REGBYTES(a0) + sret + + .global trap_entry + .align 2 +trap_entry: + csrrw sp, sscratch, sp + + # save gprs + STORE x1,1*REGBYTES(sp) + STORE x3,3*REGBYTES(sp) + STORE x4,4*REGBYTES(sp) + STORE x5,5*REGBYTES(sp) + STORE x6,6*REGBYTES(sp) + STORE x7,7*REGBYTES(sp) + STORE x8,8*REGBYTES(sp) + STORE x9,9*REGBYTES(sp) + STORE x10,10*REGBYTES(sp) + STORE x11,11*REGBYTES(sp) + STORE x12,12*REGBYTES(sp) + STORE x13,13*REGBYTES(sp) + STORE x14,14*REGBYTES(sp) + STORE x15,15*REGBYTES(sp) + STORE x16,16*REGBYTES(sp) + STORE x17,17*REGBYTES(sp) + STORE x18,18*REGBYTES(sp) + STORE x19,19*REGBYTES(sp) + STORE x20,20*REGBYTES(sp) + STORE x21,21*REGBYTES(sp) + STORE x22,22*REGBYTES(sp) + STORE x23,23*REGBYTES(sp) + STORE x24,24*REGBYTES(sp) + STORE x25,25*REGBYTES(sp) + STORE x26,26*REGBYTES(sp) + STORE x27,27*REGBYTES(sp) + STORE x28,28*REGBYTES(sp) + STORE x29,29*REGBYTES(sp) + STORE x30,30*REGBYTES(sp) + STORE x31,31*REGBYTES(sp) + + csrrw t0,sscratch,sp + STORE t0,2*REGBYTES(sp) + + # get sr, epc, badvaddr, cause + csrr t0,sstatus + STORE t0,32*REGBYTES(sp) + csrr t0,sepc + STORE t0,33*REGBYTES(sp) + csrr t0,sbadaddr + STORE t0,34*REGBYTES(sp) + csrr t0,scause + STORE t0,35*REGBYTES(sp) + + move a0, sp + j handle_trap diff --git a/apps/riscv-tests/env/v/link.ld b/apps/riscv-tests/env/v/link.ld new file mode 120000 index 0000000..86b45f9 --- /dev/null +++ b/apps/riscv-tests/env/v/link.ld @@ -0,0 +1 @@ +../p/link.ld \ No newline at end of file diff --git a/apps/riscv-tests/env/v/riscv_test.h b/apps/riscv-tests/env/v/riscv_test.h new file mode 100644 index 0000000..c74e05d --- /dev/null +++ b/apps/riscv-tests/env/v/riscv_test.h @@ -0,0 +1,80 @@ +// See LICENSE for license details. + +#ifndef _ENV_VIRTUAL_SINGLE_CORE_H +#define _ENV_VIRTUAL_SINGLE_CORE_H + +#include "../p/riscv_test.h" + +//----------------------------------------------------------------------- +// Begin Macro +//----------------------------------------------------------------------- + +#undef RVTEST_FP_ENABLE +#define RVTEST_FP_ENABLE fssr x0 + +#undef RVTEST_VECTOR_ENABLE +#define RVTEST_VECTOR_ENABLE \ + csrwi fcsr, 0; \ + csrwi vcsr, 0; + +#undef RVTEST_CODE_BEGIN +#define RVTEST_CODE_BEGIN \ + .text; \ + .global extra_boot; \ +extra_boot: \ + EXTRA_INIT \ + ret; \ + .global userstart; \ +userstart: \ + init + +//----------------------------------------------------------------------- +// Pass/Fail Macro +//----------------------------------------------------------------------- + +#undef RVTEST_PASS +#define RVTEST_PASS li a0, 1; scall + +#undef RVTEST_FAIL +#define RVTEST_FAIL sll a0, TESTNUM, 1; 1:beqz a0, 1b; or a0, a0, 1; scall; + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#undef RVTEST_DATA_END +#define RVTEST_DATA_END + +//----------------------------------------------------------------------- +// Supervisor mode definitions and macros +//----------------------------------------------------------------------- + +#define MAX_TEST_PAGES 63 // this must be the period of the LFSR below +#define LFSR_NEXT(x) (((((x)^((x)>>1)) & 1) << 5) | ((x) >> 1)) + +#define PGSHIFT 12 +#define PGSIZE (1UL << PGSHIFT) + +#define SIZEOF_TRAPFRAME_T ((__riscv_xlen / 8) * 36) + +#ifndef __ASSEMBLER__ + +typedef unsigned long pte_t; +#define LEVELS (sizeof(pte_t) == sizeof(uint64_t) ? 3 : 2) +#define PTIDXBITS (PGSHIFT - (sizeof(pte_t) == 8 ? 3 : 2)) +#define VPN_BITS (PTIDXBITS * LEVELS) +#define VA_BITS (VPN_BITS + PGSHIFT) +#define PTES_PER_PT (1UL << RISCV_PGLEVEL_BITS) +#define MEGAPAGE_SIZE (PTES_PER_PT * PGSIZE) + +typedef struct +{ + long gpr[32]; + long sr; + long epc; + long badvaddr; + long cause; +} trapframe_t; +#endif + +#endif diff --git a/apps/riscv-tests/env/v/string.c b/apps/riscv-tests/env/v/string.c new file mode 100644 index 0000000..4ffedc0 --- /dev/null +++ b/apps/riscv-tests/env/v/string.c @@ -0,0 +1,114 @@ +#include +#include +#include + +void* memcpy(void* dest, const void* src, size_t len) +{ + if ((((uintptr_t)dest | (uintptr_t)src | len) & (sizeof(uintptr_t)-1)) == 0) { + const uintptr_t* s = src; + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = *s++; + } else { + const char* s = src; + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = *s++; + } + return dest; +} + +void* memset(void* dest, int byte, size_t len) +{ + if ((((uintptr_t)dest | len) & (sizeof(uintptr_t)-1)) == 0) { + uintptr_t word = byte & 0xFF; + word |= word << 8; + word |= word << 16; + word |= word << 16 << 16; + + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = word; + } else { + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = byte; + } + return dest; +} + +size_t strlen(const char *s) +{ + const char *p = s; + while (*p) + p++; + return p - s; +} + +int strcmp(const char* s1, const char* s2) +{ + unsigned char c1, c2; + + do { + c1 = *s1++; + c2 = *s2++; + } while (c1 != 0 && c1 == c2); + + return c1 - c2; +} + +int memcmp(const void* s1, const void* s2, size_t n) +{ + if ((((uintptr_t)s1 | (uintptr_t)s2) & (sizeof(uintptr_t)-1)) == 0) { + const uintptr_t* u1 = s1; + const uintptr_t* u2 = s2; + const uintptr_t* end = u1 + (n / sizeof(uintptr_t)); + while (u1 < end) { + if (*u1 != *u2) + break; + u1++; + u2++; + } + n -= (const void*)u1 - s1; + s1 = u1; + s2 = u2; + } + + while (n--) { + unsigned char c1 = *(const unsigned char*)s1++; + unsigned char c2 = *(const unsigned char*)s2++; + if (c1 != c2) + return c1 - c2; + } + + return 0; +} + +char* strcpy(char* dest, const char* src) +{ + char* d = dest; + while ((*d++ = *src++)) + ; + return dest; +} + +long atol(const char* str) +{ + long res = 0; + int sign = 0; + + while (*str == ' ') + str++; + + if (*str == '-' || *str == '+') { + sign = *str == '-'; + str++; + } + + while (*str) { + res *= 10; + res += *str++ - '0'; + } + + return sign ? -res : res; +} diff --git a/apps/riscv-tests/env/v/vm.c b/apps/riscv-tests/env/v/vm.c new file mode 100644 index 0000000..71700f5 --- /dev/null +++ b/apps/riscv-tests/env/v/vm.c @@ -0,0 +1,300 @@ +// See LICENSE for license details. + +#include +#include +#include + +#include "riscv_test.h" + +#if __riscv_xlen == 32 +# define SATP_MODE_CHOICE SATP_MODE_SV32 +#elif defined(Sv48) +# define SATP_MODE_CHOICE SATP_MODE_SV48 +#else +# define SATP_MODE_CHOICE SATP_MODE_SV39 +#endif + +void trap_entry(); +void pop_tf(trapframe_t*); + +extern volatile uint64_t tohost; +extern volatile uint64_t fromhost; + +static void do_tohost(uint64_t tohost_value) +{ + while (tohost) + fromhost = 0; + tohost = tohost_value; +} + +#define pa2kva(pa) ((void*)(pa) - DRAM_BASE - MEGAPAGE_SIZE) +#define uva2kva(pa) ((void*)(pa) - MEGAPAGE_SIZE) + +#define flush_page(addr) asm volatile ("sfence.vma %0" : : "r" (addr) : "memory") + +static uint64_t lfsr63(uint64_t x) +{ + uint64_t bit = (x ^ (x >> 1)) & 1; + return (x >> 1) | (bit << 62); +} + +static void cputchar(int x) +{ + do_tohost(0x0101000000000000 | (unsigned char)x); +} + +static void cputstring(const char* s) +{ + while (*s) + cputchar(*s++); +} + +static void terminate(int code) +{ + do_tohost(code); + while (1); +} + +void wtf() +{ + terminate(841); +} + +#define stringify1(x) #x +#define stringify(x) stringify1(x) +#define assert(x) do { \ + if (x) break; \ + cputstring("Assertion failed: " stringify(x) "\n"); \ + terminate(3); \ +} while(0) + +#define l1pt pt[0] +#define user_l2pt pt[1] +#if SATP_MODE_CHOICE == SATP_MODE_SV48 +# define NPT 6 +# define kernel_l2pt pt[2] +# define kernel_l3pt pt[3] +# define user_l3pt pt[4] +# define user_llpt pt[5] +#elif SATP_MODE_CHOICE == SATP_MODE_SV39 +# define NPT 4 +# define kernel_l2pt pt[2] +# define user_llpt pt[3] +#elif SATP_MODE_CHOICE == SATP_MODE_SV32 +# define NPT 2 +# define user_llpt user_l2pt +#else +# error Unknown SATP_MODE_CHOICE +#endif +pte_t pt[NPT][PTES_PER_PT] __attribute__((aligned(PGSIZE))); + +typedef struct { pte_t addr; void* next; } freelist_t; + +freelist_t user_mapping[MAX_TEST_PAGES]; +freelist_t freelist_nodes[MAX_TEST_PAGES]; +freelist_t *freelist_head, *freelist_tail; + +void printhex(uint64_t x) +{ + char str[17]; + for (int i = 0; i < 16; i++) + { + str[15-i] = (x & 0xF) + ((x & 0xF) < 10 ? '0' : 'a'-10); + x >>= 4; + } + str[16] = 0; + + cputstring(str); +} + +static void evict(unsigned long addr) +{ + assert(addr >= PGSIZE && addr < MAX_TEST_PAGES * PGSIZE); + addr = addr/PGSIZE*PGSIZE; + + freelist_t* node = &user_mapping[addr/PGSIZE]; + if (node->addr) + { + // check accessed and dirty bits + assert(user_llpt[addr/PGSIZE] & PTE_A); + uintptr_t sstatus = set_csr(sstatus, SSTATUS_SUM); + if (memcmp((void*)addr, uva2kva(addr), PGSIZE)) { + assert(user_llpt[addr/PGSIZE] & PTE_D); + memcpy((void*)addr, uva2kva(addr), PGSIZE); + } + write_csr(sstatus, sstatus); + + user_mapping[addr/PGSIZE].addr = 0; + + if (freelist_tail == 0) + freelist_head = freelist_tail = node; + else + { + freelist_tail->next = node; + freelist_tail = node; + } + } +} + +void handle_fault(uintptr_t addr, uintptr_t cause) +{ + assert(addr >= PGSIZE && addr < MAX_TEST_PAGES * PGSIZE); + addr = addr/PGSIZE*PGSIZE; + + if (user_llpt[addr/PGSIZE]) { + if (!(user_llpt[addr/PGSIZE] & PTE_A)) { + user_llpt[addr/PGSIZE] |= PTE_A; + } else { + assert(!(user_llpt[addr/PGSIZE] & PTE_D) && cause == CAUSE_STORE_PAGE_FAULT); + user_llpt[addr/PGSIZE] |= PTE_D; + } + flush_page(addr); + return; + } + + freelist_t* node = freelist_head; + assert(node); + freelist_head = node->next; + if (freelist_head == freelist_tail) + freelist_tail = 0; + + uintptr_t new_pte = (node->addr >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V | PTE_U | PTE_R | PTE_W | PTE_X; + user_llpt[addr/PGSIZE] = new_pte | PTE_A | PTE_D; + flush_page(addr); + + assert(user_mapping[addr/PGSIZE].addr == 0); + user_mapping[addr/PGSIZE] = *node; + + uintptr_t sstatus = set_csr(sstatus, SSTATUS_SUM); + memcpy((void*)addr, uva2kva(addr), PGSIZE); + write_csr(sstatus, sstatus); + + user_llpt[addr/PGSIZE] = new_pte; + flush_page(addr); + + __builtin___clear_cache(0,0); +} + +void handle_trap(trapframe_t* tf) +{ + if (tf->cause == CAUSE_USER_ECALL) + { + int n = tf->gpr[10]; + + for (long i = 1; i < MAX_TEST_PAGES; i++) + evict(i*PGSIZE); + + terminate(n); + } + else if (tf->cause == CAUSE_ILLEGAL_INSTRUCTION) + { + assert(tf->epc % 4 == 0); + + int* fssr; + asm ("jal %0, 1f; fssr x0; 1:" : "=r"(fssr)); + + if (*(int*)tf->epc == *fssr) + terminate(1); // FP test on non-FP hardware. "succeed." + else + assert(!"illegal instruction"); + tf->epc += 4; + } + else if (tf->cause == CAUSE_FETCH_PAGE_FAULT || tf->cause == CAUSE_LOAD_PAGE_FAULT || tf->cause == CAUSE_STORE_PAGE_FAULT) + handle_fault(tf->badvaddr, tf->cause); + else + assert(!"unexpected exception"); + + pop_tf(tf); +} + +static void coherence_torture() +{ + // cause coherence misses without affecting program semantics + uint64_t random = ENTROPY; + while (1) { + uintptr_t paddr = DRAM_BASE + ((random % (2 * (MAX_TEST_PAGES + 1) * PGSIZE)) & -4); +#ifdef __riscv_atomic + if (random & 1) // perform a no-op write + asm volatile ("amoadd.w zero, zero, (%0)" :: "r"(paddr)); + else // perform a read +#endif + asm volatile ("lw zero, (%0)" :: "r"(paddr)); + random = lfsr63(random); + } +} + +void vm_boot(uintptr_t test_addr) +{ + uint64_t random = ENTROPY; + if (read_csr(mhartid) > 0) + coherence_torture(); + + _Static_assert(SIZEOF_TRAPFRAME_T == sizeof(trapframe_t), "???"); + +#if (MAX_TEST_PAGES > PTES_PER_PT) || (DRAM_BASE % MEGAPAGE_SIZE) != 0 +# error +#endif + // map user to lowermost megapage + l1pt[0] = ((pte_t)user_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + // map kernel to uppermost megapage +#if SATP_MODE_CHOICE == SATP_MODE_SV48 + l1pt[PTES_PER_PT-1] = ((pte_t)kernel_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + kernel_l2pt[PTES_PER_PT-1] = ((pte_t)kernel_l3pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + kernel_l3pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D; + user_l2pt[0] = ((pte_t)user_l3pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + user_l3pt[0] = ((pte_t)user_llpt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; +#elif SATP_MODE_CHOICE == SATP_MODE_SV39 + l1pt[PTES_PER_PT-1] = ((pte_t)kernel_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + kernel_l2pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D; + user_l2pt[0] = ((pte_t)user_llpt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; +#elif SATP_MODE_CHOICE == SATP_MODE_SV32 + l1pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D; +#else +# error +#endif + uintptr_t vm_choice = SATP_MODE_CHOICE; + uintptr_t sptbr_value = ((uintptr_t)l1pt >> PGSHIFT) + | (vm_choice * (SATP_MODE & ~(SATP_MODE<<1))); + write_csr(sptbr, sptbr_value); + if (read_csr(sptbr) != sptbr_value) + assert(!"unsupported satp mode"); + + // Set up PMPs if present, ignoring illegal instruction trap if not. + uintptr_t pmpc = PMP_NAPOT | PMP_R | PMP_W | PMP_X; + uintptr_t pmpa = ((uintptr_t)1 << (__riscv_xlen == 32 ? 31 : 53)) - 1; + asm volatile ("la t0, 1f\n\t" + "csrrw t0, mtvec, t0\n\t" + "csrw pmpaddr0, %1\n\t" + "csrw pmpcfg0, %0\n\t" + ".align 2\n\t" + "1: csrw mtvec, t0" + : : "r" (pmpc), "r" (pmpa) : "t0"); + + // set up supervisor trap handling + write_csr(stvec, pa2kva(trap_entry)); + write_csr(sscratch, pa2kva(read_csr(mscratch))); + write_csr(medeleg, + (1 << CAUSE_USER_ECALL) | + (1 << CAUSE_FETCH_PAGE_FAULT) | + (1 << CAUSE_LOAD_PAGE_FAULT) | + (1 << CAUSE_STORE_PAGE_FAULT)); + // FPU on; accelerator on; vector unit on + write_csr(mstatus, MSTATUS_FS | MSTATUS_XS | MSTATUS_VS); + write_csr(mie, 0); + + random = 1 + (random % MAX_TEST_PAGES); + freelist_head = pa2kva((void*)&freelist_nodes[0]); + freelist_tail = pa2kva(&freelist_nodes[MAX_TEST_PAGES-1]); + for (long i = 0; i < MAX_TEST_PAGES; i++) + { + freelist_nodes[i].addr = DRAM_BASE + (MAX_TEST_PAGES + random)*PGSIZE; + freelist_nodes[i].next = pa2kva(&freelist_nodes[i+1]); + random = LFSR_NEXT(random); + } + freelist_nodes[MAX_TEST_PAGES-1].next = 0; + + trapframe_t tf; + memset(&tf, 0, sizeof(tf)); + tf.epc = test_addr - DRAM_BASE; + pop_tf(&tf); +} diff --git a/apps/riscv-tests/isa/.gitignore b/apps/riscv-tests/isa/.gitignore new file mode 100644 index 0000000..c93c5ff --- /dev/null +++ b/apps/riscv-tests/isa/.gitignore @@ -0,0 +1 @@ +rv*-* diff --git a/apps/riscv-tests/isa/Makefile b/apps/riscv-tests/isa/Makefile new file mode 100644 index 0000000..6813427 --- /dev/null +++ b/apps/riscv-tests/isa/Makefile @@ -0,0 +1,152 @@ +#======================================================================= +# Makefile for riscv-tests/isa +#----------------------------------------------------------------------- + +XLEN ?= 64 + +src_dir := . + +ifeq ($(XLEN),64) +include $(src_dir)/rv64ui/Makefrag +include $(src_dir)/rv64uc/Makefrag +include $(src_dir)/rv64um/Makefrag +include $(src_dir)/rv64ua/Makefrag +include $(src_dir)/rv64uf/Makefrag +include $(src_dir)/rv64ud/Makefrag +include $(src_dir)/rv64uv/Makefrag +include $(src_dir)/rv64si/Makefrag +include $(src_dir)/rv64mi/Makefrag +endif +include $(src_dir)/rv32ui/Makefrag +include $(src_dir)/rv32uc/Makefrag +include $(src_dir)/rv32um/Makefrag +include $(src_dir)/rv32ua/Makefrag +include $(src_dir)/rv32uf/Makefrag +include $(src_dir)/rv32ud/Makefrag +include $(src_dir)/rv32si/Makefrag +include $(src_dir)/rv32mi/Makefrag + +default: all + +#-------------------------------------------------------------------- +# Build rules +#-------------------------------------------------------------------- + +# Original GCC variables +RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf- +RISCV_GCC ?= $(RISCV_PREFIX)gcc +RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles +RISCV_GCC_OPTS_C ?= -O2 + +# Added LLVM variables +RISCV_LLVM ?= clang -fuse-ld=lld +RISCV_CC_OPTS ?= -mcmodel=medany -fvisibility=hidden -mno-relax -nostdlib -nostartfiles +RISCV_CC_OPTS_C ?= -O2 -mno-relax -nostdlib -nostartfiles -fno-vectorize -mllvm -scalable-vectorization=off -mllvm -riscv-v-vector-bits-min=0 -mno-implicit-float +RISCV_CC_DEFS_C ?= $(ARA_DEFINES) +LLVM_V_VERSION ?= v_zfh_zvfh + +# Original objdump + spike variables +RISCV_OBJDUMP ?= llvm-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.text.init --section=.data +RISCV_SIM ?= spike + +vpath %.S $(src_dir) + +#------------------------------------------------------------ +# Build assembly tests + +%.dump: % + $(RISCV_OBJDUMP) $< > $@ + +%.out: % + $(RISCV_SIM) --isa=rv64gcv --varch="vlen:4096,elen:64" $< 2> $@ + +%.out32: % + $(RISCV_SIM) --isa=rv32gcv $< 2> $@ + +%.cout: % + $(RISCV_SIM) --isa=rv64gcv_zfh --varch="vlen:4096,elen:64" $< 2> $@ + +%.cout32: % + $(RISCV_SIM) --isa=rv32gcv $< 2> $@ + +define compile_template + +$$($(1)_p_tests): $(1)-p-%: $(1)/%.S + $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir)/../env/p -I$(src_dir)/macros/scalar -I$(src_dir)/macros/vector -T$(src_dir)/../env/p/link.ld $$< -o $$@ +$(1)_tests += $$($(1)_p_tests) + +$$($(1)_v_tests): $(1)-v-%: $(1)/%.S + $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -DENTROPY=0x$$(shell echo \$$@ | md5sum | cut -c 1-7) -std=gnu99 -O2 -I$(src_dir)/../env/v -I$(src_dir)/macros/scalar -I$(src_dir)/macros/vector -T$(src_dir)/../env/v/link.ld $(src_dir)/../env/v/entry.S $(src_dir)/../env/v/*.c $$< -o $$@ +$(1)_tests += $$($(1)_v_tests) + +$(1)_tests_dump = $$(addsuffix .dump, $$($(1)_tests)) + +$(1): $$($(1)_tests_dump) + +.PHONY: $(1) + +tests += $$($(1)_tests) + +endef + +define compile_template_c + +$$($(1)_p_tests): $(1)-p-%: $(1)/%.c ../benchmarks/common/crt.S ../benchmarks/common/syscalls.c + $$(RISCV_LLVM) $$(RISCV_CC_OPTS_C) $$(RISCV_CC_DEFS_C) $(2)$$(LLVM_V_VERSION) $(3) -mcmodel=medany -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf -I../benchmarks/../env -I../benchmarks/common -I$(src_dir)/macros/scalar -I$(src_dir)/macros/vector -DPREALLOCATE=1 -D__FLOAT_SUPPORT__ -D__SPIKE__=1 $$(RISCV_LD_OPTS) -static -O2 -nostdlib -T../benchmarks/common/test.ld -o $$@ $$^ +$(1)_tests += $$($(1)_p_tests) + +$$($(1)_v_tests): $(1)-v-%: $(1)/%.c ../benchmarks/common/crt.S ../benchmarks/common/syscalls.c + $$(RISCV_LLVM) $$(RISCV_CC_OPTS_C) $$(RISCV_CC_DEFS_C) $(2)$$(LLVM_V_VERSION) $(3) -mcmodel=medany -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf -I../benchmarks/../env -I../benchmarks/common -I$(src_dir)/macros/scalar -I$(src_dir)/macros/vector -DPREALLOCATE=1 -D__FLOAT_SUPPORT__ -D__SPIKE__=1 $$(RISCV_LD_OPTS) -static -O2 -nostdlib -T../benchmarks/common/test.ld -o $$@ $$^ +$(1)_tests += $$($(1)_v_tests) + +$(1)_tests_dump = $$(addsuffix .dump, $$($(1)_tests)) + +$(1): $$($(1)_tests_dump) + +.PHONY: $(1) + +tests += $$($(1)_tests) + +endef + +$(eval $(call compile_template,rv32ui,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32uc,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32um,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32ua,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32uf,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32ud,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32si,-march=rv32g -mabi=ilp32)) +$(eval $(call compile_template,rv32mi,-march=rv32g -mabi=ilp32)) +ifeq ($(XLEN),64) +$(eval $(call compile_template,rv64ui,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template,rv64uc,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template,rv64um,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template,rv64ua,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template,rv64uf,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template,rv64ud,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template_c,rv64uv,-march=rv64g, -mabi=lp64)) +$(eval $(call compile_template,rv64si,-march=rv64g -mabi=lp64)) +$(eval $(call compile_template,rv64mi,-march=rv64g -mabi=lp64)) +endif + +tests_dump = $(addsuffix .dump, $(tests)) +tests_hex = $(addsuffix .hex, $(tests)) +tests_out = $(addsuffix .out, $(spike_tests)) +tests32_out = $(addsuffix .out32, $(spike32_tests)) +tests_cout = $(addsuffix .cout, $(spike_ctests)) +tests32_cout = $(addsuffix .cout32, $(spike32_ctests)) + +run: $(tests_out) $(tests32_out) $(tests_cout) $(tests32_cout) + +junk += $(tests) $(tests_dump) $(tests_hex) $(tests_out) $(tests32_out) $(tests_cout) $(tests32_cout) + +#------------------------------------------------------------ +# Default + +all: $(tests_dump) + +#------------------------------------------------------------ +# Clean up + +clean: + rm -rf $(junk) diff --git a/apps/riscv-tests/isa/macros/scalar/test_macros.h b/apps/riscv-tests/isa/macros/scalar/test_macros.h new file mode 100644 index 0000000..ed4cab0 --- /dev/null +++ b/apps/riscv-tests/isa/macros/scalar/test_macros.h @@ -0,0 +1,649 @@ +// See LICENSE for license details. + +#ifndef __TEST_MACROS_SCALAR_H +#define __TEST_MACROS_SCALAR_H + + +#----------------------------------------------------------------------- +# Helper macros +#----------------------------------------------------------------------- + +#define MASK_XLEN(x) ((x) & ((1 << (__riscv_xlen - 1) << 1) - 1)) + +#define TEST_CASE( testnum, testreg, correctval, code... ) \ +test_ ## testnum: \ + code; \ + li x7, MASK_XLEN(correctval); \ + li TESTNUM, testnum; \ + bne testreg, x7, fail; + +# We use a macro hack to simpify code generation for various numbers +# of bubble cycles. + +#define TEST_INSERT_NOPS_0 +#define TEST_INSERT_NOPS_1 nop; TEST_INSERT_NOPS_0 +#define TEST_INSERT_NOPS_2 nop; TEST_INSERT_NOPS_1 +#define TEST_INSERT_NOPS_3 nop; TEST_INSERT_NOPS_2 +#define TEST_INSERT_NOPS_4 nop; TEST_INSERT_NOPS_3 +#define TEST_INSERT_NOPS_5 nop; TEST_INSERT_NOPS_4 +#define TEST_INSERT_NOPS_6 nop; TEST_INSERT_NOPS_5 +#define TEST_INSERT_NOPS_7 nop; TEST_INSERT_NOPS_6 +#define TEST_INSERT_NOPS_8 nop; TEST_INSERT_NOPS_7 +#define TEST_INSERT_NOPS_9 nop; TEST_INSERT_NOPS_8 +#define TEST_INSERT_NOPS_10 nop; TEST_INSERT_NOPS_9 + + +#----------------------------------------------------------------------- +# RV64UI MACROS +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Tests for instructions with immediate operand +#----------------------------------------------------------------------- + +#define SEXT_IMM(x) ((x) | (-(((x) >> 11) & 1) << 11)) + +#define TEST_IMM_OP( testnum, inst, result, val1, imm ) \ + TEST_CASE( testnum, x14, result, \ + li x1, MASK_XLEN(val1); \ + inst x14, x1, SEXT_IMM(imm); \ + ) + +#define TEST_IMM_SRC1_EQ_DEST( testnum, inst, result, val1, imm ) \ + TEST_CASE( testnum, x1, result, \ + li x1, MASK_XLEN(val1); \ + inst x1, x1, SEXT_IMM(imm); \ + ) + +#define TEST_IMM_DEST_BYPASS( testnum, nop_cycles, inst, result, val1, imm ) \ + TEST_CASE( testnum, x6, result, \ + li x4, 0; \ +1: li x1, MASK_XLEN(val1); \ + inst x14, x1, SEXT_IMM(imm); \ + TEST_INSERT_NOPS_ ## nop_cycles \ + addi x6, x14, 0; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + ) + +#define TEST_IMM_SRC1_BYPASS( testnum, nop_cycles, inst, result, val1, imm ) \ + TEST_CASE( testnum, x14, result, \ + li x4, 0; \ +1: li x1, MASK_XLEN(val1); \ + TEST_INSERT_NOPS_ ## nop_cycles \ + inst x14, x1, SEXT_IMM(imm); \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + ) + +#define TEST_IMM_ZEROSRC1( testnum, inst, result, imm ) \ + TEST_CASE( testnum, x1, result, \ + inst x1, x0, SEXT_IMM(imm); \ + ) + +#define TEST_IMM_ZERODEST( testnum, inst, val1, imm ) \ + TEST_CASE( testnum, x0, 0, \ + li x1, MASK_XLEN(val1); \ + inst x0, x1, SEXT_IMM(imm); \ + ) + +#----------------------------------------------------------------------- +# Tests for an instruction with register operands +#----------------------------------------------------------------------- + +#define TEST_R_OP( testnum, inst, result, val1 ) \ + TEST_CASE( testnum, x14, result, \ + li x1, val1; \ + inst x14, x1; \ + ) + +#define TEST_R_SRC1_EQ_DEST( testnum, inst, result, val1 ) \ + TEST_CASE( testnum, x1, result, \ + li x1, val1; \ + inst x1, x1; \ + ) + +#define TEST_R_DEST_BYPASS( testnum, nop_cycles, inst, result, val1 ) \ + TEST_CASE( testnum, x6, result, \ + li x4, 0; \ +1: li x1, val1; \ + inst x14, x1; \ + TEST_INSERT_NOPS_ ## nop_cycles \ + addi x6, x14, 0; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + ) + +#----------------------------------------------------------------------- +# Tests for an instruction with register-register operands +#----------------------------------------------------------------------- + +#define TEST_RR_OP( testnum, inst, result, val1, val2 ) \ + TEST_CASE( testnum, x14, result, \ + li x1, MASK_XLEN(val1); \ + li x2, MASK_XLEN(val2); \ + inst x14, x1, x2; \ + ) + +#define TEST_RR_SRC1_EQ_DEST( testnum, inst, result, val1, val2 ) \ + TEST_CASE( testnum, x1, result, \ + li x1, MASK_XLEN(val1); \ + li x2, MASK_XLEN(val2); \ + inst x1, x1, x2; \ + ) + +#define TEST_RR_SRC2_EQ_DEST( testnum, inst, result, val1, val2 ) \ + TEST_CASE( testnum, x2, result, \ + li x1, MASK_XLEN(val1); \ + li x2, MASK_XLEN(val2); \ + inst x2, x1, x2; \ + ) + +#define TEST_RR_SRC12_EQ_DEST( testnum, inst, result, val1 ) \ + TEST_CASE( testnum, x1, result, \ + li x1, MASK_XLEN(val1); \ + inst x1, x1, x1; \ + ) + +#define TEST_RR_DEST_BYPASS( testnum, nop_cycles, inst, result, val1, val2 ) \ + TEST_CASE( testnum, x6, result, \ + li x4, 0; \ +1: li x1, MASK_XLEN(val1); \ + li x2, MASK_XLEN(val2); \ + inst x14, x1, x2; \ + TEST_INSERT_NOPS_ ## nop_cycles \ + addi x6, x14, 0; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + ) + +#define TEST_RR_SRC12_BYPASS( testnum, src1_nops, src2_nops, inst, result, val1, val2 ) \ + TEST_CASE( testnum, x14, result, \ + li x4, 0; \ +1: li x1, MASK_XLEN(val1); \ + TEST_INSERT_NOPS_ ## src1_nops \ + li x2, MASK_XLEN(val2); \ + TEST_INSERT_NOPS_ ## src2_nops \ + inst x14, x1, x2; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + ) + +#define TEST_RR_SRC21_BYPASS( testnum, src1_nops, src2_nops, inst, result, val1, val2 ) \ + TEST_CASE( testnum, x14, result, \ + li x4, 0; \ +1: li x2, MASK_XLEN(val2); \ + TEST_INSERT_NOPS_ ## src1_nops \ + li x1, MASK_XLEN(val1); \ + TEST_INSERT_NOPS_ ## src2_nops \ + inst x14, x1, x2; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + ) + +#define TEST_RR_ZEROSRC1( testnum, inst, result, val ) \ + TEST_CASE( testnum, x2, result, \ + li x1, MASK_XLEN(val); \ + inst x2, x0, x1; \ + ) + +#define TEST_RR_ZEROSRC2( testnum, inst, result, val ) \ + TEST_CASE( testnum, x2, result, \ + li x1, MASK_XLEN(val); \ + inst x2, x1, x0; \ + ) + +#define TEST_RR_ZEROSRC12( testnum, inst, result ) \ + TEST_CASE( testnum, x1, result, \ + inst x1, x0, x0; \ + ) + +#define TEST_RR_ZERODEST( testnum, inst, val1, val2 ) \ + TEST_CASE( testnum, x0, 0, \ + li x1, MASK_XLEN(val1); \ + li x2, MASK_XLEN(val2); \ + inst x0, x1, x2; \ + ) + +#----------------------------------------------------------------------- +# Test memory instructions +#----------------------------------------------------------------------- + +#define TEST_LD_OP( testnum, inst, result, offset, base ) \ + TEST_CASE( testnum, x14, result, \ + la x1, base; \ + inst x14, offset(x1); \ + ) + +#define TEST_ST_OP( testnum, load_inst, store_inst, result, offset, base ) \ + TEST_CASE( testnum, x14, result, \ + la x1, base; \ + li x2, result; \ + store_inst x2, offset(x1); \ + load_inst x14, offset(x1); \ + ) + +#define TEST_LD_DEST_BYPASS( testnum, nop_cycles, inst, result, offset, base ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: la x1, base; \ + inst x14, offset(x1); \ + TEST_INSERT_NOPS_ ## nop_cycles \ + addi x6, x14, 0; \ + li x7, result; \ + bne x6, x7, fail; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b; \ + +#define TEST_LD_SRC1_BYPASS( testnum, nop_cycles, inst, result, offset, base ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: la x1, base; \ + TEST_INSERT_NOPS_ ## nop_cycles \ + inst x14, offset(x1); \ + li x7, result; \ + bne x14, x7, fail; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + +#define TEST_ST_SRC12_BYPASS( testnum, src1_nops, src2_nops, load_inst, store_inst, result, offset, base ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: li x1, result; \ + TEST_INSERT_NOPS_ ## src1_nops \ + la x2, base; \ + TEST_INSERT_NOPS_ ## src2_nops \ + store_inst x1, offset(x2); \ + load_inst x14, offset(x2); \ + li x7, result; \ + bne x14, x7, fail; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + +#define TEST_ST_SRC21_BYPASS( testnum, src1_nops, src2_nops, load_inst, store_inst, result, offset, base ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: la x2, base; \ + TEST_INSERT_NOPS_ ## src1_nops \ + li x1, result; \ + TEST_INSERT_NOPS_ ## src2_nops \ + store_inst x1, offset(x2); \ + load_inst x14, offset(x2); \ + li x7, result; \ + bne x14, x7, fail; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + +#define TEST_BR2_OP_TAKEN( testnum, inst, val1, val2 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x1, val1; \ + li x2, val2; \ + inst x1, x2, 2f; \ + bne x0, TESTNUM, fail; \ +1: bne x0, TESTNUM, 3f; \ +2: inst x1, x2, 1b; \ + bne x0, TESTNUM, fail; \ +3: + +#define TEST_BR2_OP_NOTTAKEN( testnum, inst, val1, val2 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x1, val1; \ + li x2, val2; \ + inst x1, x2, 1f; \ + bne x0, TESTNUM, 2f; \ +1: bne x0, TESTNUM, fail; \ +2: inst x1, x2, 1b; \ +3: + +#define TEST_BR2_SRC12_BYPASS( testnum, src1_nops, src2_nops, inst, val1, val2 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: li x1, val1; \ + TEST_INSERT_NOPS_ ## src1_nops \ + li x2, val2; \ + TEST_INSERT_NOPS_ ## src2_nops \ + inst x1, x2, fail; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + +#define TEST_BR2_SRC21_BYPASS( testnum, src1_nops, src2_nops, inst, val1, val2 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: li x2, val2; \ + TEST_INSERT_NOPS_ ## src1_nops \ + li x1, val1; \ + TEST_INSERT_NOPS_ ## src2_nops \ + inst x1, x2, fail; \ + addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + +#----------------------------------------------------------------------- +# Test jump instructions +#----------------------------------------------------------------------- + +#define TEST_JR_SRC1_BYPASS( testnum, nop_cycles, inst ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: la x6, 2f; \ + TEST_INSERT_NOPS_ ## nop_cycles \ + inst x6; \ + bne x0, TESTNUM, fail; \ +2: addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + +#define TEST_JALR_SRC1_BYPASS( testnum, nop_cycles, inst ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + li x4, 0; \ +1: la x6, 2f; \ + TEST_INSERT_NOPS_ ## nop_cycles \ + inst x13, x6, 0; \ + bne x0, TESTNUM, fail; \ +2: addi x4, x4, 1; \ + li x5, 2; \ + bne x4, x5, 1b \ + + +#----------------------------------------------------------------------- +# RV64UF MACROS +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Tests floating-point instructions +#----------------------------------------------------------------------- + +#define qNaNf 0f:7fc00000 +#define sNaNf 0f:7f800001 +#define qNaN 0d:7ff8000000000000 +#define sNaN 0d:7ff0000000000001 + +#define TEST_FP_OP_S_INTERNAL( testnum, flags, result, val1, val2, val3, code... ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + la a0, test_ ## testnum ## _data ;\ + flw f0, 0(a0); \ + flw f1, 4(a0); \ + flw f2, 8(a0); \ + lw a3, 12(a0); \ + code; \ + fsflags a1, x0; \ + li a2, flags; \ + bne a0, a3, fail; \ + bne a1, a2, fail; \ + .pushsection .data; \ + .align 2; \ + test_ ## testnum ## _data: \ + .float val1; \ + .float val2; \ + .float val3; \ + .result; \ + .popsection + +#define TEST_FP_OP_D_INTERNAL( testnum, flags, result, val1, val2, val3, code... ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + la a0, test_ ## testnum ## _data ;\ + fld f0, 0(a0); \ + fld f1, 8(a0); \ + fld f2, 16(a0); \ + ld a3, 24(a0); \ + code; \ + fsflags a1, x0; \ + li a2, flags; \ + bne a0, a3, fail; \ + bne a1, a2, fail; \ + .pushsection .data; \ + .align 3; \ + test_ ## testnum ## _data: \ + .double val1; \ + .double val2; \ + .double val3; \ + .result; \ + .popsection + +// TODO: assign a separate mem location for the comparison address? +#define TEST_FP_OP_D32_INTERNAL( testnum, flags, result, val1, val2, val3, code... ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + la a0, test_ ## testnum ## _data ;\ + fld f0, 0(a0); \ + fld f1, 8(a0); \ + fld f2, 16(a0); \ + lw a3, 24(a0); \ + lw t1, 28(a0); \ + code; \ + fsflags a1, x0; \ + li a2, flags; \ + bne a0, a3, fail; \ + bne t1, t2, fail; \ + bne a1, a2, fail; \ + .pushsection .data; \ + .align 3; \ + test_ ## testnum ## _data: \ + .double val1; \ + .double val2; \ + .double val3; \ + .result; \ + .popsection + +#define TEST_FCVT_S_D32( testnum, result, val1 ) \ + TEST_FP_OP_D32_INTERNAL( testnum, 0, double result, val1, 0.0, 0.0, \ + fcvt.s.d f3, f0; fcvt.d.s f3, f3; fsd f3, 0(a0); lw t2, 4(a0); lw a0, 0(a0)) + +#define TEST_FCVT_S_D( testnum, result, val1 ) \ + TEST_FP_OP_D_INTERNAL( testnum, 0, double result, val1, 0.0, 0.0, \ + fcvt.s.d f3, f0; fcvt.d.s f3, f3; fmv.x.d a0, f3) + +#define TEST_FCVT_D_S( testnum, result, val1 ) \ + TEST_FP_OP_S_INTERNAL( testnum, 0, float result, val1, 0.0, 0.0, \ + fcvt.d.s f3, f0; fcvt.s.d f3, f3; fmv.x.s a0, f3) + +#define TEST_FP_OP1_S( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, float result, val1, 0.0, 0.0, \ + inst f3, f0; fmv.x.s a0, f3) + +#define TEST_FP_OP1_D32( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_D32_INTERNAL( testnum, flags, double result, val1, 0.0, 0.0, \ + inst f3, f0; fsd f3, 0(a0); lw t2, 4(a0); lw a0, 0(a0)) +// ^: store computation result in address from a0, load high-word into t2 + +#define TEST_FP_OP1_D( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, double result, val1, 0.0, 0.0, \ + inst f3, f0; fmv.x.d a0, f3) + +#define TEST_FP_OP1_S_DWORD_RESULT( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, dword result, val1, 0.0, 0.0, \ + inst f3, f0; fmv.x.s a0, f3) + +#define TEST_FP_OP1_D32_DWORD_RESULT( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_D32_INTERNAL( testnum, flags, dword result, val1, 0.0, 0.0, \ + inst f3, f0; fsd f3, 0(a0); lw t2, 4(a0); lw a0, 0(a0)) +// ^: store computation result in address from a0, load high-word into t2 + +#define TEST_FP_OP1_D_DWORD_RESULT( testnum, inst, flags, result, val1 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, dword result, val1, 0.0, 0.0, \ + inst f3, f0; fmv.x.d a0, f3) + +#define TEST_FP_OP2_S( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, float result, val1, val2, 0.0, \ + inst f3, f0, f1; fmv.x.s a0, f3) + +#define TEST_FP_OP2_D32( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_D32_INTERNAL( testnum, flags, double result, val1, val2, 0.0, \ + inst f3, f0, f1; fsd f3, 0(a0); lw t2, 4(a0); lw a0, 0(a0)) +// ^: store computation result in address from a0, load high-word into t2 + +#define TEST_FP_OP2_D( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, double result, val1, val2, 0.0, \ + inst f3, f0, f1; fmv.x.d a0, f3) + +#define TEST_FP_OP3_S( testnum, inst, flags, result, val1, val2, val3 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, float result, val1, val2, val3, \ + inst f3, f0, f1, f2; fmv.x.s a0, f3) + +#define TEST_FP_OP3_D32( testnum, inst, flags, result, val1, val2, val3 ) \ + TEST_FP_OP_D32_INTERNAL( testnum, flags, double result, val1, val2, val3, \ + inst f3, f0, f1, f2; fsd f3, 0(a0); lw t2, 4(a0); lw a0, 0(a0)) +// ^: store computation result in address from a0, load high-word into t2 + +#define TEST_FP_OP3_D( testnum, inst, flags, result, val1, val2, val3 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, double result, val1, val2, val3, \ + inst f3, f0, f1, f2; fmv.x.d a0, f3) + +#define TEST_FP_INT_OP_S( testnum, inst, flags, result, val1, rm ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, word result, val1, 0.0, 0.0, \ + inst a0, f0, rm) + +#define TEST_FP_INT_OP_D32( testnum, inst, flags, result, val1, rm ) \ + TEST_FP_OP_D32_INTERNAL( testnum, flags, dword result, val1, 0.0, 0.0, \ + inst a0, f0, f1; li t2, 0) + +#define TEST_FP_INT_OP_D( testnum, inst, flags, result, val1, rm ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, dword result, val1, 0.0, 0.0, \ + inst a0, f0, rm) + +#define TEST_FP_CMP_OP_S( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_S_INTERNAL( testnum, flags, word result, val1, val2, 0.0, \ + inst a0, f0, f1) + +#define TEST_FP_CMP_OP_D32( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_D32_INTERNAL( testnum, flags, dword result, val1, val2, 0.0, \ + inst a0, f0, f1; li t2, 0) + +#define TEST_FP_CMP_OP_D( testnum, inst, flags, result, val1, val2 ) \ + TEST_FP_OP_D_INTERNAL( testnum, flags, dword result, val1, val2, 0.0, \ + inst a0, f0, f1) + +#define TEST_FCLASS_S(testnum, correct, input) \ + TEST_CASE(testnum, a0, correct, li a0, input; fmv.s.x fa0, a0; \ + fclass.s a0, fa0) + +#define TEST_FCLASS_D32(testnum, correct, input) \ + TEST_CASE(testnum, a0, correct, \ + la a0, test_ ## testnum ## _data ;\ + fld fa0, 0(a0); \ + fclass.d a0, fa0) \ + .pushsection .data; \ + .align 3; \ + test_ ## testnum ## _data: \ + .dword input; \ + .popsection + +#define TEST_FCLASS_D(testnum, correct, input) \ + TEST_CASE(testnum, a0, correct, li a0, input; fmv.d.x fa0, a0; \ + fclass.d a0, fa0) + +#define TEST_INT_FP_OP_S( testnum, inst, result, val1 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + la a0, test_ ## testnum ## _data ;\ + lw a3, 0(a0); \ + li a0, val1; \ + inst f0, a0; \ + fsflags x0; \ + fmv.x.s a0, f0; \ + bne a0, a3, fail; \ + .pushsection .data; \ + .align 2; \ + test_ ## testnum ## _data: \ + .float result; \ + .popsection + +#define TEST_INT_FP_OP_D32( testnum, inst, result, val1 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + la a0, test_ ## testnum ## _data ;\ + lw a3, 0(a0); \ + lw a4, 4(a0); \ + li a1, val1; \ + inst f0, a1; \ + \ + fsd f0, 0(a0); \ + lw a1, 4(a0); \ + lw a0, 0(a0); \ + \ + fsflags x0; \ + bne a0, a3, fail; \ + bne a1, a4, fail; \ + .pushsection .data; \ + .align 3; \ + test_ ## testnum ## _data: \ + .double result; \ + .popsection + +#define TEST_INT_FP_OP_D( testnum, inst, result, val1 ) \ +test_ ## testnum: \ + li TESTNUM, testnum; \ + la a0, test_ ## testnum ## _data ;\ + ld a3, 0(a0); \ + li a0, val1; \ + inst f0, a0; \ + fsflags x0; \ + fmv.x.d a0, f0; \ + bne a0, a3, fail; \ + .pushsection .data; \ + .align 3; \ + test_ ## testnum ## _data: \ + .double result; \ + .popsection + +// We need some special handling here to allow 64-bit comparison in 32-bit arch +// TODO: find a better name and clean up when intended for general usage? +#define TEST_CASE_D32( testnum, testreg1, testreg2, correctval, code... ) \ +test_ ## testnum: \ + code; \ + la x15, test_ ## testnum ## _data ; \ + lw x7, 0(x15); \ + lw x15, 4(x15); \ + li TESTNUM, testnum; \ + bne testreg1, x7, fail;\ + bne testreg2, x15, fail;\ + .pushsection .data; \ + .align 3; \ + test_ ## testnum ## _data: \ + .dword correctval; \ + .popsection + +// ^ x14 is used in some other macros, to avoid issues we use x15 for upper word + +#----------------------------------------------------------------------- +# Pass and fail code (assumes test num is in TESTNUM) +#----------------------------------------------------------------------- + +#define TEST_PASSFAIL \ + bne x0, TESTNUM, pass; \ +fail: \ + RVTEST_FAIL; \ +pass: \ + RVTEST_PASS \ + + +#----------------------------------------------------------------------- +# Test data section +#----------------------------------------------------------------------- + +#define TEST_DATA + +#endif diff --git a/apps/riscv-tests/isa/macros/vector/dataset.h b/apps/riscv-tests/isa/macros/vector/dataset.h new file mode 100644 index 0000000..cfad940 --- /dev/null +++ b/apps/riscv-tests/isa/macros/vector/dataset.h @@ -0,0 +1,48 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante + +#ifndef __DATASET_H__ +#define __DATASET_H__ + +#define SIZE 1024 +#define L_SIZE 1024 + +static volatile uint64_t Au64[SIZE] __attribute__((aligned(128))); +static volatile uint32_t Au32[SIZE] __attribute__((aligned(128))); +static volatile uint16_t Au16[SIZE] __attribute__((aligned(128))); +static volatile uint8_t Au8 [SIZE] __attribute__((aligned(128))); +static volatile int64_t Ai64[SIZE] __attribute__((aligned(128))); +static volatile int32_t Ai32[SIZE] __attribute__((aligned(128))); +static volatile int16_t Ai16[SIZE] __attribute__((aligned(128))); +static volatile int8_t Ai8 [SIZE] __attribute__((aligned(128))); +static volatile uint64_t Af64[SIZE] __attribute__((aligned(128))); +static volatile uint32_t Af32[SIZE] __attribute__((aligned(128))); +static volatile uint16_t Af16[SIZE] __attribute__((aligned(128))); + +static volatile uint64_t Ru64[SIZE] __attribute__((aligned(128))); +static volatile uint32_t Ru32[SIZE] __attribute__((aligned(128))); +static volatile uint16_t Ru16[SIZE] __attribute__((aligned(128))); +static volatile uint8_t Ru8 [SIZE] __attribute__((aligned(128))); +static volatile int64_t Ri64[SIZE] __attribute__((aligned(128))); +static volatile int32_t Ri32[SIZE] __attribute__((aligned(128))); +static volatile int16_t Ri16[SIZE] __attribute__((aligned(128))); +static volatile int8_t Ri8 [SIZE] __attribute__((aligned(128))); +static volatile uint64_t Rf64[SIZE] __attribute__((aligned(128))); +static volatile uint32_t Rf32[SIZE] __attribute__((aligned(128))); +static volatile uint16_t Rf16[SIZE] __attribute__((aligned(128))); + +static volatile uint64_t Lu64[L_SIZE] __attribute__((aligned(128))); +static volatile uint32_t Lu32[L_SIZE] __attribute__((aligned(128))); +static volatile uint16_t Lu16[L_SIZE] __attribute__((aligned(128))); +static volatile uint8_t Lu8 [L_SIZE] __attribute__((aligned(128))); + +static volatile uint64_t Xf64[1] __attribute__((aligned(128))); +static volatile uint32_t Xf32[1] __attribute__((aligned(128))); +static volatile uint16_t Xf16[1] __attribute__((aligned(128))); + +#undef SIZE + +#endif // __DATASET__H__ diff --git a/apps/riscv-tests/isa/macros/vector/float_conversion.h b/apps/riscv-tests/isa/macros/vector/float_conversion.h new file mode 100644 index 0000000..d0f5586 --- /dev/null +++ b/apps/riscv-tests/isa/macros/vector/float_conversion.h @@ -0,0 +1,133 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante + +typedef union { + uint64_t i; + uint16_t h; + float f; + double d; +} v_fconv; + +static inline v_fconv _i(uint64_t i) { + v_fconv r; + r.i = i; + return r; +} + +static inline v_fconv _h(float f) { + /*Copyright (c) 2005-2021, NumPy Developers. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the NumPy Developers nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ + + // Source: https://github.com/numpy/numpy/blob/master/numpy/core/src/npymath/halffloat.c + + v_fconv r; + r.f = f; + + uint32_t f_exp, f_sig; + uint16_t h_sgn, h_exp, h_sig; + + h_sgn = (uint16_t) ((r.i&0x80000000u) >> 16); + f_exp = (r.i&0x7f800000u); + + /* Exponent overflow/NaN converts to signed inf/NaN */ + if (f_exp >= 0x47800000u) { + if (f_exp == 0x7f800000u) { + /* Inf or NaN */ + f_sig = (r.i&0x007fffffu); + if (f_sig != 0) { + /* NaN - propagate the flag in the significand... */ + uint16_t ret = (uint16_t) (0x7c00u + (f_sig >> 13)); + /* ...but make sure it stays a NaN */ + if (ret == 0x7c00u) { + ret++; + } + r.i = (uint16_t) h_sgn + ret; + return r; + } else { + /* signed inf */ + r.i = (uint16_t) (h_sgn + 0x7c00u); + return r; + } + } else { + r.i = (uint16_t) (h_sgn + 0x7c00u); + return r; + } + } + + /* Exponent underflow converts to a subnormal half or signed zero */ + if (f_exp <= 0x38000000u) { + /* + * Signed zeros, subnormal floats, and floats with small + * exponents all convert to signed zero half-floats. + */ + if (f_exp < 0x33000000u) { + r.i = h_sgn; + return r; + } + /* Make the subnormal significand */ + f_exp >>= 23; + f_sig = (0x00800000u + (r.i&0x007fffffu)); + f_sig >>= (113 - f_exp); + f_sig += 0x00001000u; + h_sig = (uint16_t) (f_sig >> 13); + /* + * If the rounding causes a bit to spill into h_exp, it will + * increment h_exp from zero to one and h_sig will be zero. + * This is the correct result. + */ + r.i = (uint16_t) (h_sgn + h_sig); + return r; + } + + /* Regular case with no overflow or underflow */ + h_exp = (uint16_t) ((f_exp - 0x38000000u) >> 13); + /* Handle rounding by adding 1 to the bit beyond half precision */ + f_sig = (r.i&0x007fffffu); + f_sig += 0x00001000u; + h_sig = (uint16_t) (f_sig >> 13); + r.i = (uint16_t) h_sgn + h_exp + h_sig; + return r; +} + +static inline v_fconv _f(float f) { + v_fconv r; + r.f = f; + return r; +} + +static inline v_fconv _d(double d) { + v_fconv r; + r.d = d; + return r; +} diff --git a/apps/riscv-tests/isa/macros/vector/float_macros.h b/apps/riscv-tests/isa/macros/vector/float_macros.h new file mode 100644 index 0000000..ceb6df6 --- /dev/null +++ b/apps/riscv-tests/isa/macros/vector/float_macros.h @@ -0,0 +1,159 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Matteo Perotti + +#ifndef __FLOAT_MACROS_H__ +#define __FLOAT_MACROS_H__ + +#include + +// Zero encoding is common to all the formats +#define pZero 0x0 + +// 16-bit IEEE 754 floats +#define qNaNh 0x7e00 +#define sNaNh 0x7c01 +#define pInfh 0x7c00 +#define mInfh 0xfc00 +#define pMaxh 0x7bff +#define mMaxh 0xfbff +#define mZeroh 0x8000 + +// 32-bit IEEE 754 floats +#define qNaNf 0x7fc00000 +#define sNaNf 0x7f800001 +#define pInff 0x7f800000 +#define mInff 0xff800000 +#define pMaxf 0x7f7fffff +#define mMaxf 0xff7fffff +#define mZerof 0x80000000 + +// 64-bit IEEE 754 floats +#define qNaNd 0x7ff8000000000000 +#define sNaNd 0x7ff0000000000001 +#define pInfd 0x7ff0000000000000 +#define mInfd 0xfff0000000000000 +#define pMaxd 0x7fefffffffffffff +#define mMaxd 0xffefffffffffffff +#define mZerod 0x8000000000000000 + +// Fflags +#define NV 0b10000 // Invalid Operation (e.g. Inf - Inf, or 0/0) +#define DZ 0b01000 // Divide by Zero (e.g. x/0, x != 0) +#define OF 0b00100 // Overflow (e.g. pMaxf + pMaxf) +#define UF 0b00010 // Underflow (e.g. pMinf/3) +#define NX 0b00001 // Inexact (e.g. 2/3) + +// MSTATUS.FS helpers +#define MSTATUS_FS_MASK 0x6000 +#define MSTATUS_FS_INIT 0x2000 +#define MSTATUS_FS_CLEAN 0x4000 +#define MSTATUS_FS_DIRTY 0x6000 + +// Rounding Mode in fcsr +#define RM_RNE 0x0 +#define RM_RTZ 0x1 +#define RM_RDN 0x2 +#define RM_RUP 0x3 +#define RM_RMM 0x4 + +// vfclass output +#define CLASS_mInf 0x001 +#define CLASS_mNorm 0x002 +#define CLASS_mSub 0x004 +#define CLASS_mZero 0x008 +#define CLASS_pZero 0x010 +#define CLASS_pSub 0x020 +#define CLASS_pNorm 0x040 +#define CLASS_pInf 0x080 +#define CLASS_sNAN 0x100 +#define CLASS_qNAN 0x200 + +typedef union double_hex { + double d; + uint64_t ui64; +} double_hex; + +// Check fcsr.fflags against an expected FFLAGS value +#define CHECK_FFLAGS(FFLAGS) \ + do { \ + uint64_t gold_ff = FFLAGS; \ + uint64_t ff; \ + asm volatile ("frflags %0" : "=r" (ff)); \ + if (ff != gold_ff) { \ + printf("fflags check FAILED. Current fflags is 0x%02lx, while expecting 0x%02lx.\n", ff, gold_ff); \ + num_failed++; \ + return; \ + } \ + } while(0) + +// Change rounding-mode +#define CHANGE_RM(NEW_RM) \ + do { \ + asm volatile ("fsrm %0" :: "r" (NEW_RM)); \ + } while(0) + +// Check fcsr.fflags against an expected FFLAGS value +#define CLEAR_FFLAGS asm volatile ("fsflags %0" :: "r" (0)) + +// !!!!! mstatus is not accessible in user-mode !!!!! +// Make mstatus.FS Clean +#define CLEAR_FS \ + do { \ + uint64_t old_mstatus; \ + uint64_t new_mstatus; \ + asm volatile ("csrrs %0, mstatus, x0" : "=r" (old_mstatus)); \ + new_mstatus = old_mstatus & ~((uint64_t) MSTATUS_FS_MASK); \ + new_mstatus |= MSTATUS_FS_CLEAN; \ + asm volatile ("csrrw x0, mstatus, %0" :: "r" (new_mstatus)); \ + } while(0) +// Check if mstatus.FS is Clean +#define CHECK_FS_CLEAN \ + do { \ + uint64_t fs; \ + asm volatile ("csrrs %0, mstatus, x0" : "=r" (fs)); \ + if ((fs & MSTATUS_FS_MASK) != MSTATUS_FS_CLEAN) { \ + printf("mstatus.FS check FAILED. Current mstatus.FS is 0x%02x, while expecting 0x%02x (Clean).\n", fs & MSTATUS_FS_MASK, MSTATUS_FS_CLEAN); \ + num_failed++; \ + return; \ + } \ + } while(0) +// Check if mstatus.FS is Dirty +#define CHECK_FS_DIRTY \ + do { \ + uint64_t fs; \ + asm volatile ("csrrs %0, mstatus, x0" : "=r" (fs)); \ + if ((fs & MSTATUS_FS_MASK) != MSTATUS_FS_DIRTY) { \ + printf("mstatus.FS check FAILED. Current mstatus.FS is 0x%02x, while expecting 0x%02x (Dirty).\n", fs & MSTATUS_FS_MASK, MSTATUS_FS_DIRTY); \ + num_failed++; \ + return; \ + } \ + } while(0) + +// NaN-Box a 16-bit IEEE 754 half float in a 64-bit double +// This is useful if we want to specify the IEEE 754 encoding of a floating-point variable +#define BOX_HALF_IN_DOUBLE(VAR_NAME, VAL_16B) \ + do { \ + double_hex nan_boxed_val; \ + nan_boxed_val.ui64 = ((uint64_t) 0xffffffffffff << 16) | VAL_16B; \ + VAR_NAME = nan_boxed_val.d; \ + } while(0) + +#define BOX_FLOAT_IN_DOUBLE(VAR_NAME, VAL_32B) \ + do { \ + double_hex nan_boxed_val; \ + nan_boxed_val.ui64 = ((uint64_t) 0xffffffff << 32) | VAL_32B; \ + VAR_NAME = nan_boxed_val.d; \ + } while(0) + +#define BOX_DOUBLE_IN_DOUBLE(VAR_NAME, VAL_64B) \ + do { \ + double_hex nan_boxed_val; \ + nan_boxed_val.ui64 = VAL_64B; \ + VAR_NAME = nan_boxed_val.d; \ + } while(0) + +#endif // __FLOAT_MACROS_H__ diff --git a/apps/riscv-tests/isa/macros/vector/long_array.h b/apps/riscv-tests/isa/macros/vector/long_array.h new file mode 100644 index 0000000..fb76918 --- /dev/null +++ b/apps/riscv-tests/isa/macros/vector/long_array.h @@ -0,0 +1,722 @@ +#include "vector_macros.h" +#define AXI_DWIDTH 128 +static volatile uint8_t LONG_I8[1024] __attribute__((aligned(AXI_DWIDTH))) = { + 0x2a, 0xbb, 0x34, 0xad, 0x40, 0x13, 0x8e, 0xf1, 0xf8, 0xe3, 0xac, 0x97, + 0x2b, 0xb2, 0x16, 0x44, 0x78, 0x75, 0x1a, 0xc7, 0x48, 0x84, 0x67, 0xce, + 0x8b, 0x6f, 0x0b, 0xcc, 0xb6, 0x3f, 0x8d, 0x81, 0x6f, 0xde, 0x87, 0xb9, + 0x82, 0x67, 0x3c, 0xff, 0x71, 0xce, 0x25, 0xbd, 0x74, 0x86, 0x8f, 0x4e, + 0xb1, 0x77, 0xf6, 0x82, 0x2f, 0x34, 0xcf, 0x13, 0xec, 0xba, 0x38, 0x11, + 0xba, 0x67, 0xe9, 0xe6, 0x62, 0x74, 0xb1, 0x92, 0x9f, 0x30, 0xc7, 0x95, + 0x4a, 0xd7, 0x33, 0x38, 0x21, 0xd4, 0xb6, 0xb8, 0xfa, 0xfa, 0xc5, 0x2a, + 0xfd, 0x97, 0x69, 0x3c, 0x4b, 0x64, 0x0d, 0x1d, 0x5f, 0x0d, 0x12, 0xb9, + 0x9a, 0x6c, 0xfb, 0x1e, 0xcc, 0x25, 0x2f, 0xe6, 0x1e, 0x2, 0x1d, 0x2, + 0x2d, 0x8b, 0x32, 0x5d, 0x1d, 0x2b, 0xe5, 0x1e, 0x1c, 0x64, 0x5f, 0xb6, + 0xcd, 0x4, 0x2e, 0xe2, 0x6d, 0x3d, 0xb4, 0xc5, 0xae, 0x9, 0x6b, 0xaf, + 0x74, 0x60, 0xba, 0x7a, 0x8b, 0x79, 0xa0, 0xd0, 0xef, 0x21, 0xce, 0xeb, + 0xa6, 0xb2, 0xb8, 0x6b, 0xf9, 0x71, 0xea, 0x85, 0xc1, 0xb9, 0xa3, 0x7c, + 0xf1, 0x6c, 0x8c, 0x4f, 0xb6, 0x81, 0x96, 0xf8, 0xe7, 0xc7, 0xfa, 0x71, + 0x2e, 0x9c, 0x65, 0xe6, 0x83, 0xfc, 0xa9, 0xaf, 0x45, 0x20, 0x17, 0x4f, + 0xc6, 0xba, 0x5a, 0x0e, 0xb9, 0xc6, 0x2d, 0xdc, 0xb8, 0x82, 0x5c, 0x8a, + 0xca, 0x13, 0x8f, 0xc3, 0xad, 0xd9, 0xd9, 0x22, 0x79, 0x34, 0x32, 0xa7, + 0x81, 0xf1, 0x4d, 0x83, 0x0d, 0x27, 0xaa, 0xbf, 0xdc, 0x86, 0x7f, 0x24, + 0x73, 0x1e, 0x1a, 0xdb, 0x19, 0x8f, 0x16, 0x5a, 0x3b, 0xdc, 0x8f, 0x1b, + 0x9f, 0x38, 0xa7, 0x31, 0x23, 0xc7, 0x29, 0xfe, 0x9b, 0xb9, 0x58, 0x42, + 0x94, 0xdb, 0x2c, 0x34, 0x9e, 0x6d, 0x42, 0x46, 0xde, 0x60, 0x22, 0xdb, + 0x9c, 0x2f, 0x0, 0xc8, 0x1e, 0x97, 0xf4, 0xb8, 0x18, 0xd4, 0xd8, 0x67, + 0x15, 0x3f, 0x29, 0x8f, 0x4f, 0xe1, 0x77, 0x23, 0xc1, 0xdc, 0x2e, 0x73, + 0xcb, 0xdf, 0xf5, 0xc0, 0x19, 0x32, 0xb7, 0xbf, 0x70, 0xf9, 0xe8, 0xe3, + 0xf5, 0x2c, 0x31, 0x98, 0x64, 0x5, 0x0b, 0x3e, 0xcd, 0x5f, 0xb6, 0x51, + 0x8d, 0x5d, 0xbc, 0x5b, 0x87, 0xfe, 0xb3, 0x89, 0xd4, 0x9d, 0x9, 0x10, + 0xb7, 0x62, 0x79, 0x82, 0xb9, 0x30, 0xa9, 0x43, 0xaa, 0x0d, 0xfc, 0xef, + 0xd7, 0xec, 0xaa, 0x46, 0x14, 0xd3, 0xa8, 0x22, 0x91, 0xb8, 0xde, 0x6c, + 0xfc, 0x6a, 0x2b, 0xc4, 0x96, 0x11, 0x47, 0x4b, 0xdf, 0x9d, 0xfb, 0xda, + 0xc1, 0xfa, 0x4b, 0x48, 0x69, 0x5b, 0x9a, 0x6b, 0xf4, 0x33, 0xaf, 0xfd, + 0x61, 0x7, 0x8b, 0x59, 0x6c, 0xc0, 0x9e, 0xc9, 0xa1, 0x0, 0x58, 0x5f, + 0xa2, 0x69, 0x9c, 0x35, 0x19, 0x0e, 0x54, 0x5a, 0xba, 0x23, 0x1b, 0x0, + 0xa8, 0x58, 0xac, 0xd1, 0x5f, 0x85, 0xc3, 0x0b, 0x9d, 0xe9, 0x22, 0x17, + 0x62, 0xf0, 0x4, 0xb3, 0xa8, 0x89, 0xf0, 0x68, 0x69, 0xff, 0x2f, 0x99, + 0x0d, 0xdb, 0x8e, 0x12, 0xea, 0x2f, 0x5a, 0xd2, 0xfd, 0xe6, 0x7d, 0x97, + 0xcd, 0xe0, 0xa8, 0xd9, 0xcf, 0xc7, 0x1e, 0x5e, 0x73, 0x5, 0x5c, 0x15, + 0xc7, 0x99, 0x6e, 0x51, 0x81, 0x55, 0x49, 0x95, 0xcf, 0xdf, 0x80, 0x4e, + 0xb1, 0x34, 0x81, 0x91, 0x7f, 0xa2, 0x13, 0xf3, 0xc0, 0xa4, 0x2, 0x81, + 0xd8, 0xde, 0xd1, 0xbf, 0xc1, 0xb9, 0x0f, 0x6d, 0x5b, 0x3b, 0xf3, 0xfe, + 0xc6, 0xca, 0x48, 0xad, 0xcb, 0x39, 0xea, 0x12, 0x4e, 0x70, 0x5b, 0x24, + 0x2e, 0x36, 0xb2, 0xf2, 0x9c, 0x7e, 0xf6, 0x0b, 0x5e, 0xb3, 0x26, 0x77, + 0x96, 0xa9, 0x1, 0x48, 0x23, 0x11, 0x9c, 0xc4, 0x36, 0x37, 0x5b, 0xd8, + 0xfb, 0xeb, 0x9a, 0x99, 0xf2, 0xb6, 0xe1, 0xbe, 0x1, 0x9a, 0x7c, 0x58, + 0x33, 0xa2, 0x79, 0x42, 0x13, 0x5, 0xfe, 0x87, 0x9d, 0xa3, 0x27, 0x76, + 0xda, 0x11, 0xe4, 0x78, 0x7, 0x79, 0x6e, 0x0, 0x8b, 0xf6, 0xc0, 0x72, + 0x2c, 0x28, 0x33, 0xa0, 0xa1, 0x37, 0xda, 0x36, 0xad, 0xa3, 0xe4, 0x91, + 0x68, 0x79, 0x6c, 0xf9, 0xe5, 0x31, 0xea, 0x3c, 0xda, 0x9, 0x15, 0xa6, + 0xef, 0x4a, 0x22, 0xdc, 0x73, 0xa8, 0xbd, 0x4a, 0x50, 0x66, 0x5b, 0xb6, + 0x9a, 0xc6, 0xa6, 0xc4, 0x7c, 0xc8, 0x4c, 0x5f, 0xbc, 0x95, 0xfc, 0x10, + 0x37, 0x84, 0x76, 0x4d, 0xfd, 0x52, 0xff, 0x0f, 0x98, 0x20, 0xa4, 0xb2, + 0xc8, 0x45, 0xc4, 0x56, 0xbf, 0x2, 0x5f, 0x6, 0xc9, 0x6b, 0xb3, 0x5a, + 0xe4, 0x4d, 0x6e, 0x53, 0x24, 0x40, 0x7b, 0x3b, 0x57, 0x1d, 0x71, 0x49, + 0x71, 0xaf, 0x68, 0x7e, 0xe1, 0xa8, 0xea, 0xaf, 0xde, 0x8a, 0xa7, 0xdf, + 0x16, 0xe3, 0xab, 0x7b, 0x1d, 0x7c, 0x35, 0xc8, 0x79, 0xa6, 0x1b, 0x87, + 0xee, 0xd5, 0x19, 0x9c, 0x73, 0x3, 0x8, 0xd3, 0xc0, 0xb6, 0xee, 0x29, + 0x86, 0xdf, 0x57, 0x66, 0x18, 0xcf, 0x5d, 0x5d, 0xb7, 0x22, 0x62, 0x9e, + 0x9f, 0x32, 0xa6, 0xdd, 0x66, 0x25, 0x6, 0x37, 0x85, 0x4a, 0x9, 0xf0, + 0xf7, 0x94, 0xcd, 0xa9, 0x9e, 0xa6, 0x14, 0x44, 0xbf, 0x87, 0xa2, 0x9c, + 0xf4, 0x55, 0x67, 0x27, 0x49, 0x48, 0x69, 0xc4, 0x16, 0xa5, 0x84, 0x95, + 0x37, 0x44, 0xb3, 0xb1, 0x89, 0x8e, 0x58, 0xea, 0x17, 0x19, 0x6d, 0xbd, + 0x87, 0xee, 0x7, 0x58, 0x65, 0xbc, 0x42, 0x18, 0x37, 0xf7, 0xa8, 0x7a, + 0x4b, 0xc1, 0xce, 0x49, 0xb3, 0x6c, 0x4a, 0x77, 0x19, 0x70, 0x11, 0x60, + 0x92, 0xd6, 0x6a, 0x6f, 0x41, 0x51, 0x23, 0x61, 0x5b, 0x9f, 0xd3, 0x16, + 0xd7, 0xdd, 0x34, 0x80, 0xb0, 0x3f, 0x48, 0x54, 0x1b, 0x98, 0x8d, 0x76, + 0x51, 0x99, 0x4a, 0x9, 0xfb, 0xd0, 0xd9, 0x85, 0x18, 0xc5, 0xb2, 0x37, + 0x24, 0x1a, 0xf6, 0x41, 0x42, 0x1f, 0x1f, 0x31, 0x61, 0x4f, 0x11, 0xb2, + 0xe2, 0x5e, 0x65, 0x88, 0x2e, 0xfb, 0xa2, 0x90, 0x1c, 0x1b, 0x59, 0xe3, + 0x35, 0xcf, 0x97, 0xe3, 0xe2, 0x43, 0xa9, 0x7c, 0x14, 0xb4, 0x0d, 0x2c, + 0x41, 0x90, 0x8d, 0x13, 0x0a, 0xd2, 0xd1, 0x3, 0x37, 0x24, 0x19, 0x57, + 0xb0, 0xc8, 0x0b, 0xdf, 0xb3, 0xd3, 0x3a, 0x14, 0x23, 0x5c, 0xee, 0x62, + 0x18, 0x6, 0x4e, 0x36, 0x44, 0xdc, 0xcd, 0xbb, 0xf8, 0x69, 0x61, 0x52, + 0x95, 0xea, 0x33, 0x68, 0x4f, 0xae, 0xce, 0x6f, 0xf1, 0x6d, 0x31, 0x3b, + 0xab, 0x25, 0x28, 0x31, 0x6, 0xe4, 0xa7, 0x12, 0xab, 0xfb, 0x3f, 0x7, + 0xff, 0xb6, 0x8f, 0xa2, 0xae, 0x20, 0x34, 0x47, 0xba, 0xa3, 0x93, 0x8c, + 0xcc, 0xad, 0x35, 0x9a, 0x72, 0xea, 0x40, 0x20, 0x25, 0x6b, 0x81, 0x0d, + 0xc3, 0x1, 0xd7, 0x74, 0x3e, 0xc4, 0xca, 0xef, 0x81, 0x31, 0x0f, 0x5d, + 0xf9, 0x2f, 0x4a, 0x43, 0x4c, 0x35, 0x19, 0x2e, 0x7b, 0x48, 0x71, 0x13, + 0x79, 0x69, 0x49, 0x21, 0x4, 0x52, 0x4d, 0x2a, 0xf0, 0xa6, 0xb6, 0x3d, + 0xd7, 0x0e, 0x2c, 0xb9, 0xff, 0xb2, 0x9d, 0x96, 0x19, 0xdb, 0x10, 0xbe, + 0x78, 0x1e, 0x4d, 0x5f, 0x28, 0x3b, 0x61, 0xcb, 0x76, 0x3, 0xc5, 0xdb, + 0x87, 0x72, 0x45, 0x4d, 0x82, 0x98, 0x7f, 0xea, 0xd6, 0x43, 0xeb, 0x5a, + 0xa3, 0x3b, 0xb1, 0x92, 0x89, 0x30, 0xf8, 0xeb, 0x72, 0xcf, 0x54, 0xe5, + 0xe1, 0x5c, 0x0d, 0xf5, 0xee, 0xe8, 0x92, 0xca, 0x58, 0x98, 0x0f, 0x36, + 0xe9, 0xe0, 0x5e, 0x2, 0x5f, 0x47, 0xe6, 0x13, 0xee, 0x8, 0xe4, 0x49, + 0x6b, 0x9e, 0x34, 0xb0, 0xe8, 0x85, 0xaa, 0x4a, 0xf6, 0xf8, 0x42, 0xda, + 0xaf, 0x3d, 0xf0, 0x97}; + +static volatile uint16_t LONG_I16[1024] __attribute__((aligned(AXI_DWIDTH))) = { + 0x05c8, 0x60a1, 0xc277, 0x3862, 0x38a5, 0x657b, 0xa9bc, 0x766a, 0x4787, + 0xf49d, 0xdb62, 0x3226, 0x9ced, 0xbcfb, 0x82f5, 0x38c5, 0x5cdf, 0xcecd, + 0xa58c, 0xfa68, 0xb3ab, 0x20d8, 0x2f42, 0x939e, 0x770a, 0x1295, 0x06fa, + 0xdd27, 0x040a, 0x1a0d, 0x082e, 0xa62b, 0xb056, 0x9f3a, 0x0e05, 0x5262, + 0x53d6, 0x99ab, 0xd888, 0xdeff, 0x9d33, 0xddd3, 0xf914, 0x59bd, 0xdd8b, + 0xf028, 0x68eb, 0x5e2a, 0x69ba, 0xa24e, 0x642a, 0x1360, 0x4784, 0x6b2b, + 0xfc7b, 0x83c7, 0x805e, 0x5665, 0xf4e9, 0xc83b, 0x3a49, 0x3f3b, 0x365e, + 0xb648, 0xa6b1, 0x84f7, 0xb227, 0xca26, 0xa732, 0xfc36, 0x033d, 0xb446, + 0xaca1, 0x1f47, 0x3f55, 0x49d7, 0xaf46, 0x8f42, 0xd634, 0x3227, 0x7b79, + 0x73bb, 0x9e94, 0x9849, 0x3729, 0xe01c, 0x6240, 0x4138, 0x093b, 0x9949, + 0xe94d, 0x01b4, 0x19fd, 0xdb17, 0xcc54, 0x498d, 0xd9bf, 0xe16b, 0x943b, + 0xa4e5, 0xd2fe, 0x891d, 0xda14, 0x5ed8, 0x7d02, 0xddb1, 0xefe5, 0x99b7, + 0x659e, 0xfae9, 0x5887, 0xde77, 0x136f, 0x88f3, 0x0554, 0xe77d, 0x912e, + 0x3c8b, 0x6e5f, 0x86ec, 0xc847, 0x2820, 0x5086, 0x448d, 0xbd06, 0x3817, + 0xedbe, 0xb229, 0xddcc, 0xa9ce, 0x8245, 0xb06e, 0x1fb1, 0xeaf7, 0x61de, + 0x115f, 0x1b58, 0x6f16, 0xc513, 0x5f9f, 0x9c08, 0x1173, 0x699f, 0xc00e, + 0xe8d5, 0x0ed4, 0x6023, 0xf121, 0xb07c, 0xb0a9, 0x3f1c, 0x474d, 0xbaa6, + 0x0d09, 0xddd4, 0xf5de, 0x3573, 0x69f2, 0x1790, 0xfd70, 0x7b2a, 0x8ae4, + 0xfe06, 0x9066, 0x82be, 0xf0d3, 0x1fa6, 0x38a3, 0x0bb3, 0x172c, 0x183b, + 0x52e7, 0x77d3, 0xf4ab, 0x1978, 0x1797, 0x4be4, 0xf98b, 0x89bd, 0x3e7d, + 0x6cba, 0xb0bb, 0x19a4, 0x482c, 0xaa90, 0xf235, 0x25eb, 0x12bf, 0xf2ad, + 0x84bd, 0x9ad8, 0x754b, 0x4e17, 0xf79d, 0xb67f, 0x127e, 0xe511, 0x4132, + 0xeda7, 0x3f08, 0xefef, 0x5b00, 0x1910, 0x678f, 0x8d26, 0x5ae2, 0xdec6, + 0x8ca5, 0x6756, 0x22c9, 0x2ad8, 0x85cf, 0xbd84, 0x050d, 0xf66b, 0xfa3f, + 0x4c23, 0x2768, 0xef35, 0x7248, 0x0db2, 0x7240, 0xa41c, 0x789b, 0x0edc, + 0x48fe, 0x40ff, 0x8435, 0x7ee8, 0x879a, 0x5245, 0x71aa, 0xbffb, 0xdf45, + 0xe361, 0xb234, 0x465c, 0x60af, 0x07b8, 0xf4af, 0xa785, 0x66c2, 0x13db, + 0x6928, 0xdf53, 0x30d0, 0xccf3, 0xc725, 0x38f6, 0xcd92, 0x3bc9, 0xbc2e, + 0xcd73, 0x2824, 0x53ca, 0xd979, 0x4b6d, 0xd79d, 0x4123, 0xdd8a, 0x7dfd, + 0xd802, 0x7718, 0x6e91, 0x6588, 0x45cf, 0x6f4e, 0xa431, 0x4296, 0xeafe, + 0x7319, 0x624b, 0x25fb, 0x31d2, 0x54e1, 0xe0d1, 0x767c, 0xf0f9, 0xdb9d, + 0x2611, 0xb352, 0xe521, 0x091a, 0x4b82, 0xe5fe, 0xafac, 0x6f8c, 0x8e66, + 0x07f2, 0x0a8f, 0x524e, 0x08e3, 0xb3ef, 0x6667, 0x80ed, 0x31a0, 0x4bc2, + 0xfc29, 0xf5d8, 0xc00e, 0x620d, 0xab89, 0x2d1c, 0xd922, 0x8a1d, 0x4758, + 0x843e, 0x5677, 0x69b9, 0xfd68, 0xc044, 0xe042, 0x12fb, 0x734f, 0xa9c1, + 0x3101, 0xc1ce, 0xe411, 0x2739, 0xbed5, 0x571c, 0xa03c, 0x67c5, 0xf559, + 0x8d02, 0x4c56, 0x7d2d, 0x0797, 0x64ba, 0x5f95, 0x3653, 0x9bc4, 0x2d2e, + 0x38bf, 0x75c2, 0x6db6, 0x3fcc, 0x7016, 0x146c, 0x094f, 0x1cee, 0xade1, + 0x71e2, 0x1311, 0x9606, 0x5899, 0x0f77, 0x0de0, 0x39d7, 0xa028, 0xd2c4, + 0x3f12, 0xf60a, 0x4a12, 0xcee6, 0x7778, 0xc1ba, 0xa2d6, 0x8d53, 0x0c25, + 0xf6c0, 0x4f9d, 0x5c20, 0xe006, 0x8d42, 0x1e30, 0x8cc9, 0xe335, 0x0c4a, + 0xc6b0, 0x6526, 0x7da6, 0xfcdc, 0x24e9, 0xecb4, 0xf36e, 0x5fc6, 0xe811, + 0x498d, 0xd99c, 0xb3a4, 0xd1c6, 0x0029, 0x4976, 0x7108, 0xf4bc, 0x60c1, + 0x86d7, 0x33e2, 0x1950, 0xaead, 0xb892, 0xa3b3, 0x7850, 0x19e8, 0x5e30, + 0xaaab, 0xe18e, 0x1652, 0x8db1, 0xd6dd, 0x1c3f, 0xe906, 0xf2e1, 0x60e5, + 0x1ce0, 0xfd1a, 0xf74a, 0xabd8, 0x9885, 0x18ef, 0xe64a, 0xe791, 0xc42d, + 0x8010, 0x1f34, 0xfa91, 0x36e3, 0x7ca3, 0xfb85, 0xb8a9, 0x6bd4, 0x8985, + 0x86af, 0x247c, 0x25f0, 0x56a9, 0x87ab, 0x54e0, 0x75af, 0xd782, 0x886d, + 0xfe3f, 0x9f68, 0x5357, 0x7f4e, 0x92f6, 0x4266, 0x5176, 0xd657, 0xc6a7, + 0x9738, 0x2f4c, 0xb40b, 0xe857, 0x12a3, 0xf4b1, 0x0ab4, 0x9eeb, 0xed88, + 0x8df4, 0x30c1, 0xf904, 0x5d83, 0xbbea, 0x5858, 0x1230, 0x99c7, 0x603e, + 0xf8f9, 0x88ec, 0x29d1, 0x415b, 0xac9a, 0x8cc1, 0xbaf8, 0xd11f, 0x569c, + 0x6e4f, 0x78a9, 0x14e9, 0xde4f, 0x76aa, 0x7e97, 0x9e43, 0x0df2, 0x3157, + 0x5df4, 0x335e, 0x0a7a, 0xe7c3, 0x4631, 0xc2be, 0x8e78, 0xd26e, 0x40a9, + 0x00d3, 0xd0cb, 0xba96, 0x8414, 0x150f, 0x845d, 0x37ff, 0x2465, 0x3d72, + 0xb6ca, 0xa623, 0xb525, 0x1466, 0x98f0, 0x30ae, 0x9a66, 0x9978, 0x3ff7, + 0xdd7b, 0x5d83, 0x287b, 0xbcac, 0x708b, 0x9f85, 0x6ba7, 0x4b45, 0x6ff9, + 0xb18d, 0xd137, 0xf108, 0x371d, 0x78cc, 0x16ee, 0xc10e, 0xea24, 0x56dd, + 0xda45, 0xc8d1, 0xa2ac, 0x1430, 0x8804, 0xca53, 0x9b14, 0x128a, 0x106f, + 0x1e8f, 0xd25c, 0x74c1, 0x4ceb, 0xca33, 0x2dfa, 0x53a7, 0x668a, 0x2338, + 0xd0bd, 0x5ba0, 0x796c, 0xbe89, 0x2737, 0x7eae, 0x47f5, 0x5675, 0x165c, + 0x546b, 0x3682, 0x1b3e, 0x04e8, 0x13d1, 0xa73b, 0x1b9d, 0xe520, 0xe89b, + 0xcc4b, 0xc6d0, 0xe5d0, 0x15f8, 0x2d3d, 0x6fa0, 0x4a1d, 0x86ec, 0xb10d, + 0x6766, 0xef18, 0x7664, 0xfdf0, 0xefb7, 0x1301, 0x5972, 0xde95, 0x7763, + 0x7359, 0x86ed, 0x937d, 0x62c6, 0x3fe6, 0x15a8, 0x2cf4, 0x67c1, 0x8b1c, + 0xfac9, 0x38cb, 0xd1f7, 0x6777, 0x57fc, 0xa8d9, 0x734f, 0x9f44, 0x7e06, + 0x94de, 0xfbcd, 0x1f2e, 0x9de5, 0xba7b, 0xaae4, 0x597c, 0xc908, 0x991c, + 0x5ba1, 0x56a7, 0x3935, 0xa728, 0x3883, 0xfce5, 0x32cc, 0x9afe, 0x0ef8, + 0x18c0, 0xcb6c, 0xe4d7, 0x7184, 0xecab, 0x3c14, 0x802d, 0xfe5b, 0x2581, + 0x40e4, 0xa4ef, 0xcb8e, 0x53a6, 0xc27b, 0xc604, 0xe5f8, 0x6c63, 0x1400, + 0xf529, 0x0303, 0x8a5d, 0xf26b, 0xfa14, 0x7f48, 0x852f, 0x4b93, 0xd96b, + 0x10ea, 0x332e, 0x72b3, 0x84a6, 0x4cd2, 0xbd3d, 0x1649, 0x6edb, 0x85e1, + 0x4cbc, 0x1b3f, 0x2057, 0xe0b5, 0x0b23, 0x3b49, 0xa634, 0xf2a3, 0xbbdc, + 0xb528, 0x5102, 0x42e9, 0xaf96, 0x0e61, 0xc393, 0x0614, 0xd3f4, 0x1329, + 0xea3d, 0xbeeb, 0x1d4b, 0x082b, 0x0a49, 0x331a, 0xe8fc, 0x57d7, 0xc4e5, + 0x5500, 0x8bc1, 0xa259, 0x8d4d, 0x8d8c, 0xcf01, 0x3ef0, 0xd1da, 0xf7e5, + 0xc55c, 0x062c, 0xaa7d, 0x967a, 0xb694, 0xfab0, 0x279e, 0x3efe, 0xcecc, + 0xd074, 0xd240, 0xbaba, 0x59d5, 0x44e4, 0xc97e, 0xd88c, 0xb3c3, 0x8145, + 0x0312, 0x8f1c, 0xc165, 0x0ec3, 0xc773, 0x9b8c, 0x56c1, 0xf293, 0x3a87, + 0xb577, 0x5423, 0xea97, 0xf94e, 0x795c, 0x3480, 0x419c, 0xec6e, 0x3f14, + 0x6cda, 0x95c9, 0xb0a2, 0x0e27, 0xc572, 0xfc95, 0x2840, 0x30f1, 0x285d, + 0x4934, 0x5ccb, 0x5a71, 0xf4d5, 0x9448, 0xdf84, 0xb00d, 0x3e72, 0xbf8a, + 0x45d1, 0x7a94, 0xc9fa, 0xd41b, 0x279a, 0x0b74, 0xb8d7, 0x983b, 0x18ac, + 0xa78e, 0x3f83, 0x397a, 0xa9ba, 0x7e7a, 0x62bc, 0x461a, 0x16f1, 0xeb72, + 0xfde1, 0x9a3c, 0xb8f0, 0xa683, 0x6031, 0x82f0, 0xe01d, 0xe109, 0x71f4, + 0xd215, 0x8794, 0xf622, 0xc5ba, 0x40ca, 0x20dd, 0x1333, 0x30ef, 0x51d8, + 0x6627, 0x66d5, 0xad8e, 0xef11, 0xf93b, 0x68c7, 0xde9f, 0xa107, 0xf6b7, + 0x2080, 0x8e4a, 0x5570, 0x945c, 0x83b4, 0xa5b1, 0x925e, 0x7818, 0x7006, + 0xf0a1, 0x450a, 0xc7d0, 0xe348, 0xd405, 0x3a77, 0xd98b, 0xc755, 0x7ad5, + 0xb1bc, 0x7f59, 0x8d0b, 0x82e6, 0x9a52, 0x10dc, 0xc268, 0xafcc, 0x5f84, + 0x629d, 0x9bea, 0x2eb6, 0x466b, 0xd4b3, 0x1ba3, 0xcfd8, 0xc856, 0xb32a, + 0x9fa3, 0x6762, 0x61e2, 0xdcb2, 0xc67c, 0xd4cc, 0x93ec, 0xfc8e, 0xea59, + 0x5e42, 0x4d74, 0xf566, 0xe148, 0xd538, 0xeba6, 0xc946, 0x7f79, 0x73e8, + 0x0403, 0x1bad, 0xd856, 0xb382, 0x77e9, 0xf88e, 0xb004, 0xa080, 0x1c0e, + 0x7dce, 0xec47, 0x2aa5, 0x3218, 0xbb53, 0x673e, 0xe9cd, 0x92b0, 0x2452, + 0x9b83, 0x7721, 0x0c2c, 0x9c90, 0x4cc6, 0xb17e, 0x77a5, 0xf070, 0xf8a5, + 0x2edc, 0x1c5f, 0xc7d5, 0xad46, 0x933e, 0xe6b5, 0x6131, 0x0885, 0x511e, + 0xabc1, 0xb239, 0x8adf, 0x2cab, 0xb149, 0x5922, 0xd99f, 0x65a5, 0x153f, + 0x02a1, 0x11d9, 0xb82d, 0x8cd1, 0xb7e0, 0x78db, 0xd92d, 0x738a, 0x0a41, + 0x8e6f, 0x67f6, 0x49ff, 0x0a42, 0x4243, 0x02ee, 0xa1ec, 0x306a, 0xd86f, + 0x71bb, 0x7645, 0xa349, 0xcd18, 0x2f95, 0x147f, 0xee96, 0x6c36, 0x929f, + 0x1bbb, 0x0814, 0xe8f7, 0x7344, 0x8397, 0xf269, 0x64b3, 0x60f2, 0x6a51, + 0xd5bf, 0x4083, 0x439a, 0xd44e, 0xdca1, 0xaebd, 0x80cb, 0xe318, 0x67e8, + 0x9a3d, 0x1014, 0x0017, 0x6f99, 0x28b4, 0x062f, 0x56e9, 0x75fb, 0x664d, + 0xee67, 0x0aa0, 0xf38f, 0xab03, 0x0777, 0xc318, 0xd0a4, 0xb3c2, 0x566e, + 0xaf15, 0x7296, 0x4fca, 0x3431, 0x6536, 0x1a4c, 0x3423, 0x4d25, 0x9877, + 0x41a1, 0xb704, 0xdef9, 0xb22e, 0xcde0, 0x1def, 0x92d7, 0x0ce2, 0xf2c9, + 0x84bf, 0x6fcd, 0x76a8, 0xdbdf, 0x41a3, 0x9337, 0xc8a7, 0xaa42, 0xa21e, + 0x8844, 0xdf16, 0x4de9, 0x4584, 0x450a, 0x0ddc, 0x62ce, 0xf491, 0x8509, + 0xc94c, 0x454f, 0x23a6, 0x5985, 0xf00b, 0x3836, 0xe524, 0x4dc1, 0x873a, + 0x8b3f, 0xed5a, 0xc984, 0x3cf7, 0x854a, 0x7569, 0x3c93, 0xfc08, 0x3b0a, + 0x59cb, 0x0558, 0x47ce, 0xb8c4, 0x0e07, 0xf780, 0x8723, 0x48c0, 0xaf0a, + 0x9ba6, 0xc9ef, 0x55c4, 0x751e, 0x86ca, 0x15d7, 0x7868, 0xf984, 0x5ce6, + 0xb0e3, 0xfab4, 0xb4af, 0xf721, 0x55b9, 0x1c10, 0xddf1}; + +static volatile uint32_t LONG_I32[1024] __attribute__((aligned(AXI_DWIDTH))) = { + 0xfb4164e6, 0x3481e187, 0x1ac57c0e, 0xd3913cf7, 0x41059a17, 0xef7e75e1, + 0xfe210ff9, 0x7f6ac91e, 0x28e9650d, 0xb7885df2, 0x284b1afc, 0xfb4a1bf7, + 0x617d65d4, 0x896d8b4f, 0x9c9c9363, 0x3b43b452, 0xabb915d7, 0x8698d89d, + 0xd8a34f81, 0x863f4cca, 0x14d6ca22, 0xb0bf4e0a, 0xee1f91c4, 0x7c3a990f, + 0x6eab68bd, 0x299c17f2, 0xcadf4216, 0xb1f82b82, 0x67c9f67f, 0x7b690aae, + 0xa150c9d4, 0x15351675, 0x9cff4711, 0xe1817cb5, 0x2430a746, 0x03057f72, + 0x171d9928, 0x09d1c92b, 0xcc77e581, 0x95929376, 0xaeadce6f, 0x789d357e, + 0xfcbfc753, 0x01432b7b, 0x9e9478fa, 0xba2e81b9, 0x82b58cff, 0xd9f94cab, + 0x6cb2edf5, 0x77487076, 0x4d02002d, 0x4a86378e, 0x68504041, 0xff7d13ee, + 0x5ac9c780, 0x4c9ec46b, 0xd255423e, 0x490ad4be, 0x402e482e, 0x20a002bb, + 0x3047c1be, 0xb6d5251f, 0xd44b670e, 0x237e7f10, 0xfac60317, 0x032f62ee, + 0xbdeed490, 0x608ce228, 0x72c0007a, 0x2f649ab1, 0x648c3132, 0x29c2e261, + 0x0bea8083, 0xcd7b169d, 0xd8650fc5, 0x0e539628, 0x7a4dca9f, 0x1a83111f, + 0xb66efb6e, 0xb57e0806, 0x97429779, 0x3db5389e, 0x37eb587b, 0xed67e2b9, + 0xd83725bc, 0xfa08dddf, 0xeda1f1d0, 0x300cb2c4, 0x40621713, 0x40bad650, + 0x76774234, 0xdabcac54, 0xc3a8998e, 0x5679012d, 0xdfbf840c, 0x7fb19cef, + 0x421cf0af, 0x205127bb, 0x7583bafe, 0xb841a0ad, 0x94c27ef1, 0x98ce86fa, + 0x63a94985, 0x3be3aa2e, 0x15172f37, 0x2cd44ef0, 0x9965f864, 0x445089c7, + 0x75bc26df, 0xf6eefe92, 0xf34c4396, 0x329bbaee, 0x4c8a5ce9, 0x88da6dad, + 0xfd153397, 0x877c5b1a, 0x21cf83c2, 0x28eadf4c, 0x79e4ea97, 0x406520ac, + 0x7ace596d, 0x97af1221, 0x1231fc0b, 0x25ed7519, 0x747b6cd8, 0x3a8f07e7, + 0x2eceda51, 0x444e9a77, 0x602cd53d, 0x4dd07c56, 0x526cf01c, 0xc20a4814, + 0xb957f851, 0xa17f5997, 0xb1301c23, 0x127449d7, 0x2019ff30, 0xcf4ae57a, + 0x9d469972, 0xa79ee397, 0x46ad27c1, 0xc102cfab, 0x9839df44, 0xbe15ac43, + 0x52429a74, 0x8498333c, 0x0323bb3b, 0x34759b37, 0x786294cf, 0xbd5b638e, + 0x3ee76252, 0x29aa55cc, 0xf838fe3f, 0x3ebbcb2a, 0x8211b294, 0xd022967b, + 0x4021661b, 0x567ce0c8, 0xe89c3fd8, 0x12a755b3, 0xb662102a, 0x5df38d95, + 0x62d37025, 0x28966663, 0xb7a26439, 0x7aaf36db, 0xd78b2521, 0x70529f47, + 0x685f3890, 0x9d8d013e, 0xcbe3ff49, 0xd46afdb6, 0xc2b04898, 0x559bf4f7, + 0xd7c8eed2, 0x2715286a, 0x725c1503, 0x680e0b70, 0xbf041ae9, 0xd254a94d, + 0x24781161, 0xd84f4a94, 0x079846af, 0x09b1493c, 0xa73bf5c1, 0xbfb15a17, + 0x037d4fb8, 0x67a8f910, 0xc30f2963, 0x90ea7999, 0xcef7a60a, 0xcf4846e2, + 0xea560dbc, 0x65918304, 0x5ec1f21c, 0x52d49030, 0x5b42b6d1, 0x9f863c02, + 0x60a941bf, 0x9341e1c1, 0x0b8eb154, 0xe388daeb, 0xe4d32c38, 0x3a34dbfb, + 0x88aa7015, 0x9df806df, 0x98bcc5ac, 0x9f0bcfef, 0xe426baf0, 0x0040e48c, + 0x9edd30b2, 0x53ec8281, 0x2a2f521c, 0xba2341d4, 0x469344c9, 0x303383dc, + 0xbcb454d6, 0x8bb0bec5, 0x03676a10, 0xc343c028, 0x2a93711a, 0x51e3d400, + 0xcbd64ef6, 0x02b6d3e2, 0x657f9d43, 0xd041e607, 0x2a4081aa, 0x3d646621, + 0x61b2b84e, 0x0d82184d, 0xe21a073b, 0xd0f44d3b, 0x83ff1551, 0xbf0be20c, + 0xc0ec1cb8, 0x85031860, 0xfd917b19, 0x4bee6789, 0xc2d90f50, 0x5328b175, + 0x33a8b947, 0xb8117d89, 0x0151019a, 0xdf1309e6, 0xeefba94b, 0xaf407e14, + 0x01841f74, 0x072edc92, 0x67718fcb, 0x3325bc8e, 0x67723637, 0x4c57c32f, + 0xec826139, 0x49da5f2b, 0x86aaad66, 0xcdf48c61, 0x1051c1ef, 0x73b124be, + 0x3d91d1e4, 0x42edf18a, 0xfb65c395, 0x2d320a4a, 0x249295ee, 0xd8a0b7da, + 0xbdda8975, 0x6cacaa51, 0x6a95ad3c, 0x70ea1e1e, 0x860d04a5, 0x7fe5968c, + 0x8e94d9d2, 0xe1776758, 0x03f2b8a4, 0x6d177309, 0x5e5d1658, 0x8226f111, + 0x5e05e9e9, 0x03523a16, 0x0a486558, 0x7802572c, 0xf4b2ece6, 0x25334aab, + 0x76ec5f3a, 0x91c188dd, 0x17602398, 0xf937ba21, 0xb4150e39, 0xfd69cb60, + 0xa6db1804, 0x40e59e9c, 0xd0a66868, 0x940433eb, 0x0493232c, 0x8c6332a5, + 0x603c2378, 0x8892f964, 0x9332413a, 0xd73f6d38, 0x9eb00bf6, 0x6d3f6f14, + 0x9cb277c2, 0x0a8f9f0e, 0x274ba4cf, 0x8b6bcd6a, 0xcf628996, 0x153697aa, + 0x637d2a08, 0x2575efc2, 0xe610cb7a, 0xfdc2463d, 0x2a79b1d2, 0x3eb854f5, + 0x8d62d4b4, 0xc0be0d46, 0x20d5923d, 0x3302d755, 0xe3fe3f04, 0x35f41e8e, + 0xc038ad3a, 0x0c3b1fe9, 0x63f01783, 0x860d0433, 0x0764210f, 0x8a089d41, + 0x345db32a, 0x73a001bd, 0x2511eac3, 0xe6662996, 0xca424b60, 0x3f28df70, + 0x2e4235b7, 0x94ecaa8d, 0x5e0dbfae, 0x05d48830, 0xaeb4f71e, 0xc34cbb15, + 0x12e7551b, 0xdb32f1cd, 0x020ca7f6, 0x947109b4, 0x31ecb208, 0xde042987, + 0x1766916a, 0x767947c7, 0x7356d7a5, 0x99af1544, 0xe4f08a91, 0xe295f986, + 0xc4ab8b16, 0xb928323c, 0x17b8d6a8, 0xf87b6f1d, 0xff8b1b74, 0xeedc69d6, + 0x466a95ce, 0x2123486a, 0xb09b7da6, 0x0c77b31c, 0xcb81435c, 0x0d5709f4, + 0xf908fe1b, 0x7827dec6, 0x9654e061, 0xe533cf13, 0xd1eb1a88, 0x41ce8521, + 0x472b0b22, 0xf2760080, 0x7cd0c1a5, 0x37a9458a, 0x25bfb15d, 0x15e3abeb, + 0xe4038b26, 0xff4d2cde, 0x008d5210, 0x08fbf24d, 0x02bb941b, 0x7a7076a3, + 0x4ff9ff8e, 0x3f83c03e, 0xe3968330, 0x321a0467, 0x9500f585, 0x44d174e6, + 0x44e093ca, 0x13042152, 0xd784bc78, 0x6f35fa1e, 0xb1f169b7, 0x5decd01b, + 0x135d20d4, 0xf02f73a0, 0x1d1c3fe5, 0x7619a9bf, 0xa28e7823, 0xc1106044, + 0xb2dc46bd, 0x4806d55f, 0x64e990d6, 0x472c895e, 0x4e9b7283, 0x8c3362c9, + 0x8a078a8d, 0xc2424042, 0x1fa3e0e0, 0x79d90528, 0x2853d8ac, 0xd5afa3d6, + 0x3670e59c, 0x2d3cc396, 0xf4479882, 0x5e8511e7, 0x9216bbe3, 0x13fd475e, + 0xc51c4183, 0x44938b14, 0x475131a1, 0x21f15f5c, 0x856470ea, 0x7c3c81de, + 0x2479d636, 0x507443eb, 0xffd9c527, 0x8812ad05, 0x9ed97b93, 0x52490a02, + 0xa6ed5452, 0xe8ddec31, 0xaf6c7d4d, 0x522da798, 0xbc83d67d, 0x961da9f2, + 0x944ad080, 0xf9713e9f, 0xf3495078, 0x9fa49ebb, 0x10dba1f0, 0x893716fd, + 0x9b0ae830, 0xa64b41a0, 0xbef91268, 0x0b6c14c8, 0x08e39616, 0xa6acfb78, + 0xdcea059f, 0x887450d5, 0x57bc0908, 0xaed44e07, 0x6472bbe9, 0x51ac69b0, + 0x95fae493, 0x689c9553, 0x2c16d5ca, 0xab54a6ba, 0x4b983d38, 0x65ec59f4, + 0xd9a7aafe, 0x9d58d2ee, 0x520ad3b8, 0xf494ab7e, 0x3937b9da, 0xb8b1e32b, + 0xe646bfa1, 0x4e27136d, 0xb67bf1ec, 0xf4329e4c, 0x787e23fb, 0x0c1735c1, + 0x6ec010ff, 0xecaec95d, 0xae6f8818, 0xd82adbe9, 0x2f43a4d0, 0xa58929d8, + 0x13f9a8e5, 0x1fd9795b, 0x5a0899ad, 0x1c2e93c3, 0xa7a3ba2e, 0xf84f24aa, + 0xc838132e, 0x400eea14, 0x14066d7c, 0x2e14b597, 0x068ecff1, 0xf1de4ca2, + 0x12728915, 0x9456e5a7, 0x44b73462, 0x8570f45a, 0x5147b71f, 0x9fec40d5, + 0x810eac29, 0x752e6e6e, 0x2163fcf7, 0x2f86c06d, 0x008c883d, 0x1103334c, + 0x64604d87, 0xda684940, 0x14db1948, 0xdd5166a6, 0xda9c3b68, 0x47e3c57c, + 0x071aa5d5, 0x5b279146, 0x7f40674a, 0x43c43b58, 0xb9a00920, 0x2e9c6395, + 0x6ede2f7f, 0xdd87b364, 0xb078f1e3, 0xe03188df, 0x34fdfdea, 0xfa5d5b6c, + 0x7238598b, 0x2152fc58, 0xbd593666, 0x110790de, 0x3aeeea53, 0x871b9b30, + 0x2e62ee2a, 0x87073223, 0xe7a8ec3d, 0x997ce0d2, 0x5e098f1a, 0x449af7a4, + 0x7160a663, 0x184dbcdd, 0xafcc6519, 0x411e4012, 0x4c757e42, 0x24a5aac6, + 0x989f5803, 0xe57658e9, 0xf21e713c, 0x9585a4c5, 0xa6d3abd4, 0xa49eba26, + 0x5c488bfe, 0xed82c154, 0xf6a5643b, 0xa5ac8cc8, 0xff160035, 0x2c26e8af, + 0x7decaaa5, 0xb636eb2a, 0x5ab81b73, 0x3908cbbc, 0x8df7a726, 0xce3c50bb, + 0xd9f1d082, 0x530bcf08, 0x57fd848f, 0x642affea, 0x5a2bd422, 0x8f9a2823, + 0x01bfa7a1, 0xc876c080, 0x23b5706d, 0x0b301308, 0xb11d1c47, 0xfb717d95, + 0x48fd147e, 0x688ae8e6, 0xc76a7815, 0x853814a6, 0x0911627c, 0x67d7d038, + 0x9b981e85, 0x332e64b9, 0xd73390cc, 0x9d5c9347, 0x64b73aa4, 0x66fda1dd, + 0x9bf7d9be, 0xb2aa046c, 0x227d564f, 0xef7c5d66, 0x74153519, 0x33b79c47, + 0x5678141d, 0x0425e8d2, 0x89151438, 0x610898f7, 0x8f4e6fec, 0x3b209567, + 0x2fa8fbe1, 0xf4de930e, 0x0fe098ed, 0x784c4bf6, 0x2e5a8aa9, 0xae2d8329, + 0x4a75bcf4, 0xe869b0d6, 0xc25f3374, 0x9c40e4ad, 0xa45a09a2, 0x71e412e5, + 0x82fa90c7, 0xc8f3f3d7, 0x8bd65e1c, 0x9428ab27, 0xfb0f0bb0, 0xed2bf565, + 0x025f8172, 0xef1f23bd, 0x527aa7db, 0x82a9eaa2, 0x3ecf5a54, 0x7b46a656, + 0x83ba908c, 0x029a1d56, 0x1ad4802d, 0x0b6d0a16, 0x85676492, 0x5603720b, + 0x93d57ab8, 0xa511234a, 0xaf0622d5, 0x92cb4015, 0xc99b3d9b, 0xc28c681e, + 0x9ca6141a, 0xc675ed6c, 0xdf2354cc, 0x4b94f874, 0xac031dc6, 0x4dc8c88a, + 0x8e957384, 0xce4c06f6, 0x41d81338, 0xedf18fa0, 0x7496b2c3, 0x1d22d10e, + 0xada0df5c, 0x567818f1, 0xed69beee, 0xd3538bee, 0x87015a7e, 0xf096af02, + 0x0f74ea22, 0xf97c3941, 0xbc92e90d, 0x64c37c02, 0x323b8567, 0x64a0388e, + 0x672072ef, 0x606c1d74, 0x3261f7cb, 0x2fc0bdff, 0x06e8d5b7, 0x5a089662, + 0x7dbb1fb6, 0x8640f66f, 0x0eebab49, 0x41f391b3, 0x405465ea, 0xdcf54a80, + 0x7b2607bd, 0x620a96f6, 0x1761b04c, 0x71602fb5, 0xc75677aa, 0xcc0b979f, + 0x68d7ad59, 0x8097096c, 0x036dda70, 0x5cc96868, 0xdf34fd5c, 0x358de617, + 0xd6cee2fe, 0x2298a0cc, 0x7d51ede5, 0xef7ec9cb, 0xbd4a2269, 0x81cfeb67, + 0x19ca0ca9, 0xd9341ac3, 0xe7eedbc4, 0x712d2b76, 0xf2fc13bd, 0x1eddc054, + 0x157a1068, 0xf77354a9, 0x982a70dc, 0x7af178bc, 0xca78b6dc, 0x89f96f32, + 0x6165ff46, 0x53cd4b2d, 0xd9d6bf4a, 0xe1cba818, 0x6943d30b, 0x49c15a0c, + 0x7c6f9158, 0xb0de4aca, 0xee608c5d, 0xe588c493, 0xe77b48d4, 0x82d454a6, + 0x1a4b0894, 0xc14840a8, 0xab9ce7dc, 0x3e103ccd, 0x9a0c5d0a, 0xa7b3beb4, + 0x799ea004, 0x1858b310, 0x3d05000f, 0xc3315616, 0x76335d71, 0x2beb4718, + 0x075e63c4, 0x49ce8254, 0x3b6e6d7b, 0x4eb9d856, 0x22257f0c, 0x8cf26342, + 0xaa5bb8bf, 0x3a9350f7, 0x5b1a22b7, 0x321b3167, 0xf93ccaaa, 0x2ee34209, + 0x08a40813, 0x3c9f0ab4, 0xe3625de4, 0x3a4ddf66, 0x3ed40aaa, 0x55c407c1, + 0x0b8be44a, 0xc0ad17ce, 0x46ee41d8, 0x5d8308cc, 0xeb0cb1aa, 0xbf8c58af, + 0x75d1e501, 0xc8dabac6, 0x9549fea7, 0x5299e2ed, 0x9b291dd4, 0x6d53d7b9, + 0x6cd4edeb, 0x48478b5f, 0x0b039677, 0xe865413c, 0xe7101843, 0x8b8b76be, + 0x158dacd7, 0x3853595c, 0xeb14d1b4, 0xad9019d1, 0x611fbb67, 0x15b98f69, + 0xc6d2b4b9, 0xbae09260, 0xe475db51, 0xabfb48fb, 0x510e0d0d, 0xe312edaa, + 0xeff0e709, 0x6e8a356a, 0xe491068e, 0x9aa3d5a5, 0x0bd3522c, 0xbc5c78b2, + 0x810e16f7, 0x23930de9, 0x828faaaa, 0x7b090240, 0x49cad6bc, 0x5ba6b866, + 0x9ad09cc8, 0xd8e94225, 0x4edf917b, 0x8b1ed082, 0x532e07a3, 0xe663e0cf, + 0x8c32bde2, 0x93971dae, 0x62220180, 0x20086ecb, 0x0e45c5c8, 0x25d8dbea, + 0x4eea9f76, 0xed571820, 0xf01d0c9d, 0xf4e803d5, 0x9fe78cfa, 0xfc2d84c3, + 0x8d0811c3, 0xecd10843, 0x33e6078a, 0x2fae3bc4, 0xe2474238, 0x8d8705c5, + 0x6c50f0ea, 0x8abaab5a, 0x32e56fd6, 0x2182980b, 0x87e6b96d, 0x3e4e2167, + 0xc94ae51a, 0x6252eb57, 0x097d3e57, 0x8bb677d4, 0x8727f2f3, 0x21599432, + 0xd2698100, 0x3bce3251, 0x32532c57, 0x8435d39a, 0xcc22b598, 0xf78214be, + 0xdfb4ad33, 0x0b293f61, 0xb70de245, 0x49ed033f, 0x1b22d3d1, 0x275a5e2a, + 0x6eda6823, 0x84ca3acf, 0xb2007d31, 0x550f4dc9, 0x6c41f89f, 0xbcf6a060, + 0x5cacc20a, 0xe072b717, 0x3e5290b4, 0x57d714e9, 0xba015f77, 0x9f5c82b9, + 0x9145d986, 0x1fbcb59f, 0xbc4c94fe, 0xe9630858, 0xbc836442, 0x6ecd8857, + 0xe6849951, 0xebb538d5, 0x77834926, 0x93c14aaf, 0x3ea06c07, 0x7defe3ea, + 0x7703d4d7, 0xa7bed2bc, 0x9f07caa9, 0xfbb38ec0, 0x93e4d78a, 0x9f962279, + 0x46461a9c, 0x3469b86f, 0xa70f4f94, 0x5a636708, 0xc7c27941, 0xbd09a8c6, + 0xfdbb0dc6, 0x8e356917, 0x40ac8185, 0x911d958e, 0x464557f8, 0x2144ceeb, + 0xc91bd789, 0x3336ca40, 0x94c17309, 0xb9b5fd22, 0xa15d027d, 0xecf123ea, + 0x24b341be, 0x15f99919, 0x0f7e5437, 0xc0a2e3b0, 0x85ad9be7, 0x1802995d, + 0x6ffbdb36, 0xfee2f330, 0x82d97360, 0xce34d141, 0x92d485db, 0xa5355c91, + 0xfa1e8722, 0xeb4d45de, 0xfb6d515e, 0xc314a653, 0x0d87eb60, 0xfd847790, + 0x8b92e379, 0x0201eba2, 0x7b4b7452, 0xf584a6e1, 0x2b193f55, 0x7c8655b5, + 0x2f7ddd10, 0x307135f2, 0xc2d95e86, 0x2a589931, 0x205cff1b, 0x3ef585cb, + 0x87ed3660, 0x3d940695, 0x9b5bf90c, 0x3cc0a414, 0xaf7c64be, 0xb89d73bf, + 0x0bfdee3c, 0x363434b2, 0x2a03aaa2, 0x9eeeaa79, 0x9d10e970, 0x2a53c383, + 0xc279b64d, 0xa1fccfd4, 0x45beae3d, 0x10a0edf7, 0x115db88e, 0xf82c38c8, + 0x3ea14f75, 0xcae52dfe, 0x0f7a30e8, 0x8097dad3, 0x6877021e, 0xf641ac74, + 0xa1070496, 0xedf1dc86, 0x8f86118a, 0xc0885553, 0x674121f2, 0x703322e7, + 0x3ce1c69c, 0x185f7483, 0xd903a5c1, 0x5443c629, 0x09be9c89, 0xc9287535, + 0xa3756dbe, 0xada965c0, 0xb5cca18a, 0xf66126c8, 0x032d3228, 0xdcb35032, + 0xb91d592c, 0x4f946c88, 0x48a4d566, 0x6c6a9877, 0x59008967, 0x4b4d064d, + 0x02c9b04a, 0x69411188, 0xd9874bbb, 0x33a0ddd5, 0x88aaca79, 0x21170627, + 0xef390ee3, 0x815ad6e4, 0x111058b4, 0x4c458220, 0xd0a582e8, 0x035b7606, + 0x3983b039, 0x85672bd9, 0x35ffe70a, 0x17a907e1, 0xc93c655b, 0xeb2d3465, + 0x4330c966, 0x865946cb, 0x591d81de, 0x2bb7e3a0, 0x0c3c47b7, 0x5fa46f27, + 0x32b448b6, 0x0ae8b601, 0x52bd856b, 0xba2b65ff, 0x5095ef4e, 0xafcc8c2b, + 0x764982c7, 0x7af2ccf1, 0xcd822340, 0x25d6277f, 0xdcebabda, 0x97d1309f, + 0xa308c1a5, 0x2c057a68, 0x93f7c2e9, 0x953c9d03, 0x570a5aba, 0xc44800d3, + 0x497e542d, 0xa5f7cd96, 0xf6a92a36, 0x5f3095df, 0x2364d5bd, 0x2e008680, + 0x40025d58, 0x9270a8c0, 0xa7027802, 0x7fed9c46, 0x9a937b1b, 0x4c909c08, + 0x54234050, 0x1a3ede20, 0x9e33f20e, 0x8945cc06, 0xa8f2d3ad, 0xc134ce4a, + 0x0a8855c0, 0x2896bb3a, 0x4641661a, 0x5b9e308c, 0xa7af698a, 0x7d7677cb, + 0xab025a5d, 0x9612a4d2, 0x52e6ab7d, 0x031e4c67, 0x7b365bc3, 0x8bc2b6e7, + 0x6e6be6ca, 0x2a479be3, 0xaa0816c0, 0x445220a7}; + +static volatile uint64_t LONG_I64[1024] __attribute__((aligned(AXI_DWIDTH))) = { + 0x5b918a8884cfd5c3, 0x2c63b07fd926c9a6, 0xc86fa3cf7b49b1de, + 0x29a920deaf293c91, 0x41dcd2ddad56ca9a, 0xc5903d04cdd5a80e, + 0x3c9652849cfe9aa7, 0x45349b70a8ae9ebf, 0xcaf33ebac28cd71a, + 0x63e1cac81153895e, 0x0b4b8c86937feae4, 0xa39bce9e797fed4d, + 0xf81a244d5bcd0109, 0xa9b1402ee782d2ce, 0x5fec840fb9505fb2, + 0x3a48b01cfe5103ca, 0xbacd4b67821f2584, 0x1d61f3d9f36d0bcf, + 0x5cca3fc0f92a6875, 0x4d9b65e9be59f56a, 0xf6f55943b82f5763, + 0x3131cf70faf884bf, 0x9b5bce0522a090e3, 0x2fdeb698c98eb085, + 0x4a50e635c24c9bf6, 0x75af29be8cfdf207, 0xd70f6631640a1fe0, + 0x088f1ddc23501599, 0x50f00f14446c4e77, 0x683dbab92f032d29, + 0x2f4903e13da53013, 0x6f3c66daa92514bf, 0x9dda491ef7291a4f, + 0xb2165e1b2565bb5e, 0x62c370b3e7a4d9a2, 0x32e2e11af3114cc2, + 0xea4ca846a44af95d, 0x2eeb9b0d1e0be906, 0x0e534020e23f1751, + 0xd741252cc5576730, 0x9f7d6eafe4be899e, 0xb7b8c4e9a986195f, + 0x7c8bf91a434a6998, 0xd87c33e9f60145f6, 0xcab4596ea9d0d117, + 0xdba10cc3c3e5becb, 0x98d65c8020821be8, 0xa5de178cdb2409be, + 0x2381465286e67e5b, 0x7869d85c3921fa27, 0x8a184a4e1bf310f1, + 0xd58d536a177b55f1, 0x88f9880e7a392d13, 0xab342cb424ad840c, + 0x8e2ab46dd1384eb7, 0x9ccbacd87db5ba92, 0xcca2305e02df0d12, + 0xca7ef22fdb3e6950, 0x5c3386e316633d50, 0xd4f1b8d07547fa00, + 0x46112de027ab3941, 0x0352b799e8621f17, 0x2d2e6b8d48c6a6e4, + 0xb30e7483f8386396, 0x576ee02125f29c9f, 0x634b9113c0f31e23, + 0xdcfd18d55e16a625, 0x85821366b4359b41, 0xebed2527d906294d, + 0xeb37c51961391a34, 0x29611108188bb315, 0x3cde4f975af5f699, + 0x46a62bcbad70d2e7, 0x9e7f814251026f2b, 0x4eb6fbd2d3ee7ae4, + 0x82a32a7817c12867, 0xef0c292f5ba84e39, 0x849d6d2140043616, + 0x807662bf9250ffef, 0x617dcc030448e683, 0x21318bb975849005, + 0x2e6fd54e323adb4f, 0x9b8d29b8573bae2b, 0x380170fec7c9f9fb, + 0x97ba91161a6b0a11, 0xbdbadcc05dfba1ac, 0x4c4303eee211d8f2, + 0xae19e1ea4cfde2d8, 0xef53f1a41256a801, 0xe0bbd4ca56b7d521, + 0x007a8bc15f4439f8, 0x7bea6a86ad68e83b, 0x91771d1505f30447, + 0x21b5b66b676370b6, 0xeb12967c8d5f2535, 0x024a5fa411e3ecfd, + 0xb7eccd38a98b3167, 0x83bfb3ea114f5ab0, 0x2fca700107446ce3, + 0x5c7f399432516311, 0x7891ee66c664f154, 0x968fad3eb7247bcc, + 0xfc915930d85b4beb, 0x58f9820e127f4759, 0x3c0a4aa3384ac8db, + 0xc1f5417d196b3e12, 0x7d680b6ade3118bb, 0x9b429210e51ed8e0, + 0x4efc95809b8a33be, 0xd5d4e8db6379f920, 0x8169cef81957d8df, + 0x1f7bfb9f7a8d08cc, 0x4954aa9d798f25cb, 0x83efcb9d744c569b, + 0x7af5c3320086adbe, 0x29a325c89e39d09e, 0x89fafbbc0ed0eb63, + 0xe5b4f470e74a827c, 0xa4c9860a38650ebc, 0xafa99ca8cd3b0479, + 0x6ac38b32e224dcbc, 0x512e00840e525b87, 0x9347d163a35f45d6, + 0x3edbc7c23cf71775, 0x90653291e03d9b5e, 0xe3cd8d583bf1d964, + 0x89a9f4f73452dae3, 0x78b361688a6129d5, 0x18f7dbd2e56001f2, + 0xbf5559bc1a38e0fc, 0x554402b1835e8a24, 0x5edece2d16dff1ef, + 0xacfac3c20012a807, 0xf4c9cf11b0b7fa95, 0x2d8363001c324a75, + 0xe1d6c92d9340477e, 0x2615cd69cd422e5c, 0x30389d7bd2042620, + 0xe3177b389d6896ca, 0x4e060c4623e6099a, 0xd906ab7594a5d71f, + 0x53fd1fa52bcf74fc, 0x7c94d1b8cb188376, 0x11a48a0723ee3913, + 0x1facb83155f53636, 0x5eb3ffea0edd087b, 0x0622f72afbdfbca3, + 0x69cb802769722ab3, 0x25bf8776b6a979ee, 0x71440fb9ff20476d, + 0x5daf0362cf5dc719, 0xea45008bbfa46c58, 0x32453d3abc1c7355, + 0x69189ed04d522fe1, 0xfe804475936727ed, 0xea3f393e0ac0a433, + 0x8d7272247d3e90fc, 0x0d6e1dea0d11c028, 0xaf76da3e78f145e2, + 0xb8f3ab388a018ee5, 0x0f165eb6d0319a52, 0xe13249edea658d7b, + 0xbc0a6fce691e0102, 0x0e12af1ee5ade4b0, 0xea610e9eb6703d32, + 0x47578a13eaeaaffd, 0x2da0a8786244df15, 0x210d7f3a93dc5051, + 0xe38ce2beaa9df561, 0x26e88004fd89019a, 0xeb652159c7446897, + 0xd84121357c2d51e0, 0x9ee6f9ab996c1f44, 0xb22b382489a7e293, + 0x2274273daca04431, 0x50ded0d3251127f8, 0x4f2793954c49a0c5, + 0xa5e8508ebeb3ade5, 0x9fe6de0208af82b3, 0x6447eb4a6f6b06a0, + 0x10aba665c4945a3e, 0xf3e078bcabb63951, 0xb9bbb373a6444f5a, + 0xed33263c3943db93, 0xa3700a2d92c2d894, 0xc3f1414355a195a0, + 0x3bc25884f8431d94, 0x9ae4bfa78b6412d8, 0xf1f6719bfb757bce, + 0x385310bdbae35867, 0x2bdc5498ad771aa7, 0x94c9c61b73834f3e, + 0xa60de5473f490826, 0x0243abafc568251c, 0x5afc2d559e8f76fe, + 0xdb20b5230ec9244d, 0x2bc97870ee6cc8c0, 0x1947bada4434dab9, + 0x5613ab3641ad91b9, 0xeba21058ec2ff2cb, 0x0a3a3d7b5c440bbb, + 0x2ab7c75d5e6deb6b, 0xdfb5c89688b10b83, 0xbf03be923fd248d0, + 0xaa3d1aa687de91b6, 0x68ba39515047f07f, 0xb937732f5cf0d518, + 0xe90fc2258f3a0804, 0xd5766f5d0ad1fcd9, 0x2bf31f13d3b10719, + 0x2514563748562116, 0x2b28f2b01c41dfb4, 0x442d3ebb22f47b2c, + 0xc78fca1d970df555, 0x17bbc8ef08b2e8ee, 0xb513d14b84478c2b, + 0x11d5a72cbb02569f, 0x83e0bc6eaa124411, 0xb052613f6f7eba90, + 0x05c3267c084c329a, 0x4bff9e077de409a2, 0xc9891309d9764f5f, + 0x37999be7a4da1032, 0x50b19a9d1f90d54b, 0x3df1dd217804cf0f, + 0x54b282a3e8c90705, 0x64866f19d48efaa4, 0x41da532592b91643, + 0x2ae0aec368805686, 0xc1b59d3ab08f45a6, 0xe50a48628c44ce94, + 0x1f162b028328e889, 0xd01900d2317dfc2a, 0xd322921695a28b07, + 0x55c926c9838a082e, 0x2079ea6a651074fa, 0xae7b4cfeb5bd5d26, + 0x35a663fe48103541, 0xa2b7ad38844a2b98, 0xa3b22db718f12e3e, + 0x27f23af6b277f14b, 0x6d44d45855e5d8ef, 0x7b39bb538d3f745a, + 0x24bda3840207a0ed, 0x92e633ece2262e25, 0x54ef36412802dd88, + 0x7c8b762c273a80df, 0x6015c1dee6a3ae4d, 0xb4f61790c3779bcf, + 0xc6aff9f3395af230, 0x7454ad25b2d4934b, 0xca4ae9464bc0aa34, + 0x28a707585a860e6d, 0x5a0f0f6e9e516da5, 0x34dd0a662a75ac66, + 0xe5d245d628150747, 0xdce669bd72c8ce43, 0xc17090bd81b074b3, + 0xdd81ee7d0e6731ed, 0xd1a33f56f62cd509, 0xf86923ecd4480c7c, + 0xab01d6df46344a8f, 0x86aaa5c4e25ca4a3, 0xafdca4a7d9f4be45, + 0xc544a896527c19f8, 0x962046e3ea741062, 0x3901545858566b8f, + 0xa78c261542c0119d, 0x38da855ff3c1b55a, 0x9ed91fc1683821f5, + 0xec42cad2cf400232, 0x434a1bf96885a6d2, 0x78f25a1b6480c8e4, + 0xd56dfb81ff3581ec, 0x7e8dd77101765b1a, 0xfafa27fdd7956236, + 0x4c5572915cde90cd, 0x20d4a45b4b7f110e, 0x48c6f353953ed043, + 0xdee6d91a76686087, 0x7543c1e533f95b08, 0x5a5bec46ab3f4dc2, + 0x70e192f39bed62ce, 0x93fc5767ce19e6c5, 0xa7b7de071427a181, + 0xfe2be507f257e9af, 0x2619ad87c431a8ed, 0x0ea0202340b07f68, + 0x21486fc6cda7191e, 0x267bc68bcd423d9b, 0x384315bdec4c3cc7, + 0x5f05352aeb2bc5b7, 0xed3e79d669b55863, 0x2446271a3c4c0400, + 0x705fd524bcf25f5f, 0x8308c6504b610083, 0xea94c51b20600c4e, + 0x0886edf395a86b81, 0x8f3ab3851ffea0af, 0xfbaebda3847c7ff2, + 0x44fb007bd439be06, 0xb5c91681070d7f4c, 0x6bc1dec7d1f8e731, + 0xe7cb0bd262c5edf1, 0x146b12d56ac906bf, 0x509fa7aa918c3cfa, + 0x9988a880985d419c, 0x15a3a4c0306a6b1e, 0x2dfc494d9f8ffb8e, + 0xd26bf57bfe66757b, 0x5c6fe4327cf3c5d4, 0x19f7686d6a24abd3, + 0xce4ad2b6d32305bb, 0x2fb395c6a538f053, 0x19f34d013d6b81a0, + 0x3a479586f28d848d, 0x42c52962c765400e, 0xce854d47ba7d298c, + 0xfedffcdb87a19b5e, 0xe1e67806207377bb, 0x1e01e222ec3d9c8e, + 0xa5a7c793007d69b9, 0xb37678242fac62c8, 0x6f464b554628d8e9, + 0x2522a52b003723fa, 0x2a94080d206298c7, 0xf0e299627aec49f7, + 0x02610fad2c52b586, 0x55ea3f51362f282a, 0xcd0a64a3f3889848, + 0x9e930f8c444ad445, 0x094714a37c69871d, 0x1256ba783178c337, + 0x342454c6cf03bad3, 0xdcd7d3dea53c5dd7, 0xb34c7d1fc84bd7cd, + 0xa0ae00c63a10ab0b, 0xec2e16a4ca36a178, 0x319585e21583d3f8, + 0xe6fbc514ab163a70, 0xd4f08282a99cdeda, 0x62d6545ec5ddaa5a, + 0x41ac5a2b635cdcbd, 0x7316418b1efaa05a, 0xee2bf8cf1fef1226, + 0x5548737a7aee00c3, 0x4ec53cbded0704b7, 0x308776126cc00e65, + 0x1cb7b2537ab3e9b4, 0x9e76e8c71c1aadd3, 0xe4f88b1c4b6cb86f, + 0xe0da8ed3d5f07756, 0xc4d31b3e13c80726, 0x87881e9a261bb4ab, + 0xd5b0177cbd48aa74, 0xc6c63ccbaff07e3d, 0x481e8a564a5cca33, + 0x208c54b70965ab69, 0x4baf88ae67ce72a5, 0xd3bbe1f95b716bde, + 0xac76b1c85e48c386, 0x5be48528a19b94ae, 0xca7e315311faf75c, + 0xe5378fdd264705cc, 0xce487129c79515b3, 0xd0fa02f288f62639, + 0x098222cb25899065, 0xec30ffb0a4f0870c, 0x941a3141f2a65e26, + 0x3e516aaf2056d29f, 0x20d5ce3c38aa691a, 0xe1477ab483496128, + 0x1db7f9630c300a62, 0xd6665ec2133b37f0, 0x87d986925810d776, + 0xc2fbdc28ceddceca, 0x23a41a25b4509d01, 0x7dc4f3941f222a0b, + 0xb0784f1ed118aa44, 0x369678c116b35f6d, 0x2d37ce532e75c509, + 0x1a592d227836870e, 0x95ef44296e4f6c66, 0x1a762a7cbc1da96a, + 0x421b98edb628d26f, 0xfc699bac5f9fa9b2, 0x445e6a410c1bc920, + 0xb490c64305d80d35, 0xed04b903df04b991, 0x7613e93f57a4410e, + 0x18c1df73a9bc4dea, 0x44ac154955a6b15a, 0x020d02df317fccf0, + 0xbf3c40af5fed7995, 0xbed7f25bc51ab6b5, 0xa3e1b4fc04457aea, + 0xcd08cd512c677f70, 0xbea31a1ff9d1a9b1, 0x1af39c9048a3a01d, + 0x8acd8919d68da4cf, 0x9995039e15467cc7, 0x87cd10e8ed4d0aa0, + 0x90d704ca9d2f9b4c, 0xe1cef9007af1152d, 0x270d70c5b8be5d5a, + 0xc5ef8050a8bdfa15, 0xe09d7109d5019d69, 0x5c4b9e6ecdd50d1d, + 0xc3a10c28043ac553, 0x3d015bc159395006, 0x0b91ca617554a97c, + 0xc93bca26654eb494, 0x5d8e03d6f461aecc, 0x3762ae071a5dcffb, + 0x32e7a6dc2a0b33a7, 0xb3ad43176ef2843f, 0xbc57995db76bfee6, + 0x1f4e8dcacea2949e, 0x1a3b8793411ac7bb, 0xa69ab1a9996393df, + 0xf565527fba769559, 0x080f90f0d53c11d8, 0xb1d6b9fb5f2d8fea, + 0x2ec4ab1ab88f30a5, 0x07c1e05cbce364f5, 0x8a693805bd1f3af4, + 0x1a7c287961a8d22b, 0x7ecfa8e5105f3271, 0xdb5d6aed5a166250, + 0x78907444fddd02ba, 0x6e0da51eca6e277f, 0x6efc4ec181d33e01, + 0x5f01be94763c5832, 0x7fcaba62fd644048, 0xdbeb62a1f151e096, + 0x4ecbb4ede2959f68, 0xf359a08c4c94c1ed, 0x97308cf6d5242bd6, + 0xd422499d753b07d8, 0xe56c573849489272, 0x7069e4fb82999a6f, + 0x20bbc9b8ff37e064, 0x3f71b9ca74fbfe15, 0x26e716e9602ba886, + 0x11a5e4a1e68fba47, 0x22e89141042a4c92, 0x3d5f1092a5736d98, + 0x441e3db7df136b81, 0xef4cd925628ffb7b, 0x965c67ea35eb6e04, + 0x308da2aba329c892, 0xdf1680a37a136e4d, 0x23d99d23258f36d9, + 0xbb76a13669829df8, 0xd90f44c7a92753d9, 0x04ad47193f3363ac, + 0x30d6eadd1185cd74, 0xb88ee0e3e8094fb9, 0x08d245c5bd415dd5, + 0x9bfbb1f5e3c37a06, 0xb3b1a4b2022b2b5e, 0xecac1662b8f270b5, + 0x94a87d509027df85, 0xc80d269a650626d6, 0x55c79b8476022cc8, + 0x4620ea4222276e23, 0x0d4e2ae285dfb42a, 0x8c738b0d2793fc2d, + 0x58e0b352c7151cca, 0xb2cd277d0fbc10c5, 0xc5bba19d47051022, + 0xcfd79787aa57f341, 0xadad360ebbcd1ab6, 0x08dd2162d889294f, + 0xdccad621696c1fbf, 0xd02a8046ec910c21, 0x134e26deaa4edf89, + 0xf77ea3f2a42d2fe5, 0x95384516840e40d5, 0xbe3ab13018d34a7d, + 0x694c1c3b32bcca65, 0xde3f91e577bef081, 0xe4c4d4377c89c1c1, + 0xd80a53cc0a04fc0d, 0xb5f58d4c52e8d7b4, 0x4f90b90f99360164, + 0x9cb5665f2228efe7, 0x9af1dd636257ee2b, 0x56fb9281bc204866, + 0x0788e6e8091ac743, 0x9a475c85a133eaec, 0x4bd4657fabe83918, + 0xb6a3cf2883f57884, 0x0d880db8ef8d2be5, 0x11bc29b42519eac9, + 0x99ca006a2fbea7de, 0xecc32f2287fd0e7d, 0xdcf6831165778e62, + 0x68ccf3c6f25824e3, 0xfbc285c3271b3c4c, 0xe02eecbc46bff9f5, + 0x632e45a0b434c8bd, 0xd12b4db5aa304c5e, 0xeafc6e594ebf60c4, + 0xffa02db3b6e6edfc, 0x41762052d11615ca, 0x77a736208b082975, + 0xc70239b91e07fd18, 0x65ec1acff78453d6, 0xf46cecad3d40293d, + 0xc0d496427244ceb9, 0x270aca85f4214e55, 0x8b6ef4052b88171e, + 0xfa2049cd7ceaa779, 0x8f4a9ede8b51fe6a, 0xa70aa214cafc7052, + 0x020ea42d7fd98625, 0xeeeb29f9b316523f, 0xa6bbf588a1b4b83b, + 0x2b35d571a093da58, 0x4e73b4977809a1bf, 0xca8a3a974d4fc3d8, + 0x33370b2b5c51c2dc, 0x09e511111002aee8, 0x59c174d902cb00fa, + 0xf20f33e6ff909b9d, 0x1017f494b9d56cd5, 0x2919cce721a71823, + 0xfc4c724efd0cb620, 0xac5057904cefd58d, 0x27da534504b7a8f0, + 0x4d8b3e3660fc59d8, 0x053d05b5424948b9, 0x1319351e2b8921fc, + 0x89a73398b02d073b, 0x546fbe0025f9cfba, 0x11ca5ddcba7d8369, + 0xe6fef6dccc2ca6f4, 0x3059baa46164304e, 0x800175f0fc9c6a19, + 0xd4093c11113f78b8, 0x60a5bd87976e324c, 0x8238bf11d6495e40, + 0xf6d4ace54d4a8068, 0x2947416027e0c92a, 0x91c5a03cb8ed0af6, + 0x730d94f749d99ace, 0xe2f81bed68511676, 0x7bd571002fecdf2f, + 0x16cf61f6ffae39d1, 0xbbef000d95e9830a, 0x07ad1acc4fc7ed84, + 0x8afc8b4c0e406725, 0x4d2680571f2e6b35, 0x4a86bdde8651a2e6, + 0x6f453a34e7174d33, 0x2b668a7e170bdb38, 0x30f5e66846fc64d3, + 0xf05e2539c70e9398, 0x43ffe1444f702239, 0x4c8dcd67b7374573, + 0xf900516979429fd8, 0xfc20f846d16f33b1, 0xf24e7ae7ccad14b0, + 0x2aac532d5b2120ef, 0x624431a04b132a40, 0xe5af91ceb3eaf8d7, + 0x55c1adcf397fe1dc, 0xff4c94620834592d, 0xa193192583743ab2, + 0xc83196ed86a60156, 0x7a3b8b965edc7bd5, 0xab72caf7a8eaed8b, + 0xcd29f59c3b64cbe0, 0xadc6965a047a89c8, 0xa33f770fe1bc6334, + 0xed3bae805c4c5ec9, 0x1d20f4585421eee9, 0x5d5bdeea5469ca3d, + 0x0692d341ab1e63e8, 0xa996e3725441f100, 0xc15619a7e8a3b3da, + 0xc1e8c7574ab37528, 0x5d44111e04ff3446, 0x811d056e07ddfbd1, + 0x94b6c519c555a356, 0xf891bf70e50ecd6d, 0x923d8689b85095c4, + 0x1ccb4fba77c57327, 0x39ed880ba89a42e0, 0x4c274e58b8e47f91, + 0xd9ca94178f5fc888, 0xaa0a7b13e823734f, 0xf01c09b840101f3a, + 0x5bfe0201a923e954, 0x8e7ff7903aa630fa, 0xb4949208e0f23414, + 0xe8ad80e69a99408e, 0x3fca41c8647ac441, 0x30cb6711ab7192c0, + 0x4c79e616997b9287, 0xd8b7482cd515b938, 0x69ed40d0bf2f1141, + 0xeafe2700b3b8366a, 0x12a314048b563bf7, 0x803284980fb63535, + 0x93aa990d8772cf38, 0x8b0a12bc54f21419, 0xd9c8615cb86cf36c, + 0xf7e5b77c1e427807, 0x410523bc55cb1365, 0x6d49bf694b2db039, + 0x9f8c30ec828ceaac, 0x9544d042d69de203, 0xe10ff47eedc7cb7e, + 0x6464a9cb0d8d79f0, 0x4418290ff3c06a9c, 0xd3ed63061493ea1a, + 0xf447fcdc5a8dd364, 0xa099c45e9dfcf4c7, 0x960d921ca569ff40, + 0x20ae4b0ebc23f222, 0x754f0768bf59d01a, 0xfccef54da65cce41, + 0x6b314ab4b3ef190c, 0x1b87085b32099c02, 0xa34e17a3613d2488, + 0xafff5fc13e9afda1, 0x324aed7f908e68ae, 0x1bbfd184dd51afe9, + 0xcfef2428e5fe7c9b, 0x136041ebfc599a58, 0x020b894271fbb4cc, + 0x1d856b409cbfc139, 0x61b99a2aa9c45786, 0x95eb845340aedef9, + 0xe7398ec5329d5335, 0x32191d113cfd66df, 0xe96cc809e4d45b23, + 0x2d2893ebf416dbad, 0xfa679ba2e0c83e74, 0x510edb3f5d47eaf8, + 0x21e73cca9dfb248a, 0xd7463cf663f95ab3, 0xffd126a39a23b70e, + 0xf9b23d23eca0402a, 0x7e1fe06e67564b7e, 0xffdc2b9da54577ff, + 0xa9576f7dbe8e0a0f, 0x2784af230acb7bbf, 0x22a40e5caf25faf8, + 0xee372c7bd40f2b6e, 0xace368ae6152be85, 0x7e83c208885a8141, + 0x5c37a16f065389d7, 0x9da872095f561300, 0x87c90400e68d2e33, + 0xb1f82162e128f0e3, 0xb136572f78aa6e37, 0xb042cbf86dd63e27, + 0x339bf0b0813536ba, 0x655d596cce02ee3b, 0x042b6337eeb8e955, + 0xa11005cbfd0986ef, 0xe7c3cf6b0a264d63, 0x31ba2370e2bd7e31, + 0x4a4833157ba9af50, 0xc5fab4a8e6b804eb, 0x356e56419cb137a6, + 0x68e86704bf0661dc, 0x98808cbc1e6a7dfd, 0x26c63f8e01a196ab, + 0x36ba752c75b7bbb4, 0xbaf75ac4520406d7, 0xc44470371882d946, + 0xfd034c9f8ea3eecd, 0x98b39020940d6e7e, 0x60c2949ebebee8ff, + 0xc137b81fbf45bd26, 0x712cf9c4c585c321, 0xcaab336c4485a8f7, + 0x0e12d2893e83d5fb, 0xf21ee79f41925cff, 0x04072dc4ff378eb1, + 0x378f53b19e03acb8, 0xafa105f9be4cb216, 0x1fb67f27eb5f8037, + 0x8c3b679454ed343d, 0x239816c9a84e935f, 0xc286e6179ba1a7e0, + 0xddc47920651293ed, 0xa8c894881ce6d2c6, 0xa32fb43ab797870e, + 0xf2d329ad495df0c6, 0x544bf4743a59ed3e, 0x71457aac1d6ede59, + 0x8955249ae96da10f, 0xd99fd5200114492a, 0xbdeb230c816c788e, + 0xa69f0d5d265d1d20, 0xa070854aac94ed29, 0x794a932cac3eb3e8, + 0x3d33251f755153e7, 0x0158cc257e0c694f, 0x4b1ed9b0c9bad71b, + 0x67d0ca7b48d0dcd5, 0xe84171ec0032cb43, 0x9f39068063aaa97c, + 0xb03ff0116e4f38e6, 0xf66f82b70ab66dcb, 0xf2c2cd7b075cd068, + 0x93a5754590e1fcaa, 0x1ef79a6d8f18ecc4, 0x9ae6b5a80bf94051, + 0x6f99de111482a709, 0xeaf91dd5d0ec8035, 0x9bf394d1aa28db73, + 0xef17554de7935427, 0x70f5fe4dbc6fc707, 0x27b4219f75a70b05, + 0x73b7022b3501bc23, 0x3e21466b839fba5c, 0x34d3aafc4203983a, + 0xcd66132eeb60d8cb, 0xd62983bb90730baf, 0x67ee29d542a643ce, + 0xb6be0f9dfd96424f, 0x5b7491eb4c1dcf1a, 0xee4d0056f3ea2d11, + 0x674f6421ae5a6311, 0x84a0d8da61f86739, 0xe517cdfde4bdcd45, + 0x59053f156f0dadc9, 0x156489f29326d7bb, 0x8e947fa40f6bbc1c, + 0x674ea187fe8c637d, 0xcd48172f989e579b, 0xab09ff8656c8d866, + 0xf942d079725c8937, 0x9c3a3a633a08cbd3, 0x5a43a0f791d33a97, + 0xac8cf68b81e93523, 0x0b03d245329e456f, 0x51bb997e8da8c27a, + 0x19c2cdddf395b9fe, 0xeda21733dbc0484e, 0x86e74efe9949a83b, + 0xcd0dfdd9c39ad75b, 0x11a6737c84881a09, 0xa21559360e3354a9, + 0xda14097c82b67154, 0x6abd6387a33193cf, 0x98ca93546021efcb, + 0x79d35bd38db2e74a, 0x676fded2b71f4d3e, 0xe953b0aacffea80c, + 0x87b11cb1a2e37511, 0x215dbb363c478a64, 0xc3fabceee7c9e544, + 0x35221b73fd1defd1, 0x3a6b4cefa8c2c7c7, 0x30dc92ad0bc42579, + 0x8181031bfa8af0fe, 0x6878b8af51ba0bd9, 0xe6553c13b3d10513, + 0x6a61058d5cc0013f, 0xaab7cc0a177e2188, 0xab5604f76dce29a5, + 0xaffc0be51414b371, 0xa1ceccd3fe49ff08, 0xd6e440ac84d7ebe4, + 0x8688268f0d65ff8c, 0x82901014067d34bf, 0xd9a912a6b9fee9fe, + 0x1aad0f3bced28b0a, 0xcd4a4608383be2e8, 0xdecd83977a854753, + 0x5f6b669dec55f221, 0x134285d1d2b1d78b, 0xa66e75043647618a, + 0xa1307c7b0ea85caf, 0x987d2d763df4fb8a, 0x5ac1d6afc4dc9a51, + 0x5ff3864eea982d0d, 0x04cb11dd578eb710, 0xd7489a43c744e514, + 0x28c7063f5c6cd297, 0x35fad4eb306b0606, 0x354d77bcc8008d19, + 0x27fb5da9a8fef0d1, 0x5312cd5416302df6, 0x0b1529ef2f7cae98, + 0x2ae720b9ae6bd957, 0x6882e42038972e42, 0xdf2f128340a0f838, + 0x0a8a195abc4477d5, 0xdb41740633f74803, 0xf8e7203221dc9a9e, + 0x03d305a35f1e5ddc, 0x00dfe75a91b299b5, 0xf585eaf3b9fdd828, + 0x1b848494c3dfec39, 0x5095571c97be3d02, 0x42c215e0584a01dd, + 0xfe2c77ed51b24fd8, 0xa198e64503ea5baf, 0xb65f9fd0d4f12054, + 0xfd61f26855830e43, 0x5b33dfec1eba0460, 0xf6b8518b54c6f2b2, + 0xe01b4604317e4878, 0x6847860f5db0f39a, 0x9d25b8a2d29a0f70, + 0xb9f9a6349c0f780c, 0x3dc1b490167d6aff, 0x33709acd0dbe247a, + 0xd3d2ec182feede98, 0x480e5f88e2e20029, 0xebde03b861ef0769, + 0xda395f6b02da66cb, 0xfb397f61375fa028, 0x0e29cadb5c1a7aa3, + 0x685aab2fcf7fd87b, 0xedae44920f18ce64, 0x47b026a0b4701ebd, + 0xf69160d0f4ecdc83, 0xe4004b605fbf0281, 0xb52520081ac027e8, + 0x2fe3f5bcfce7cf96, 0xbf632bc8cc97dec1, 0xe638b2a8b6feb471, + 0xda96f5005cd21dc9, 0x91376713417b0833, 0x6a8c562b2915eabf, + 0x92088eaa1153a13b, 0xc1b07bce2d2bdc4f, 0x327514aea91eec26, + 0x9c334d1b48e217df, 0x1c49928a15468661, 0x11c104e7fb22da80, + 0x722ceca55e08e209, 0xa5e9633b1088eb7b, 0x32f2d27dfa922aab, + 0x8dd8dd6558292ec2, 0x552a9d1422d01a04, 0xea6ee3a6c17eb0d5, + 0x197f2e91090ed8c2, 0xbda4a3d62bb3b48a, 0xac8904e8d84ce60e, + 0xf87ef221e26d4db0, 0x291f1b68fd0b4423, 0xa76e25e42fd8a011, + 0x890e637f975c017b, 0xc39aa219aeafc163, 0x3110f535c1aaca0e, + 0xd401483b933d7601, 0x014be950902bf03f, 0xbe675e6590fee069, + 0x75926173c192b649, 0x2b0ae0c6be4ef6e7, 0xbbe333478564bf4b, + 0xa5b8dc43e0064d74, 0xfd9d065cd2876b03, 0x5dade062b21e31c7, + 0x22a26c627c20727f, 0xaca881bf5e268e94, 0x0d9ba3dc9800e4b9, + 0x3c0c0944f2f67b8f, 0x7f36876e89206916, 0x7c21f7bbb56d15c7, + 0xe5ceb33aceda84a0, 0x10d33b09656a49f1, 0xe9a5a28b672c4f44, + 0x2af925e75c3b9e4c, 0x3341e4b20cf5f6ff, 0x148ae60d1fe37e6a, + 0xd6c9367b3609a8b6, 0x26f3a5f955e79b7e, 0x129161c994655f6b, + 0xe0469aa06fdaf054, 0x6e05865d823e7b5d, 0xa2ab2f9c6a07fe59, + 0x6cd2f28bbc592343, 0x0feaae1e111199f2, 0x662c2cc7ad60fc98, + 0x69bfa2c36710f904, 0x291ed974d6a110cf, 0xd8cf764a34693132, + 0xd60146b00eb91440, 0x882e037569249143, 0x891c272f14b482b8, + 0xc03bc245e52857f5, 0x585e768c723ec277, 0xe525e2fb8d5e10aa, + 0x66b9143701092233, 0x58fb0f857e21c357, 0xec5e0c5d345567a1, + 0xf3cdc120987b6946, 0xaa53f522fd7d4c69, 0x8446b5dd2b05f8b7, + 0x2a330800b6c8cec4, 0x0500e4b0ab306d27, 0x7e7e3feb244bc6f0, + 0x7725754e52c08de5, 0xe8c1d3d3064c0669, 0x951eb6f64090ebc4, + 0x8bdbc77b8ced0013, 0x2f848fa5f48451b4, 0x69e0db1b07b8bf51, + 0x1d86b68811a35227, 0x639fc646d0724f17, 0x01d7e80af04f0675, + 0x3403fc54e1bd7652, 0x1cec014fbe639222, 0xe7560c098fcfdeca, + 0x1ef70e6441bb4391, 0x4e7645df0eb94f80, 0x03cb44aa9606254a, + 0xc76f734c2bab73e0, 0xbe11e3eda9f9b091, 0x700c348e7445c600, + 0x92dd05baa051d366, 0xc3132ae5977216eb, 0x06c9fe31df261b26, + 0xd297c34c451b5547, 0xdd7171b6b3554c86, 0xe908596beeb902ef, + 0x4680dae676d529ad, 0xf3de8fb304fe553d, 0x288eaff8b5c4f3e9, + 0xa53354434f9be8d6, 0x828db1d7c26c3e98, 0x21171864afa5db1b, + 0x63ece114cd420ff0, 0xe57cdfd446bb3ade, 0x1fc96b013eb5feb2, + 0x71f7fc36b0681d82, 0x2fd265740867f5c6, 0xfad2cbc9fe83ef1b, + 0x5e2d2259a4de7526, 0x434a85c3fefbf4a6, 0x28f0d3ac94ea261d, + 0xc913d0583a3d33dd, 0x4a955cc9d6acb29e, 0x08ef260e43ce8809, + 0x919fe9643e16a3c5, 0xf988210bfb971fd3, 0x47a4db5fb8c2b434, + 0x38fefaa8ffd2ec45, 0x49ad92c4e46d65a6, 0x4514353bb9f9125a, + 0xdabe1b70ad163e5f, 0xd6c8c71217bc74bd, 0x02c29ac70c083f83, + 0x67d0973f224b7fac, 0xb20223ae707d36df, 0x5c5ce4564bdb342d, + 0x310a7c75cf8b86fa, 0x8e72ad037e6e6141, 0x0a0c8828fc87dc42, + 0xd0cb73d0ff193022, 0x31e46c6c4130989e, 0xf783034f2bd03941, + 0x5aa884e64531d778, 0xa27920db7f387203, 0x5dad7dfef8ddf3db, + 0x69ae464882a727ac, 0xbceec35d736a9505, 0xce5d8d607b230532, + 0x818ad5f0272227a7, 0x4b0733108d1f8406, 0x4ce75a7d229667cf, + 0xaa33cba2dcaac470, 0xcaeffe576eed0c77, 0x99008bdc666e7666, + 0xb85ea276201cfc79, 0xadd02de812da8ee4, 0x861cddd9ea9f3998, + 0x0dce8b30690b253a, 0x42f1d027c7bcf4a1, 0xae2d41b2663d66c4, + 0x732d72d4bfa3621c, 0x638e6722f4fd9345, 0x47dd4cae32cfcf85, + 0x7df7059ea7401b5a, 0xeeed3fdb7a84992d, 0xc5668d82500a4450, + 0xad653de727f1ddc5, 0x3acc8e41dab3b148, 0x11c34748fb20c06e, + 0x624f4e52cda3a3ac, 0x4ebafae2db6f4bf0, 0x0982ba7003473f71, + 0x0bbf4688b9430f62, 0x211b45673946ae5f, 0xb82a89a867c886af, + 0x6b14e4faa48ed749, 0xb1fc3f8165fe7f8b, 0xdf99f8d1da8bad26, + 0xebed4f38b454f054, 0xbca66527bbdcb772, 0xdda73b04152dcf84, + 0x6a36786be0c04a82, 0x34c316321caa11a7, 0xc5e3660df39116ed, + 0x326e398ab1a6e509, 0x8e71d0bc94352a9e, 0x25a6f235ee6d00de, + 0xc19ea51bef734c98, 0x4119474d6198c8cc, 0x4172530345e8006d, + 0x4b69dc8cf88ef19c, 0x7d08d0792f8d11f0, 0xc3f49a0ee311e74a, + 0x02ead598a4373651, 0x46f73af1b1030158, 0x33fe85428bbfffe8, + 0x5a73064171cf11f7, 0xaf853d7d05bd87e2, 0x33bb55d64fa80d25, + 0x09d3d7d27d9ff5ac, 0x1aa733495dde2154, 0x4497cf7ee2edc63a, + 0x42d269c685521f58}; diff --git a/apps/riscv-tests/isa/macros/vector/rvv_debug_macros.h b/apps/riscv-tests/isa/macros/vector/rvv_debug_macros.h new file mode 100644 index 0000000..3686259 --- /dev/null +++ b/apps/riscv-tests/isa/macros/vector/rvv_debug_macros.h @@ -0,0 +1,106 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante + +#ifndef __RVV_DEBUG_MACROS__ +#define __RVV_DEBUG_MACROS__ + +//Functions to print buffers +#define PRINT_BUFFER_U64(A) \ + do { \ + for(unsigned int i = 0; i < sizeof(A)/sizeof(uint64_t); i++) \ + VPRINTF("%016x\n",A[i]); \ + MEMBARRIER; \ + } while(0) + +#define PRINT_BUFFER_U32(A) \ + do { \ + for(unsigned int i = 0; i < sizeof(A)/sizeof(uint32_t); i++) \ + VPRINTF("%08x\n",A[i]); \ + MEMBARRIER; \ + } while(0) + +#define PRINT_BUFFER_U16(A) \ + do { \ + for(unsigned int i = 0; i < sizeof(A)/sizeof(uint16_t); i++) \ + VPRINTF("%04x\n",A[i]); \ + MEMBARRIER; \ + } while(0) + +#define PRINT_BUFFER_U8(A) \ + do { \ + for(unsigned int i = 0; i < sizeof(A)/sizeof(uint8_t); i++) \ + VPRINTF("%02x\n",A[i]); \ + MEMBARRIER; \ + } while(0) + +#define PRINT_BUFFER_F64(A) \ + do { \ + for(unsigned int i = 0; i < sizeof(A)/sizeof(double); i++) \ + VPRINTF("Buffer Debug %d: %.17g\n",i,A[i]); \ + MEMBARRIER; \ + } while(0) + +#define PRINT_BUFFER_F32(A) \ + do { \ + for(unsigned int i = 0; i < sizeof(A)/sizeof(float); i++) \ + VPRINTF("Buffer Debug %d: %0.9g\n",i,A[i]); \ + MEMBARRIER; \ + } while(0) + +//Debuging Macros + +#define DEBUG_F64(register) \ + do { \ + double buffer ##register[VLEN_CUR]; \ + VSTORE_64(register,buffer ##register); \ + PRINT_BUFFER_F64(buffer ##register); \ + } while(0) + +#define DEBUG_F32(register) \ + do { \ + float buffer ##register[VLEN_CUR]; \ + VSTORE_32(register,buffer ##register); \ + PRINT_BUFFER_F32(buffer ##register); \ + } while(0) + +#define DEBUG_U8(register) \ + do { \ + uint8_t buffer ##register[VLEN_CUR]; \ + VSTORE_8(register,buffer ##register); \ + PRINT_BUFFER_U8(buffer ##register); \ + } while(0) + + +#define DEBUG_8(register) DEBUG_U8(register) + +#define DEBUG_U16(register) \ + do { \ + uint16_t buffer ##register[VLEN_CUR]; \ + VSTORE_16(register,buffer ##register); \ + PRINT_BUFFER_U16(buffer ##register); \ + } while(0) + +#define DEBUG_16(register) DEBUG_U16(register) + +#define DEBUG_U32(register) \ + do { \ + uint32_t buffer ##register[VLEN_CUR]; \ + VSTORE_32(register,buffer ##register); \ + PRINT_BUFFER_U32(buffer ##register); \ + } while(0) + +#define DEBUG_32(register) DEBUG_U32(register) + +#define DEBUG_U64(register) \ + do { \ + uint64_t buffer ##register[VLEN_CUR]; \ + VSTORE_64(register,buffer ##register); \ + PRINT_BUFFER_U64(buffer ##register); \ + } while(0) + +#define DEBUG_64(register) DEBUG_U64(register) + +#endif // __RVV_DEBUG_MACROS__ diff --git a/apps/riscv-tests/isa/macros/vector/vector_macros.h b/apps/riscv-tests/isa/macros/vector/vector_macros.h new file mode 100644 index 0000000..9193717 --- /dev/null +++ b/apps/riscv-tests/isa/macros/vector/vector_macros.h @@ -0,0 +1,301 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante + +#ifndef __VECTOR_MACROS_H__ +#define __VECTOR_MACROS_H__ + +#include +#include "dataset.h" +#include "rvv_debug_macros.h" +#include "encoding.h" +#include "float_conversion.h" + +#ifdef __SPIKE__ +#include + +// We need to activate the FP and V extensions manually +#define enable_vec() do { asm volatile ("csrs mstatus, %[bits];" :: [bits] "r" (MSTATUS_VS & (MSTATUS_VS >> 1))); } while (0); +#define enable_fp() do { asm volatile ("csrs mstatus, %[bits];" :: [bits] "r" (MSTATUS_FS & (MSTATUS_FS >> 1))); } while (0); +#else +#include + +// The FP and V extensions are activated in the crt0 script +#define enable_vec() +#define enable_fp() +#endif + +/************** + * Counters * + **************/ + +// Counter for how many tests have failed +int num_failed; +// Pointer to the current test case +int test_case; + +/************ + * Macros * + ************/ + +#define read_vtype(buf) do { asm volatile ("csrr %[BUF], vtype" : [BUF] "=r" (buf)); } while (0); +#define read_vl(buf) do { asm volatile ("csrr %[BUF], vl" : [BUF] "=r" (buf)); } while (0); +#define read_vxsat(buf) do { asm volatile ("csrr %[BUF], vxsat" : [BUF] "=r" (buf)); } while (0); +#define reset_vxsat do { asm volatile ("csrw vxsat, %0" :: "rK"(0)); } while (0); +#define set_vxrm(val) do { asm volatile ("csrw vxrm, %0" :: "rK"(val)); } while (0); + +#define vtype(golden_vtype, vlmul, vsew, vta, vma) (golden_vtype = vlmul << 0 | vsew << 3 | vta << 6 | vma << 7) + +// Checking vtype and vl value which is set by configuration setting instructions +// by comparing with golden_vtype value used as a reference. Also check for +// illegal values of vlmul and vsew which violtate: ELEN >= SEW/LMUL +#define check_vtype_vl(casenum, vtype, golden_vtype, avl, vl, vsew, vlmul) \ + printf("Checking vtype and vl #%d...\n", casenum); \ + if((vlmul==5 && (vsew == 1 || vsew == 2 || vsew ==3)) || (vlmul==6 && (vsew == 2 || vsew ==3)) || (vlmul==7 && vsew==3)){ \ + if((vtype != 0x8000000000000000) || (vl != 0)){ \ + printf("FAILED. Got vtype = %lx, expected vtype = 8000000000000000. avl = %lx, vl = %lx.\n", vtype,avl, vl); \ + return; \ + }} \ + else if (vtype != golden_vtype || avl != vl) { \ + printf("FAILED. Got vtype = %lx, expected vtype = %lx. avl = %lx, vl = %lx.\n", vtype, golden_vtype, avl, vl); \ + num_failed++; \ + return; \ + } \ + printf("PASSED.\n"); + +#define check_vxsat(casenum, vxsat, golden_vxsat) \ + printf("Checking vxsat #%d...\n", casenum); \ + if (vxsat != golden_vxsat) { \ + printf("FAILED. Got vxsat = %lx, expected vxsat = %lx.\n", vxsat, golden_vxsat); \ + num_failed++; \ + return; \ + } \ + printf("PASSED.\n"); + +// In order to avoid that scalar loads run ahead of vector stores, +// we use an instruction to ensure that all vector stores have been +// committed before continuing with scalar memory operations. +#define MEMORY_BARRIER // asm volatile ("fence"); + +// Zero-initialized variables can be problematic on bare-metal. +// Therefore, initialize them during runtime. +#define INIT_CHECK() \ + num_failed = 0; \ + test_case = 0; \ + +// Check at the final of the execution whether all the tests passed or not. +// Returns the number of failed tests. +#define EXIT_CHECK() \ + do { \ + MEMORY_BARRIER; \ + if (num_failed > 0) { \ + printf("ERROR: %s failed %d tests!\n", __FILE__, num_failed); \ + return num_failed; \ + } \ + else { \ + printf("PASSED: %s!\n", __FILE__); \ + return 0; \ + } \ + } while(0); \ + +// Check the result against a scalar golden value +#define XCMP(casenum,act,exp) \ + printf("Checking the results of the test case %d:\n", casenum); \ + if (act != exp) { \ + printf("Index %d FAILED. Got %d, expected %d.\n", casenum, act, exp);\ + num_failed++; \ + return; \ + } \ + printf("PASSED.\n"); \ + +// Check the result against a floating-point scalar golden value +#define FCMP(casenum,act,exp) \ + if(act != exp) { \ + printf("Index %d FAILED. Got %lf, expected %lf.\n",casenum, act, exp); \ + num_failed++; \ + return; \ + } \ + printf("PASSED.\n"); + +// Check the results against a vector of golden values +#define VCMP(T,str,casenum,vexp,act...) \ + T vact[] = {act}; \ + printf("Checking the results of the test case %d:\n", casenum); \ + MEMORY_BARRIER; \ + for (unsigned int i = 0; i < sizeof(vact)/sizeof(T); i++) { \ + if (vexp[i] != vact[i]) { \ + printf("Index %d FAILED. Got "#str", expected "#str".\n", i, vexp[i], vact[i]); \ + num_failed++; \ + return; \ + } \ + } \ + printf("PASSED.\n"); + +//Macro used to compare large number of elements +#define LVCMP(T,str,casenum,elements, vexp ,vact) \ + printf("Checking the results of the test case %d:\n", casenum); \ + MEMORY_BARRIER; \ + for (unsigned int i = 0; i < elements; i++) { \ + if (vexp[i] != vact[i]) { \ + printf("Index %d FAILED. Got "#str", expected "#str".\n", i, vexp[i], vact[i]); \ + num_failed++; \ + return; \ + } \ + } \ + printf("PASSED.\n"); + + +// Check the results against an in-memory vector of golden values +#define VMCMP(T,str,casenum,vexp,vgold,size) \ + printf("Checking the results of the test case %d:\n", casenum); \ + MEMORY_BARRIER; \ + for (unsigned int i = 0; i < size; i++) { \ + if (vexp[i] != vgold[i]) { \ + printf("Index %d FAILED. Got "#str", expected "#str".\n", i, vexp[i], vgold[i]);\ + num_failed++; \ + return; \ + } \ + } \ + printf("PASSED.\n"); + +// Macros to set vector length, type and multiplier +// Don't use this to set VL == 0 since the compiler puts rs1 == x0 +#define VSET(VLEN,VTYPE,LMUL) \ + do { \ + asm volatile ("vsetvli t0, %[A]," #VTYPE "," #LMUL ", ta, ma \n" :: [A] "r" (VLEN)); \ + } while(0) + +// Macros to set vector length equal to zero +#define VSET_ZERO(VTYPE,LMUL) \ + do { \ + int vset_zero_buf; \ + asm volatile("li %0, 0" : "=r" (vset_zero_buf)); \ + asm volatile("vsetvli x0, %0," #VTYPE "," #LMUL ", ta, ma \n" :: "r" (vset_zero_buf)); \ + } while(0) + +#define VSETMAX(VTYPE,LMUL) \ + do { \ + int64_t scalar = -1; \ + asm volatile ("vsetvli t1, %[A]," #VTYPE "," #LMUL", ta, ma \n":: [A] "r" (scalar)); \ + } while(0) + +// Macro to load a vector register with data from the stack +#define VLOAD(datatype,loadtype,vreg,vec...) \ + do { \ + volatile datatype V ##vreg[] = {vec}; \ + MEMORY_BARRIER; \ + asm volatile ("vl"#loadtype".v "#vreg", (%0) \n":: [V] "r"(V ##vreg)); \ + } while(0) + +// Macro to store a vector register into the pointer vec +#define VSTORE(T, storetype, vreg, vec) \ + do { \ + T* vec ##_t = (T*) vec; \ + asm volatile ("vs"#storetype".v "#vreg", (%0)\n" : "+r" (vec ##_t)); \ + MEMORY_BARRIER; \ + } while(0) + +// Macro to reset the whole register back to zero +#define VCLEAR(register) \ + do { \ + MEMORY_BARRIER; \ + uint64_t vtype; uint64_t vl; uint64_t vlmax; \ + asm volatile("csrr %[vtype], vtype" : [vtype] "=r" (vtype)); \ + asm volatile("csrr %[vl], vl" : [vl] "=r" (vl)); \ + asm volatile("vsetvl %[vlmax], zero, %[vtype]" : [vlmax] "=r" (vlmax) : [vtype] "r" (vtype)); \ + asm volatile("vmv.v.i "#register", 0"); \ + asm volatile("vsetvl zero, %[vl], %[vtype]" :: [vl] "r" (vl), [vtype] "r" (vtype)); \ + } while(0) + +#define VCLEAR_AT_ONE(register) \ + do { \ + MEMORY_BARRIER; \ + uint64_t vtype; uint64_t vl; uint64_t vlmax; \ + asm volatile("csrr %[vtype], vtype" : [vtype] "=r" (vtype)); \ + asm volatile("csrr %[vl], vl" : [vl] "=r" (vl)); \ + asm volatile("vsetvl %[vlmax], zero, %[vtype]" : [vlmax] "=r" (vlmax) : [vtype] "r" (vtype)); \ + asm volatile("vmv.v.i "#register", -1"); \ + asm volatile("vsetvl zero, %[vl], %[vtype]" :: [vl] "r" (vl), [vtype] "r" (vtype)); \ + } while(0) + +// Macro to initialize a vector with progressive values from a counter +#define INIT_MEM_CNT(vec_name, size) \ + counter = 0; \ + for (int i = 0 ; i < size; i++) { \ + vec_name[i] = counter; \ + counter++; \ + } \ + +// Macro to initialize a vector with zeroes +// The vector is initialized on the stack, use this function with caution +// Easy to go in the UART address space +#define INIT_MEM_ZEROES(vec_name, size) \ + for (int i = 0 ; i < size; i++) { \ + vec_name[i] = 0; \ + } \ + +/*************************** + * Type-dependant macros * + ***************************/ + +// Vector comparison +#define VCMP_U64(casenum,vect,act...) {VSTORE_U64(vect); VCMP(uint64_t,%x,casenum,Ru64,act)} +#define VCMP_U32(casenum,vect,act...) {VSTORE_U32(vect); VCMP(uint32_t,%x,casenum,Ru32,act)} +#define VCMP_U16(casenum,vect,act...) {VSTORE_U16(vect); VCMP(uint16_t,%x,casenum,Ru16,act)} +#define VCMP_U8(casenum,vect,act...) {VSTORE_U8(vect) ; VCMP(uint8_t, %x,casenum, Ru8,act)} + +#define LVCMP_U8(casenum,vect,act) {uint64_t vl; read_vl(vl); VSTORE_L8(vect); \ + LVCMP(uint8_t, %x,casenum,vl, Lu8, act)} +#define LVCMP_U16(casenum,vect,act) {uint64_t vl; read_vl(vl); VSTORE_L16(vect); \ + LVCMP(uint16_t, %x,casenum,vl,Lu16,act)} +#define LVCMP_U32(casenum,vect,act) {uint64_t vl; read_vl(vl); VSTORE_L32(vect); \ + LVCMP(uint32_t, %x,casenum,vl,Lu32,act)} +#define LVCMP_U64(casenum,vect,act) {uint64_t vl; read_vl(vl); VSTORE_L64(vect); \ + LVCMP(uint64_t, %x,casenum,vl,Lu64,act)} + +#define VVCMP_U64(casenum,ptr64,act...) {VCMP(uint64_t,%x,casenum,ptr64,act)} +#define VVCMP_U32(casenum,ptr32,act...) {VCMP(uint32_t,%x,casenum,ptr32,act)} +#define VVCMP_U16(casenum,ptr16,act...) {VCMP(uint16_t,%x,casenum,ptr16,act)} +#define VVCMP_U8(casenum,ptr8,act...) {VCMP(uint8_t, %x,casenum,ptr8, act)} + +#define LVVCMP_U64(casenum,ptr64,act) {uint64_t vl; read_vl(vl); LVCMP(uint64_t,%x,casenum,vl, ptr64,act)} +#define LVVCMP_U32(casenum,ptr32,act) {uint64_t vl; read_vl(vl); LVCMP(uint32_t,%x,casenum,vl, ptr32,act)} +#define LVVCMP_U16(casenum,ptr16,act) {uint64_t vl; read_vl(vl); LVCMP(uint16_t,%x,casenum,vl, ptr16,act)} +#define LVVCMP_U8(casenum,ptr8,act) {uint64_t vl; read_vl(vl); LVCMP(uint8_t, %x,casenum,vl, ptr8, act)} + +#define VCMP_I64(casenum,vect,act...) {VSTORE_I64(vect); VCMP(int64_t,%ld, casenum,Ri64,act)} +#define VCMP_I32(casenum,vect,act...) {VSTORE_I32(vect); VCMP(int32_t,%d, casenum,Ri32,act)} +#define VCMP_I16(casenum,vect,act...) {VSTORE_I16(vect); VCMP(int16_t,%hd, casenum,Ri16,act)} +#define VCMP_I8(casenum,vect,act...) {VSTORE_I8(vect); VCMP(int8_t, %hhd,casenum,Ri8, act)} + +#define VCMP_F64(casenum,vect,act...) {VSTORE_F64(vect); VCMP(double,%lf,casenum,Rf64,act)} +#define VCMP_F32(casenum,vect,act...) {VSTORE_F32(vect); VCMP(float, %f ,casenum,Rf32,act)} + +// Vector load +#define VLOAD_64(vreg,vec...) VLOAD(uint64_t,e64,vreg,vec) +#define VLOAD_32(vreg,vec...) VLOAD(uint32_t,e32,vreg,vec) +#define VLOAD_16(vreg,vec...) VLOAD(uint16_t,e16,vreg,vec) +#define VLOAD_8(vreg,vec...) VLOAD(uint8_t, e8, vreg,vec) + +// Vector store +#define VSTORE_U64(vreg) VSTORE(uint64_t,e64,vreg,Ru64) +#define VSTORE_U32(vreg) VSTORE(uint32_t,e32,vreg,Ru32) +#define VSTORE_U16(vreg) VSTORE(uint16_t,e16,vreg,Ru16) +#define VSTORE_U8(vreg) VSTORE(uint8_t ,e8 ,vreg,Ru8 ) + +#define VSTORE_L64(vreg) VSTORE(uint64_t,e64,vreg,Lu64) +#define VSTORE_L32(vreg) VSTORE(uint32_t,e32,vreg,Lu32) +#define VSTORE_L16(vreg) VSTORE(uint16_t,e16,vreg,Lu16) +#define VSTORE_L8(vreg) VSTORE(uint8_t ,e8 ,vreg,Lu8 ) + +#define VSTORE_I64(vreg) VSTORE(int64_t,e64,vreg,Ri64) +#define VSTORE_I32(vreg) VSTORE(int32_t,e32,vreg,Ri32) +#define VSTORE_I16(vreg) VSTORE(int16_t,e16,vreg,Ri16) +#define VSTORE_I8(vreg) VSTORE(int8_t ,e8 ,vreg,Ri8 ) + +#define VSTORE_F64(vreg) VSTORE(double,e64,vreg,Rf64) +#define VSTORE_F32(vreg) VSTORE(float, e32,vreg,Rf32) + +#endif // __VECTOR_MACROS_H__ diff --git a/apps/riscv-tests/isa/rv32mi/Makefrag b/apps/riscv-tests/isa/rv32mi/Makefrag new file mode 100644 index 0000000..5ee7edc --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/Makefrag @@ -0,0 +1,18 @@ +#======================================================================= +# Makefrag for rv32mi tests +#----------------------------------------------------------------------- + +rv32mi_sc_tests = \ + breakpoint \ + csr \ + mcsr \ + illegal \ + ma_fetch \ + ma_addr \ + scall \ + sbreak \ + shamt \ + +rv32mi_p_tests = $(addprefix rv32mi-p-, $(rv32mi_sc_tests)) + +spike32_tests += $(rv32mi_p_tests) diff --git a/apps/riscv-tests/isa/rv32mi/breakpoint.S b/apps/riscv-tests/isa/rv32mi/breakpoint.S new file mode 100644 index 0000000..ecbec6a --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/breakpoint.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64M +#define RVTEST_RV64M RVTEST_RV32M +#define __MACHINE_MODE + +#include "../rv64mi/breakpoint.S" diff --git a/apps/riscv-tests/isa/rv32mi/csr.S b/apps/riscv-tests/isa/rv32mi/csr.S new file mode 100644 index 0000000..6361f86 --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/csr.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32M +#define __MACHINE_MODE + +#include "../rv64si/csr.S" diff --git a/apps/riscv-tests/isa/rv32mi/illegal.S b/apps/riscv-tests/isa/rv32mi/illegal.S new file mode 100644 index 0000000..e167c71 --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/illegal.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64M +#define RVTEST_RV64M RVTEST_RV32M + +#include "../rv64mi/illegal.S" diff --git a/apps/riscv-tests/isa/rv32mi/ma_addr.S b/apps/riscv-tests/isa/rv32mi/ma_addr.S new file mode 100644 index 0000000..7575a3f --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/ma_addr.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64M +#define RVTEST_RV64M RVTEST_RV32M + +#include "../rv64mi/ma_addr.S" diff --git a/apps/riscv-tests/isa/rv32mi/ma_fetch.S b/apps/riscv-tests/isa/rv32mi/ma_fetch.S new file mode 100644 index 0000000..ec0e0f6 --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/ma_fetch.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32M +#define __MACHINE_MODE + +#include "../rv64si/ma_fetch.S" diff --git a/apps/riscv-tests/isa/rv32mi/mcsr.S b/apps/riscv-tests/isa/rv32mi/mcsr.S new file mode 100644 index 0000000..0d5a5cd --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/mcsr.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64M +#define RVTEST_RV64M RVTEST_RV32M + +#include "../rv64mi/mcsr.S" diff --git a/apps/riscv-tests/isa/rv32mi/sbreak.S b/apps/riscv-tests/isa/rv32mi/sbreak.S new file mode 100644 index 0000000..c1b127d --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/sbreak.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32M +#define __MACHINE_MODE + +#include "../rv64si/sbreak.S" diff --git a/apps/riscv-tests/isa/rv32mi/scall.S b/apps/riscv-tests/isa/rv32mi/scall.S new file mode 100644 index 0000000..e5b3153 --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/scall.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32M +#define __MACHINE_MODE + +#include "../rv64si/scall.S" diff --git a/apps/riscv-tests/isa/rv32mi/shamt.S b/apps/riscv-tests/isa/rv32mi/shamt.S new file mode 100644 index 0000000..622fde4 --- /dev/null +++ b/apps/riscv-tests/isa/rv32mi/shamt.S @@ -0,0 +1,44 @@ +# See LICENSE for license details. + +#***************************************************************************** +# shamt.S +#----------------------------------------------------------------------------- +# +# Test illegal shamt[5] of shift instruction in 32-bit ISA. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32M +RVTEST_CODE_BEGIN + + # Make sure slli with shamt[4] set is legal. + TEST_CASE( 2, a0, 65536, li a0, 1; slli a0, a0, 16); + + # Make sure slli with shamt[5] set is not legal. + TEST_CASE( 3, x0, 1, .word 0x02051513); # slli a0, a0, 32 + + TEST_PASSFAIL + +.global mtvec_handler +mtvec_handler: + # Trapping on test 3 is good. + # Note that since the test didn't complete, TESTNUM is smaller by 1. + li t0, 2 + bne TESTNUM, t0, fail + + # Make sure CAUSE indicates an illegal instructino. + csrr t0, mcause + li t1, CAUSE_ILLEGAL_INSTRUCTION + bne t0, t1, fail + j pass + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32si/Makefrag b/apps/riscv-tests/isa/rv32si/Makefrag new file mode 100644 index 0000000..f423788 --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/Makefrag @@ -0,0 +1,15 @@ +#======================================================================= +# Makefrag for rv32si tests +#----------------------------------------------------------------------- + +rv32si_sc_tests = \ + csr \ + dirty \ + ma_fetch \ + scall \ + sbreak \ + wfi \ + +rv32si_p_tests = $(addprefix rv32si-p-, $(rv32si_sc_tests)) + +spike32_tests += $(rv32si_p_tests) diff --git a/apps/riscv-tests/isa/rv32si/csr.S b/apps/riscv-tests/isa/rv32si/csr.S new file mode 100644 index 0000000..3c414c0 --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/csr.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32S + +#include "../rv64si/csr.S" diff --git a/apps/riscv-tests/isa/rv32si/dirty.S b/apps/riscv-tests/isa/rv32si/dirty.S new file mode 100644 index 0000000..bdbc1e4 --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/dirty.S @@ -0,0 +1,10 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64M +#define RVTEST_RV64M RVTEST_RV32M + +#undef SATP_MODE_SV39 +#define SATP_MODE_SV39 SATP_MODE_SV32 + +#include "../rv64si/dirty.S" diff --git a/apps/riscv-tests/isa/rv32si/ma_fetch.S b/apps/riscv-tests/isa/rv32si/ma_fetch.S new file mode 100644 index 0000000..2e5254f --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/ma_fetch.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32S + +#include "../rv64si/ma_fetch.S" diff --git a/apps/riscv-tests/isa/rv32si/sbreak.S b/apps/riscv-tests/isa/rv32si/sbreak.S new file mode 100644 index 0000000..3dcfba2 --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/sbreak.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32S + +#include "../rv64si/sbreak.S" diff --git a/apps/riscv-tests/isa/rv32si/scall.S b/apps/riscv-tests/isa/rv32si/scall.S new file mode 100644 index 0000000..5b732c8 --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/scall.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32S + +#include "../rv64si/scall.S" diff --git a/apps/riscv-tests/isa/rv32si/wfi.S b/apps/riscv-tests/isa/rv32si/wfi.S new file mode 100644 index 0000000..8bc9279 --- /dev/null +++ b/apps/riscv-tests/isa/rv32si/wfi.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV32S + +#include "../rv64si/wfi.S" diff --git a/apps/riscv-tests/isa/rv32ua/Makefrag b/apps/riscv-tests/isa/rv32ua/Makefrag new file mode 100644 index 0000000..575dc6a --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/Makefrag @@ -0,0 +1,12 @@ +#======================================================================= +# Makefrag for rv32ua tests +#----------------------------------------------------------------------- + +rv32ua_sc_tests = \ + amoadd_w amoand_w amomax_w amomaxu_w amomin_w amominu_w amoor_w amoxor_w amoswap_w \ + lrsc \ + +rv32ua_p_tests = $(addprefix rv32ua-p-, $(rv32ua_sc_tests)) +rv32ua_v_tests = $(addprefix rv32ua-v-, $(rv32ua_sc_tests)) + +spike32_tests += $(rv32ua_p_tests) $(rv32ua_v_tests) diff --git a/apps/riscv-tests/isa/rv32ua/amoadd_w.S b/apps/riscv-tests/isa/rv32ua/amoadd_w.S new file mode 100644 index 0000000..df4560d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amoadd_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amoadd_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amoand_w.S b/apps/riscv-tests/isa/rv32ua/amoand_w.S new file mode 100644 index 0000000..b824483 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amoand_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amoand_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amomax_w.S b/apps/riscv-tests/isa/rv32ua/amomax_w.S new file mode 100644 index 0000000..899d7d6 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amomax_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amomax_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amomaxu_w.S b/apps/riscv-tests/isa/rv32ua/amomaxu_w.S new file mode 100644 index 0000000..662f023 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amomaxu_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amomaxu_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amomin_w.S b/apps/riscv-tests/isa/rv32ua/amomin_w.S new file mode 100644 index 0000000..cbd88e6 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amomin_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amomin_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amominu_w.S b/apps/riscv-tests/isa/rv32ua/amominu_w.S new file mode 100644 index 0000000..acb0d79 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amominu_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amominu_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amoor_w.S b/apps/riscv-tests/isa/rv32ua/amoor_w.S new file mode 100644 index 0000000..0a2a57d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amoor_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amoor_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amoswap_w.S b/apps/riscv-tests/isa/rv32ua/amoswap_w.S new file mode 100644 index 0000000..722b7bc --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amoswap_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amoswap_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/amoxor_w.S b/apps/riscv-tests/isa/rv32ua/amoxor_w.S new file mode 100644 index 0000000..1858d7e --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/amoxor_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/amoxor_w.S" diff --git a/apps/riscv-tests/isa/rv32ua/lrsc.S b/apps/riscv-tests/isa/rv32ua/lrsc.S new file mode 100644 index 0000000..695a5c8 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ua/lrsc.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ua/lrsc.S" diff --git a/apps/riscv-tests/isa/rv32uc/Makefrag b/apps/riscv-tests/isa/rv32uc/Makefrag new file mode 100644 index 0000000..0586843 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uc/Makefrag @@ -0,0 +1,11 @@ +#======================================================================= +# Makefrag for rv32uc tests +#----------------------------------------------------------------------- + +rv32uc_sc_tests = \ + rvc \ + +rv32uc_p_tests = $(addprefix rv32uc-p-, $(rv32uc_sc_tests)) +rv32uc_v_tests = $(addprefix rv32uc-v-, $(rv32uc_sc_tests)) + +spike32_tests += $(rv32uc_p_tests) $(rv32uc_v_tests) diff --git a/apps/riscv-tests/isa/rv32uc/rvc.S b/apps/riscv-tests/isa/rv32uc/rvc.S new file mode 100644 index 0000000..debbbd8 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uc/rvc.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64uc/rvc.S" diff --git a/apps/riscv-tests/isa/rv32ud/Makefrag b/apps/riscv-tests/isa/rv32ud/Makefrag new file mode 100644 index 0000000..998078d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/Makefrag @@ -0,0 +1,15 @@ +#======================================================================= +# Makefrag for rv32ud tests +#----------------------------------------------------------------------- + +rv32ud_sc_tests = \ + fadd fdiv fclass fcmp fcvt fcvt_w fmadd fmin \ + ldst recoding \ + +# TODO: use this line instead of the last of the previous once move and structural tests have been implemented +# ldst move structural recoding \ + +rv32ud_p_tests = $(addprefix rv32ud-p-, $(rv32ud_sc_tests)) +rv32ud_v_tests = $(addprefix rv32ud-v-, $(rv32ud_sc_tests)) + +spike32_tests += $(rv32ud_p_tests) $(rv32ud_v_tests) diff --git a/apps/riscv-tests/isa/rv32ud/fadd.S b/apps/riscv-tests/isa/rv32ud/fadd.S new file mode 100644 index 0000000..5fb9090 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fadd.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fadd.S" diff --git a/apps/riscv-tests/isa/rv32ud/fclass.S b/apps/riscv-tests/isa/rv32ud/fclass.S new file mode 100644 index 0000000..c960ad6 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fclass.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fclass.S" diff --git a/apps/riscv-tests/isa/rv32ud/fcmp.S b/apps/riscv-tests/isa/rv32ud/fcmp.S new file mode 100644 index 0000000..55d1c3a --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fcmp.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fcmp.S" diff --git a/apps/riscv-tests/isa/rv32ud/fcvt.S b/apps/riscv-tests/isa/rv32ud/fcvt.S new file mode 100644 index 0000000..8811b6e --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fcvt.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fcvt.S" diff --git a/apps/riscv-tests/isa/rv32ud/fcvt_w.S b/apps/riscv-tests/isa/rv32ud/fcvt_w.S new file mode 100644 index 0000000..3447530 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fcvt_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fcvt_w.S" diff --git a/apps/riscv-tests/isa/rv32ud/fdiv.S b/apps/riscv-tests/isa/rv32ud/fdiv.S new file mode 100644 index 0000000..793e51a --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fdiv.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fdiv.S" diff --git a/apps/riscv-tests/isa/rv32ud/fmadd.S b/apps/riscv-tests/isa/rv32ud/fmadd.S new file mode 100644 index 0000000..e60934c --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fmadd.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fmadd.S" diff --git a/apps/riscv-tests/isa/rv32ud/fmin.S b/apps/riscv-tests/isa/rv32ud/fmin.S new file mode 100644 index 0000000..c80c880 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/fmin.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/fmin.S" diff --git a/apps/riscv-tests/isa/rv32ud/ldst.S b/apps/riscv-tests/isa/rv32ud/ldst.S new file mode 100644 index 0000000..e39fe30 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/ldst.S @@ -0,0 +1,42 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ldst.S +#----------------------------------------------------------------------------- +# +# This test verifies that flw, fld, fsw, and fsd work properly. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32UF +RVTEST_CODE_BEGIN + + la s0, tdat + TEST_CASE_D32(2, a0, a1, 0x40000000bf800000, fld f2, 0(s0); fsd f2, 16(s0); lw a0, 16(s0); lw a1, 20(s0)) + TEST_CASE_D32(3, a0, a1, 0x40000000bf800000, fld f2, 0(s0); fsw f2, 16(s0); lw a0, 16(s0); lw a1, 20(s0)) + TEST_CASE_D32(4, a0, a1, 0x40000000bf800000, flw f2, 0(s0); fsw f2, 16(s0); lw a0, 16(s0); lw a1, 20(s0)) + TEST_CASE_D32(5, a0, a1, 0xc080000040400000, fld f2, 8(s0); fsd f2, 16(s0); lw a0, 16(s0); lw a1, 20(s0)) + TEST_CASE_D32(6, a0, a1, 0xffffffff40400000, flw f2, 8(s0); fsd f2, 16(s0); lw a0, 16(s0); lw a1, 20(s0)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +.word 0xbf800000 +.word 0x40000000 +.word 0x40400000 +.word 0xc0800000 +.word 0xdeadbeef +.word 0xcafebabe +.word 0xabad1dea +.word 0x1337d00d + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32ud/move.S b/apps/riscv-tests/isa/rv32ud/move.S new file mode 100644 index 0000000..4551ffd --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/move.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64ud/move.S" diff --git a/apps/riscv-tests/isa/rv32ud/recoding.S b/apps/riscv-tests/isa/rv32ud/recoding.S new file mode 100644 index 0000000..5dc0113 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ud/recoding.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/recoding.S" diff --git a/apps/riscv-tests/isa/rv32uf/Makefrag b/apps/riscv-tests/isa/rv32uf/Makefrag new file mode 100644 index 0000000..7dde664 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/Makefrag @@ -0,0 +1,12 @@ +#======================================================================= +# Makefrag for rv32uf tests +#----------------------------------------------------------------------- + +rv32uf_sc_tests = \ + fadd fdiv fclass fcmp fcvt fcvt_w fmadd fmin \ + ldst move recoding \ + +rv32uf_p_tests = $(addprefix rv32uf-p-, $(rv32uf_sc_tests)) +rv32uf_v_tests = $(addprefix rv32uf-v-, $(rv32uf_sc_tests)) + +spike32_tests += $(rv32uf_p_tests) $(rv32uf_v_tests) diff --git a/apps/riscv-tests/isa/rv32uf/fadd.S b/apps/riscv-tests/isa/rv32uf/fadd.S new file mode 100644 index 0000000..b832c3d --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fadd.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fadd.S" diff --git a/apps/riscv-tests/isa/rv32uf/fclass.S b/apps/riscv-tests/isa/rv32uf/fclass.S new file mode 100644 index 0000000..19bbcc5 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fclass.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fclass.S" diff --git a/apps/riscv-tests/isa/rv32uf/fcmp.S b/apps/riscv-tests/isa/rv32uf/fcmp.S new file mode 100644 index 0000000..2dbf451 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fcmp.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fcmp.S" diff --git a/apps/riscv-tests/isa/rv32uf/fcvt.S b/apps/riscv-tests/isa/rv32uf/fcvt.S new file mode 100644 index 0000000..627f1f2 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fcvt.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fcvt.S" diff --git a/apps/riscv-tests/isa/rv32uf/fcvt_w.S b/apps/riscv-tests/isa/rv32uf/fcvt_w.S new file mode 100644 index 0000000..3447530 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fcvt_w.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fcvt_w.S" diff --git a/apps/riscv-tests/isa/rv32uf/fdiv.S b/apps/riscv-tests/isa/rv32uf/fdiv.S new file mode 100644 index 0000000..12aaa3d --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fdiv.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fdiv.S" diff --git a/apps/riscv-tests/isa/rv32uf/fmadd.S b/apps/riscv-tests/isa/rv32uf/fmadd.S new file mode 100644 index 0000000..8a5aacb --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fmadd.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fmadd.S" diff --git a/apps/riscv-tests/isa/rv32uf/fmin.S b/apps/riscv-tests/isa/rv32uf/fmin.S new file mode 100644 index 0000000..9231d01 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/fmin.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/fmin.S" diff --git a/apps/riscv-tests/isa/rv32uf/ldst.S b/apps/riscv-tests/isa/rv32uf/ldst.S new file mode 100644 index 0000000..01f7fef --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/ldst.S @@ -0,0 +1,38 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ldst.S +#----------------------------------------------------------------------------- +# +# This test verifies that flw, fld, fsw, and fsd work properly. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32UF +RVTEST_CODE_BEGIN + + TEST_CASE(2, a0, 0x40000000, la a1, tdat; flw f1, 4(a1); fsw f1, 20(a1); lw a0, 20(a1)) + TEST_CASE(3, a0, 0xbf800000, la a1, tdat; flw f1, 0(a1); fsw f1, 24(a1); lw a0, 24(a1)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +.word 0xbf800000 +.word 0x40000000 +.word 0x40400000 +.word 0xc0800000 +.word 0xdeadbeef +.word 0xcafebabe +.word 0xabad1dea +.word 0x1337d00d + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32uf/move.S b/apps/riscv-tests/isa/rv32uf/move.S new file mode 100644 index 0000000..949da6f --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/move.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/move.S" diff --git a/apps/riscv-tests/isa/rv32uf/recoding.S b/apps/riscv-tests/isa/rv32uf/recoding.S new file mode 100644 index 0000000..5dc0113 --- /dev/null +++ b/apps/riscv-tests/isa/rv32uf/recoding.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64UF +#define RVTEST_RV64UF RVTEST_RV32UF + +#include "../rv64uf/recoding.S" diff --git a/apps/riscv-tests/isa/rv32ui/Makefrag b/apps/riscv-tests/isa/rv32ui/Makefrag new file mode 100644 index 0000000..7903b15 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/Makefrag @@ -0,0 +1,27 @@ +#======================================================================= +# Makefrag for rv32ui tests +#----------------------------------------------------------------------- + +rv32ui_sc_tests = \ + simple \ + add addi \ + and andi \ + auipc \ + beq bge bgeu blt bltu bne \ + fence_i \ + jal jalr \ + lb lbu lh lhu lw \ + lui \ + or ori \ + sb sh sw \ + sll slli \ + slt slti sltiu sltu \ + sra srai \ + srl srli \ + sub \ + xor xori \ + +rv32ui_p_tests = $(addprefix rv32ui-p-, $(rv32ui_sc_tests)) +rv32ui_v_tests = $(addprefix rv32ui-v-, $(rv32ui_sc_tests)) + +spike32_tests += $(rv32ui_p_tests) $(rv32ui_v_tests) diff --git a/apps/riscv-tests/isa/rv32ui/add.S b/apps/riscv-tests/isa/rv32ui/add.S new file mode 100644 index 0000000..3ab883d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/add.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/add.S" diff --git a/apps/riscv-tests/isa/rv32ui/addi.S b/apps/riscv-tests/isa/rv32ui/addi.S new file mode 100644 index 0000000..fa80a68 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/addi.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/addi.S" diff --git a/apps/riscv-tests/isa/rv32ui/and.S b/apps/riscv-tests/isa/rv32ui/and.S new file mode 100644 index 0000000..4ee105b --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/and.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/and.S" diff --git a/apps/riscv-tests/isa/rv32ui/andi.S b/apps/riscv-tests/isa/rv32ui/andi.S new file mode 100644 index 0000000..e6b1529 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/andi.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/andi.S" diff --git a/apps/riscv-tests/isa/rv32ui/auipc.S b/apps/riscv-tests/isa/rv32ui/auipc.S new file mode 100644 index 0000000..0827f7d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/auipc.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/auipc.S" diff --git a/apps/riscv-tests/isa/rv32ui/beq.S b/apps/riscv-tests/isa/rv32ui/beq.S new file mode 100644 index 0000000..7c3996d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/beq.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/beq.S" diff --git a/apps/riscv-tests/isa/rv32ui/bge.S b/apps/riscv-tests/isa/rv32ui/bge.S new file mode 100644 index 0000000..d47c304 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/bge.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/bge.S" diff --git a/apps/riscv-tests/isa/rv32ui/bgeu.S b/apps/riscv-tests/isa/rv32ui/bgeu.S new file mode 100644 index 0000000..560ec45 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/bgeu.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/bgeu.S" diff --git a/apps/riscv-tests/isa/rv32ui/blt.S b/apps/riscv-tests/isa/rv32ui/blt.S new file mode 100644 index 0000000..72017dd --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/blt.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/blt.S" diff --git a/apps/riscv-tests/isa/rv32ui/bltu.S b/apps/riscv-tests/isa/rv32ui/bltu.S new file mode 100644 index 0000000..80f7468 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/bltu.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/bltu.S" diff --git a/apps/riscv-tests/isa/rv32ui/bne.S b/apps/riscv-tests/isa/rv32ui/bne.S new file mode 100644 index 0000000..ddb7d9f --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/bne.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/bne.S" diff --git a/apps/riscv-tests/isa/rv32ui/fence_i.S b/apps/riscv-tests/isa/rv32ui/fence_i.S new file mode 100644 index 0000000..cd1dbc3 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/fence_i.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/fence_i.S" diff --git a/apps/riscv-tests/isa/rv32ui/jal.S b/apps/riscv-tests/isa/rv32ui/jal.S new file mode 100644 index 0000000..93f407b --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/jal.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/jal.S" diff --git a/apps/riscv-tests/isa/rv32ui/jalr.S b/apps/riscv-tests/isa/rv32ui/jalr.S new file mode 100644 index 0000000..59f6425 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/jalr.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/jalr.S" diff --git a/apps/riscv-tests/isa/rv32ui/lb.S b/apps/riscv-tests/isa/rv32ui/lb.S new file mode 100644 index 0000000..6cf4d44 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/lb.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/lb.S" diff --git a/apps/riscv-tests/isa/rv32ui/lbu.S b/apps/riscv-tests/isa/rv32ui/lbu.S new file mode 100644 index 0000000..a479a0f --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/lbu.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/lbu.S" diff --git a/apps/riscv-tests/isa/rv32ui/lh.S b/apps/riscv-tests/isa/rv32ui/lh.S new file mode 100644 index 0000000..f1b2390 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/lh.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/lh.S" diff --git a/apps/riscv-tests/isa/rv32ui/lhu.S b/apps/riscv-tests/isa/rv32ui/lhu.S new file mode 100644 index 0000000..775765f --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/lhu.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/lhu.S" diff --git a/apps/riscv-tests/isa/rv32ui/lui.S b/apps/riscv-tests/isa/rv32ui/lui.S new file mode 100644 index 0000000..a127d61 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/lui.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/lui.S" diff --git a/apps/riscv-tests/isa/rv32ui/lw.S b/apps/riscv-tests/isa/rv32ui/lw.S new file mode 100644 index 0000000..3b747d8 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/lw.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/lw.S" diff --git a/apps/riscv-tests/isa/rv32ui/or.S b/apps/riscv-tests/isa/rv32ui/or.S new file mode 100644 index 0000000..1cf5674 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/or.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/or.S" diff --git a/apps/riscv-tests/isa/rv32ui/ori.S b/apps/riscv-tests/isa/rv32ui/ori.S new file mode 100644 index 0000000..3399649 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/ori.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/ori.S" diff --git a/apps/riscv-tests/isa/rv32ui/sb.S b/apps/riscv-tests/isa/rv32ui/sb.S new file mode 100644 index 0000000..b2f99ac --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sb.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sb.S" diff --git a/apps/riscv-tests/isa/rv32ui/sh.S b/apps/riscv-tests/isa/rv32ui/sh.S new file mode 100644 index 0000000..eb5a72d --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sh.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sh.S" diff --git a/apps/riscv-tests/isa/rv32ui/simple.S b/apps/riscv-tests/isa/rv32ui/simple.S new file mode 100644 index 0000000..20e5546 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/simple.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/simple.S" diff --git a/apps/riscv-tests/isa/rv32ui/sll.S b/apps/riscv-tests/isa/rv32ui/sll.S new file mode 100644 index 0000000..237df9e --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sll.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sll.S" diff --git a/apps/riscv-tests/isa/rv32ui/slli.S b/apps/riscv-tests/isa/rv32ui/slli.S new file mode 100644 index 0000000..5f950e1 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/slli.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/slli.S" diff --git a/apps/riscv-tests/isa/rv32ui/slt.S b/apps/riscv-tests/isa/rv32ui/slt.S new file mode 100644 index 0000000..64a3dd9 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/slt.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/slt.S" diff --git a/apps/riscv-tests/isa/rv32ui/slti.S b/apps/riscv-tests/isa/rv32ui/slti.S new file mode 100644 index 0000000..7484505 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/slti.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/slti.S" diff --git a/apps/riscv-tests/isa/rv32ui/sltiu.S b/apps/riscv-tests/isa/rv32ui/sltiu.S new file mode 100644 index 0000000..4185f9b --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sltiu.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sltiu.S" diff --git a/apps/riscv-tests/isa/rv32ui/sltu.S b/apps/riscv-tests/isa/rv32ui/sltu.S new file mode 100644 index 0000000..bd92b26 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sltu.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sltu.S" diff --git a/apps/riscv-tests/isa/rv32ui/sra.S b/apps/riscv-tests/isa/rv32ui/sra.S new file mode 100644 index 0000000..08abe19 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sra.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sra.S" diff --git a/apps/riscv-tests/isa/rv32ui/srai.S b/apps/riscv-tests/isa/rv32ui/srai.S new file mode 100644 index 0000000..b62a880 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/srai.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/srai.S" diff --git a/apps/riscv-tests/isa/rv32ui/srl.S b/apps/riscv-tests/isa/rv32ui/srl.S new file mode 100644 index 0000000..c0ac841 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/srl.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/srl.S" diff --git a/apps/riscv-tests/isa/rv32ui/srli.S b/apps/riscv-tests/isa/rv32ui/srli.S new file mode 100644 index 0000000..ef0203b --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/srli.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/srli.S" diff --git a/apps/riscv-tests/isa/rv32ui/sub.S b/apps/riscv-tests/isa/rv32ui/sub.S new file mode 100644 index 0000000..330f478 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sub.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sub.S" diff --git a/apps/riscv-tests/isa/rv32ui/sw.S b/apps/riscv-tests/isa/rv32ui/sw.S new file mode 100644 index 0000000..3098133 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/sw.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/sw.S" diff --git a/apps/riscv-tests/isa/rv32ui/xor.S b/apps/riscv-tests/isa/rv32ui/xor.S new file mode 100644 index 0000000..a9c1e41 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/xor.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/xor.S" diff --git a/apps/riscv-tests/isa/rv32ui/xori.S b/apps/riscv-tests/isa/rv32ui/xori.S new file mode 100644 index 0000000..9e71152 --- /dev/null +++ b/apps/riscv-tests/isa/rv32ui/xori.S @@ -0,0 +1,7 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64U +#define RVTEST_RV64U RVTEST_RV32U + +#include "../rv64ui/xori.S" diff --git a/apps/riscv-tests/isa/rv32um/Makefrag b/apps/riscv-tests/isa/rv32um/Makefrag new file mode 100644 index 0000000..1391c6a --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/Makefrag @@ -0,0 +1,13 @@ +#======================================================================= +# Makefrag for rv32um tests +#----------------------------------------------------------------------- + +rv32um_sc_tests = \ + div divu \ + mul mulh mulhsu mulhu \ + rem remu \ + +rv32um_p_tests = $(addprefix rv32um-p-, $(rv32um_sc_tests)) +rv32um_v_tests = $(addprefix rv32um-v-, $(rv32um_sc_tests)) + +spike32_tests += $(rv32um_p_tests) $(rv32um_v_tests) diff --git a/apps/riscv-tests/isa/rv32um/div.S b/apps/riscv-tests/isa/rv32um/div.S new file mode 100644 index 0000000..24dc9ff --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/div.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# div.S +#----------------------------------------------------------------------------- +# +# Test div instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, div, 3, 20, 6 ); + TEST_RR_OP( 3, div, -3, -20, 6 ); + TEST_RR_OP( 4, div, -3, 20, -6 ); + TEST_RR_OP( 5, div, 3, -20, -6 ); + + TEST_RR_OP( 6, div, -1<<31, -1<<31, 1 ); + TEST_RR_OP( 7, div, -1<<31, -1<<31, -1 ); + + TEST_RR_OP( 8, div, -1, -1<<31, 0 ); + TEST_RR_OP( 9, div, -1, 1, 0 ); + TEST_RR_OP(10, div, -1, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/divu.S b/apps/riscv-tests/isa/rv32um/divu.S new file mode 100644 index 0000000..cd348c9 --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/divu.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# divu.S +#----------------------------------------------------------------------------- +# +# Test divu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, divu, 3, 20, 6 ); + TEST_RR_OP( 3, divu, 715827879, -20, 6 ); + TEST_RR_OP( 4, divu, 0, 20, -6 ); + TEST_RR_OP( 5, divu, 0, -20, -6 ); + + TEST_RR_OP( 6, divu, -1<<31, -1<<31, 1 ); + TEST_RR_OP( 7, divu, 0, -1<<31, -1 ); + + TEST_RR_OP( 8, divu, -1, -1<<31, 0 ); + TEST_RR_OP( 9, divu, -1, 1, 0 ); + TEST_RR_OP(10, divu, -1, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/mul.S b/apps/riscv-tests/isa/rv32um/mul.S new file mode 100644 index 0000000..0368629 --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/mul.S @@ -0,0 +1,84 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mul.S +#----------------------------------------------------------------------------- +# +# Test mul instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP(32, mul, 0x00001200, 0x00007e00, 0xb6db6db7 ); + TEST_RR_OP(33, mul, 0x00001240, 0x00007fc0, 0xb6db6db7 ); + + TEST_RR_OP( 2, mul, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mul, 0x00000001, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mul, 0x00000015, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mul, 0x00000000, 0x00000000, 0xffff8000 ); + TEST_RR_OP( 6, mul, 0x00000000, 0x80000000, 0x00000000 ); + TEST_RR_OP( 7, mul, 0x00000000, 0x80000000, 0xffff8000 ); + + TEST_RR_OP(30, mul, 0x0000ff7f, 0xaaaaaaab, 0x0002fe7d ); + TEST_RR_OP(31, mul, 0x0000ff7f, 0x0002fe7d, 0xaaaaaaab ); + + TEST_RR_OP(34, mul, 0x00000000, 0xff000000, 0xff000000 ); + + TEST_RR_OP(35, mul, 0x00000001, 0xffffffff, 0xffffffff ); + TEST_RR_OP(36, mul, 0xffffffff, 0xffffffff, 0x00000001 ); + TEST_RR_OP(37, mul, 0xffffffff, 0x00000001, 0xffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mul, 143, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 9, mul, 154, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 10, mul, 169, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mul, 143, 13, 11 ); + TEST_RR_DEST_BYPASS( 12, 1, mul, 154, 14, 11 ); + TEST_RR_DEST_BYPASS( 13, 2, mul, 165, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mul, 143, 13, 11 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mul, 154, 14, 11 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mul, 165, 15, 11 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mul, 143, 13, 11 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mul, 154, 14, 11 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mul, 165, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mul, 143, 13, 11 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mul, 154, 14, 11 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mul, 165, 15, 11 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mul, 143, 13, 11 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mul, 154, 14, 11 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mul, 165, 15, 11 ); + + TEST_RR_ZEROSRC1( 26, mul, 0, 31 ); + TEST_RR_ZEROSRC2( 27, mul, 0, 32 ); + TEST_RR_ZEROSRC12( 28, mul, 0 ); + TEST_RR_ZERODEST( 29, mul, 33, 34 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/mulh.S b/apps/riscv-tests/isa/rv32um/mulh.S new file mode 100644 index 0000000..e583f5f --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/mulh.S @@ -0,0 +1,81 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulh.S +#----------------------------------------------------------------------------- +# +# Test mulh instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulh, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulh, 0x00000000, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulh, 0x00000000, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulh, 0x00000000, 0x00000000, 0xffff8000 ); + TEST_RR_OP( 6, mulh, 0x00000000, 0x80000000, 0x00000000 ); + TEST_RR_OP( 7, mulh, 0x00000000, 0x80000000, 0x00000000 ); + + TEST_RR_OP(30, mulh, 0xffff0081, 0xaaaaaaab, 0x0002fe7d ); + TEST_RR_OP(31, mulh, 0xffff0081, 0x0002fe7d, 0xaaaaaaab ); + + TEST_RR_OP(32, mulh, 0x00010000, 0xff000000, 0xff000000 ); + + TEST_RR_OP(33, mulh, 0x00000000, 0xffffffff, 0xffffffff ); + TEST_RR_OP(34, mulh, 0xffffffff, 0xffffffff, 0x00000001 ); + TEST_RR_OP(35, mulh, 0xffffffff, 0x00000001, 0xffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulh, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC2_EQ_DEST( 9, mulh, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_EQ_DEST( 10, mulh, 43264, 13<<20 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulh, 36608, 13<<20, 11<<20 ); + TEST_RR_DEST_BYPASS( 12, 1, mulh, 39424, 14<<20, 11<<20 ); + TEST_RR_DEST_BYPASS( 13, 2, mulh, 42240, 15<<20, 11<<20 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulh, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulh, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulh, 42240, 15<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulh, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulh, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulh, 42240, 15<<20, 11<<20 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulh, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulh, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulh, 42240, 15<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulh, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulh, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulh, 42240, 15<<20, 11<<20 ); + + TEST_RR_ZEROSRC1( 26, mulh, 0, 31<<26 ); + TEST_RR_ZEROSRC2( 27, mulh, 0, 32<<26 ); + TEST_RR_ZEROSRC12( 28, mulh, 0 ); + TEST_RR_ZERODEST( 29, mulh, 33<<20, 34<<20 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/mulhsu.S b/apps/riscv-tests/isa/rv32um/mulhsu.S new file mode 100644 index 0000000..28b3690 --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/mulhsu.S @@ -0,0 +1,83 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulhsu.S +#----------------------------------------------------------------------------- +# +# Test mulhsu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulhsu, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulhsu, 0x00000000, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulhsu, 0x00000000, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulhsu, 0x00000000, 0x00000000, 0xffff8000 ); + TEST_RR_OP( 6, mulhsu, 0x00000000, 0x80000000, 0x00000000 ); + TEST_RR_OP( 7, mulhsu, 0x80004000, 0x80000000, 0xffff8000 ); + + TEST_RR_OP(30, mulhsu, 0xffff0081, 0xaaaaaaab, 0x0002fe7d ); + TEST_RR_OP(31, mulhsu, 0x0001fefe, 0x0002fe7d, 0xaaaaaaab ); + + TEST_RR_OP(32, mulhsu, 0xff010000, 0xff000000, 0xff000000 ); + + TEST_RR_OP(33, mulhsu, 0xffffffff, 0xffffffff, 0xffffffff ); + TEST_RR_OP(34, mulhsu, 0xffffffff, 0xffffffff, 0x00000001 ); + TEST_RR_OP(35, mulhsu, 0x00000000, 0x00000001, 0xffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulhsu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC2_EQ_DEST( 9, mulhsu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_EQ_DEST( 10, mulhsu, 43264, 13<<20 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulhsu, 36608, 13<<20, 11<<20 ); + TEST_RR_DEST_BYPASS( 12, 1, mulhsu, 39424, 14<<20, 11<<20 ); + TEST_RR_DEST_BYPASS( 13, 2, mulhsu, 42240, 15<<20, 11<<20 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulhsu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulhsu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulhsu, 42240, 15<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulhsu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulhsu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulhsu, 42240, 15<<20, 11<<20 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulhsu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulhsu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulhsu, 42240, 15<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulhsu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulhsu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulhsu, 42240, 15<<20, 11<<20 ); + + TEST_RR_ZEROSRC1( 26, mulhsu, 0, 31<<26 ); + TEST_RR_ZEROSRC2( 27, mulhsu, 0, 32<<26 ); + TEST_RR_ZEROSRC12( 28, mulhsu, 0 ); + TEST_RR_ZERODEST( 29, mulhsu, 33<<20, 34<<20 ); + + + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/mulhu.S b/apps/riscv-tests/isa/rv32um/mulhu.S new file mode 100644 index 0000000..601dcff --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/mulhu.S @@ -0,0 +1,82 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulhu.S +#----------------------------------------------------------------------------- +# +# Test mulhu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulhu, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulhu, 0x00000000, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulhu, 0x00000000, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulhu, 0x00000000, 0x00000000, 0xffff8000 ); + TEST_RR_OP( 6, mulhu, 0x00000000, 0x80000000, 0x00000000 ); + TEST_RR_OP( 7, mulhu, 0x7fffc000, 0x80000000, 0xffff8000 ); + + TEST_RR_OP(30, mulhu, 0x0001fefe, 0xaaaaaaab, 0x0002fe7d ); + TEST_RR_OP(31, mulhu, 0x0001fefe, 0x0002fe7d, 0xaaaaaaab ); + + TEST_RR_OP(32, mulhu, 0xfe010000, 0xff000000, 0xff000000 ); + + TEST_RR_OP(33, mulhu, 0xfffffffe, 0xffffffff, 0xffffffff ); + TEST_RR_OP(34, mulhu, 0x00000000, 0xffffffff, 0x00000001 ); + TEST_RR_OP(35, mulhu, 0x00000000, 0x00000001, 0xffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulhu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC2_EQ_DEST( 9, mulhu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_EQ_DEST( 10, mulhu, 43264, 13<<20 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulhu, 36608, 13<<20, 11<<20 ); + TEST_RR_DEST_BYPASS( 12, 1, mulhu, 39424, 14<<20, 11<<20 ); + TEST_RR_DEST_BYPASS( 13, 2, mulhu, 42240, 15<<20, 11<<20 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulhu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulhu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulhu, 42240, 15<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulhu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulhu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulhu, 42240, 15<<20, 11<<20 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulhu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulhu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulhu, 42240, 15<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulhu, 36608, 13<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulhu, 39424, 14<<20, 11<<20 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulhu, 42240, 15<<20, 11<<20 ); + + TEST_RR_ZEROSRC1( 26, mulhu, 0, 31<<26 ); + TEST_RR_ZEROSRC2( 27, mulhu, 0, 32<<26 ); + TEST_RR_ZEROSRC12( 28, mulhu, 0 ); + TEST_RR_ZERODEST( 29, mulhu, 33<<20, 34<<20 ); + + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/rem.S b/apps/riscv-tests/isa/rv32um/rem.S new file mode 100644 index 0000000..7955736 --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/rem.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# rem.S +#----------------------------------------------------------------------------- +# +# Test rem instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, rem, 2, 20, 6 ); + TEST_RR_OP( 3, rem, -2, -20, 6 ); + TEST_RR_OP( 4, rem, 2, 20, -6 ); + TEST_RR_OP( 5, rem, -2, -20, -6 ); + + TEST_RR_OP( 6, rem, 0, -1<<31, 1 ); + TEST_RR_OP( 7, rem, 0, -1<<31, -1 ); + + TEST_RR_OP( 8, rem, -1<<31, -1<<31, 0 ); + TEST_RR_OP( 9, rem, 1, 1, 0 ); + TEST_RR_OP(10, rem, 0, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv32um/remu.S b/apps/riscv-tests/isa/rv32um/remu.S new file mode 100644 index 0000000..a96cfc1 --- /dev/null +++ b/apps/riscv-tests/isa/rv32um/remu.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# remu.S +#----------------------------------------------------------------------------- +# +# Test remu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV32U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, remu, 2, 20, 6 ); + TEST_RR_OP( 3, remu, 2, -20, 6 ); + TEST_RR_OP( 4, remu, 20, 20, -6 ); + TEST_RR_OP( 5, remu, -20, -20, -6 ); + + TEST_RR_OP( 6, remu, 0, -1<<31, 1 ); + TEST_RR_OP( 7, remu, -1<<31, -1<<31, -1 ); + + TEST_RR_OP( 8, remu, -1<<31, -1<<31, 0 ); + TEST_RR_OP( 9, remu, 1, 1, 0 ); + TEST_RR_OP(10, remu, 0, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64mi/Makefrag b/apps/riscv-tests/isa/rv64mi/Makefrag new file mode 100644 index 0000000..c81c24e --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/Makefrag @@ -0,0 +1,18 @@ +#======================================================================= +# Makefrag for rv64mi tests +#----------------------------------------------------------------------- + +rv64mi_sc_tests = \ + access \ + breakpoint \ + csr \ + mcsr \ + illegal \ + ma_fetch \ + ma_addr \ + scall \ + sbreak \ + +rv64mi_p_tests = $(addprefix rv64mi-p-, $(rv64mi_sc_tests)) + +spike_tests += $(rv64mi_p_tests) diff --git a/apps/riscv-tests/isa/rv64mi/access.S b/apps/riscv-tests/isa/rv64mi/access.S new file mode 100644 index 0000000..40a28d3 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/access.S @@ -0,0 +1,70 @@ +# See LICENSE for license details. + +#***************************************************************************** +# access.S +#----------------------------------------------------------------------------- +# +# Test access-exception behavior. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + .align 2 + + # Flipping just the MSB should result in an illegal address for RV64. + la t2, fail + li t0, 1 << (__riscv_xlen - 1) + xor t0, t0, t2 + + # jalr to an illegal address should commit (hence should write rd). + # after the pc is set to rs1, an access exception should be raised. + li TESTNUM, 2 + li t1, CAUSE_FETCH_ACCESS + la s1, 1f + li t2, 0 + jalr t2, t0 +1: + + # A load to an illegal address should not commit. + li TESTNUM, 3 + li t1, CAUSE_LOAD_ACCESS + la s1, 1f + mv t2, s1 + lb t2, (t0) + j fail +1: + + j pass + + TEST_PASSFAIL + + .align 2 + .global mtvec_handler +mtvec_handler: + li a0, 2 + beq TESTNUM, a0, 2f + li a0, 3 + beq TESTNUM, a0, 2f + j fail + +2: + bne t2, s1, fail + + csrr t2, mcause + bne t2, t1, fail + + csrw mepc, s1 + mret + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64mi/breakpoint.S b/apps/riscv-tests/isa/rv64mi/breakpoint.S new file mode 100644 index 0000000..252a696 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/breakpoint.S @@ -0,0 +1,129 @@ +# See LICENSE for license details. + +#***************************************************************************** +# breakpoint.S +#----------------------------------------------------------------------------- +# +# Test breakpoints, if they are implemented. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + # Set up breakpoint to trap on M-mode fetches. + li TESTNUM, 2 + + # Skip tselect if hard-wired. + csrw tselect, x0 + csrr a1, tselect + bne x0, a1, pass + + la a2, 1f + csrw tdata2, a2 + li a0, (2 << (__riscv_xlen - 4)) | MCONTROL_M | MCONTROL_EXECUTE + csrw tdata1, a0 + # Skip if breakpoint type is unsupported. + csrr a1, tdata1 + bne a0, a1, 2f + .align 2 +1: + # Trap handler should skip this instruction. + beqz x0, fail + + # Make sure reads don't trap. + li TESTNUM, 3 + lw a0, (a2) + +2: + # Set up breakpoint to trap on M-mode reads. + li TESTNUM, 4 + li a0, (2 << (__riscv_xlen - 4)) | MCONTROL_M | MCONTROL_LOAD + csrw tdata1, a0 + # Skip if breakpoint type is unsupported. + csrr a1, tdata1 + bne a0, a1, 2f + la a2, data1 + csrw tdata2, a2 + + # Trap handler should skip this instruction. + lw a2, (a2) + beqz a2, fail + + # Make sure writes don't trap. + li TESTNUM, 5 + sw x0, (a2) + +2: + # Set up breakpoint to trap on M-mode stores. + li TESTNUM, 6 + li a0, (2 << (__riscv_xlen - 4)) | MCONTROL_M | MCONTROL_STORE + csrw tdata1, a0 + # Skip if breakpoint type is unsupported. + csrr a1, tdata1 + bne a0, a1, 2f + + # Trap handler should skip this instruction. + sw a2, (a2) + + # Make sure store didn't succeed. + li TESTNUM, 7 + lw a2, (a2) + bnez a2, fail + + # Try to set up a second breakpoint. + li a0, 1 + csrw tselect, a0 + csrr a1, tselect + bne a0, a1, pass + + li a0, (2 << (__riscv_xlen - 4)) | MCONTROL_M | MCONTROL_LOAD + csrw tdata1, a0 + la a3, data2 + csrw tdata2, a3 + + # Make sure the second breakpoint triggers. + li TESTNUM, 8 + lw a3, (a3) + beqz a3, fail + + # Make sure the first breakpoint still triggers. + li TESTNUM, 10 + la a2, data1 + sw a2, (a2) + li TESTNUM, 11 + lw a2, (a2) + bnez a2, fail + +2: + TEST_PASSFAIL + + .align 2 + .global mtvec_handler +mtvec_handler: + # Only even-numbered tests should trap. + andi t0, TESTNUM, 1 + bnez t0, fail + + li t0, CAUSE_BREAKPOINT + csrr t1, mcause + bne t0, t1, fail + + csrr t0, mepc + addi t0, t0, 4 + csrw mepc, t0 + mret + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +data1: .word 0 +data2: .word 0 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64mi/csr.S b/apps/riscv-tests/isa/rv64mi/csr.S new file mode 100644 index 0000000..77e7619 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/csr.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV64M +#define __MACHINE_MODE + +#include "../rv64si/csr.S" diff --git a/apps/riscv-tests/isa/rv64mi/illegal.S b/apps/riscv-tests/isa/rv64mi/illegal.S new file mode 100644 index 0000000..5531570 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/illegal.S @@ -0,0 +1,195 @@ +# See LICENSE for license details. + +#***************************************************************************** +# illegal.S +#----------------------------------------------------------------------------- +# +# Test illegal instruction trap. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + .align 2 + .option norvc + + li TESTNUM, 2 +bad2: + .word 0 + j fail + + # Skip the rest of the test if S-mode is not present. + li t0, MSTATUS_MPP + csrc mstatus, t0 + li t1, (MSTATUS_MPP & -MSTATUS_MPP) * PRV_S + csrs mstatus, t1 + csrr t2, mstatus + and t2, t2, t0 + bne t1, t2, pass + + # Test vectored interrupts if they are supported. +test_vectored_interrupts: + csrwi mip, MIP_SSIP + csrwi mie, MIP_SSIP + la t0, mtvec_handler + 1 + csrrw s0, mtvec, t0 + csrr t0, mtvec + andi t0, t0, 1 + beqz t0, msip + csrsi mstatus, MSTATUS_MIE +1: + j 1b +msip: + csrw mtvec, s0 + + # Delegate supervisor software interrupts so WFI won't stall. + csrwi mideleg, MIP_SSIP + # Enter supervisor mode. + la t0, 1f + csrw mepc, t0 + li t0, MSTATUS_MPP + csrc mstatus, t0 + li t1, (MSTATUS_MPP & -MSTATUS_MPP) * PRV_S + csrs mstatus, t1 + mret + +1: + # Make sure WFI doesn't trap when TW=0. + wfi +bad3: + .word 0 + j fail + +bad4: + # Make sure WFI does trap when TW=1. + wfi + j fail + + # Make sure SFENCE.VMA and sptbr don't trap when TVM=0. + sfence.vma + csrr t0, sptbr +bad5: + .word 0 + j fail + +bad6: + # Make sure SFENCE.VMA and sptbr do trap when TVM=1. + sfence.vma + j fail +bad7: + csrr t0, sptbr + j fail + + # Make sure SRET doesn't trap when TSR=0. + la t0, bad8 + csrw sepc, t0 + li t0, SSTATUS_SPP + csrs sstatus, t0 + li t0, SSTATUS_SPIE + csrc sstatus, t0 + sret +bad8: + .word 0 + j fail + + # Make sure SRET does trap when TSR=1. + la t0, 1f + csrw sepc, t0 +bad9: + sret +1: + j fail + + TEST_PASSFAIL + + .align 8 + .global mtvec_handler +mtvec_handler: + j synchronous_exception + j msip + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + j fail + +synchronous_exception: + li t1, CAUSE_ILLEGAL_INSTRUCTION + csrr t0, mcause + bne t0, t1, fail + csrr t0, mepc + + # Make sure mtval contains either 0 or the instruction word. + csrr t2, mbadaddr + beqz t2, 1f + lhu t1, 0(t0) + xor t2, t2, t1 + lhu t1, 2(t0) + slli t1, t1, 16 + xor t2, t2, t1 + bnez t2, fail +1: + + la t1, bad2 + beq t0, t1, 2f + la t1, bad3 + beq t0, t1, 3f + la t1, bad4 + beq t0, t1, 4f + la t1, bad5 + beq t0, t1, 5f + la t1, bad6 + beq t0, t1, 6f + la t1, bad7 + beq t0, t1, 7f + la t1, bad8 + beq t0, t1, 8f + la t1, bad9 + beq t0, t1, 9f + j fail +2: +4: +6: +7: + addi t0, t0, 8 + csrw mepc, t0 + mret + +3: + li t1, MSTATUS_TW + csrs mstatus, t1 + j 2b + +5: + li t1, MSTATUS_TVM + csrs mstatus, t1 + j 2b + +8: + li t1, MSTATUS_TSR + csrs mstatus, t1 + j 2b + +9: + j 2b + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64mi/ma_addr.S b/apps/riscv-tests/isa/rv64mi/ma_addr.S new file mode 100644 index 0000000..721ac6a --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/ma_addr.S @@ -0,0 +1,126 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ma_addr.S +#----------------------------------------------------------------------------- +# +# Test misaligned ld/st trap. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + .align 2 + .option norvc + + la s0, data + + # indicate it's a load test + li s1, CAUSE_MISALIGNED_LOAD + +#define SEXT(x, n) ((-((x) >> ((n)-1)) << (n)) | ((x) & ((1 << (n))-1))) + +/* Check that a misaligned load either writes the correct value, or + takes an exception and performs no writeback. */ +#define MISALIGNED_LOAD_TEST(testnum, insn, base, offset, res) \ + li TESTNUM, testnum; \ + la t2, 1f; \ + addi t1, base, offset; \ + insn t1, offset(base); \ + li t2, res; \ + bne t1, t2, fail; \ +1: + + MISALIGNED_LOAD_TEST(2, lh, s0, 1, SEXT(0xbbcc, 16)) + MISALIGNED_LOAD_TEST(3, lhu, s0, 1, 0xbbcc) + MISALIGNED_LOAD_TEST(4, lw, s0, 1, SEXT(0x99aabbcc, 32)) + MISALIGNED_LOAD_TEST(5, lw, s0, 2, SEXT(0x8899aabb, 32)) + MISALIGNED_LOAD_TEST(6, lw, s0, 3, SEXT(0x778899aa, 32)) + +#if __riscv_xlen == 64 + MISALIGNED_LOAD_TEST(7, lwu, s0, 1, 0x99aabbcc) + MISALIGNED_LOAD_TEST(8, lwu, s0, 2, 0x8899aabb) + MISALIGNED_LOAD_TEST(9, lwu, s0, 3, 0x778899aa) + + MISALIGNED_LOAD_TEST(10, ld, s0, 1, 0x5566778899aabbcc) + MISALIGNED_LOAD_TEST(11, ld, s0, 2, 0x445566778899aabb) + MISALIGNED_LOAD_TEST(12, ld, s0, 3, 0x33445566778899aa) + MISALIGNED_LOAD_TEST(13, ld, s0, 4, 0x2233445566778899) + MISALIGNED_LOAD_TEST(14, ld, s0, 5, 0x1122334455667788) + MISALIGNED_LOAD_TEST(15, ld, s0, 6, 0xee11223344556677) + MISALIGNED_LOAD_TEST(16, ld, s0, 7, 0xffee112233445566) +#endif + + # indicate it's a store test + li s1, CAUSE_MISALIGNED_STORE + +/* Check that a misaligned store has some effect and takes no exception, + or takes no effect and generates an exception. This is not very + thorough. */ +#define MISALIGNED_STORE_TEST(testnum, insn, base, offset, size) \ + li TESTNUM, testnum; \ + la t2, 1f; \ + addi t1, base, offset; \ + insn x0, offset(base); \ + lb t1, (offset - 1)(base); \ + beqz t1, fail; \ + lb t1, (offset + size)(base); \ + beqz t1, fail; \ + lb t1, (offset + 0)(base); \ + bnez t1, fail; \ + lb t1, (offset + size - 1)(base); \ + bnez t1, fail; \ +1: + + MISALIGNED_STORE_TEST(22, sh, s0, 1, 2) + MISALIGNED_STORE_TEST(23, sw, s0, 5, 4) + MISALIGNED_STORE_TEST(24, sw, s0, 10, 4) + MISALIGNED_STORE_TEST(25, sw, s0, 15, 4) + +#if __riscv_xlen == 64 + MISALIGNED_STORE_TEST(26, sd, s0, 25, 8) + MISALIGNED_STORE_TEST(27, sd, s0, 34, 8) + MISALIGNED_STORE_TEST(28, sd, s0, 43, 8) + MISALIGNED_STORE_TEST(29, sd, s0, 52, 8) + MISALIGNED_STORE_TEST(30, sd, s0, 61, 8) + MISALIGNED_STORE_TEST(31, sd, s0, 70, 8) + MISALIGNED_STORE_TEST(32, sd, s0, 79, 8) +#endif + + TEST_PASSFAIL + + .align 3 + .global mtvec_handler +mtvec_handler: + csrr t0, mcause + bne t0, s1, fail + + csrr t0, mbadaddr + bne t0, t1, fail + + lb t0, (t0) + beqz t0, fail + + csrw mepc, t2 + mret + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + +data: + .align 3 +.word 0xaabbccdd +.word 0x66778899 +.word 0x22334455 +.word 0xeeffee11 +.fill 0xff, 1, 80 + + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64mi/ma_fetch.S b/apps/riscv-tests/isa/rv64mi/ma_fetch.S new file mode 100644 index 0000000..cfcb90c --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/ma_fetch.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV64M +#define __MACHINE_MODE + +#include "../rv64si/ma_fetch.S" diff --git a/apps/riscv-tests/isa/rv64mi/mcsr.S b/apps/riscv-tests/isa/rv64mi/mcsr.S new file mode 100644 index 0000000..e0256e7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/mcsr.S @@ -0,0 +1,45 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mcsr.S +#----------------------------------------------------------------------------- +# +# Test various M-mode CSRs. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + # Check that mcpuid reports the correct XLEN +#if __riscv_xlen == 64 + TEST_CASE(2, a0, 0x2, csrr a0, misa; srl a0, a0, 62) +#else + TEST_CASE(2, a0, 0x1, csrr a0, misa; srl a0, a0, 30) +#endif + + # Check that mhartid reports 0 + TEST_CASE(3, a0, 0x0, csrr a0, mhartid) + + # Check that reading the following CSRs doesn't cause an exception + csrr a0, mimpid + csrr a0, marchid + csrr a0, mvendorid + + # Check that writing hte following CSRs doesn't cause an exception + li t0, 0 + csrs mtvec, t0 + csrs mepc, t0 + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64mi/sbreak.S b/apps/riscv-tests/isa/rv64mi/sbreak.S new file mode 100644 index 0000000..f36a9f8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/sbreak.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV64M +#define __MACHINE_MODE + +#include "../rv64si/sbreak.S" diff --git a/apps/riscv-tests/isa/rv64mi/scall.S b/apps/riscv-tests/isa/rv64mi/scall.S new file mode 100644 index 0000000..22e9eb5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64mi/scall.S @@ -0,0 +1,8 @@ +# See LICENSE for license details. + +#include "riscv_test.h" +#undef RVTEST_RV64S +#define RVTEST_RV64S RVTEST_RV64M +#define __MACHINE_MODE + +#include "../rv64si/scall.S" diff --git a/apps/riscv-tests/isa/rv64si/Makefrag b/apps/riscv-tests/isa/rv64si/Makefrag new file mode 100644 index 0000000..f01a332 --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/Makefrag @@ -0,0 +1,16 @@ +#======================================================================= +# Makefrag for rv64si tests +#----------------------------------------------------------------------- + +rv64si_sc_tests = \ + csr \ + dirty \ + icache-alias \ + ma_fetch \ + scall \ + wfi \ + sbreak \ + +rv64si_p_tests = $(addprefix rv64si-p-, $(rv64si_sc_tests)) + +spike_tests += $(rv64si_p_tests) diff --git a/apps/riscv-tests/isa/rv64si/csr.S b/apps/riscv-tests/isa/rv64si/csr.S new file mode 100644 index 0000000..09494ef --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/csr.S @@ -0,0 +1,154 @@ +# See LICENSE for license details. + +#***************************************************************************** +# csr.S +#----------------------------------------------------------------------------- +# +# Test CSRRx and CSRRxI instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64S +RVTEST_CODE_BEGIN + +#ifdef __MACHINE_MODE + #define sscratch mscratch + #define sstatus mstatus + #define scause mcause + #define sepc mepc + #define sret mret + #define stvec_handler mtvec_handler + #undef SSTATUS_SPP + #define SSTATUS_SPP MSTATUS_MPP +#endif + + # For RV64, make sure UXL encodes RV64. (UXL does not exist for RV32.) +#if __riscv_xlen == 64 + # If running in M mode, use mstatus.MPP to check existence of U mode. + # Otherwise, if in S mode, then U mode must exist and we don't need to check. +#ifdef __MACHINE_MODE + li t0, MSTATUS_MPP + csrc mstatus, t0 + csrr t1, mstatus + and t0, t0, t1 + bnez t0, 1f +#endif + # If U mode is present, UXL should be 2 (XLEN = 64-bit) + TEST_CASE(18, a0, SSTATUS_UXL & (SSTATUS_UXL << 1), csrr a0, sstatus; li a1, SSTATUS_UXL; and a0, a0, a1) +#ifdef __MACHINE_MODE + j 2f +1: + # If U mode is not present, UXL should be 0 + TEST_CASE(19, a0, 0, csrr a0, sstatus; li a1, SSTATUS_UXL; and a0, a0, a1) +2: +#endif +#endif + + TEST_CASE(20, a0, 0, csrw sscratch, zero; csrr a0, sscratch); + TEST_CASE(21, a0, 0, csrrwi a0, sscratch, 0; csrrwi a0, sscratch, 0xF); + + csrwi sscratch, 3 + TEST_CASE( 2, a0, 3, csrr a0, sscratch); + TEST_CASE( 3, a1, 3, csrrci a1, sscratch, 1); + TEST_CASE( 4, a2, 2, csrrsi a2, sscratch, 4); + TEST_CASE( 5, a3, 6, csrrwi a3, sscratch, 2); + TEST_CASE( 6, a1, 2, li a0, 0xbad1dea; csrrw a1, sscratch, a0); + TEST_CASE( 7, a1, 0xbad1dea, li a0, 0x0001dea; csrrc a1, sscratch, a0); + TEST_CASE( 8, a1, 0xbad0000, li a0, 0x000beef; csrrs a1, sscratch, a0); + TEST_CASE( 9, a0, 0xbadbeef, li a0, 0xbad1dea; csrrw a0, sscratch, a0); + TEST_CASE(10, a0, 0xbad1dea, li a0, 0x0001dea; csrrc a0, sscratch, a0); + TEST_CASE(11, a0, 0xbad0000, li a0, 0x000beef; csrrs a0, sscratch, a0); + TEST_CASE(12, a0, 0xbadbeef, csrr a0, sscratch); + +#ifdef __MACHINE_MODE + # Is F extension present? + csrr a0, misa + andi a0, a0, (1 << ('F' - 'A')) + beqz a0, 1f + # If so, make sure FP stores have no effect when mstatus.FS is off. + li a1, MSTATUS_FS + csrs mstatus, a1 +#ifdef __riscv_flen + fmv.s.x f0, x0 + csrc mstatus, a1 + la a1, fsw_data + TEST_CASE(13, a0, 1, fsw f0, (a1); lw a0, (a1)); +#else + # Fail if this test is compiled without F but executed on a core with F. + TEST_CASE(13, zero, 1) +#endif +1: + + # Figure out if 'U' is set in misa + csrr a0, misa # a0 = csr(misa) + srli a0, a0, 20 # a0 = a0 >> 20 + andi a0, a0, 1 # a0 = a0 & 1 + beqz a0, finish # if no user mode, skip the rest of these checks +#endif /* __MACHINE_MODE */ + + # jump to user land + li t0, SSTATUS_SPP + csrc sstatus, t0 + la t0, 1f + csrw sepc, t0 + sret + 1: + + # Make sure writing the cycle counter causes an exception. + # Don't run in supervisor, as we don't delegate illegal instruction traps. +#ifdef __MACHINE_MODE + TEST_CASE(14, a0, 255, li a0, 255; csrrw a0, cycle, x0); +#endif + + # Make sure reading status in user mode causes an exception. + # Don't run in supervisor, as we don't delegate illegal instruction traps. +#ifdef __MACHINE_MODE + TEST_CASE(15, a0, 255, li a0, 255; csrr a0, sstatus) +#else + TEST_CASE(15, x0, 0, nop) +#endif + +finish: + RVTEST_PASS + + # We should only fall through to this if scall failed. + TEST_PASSFAIL + + .align 2 + .global stvec_handler +stvec_handler: + # Trapping on tests 13-15 is good news. + # Note that since the test didn't complete, TESTNUM is smaller by 1. + li t0, 12 + bltu TESTNUM, t0, 1f + li t0, 14 + bleu TESTNUM, t0, privileged +1: + + # catch RVTEST_PASS and kick it up to M-mode + csrr t0, scause + li t1, CAUSE_USER_ECALL + bne t0, t1, fail + RVTEST_PASS + +privileged: + # Make sure scause indicates a lack of privilege. + csrr t0, scause + li t1, CAUSE_ILLEGAL_INSTRUCTION + bne t0, t1, fail + # Return to user mode, but skip the trapping instruction. + csrr t0, sepc + addi t0, t0, 4 + csrw sepc, t0 + sret + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + +fsw_data: .word 1 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64si/dirty.S b/apps/riscv-tests/isa/rv64si/dirty.S new file mode 100644 index 0000000..15f3163 --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/dirty.S @@ -0,0 +1,133 @@ +# See LICENSE for license details. + +#***************************************************************************** +# dirty.S +#----------------------------------------------------------------------------- +# +# Test VM referenced and dirty bits. +# + +#include "riscv_test.h" +#include "test_macros.h" + +#if (DRAM_BASE >> 30 << 30) != DRAM_BASE +# error This test requires DRAM_BASE be SV39 superpage-aligned +#endif + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + # Turn on VM + li a0, (SATP_MODE & ~(SATP_MODE<<1)) * SATP_MODE_SV39 + la a1, page_table_1 + srl a1, a1, RISCV_PGSHIFT + or a1, a1, a0 + csrw sptbr, a1 + sfence.vma + + # Set up MPRV with MPP=S, so loads and stores use S-mode + li a1, ((MSTATUS_MPP & ~(MSTATUS_MPP<<1)) * PRV_S) | MSTATUS_MPRV + csrs mstatus, a1 + + # Try a faulting store to make sure dirty bit is not set + li TESTNUM, 2 + li t2, 1 + sw t2, dummy - DRAM_BASE, a0 + + # Set SUM=1 so user memory access is permitted + li TESTNUM, 3 + li a1, ((MSTATUS_MPP & ~(MSTATUS_MPP<<1)) * PRV_S) | MSTATUS_SUM + csrs mstatus, a1 + + # Make sure SUM=1 works + lw t0, dummy - DRAM_BASE + bnez t0, die + + # Try a non-faulting store to make sure dirty bit is set + sw t2, dummy - DRAM_BASE, a0 + + # Make sure it succeeded + lw t0, dummy - DRAM_BASE + bne t0, t2, die + + # Leave MPRV + li t0, MSTATUS_MPRV + csrc mstatus, t0 + + # Make sure D bit is set + lw t0, page_table_1 + li a0, PTE_A | PTE_D + and t0, t0, a0 + bne t0, a0, die + + # Enter MPRV again + li t0, MSTATUS_MPRV + csrs mstatus, t0 + + # Make sure that superpage entries trap when PPN LSBs are set. + li TESTNUM, 4 + lw a0, page_table_1 - DRAM_BASE + or a0, a0, 1 << PTE_PPN_SHIFT + sw a0, page_table_1 - DRAM_BASE, t0 + sfence.vma + sw a0, page_table_1 - DRAM_BASE, t0 + j die + + RVTEST_PASS + + TEST_PASSFAIL + + .align 2 + .global mtvec_handler +mtvec_handler: + csrr t0, mcause + add t0, t0, -CAUSE_STORE_PAGE_FAULT + bnez t0, die + + li t1, 2 + bne TESTNUM, t1, 1f + # Make sure D bit is clear + lw t0, page_table_1 + and t1, t0, PTE_D + bnez t1, die +skip: + csrr t0, mepc + add t0, t0, 4 + csrw mepc, t0 + mret + +1: + li t1, 3 + bne TESTNUM, t1, 1f + # The implementation doesn't appear to set D bits in HW. + # Make sure the D bit really is clear. + lw t0, page_table_1 + and t1, t0, PTE_D + bnez t1, die + # Set the D bit. + or t0, t0, PTE_D + sw t0, page_table_1, t1 + sfence.vma + mret + +1: + li t1, 4 + bne TESTNUM, t1, 1f + j pass + +1: +die: + RVTEST_FAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +.align 12 +page_table_1: .dword (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_U | PTE_R | PTE_W | PTE_X | PTE_A +dummy: .dword 0 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64si/icache-alias.S b/apps/riscv-tests/isa/rv64si/icache-alias.S new file mode 100644 index 0000000..9a8515e --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/icache-alias.S @@ -0,0 +1,141 @@ +# See LICENSE for license details. + +#***************************************************************************** +# icache-alias.S +#----------------------------------------------------------------------------- +# +# Test that instruction memory appears to be physically addressed, i.e., +# that disagreements in the low-order VPN and PPN bits don't cause the +# wrong instruction to be fetched. It also tests that changing a page +# mapping takes effect without executing FENCE.I. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64M +RVTEST_CODE_BEGIN + + li TESTNUM, 2 + + # Set up intermediate page tables + + la t0, page_table_3 + srl t0, t0, RISCV_PGSHIFT - PTE_PPN_SHIFT + ori t0, t0, PTE_V + sd t0, page_table_2, t1 + + la t0, page_table_2 + srl t0, t0, RISCV_PGSHIFT - PTE_PPN_SHIFT + ori t0, t0, PTE_V + sd t0, page_table_1, t1 + + # Set up leaf mappings where va[12] != pa[12] + + la t0, code_page_1 + srl t0, t0, RISCV_PGSHIFT - PTE_PPN_SHIFT + ori t0, t0, PTE_V | PTE_X | PTE_A + sd t0, page_table_3 + 8, t1 + + la t0, code_page_2 + srl t0, t0, RISCV_PGSHIFT - PTE_PPN_SHIFT + ori t0, t0, PTE_V | PTE_X | PTE_A + sd t0, page_table_3 + 0, t1 + + # Turn on VM + + li a0, (SATP_MODE & ~(SATP_MODE<<1)) * SATP_MODE_SV39 + la a1, page_table_1 + srl a1, a1, RISCV_PGSHIFT + or a1, a1, a0 + csrw sptbr, a1 + sfence.vma + + # Enter supervisor mode and make sure correct page is accessed + + la a2, 1f + csrwi mepc, 0 + li a1, ((MSTATUS_MPP & ~(MSTATUS_MPP<<1)) * PRV_S) + csrs mstatus, a1 + mret + +1: + li TESTNUM, 2 + addi a0, a0, -321 + bnez a0, fail + + li TESTNUM, 3 + la a2, 1f + li t0, RISCV_PGSIZE + csrw mepc, t0 + mret + +1: + addi a0, a0, -123 + bnez a0, fail + + li TESTNUM, 4 + la a2, 1f + csrwi mepc, 0 + mret + + .align 2 +1: + addi a0, a0, -321 + bnez a0, fail + + li TESTNUM, 5 + + # Change mapping and try again + + la t0, code_page_1 + srl t0, t0, RISCV_PGSHIFT - PTE_PPN_SHIFT + ori t0, t0, PTE_V | PTE_X | PTE_A + sd t0, page_table_3 + 0, t1 + sfence.vma + + la a2, 1f + csrwi mepc, 0 + mret + + .align 2 +1: + addi a0, a0, -123 + bnez a0, fail + + RVTEST_PASS + + TEST_PASSFAIL + + .align 2 + .global mtvec_handler +mtvec_handler: + csrr t0, mcause + add t0, t0, -CAUSE_STORE_PAGE_FAULT + bnez t0, fail + + jr a2 + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +.align 12 +page_table_1: .dword 0 +.align 12 +page_table_2: .dword 0 +.align 12 +page_table_3: .dword 0 +.align 13 +code_page_1: + li a0, 123 + sw x0, (x0) +.align 12 +code_page_2: + li a0, 321 + sw x0, (x0) + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64si/ma_fetch.S b/apps/riscv-tests/isa/rv64si/ma_fetch.S new file mode 100644 index 0000000..7d2adec --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/ma_fetch.S @@ -0,0 +1,204 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ma_fetch.S +#----------------------------------------------------------------------------- +# +# Test misaligned fetch trap. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64S +RVTEST_CODE_BEGIN + +#ifdef __MACHINE_MODE + #define sscratch mscratch + #define sstatus mstatus + #define scause mcause + #define sbadaddr mbadaddr + #define sepc mepc + #define sret mret + #define stvec_handler mtvec_handler +#endif + + .align 2 + .option norvc + + # Without RVC, the jalr should trap, and the handler will skip ahead. + # With RVC, the jalr should not trap, and "j fail" should get skipped. + li TESTNUM, 2 + li t1, 0 + la t0, 1f + jalr t1, t0, 2 +1: + .option rvc + c.j 1f + c.j 2f + .option norvc +1: + j fail +2: + + // This test should pass, since JALR ignores the target LSB + li TESTNUM, 3 + la t0, 1f + jalr t1, t0, 1 +1: + j 1f + j fail +1: + + li TESTNUM, 4 + li t1, 0 + la t0, 1f + jalr t1, t0, 3 +1: + .option rvc + c.j 1f + c.j 2f + .option norvc +1: + j fail +2: + + # Like test 2, but with jal instead of jalr. + li TESTNUM, 5 + li t1, 0 + la t0, 1f + jal t1, 2f +1: + .option rvc + c.j 1f +2: + c.j 2f + .option norvc +1: + j fail +2: + + # Like test 2, but with a taken branch instead of jalr. + li TESTNUM, 6 + li t1, 0 + la t0, 1f + beqz x0, 2f +1: + .option rvc + c.j 1f +2: + c.j 2f + .option norvc +1: + j fail +2: + + # Not-taken branches should not trap, even without RVC. + li TESTNUM, 7 + bnez x0, 1f + j 2f + .option rvc + c.j 1f +1: + c.j 1f + .option norvc +1: + j fail +2: + +#ifdef __MACHINE_MODE + # RVC cannot be disabled if doing so would cause a misaligned instruction + # exception on the next instruction fetch. (This test assumes no other + # extensions that support misalignment are present.) + li TESTNUM, 8 + csrr t2, misa + andi t2, t2, 1 << ('c' - 'a') + beqz t2, 2f + + .option rvc + c.nop + csrci misa, 1 << ('c' - 'a') +1: + c.nop + .option norvc + + csrr t2, misa + andi t2, t2, 1 << ('c' - 'a') + beqz t2, fail + + # When RVC is disabled, mret to a misaligned mepc should succeed, + # masking off mepc[1]. + la t0, 1f + addi t0, t0, -2 + csrw mepc, t0 + + # Try to disable RVC; if it can't be disabled, skip the test. + csrci misa, 1 << ('c' - 'a') + csrr t2, misa + andi t2, t2, 1 << ('c' - 'a') + bnez t2, 2f + + li t2, MSTATUS_MPP + csrs mstatus, t2 + mret + + # mret should transfer control to this branch. Otherwise, it will + # transfer control two bytes into the branch, which happens to be the + # illegal instruction c.unimp. + beqz x0, 1f +1: + csrsi misa, 1 << ('c' - 'a') +2: +#endif + + j pass + + TEST_PASSFAIL + + .align 2 + .global stvec_handler +stvec_handler: + # tests 2, 4, 5, 6, and 8 should trap + li a0, 2 + beq TESTNUM, a0, 1f + li a0, 4 + beq TESTNUM, a0, 1f + li a0, 5 + beq TESTNUM, a0, 1f + li a0, 6 + beq TESTNUM, a0, 1f + j fail +1: + + # verify that return address was not written + bnez t1, fail + + # verify trap cause + li a1, CAUSE_MISALIGNED_FETCH + csrr a0, scause + bne a0, a1, fail + + # verify that epc == &jalr (== t0 - 4) + csrr a1, sepc + addi a1, a1, 4 + bne t0, a1, fail + + # verify that badaddr == 0 or badaddr == t0+2. + csrr a0, sbadaddr + beqz a0, 1f + addi a0, a0, -2 + bne a0, t0, fail +1: + + addi a1, a1, 12 + csrw sepc, a1 + sret + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64si/sbreak.S b/apps/riscv-tests/isa/rv64si/sbreak.S new file mode 100644 index 0000000..31efff8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/sbreak.S @@ -0,0 +1,51 @@ +# See LICENSE for license details. + +#***************************************************************************** +# scall.S +#----------------------------------------------------------------------------- +# +# Test syscall trap. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64S +RVTEST_CODE_BEGIN + +#ifdef __MACHINE_MODE + #define sscratch mscratch + #define sstatus mstatus + #define scause mcause + #define sepc mepc + #define sret mret + #define stvec_handler mtvec_handler +#endif + + li TESTNUM, 2 + +do_break: + sbreak + j fail + + TEST_PASSFAIL + + .align 2 + .global stvec_handler +stvec_handler: + li t1, CAUSE_BREAKPOINT + csrr t0, scause + bne t0, t1, fail + la t1, do_break + csrr t0, sepc + bne t0, t1, fail + j pass + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64si/scall.S b/apps/riscv-tests/isa/rv64si/scall.S new file mode 100644 index 0000000..9956e03 --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/scall.S @@ -0,0 +1,83 @@ +# See LICENSE for license details. + +#***************************************************************************** +# scall.S +#----------------------------------------------------------------------------- +# +# Test syscall trap. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64S +RVTEST_CODE_BEGIN + +#ifdef __MACHINE_MODE + #define sscratch mscratch + #define sstatus mstatus + #define scause mcause + #define sepc mepc + #define sret mret + #define stvec_handler mtvec_handler + #undef SSTATUS_SPP + #define SSTATUS_SPP MSTATUS_MPP +#endif + + li TESTNUM, 2 + + # This is the expected trap code. + li t1, CAUSE_USER_ECALL + +#ifdef __MACHINE_MODE + # If running in M mode, use mstatus.MPP to check existence of U mode. + # Otherwise, if in S mode, then U mode must exist and we don't need to check. + li t0, MSTATUS_MPP + csrc mstatus, t0 + csrr t2, mstatus + and t0, t0, t2 + beqz t0, 1f + + # If U mode doesn't exist, mcause should indicate ECALL from M mode. + li t1, CAUSE_MACHINE_ECALL +#endif + +1: + li t0, SSTATUS_SPP + csrc sstatus, t0 + la t0, 1f + csrw sepc, t0 + sret +1: + + li TESTNUM, 1 +do_scall: + scall + j fail + + TEST_PASSFAIL + +# Depending on the test environment, the M-mode version of this test might +# not actually invoke the following handler. Instead, the usual ECALL +# handler in the test environment might detect the CAUSE_USER_ECALL or +# CAUSE_MACHINE_ECALL exception and mark the test as having passed. +# Either way, we'll get the coverage we desire: such a handler must check +# both mcause and TESTNUM, just like the following handler. + .align 2 + .global stvec_handler +stvec_handler: + csrr t0, scause + bne t0, t1, fail + la t2, do_scall + csrr t0, sepc + bne t0, t2, fail + j pass + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64si/wfi.S b/apps/riscv-tests/isa/rv64si/wfi.S new file mode 100644 index 0000000..0302034 --- /dev/null +++ b/apps/riscv-tests/isa/rv64si/wfi.S @@ -0,0 +1,33 @@ +# See LICENSE for license details. + +#***************************************************************************** +# wfi.S +#----------------------------------------------------------------------------- +# +# Test wait-for-interrupt instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64S +RVTEST_CODE_BEGIN + + # Make sure wfi doesn't halt the hart, even if interrupts are disabled + csrc sstatus, SSTATUS_SIE + csrs sie, SIP_SSIP + csrs sip, SIP_SSIP + wfi + + RVTEST_PASS + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ua/Makefrag b/apps/riscv-tests/isa/rv64ua/Makefrag new file mode 100644 index 0000000..3af8856 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/Makefrag @@ -0,0 +1,13 @@ +#======================================================================= +# Makefrag for rv64ua tests +#----------------------------------------------------------------------- + +rv64ua_sc_tests = \ + amoadd_d amoand_d amomax_d amomaxu_d amomin_d amominu_d amoor_d amoxor_d amoswap_d \ + amoadd_w amoand_w amomax_w amomaxu_w amomin_w amominu_w amoor_w amoxor_w amoswap_w \ + lrsc \ + +rv64ua_p_tests = $(addprefix rv64ua-p-, $(rv64ua_sc_tests)) +rv64ua_v_tests = $(addprefix rv64ua-v-, $(rv64ua_sc_tests)) + +spike_tests += $(rv64ua_p_tests) $(rv64ua_v_tests) diff --git a/apps/riscv-tests/isa/rv64ua/amoadd_d.S b/apps/riscv-tests/isa/rv64ua/amoadd_d.S new file mode 100644 index 0000000..05b2f38 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoadd_d.S @@ -0,0 +1,47 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoadd_d.S +#----------------------------------------------------------------------------- +# +# Test amoadd.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amoadd.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff7ffff800, ld a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xffffffff7ffff800, \ + amoadd.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffff7ffff000, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoadd_w.S b/apps/riscv-tests/isa/rv64ua/amoadd_w.S new file mode 100644 index 0000000..d076d45 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoadd_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoadd_w.S +#----------------------------------------------------------------------------- +# +# Test amoadd.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amoadd.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0x000000007ffff800, lw a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0x000000007ffff800, \ + li a1, 0xffffffff80000000; \ + amoadd.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xfffffffffffff800, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoand_d.S b/apps/riscv-tests/isa/rv64ua/amoand_d.S new file mode 100644 index 0000000..c1148c0 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoand_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoand_d.S +#----------------------------------------------------------------------------- +# +# Test amoand.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amoand.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff80000000, ld a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xffffffff80000000, \ + li a1, 0x0000000080000000; \ + amoand.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0x0000000080000000, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoand_w.S b/apps/riscv-tests/isa/rv64ua/amoand_w.S new file mode 100644 index 0000000..7fe3bd0 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoand_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoand.w.S +#----------------------------------------------------------------------------- +# +# Test amoand.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amoand.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff80000000, lw a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xffffffff80000000, \ + li a1, 0x0000000080000000; \ + amoand.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffff80000000, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amomax_d.S b/apps/riscv-tests/isa/rv64ua/amomax_d.S new file mode 100644 index 0000000..b7f8703 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amomax_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amomax_d.S +#----------------------------------------------------------------------------- +# +# Test amomax.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amomax.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, ld a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 1; \ + sd x0, 0(a3); \ + amomax.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 1, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amomax_w.S b/apps/riscv-tests/isa/rv64ua/amomax_w.S new file mode 100644 index 0000000..f986205 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amomax_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amomax_d.S +#----------------------------------------------------------------------------- +# +# Test amomax.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amomax.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, lw a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 1; \ + sw x0, 0(a3); \ + amomax.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 1, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amomaxu_d.S b/apps/riscv-tests/isa/rv64ua/amomaxu_d.S new file mode 100644 index 0000000..227ac4c --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amomaxu_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amomaxu_d.S +#----------------------------------------------------------------------------- +# +# Test amomaxu.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amomaxu.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, ld a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 0xffffffffffffffff; \ + sd x0, 0(a3); \ + amomaxu.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffffffffffff, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amomaxu_w.S b/apps/riscv-tests/isa/rv64ua/amomaxu_w.S new file mode 100644 index 0000000..eb27d07 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amomaxu_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amomaxu_d.S +#----------------------------------------------------------------------------- +# +# Test amomaxu.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amomaxu.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, lw a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 0xffffffffffffffff; \ + sw x0, 0(a3); \ + amomaxu.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffffffffffff, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amomin_d.S b/apps/riscv-tests/isa/rv64ua/amomin_d.S new file mode 100644 index 0000000..ee6bbf3 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amomin_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amomin_d.S +#----------------------------------------------------------------------------- +# +# Test amomin.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amomin.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff80000000, ld a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 0xffffffffffffffff; \ + sd x0, 0(a3); \ + amomin.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffffffffffff, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amomin_w.S b/apps/riscv-tests/isa/rv64ua/amomin_w.S new file mode 100644 index 0000000..1337d2c --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amomin_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amomin_d.S +#----------------------------------------------------------------------------- +# +# Test amomin.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amomin.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff80000000, lw a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 0xffffffffffffffff; \ + sw x0, 0(a3); \ + amomin.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffffffffffff, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amominu_d.S b/apps/riscv-tests/isa/rv64ua/amominu_d.S new file mode 100644 index 0000000..08bfb5b --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amominu_d.S @@ -0,0 +1,49 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amominu_d.S +#----------------------------------------------------------------------------- +# +# Test amominu.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amominu.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff80000000, ld a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 0xffffffffffffffff; \ + sd x0, 0(a3); \ + amominu.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 + diff --git a/apps/riscv-tests/isa/rv64ua/amominu_w.S b/apps/riscv-tests/isa/rv64ua/amominu_w.S new file mode 100644 index 0000000..f45f856 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amominu_w.S @@ -0,0 +1,49 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amominu_d.S +#----------------------------------------------------------------------------- +# +# Test amominu.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amominu.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xffffffff80000000, lw a5, 0(a3)) + + TEST_CASE(4, a4, 0, \ + li a1, 0xffffffffffffffff; \ + sw x0, 0(a3); \ + amominu.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 + diff --git a/apps/riscv-tests/isa/rv64ua/amoor_d.S b/apps/riscv-tests/isa/rv64ua/amoor_d.S new file mode 100644 index 0000000..6f71495 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoor_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoor_d.S +#----------------------------------------------------------------------------- +# +# Test amoor.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amoor.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, ld a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xfffffffffffff800, \ + li a1, 1; \ + amoor.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xfffffffffffff801, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoor_w.S b/apps/riscv-tests/isa/rv64ua/amoor_w.S new file mode 100644 index 0000000..e64b8c2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoor_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoor.w.S +#----------------------------------------------------------------------------- +# +# Test amoor.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amoor.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, lw a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xfffffffffffff800, \ + li a1, 1; \ + amoor.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xfffffffffffff801, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoswap_d.S b/apps/riscv-tests/isa/rv64ua/amoswap_d.S new file mode 100644 index 0000000..6b07d74 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoswap_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoswap.d.S +#----------------------------------------------------------------------------- +# +# Test amoswap.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amoswap.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, ld a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xfffffffffffff800, \ + li a1, 0x0000000080000000; \ + amoswap.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0x0000000080000000, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoswap_w.S b/apps/riscv-tests/isa/rv64ua/amoswap_w.S new file mode 100644 index 0000000..c4276dc --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoswap_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoswap_w.S +#----------------------------------------------------------------------------- +# +# Test amoswap.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amoswap.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0xfffffffffffff800, lw a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0xfffffffffffff800, \ + li a1, 0x0000000080000000; \ + amoswap.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffff80000000, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoxor_d.S b/apps/riscv-tests/isa/rv64ua/amoxor_d.S new file mode 100644 index 0000000..8305434 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoxor_d.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoxor_d.S +#----------------------------------------------------------------------------- +# +# Test amoxor.d instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sd a0, 0(a3); \ + amoxor.d a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0x000000007ffff800, ld a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0x000000007ffff800, \ + li a1, 1; \ + amoxor.d a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0x000000007ffff801, ld a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/amoxor_w.S b/apps/riscv-tests/isa/rv64ua/amoxor_w.S new file mode 100644 index 0000000..1b6fc48 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/amoxor_w.S @@ -0,0 +1,48 @@ +# See LICENSE for license details. + +#***************************************************************************** +# amoxor_w.S +#----------------------------------------------------------------------------- +# +# Test amoxor.w instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a4, 0xffffffff80000000, \ + li a0, 0xffffffff80000000; \ + li a1, 0xfffffffffffff800; \ + la a3, amo_operand; \ + sw a0, 0(a3); \ + amoxor.w a4, a1, 0(a3); \ + ) + + TEST_CASE(3, a5, 0x7ffff800, lw a5, 0(a3)) + + # try again after a cache miss + TEST_CASE(4, a4, 0x7ffff800, \ + li a1, 0xc0000001; \ + amoxor.w a4, a1, 0(a3); \ + ) + + TEST_CASE(5, a5, 0xffffffffbffff801, lw a5, 0(a3)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END + + .bss + .align 3 +amo_operand: + .dword 0 diff --git a/apps/riscv-tests/isa/rv64ua/lrsc.S b/apps/riscv-tests/isa/rv64ua/lrsc.S new file mode 100644 index 0000000..c7589d7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ua/lrsc.S @@ -0,0 +1,102 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lrsr.S +#----------------------------------------------------------------------------- +# +# Test LR/SC instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + +# get a unique core id +la a0, coreid +li a1, 1 +amoadd.w a2, a1, (a0) + +# for now, only run this on core 0 +1:li a3, 1 +bgeu a2, a3, 1b + +1: lw a1, (a0) +bltu a1, a3, 1b + +# make sure that sc without a reservation fails. +TEST_CASE( 2, a4, 1, \ + la a0, foo; \ + li a5, 0xdeadbeef; \ + sc.w a4, a5, (a0); \ +) + +# make sure the failing sc did not commit into memory +TEST_CASE( 3, a4, 0, \ + lw a4, foo; \ +) + +# make sure that sc with the wrong reservation fails. +# TODO is this actually mandatory behavior? +TEST_CASE( 4, a4, 1, \ + la a0, foo; \ + la a1, fooTest3; \ + lr.w a1, (a1); \ + sc.w a4, a1, (a0); \ +) + +#define LOG_ITERATIONS 10 + +# have each core add its coreid+1 to foo 1024 times +la a0, foo +li a1, 1<= 64 + TEST_INT_FP_OP_D(6, fcvt.d.l, 2.0, 2); + TEST_INT_FP_OP_D(7, fcvt.d.l, -2.0, -2); + + TEST_INT_FP_OP_D(8, fcvt.d.lu, 2.0, 2); + TEST_INT_FP_OP_D(9, fcvt.d.lu, 1.8446744073709552e19, -2); +#endif + + TEST_FCVT_S_D(10, -1.5, -1.5) + TEST_FCVT_D_S(11, -1.5, -1.5) + +#if __riscv_xlen >= 64 + TEST_CASE(12, a0, 0x7ff8000000000000, + la a1, test_data_22; + ld a2, 0(a1); + fmv.d.x f2, a2; + fcvt.s.d f2, f2; + fcvt.d.s f2, f2; + fmv.x.d a0, f2; + ) +#else + TEST_CASE_D32(12, a0, a1, 0x7ff8000000000000, + la a1, test_data_22; + fld f2, 0(a1); + fcvt.s.d f2, f2; + fcvt.d.s f2, f2; + fsd f2, 0(a1); + lw a0, 0(a1); + lw a1, 4(a1) + ) +#endif + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +test_data_22: + .dword 0x7ffcffffffff8004 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/fcvt_w.S b/apps/riscv-tests/isa/rv64ud/fcvt_w.S new file mode 100644 index 0000000..56cc29d --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/fcvt_w.S @@ -0,0 +1,114 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fcvt_w.S +#----------------------------------------------------------------------------- +# +# Test fcvt{wu|w|lu|l}.d instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_INT_OP_D( 2, fcvt.w.d, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_D( 3, fcvt.w.d, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_D( 4, fcvt.w.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D( 5, fcvt.w.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D( 6, fcvt.w.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D( 7, fcvt.w.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D( 8, fcvt.w.d, 0x10, -1<<31, -3e9, rtz); + TEST_FP_INT_OP_D( 9, fcvt.w.d, 0x10, (1<<31)-1, 3e9, rtz); + + TEST_FP_INT_OP_D(12, fcvt.wu.d, 0x10, 0, -3.0, rtz); + TEST_FP_INT_OP_D(13, fcvt.wu.d, 0x10, 0, -1.0, rtz); + TEST_FP_INT_OP_D(14, fcvt.wu.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(15, fcvt.wu.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(16, fcvt.wu.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(17, fcvt.wu.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(18, fcvt.wu.d, 0x10, 0, -3e9, rtz); + TEST_FP_INT_OP_D(19, fcvt.wu.d, 0x00, 0xffffffffb2d05e00, 3e9, rtz); + +#if __riscv_xlen >= 64 + TEST_FP_INT_OP_D(22, fcvt.l.d, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_D(23, fcvt.l.d, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_D(24, fcvt.l.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(25, fcvt.l.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(26, fcvt.l.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(27, fcvt.l.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(28, fcvt.l.d, 0x00,-3000000000, -3e9, rtz); + TEST_FP_INT_OP_D(29, fcvt.l.d, 0x00, 3000000000, 3e9, rtz); + TEST_FP_INT_OP_D(20, fcvt.l.d, 0x10, -1<<63,-3e19, rtz); + TEST_FP_INT_OP_D(21, fcvt.l.d, 0x10, (1<<63)-1, 3e19, rtz); + + TEST_FP_INT_OP_D(32, fcvt.lu.d, 0x10, 0, -3.0, rtz); + TEST_FP_INT_OP_D(33, fcvt.lu.d, 0x10, 0, -1.0, rtz); + TEST_FP_INT_OP_D(34, fcvt.lu.d, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_D(35, fcvt.lu.d, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_D(36, fcvt.lu.d, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_D(37, fcvt.lu.d, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_D(38, fcvt.lu.d, 0x10, 0, -3e9, rtz); + TEST_FP_INT_OP_D(39, fcvt.lu.d, 0x00, 3000000000, 3e9, rtz); +#endif + + # test negative NaN, negative infinity conversion + TEST_CASE(42, x1, 0x000000007fffffff, la x1, tdat_d; fld f1, 0(x1); fcvt.w.d x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE(43, x1, 0x7fffffffffffffff, la x1, tdat_d; fld f1, 0(x1); fcvt.l.d x1, f1) +#endif + TEST_CASE(44, x1, 0xffffffff80000000, la x1, tdat_d; fld f1, 16(x1); fcvt.w.d x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE(45, x1, 0x8000000000000000, la x1, tdat_d; fld f1, 16(x1); fcvt.l.d x1, f1) +#endif + + # test positive NaN, positive infinity conversion + TEST_CASE(52, x1, 0x000000007fffffff, la x1, tdat_d; fld f1, 8(x1); fcvt.w.d x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE(53, x1, 0x7fffffffffffffff, la x1, tdat_d; fld f1, 8(x1); fcvt.l.d x1, f1) +#endif + TEST_CASE(54, x1, 0x000000007fffffff, la x1, tdat_d; fld f1, 24(x1); fcvt.w.d x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE(55, x1, 0x7fffffffffffffff, la x1, tdat_d; fld f1, 24(x1); fcvt.l.d x1, f1) +#endif + + # test NaN, infinity conversions to unsigned integer + TEST_CASE(62, x1, 0xffffffffffffffff, la x1, tdat_d; fld f1, 0(x1); fcvt.wu.d x1, f1) + TEST_CASE(63, x1, 0xffffffffffffffff, la x1, tdat_d; fld f1, 8(x1); fcvt.wu.d x1, f1) + TEST_CASE(64, x1, 0, la x1, tdat_d; fld f1, 16(x1); fcvt.wu.d x1, f1) + TEST_CASE(65, x1, 0xffffffffffffffff, la x1, tdat_d; fld f1, 24(x1); fcvt.wu.d x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE(66, x1, 0xffffffffffffffff, la x1, tdat_d; fld f1, 0(x1); fcvt.lu.d x1, f1) + TEST_CASE(67, x1, 0xffffffffffffffff, la x1, tdat_d; fld f1, 8(x1); fcvt.lu.d x1, f1) + TEST_CASE(68, x1, 0, la x1, tdat_d; fld f1, 16(x1); fcvt.lu.d x1, f1) + TEST_CASE(69, x1, 0xffffffffffffffff, la x1, tdat_d; fld f1, 24(x1); fcvt.lu.d x1, f1) +#endif + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +# -NaN, NaN, -inf, +inf +tdat: +.word 0xffffffff +.word 0x7fffffff +.word 0xff800000 +.word 0x7f800000 + +tdat_d: +.dword 0xffffffffffffffff +.dword 0x7fffffffffffffff +.dword 0xfff0000000000000 +.dword 0x7ff0000000000000 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/fdiv.S b/apps/riscv-tests/isa/rv64ud/fdiv.S new file mode 100644 index 0000000..f985fa1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/fdiv.S @@ -0,0 +1,54 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fdiv.S +#----------------------------------------------------------------------------- +# +# Test f{div|sqrt}.d instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + +#if __riscv_xlen == 32 + # Replace the functions with the 32-bit variants defined in test_macros.h + #undef TEST_FP_OP2_D + #define TEST_FP_OP2_D TEST_FP_OP2_D32 + + #undef TEST_FP_OP1_D + #define TEST_FP_OP1_D TEST_FP_OP1_D32 + + #undef TEST_FP_OP1_D_DWORD_RESULT + #define TEST_FP_OP1_D_DWORD_RESULT TEST_FP_OP1_D32_DWORD_RESULT +#endif + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP2_D( 2, fdiv.d, 1, 1.1557273520668288, 3.14159265, 2.71828182 ); + TEST_FP_OP2_D( 3, fdiv.d, 1,-0.9991093838555584, -1234, 1235.1 ); + TEST_FP_OP2_D( 4, fdiv.d, 0, 3.14159265, 3.14159265, 1.0 ); + + TEST_FP_OP1_D( 5, fsqrt.d, 1, 1.7724538498928541, 3.14159265 ); + TEST_FP_OP1_D( 6, fsqrt.d, 0, 100, 10000 ); + + TEST_FP_OP1_D_DWORD_RESULT(16, fsqrt.d, 0x10, 0x7FF8000000000000, -1.0 ); + + TEST_FP_OP1_D( 7, fsqrt.d, 1, 13.076696830622021, 171.0); + + TEST_FP_OP1_D( 8, fsqrt.d, 1,0.00040099251863345283320230749702, 1.60795e-7); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/fmadd.S b/apps/riscv-tests/isa/rv64ud/fmadd.S new file mode 100644 index 0000000..1e3ba66 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/fmadd.S @@ -0,0 +1,51 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fmadd.S +#----------------------------------------------------------------------------- +# +# Test f[n]m{add|sub}.s and f[n]m{add|sub}.d instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + +#if __riscv_xlen == 32 + # Replace the function with the 32-bit variant defined in test_macros.h + #undef TEST_FP_OP3_D + #define TEST_FP_OP3_D TEST_FP_OP3_D32 +#endif + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP3_D( 2, fmadd.d, 0, 3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D( 3, fmadd.d, 1, 1236.1999999999999, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D( 4, fmadd.d, 0, -12.0, 2.0, -5.0, -2.0 ); + + TEST_FP_OP3_D( 5, fnmadd.d, 0, -3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D( 6, fnmadd.d, 1, -1236.1999999999999, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D( 7, fnmadd.d, 0, 12.0, 2.0, -5.0, -2.0 ); + + TEST_FP_OP3_D( 8, fmsub.d, 0, 1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D( 9, fmsub.d, 1, 1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D(10, fmsub.d, 0, -8.0, 2.0, -5.0, -2.0 ); + + TEST_FP_OP3_D(11, fnmsub.d, 0, -1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_D(12, fnmsub.d, 1, -1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_D(13, fnmsub.d, 0, 8.0, 2.0, -5.0, -2.0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/fmin.S b/apps/riscv-tests/isa/rv64ud/fmin.S new file mode 100644 index 0000000..8f270a5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/fmin.S @@ -0,0 +1,60 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fmin.S +#----------------------------------------------------------------------------- +# +# Test f{min|max}.d instructinos. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + +#if __riscv_xlen == 32 + # Replace the function with the 32-bit variant defined in test_macros.h + #undef TEST_FP_OP2_D + #define TEST_FP_OP2_D TEST_FP_OP2_D32 +#endif + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP2_D( 2, fmin.d, 0, 1.0, 2.5, 1.0 ); + TEST_FP_OP2_D( 3, fmin.d, 0, -1235.1, -1235.1, 1.1 ); + TEST_FP_OP2_D( 4, fmin.d, 0, -1235.1, 1.1, -1235.1 ); + TEST_FP_OP2_D( 5, fmin.d, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_D( 6, fmin.d, 0, 0.00000001, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D( 7, fmin.d, 0, -2.0, -1.0, -2.0 ); + + TEST_FP_OP2_D(12, fmax.d, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_D(13, fmax.d, 0, 1.1, -1235.1, 1.1 ); + TEST_FP_OP2_D(14, fmax.d, 0, 1.1, 1.1, -1235.1 ); + TEST_FP_OP2_D(15, fmax.d, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_D(16, fmax.d, 0, 3.14159265, 3.14159265, 0.00000001 ); + TEST_FP_OP2_D(17, fmax.d, 0, -1.0, -1.0, -2.0 ); + + # FMAX(sNaN, x) = x + TEST_FP_OP2_D(20, fmax.d, 0x10, 1.0, sNaN, 1.0); + # FMAX(qNaN, qNaN) = canonical NaN + TEST_FP_OP2_D(21, fmax.d, 0x00, qNaN, NaN, NaN); + + # -0.0 < +0.0 + TEST_FP_OP2_D(30, fmin.d, 0, -0.0, -0.0, 0.0 ); + TEST_FP_OP2_D(31, fmin.d, 0, -0.0, 0.0, -0.0 ); + TEST_FP_OP2_D(32, fmax.d, 0, 0.0, -0.0, 0.0 ); + TEST_FP_OP2_D(33, fmax.d, 0, 0.0, 0.0, -0.0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/ldst.S b/apps/riscv-tests/isa/rv64ud/ldst.S new file mode 100644 index 0000000..9629341 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/ldst.S @@ -0,0 +1,42 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ldst.S +#----------------------------------------------------------------------------- +# +# This test verifies that flw, fld, fsw, and fsd work properly. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + la s0, tdat + TEST_CASE(2, a0, 0x40000000bf800000, fld f2, 0(s0); fsd f2, 16(s0); ld a0, 16(s0)) + TEST_CASE(3, a0, 0x40000000bf800000, fld f2, 0(s0); fsw f2, 16(s0); ld a0, 16(s0)) + TEST_CASE(4, a0, 0x40000000bf800000, flw f2, 0(s0); fsw f2, 16(s0); ld a0, 16(s0)) + TEST_CASE(5, a0, 0xc080000040400000, fld f2, 8(s0); fsd f2, 16(s0); ld a0, 16(s0)) + TEST_CASE(6, a0, 0xffffffff40400000, flw f2, 8(s0); fsd f2, 16(s0); ld a0, 16(s0)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +.word 0xbf800000 +.word 0x40000000 +.word 0x40400000 +.word 0xc0800000 +.word 0xdeadbeef +.word 0xcafebabe +.word 0xabad1dea +.word 0x1337d00d + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/move.S b/apps/riscv-tests/isa/rv64ud/move.S new file mode 100644 index 0000000..8911d95 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/move.S @@ -0,0 +1,113 @@ +# See LICENSE for license details. + +#***************************************************************************** +# move.S +#----------------------------------------------------------------------------- +# +# This test verifies that fmv.d.x, fmv.x.d, and fsgnj[x|n].d work properly. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + +#TODO: make 32-bit compatible version +#define TEST_FSGNJD(n, insn, new_sign, rs1_sign, rs2_sign) \ + TEST_CASE(n, a0, 0x123456789abcdef0 | (-(new_sign) << 63), \ + li a1, ((rs1_sign) << 63) | 0x123456789abcdef0; \ + li a2, -(rs2_sign); \ + fmv.d.x f1, a1; \ + fmv.d.x f2, a2; \ + insn f0, f1, f2; \ + fmv.x.d a0, f0) + + TEST_FSGNJD(10, fsgnj.d, 0, 0, 0) + TEST_FSGNJD(11, fsgnj.d, 1, 0, 1) + TEST_FSGNJD(12, fsgnj.d, 0, 1, 0) + TEST_FSGNJD(13, fsgnj.d, 1, 1, 1) + + TEST_FSGNJD(20, fsgnjn.d, 1, 0, 0) + TEST_FSGNJD(21, fsgnjn.d, 0, 0, 1) + TEST_FSGNJD(22, fsgnjn.d, 1, 1, 0) + TEST_FSGNJD(23, fsgnjn.d, 0, 1, 1) + + TEST_FSGNJD(30, fsgnjx.d, 0, 0, 0) + TEST_FSGNJD(31, fsgnjx.d, 1, 0, 1) + TEST_FSGNJD(32, fsgnjx.d, 1, 1, 0) + TEST_FSGNJD(33, fsgnjx.d, 0, 1, 1) + +// Test fsgnj.s in conjunction with double-precision moves +#define TEST_FSGNJS(n, rd, rs1, rs2) \ + TEST_CASE(n, a0, (rd) | (-((rd) >> 31) << 32), \ + li a1, rs1; \ + li a2, rs2; \ + fmv.d.x f1, a1; \ + fmv.d.x f2, a2; \ + fsgnj.s f0, f1, f2; \ + fmv.x.s a0, f0); \ + TEST_CASE(1##n, a0, (rd) | 0xffffffff00000000, \ + li a1, rs1; \ + li a2, rs2; \ + fmv.d.x f1, a1; \ + fmv.d.x f2, a2; \ + fsgnj.s f0, f1, f2; \ + fmv.x.d a0, f0) + + TEST_FSGNJS(40, 0x7fc00000, 0x7ffffffe12345678, 0) + TEST_FSGNJS(41, 0x7fc00000, 0xfffffffe12345678, 0) + TEST_FSGNJS(42, 0x7fc00000, 0x7fffffff12345678, 0) + TEST_FSGNJS(43, 0x12345678, 0xffffffff12345678, 0) + + TEST_FSGNJS(50, 0x7fc00000, 0x7ffffffe12345678, 0x80000000) + TEST_FSGNJS(51, 0x7fc00000, 0xfffffffe12345678, 0x80000000) + TEST_FSGNJS(52, 0x7fc00000, 0x7fffffff12345678, 0x80000000) + TEST_FSGNJS(53, 0x12345678, 0xffffffff12345678, 0x80000000) + + TEST_FSGNJS(60, 0xffc00000, 0x7ffffffe12345678, 0xffffffff80000000) + TEST_FSGNJS(61, 0xffc00000, 0xfffffffe12345678, 0xffffffff80000000) + TEST_FSGNJS(62, 0x92345678, 0xffffffff12345678, 0xffffffff80000000) + TEST_FSGNJS(63, 0x12345678, 0xffffffff12345678, 0x7fffffff80000000) + +// Test fsgnj.d in conjunction with single-precision moves +#define TEST_FSGNJD_SP(n, isnan, rd, rs1, rs2) \ + TEST_CASE(n, a0, ((rd) & 0xffffffff) | (-(((rd) >> 31) & 1) << 32), \ + li a1, rs1; \ + li a2, rs2; \ + fmv.d.x f1, a1; \ + fmv.d.x f2, a2; \ + fsgnj.d f0, f1, f2; \ + feq.s a0, f0, f0; \ + addi a0, a0, -!(isnan); \ + bnez a0, 1f; \ + fmv.x.s a0, f0; \ + 1:); \ + TEST_CASE(1##n, a0, rd, \ + li a1, rs1; \ + li a2, rs2; \ + fmv.d.x f1, a1; \ + fmv.d.x f2, a2; \ + fsgnj.d f0, f1, f2; \ + fmv.x.d a0, f0; \ + 1:) + + TEST_FSGNJD_SP(70, 0, 0xffffffff11111111, 0xffffffff11111111, 0xffffffff11111111) + TEST_FSGNJD_SP(71, 1, 0x7fffffff11111111, 0xffffffff11111111, 0x7fffffff11111111) + TEST_FSGNJD_SP(72, 0, 0xffffffff11111111, 0xffffffff11111111, 0xffffffff91111111) + TEST_FSGNJD_SP(73, 0, 0xffffffff11111111, 0xffffffff11111111, 0x8000000000000000) + TEST_FSGNJD_SP(74, 0, 0xffffffff11111111, 0x7fffffff11111111, 0xffffffff11111111) + TEST_FSGNJD_SP(75, 1, 0x7fffffff11111111, 0x7fffffff11111111, 0x7fffffff11111111) + TEST_FSGNJD_SP(76, 0, 0xffffffff11111111, 0x7fffffff11111111, 0xffffffff91111111) + TEST_FSGNJD_SP(77, 0, 0xffffffff11111111, 0x7fffffff11111111, 0x8000000000000000) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/recoding.S b/apps/riscv-tests/isa/rv64ud/recoding.S new file mode 100644 index 0000000..69ad665 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/recoding.S @@ -0,0 +1,67 @@ +# See LICENSE for license details. + +#***************************************************************************** +# recoding.S +#----------------------------------------------------------------------------- +# +# Test corner cases of John Hauser's microarchitectural recoding scheme. +# There are twice as many recoded values as IEEE-754 values; some of these +# extras are redundant (e.g. Inf) and others are illegal (subnormals with +# too many bits set). +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + # Make sure infinities with different mantissas compare as equal. + fld f0, minf, a0 + fld f1, three, a0 + fmul.d f1, f1, f0 + TEST_CASE( 2, a0, 1, feq.d a0, f0, f1) + TEST_CASE( 3, a0, 1, fle.d a0, f0, f1) + TEST_CASE( 4, a0, 0, flt.d a0, f0, f1) + + # Likewise, but for zeroes. + fcvt.d.w f0, x0 + li a0, 1 + fcvt.d.w f1, a0 + fmul.d f1, f1, f0 + TEST_CASE(5, a0, 1, feq.d a0, f0, f1) + TEST_CASE(6, a0, 1, fle.d a0, f0, f1) + TEST_CASE(7, a0, 0, flt.d a0, f0, f1) + + # When converting small doubles to single-precision subnormals, + # ensure that the extra precision is discarded. + flw f0, big, a0 + fld f1, tiny, a0 + fcvt.s.d f1, f1 + fmul.s f0, f0, f1 + fmv.x.s a0, f0 + lw a1, small + TEST_CASE(10, a0, 0, sub a0, a0, a1) + + # Make sure FSD+FLD correctly saves and restores a single-precision value. + flw f0, three, a0 + fadd.s f1, f0, f0 + fadd.s f0, f0, f0 + fsd f0, tiny, a0 + fld f0, tiny, a0 + TEST_CASE(20, a0, 1, feq.s a0, f0, f1) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + +minf: .double -Inf +three: .double 3.0 +big: .float 1221 +small: .float 2.9133121e-37 +tiny: .double 2.3860049081905093e-40 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ud/structural.S b/apps/riscv-tests/isa/rv64ud/structural.S new file mode 100644 index 0000000..3cf87aa --- /dev/null +++ b/apps/riscv-tests/isa/rv64ud/structural.S @@ -0,0 +1,58 @@ +# See LICENSE for license details. + +#***************************************************************************** +# structural.S +#----------------------------------------------------------------------------- +# +# This test verifies that the FPU correctly obviates structural hazards on its +# writeback port (e.g. fadd followed by fsgnj) +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + +li x12, 1 + +li x2, 0x3FF0000000000000 +li x1, 0x3F800000 + +#define TEST(nops, errcode) \ + fmv.d.x f4, x0 ;\ + fmv.s.x f3, x0 ;\ + fmv.d.x f2, x2 ;\ + fmv.s.x f1, x1 ;\ + j 1f ;\ + .align 5 ;\ +1:fmul.d f4, f2, f2 ;\ + nops ;\ + fsgnj.s f3, f1, f1 ;\ + fmv.x.d x4, f4 ;\ + fmv.x.s x5, f3 ;\ + beq x1, x5, 2f ;\ + RVTEST_FAIL ;\ +2:beq x2, x4, 2f ;\ + RVTEST_FAIL; \ +2:fmv.d.x f2, zero ;\ + fmv.s.x f1, zero ;\ + +TEST(;,2) +TEST(nop,4) +TEST(nop;nop,6) +TEST(nop;nop;nop,8) +TEST(nop;nop;nop;nop,10) +TEST(nop;nop;nop;nop;nop,12) +TEST(nop;nop;nop;nop;nop;nop,14) + +RVTEST_PASS + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/Makefrag b/apps/riscv-tests/isa/rv64uf/Makefrag new file mode 100644 index 0000000..33c11db --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/Makefrag @@ -0,0 +1,12 @@ +#======================================================================= +# Makefrag for rv64uf tests +#----------------------------------------------------------------------- + +rv64uf_sc_tests = \ + fadd fdiv fclass fcmp fcvt fcvt_w fmadd fmin \ + ldst move recoding \ + +rv64uf_p_tests = $(addprefix rv64uf-p-, $(rv64uf_sc_tests)) +rv64uf_v_tests = $(addprefix rv64uf-v-, $(rv64uf_sc_tests)) + +spike_tests += $(rv64uf_p_tests) $(rv64uf_v_tests) diff --git a/apps/riscv-tests/isa/rv64uf/fadd.S b/apps/riscv-tests/isa/rv64uf/fadd.S new file mode 100644 index 0000000..b6259df --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fadd.S @@ -0,0 +1,44 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fadd.S +#----------------------------------------------------------------------------- +# +# Test f{add|sub|mul}.s instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP2_S( 2, fadd.s, 0, 3.5, 2.5, 1.0 ); + TEST_FP_OP2_S( 3, fadd.s, 1, -1234, -1235.1, 1.1 ); + TEST_FP_OP2_S( 4, fadd.s, 1, 3.14159265, 3.14159265, 0.00000001 ); + + TEST_FP_OP2_S( 5, fsub.s, 0, 1.5, 2.5, 1.0 ); + TEST_FP_OP2_S( 6, fsub.s, 1, -1234, -1235.1, -1.1 ); + TEST_FP_OP2_S( 7, fsub.s, 1, 3.14159265, 3.14159265, 0.00000001 ); + + TEST_FP_OP2_S( 8, fmul.s, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_S( 9, fmul.s, 1, 1358.61, -1235.1, -1.1 ); + TEST_FP_OP2_S(10, fmul.s, 1, 3.14159265e-8, 3.14159265, 0.00000001 ); + + # Is the canonical NaN generated for Inf - Inf? + TEST_FP_OP2_S(11, fsub.s, 0x10, qNaNf, Inf, Inf); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fclass.S b/apps/riscv-tests/isa/rv64uf/fclass.S new file mode 100644 index 0000000..9bb86b1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fclass.S @@ -0,0 +1,40 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fclass.S +#----------------------------------------------------------------------------- +# +# Test fclass.s instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FCLASS_S( 2, 1 << 0, 0xff800000 ) + TEST_FCLASS_S( 3, 1 << 1, 0xbf800000 ) + TEST_FCLASS_S( 4, 1 << 2, 0x807fffff ) + TEST_FCLASS_S( 5, 1 << 3, 0x80000000 ) + TEST_FCLASS_S( 6, 1 << 4, 0x00000000 ) + TEST_FCLASS_S( 7, 1 << 5, 0x007fffff ) + TEST_FCLASS_S( 8, 1 << 6, 0x3f800000 ) + TEST_FCLASS_S( 9, 1 << 7, 0x7f800000 ) + TEST_FCLASS_S(10, 1 << 8, 0x7f800001 ) + TEST_FCLASS_S(11, 1 << 9, 0x7fc00000 ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fcmp.S b/apps/riscv-tests/isa/rv64uf/fcmp.S new file mode 100644 index 0000000..2d7fcc2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fcmp.S @@ -0,0 +1,50 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fcmp.S +#----------------------------------------------------------------------------- +# +# Test f{eq|lt|le}.s instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_CMP_OP_S( 2, feq.s, 0x00, 1, -1.36, -1.36) + TEST_FP_CMP_OP_S( 3, fle.s, 0x00, 1, -1.36, -1.36) + TEST_FP_CMP_OP_S( 4, flt.s, 0x00, 0, -1.36, -1.36) + + TEST_FP_CMP_OP_S( 5, feq.s, 0x00, 0, -1.37, -1.36) + TEST_FP_CMP_OP_S( 6, fle.s, 0x00, 1, -1.37, -1.36) + TEST_FP_CMP_OP_S( 7, flt.s, 0x00, 1, -1.37, -1.36) + + # Only sNaN should signal invalid for feq. + TEST_FP_CMP_OP_S( 8, feq.s, 0x00, 0, NaN, 0) + TEST_FP_CMP_OP_S( 9, feq.s, 0x00, 0, NaN, NaN) + TEST_FP_CMP_OP_S(10, feq.s, 0x10, 0, sNaNf, 0) + + # qNaN should signal invalid for fle/flt. + TEST_FP_CMP_OP_S(11, flt.s, 0x10, 0, NaN, 0) + TEST_FP_CMP_OP_S(12, flt.s, 0x10, 0, NaN, NaN) + TEST_FP_CMP_OP_S(13, flt.s, 0x10, 0, sNaNf, 0) + TEST_FP_CMP_OP_S(14, fle.s, 0x10, 0, NaN, 0) + TEST_FP_CMP_OP_S(15, fle.s, 0x10, 0, NaN, NaN) + TEST_FP_CMP_OP_S(16, fle.s, 0x10, 0, sNaNf, 0) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fcvt.S b/apps/riscv-tests/isa/rv64uf/fcvt.S new file mode 100644 index 0000000..a41686e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fcvt.S @@ -0,0 +1,43 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fcvt.S +#----------------------------------------------------------------------------- +# +# Test fcvt.s.{wu|w|lu|l}, fcvt.s.d, and fcvt.d.s instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_INT_FP_OP_S( 2, fcvt.s.w, 2.0, 2); + TEST_INT_FP_OP_S( 3, fcvt.s.w, -2.0, -2); + + TEST_INT_FP_OP_S( 4, fcvt.s.wu, 2.0, 2); + TEST_INT_FP_OP_S( 5, fcvt.s.wu, 4.2949673e9, -2); + +#if __riscv_xlen >= 64 + TEST_INT_FP_OP_S( 6, fcvt.s.l, 2.0, 2); + TEST_INT_FP_OP_S( 7, fcvt.s.l, -2.0, -2); + + TEST_INT_FP_OP_S( 8, fcvt.s.lu, 2.0, 2); + TEST_INT_FP_OP_S( 9, fcvt.s.lu, 1.8446744e19, -2); +#endif + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fcvt_w.S b/apps/riscv-tests/isa/rv64uf/fcvt_w.S new file mode 100644 index 0000000..cad5cba --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fcvt_w.S @@ -0,0 +1,105 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fcvt_w.S +#----------------------------------------------------------------------------- +# +# Test fcvt{wu|w|lu|l}.s instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_INT_OP_S( 2, fcvt.w.s, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_S( 3, fcvt.w.s, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_S( 4, fcvt.w.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S( 5, fcvt.w.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S( 6, fcvt.w.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S( 7, fcvt.w.s, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_S( 8, fcvt.w.s, 0x10, -1<<31, -3e9, rtz); + TEST_FP_INT_OP_S( 9, fcvt.w.s, 0x10, (1<<31)-1, 3e9, rtz); + + TEST_FP_INT_OP_S(12, fcvt.wu.s, 0x10, 0, -3.0, rtz); + TEST_FP_INT_OP_S(13, fcvt.wu.s, 0x10, 0, -1.0, rtz); + TEST_FP_INT_OP_S(14, fcvt.wu.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S(15, fcvt.wu.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S(16, fcvt.wu.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S(17, fcvt.wu.s, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_S(18, fcvt.wu.s, 0x10, 0, -3e9, rtz); + TEST_FP_INT_OP_S(19, fcvt.wu.s, 0x00, 3000000000, 3e9, rtz); + +#if __riscv_xlen >= 64 + TEST_FP_INT_OP_S(22, fcvt.l.s, 0x01, -1, -1.1, rtz); + TEST_FP_INT_OP_S(23, fcvt.l.s, 0x00, -1, -1.0, rtz); + TEST_FP_INT_OP_S(24, fcvt.l.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S(25, fcvt.l.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S(26, fcvt.l.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S(27, fcvt.l.s, 0x01, 1, 1.1, rtz); + + TEST_FP_INT_OP_S(32, fcvt.lu.s, 0x10, 0, -3.0, rtz); + TEST_FP_INT_OP_S(33, fcvt.lu.s, 0x10, 0, -1.0, rtz); + TEST_FP_INT_OP_S(34, fcvt.lu.s, 0x01, 0, -0.9, rtz); + TEST_FP_INT_OP_S(35, fcvt.lu.s, 0x01, 0, 0.9, rtz); + TEST_FP_INT_OP_S(36, fcvt.lu.s, 0x00, 1, 1.0, rtz); + TEST_FP_INT_OP_S(37, fcvt.lu.s, 0x01, 1, 1.1, rtz); + TEST_FP_INT_OP_S(38, fcvt.lu.s, 0x10, 0, -3e9, rtz); +#endif + + # test negative NaN, negative infinity conversion + TEST_CASE( 42, x1, 0x000000007fffffff, la x1, tdat ; flw f1, 0(x1); fcvt.w.s x1, f1) + TEST_CASE( 44, x1, 0xffffffff80000000, la x1, tdat ; flw f1, 8(x1); fcvt.w.s x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE( 43, x1, 0x7fffffffffffffff, la x1, tdat ; flw f1, 0(x1); fcvt.l.s x1, f1) + TEST_CASE( 45, x1, 0x8000000000000000, la x1, tdat ; flw f1, 8(x1); fcvt.l.s x1, f1) +#endif + + # test positive NaN, positive infinity conversion + TEST_CASE( 52, x1, 0x000000007fffffff, la x1, tdat ; flw f1, 4(x1); fcvt.w.s x1, f1) + TEST_CASE( 54, x1, 0x000000007fffffff, la x1, tdat ; flw f1, 12(x1); fcvt.w.s x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE( 53, x1, 0x7fffffffffffffff, la x1, tdat ; flw f1, 4(x1); fcvt.l.s x1, f1) + TEST_CASE( 55, x1, 0x7fffffffffffffff, la x1, tdat ; flw f1, 12(x1); fcvt.l.s x1, f1) +#endif + + # test NaN, infinity conversions to unsigned integer + TEST_CASE( 62, x1, 0xffffffffffffffff, la x1, tdat ; flw f1, 0(x1); fcvt.wu.s x1, f1) + TEST_CASE( 63, x1, 0xffffffffffffffff, la x1, tdat ; flw f1, 4(x1); fcvt.wu.s x1, f1) + TEST_CASE( 64, x1, 0, la x1, tdat ; flw f1, 8(x1); fcvt.wu.s x1, f1) + TEST_CASE( 65, x1, 0xffffffffffffffff, la x1, tdat ; flw f1, 12(x1); fcvt.wu.s x1, f1) +#if __riscv_xlen >= 64 + TEST_CASE( 66, x1, 0xffffffffffffffff, la x1, tdat ; flw f1, 0(x1); fcvt.lu.s x1, f1) + TEST_CASE( 67, x1, 0xffffffffffffffff, la x1, tdat ; flw f1, 4(x1); fcvt.lu.s x1, f1) + TEST_CASE( 68, x1, 0, la x1, tdat ; flw f1, 8(x1); fcvt.lu.s x1, f1) + TEST_CASE( 69, x1, 0xffffffffffffffff, la x1, tdat ; flw f1, 12(x1); fcvt.lu.s x1, f1) +#endif + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +# -NaN, NaN, -inf, +inf +tdat: +.word 0xffffffff +.word 0x7fffffff +.word 0xff800000 +.word 0x7f800000 + +tdat_d: +.dword 0xffffffffffffffff +.dword 0x7fffffffffffffff +.dword 0xfff0000000000000 +.dword 0x7ff0000000000000 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fdiv.S b/apps/riscv-tests/isa/rv64uf/fdiv.S new file mode 100644 index 0000000..a75a23d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fdiv.S @@ -0,0 +1,40 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fdiv.S +#----------------------------------------------------------------------------- +# +# Test f{div|sqrt}.s instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP2_S(2, fdiv.s, 1, 1.1557273520668288, 3.14159265, 2.71828182 ); + TEST_FP_OP2_S(3, fdiv.s, 1,-0.9991093838555584, -1234, 1235.1 ); + TEST_FP_OP2_S(4, fdiv.s, 0, 3.14159265, 3.14159265, 1.0 ); + + TEST_FP_OP1_S(5, fsqrt.s, 1, 1.7724538498928541, 3.14159265 ); + TEST_FP_OP1_S(6, fsqrt.s, 0, 100, 10000 ); + + TEST_FP_OP1_S_DWORD_RESULT(7, fsqrt.s, 0x10, 0x7FC00000, -1.0 ); + + TEST_FP_OP1_S(8, fsqrt.s, 1, 13.076696, 171.0); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fmadd.S b/apps/riscv-tests/isa/rv64uf/fmadd.S new file mode 100644 index 0000000..241bead --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fmadd.S @@ -0,0 +1,45 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fmadd.S +#----------------------------------------------------------------------------- +# +# Test f[n]m{add|sub}.s and f[n]m{add|sub}.d instructions. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP3_S( 2, fmadd.s, 0, 3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S( 3, fmadd.s, 1, 1236.2, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S( 4, fmadd.s, 0, -12.0, 2.0, -5.0, -2.0 ); + + TEST_FP_OP3_S( 5, fnmadd.s, 0, -3.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S( 6, fnmadd.s, 1, -1236.2, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S( 7, fnmadd.s, 0, 12.0, 2.0, -5.0, -2.0 ); + + TEST_FP_OP3_S( 8, fmsub.s, 0, 1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S( 9, fmsub.s, 1, 1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S(10, fmsub.s, 0, -8.0, 2.0, -5.0, -2.0 ); + + TEST_FP_OP3_S(11, fnmsub.s, 0, -1.5, 1.0, 2.5, 1.0 ); + TEST_FP_OP3_S(12, fnmsub.s, 1, -1234, -1.0, -1235.1, 1.1 ); + TEST_FP_OP3_S(13, fnmsub.s, 0, 8.0, 2.0, -5.0, -2.0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/fmin.S b/apps/riscv-tests/isa/rv64uf/fmin.S new file mode 100644 index 0000000..1f97533 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/fmin.S @@ -0,0 +1,54 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fmin.S +#----------------------------------------------------------------------------- +# +# Test f{min|max}.s instructinos. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_FP_OP2_S( 2, fmin.s, 0, 1.0, 2.5, 1.0 ); + TEST_FP_OP2_S( 3, fmin.s, 0, -1235.1, -1235.1, 1.1 ); + TEST_FP_OP2_S( 4, fmin.s, 0, -1235.1, 1.1, -1235.1 ); + TEST_FP_OP2_S( 5, fmin.s, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_S( 6, fmin.s, 0, 0.00000001, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S( 7, fmin.s, 0, -2.0, -1.0, -2.0 ); + + TEST_FP_OP2_S(12, fmax.s, 0, 2.5, 2.5, 1.0 ); + TEST_FP_OP2_S(13, fmax.s, 0, 1.1, -1235.1, 1.1 ); + TEST_FP_OP2_S(14, fmax.s, 0, 1.1, 1.1, -1235.1 ); + TEST_FP_OP2_S(15, fmax.s, 0, -1235.1, NaN, -1235.1 ); + TEST_FP_OP2_S(16, fmax.s, 0, 3.14159265, 3.14159265, 0.00000001 ); + TEST_FP_OP2_S(17, fmax.s, 0, -1.0, -1.0, -2.0 ); + + # FMAX(sNaN, x) = x + TEST_FP_OP2_S(20, fmax.s, 0x10, 1.0, sNaNf, 1.0); + # FMAX(qNaN, qNaN) = canonical NaN + TEST_FP_OP2_S(21, fmax.s, 0x00, qNaNf, NaN, NaN); + + # -0.0 < +0.0 + TEST_FP_OP2_S(30, fmin.s, 0, -0.0, -0.0, 0.0 ); + TEST_FP_OP2_S(31, fmin.s, 0, -0.0, 0.0, -0.0 ); + TEST_FP_OP2_S(32, fmax.s, 0, 0.0, -0.0, 0.0 ); + TEST_FP_OP2_S(33, fmax.s, 0, 0.0, 0.0, -0.0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/ldst.S b/apps/riscv-tests/isa/rv64uf/ldst.S new file mode 100644 index 0000000..c35dd8d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/ldst.S @@ -0,0 +1,38 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ldst.S +#----------------------------------------------------------------------------- +# +# This test verifies that flw, fld, fsw, and fsd work properly. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + TEST_CASE(2, a0, 0x40000000deadbeef, la a1, tdat; flw f1, 4(a1); fsw f1, 20(a1); ld a0, 16(a1)) + TEST_CASE(3, a0, 0x1337d00dbf800000, la a1, tdat; flw f1, 0(a1); fsw f1, 24(a1); ld a0, 24(a1)) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +.word 0xbf800000 +.word 0x40000000 +.word 0x40400000 +.word 0xc0800000 +.word 0xdeadbeef +.word 0xcafebabe +.word 0xabad1dea +.word 0x1337d00d + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/move.S b/apps/riscv-tests/isa/rv64uf/move.S new file mode 100644 index 0000000..60f7cf3 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/move.S @@ -0,0 +1,58 @@ +# See LICENSE for license details. + +#***************************************************************************** +# move.S +#----------------------------------------------------------------------------- +# +# This test verifies that the fmv.s.x, fmv.x.s, and fsgnj[x|n].d instructions +# and the fcsr work properly. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + TEST_CASE(2, a1, 1, csrwi fcsr, 1; li a0, 0x1234; fssr a1, a0) + TEST_CASE(3, a0, 0x34, frsr a0) + TEST_CASE(4, a0, 0x14, frflags a0) + TEST_CASE(5, a0, 0x01, csrrwi a0, frm, 2) + TEST_CASE(6, a0, 0x54, frsr a0) + TEST_CASE(7, a0, 0x14, csrrci a0, fflags, 4) + TEST_CASE(8, a0, 0x50, frsr a0) + +#define TEST_FSGNJS(n, insn, new_sign, rs1_sign, rs2_sign) \ + TEST_CASE(n, a0, 0x12345678 | (-(new_sign) << 31), \ + li a1, ((rs1_sign) << 31) | 0x12345678; \ + li a2, -(rs2_sign); \ + fmv.s.x f1, a1; \ + fmv.s.x f2, a2; \ + insn f0, f1, f2; \ + fmv.x.s a0, f0) + + TEST_FSGNJS(10, fsgnj.s, 0, 0, 0) + TEST_FSGNJS(11, fsgnj.s, 1, 0, 1) + TEST_FSGNJS(12, fsgnj.s, 0, 1, 0) + TEST_FSGNJS(13, fsgnj.s, 1, 1, 1) + + TEST_FSGNJS(20, fsgnjn.s, 1, 0, 0) + TEST_FSGNJS(21, fsgnjn.s, 0, 0, 1) + TEST_FSGNJS(22, fsgnjn.s, 1, 1, 0) + TEST_FSGNJS(23, fsgnjn.s, 0, 1, 1) + + TEST_FSGNJS(30, fsgnjx.s, 0, 0, 0) + TEST_FSGNJS(31, fsgnjx.s, 1, 0, 1) + TEST_FSGNJS(32, fsgnjx.s, 1, 1, 0) + TEST_FSGNJS(33, fsgnjx.s, 0, 1, 1) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uf/recoding.S b/apps/riscv-tests/isa/rv64uf/recoding.S new file mode 100644 index 0000000..802be66 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uf/recoding.S @@ -0,0 +1,46 @@ +# See LICENSE for license details. + +#***************************************************************************** +# recoding.S +#----------------------------------------------------------------------------- +# +# Test corner cases of John Hauser's microarchitectural recoding scheme. +# There are twice as many recoded values as IEEE-754 values; some of these +# extras are redundant (e.g. Inf) and others are illegal (subnormals with +# too many bits set). +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64UF +RVTEST_CODE_BEGIN + + # Make sure infinities with different mantissas compare as equal. + flw f0, minf, a0 + flw f1, three, a0 + fmul.s f1, f1, f0 + TEST_CASE( 2, a0, 1, feq.s a0, f0, f1) + TEST_CASE( 3, a0, 1, fle.s a0, f0, f1) + TEST_CASE( 4, a0, 0, flt.s a0, f0, f1) + + # Likewise, but for zeroes. + fcvt.s.w f0, x0 + li a0, 1 + fcvt.s.w f1, a0 + fmul.s f1, f1, f0 + TEST_CASE(5, a0, 1, feq.s a0, f0, f1) + TEST_CASE(6, a0, 1, fle.s a0, f0, f1) + TEST_CASE(7, a0, 0, flt.s a0, f0, f1) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + +minf: .float -Inf +three: .float 3.0 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/Makefrag b/apps/riscv-tests/isa/rv64ui/Makefrag new file mode 100644 index 0000000..1867ea5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/Makefrag @@ -0,0 +1,27 @@ +#======================================================================= +# Makefrag for rv64ui tests +#----------------------------------------------------------------------- + +rv64ui_sc_tests = \ + add addi addiw addw \ + and andi \ + auipc \ + beq bge bgeu blt bltu bne \ + simple \ + fence_i \ + jal jalr \ + lb lbu lh lhu lw lwu ld \ + lui \ + or ori \ + sb sh sw sd \ + sll slli slliw sllw \ + slt slti sltiu sltu \ + sra srai sraiw sraw \ + srl srli srliw srlw \ + sub subw \ + xor xori \ + +rv64ui_p_tests = $(addprefix rv64ui-p-, $(rv64ui_sc_tests)) +rv64ui_v_tests = $(addprefix rv64ui-v-, $(rv64ui_sc_tests)) + +spike_tests += $(rv64ui_p_tests) $(rv64ui_v_tests) diff --git a/apps/riscv-tests/isa/rv64ui/add.S b/apps/riscv-tests/isa/rv64ui/add.S new file mode 100644 index 0000000..0696428 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/add.S @@ -0,0 +1,85 @@ +# See LICENSE for license details. + +#***************************************************************************** +# add.S +#----------------------------------------------------------------------------- +# +# Test add instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, add, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, add, 0x00000002, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, add, 0x0000000a, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, add, 0xffffffffffff8000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, add, 0xffffffff80000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, add, 0xffffffff7fff8000, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP( 8, add, 0x0000000000007fff, 0x0000000000000000, 0x0000000000007fff ); + TEST_RR_OP( 9, add, 0x000000007fffffff, 0x000000007fffffff, 0x0000000000000000 ); + TEST_RR_OP( 10, add, 0x0000000080007ffe, 0x000000007fffffff, 0x0000000000007fff ); + + TEST_RR_OP( 11, add, 0xffffffff80007fff, 0xffffffff80000000, 0x0000000000007fff ); + TEST_RR_OP( 12, add, 0x000000007fff7fff, 0x000000007fffffff, 0xffffffffffff8000 ); + + TEST_RR_OP( 13, add, 0xffffffffffffffff, 0x0000000000000000, 0xffffffffffffffff ); + TEST_RR_OP( 14, add, 0x0000000000000000, 0xffffffffffffffff, 0x0000000000000001 ); + TEST_RR_OP( 15, add, 0xfffffffffffffffe, 0xffffffffffffffff, 0xffffffffffffffff ); + + TEST_RR_OP( 16, add, 0x0000000080000000, 0x0000000000000001, 0x000000007fffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 17, add, 24, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 18, add, 25, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 19, add, 26, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 20, 0, add, 24, 13, 11 ); + TEST_RR_DEST_BYPASS( 21, 1, add, 25, 14, 11 ); + TEST_RR_DEST_BYPASS( 22, 2, add, 26, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 23, 0, 0, add, 24, 13, 11 ); + TEST_RR_SRC12_BYPASS( 24, 0, 1, add, 25, 14, 11 ); + TEST_RR_SRC12_BYPASS( 25, 0, 2, add, 26, 15, 11 ); + TEST_RR_SRC12_BYPASS( 26, 1, 0, add, 24, 13, 11 ); + TEST_RR_SRC12_BYPASS( 27, 1, 1, add, 25, 14, 11 ); + TEST_RR_SRC12_BYPASS( 28, 2, 0, add, 26, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 29, 0, 0, add, 24, 13, 11 ); + TEST_RR_SRC21_BYPASS( 30, 0, 1, add, 25, 14, 11 ); + TEST_RR_SRC21_BYPASS( 31, 0, 2, add, 26, 15, 11 ); + TEST_RR_SRC21_BYPASS( 32, 1, 0, add, 24, 13, 11 ); + TEST_RR_SRC21_BYPASS( 33, 1, 1, add, 25, 14, 11 ); + TEST_RR_SRC21_BYPASS( 34, 2, 0, add, 26, 15, 11 ); + + TEST_RR_ZEROSRC1( 35, add, 15, 15 ); + TEST_RR_ZEROSRC2( 36, add, 32, 32 ); + TEST_RR_ZEROSRC12( 37, add, 0 ); + TEST_RR_ZERODEST( 38, add, 16, 30 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/addi.S b/apps/riscv-tests/isa/rv64ui/addi.S new file mode 100644 index 0000000..e6b67ca --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/addi.S @@ -0,0 +1,71 @@ +# See LICENSE for license details. + +#***************************************************************************** +# addi.S +#----------------------------------------------------------------------------- +# +# Test addi instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, addi, 0x00000000, 0x00000000, 0x000 ); + TEST_IMM_OP( 3, addi, 0x00000002, 0x00000001, 0x001 ); + TEST_IMM_OP( 4, addi, 0x0000000a, 0x00000003, 0x007 ); + + TEST_IMM_OP( 5, addi, 0xfffffffffffff800, 0x0000000000000000, 0x800 ); + TEST_IMM_OP( 6, addi, 0xffffffff80000000, 0xffffffff80000000, 0x000 ); + TEST_IMM_OP( 7, addi, 0xffffffff7ffff800, 0xffffffff80000000, 0x800 ); + + TEST_IMM_OP( 8, addi, 0x00000000000007ff, 0x00000000, 0x7ff ); + TEST_IMM_OP( 9, addi, 0x000000007fffffff, 0x7fffffff, 0x000 ); + TEST_IMM_OP( 10, addi, 0x00000000800007fe, 0x7fffffff, 0x7ff ); + + TEST_IMM_OP( 11, addi, 0xffffffff800007ff, 0xffffffff80000000, 0x7ff ); + TEST_IMM_OP( 12, addi, 0x000000007ffff7ff, 0x000000007fffffff, 0x800 ); + + TEST_IMM_OP( 13, addi, 0xffffffffffffffff, 0x0000000000000000, 0xfff ); + TEST_IMM_OP( 14, addi, 0x0000000000000000, 0xffffffffffffffff, 0x001 ); + TEST_IMM_OP( 15, addi, 0xfffffffffffffffe, 0xffffffffffffffff, 0xfff ); + + TEST_IMM_OP( 16, addi, 0x0000000080000000, 0x7fffffff, 0x001 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, addi, 24, 13, 11 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, addi, 24, 13, 11 ); + TEST_IMM_DEST_BYPASS( 19, 1, addi, 23, 13, 10 ); + TEST_IMM_DEST_BYPASS( 20, 2, addi, 22, 13, 9 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, addi, 24, 13, 11 ); + TEST_IMM_SRC1_BYPASS( 22, 1, addi, 23, 13, 10 ); + TEST_IMM_SRC1_BYPASS( 23, 2, addi, 22, 13, 9 ); + + TEST_IMM_ZEROSRC1( 24, addi, 32, 32 ); + TEST_IMM_ZERODEST( 25, addi, 33, 50 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/addiw.S b/apps/riscv-tests/isa/rv64ui/addiw.S new file mode 100644 index 0000000..c0f9a61 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/addiw.S @@ -0,0 +1,71 @@ +# See LICENSE for license details. + +#***************************************************************************** +# addiw.S +#----------------------------------------------------------------------------- +# +# Test addiw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, addiw, 0x00000000, 0x00000000, 0x000 ); + TEST_IMM_OP( 3, addiw, 0x00000002, 0x00000001, 0x001 ); + TEST_IMM_OP( 4, addiw, 0x0000000a, 0x00000003, 0x007 ); + + TEST_IMM_OP( 5, addiw, 0xfffffffffffff800, 0x0000000000000000, 0x800 ); + TEST_IMM_OP( 6, addiw, 0xffffffff80000000, 0xffffffff80000000, 0x000 ); + TEST_IMM_OP( 7, addiw, 0x000000007ffff800, 0xffffffff80000000, 0x800 ); + + TEST_IMM_OP( 8, addiw, 0x00000000000007ff, 0x00000000, 0x7ff ); + TEST_IMM_OP( 9, addiw, 0x000000007fffffff, 0x7fffffff, 0x000 ); + TEST_IMM_OP( 10, addiw, 0xffffffff800007fe, 0x7fffffff, 0x7ff ); + + TEST_IMM_OP( 11, addiw, 0xffffffff800007ff, 0xffffffff80000000, 0x7ff ); + TEST_IMM_OP( 12, addiw, 0x000000007ffff7ff, 0x000000007fffffff, 0x800 ); + + TEST_IMM_OP( 13, addiw, 0xffffffffffffffff, 0x0000000000000000, 0xfff ); + TEST_IMM_OP( 14, addiw, 0x0000000000000000, 0xffffffffffffffff, 0x001 ); + TEST_IMM_OP( 15, addiw, 0xfffffffffffffffe, 0xffffffffffffffff, 0xfff ); + + TEST_IMM_OP( 16, addiw, 0xffffffff80000000, 0x7fffffff, 0x001 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, addiw, 24, 13, 11 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, addiw, 24, 13, 11 ); + TEST_IMM_DEST_BYPASS( 19, 1, addiw, 23, 13, 10 ); + TEST_IMM_DEST_BYPASS( 20, 2, addiw, 22, 13, 9 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, addiw, 24, 13, 11 ); + TEST_IMM_SRC1_BYPASS( 22, 1, addiw, 23, 13, 10 ); + TEST_IMM_SRC1_BYPASS( 23, 2, addiw, 22, 13, 9 ); + + TEST_IMM_ZEROSRC1( 24, addiw, 32, 32 ); + TEST_IMM_ZERODEST( 25, addiw, 33, 50 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/addw.S b/apps/riscv-tests/isa/rv64ui/addw.S new file mode 100644 index 0000000..ad7fe0b --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/addw.S @@ -0,0 +1,85 @@ +# See LICENSE for license details. + +#***************************************************************************** +# addw.S +#----------------------------------------------------------------------------- +# +# Test addw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, addw, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, addw, 0x00000002, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, addw, 0x0000000a, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, addw, 0xffffffffffff8000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, addw, 0xffffffff80000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, addw, 0x000000007fff8000, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP( 8, addw, 0x0000000000007fff, 0x0000000000000000, 0x0000000000007fff ); + TEST_RR_OP( 9, addw, 0x000000007fffffff, 0x000000007fffffff, 0x0000000000000000 ); + TEST_RR_OP( 10, addw, 0xffffffff80007ffe, 0x000000007fffffff, 0x0000000000007fff ); + + TEST_RR_OP( 11, addw, 0xffffffff80007fff, 0xffffffff80000000, 0x0000000000007fff ); + TEST_RR_OP( 12, addw, 0x000000007fff7fff, 0x000000007fffffff, 0xffffffffffff8000 ); + + TEST_RR_OP( 13, addw, 0xffffffffffffffff, 0x0000000000000000, 0xffffffffffffffff ); + TEST_RR_OP( 14, addw, 0x0000000000000000, 0xffffffffffffffff, 0x0000000000000001 ); + TEST_RR_OP( 15, addw, 0xfffffffffffffffe, 0xffffffffffffffff, 0xffffffffffffffff ); + + TEST_RR_OP( 16, addw, 0xffffffff80000000, 0x0000000000000001, 0x000000007fffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 17, addw, 24, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 18, addw, 25, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 19, addw, 26, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 20, 0, addw, 24, 13, 11 ); + TEST_RR_DEST_BYPASS( 21, 1, addw, 25, 14, 11 ); + TEST_RR_DEST_BYPASS( 22, 2, addw, 26, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 23, 0, 0, addw, 24, 13, 11 ); + TEST_RR_SRC12_BYPASS( 24, 0, 1, addw, 25, 14, 11 ); + TEST_RR_SRC12_BYPASS( 25, 0, 2, addw, 26, 15, 11 ); + TEST_RR_SRC12_BYPASS( 26, 1, 0, addw, 24, 13, 11 ); + TEST_RR_SRC12_BYPASS( 27, 1, 1, addw, 25, 14, 11 ); + TEST_RR_SRC12_BYPASS( 28, 2, 0, addw, 26, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 29, 0, 0, addw, 24, 13, 11 ); + TEST_RR_SRC21_BYPASS( 30, 0, 1, addw, 25, 14, 11 ); + TEST_RR_SRC21_BYPASS( 31, 0, 2, addw, 26, 15, 11 ); + TEST_RR_SRC21_BYPASS( 32, 1, 0, addw, 24, 13, 11 ); + TEST_RR_SRC21_BYPASS( 33, 1, 1, addw, 25, 14, 11 ); + TEST_RR_SRC21_BYPASS( 34, 2, 0, addw, 26, 15, 11 ); + + TEST_RR_ZEROSRC1( 35, addw, 15, 15 ); + TEST_RR_ZEROSRC2( 36, addw, 32, 32 ); + TEST_RR_ZEROSRC12( 37, addw, 0 ); + TEST_RR_ZERODEST( 38, addw, 16, 30 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/and.S b/apps/riscv-tests/isa/rv64ui/and.S new file mode 100644 index 0000000..3f63790 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/and.S @@ -0,0 +1,69 @@ +# See LICENSE for license details. + +#***************************************************************************** +# and.S +#----------------------------------------------------------------------------- +# +# Test and instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Logical tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_OP( 3, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_OP( 4, and, 0x000f000f, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_OP( 5, and, 0xf000f000, 0xf00ff00f, 0xf0f0f0f0 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 6, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC2_EQ_DEST( 7, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_EQ_DEST( 8, and, 0xff00ff00, 0xff00ff00 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 9, 0, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_DEST_BYPASS( 10, 1, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_DEST_BYPASS( 11, 2, and, 0x000f000f, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_SRC12_BYPASS( 12, 0, 0, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 13, 0, 1, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_BYPASS( 14, 0, 2, and, 0x000f000f, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 15, 1, 0, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 16, 1, 1, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_BYPASS( 17, 2, 0, and, 0x000f000f, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_SRC21_BYPASS( 18, 0, 0, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 19, 0, 1, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC21_BYPASS( 20, 0, 2, and, 0x000f000f, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 21, 1, 0, and, 0x0f000f00, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 22, 1, 1, and, 0x00f000f0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC21_BYPASS( 23, 2, 0, and, 0x000f000f, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_ZEROSRC1( 24, and, 0, 0xff00ff00 ); + TEST_RR_ZEROSRC2( 25, and, 0, 0x00ff00ff ); + TEST_RR_ZEROSRC12( 26, and, 0 ); + TEST_RR_ZERODEST( 27, and, 0x11111111, 0x22222222 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/andi.S b/apps/riscv-tests/isa/rv64ui/andi.S new file mode 100644 index 0000000..913af9d --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/andi.S @@ -0,0 +1,55 @@ +# See LICENSE for license details. + +#***************************************************************************** +# andi.S +#----------------------------------------------------------------------------- +# +# Test andi instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Logical tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, andi, 0xff00ff00, 0xff00ff00, 0xf0f ); + TEST_IMM_OP( 3, andi, 0x000000f0, 0x0ff00ff0, 0x0f0 ); + TEST_IMM_OP( 4, andi, 0x0000000f, 0x00ff00ff, 0x70f ); + TEST_IMM_OP( 5, andi, 0x00000000, 0xf00ff00f, 0x0f0 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 6, andi, 0x00000000, 0xff00ff00, 0x0f0 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 7, 0, andi, 0x00000700, 0x0ff00ff0, 0x70f ); + TEST_IMM_DEST_BYPASS( 8, 1, andi, 0x000000f0, 0x00ff00ff, 0x0f0 ); + TEST_IMM_DEST_BYPASS( 9, 2, andi, 0xf00ff00f, 0xf00ff00f, 0xf0f ); + + TEST_IMM_SRC1_BYPASS( 10, 0, andi, 0x00000700, 0x0ff00ff0, 0x70f ); + TEST_IMM_SRC1_BYPASS( 11, 1, andi, 0x000000f0, 0x00ff00ff, 0x0f0 ); + TEST_IMM_SRC1_BYPASS( 12, 2, andi, 0x0000000f, 0xf00ff00f, 0x70f ); + + TEST_IMM_ZEROSRC1( 13, andi, 0, 0x0f0 ); + TEST_IMM_ZERODEST( 14, andi, 0x00ff00ff, 0x70f ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/auipc.S b/apps/riscv-tests/isa/rv64ui/auipc.S new file mode 100644 index 0000000..6fe5962 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/auipc.S @@ -0,0 +1,39 @@ +# See LICENSE for license details. + +#***************************************************************************** +# auipc.S +#----------------------------------------------------------------------------- +# +# Test auipc instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + TEST_CASE(2, a0, 10000, \ + .align 3; \ + lla a0, 1f + 10000; \ + jal a1, 1f; \ + 1: sub a0, a0, a1; \ + ) + + TEST_CASE(3, a0, -10000, \ + .align 3; \ + lla a0, 1f - 10000; \ + jal a1, 1f; \ + 1: sub a0, a0, a1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/beq.S b/apps/riscv-tests/isa/rv64ui/beq.S new file mode 100644 index 0000000..436db8c --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/beq.S @@ -0,0 +1,73 @@ +# See LICENSE for license details. + +#***************************************************************************** +# beq.S +#----------------------------------------------------------------------------- +# +# Test beq instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Branch tests + #------------------------------------------------------------- + + # Each test checks both forward and backward branches + + TEST_BR2_OP_TAKEN( 2, beq, 0, 0 ); + TEST_BR2_OP_TAKEN( 3, beq, 1, 1 ); + TEST_BR2_OP_TAKEN( 4, beq, -1, -1 ); + + TEST_BR2_OP_NOTTAKEN( 5, beq, 0, 1 ); + TEST_BR2_OP_NOTTAKEN( 6, beq, 1, 0 ); + TEST_BR2_OP_NOTTAKEN( 7, beq, -1, 1 ); + TEST_BR2_OP_NOTTAKEN( 8, beq, 1, -1 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_BR2_SRC12_BYPASS( 9, 0, 0, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 10, 0, 1, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 11, 0, 2, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 12, 1, 0, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 13, 1, 1, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 14, 2, 0, beq, 0, -1 ); + + TEST_BR2_SRC12_BYPASS( 15, 0, 0, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 16, 0, 1, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 17, 0, 2, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 18, 1, 0, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 19, 1, 1, beq, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 20, 2, 0, beq, 0, -1 ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 21, x1, 3, \ + li x1, 1; \ + beq x0, x0, 1f; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ +1: addi x1, x1, 1; \ + addi x1, x1, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/bge.S b/apps/riscv-tests/isa/rv64ui/bge.S new file mode 100644 index 0000000..04aebbc --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/bge.S @@ -0,0 +1,76 @@ +# See LICENSE for license details. + +#***************************************************************************** +# bge.S +#----------------------------------------------------------------------------- +# +# Test bge instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Branch tests + #------------------------------------------------------------- + + # Each test checks both forward and backward branches + + TEST_BR2_OP_TAKEN( 2, bge, 0, 0 ); + TEST_BR2_OP_TAKEN( 3, bge, 1, 1 ); + TEST_BR2_OP_TAKEN( 4, bge, -1, -1 ); + TEST_BR2_OP_TAKEN( 5, bge, 1, 0 ); + TEST_BR2_OP_TAKEN( 6, bge, 1, -1 ); + TEST_BR2_OP_TAKEN( 7, bge, -1, -2 ); + + TEST_BR2_OP_NOTTAKEN( 8, bge, 0, 1 ); + TEST_BR2_OP_NOTTAKEN( 9, bge, -1, 1 ); + TEST_BR2_OP_NOTTAKEN( 10, bge, -2, -1 ); + TEST_BR2_OP_NOTTAKEN( 11, bge, -2, 1 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_BR2_SRC12_BYPASS( 12, 0, 0, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 13, 0, 1, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 14, 0, 2, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 15, 1, 0, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 16, 1, 1, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 17, 2, 0, bge, -1, 0 ); + + TEST_BR2_SRC12_BYPASS( 18, 0, 0, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 19, 0, 1, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 20, 0, 2, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 21, 1, 0, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 22, 1, 1, bge, -1, 0 ); + TEST_BR2_SRC12_BYPASS( 23, 2, 0, bge, -1, 0 ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 24, x1, 3, \ + li x1, 1; \ + bge x1, x0, 1f; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ +1: addi x1, x1, 1; \ + addi x1, x1, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/bgeu.S b/apps/riscv-tests/isa/rv64ui/bgeu.S new file mode 100644 index 0000000..36b6b3a --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/bgeu.S @@ -0,0 +1,76 @@ +# See LICENSE for license details. + +#***************************************************************************** +# bgeu.S +#----------------------------------------------------------------------------- +# +# Test bgeu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Branch tests + #------------------------------------------------------------- + + # Each test checks both forward and backward branches + + TEST_BR2_OP_TAKEN( 2, bgeu, 0x00000000, 0x00000000 ); + TEST_BR2_OP_TAKEN( 3, bgeu, 0x00000001, 0x00000001 ); + TEST_BR2_OP_TAKEN( 4, bgeu, 0xffffffff, 0xffffffff ); + TEST_BR2_OP_TAKEN( 5, bgeu, 0x00000001, 0x00000000 ); + TEST_BR2_OP_TAKEN( 6, bgeu, 0xffffffff, 0xfffffffe ); + TEST_BR2_OP_TAKEN( 7, bgeu, 0xffffffff, 0x00000000 ); + + TEST_BR2_OP_NOTTAKEN( 8, bgeu, 0x00000000, 0x00000001 ); + TEST_BR2_OP_NOTTAKEN( 9, bgeu, 0xfffffffe, 0xffffffff ); + TEST_BR2_OP_NOTTAKEN( 10, bgeu, 0x00000000, 0xffffffff ); + TEST_BR2_OP_NOTTAKEN( 11, bgeu, 0x7fffffff, 0x80000000 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_BR2_SRC12_BYPASS( 12, 0, 0, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 13, 0, 1, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 14, 0, 2, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 15, 1, 0, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 16, 1, 1, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 17, 2, 0, bgeu, 0xefffffff, 0xf0000000 ); + + TEST_BR2_SRC12_BYPASS( 18, 0, 0, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 19, 0, 1, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 20, 0, 2, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 21, 1, 0, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 22, 1, 1, bgeu, 0xefffffff, 0xf0000000 ); + TEST_BR2_SRC12_BYPASS( 23, 2, 0, bgeu, 0xefffffff, 0xf0000000 ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 24, x1, 3, \ + li x1, 1; \ + bgeu x1, x0, 1f; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ +1: addi x1, x1, 1; \ + addi x1, x1, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/blt.S b/apps/riscv-tests/isa/rv64ui/blt.S new file mode 100644 index 0000000..1c0ca69 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/blt.S @@ -0,0 +1,73 @@ +# See LICENSE for license details. + +#***************************************************************************** +# blt.S +#----------------------------------------------------------------------------- +# +# Test blt instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Branch tests + #------------------------------------------------------------- + + # Each test checks both forward and backward branches + + TEST_BR2_OP_TAKEN( 2, blt, 0, 1 ); + TEST_BR2_OP_TAKEN( 3, blt, -1, 1 ); + TEST_BR2_OP_TAKEN( 4, blt, -2, -1 ); + + TEST_BR2_OP_NOTTAKEN( 5, blt, 1, 0 ); + TEST_BR2_OP_NOTTAKEN( 6, blt, 1, -1 ); + TEST_BR2_OP_NOTTAKEN( 7, blt, -1, -2 ); + TEST_BR2_OP_NOTTAKEN( 8, blt, 1, -2 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_BR2_SRC12_BYPASS( 9, 0, 0, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 10, 0, 1, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 11, 0, 2, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 12, 1, 0, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 13, 1, 1, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 14, 2, 0, blt, 0, -1 ); + + TEST_BR2_SRC12_BYPASS( 15, 0, 0, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 16, 0, 1, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 17, 0, 2, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 18, 1, 0, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 19, 1, 1, blt, 0, -1 ); + TEST_BR2_SRC12_BYPASS( 20, 2, 0, blt, 0, -1 ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 21, x1, 3, \ + li x1, 1; \ + blt x0, x1, 1f; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ +1: addi x1, x1, 1; \ + addi x1, x1, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/bltu.S b/apps/riscv-tests/isa/rv64ui/bltu.S new file mode 100644 index 0000000..4e880d6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/bltu.S @@ -0,0 +1,73 @@ +# See LICENSE for license details. + +#***************************************************************************** +# bltu.S +#----------------------------------------------------------------------------- +# +# Test bltu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Branch tests + #------------------------------------------------------------- + + # Each test checks both forward and backward branches + + TEST_BR2_OP_TAKEN( 2, bltu, 0x00000000, 0x00000001 ); + TEST_BR2_OP_TAKEN( 3, bltu, 0xfffffffe, 0xffffffff ); + TEST_BR2_OP_TAKEN( 4, bltu, 0x00000000, 0xffffffff ); + + TEST_BR2_OP_NOTTAKEN( 5, bltu, 0x00000001, 0x00000000 ); + TEST_BR2_OP_NOTTAKEN( 6, bltu, 0xffffffff, 0xfffffffe ); + TEST_BR2_OP_NOTTAKEN( 7, bltu, 0xffffffff, 0x00000000 ); + TEST_BR2_OP_NOTTAKEN( 8, bltu, 0x80000000, 0x7fffffff ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_BR2_SRC12_BYPASS( 9, 0, 0, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 10, 0, 1, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 11, 0, 2, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 12, 1, 0, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 13, 1, 1, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 14, 2, 0, bltu, 0xf0000000, 0xefffffff ); + + TEST_BR2_SRC12_BYPASS( 15, 0, 0, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 16, 0, 1, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 17, 0, 2, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 18, 1, 0, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 19, 1, 1, bltu, 0xf0000000, 0xefffffff ); + TEST_BR2_SRC12_BYPASS( 20, 2, 0, bltu, 0xf0000000, 0xefffffff ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 21, x1, 3, \ + li x1, 1; \ + bltu x0, x1, 1f; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ +1: addi x1, x1, 1; \ + addi x1, x1, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/bne.S b/apps/riscv-tests/isa/rv64ui/bne.S new file mode 100644 index 0000000..3ca4e6c --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/bne.S @@ -0,0 +1,73 @@ +# See LICENSE for license details. + +#***************************************************************************** +# bne.S +#----------------------------------------------------------------------------- +# +# Test bne instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Branch tests + #------------------------------------------------------------- + + # Each test checks both forward and backward branches + + TEST_BR2_OP_TAKEN( 2, bne, 0, 1 ); + TEST_BR2_OP_TAKEN( 3, bne, 1, 0 ); + TEST_BR2_OP_TAKEN( 4, bne, -1, 1 ); + TEST_BR2_OP_TAKEN( 5, bne, 1, -1 ); + + TEST_BR2_OP_NOTTAKEN( 6, bne, 0, 0 ); + TEST_BR2_OP_NOTTAKEN( 7, bne, 1, 1 ); + TEST_BR2_OP_NOTTAKEN( 8, bne, -1, -1 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_BR2_SRC12_BYPASS( 9, 0, 0, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 10, 0, 1, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 11, 0, 2, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 12, 1, 0, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 13, 1, 1, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 14, 2, 0, bne, 0, 0 ); + + TEST_BR2_SRC12_BYPASS( 15, 0, 0, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 16, 0, 1, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 17, 0, 2, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 18, 1, 0, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 19, 1, 1, bne, 0, 0 ); + TEST_BR2_SRC12_BYPASS( 20, 2, 0, bne, 0, 0 ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 21, x1, 3, \ + li x1, 1; \ + bne x1, x0, 1f; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ + addi x1, x1, 1; \ +1: addi x1, x1, 1; \ + addi x1, x1, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/fence_i.S b/apps/riscv-tests/isa/rv64ui/fence_i.S new file mode 100644 index 0000000..e6a6912 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/fence_i.S @@ -0,0 +1,62 @@ +# See LICENSE for license details. + +#***************************************************************************** +# fence_i.S +#----------------------------------------------------------------------------- +# +# Test self-modifying code and the fence.i instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + +li a3, 111 +lh a0, insn +lh a1, insn+2 + +# test I$ hit +.align 6 +sh a0, 2f, t0 +sh a1, 2f+2, t0 +fence.i + +la a5, 2f +jalr t1, a5, 0 +TEST_CASE( 2, a3, 444, nop ) + +# test prefetcher hit +li a4, 100 +1: addi a4, a4, -1 +bnez a4, 1b + +sh a0, 3f, t0 +sh a1, 3f+2, t0 +fence.i + +.align 6 +la a5, 3f +jalr t1, a5, 0 +TEST_CASE( 3, a3, 777, nop ) + +TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +insn: + addi a3, a3, 333 + +2: addi a3, a3, 222 +jalr a5, t1, 0 + +3: addi a3, a3, 555 +jalr a5, t1, 0 + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/jal.S b/apps/riscv-tests/isa/rv64ui/jal.S new file mode 100644 index 0000000..00c65d8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/jal.S @@ -0,0 +1,59 @@ +# See LICENSE for license details. + +#***************************************************************************** +# jal.S +#----------------------------------------------------------------------------- +# +# Test jal instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Test 2: Basic test + #------------------------------------------------------------- + +test_2: + li TESTNUM, 2 + li ra, 0 + + jal x4, target_2 +linkaddr_2: + nop + nop + + j fail + +target_2: + la x2, linkaddr_2 + bne x2, x4, fail + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + TEST_CASE( 3, ra, 3, \ + li ra, 1; \ + jal x0, 1f; \ + addi ra, ra, 1; \ + addi ra, ra, 1; \ + addi ra, ra, 1; \ + addi ra, ra, 1; \ +1: addi ra, ra, 1; \ + addi ra, ra, 1; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/jalr.S b/apps/riscv-tests/isa/rv64ui/jalr.S new file mode 100644 index 0000000..c922b11 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/jalr.S @@ -0,0 +1,86 @@ +# See LICENSE for license details. + +#***************************************************************************** +# jalr.S +#----------------------------------------------------------------------------- +# +# Test jalr instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Test 2: Basic test + #------------------------------------------------------------- + +test_2: + li TESTNUM, 2 + li t0, 0 + la t1, target_2 + + jalr t0, t1, 0 +linkaddr_2: + j fail + +target_2: + la t1, linkaddr_2 + bne t0, t1, fail + + #------------------------------------------------------------- + # Test 3: Basic test2, rs = rd + #------------------------------------------------------------- + +test_3: + li TESTNUM, 3 + la t0, target_3 + + jalr t0, t0, 0 +linkaddr_3: + j fail + +target_3: + la t1, linkaddr_3 + bne t0, t1, fail + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_JALR_SRC1_BYPASS( 4, 0, jalr ); + TEST_JALR_SRC1_BYPASS( 5, 1, jalr ); + TEST_JALR_SRC1_BYPASS( 6, 2, jalr ); + + #------------------------------------------------------------- + # Test delay slot instructions not executed nor bypassed + #------------------------------------------------------------- + + .option push + .align 2 + .option norvc + TEST_CASE( 7, t0, 4, \ + li t0, 1; \ + la t1, 1f; \ + jr t1, -4; \ + addi t0, t0, 1; \ + addi t0, t0, 1; \ + addi t0, t0, 1; \ + addi t0, t0, 1; \ +1: addi t0, t0, 1; \ + addi t0, t0, 1; \ + ) + .option pop + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lb.S b/apps/riscv-tests/isa/rv64ui/lb.S new file mode 100644 index 0000000..856dfe9 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lb.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lb.S +#----------------------------------------------------------------------------- +# +# Test lb instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, lb, 0xffffffffffffffff, 0, tdat ); + TEST_LD_OP( 3, lb, 0x0000000000000000, 1, tdat ); + TEST_LD_OP( 4, lb, 0xfffffffffffffff0, 2, tdat ); + TEST_LD_OP( 5, lb, 0x000000000000000f, 3, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, lb, 0xffffffffffffffff, -3, tdat4 ); + TEST_LD_OP( 7, lb, 0x0000000000000000, -2, tdat4 ); + TEST_LD_OP( 8, lb, 0xfffffffffffffff0, -1, tdat4 ); + TEST_LD_OP( 9, lb, 0x000000000000000f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0xffffffffffffffff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + lb x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x0000000000000000, \ + la x1, tdat; \ + addi x1, x1, -6; \ + lb x5, 7(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, lb, 0xfffffffffffffff0, 1, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, lb, 0x000000000000000f, 1, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, lb, 0x0000000000000000, 1, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, lb, 0xfffffffffffffff0, 1, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, lb, 0x000000000000000f, 1, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, lb, 0x0000000000000000, 1, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + lb x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + lb x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .byte 0xff +tdat2: .byte 0x00 +tdat3: .byte 0xf0 +tdat4: .byte 0x0f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lbu.S b/apps/riscv-tests/isa/rv64ui/lbu.S new file mode 100644 index 0000000..adc3a05 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lbu.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lbu.S +#----------------------------------------------------------------------------- +# +# Test lbu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, lbu, 0x00000000000000ff, 0, tdat ); + TEST_LD_OP( 3, lbu, 0x0000000000000000, 1, tdat ); + TEST_LD_OP( 4, lbu, 0x00000000000000f0, 2, tdat ); + TEST_LD_OP( 5, lbu, 0x000000000000000f, 3, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, lbu, 0x00000000000000ff, -3, tdat4 ); + TEST_LD_OP( 7, lbu, 0x0000000000000000, -2, tdat4 ); + TEST_LD_OP( 8, lbu, 0x00000000000000f0, -1, tdat4 ); + TEST_LD_OP( 9, lbu, 0x000000000000000f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x00000000000000ff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + lbu x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x0000000000000000, \ + la x1, tdat; \ + addi x1, x1, -6; \ + lbu x5, 7(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, lbu, 0x00000000000000f0, 1, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, lbu, 0x000000000000000f, 1, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, lbu, 0x0000000000000000, 1, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, lbu, 0x00000000000000f0, 1, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, lbu, 0x000000000000000f, 1, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, lbu, 0x0000000000000000, 1, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + lbu x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + lbu x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .byte 0xff +tdat2: .byte 0x00 +tdat3: .byte 0xf0 +tdat4: .byte 0x0f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/ld.S b/apps/riscv-tests/isa/rv64ui/ld.S new file mode 100644 index 0000000..948c34b --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/ld.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ld.S +#----------------------------------------------------------------------------- +# +# Test ld instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, ld, 0x00ff00ff00ff00ff, 0, tdat ); + TEST_LD_OP( 3, ld, 0xff00ff00ff00ff00, 8, tdat ); + TEST_LD_OP( 4, ld, 0x0ff00ff00ff00ff0, 16, tdat ); + TEST_LD_OP( 5, ld, 0xf00ff00ff00ff00f, 24, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, ld, 0x00ff00ff00ff00ff, -24, tdat4 ); + TEST_LD_OP( 7, ld, 0xff00ff00ff00ff00, -16, tdat4 ); + TEST_LD_OP( 8, ld, 0x0ff00ff00ff00ff0, -8, tdat4 ); + TEST_LD_OP( 9, ld, 0xf00ff00ff00ff00f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x00ff00ff00ff00ff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + ld x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0xff00ff00ff00ff00, \ + la x1, tdat; \ + addi x1, x1, -3; \ + ld x5, 11(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, ld, 0x0ff00ff00ff00ff0, 8, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, ld, 0xf00ff00ff00ff00f, 8, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, ld, 0xff00ff00ff00ff00, 8, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, ld, 0x0ff00ff00ff00ff0, 8, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, ld, 0xf00ff00ff00ff00f, 8, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, ld, 0xff00ff00ff00ff00, 8, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + ld x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + ld x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .dword 0x00ff00ff00ff00ff +tdat2: .dword 0xff00ff00ff00ff00 +tdat3: .dword 0x0ff00ff00ff00ff0 +tdat4: .dword 0xf00ff00ff00ff00f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lh.S b/apps/riscv-tests/isa/rv64ui/lh.S new file mode 100644 index 0000000..338ed69 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lh.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lh.S +#----------------------------------------------------------------------------- +# +# Test lh instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, lh, 0x00000000000000ff, 0, tdat ); + TEST_LD_OP( 3, lh, 0xffffffffffffff00, 2, tdat ); + TEST_LD_OP( 4, lh, 0x0000000000000ff0, 4, tdat ); + TEST_LD_OP( 5, lh, 0xfffffffffffff00f, 6, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, lh, 0x00000000000000ff, -6, tdat4 ); + TEST_LD_OP( 7, lh, 0xffffffffffffff00, -4, tdat4 ); + TEST_LD_OP( 8, lh, 0x0000000000000ff0, -2, tdat4 ); + TEST_LD_OP( 9, lh, 0xfffffffffffff00f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x00000000000000ff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + lh x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0xffffffffffffff00, \ + la x1, tdat; \ + addi x1, x1, -5; \ + lh x5, 7(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, lh, 0x0000000000000ff0, 2, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, lh, 0xfffffffffffff00f, 2, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, lh, 0xffffffffffffff00, 2, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, lh, 0x0000000000000ff0, 2, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, lh, 0xfffffffffffff00f, 2, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, lh, 0xffffffffffffff00, 2, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + lh x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + lh x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .half 0x00ff +tdat2: .half 0xff00 +tdat3: .half 0x0ff0 +tdat4: .half 0xf00f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lhu.S b/apps/riscv-tests/isa/rv64ui/lhu.S new file mode 100644 index 0000000..a4cc49b --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lhu.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lhu.S +#----------------------------------------------------------------------------- +# +# Test lhu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, lhu, 0x00000000000000ff, 0, tdat ); + TEST_LD_OP( 3, lhu, 0x000000000000ff00, 2, tdat ); + TEST_LD_OP( 4, lhu, 0x0000000000000ff0, 4, tdat ); + TEST_LD_OP( 5, lhu, 0x000000000000f00f, 6, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, lhu, 0x00000000000000ff, -6, tdat4 ); + TEST_LD_OP( 7, lhu, 0x000000000000ff00, -4, tdat4 ); + TEST_LD_OP( 8, lhu, 0x0000000000000ff0, -2, tdat4 ); + TEST_LD_OP( 9, lhu, 0x000000000000f00f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x00000000000000ff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + lhu x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x000000000000ff00, \ + la x1, tdat; \ + addi x1, x1, -5; \ + lhu x5, 7(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, lhu, 0x0000000000000ff0, 2, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, lhu, 0x000000000000f00f, 2, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, lhu, 0x000000000000ff00, 2, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, lhu, 0x0000000000000ff0, 2, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, lhu, 0x000000000000f00f, 2, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, lhu, 0x000000000000ff00, 2, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + lhu x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + lhu x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .half 0x00ff +tdat2: .half 0xff00 +tdat3: .half 0x0ff0 +tdat4: .half 0xf00f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lui.S b/apps/riscv-tests/isa/rv64ui/lui.S new file mode 100644 index 0000000..8a4e70c --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lui.S @@ -0,0 +1,36 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lui.S +#----------------------------------------------------------------------------- +# +# Test lui instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_CASE( 2, x1, 0x0000000000000000, lui x1, 0x00000 ); + TEST_CASE( 3, x1, 0xfffffffffffff800, lui x1, 0xfffff;sra x1,x1,1); + TEST_CASE( 4, x1, 0x00000000000007ff, lui x1, 0x7ffff;sra x1,x1,20); + TEST_CASE( 5, x1, 0xfffffffffffff800, lui x1, 0x80000;sra x1,x1,20); + + TEST_CASE( 6, x0, 0, lui x0, 0x80000 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lw.S b/apps/riscv-tests/isa/rv64ui/lw.S new file mode 100644 index 0000000..40a73f1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lw.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lw.S +#----------------------------------------------------------------------------- +# +# Test lw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, lw, 0x0000000000ff00ff, 0, tdat ); + TEST_LD_OP( 3, lw, 0xffffffffff00ff00, 4, tdat ); + TEST_LD_OP( 4, lw, 0x000000000ff00ff0, 8, tdat ); + TEST_LD_OP( 5, lw, 0xfffffffff00ff00f, 12, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, lw, 0x0000000000ff00ff, -12, tdat4 ); + TEST_LD_OP( 7, lw, 0xffffffffff00ff00, -8, tdat4 ); + TEST_LD_OP( 8, lw, 0x000000000ff00ff0, -4, tdat4 ); + TEST_LD_OP( 9, lw, 0xfffffffff00ff00f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x0000000000ff00ff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + lw x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0xffffffffff00ff00, \ + la x1, tdat; \ + addi x1, x1, -3; \ + lw x5, 7(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, lw, 0x000000000ff00ff0, 4, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, lw, 0xfffffffff00ff00f, 4, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, lw, 0xffffffffff00ff00, 4, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, lw, 0x000000000ff00ff0, 4, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, lw, 0xfffffffff00ff00f, 4, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, lw, 0xffffffffff00ff00, 4, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + lw x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + lw x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .word 0x00ff00ff +tdat2: .word 0xff00ff00 +tdat3: .word 0x0ff00ff0 +tdat4: .word 0xf00ff00f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/lwu.S b/apps/riscv-tests/isa/rv64ui/lwu.S new file mode 100644 index 0000000..9f7cf67 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/lwu.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# lwu.S +#----------------------------------------------------------------------------- +# +# Test lwu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_LD_OP( 2, lwu, 0x0000000000ff00ff, 0, tdat ); + TEST_LD_OP( 3, lwu, 0x00000000ff00ff00, 4, tdat ); + TEST_LD_OP( 4, lwu, 0x000000000ff00ff0, 8, tdat ); + TEST_LD_OP( 5, lwu, 0x00000000f00ff00f, 12, tdat ); + + # Test with negative offset + + TEST_LD_OP( 6, lwu, 0x0000000000ff00ff, -12, tdat4 ); + TEST_LD_OP( 7, lwu, 0x00000000ff00ff00, -8, tdat4 ); + TEST_LD_OP( 8, lwu, 0x000000000ff00ff0, -4, tdat4 ); + TEST_LD_OP( 9, lwu, 0x00000000f00ff00f, 0, tdat4 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x0000000000ff00ff, \ + la x1, tdat; \ + addi x1, x1, -32; \ + lwu x5, 32(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x00000000ff00ff00, \ + la x1, tdat; \ + addi x1, x1, -3; \ + lwu x5, 7(x1); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_LD_DEST_BYPASS( 12, 0, lwu, 0x000000000ff00ff0, 4, tdat2 ); + TEST_LD_DEST_BYPASS( 13, 1, lwu, 0x00000000f00ff00f, 4, tdat3 ); + TEST_LD_DEST_BYPASS( 14, 2, lwu, 0x00000000ff00ff00, 4, tdat1 ); + + TEST_LD_SRC1_BYPASS( 15, 0, lwu, 0x000000000ff00ff0, 4, tdat2 ); + TEST_LD_SRC1_BYPASS( 16, 1, lwu, 0x00000000f00ff00f, 4, tdat3 ); + TEST_LD_SRC1_BYPASS( 17, 2, lwu, 0x00000000ff00ff00, 4, tdat1 ); + + #------------------------------------------------------------- + # Test write-after-write hazard + #------------------------------------------------------------- + + TEST_CASE( 18, x2, 2, \ + la x5, tdat; \ + lwu x2, 0(x5); \ + li x2, 2; \ + ) + + TEST_CASE( 19, x2, 2, \ + la x5, tdat; \ + lwu x2, 0(x5); \ + nop; \ + li x2, 2; \ + ) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .word 0x00ff00ff +tdat2: .word 0xff00ff00 +tdat3: .word 0x0ff00ff0 +tdat4: .word 0xf00ff00f + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/or.S b/apps/riscv-tests/isa/rv64ui/or.S new file mode 100644 index 0000000..6d84f53 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/or.S @@ -0,0 +1,69 @@ +# See LICENSE for license details. + +#***************************************************************************** +# or.S +#----------------------------------------------------------------------------- +# +# Test or instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Logical tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_OP( 3, or, 0xfff0fff0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_OP( 4, or, 0x0fff0fff, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_OP( 5, or, 0xf0fff0ff, 0xf00ff00f, 0xf0f0f0f0 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 6, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC2_EQ_DEST( 7, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_EQ_DEST( 8, or, 0xff00ff00, 0xff00ff00 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 9, 0, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_DEST_BYPASS( 10, 1, or, 0xfff0fff0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_DEST_BYPASS( 11, 2, or, 0x0fff0fff, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_SRC12_BYPASS( 12, 0, 0, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 13, 0, 1, or, 0xfff0fff0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_BYPASS( 14, 0, 2, or, 0x0fff0fff, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 15, 1, 0, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 16, 1, 1, or, 0xfff0fff0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_BYPASS( 17, 2, 0, or, 0x0fff0fff, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_SRC21_BYPASS( 18, 0, 0, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 19, 0, 1, or, 0xfff0fff0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC21_BYPASS( 20, 0, 2, or, 0x0fff0fff, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 21, 1, 0, or, 0xff0fff0f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 22, 1, 1, or, 0xfff0fff0, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC21_BYPASS( 23, 2, 0, or, 0x0fff0fff, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_ZEROSRC1( 24, or, 0xff00ff00, 0xff00ff00 ); + TEST_RR_ZEROSRC2( 25, or, 0x00ff00ff, 0x00ff00ff ); + TEST_RR_ZEROSRC12( 26, or, 0 ); + TEST_RR_ZERODEST( 27, or, 0x11111111, 0x22222222 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/ori.S b/apps/riscv-tests/isa/rv64ui/ori.S new file mode 100644 index 0000000..437c00a --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/ori.S @@ -0,0 +1,55 @@ +# See LICENSE for license details. + +#***************************************************************************** +# ori.S +#----------------------------------------------------------------------------- +# +# Test ori instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Logical tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, ori, 0xffffffffffffff0f, 0xffffffffff00ff00, 0xf0f ); + TEST_IMM_OP( 3, ori, 0x000000000ff00ff0, 0x000000000ff00ff0, 0x0f0 ); + TEST_IMM_OP( 4, ori, 0x0000000000ff07ff, 0x0000000000ff00ff, 0x70f ); + TEST_IMM_OP( 5, ori, 0xfffffffff00ff0ff, 0xfffffffff00ff00f, 0x0f0 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 6, ori, 0xff00fff0, 0xff00ff00, 0x0f0 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 7, 0, ori, 0x000000000ff00ff0, 0x000000000ff00ff0, 0x0f0 ); + TEST_IMM_DEST_BYPASS( 8, 1, ori, 0x0000000000ff07ff, 0x0000000000ff00ff, 0x70f ); + TEST_IMM_DEST_BYPASS( 9, 2, ori, 0xfffffffff00ff0ff, 0xfffffffff00ff00f, 0x0f0 ); + + TEST_IMM_SRC1_BYPASS( 10, 0, ori, 0x000000000ff00ff0, 0x000000000ff00ff0, 0x0f0 ); + TEST_IMM_SRC1_BYPASS( 11, 1, ori, 0xffffffffffffffff, 0x0000000000ff00ff, 0xf0f ); + TEST_IMM_SRC1_BYPASS( 12, 2, ori, 0xfffffffff00ff0ff, 0xfffffffff00ff00f, 0x0f0 ); + + TEST_IMM_ZEROSRC1( 13, ori, 0x0f0, 0x0f0 ); + TEST_IMM_ZERODEST( 14, ori, 0x00ff00ff, 0x70f ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sb.S b/apps/riscv-tests/isa/rv64ui/sb.S new file mode 100644 index 0000000..19e32d6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sb.S @@ -0,0 +1,96 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sb.S +#----------------------------------------------------------------------------- +# +# Test sb instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_ST_OP( 2, lb, sb, 0xffffffffffffffaa, 0, tdat ); + TEST_ST_OP( 3, lb, sb, 0x0000000000000000, 1, tdat ); + TEST_ST_OP( 4, lh, sb, 0xffffffffffffefa0, 2, tdat ); + TEST_ST_OP( 5, lb, sb, 0x000000000000000a, 3, tdat ); + + # Test with negative offset + + TEST_ST_OP( 6, lb, sb, 0xffffffffffffffaa, -3, tdat8 ); + TEST_ST_OP( 7, lb, sb, 0x0000000000000000, -2, tdat8 ); + TEST_ST_OP( 8, lb, sb, 0xffffffffffffffa0, -1, tdat8 ); + TEST_ST_OP( 9, lb, sb, 0x000000000000000a, 0, tdat8 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x78, \ + la x1, tdat9; \ + li x2, 0x12345678; \ + addi x4, x1, -32; \ + sb x2, 32(x4); \ + lb x5, 0(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0xffffffffffffff98, \ + la x1, tdat9; \ + li x2, 0x00003098; \ + addi x1, x1, -6; \ + sb x2, 7(x1); \ + la x4, tdat10; \ + lb x5, 0(x4); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_ST_SRC12_BYPASS( 12, 0, 0, lb, sb, 0xffffffffffffffdd, 0, tdat ); + TEST_ST_SRC12_BYPASS( 13, 0, 1, lb, sb, 0xffffffffffffffcd, 1, tdat ); + TEST_ST_SRC12_BYPASS( 14, 0, 2, lb, sb, 0xffffffffffffffcc, 2, tdat ); + TEST_ST_SRC12_BYPASS( 15, 1, 0, lb, sb, 0xffffffffffffffbc, 3, tdat ); + TEST_ST_SRC12_BYPASS( 16, 1, 1, lb, sb, 0xffffffffffffffbb, 4, tdat ); + TEST_ST_SRC12_BYPASS( 17, 2, 0, lb, sb, 0xffffffffffffffab, 5, tdat ); + + TEST_ST_SRC21_BYPASS( 18, 0, 0, lb, sb, 0x33, 0, tdat ); + TEST_ST_SRC21_BYPASS( 19, 0, 1, lb, sb, 0x23, 1, tdat ); + TEST_ST_SRC21_BYPASS( 20, 0, 2, lb, sb, 0x22, 2, tdat ); + TEST_ST_SRC21_BYPASS( 21, 1, 0, lb, sb, 0x12, 3, tdat ); + TEST_ST_SRC21_BYPASS( 22, 1, 1, lb, sb, 0x11, 4, tdat ); + TEST_ST_SRC21_BYPASS( 23, 2, 0, lb, sb, 0x01, 5, tdat ); + + li a0, 0xef + la a1, tdat + sb a0, 3(a1) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .byte 0xef +tdat2: .byte 0xef +tdat3: .byte 0xef +tdat4: .byte 0xef +tdat5: .byte 0xef +tdat6: .byte 0xef +tdat7: .byte 0xef +tdat8: .byte 0xef +tdat9: .byte 0xef +tdat10: .byte 0xef + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sd.S b/apps/riscv-tests/isa/rv64ui/sd.S new file mode 100644 index 0000000..b6fd66d --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sd.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sd.S +#----------------------------------------------------------------------------- +# +# Test sd instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_ST_OP( 2, ld, sd, 0x00aa00aa00aa00aa, 0, tdat ); + TEST_ST_OP( 3, ld, sd, 0xaa00aa00aa00aa00, 8, tdat ); + TEST_ST_OP( 4, ld, sd, 0x0aa00aa00aa00aa0, 16, tdat ); + TEST_ST_OP( 5, ld, sd, 0xa00aa00aa00aa00a, 24, tdat ); + + # Test with negative offset + + TEST_ST_OP( 6, ld, sd, 0x00aa00aa00aa00aa, -24, tdat8 ); + TEST_ST_OP( 7, ld, sd, 0xaa00aa00aa00aa00, -16, tdat8 ); + TEST_ST_OP( 8, ld, sd, 0x0aa00aa00aa00aa0, -8, tdat8 ); + TEST_ST_OP( 9, ld, sd, 0xa00aa00aa00aa00a, 0, tdat8 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x1234567812345678, \ + la x1, tdat9; \ + li x2, 0x1234567812345678; \ + addi x4, x1, -32; \ + sd x2, 32(x4); \ + ld x5, 0(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x5821309858213098, \ + la x1, tdat9; \ + li x2, 0x5821309858213098; \ + addi x1, x1, -3; \ + sd x2, 11(x1); \ + la x4, tdat10; \ + ld x5, 0(x4); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_ST_SRC12_BYPASS( 12, 0, 0, ld, sd, 0xabbccdd, 0, tdat ); + TEST_ST_SRC12_BYPASS( 13, 0, 1, ld, sd, 0xaabbccd, 8, tdat ); + TEST_ST_SRC12_BYPASS( 14, 0, 2, ld, sd, 0xdaabbcc, 16, tdat ); + TEST_ST_SRC12_BYPASS( 15, 1, 0, ld, sd, 0xddaabbc, 24, tdat ); + TEST_ST_SRC12_BYPASS( 16, 1, 1, ld, sd, 0xcddaabb, 32, tdat ); + TEST_ST_SRC12_BYPASS( 17, 2, 0, ld, sd, 0xccddaab, 40, tdat ); + + TEST_ST_SRC21_BYPASS( 18, 0, 0, ld, sd, 0x00112233, 0, tdat ); + TEST_ST_SRC21_BYPASS( 19, 0, 1, ld, sd, 0x30011223, 8, tdat ); + TEST_ST_SRC21_BYPASS( 20, 0, 2, ld, sd, 0x33001122, 16, tdat ); + TEST_ST_SRC21_BYPASS( 21, 1, 0, ld, sd, 0x23300112, 24, tdat ); + TEST_ST_SRC21_BYPASS( 22, 1, 1, ld, sd, 0x22330011, 32, tdat ); + TEST_ST_SRC21_BYPASS( 23, 2, 0, ld, sd, 0x12233001, 40, tdat ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .dword 0xdeadbeefdeadbeef +tdat2: .dword 0xdeadbeefdeadbeef +tdat3: .dword 0xdeadbeefdeadbeef +tdat4: .dword 0xdeadbeefdeadbeef +tdat5: .dword 0xdeadbeefdeadbeef +tdat6: .dword 0xdeadbeefdeadbeef +tdat7: .dword 0xdeadbeefdeadbeef +tdat8: .dword 0xdeadbeefdeadbeef +tdat9: .dword 0xdeadbeefdeadbeef +tdat10: .dword 0xdeadbeefdeadbeef + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sh.S b/apps/riscv-tests/isa/rv64ui/sh.S new file mode 100644 index 0000000..ea9eb23 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sh.S @@ -0,0 +1,96 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sh.S +#----------------------------------------------------------------------------- +# +# Test sh instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_ST_OP( 2, lh, sh, 0x00000000000000aa, 0, tdat ); + TEST_ST_OP( 3, lh, sh, 0xffffffffffffaa00, 2, tdat ); + TEST_ST_OP( 4, lw, sh, 0xffffffffbeef0aa0, 4, tdat ); + TEST_ST_OP( 5, lh, sh, 0xffffffffffffa00a, 6, tdat ); + + # Test with negative offset + + TEST_ST_OP( 6, lh, sh, 0x00000000000000aa, -6, tdat8 ); + TEST_ST_OP( 7, lh, sh, 0xffffffffffffaa00, -4, tdat8 ); + TEST_ST_OP( 8, lh, sh, 0x0000000000000aa0, -2, tdat8 ); + TEST_ST_OP( 9, lh, sh, 0xffffffffffffa00a, 0, tdat8 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x5678, \ + la x1, tdat9; \ + li x2, 0x12345678; \ + addi x4, x1, -32; \ + sh x2, 32(x4); \ + lh x5, 0(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x3098, \ + la x1, tdat9; \ + li x2, 0x00003098; \ + addi x1, x1, -5; \ + sh x2, 7(x1); \ + la x4, tdat10; \ + lh x5, 0(x4); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_ST_SRC12_BYPASS( 12, 0, 0, lh, sh, 0xffffffffffffccdd, 0, tdat ); + TEST_ST_SRC12_BYPASS( 13, 0, 1, lh, sh, 0xffffffffffffbccd, 2, tdat ); + TEST_ST_SRC12_BYPASS( 14, 0, 2, lh, sh, 0xffffffffffffbbcc, 4, tdat ); + TEST_ST_SRC12_BYPASS( 15, 1, 0, lh, sh, 0xffffffffffffabbc, 6, tdat ); + TEST_ST_SRC12_BYPASS( 16, 1, 1, lh, sh, 0xffffffffffffaabb, 8, tdat ); + TEST_ST_SRC12_BYPASS( 17, 2, 0, lh, sh, 0xffffffffffffdaab, 10, tdat ); + + TEST_ST_SRC21_BYPASS( 18, 0, 0, lh, sh, 0x2233, 0, tdat ); + TEST_ST_SRC21_BYPASS( 19, 0, 1, lh, sh, 0x1223, 2, tdat ); + TEST_ST_SRC21_BYPASS( 20, 0, 2, lh, sh, 0x1122, 4, tdat ); + TEST_ST_SRC21_BYPASS( 21, 1, 0, lh, sh, 0x0112, 6, tdat ); + TEST_ST_SRC21_BYPASS( 22, 1, 1, lh, sh, 0x0011, 8, tdat ); + TEST_ST_SRC21_BYPASS( 23, 2, 0, lh, sh, 0x3001, 10, tdat ); + + li a0, 0xbeef + la a1, tdat + sh a0, 6(a1) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .half 0xbeef +tdat2: .half 0xbeef +tdat3: .half 0xbeef +tdat4: .half 0xbeef +tdat5: .half 0xbeef +tdat6: .half 0xbeef +tdat7: .half 0xbeef +tdat8: .half 0xbeef +tdat9: .half 0xbeef +tdat10: .half 0xbeef + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/simple.S b/apps/riscv-tests/isa/rv64ui/simple.S new file mode 100644 index 0000000..6c45fbd --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/simple.S @@ -0,0 +1,27 @@ +# See LICENSE for license details. + +#***************************************************************************** +# simple.S +#----------------------------------------------------------------------------- +# +# This is the most basic self checking test. If your simulator does not +# pass thiss then there is little chance that it will pass any of the +# more complicated self checking tests. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + +RVTEST_PASS + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sll.S b/apps/riscv-tests/isa/rv64ui/sll.S new file mode 100644 index 0000000..8682743 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sll.S @@ -0,0 +1,96 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sll.S +#----------------------------------------------------------------------------- +# +# Test sll instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, sll, 0x0000000000000001, 0x0000000000000001, 0 ); + TEST_RR_OP( 3, sll, 0x0000000000000002, 0x0000000000000001, 1 ); + TEST_RR_OP( 4, sll, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_OP( 5, sll, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_OP( 6, sll, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_RR_OP( 7, sll, 0xffffffffffffffff, 0xffffffffffffffff, 0 ); + TEST_RR_OP( 8, sll, 0xfffffffffffffffe, 0xffffffffffffffff, 1 ); + TEST_RR_OP( 9, sll, 0xffffffffffffff80, 0xffffffffffffffff, 7 ); + TEST_RR_OP( 10, sll, 0xffffffffffffc000, 0xffffffffffffffff, 14 ); + TEST_RR_OP( 11, sll, 0xffffffff80000000, 0xffffffffffffffff, 31 ); + + TEST_RR_OP( 12, sll, 0x0000000021212121, 0x0000000021212121, 0 ); + TEST_RR_OP( 13, sll, 0x0000000042424242, 0x0000000021212121, 1 ); + TEST_RR_OP( 14, sll, 0x0000001090909080, 0x0000000021212121, 7 ); + TEST_RR_OP( 15, sll, 0x0000084848484000, 0x0000000021212121, 14 ); + TEST_RR_OP( 16, sll, 0x1090909080000000, 0x0000000021212121, 31 ); + + # Verify that shifts only use bottom six(rv64) or five(rv32) bits + + TEST_RR_OP( 17, sll, 0x0000000021212121, 0x0000000021212121, 0xffffffffffffffc0 ); + TEST_RR_OP( 18, sll, 0x0000000042424242, 0x0000000021212121, 0xffffffffffffffc1 ); + TEST_RR_OP( 19, sll, 0x0000001090909080, 0x0000000021212121, 0xffffffffffffffc7 ); + TEST_RR_OP( 20, sll, 0x0000084848484000, 0x0000000021212121, 0xffffffffffffffce ); + +#if __riscv_xlen == 64 + TEST_RR_OP( 21, sll, 0x8000000000000000, 0x0000000021212121, 0xffffffffffffffff ); + TEST_RR_OP( 50, sll, 0x8000000000000000, 0x0000000000000001, 63 ); + TEST_RR_OP( 51, sll, 0xffffff8000000000, 0xffffffffffffffff, 39 ); + TEST_RR_OP( 52, sll, 0x0909080000000000, 0x0000000021212121, 43 ); +#endif + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 22, sll, 0x00000080, 0x00000001, 7 ); + TEST_RR_SRC2_EQ_DEST( 23, sll, 0x00004000, 0x00000001, 14 ); + TEST_RR_SRC12_EQ_DEST( 24, sll, 24, 3 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 25, 0, sll, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_DEST_BYPASS( 26, 1, sll, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_DEST_BYPASS( 27, 2, sll, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_RR_SRC12_BYPASS( 28, 0, 0, sll, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC12_BYPASS( 29, 0, 1, sll, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC12_BYPASS( 30, 0, 2, sll, 0x0000000080000000, 0x0000000000000001, 31 ); + TEST_RR_SRC12_BYPASS( 31, 1, 0, sll, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC12_BYPASS( 32, 1, 1, sll, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC12_BYPASS( 33, 2, 0, sll, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_RR_SRC21_BYPASS( 34, 0, 0, sll, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC21_BYPASS( 35, 0, 1, sll, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC21_BYPASS( 36, 0, 2, sll, 0x0000000080000000, 0x0000000000000001, 31 ); + TEST_RR_SRC21_BYPASS( 37, 1, 0, sll, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC21_BYPASS( 38, 1, 1, sll, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC21_BYPASS( 39, 2, 0, sll, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_RR_ZEROSRC1( 40, sll, 0, 15 ); + TEST_RR_ZEROSRC2( 41, sll, 32, 32 ); + TEST_RR_ZEROSRC12( 42, sll, 0 ); + TEST_RR_ZERODEST( 43, sll, 1024, 2048 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/slli.S b/apps/riscv-tests/isa/rv64ui/slli.S new file mode 100644 index 0000000..b5341ad --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/slli.S @@ -0,0 +1,74 @@ +# See LICENSE for license details. + +#***************************************************************************** +# slli.S +#----------------------------------------------------------------------------- +# +# Test slli instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, slli, 0x0000000000000001, 0x0000000000000001, 0 ); + TEST_IMM_OP( 3, slli, 0x0000000000000002, 0x0000000000000001, 1 ); + TEST_IMM_OP( 4, slli, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_IMM_OP( 5, slli, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_IMM_OP( 6, slli, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_IMM_OP( 7, slli, 0xffffffffffffffff, 0xffffffffffffffff, 0 ); + TEST_IMM_OP( 8, slli, 0xfffffffffffffffe, 0xffffffffffffffff, 1 ); + TEST_IMM_OP( 9, slli, 0xffffffffffffff80, 0xffffffffffffffff, 7 ); + TEST_IMM_OP( 10, slli, 0xffffffffffffc000, 0xffffffffffffffff, 14 ); + TEST_IMM_OP( 11, slli, 0xffffffff80000000, 0xffffffffffffffff, 31 ); + + TEST_IMM_OP( 12, slli, 0x0000000021212121, 0x0000000021212121, 0 ); + TEST_IMM_OP( 13, slli, 0x0000000042424242, 0x0000000021212121, 1 ); + TEST_IMM_OP( 14, slli, 0x0000001090909080, 0x0000000021212121, 7 ); + TEST_IMM_OP( 15, slli, 0x0000084848484000, 0x0000000021212121, 14 ); + TEST_IMM_OP( 16, slli, 0x1090909080000000, 0x0000000021212121, 31 ); + +#if __riscv_xlen == 64 + TEST_IMM_OP( 50, slli, 0x8000000000000000, 0x0000000000000001, 63 ); + TEST_IMM_OP( 51, slli, 0xffffff8000000000, 0xffffffffffffffff, 39 ); + TEST_IMM_OP( 52, slli, 0x0909080000000000, 0x0000000021212121, 43 ); +#endif + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, slli, 0x00000080, 0x00000001, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, slli, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_IMM_DEST_BYPASS( 19, 1, slli, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_IMM_DEST_BYPASS( 20, 2, slli, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, slli, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_IMM_SRC1_BYPASS( 22, 1, slli, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_IMM_SRC1_BYPASS( 23, 2, slli, 0x0000000080000000, 0x0000000000000001, 31 ); + + TEST_IMM_ZEROSRC1( 24, slli, 0, 31 ); + TEST_IMM_ZERODEST( 25, slli, 33, 20 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/slliw.S b/apps/riscv-tests/isa/rv64ui/slliw.S new file mode 100644 index 0000000..0ed888b --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/slliw.S @@ -0,0 +1,75 @@ +# See LICENSE for license details. + +#***************************************************************************** +# slliw.S +#----------------------------------------------------------------------------- +# +# Test slliw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, slliw, 0x0000000000000001, 0x0000000000000001, 0 ); + TEST_IMM_OP( 3, slliw, 0x0000000000000002, 0x0000000000000001, 1 ); + TEST_IMM_OP( 4, slliw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_IMM_OP( 5, slliw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_IMM_OP( 6, slliw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_IMM_OP( 7, slliw, 0xffffffffffffffff, 0xffffffffffffffff, 0 ); + TEST_IMM_OP( 8, slliw, 0xfffffffffffffffe, 0xffffffffffffffff, 1 ); + TEST_IMM_OP( 9, slliw, 0xffffffffffffff80, 0xffffffffffffffff, 7 ); + TEST_IMM_OP( 10, slliw, 0xffffffffffffc000, 0xffffffffffffffff, 14 ); + TEST_IMM_OP( 11, slliw, 0xffffffff80000000, 0xffffffffffffffff, 31 ); + + TEST_IMM_OP( 12, slliw, 0x0000000021212121, 0x0000000021212121, 0 ); + TEST_IMM_OP( 13, slliw, 0x0000000042424242, 0x0000000021212121, 1 ); + TEST_IMM_OP( 14, slliw, 0xffffffff90909080, 0x0000000021212121, 7 ); + TEST_IMM_OP( 15, slliw, 0x0000000048484000, 0x0000000021212121, 14 ); + TEST_IMM_OP( 16, slliw, 0xffffffff80000000, 0x0000000021212121, 31 ); + + # Verify that shifts ignore top 32 (using true 64-bit values) + + TEST_IMM_OP( 44, slliw, 0x0000000012345678, 0xffffffff12345678, 0 ); + TEST_IMM_OP( 45, slliw, 0x0000000023456780, 0xffffffff12345678, 4 ); + TEST_IMM_OP( 46, slliw, 0xffffffff92345678, 0x0000000092345678, 0 ); + TEST_IMM_OP( 47, slliw, 0xffffffff93456780, 0x0000000099345678, 4 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, slliw, 0x00000080, 0x00000001, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, slliw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_IMM_DEST_BYPASS( 19, 1, slliw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_IMM_DEST_BYPASS( 20, 2, slliw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, slliw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_IMM_SRC1_BYPASS( 22, 1, slliw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_IMM_SRC1_BYPASS( 23, 2, slliw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_IMM_ZEROSRC1( 24, slliw, 0, 31 ); + TEST_IMM_ZERODEST( 25, slliw, 31, 28 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sllw.S b/apps/riscv-tests/isa/rv64ui/sllw.S new file mode 100644 index 0000000..62b4db6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sllw.S @@ -0,0 +1,97 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sllw.S +#----------------------------------------------------------------------------- +# +# Test sllw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, sllw, 0x0000000000000001, 0x0000000000000001, 0 ); + TEST_RR_OP( 3, sllw, 0x0000000000000002, 0x0000000000000001, 1 ); + TEST_RR_OP( 4, sllw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_OP( 5, sllw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_OP( 6, sllw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_RR_OP( 7, sllw, 0xffffffffffffffff, 0xffffffffffffffff, 0 ); + TEST_RR_OP( 8, sllw, 0xfffffffffffffffe, 0xffffffffffffffff, 1 ); + TEST_RR_OP( 9, sllw, 0xffffffffffffff80, 0xffffffffffffffff, 7 ); + TEST_RR_OP( 10, sllw, 0xffffffffffffc000, 0xffffffffffffffff, 14 ); + TEST_RR_OP( 11, sllw, 0xffffffff80000000, 0xffffffffffffffff, 31 ); + + TEST_RR_OP( 12, sllw, 0x0000000021212121, 0x0000000021212121, 0 ); + TEST_RR_OP( 13, sllw, 0x0000000042424242, 0x0000000021212121, 1 ); + TEST_RR_OP( 14, sllw, 0xffffffff90909080, 0x0000000021212121, 7 ); + TEST_RR_OP( 15, sllw, 0x0000000048484000, 0x0000000021212121, 14 ); + TEST_RR_OP( 16, sllw, 0xffffffff80000000, 0x0000000021212121, 31 ); + + # Verify that shifts only use bottom five bits + + TEST_RR_OP( 17, sllw, 0x0000000021212121, 0x0000000021212121, 0xffffffffffffffe0 ); + TEST_RR_OP( 18, sllw, 0x0000000042424242, 0x0000000021212121, 0xffffffffffffffe1 ); + TEST_RR_OP( 19, sllw, 0xffffffff90909080, 0x0000000021212121, 0xffffffffffffffe7 ); + TEST_RR_OP( 20, sllw, 0x0000000048484000, 0x0000000021212121, 0xffffffffffffffee ); + TEST_RR_OP( 21, sllw, 0xffffffff80000000, 0x0000000021212121, 0xffffffffffffffff ); + + # Verify that shifts ignore top 32 (using true 64-bit values) + + TEST_RR_OP( 44, sllw, 0x0000000012345678, 0xffffffff12345678, 0 ); + TEST_RR_OP( 45, sllw, 0x0000000023456780, 0xffffffff12345678, 4 ); + TEST_RR_OP( 46, sllw, 0xffffffff92345678, 0x0000000092345678, 0 ); + TEST_RR_OP( 47, sllw, 0xffffffff93456780, 0x0000000099345678, 4 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 22, sllw, 0x00000080, 0x00000001, 7 ); + TEST_RR_SRC2_EQ_DEST( 23, sllw, 0x00004000, 0x00000001, 14 ); + TEST_RR_SRC12_EQ_DEST( 24, sllw, 24, 3 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 25, 0, sllw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_DEST_BYPASS( 26, 1, sllw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_DEST_BYPASS( 27, 2, sllw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_RR_SRC12_BYPASS( 28, 0, 0, sllw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC12_BYPASS( 29, 0, 1, sllw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC12_BYPASS( 30, 0, 2, sllw, 0xffffffff80000000, 0x0000000000000001, 31 ); + TEST_RR_SRC12_BYPASS( 31, 1, 0, sllw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC12_BYPASS( 32, 1, 1, sllw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC12_BYPASS( 33, 2, 0, sllw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_RR_SRC21_BYPASS( 34, 0, 0, sllw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC21_BYPASS( 35, 0, 1, sllw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC21_BYPASS( 36, 0, 2, sllw, 0xffffffff80000000, 0x0000000000000001, 31 ); + TEST_RR_SRC21_BYPASS( 37, 1, 0, sllw, 0x0000000000000080, 0x0000000000000001, 7 ); + TEST_RR_SRC21_BYPASS( 38, 1, 1, sllw, 0x0000000000004000, 0x0000000000000001, 14 ); + TEST_RR_SRC21_BYPASS( 39, 2, 0, sllw, 0xffffffff80000000, 0x0000000000000001, 31 ); + + TEST_RR_ZEROSRC1( 40, sllw, 0, 15 ); + TEST_RR_ZEROSRC2( 41, sllw, 32, 32 ); + TEST_RR_ZEROSRC12( 42, sllw, 0 ); + TEST_RR_ZERODEST( 43, sllw, 1024, 2048 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/slt.S b/apps/riscv-tests/isa/rv64ui/slt.S new file mode 100644 index 0000000..644a51a --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/slt.S @@ -0,0 +1,84 @@ +# See LICENSE for license details. + +#***************************************************************************** +# slt.S +#----------------------------------------------------------------------------- +# +# Test slt instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, slt, 0, 0x0000000000000000, 0x0000000000000000 ); + TEST_RR_OP( 3, slt, 0, 0x0000000000000001, 0x0000000000000001 ); + TEST_RR_OP( 4, slt, 1, 0x0000000000000003, 0x0000000000000007 ); + TEST_RR_OP( 5, slt, 0, 0x0000000000000007, 0x0000000000000003 ); + + TEST_RR_OP( 6, slt, 0, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 7, slt, 1, 0xffffffff80000000, 0x0000000000000000 ); + TEST_RR_OP( 8, slt, 1, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP( 9, slt, 1, 0x0000000000000000, 0x0000000000007fff ); + TEST_RR_OP( 10, slt, 0, 0x000000007fffffff, 0x0000000000000000 ); + TEST_RR_OP( 11, slt, 0, 0x000000007fffffff, 0x0000000000007fff ); + + TEST_RR_OP( 12, slt, 1, 0xffffffff80000000, 0x0000000000007fff ); + TEST_RR_OP( 13, slt, 0, 0x000000007fffffff, 0xffffffffffff8000 ); + + TEST_RR_OP( 14, slt, 0, 0x0000000000000000, 0xffffffffffffffff ); + TEST_RR_OP( 15, slt, 1, 0xffffffffffffffff, 0x0000000000000001 ); + TEST_RR_OP( 16, slt, 0, 0xffffffffffffffff, 0xffffffffffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 17, slt, 0, 14, 13 ); + TEST_RR_SRC2_EQ_DEST( 18, slt, 1, 11, 13 ); + TEST_RR_SRC12_EQ_DEST( 19, slt, 0, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 20, 0, slt, 1, 11, 13 ); + TEST_RR_DEST_BYPASS( 21, 1, slt, 0, 14, 13 ); + TEST_RR_DEST_BYPASS( 22, 2, slt, 1, 12, 13 ); + + TEST_RR_SRC12_BYPASS( 23, 0, 0, slt, 0, 14, 13 ); + TEST_RR_SRC12_BYPASS( 24, 0, 1, slt, 1, 11, 13 ); + TEST_RR_SRC12_BYPASS( 25, 0, 2, slt, 0, 15, 13 ); + TEST_RR_SRC12_BYPASS( 26, 1, 0, slt, 1, 10, 13 ); + TEST_RR_SRC12_BYPASS( 27, 1, 1, slt, 0, 16, 13 ); + TEST_RR_SRC12_BYPASS( 28, 2, 0, slt, 1, 9, 13 ); + + TEST_RR_SRC21_BYPASS( 29, 0, 0, slt, 0, 17, 13 ); + TEST_RR_SRC21_BYPASS( 30, 0, 1, slt, 1, 8, 13 ); + TEST_RR_SRC21_BYPASS( 31, 0, 2, slt, 0, 18, 13 ); + TEST_RR_SRC21_BYPASS( 32, 1, 0, slt, 1, 7, 13 ); + TEST_RR_SRC21_BYPASS( 33, 1, 1, slt, 0, 19, 13 ); + TEST_RR_SRC21_BYPASS( 34, 2, 0, slt, 1, 6, 13 ); + + TEST_RR_ZEROSRC1( 35, slt, 0, -1 ); + TEST_RR_ZEROSRC2( 36, slt, 1, -1 ); + TEST_RR_ZEROSRC12( 37, slt, 0 ); + TEST_RR_ZERODEST( 38, slt, 16, 30 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/slti.S b/apps/riscv-tests/isa/rv64ui/slti.S new file mode 100644 index 0000000..9222fa4 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/slti.S @@ -0,0 +1,70 @@ +# See LICENSE for license details. + +#***************************************************************************** +# slti.S +#----------------------------------------------------------------------------- +# +# Test slti instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, slti, 0, 0x0000000000000000, 0x000 ); + TEST_IMM_OP( 3, slti, 0, 0x0000000000000001, 0x001 ); + TEST_IMM_OP( 4, slti, 1, 0x0000000000000003, 0x007 ); + TEST_IMM_OP( 5, slti, 0, 0x0000000000000007, 0x003 ); + + TEST_IMM_OP( 6, slti, 0, 0x0000000000000000, 0x800 ); + TEST_IMM_OP( 7, slti, 1, 0xffffffff80000000, 0x000 ); + TEST_IMM_OP( 8, slti, 1, 0xffffffff80000000, 0x800 ); + + TEST_IMM_OP( 9, slti, 1, 0x0000000000000000, 0x7ff ); + TEST_IMM_OP( 10, slti, 0, 0x000000007fffffff, 0x000 ); + TEST_IMM_OP( 11, slti, 0, 0x000000007fffffff, 0x7ff ); + + TEST_IMM_OP( 12, slti, 1, 0xffffffff80000000, 0x7ff ); + TEST_IMM_OP( 13, slti, 0, 0x000000007fffffff, 0x800 ); + + TEST_IMM_OP( 14, slti, 0, 0x0000000000000000, 0xfff ); + TEST_IMM_OP( 15, slti, 1, 0xffffffffffffffff, 0x001 ); + TEST_IMM_OP( 16, slti, 0, 0xffffffffffffffff, 0xfff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, slti, 1, 11, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, slti, 0, 15, 10 ); + TEST_IMM_DEST_BYPASS( 19, 1, slti, 1, 10, 16 ); + TEST_IMM_DEST_BYPASS( 20, 2, slti, 0, 16, 9 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, slti, 1, 11, 15 ); + TEST_IMM_SRC1_BYPASS( 22, 1, slti, 0, 17, 8 ); + TEST_IMM_SRC1_BYPASS( 23, 2, slti, 1, 12, 14 ); + + TEST_IMM_ZEROSRC1( 24, slti, 0, 0xfff ); + TEST_IMM_ZERODEST( 25, slti, 0x00ff00ff, 0xfff ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sltiu.S b/apps/riscv-tests/isa/rv64ui/sltiu.S new file mode 100644 index 0000000..f6a719b --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sltiu.S @@ -0,0 +1,70 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sltiu.S +#----------------------------------------------------------------------------- +# +# Test sltiu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, sltiu, 0, 0x0000000000000000, 0x000 ); + TEST_IMM_OP( 3, sltiu, 0, 0x0000000000000001, 0x001 ); + TEST_IMM_OP( 4, sltiu, 1, 0x0000000000000003, 0x007 ); + TEST_IMM_OP( 5, sltiu, 0, 0x0000000000000007, 0x003 ); + + TEST_IMM_OP( 6, sltiu, 1, 0x0000000000000000, 0x800 ); + TEST_IMM_OP( 7, sltiu, 0, 0xffffffff80000000, 0x000 ); + TEST_IMM_OP( 8, sltiu, 1, 0xffffffff80000000, 0x800 ); + + TEST_IMM_OP( 9, sltiu, 1, 0x0000000000000000, 0x7ff ); + TEST_IMM_OP( 10, sltiu, 0, 0x000000007fffffff, 0x000 ); + TEST_IMM_OP( 11, sltiu, 0, 0x000000007fffffff, 0x7ff ); + + TEST_IMM_OP( 12, sltiu, 0, 0xffffffff80000000, 0x7ff ); + TEST_IMM_OP( 13, sltiu, 1, 0x000000007fffffff, 0x800 ); + + TEST_IMM_OP( 14, sltiu, 1, 0x0000000000000000, 0xfff ); + TEST_IMM_OP( 15, sltiu, 0, 0xffffffffffffffff, 0x001 ); + TEST_IMM_OP( 16, sltiu, 0, 0xffffffffffffffff, 0xfff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, sltiu, 1, 11, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, sltiu, 0, 15, 10 ); + TEST_IMM_DEST_BYPASS( 19, 1, sltiu, 1, 10, 16 ); + TEST_IMM_DEST_BYPASS( 20, 2, sltiu, 0, 16, 9 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, sltiu, 1, 11, 15 ); + TEST_IMM_SRC1_BYPASS( 22, 1, sltiu, 0, 17, 8 ); + TEST_IMM_SRC1_BYPASS( 23, 2, sltiu, 1, 12, 14 ); + + TEST_IMM_ZEROSRC1( 24, sltiu, 1, 0xfff ); + TEST_IMM_ZERODEST( 25, sltiu, 0x00ff00ff, 0xfff ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sltu.S b/apps/riscv-tests/isa/rv64ui/sltu.S new file mode 100644 index 0000000..52ff685 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sltu.S @@ -0,0 +1,84 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sltu.S +#----------------------------------------------------------------------------- +# +# Test sltu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, sltu, 0, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, sltu, 0, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, sltu, 1, 0x00000003, 0x00000007 ); + TEST_RR_OP( 5, sltu, 0, 0x00000007, 0x00000003 ); + + TEST_RR_OP( 6, sltu, 1, 0x00000000, 0xffff8000 ); + TEST_RR_OP( 7, sltu, 0, 0x80000000, 0x00000000 ); + TEST_RR_OP( 8, sltu, 1, 0x80000000, 0xffff8000 ); + + TEST_RR_OP( 9, sltu, 1, 0x00000000, 0x00007fff ); + TEST_RR_OP( 10, sltu, 0, 0x7fffffff, 0x00000000 ); + TEST_RR_OP( 11, sltu, 0, 0x7fffffff, 0x00007fff ); + + TEST_RR_OP( 12, sltu, 0, 0x80000000, 0x00007fff ); + TEST_RR_OP( 13, sltu, 1, 0x7fffffff, 0xffff8000 ); + + TEST_RR_OP( 14, sltu, 1, 0x00000000, 0xffffffff ); + TEST_RR_OP( 15, sltu, 0, 0xffffffff, 0x00000001 ); + TEST_RR_OP( 16, sltu, 0, 0xffffffff, 0xffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 17, sltu, 0, 14, 13 ); + TEST_RR_SRC2_EQ_DEST( 18, sltu, 1, 11, 13 ); + TEST_RR_SRC12_EQ_DEST( 19, sltu, 0, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 20, 0, sltu, 1, 11, 13 ); + TEST_RR_DEST_BYPASS( 21, 1, sltu, 0, 14, 13 ); + TEST_RR_DEST_BYPASS( 22, 2, sltu, 1, 12, 13 ); + + TEST_RR_SRC12_BYPASS( 23, 0, 0, sltu, 0, 14, 13 ); + TEST_RR_SRC12_BYPASS( 24, 0, 1, sltu, 1, 11, 13 ); + TEST_RR_SRC12_BYPASS( 25, 0, 2, sltu, 0, 15, 13 ); + TEST_RR_SRC12_BYPASS( 26, 1, 0, sltu, 1, 10, 13 ); + TEST_RR_SRC12_BYPASS( 27, 1, 1, sltu, 0, 16, 13 ); + TEST_RR_SRC12_BYPASS( 28, 2, 0, sltu, 1, 9, 13 ); + + TEST_RR_SRC21_BYPASS( 29, 0, 0, sltu, 0, 17, 13 ); + TEST_RR_SRC21_BYPASS( 30, 0, 1, sltu, 1, 8, 13 ); + TEST_RR_SRC21_BYPASS( 31, 0, 2, sltu, 0, 18, 13 ); + TEST_RR_SRC21_BYPASS( 32, 1, 0, sltu, 1, 7, 13 ); + TEST_RR_SRC21_BYPASS( 33, 1, 1, sltu, 0, 19, 13 ); + TEST_RR_SRC21_BYPASS( 34, 2, 0, sltu, 1, 6, 13 ); + + TEST_RR_ZEROSRC1( 35, sltu, 1, -1 ); + TEST_RR_ZEROSRC2( 36, sltu, 0, -1 ); + TEST_RR_ZEROSRC12( 37, sltu, 0 ); + TEST_RR_ZERODEST( 38, sltu, 16, 30 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sra.S b/apps/riscv-tests/isa/rv64ui/sra.S new file mode 100644 index 0000000..580ae89 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sra.S @@ -0,0 +1,90 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sra.S +#----------------------------------------------------------------------------- +# +# Test sra instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, sra, 0xffffffff80000000, 0xffffffff80000000, 0 ); + TEST_RR_OP( 3, sra, 0xffffffffc0000000, 0xffffffff80000000, 1 ); + TEST_RR_OP( 4, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_OP( 5, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_OP( 6, sra, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_RR_OP( 7, sra, 0x000000007fffffff, 0x000000007fffffff, 0 ); + TEST_RR_OP( 8, sra, 0x000000003fffffff, 0x000000007fffffff, 1 ); + TEST_RR_OP( 9, sra, 0x0000000000ffffff, 0x000000007fffffff, 7 ); + TEST_RR_OP( 10, sra, 0x000000000001ffff, 0x000000007fffffff, 14 ); + TEST_RR_OP( 11, sra, 0x0000000000000000, 0x000000007fffffff, 31 ); + + TEST_RR_OP( 12, sra, 0xffffffff81818181, 0xffffffff81818181, 0 ); + TEST_RR_OP( 13, sra, 0xffffffffc0c0c0c0, 0xffffffff81818181, 1 ); + TEST_RR_OP( 14, sra, 0xffffffffff030303, 0xffffffff81818181, 7 ); + TEST_RR_OP( 15, sra, 0xfffffffffffe0606, 0xffffffff81818181, 14 ); + TEST_RR_OP( 16, sra, 0xffffffffffffffff, 0xffffffff81818181, 31 ); + + # Verify that shifts only use bottom six(rv64) or five(rv32) bits + + TEST_RR_OP( 17, sra, 0xffffffff81818181, 0xffffffff81818181, 0xffffffffffffffc0 ); + TEST_RR_OP( 18, sra, 0xffffffffc0c0c0c0, 0xffffffff81818181, 0xffffffffffffffc1 ); + TEST_RR_OP( 19, sra, 0xffffffffff030303, 0xffffffff81818181, 0xffffffffffffffc7 ); + TEST_RR_OP( 20, sra, 0xfffffffffffe0606, 0xffffffff81818181, 0xffffffffffffffce ); + TEST_RR_OP( 21, sra, 0xffffffffffffffff, 0xffffffff81818181, 0xffffffffffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 22, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC2_EQ_DEST( 23, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_EQ_DEST( 24, sra, 0, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 25, 0, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_DEST_BYPASS( 26, 1, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_DEST_BYPASS( 27, 2, sra, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + + TEST_RR_SRC12_BYPASS( 28, 0, 0, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC12_BYPASS( 29, 0, 1, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_BYPASS( 30, 0, 2, sra, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + TEST_RR_SRC12_BYPASS( 31, 1, 0, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC12_BYPASS( 32, 1, 1, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_BYPASS( 33, 2, 0, sra, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + + TEST_RR_SRC21_BYPASS( 34, 0, 0, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC21_BYPASS( 35, 0, 1, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC21_BYPASS( 36, 0, 2, sra, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + TEST_RR_SRC21_BYPASS( 37, 1, 0, sra, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC21_BYPASS( 38, 1, 1, sra, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC21_BYPASS( 39, 2, 0, sra, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + + TEST_RR_ZEROSRC1( 40, sra, 0, 15 ); + TEST_RR_ZEROSRC2( 41, sra, 32, 32 ); + TEST_RR_ZEROSRC12( 42, sra, 0 ); + TEST_RR_ZERODEST( 43, sra, 1024, 2048 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/srai.S b/apps/riscv-tests/isa/rv64ui/srai.S new file mode 100644 index 0000000..8d05213 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/srai.S @@ -0,0 +1,68 @@ +# See LICENSE for license details. + +#***************************************************************************** +# srai.S +#----------------------------------------------------------------------------- +# +# Test srai instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, srai, 0xffffff8000000000, 0xffffff8000000000, 0 ); + TEST_IMM_OP( 3, srai, 0xffffffffc0000000, 0xffffffff80000000, 1 ); + TEST_IMM_OP( 4, srai, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_IMM_OP( 5, srai, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_IMM_OP( 6, srai, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_IMM_OP( 7, srai, 0x000000007fffffff, 0x000000007fffffff, 0 ); + TEST_IMM_OP( 8, srai, 0x000000003fffffff, 0x000000007fffffff, 1 ); + TEST_IMM_OP( 9, srai, 0x0000000000ffffff, 0x000000007fffffff, 7 ); + TEST_IMM_OP( 10, srai, 0x000000000001ffff, 0x000000007fffffff, 14 ); + TEST_IMM_OP( 11, srai, 0x0000000000000000, 0x000000007fffffff, 31 ); + + TEST_IMM_OP( 12, srai, 0xffffffff81818181, 0xffffffff81818181, 0 ); + TEST_IMM_OP( 13, srai, 0xffffffffc0c0c0c0, 0xffffffff81818181, 1 ); + TEST_IMM_OP( 14, srai, 0xffffffffff030303, 0xffffffff81818181, 7 ); + TEST_IMM_OP( 15, srai, 0xfffffffffffe0606, 0xffffffff81818181, 14 ); + TEST_IMM_OP( 16, srai, 0xffffffffffffffff, 0xffffffff81818181, 31 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, srai, 0xffffffffff000000, 0xffffffff80000000, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, srai, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_IMM_DEST_BYPASS( 19, 1, srai, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_IMM_DEST_BYPASS( 20, 2, srai, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, srai, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_IMM_SRC1_BYPASS( 22, 1, srai, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_IMM_SRC1_BYPASS( 23, 2, srai, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_IMM_ZEROSRC1( 24, srai, 0, 4 ); + TEST_IMM_ZERODEST( 25, srai, 33, 10 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sraiw.S b/apps/riscv-tests/isa/rv64ui/sraiw.S new file mode 100644 index 0000000..a435e59 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sraiw.S @@ -0,0 +1,78 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sraiw.S +#----------------------------------------------------------------------------- +# +# Test sraiw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, sraiw, 0xffffffff80000000, 0xffffffff80000000, 0 ); + TEST_IMM_OP( 3, sraiw, 0xffffffffc0000000, 0xffffffff80000000, 1 ); + TEST_IMM_OP( 4, sraiw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_IMM_OP( 5, sraiw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_IMM_OP( 6, sraiw, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_IMM_OP( 7, sraiw, 0x000000007fffffff, 0x000000007fffffff, 0 ); + TEST_IMM_OP( 8, sraiw, 0x000000003fffffff, 0x000000007fffffff, 1 ); + TEST_IMM_OP( 9, sraiw, 0x0000000000ffffff, 0x000000007fffffff, 7 ); + TEST_IMM_OP( 10, sraiw, 0x000000000001ffff, 0x000000007fffffff, 14 ); + TEST_IMM_OP( 11, sraiw, 0x0000000000000000, 0x000000007fffffff, 31 ); + + TEST_IMM_OP( 12, sraiw, 0xffffffff81818181, 0xffffffff81818181, 0 ); + TEST_IMM_OP( 13, sraiw, 0xffffffffc0c0c0c0, 0xffffffff81818181, 1 ); + TEST_IMM_OP( 14, sraiw, 0xffffffffff030303, 0xffffffff81818181, 7 ); + TEST_IMM_OP( 15, sraiw, 0xfffffffffffe0606, 0xffffffff81818181, 14 ); + TEST_IMM_OP( 16, sraiw, 0xffffffffffffffff, 0xffffffff81818181, 31 ); + + # Verify that shifts ignore top 32 (using true 64-bit values) + + TEST_IMM_OP( 44, sraiw, 0x0000000012345678, 0xffffffff12345678, 0 ); + TEST_IMM_OP( 45, sraiw, 0x0000000001234567, 0xffffffff12345678, 4 ); + TEST_IMM_OP( 46, sraiw, 0xffffffff92345678, 0x0000000092345678, 0 ); + TEST_IMM_OP( 47, sraiw, 0xfffffffff9234567, 0x0000000092345678, 4 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, sraiw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, sraiw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_IMM_DEST_BYPASS( 19, 1, sraiw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_IMM_DEST_BYPASS( 20, 2, sraiw, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, sraiw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_IMM_SRC1_BYPASS( 22, 1, sraiw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_IMM_SRC1_BYPASS( 23, 2, sraiw, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_IMM_ZEROSRC1( 24, sraiw, 0, 31 ); + TEST_IMM_ZERODEST( 25, sraiw, 31, 28 ); + + TEST_IMM_OP( 26, sraiw, 0x0000000000000000, 0x00e0000000000000, 28) + TEST_IMM_OP( 27, sraiw, 0xffffffffff000000, 0x00000000f0000000, 4) + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sraw.S b/apps/riscv-tests/isa/rv64ui/sraw.S new file mode 100644 index 0000000..68d913e --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sraw.S @@ -0,0 +1,97 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sraw.S +#----------------------------------------------------------------------------- +# +# Test sraw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, sraw, 0xffffffff80000000, 0xffffffff80000000, 0 ); + TEST_RR_OP( 3, sraw, 0xffffffffc0000000, 0xffffffff80000000, 1 ); + TEST_RR_OP( 4, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_OP( 5, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_OP( 6, sraw, 0xffffffffffffffff, 0xffffffff80000001, 31 ); + + TEST_RR_OP( 7, sraw, 0x000000007fffffff, 0x000000007fffffff, 0 ); + TEST_RR_OP( 8, sraw, 0x000000003fffffff, 0x000000007fffffff, 1 ); + TEST_RR_OP( 9, sraw, 0x0000000000ffffff, 0x000000007fffffff, 7 ); + TEST_RR_OP( 10, sraw, 0x000000000001ffff, 0x000000007fffffff, 14 ); + TEST_RR_OP( 11, sraw, 0x0000000000000000, 0x000000007fffffff, 31 ); + + TEST_RR_OP( 12, sraw, 0xffffffff81818181, 0xffffffff81818181, 0 ); + TEST_RR_OP( 13, sraw, 0xffffffffc0c0c0c0, 0xffffffff81818181, 1 ); + TEST_RR_OP( 14, sraw, 0xffffffffff030303, 0xffffffff81818181, 7 ); + TEST_RR_OP( 15, sraw, 0xfffffffffffe0606, 0xffffffff81818181, 14 ); + TEST_RR_OP( 16, sraw, 0xffffffffffffffff, 0xffffffff81818181, 31 ); + + # Verify that shifts only use bottom five bits + + TEST_RR_OP( 17, sraw, 0xffffffff81818181, 0xffffffff81818181, 0xffffffffffffffe0 ); + TEST_RR_OP( 18, sraw, 0xffffffffc0c0c0c0, 0xffffffff81818181, 0xffffffffffffffe1 ); + TEST_RR_OP( 19, sraw, 0xffffffffff030303, 0xffffffff81818181, 0xffffffffffffffe7 ); + TEST_RR_OP( 20, sraw, 0xfffffffffffe0606, 0xffffffff81818181, 0xffffffffffffffee ); + TEST_RR_OP( 21, sraw, 0xffffffffffffffff, 0xffffffff81818181, 0xffffffffffffffff ); + + # Verify that shifts ignore top 32 (using true 64-bit values) + + TEST_RR_OP( 44, sraw, 0x0000000012345678, 0xffffffff12345678, 0 ); + TEST_RR_OP( 45, sraw, 0x0000000001234567, 0xffffffff12345678, 4 ); + TEST_RR_OP( 46, sraw, 0xffffffff92345678, 0x0000000092345678, 0 ); + TEST_RR_OP( 47, sraw, 0xfffffffff9234567, 0x0000000092345678, 4 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 22, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC2_EQ_DEST( 23, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_EQ_DEST( 24, sraw, 0, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 25, 0, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_DEST_BYPASS( 26, 1, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_DEST_BYPASS( 27, 2, sraw, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + + TEST_RR_SRC12_BYPASS( 28, 0, 0, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC12_BYPASS( 29, 0, 1, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_BYPASS( 30, 0, 2, sraw, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + TEST_RR_SRC12_BYPASS( 31, 1, 0, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC12_BYPASS( 32, 1, 1, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_BYPASS( 33, 2, 0, sraw, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + + TEST_RR_SRC21_BYPASS( 34, 0, 0, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC21_BYPASS( 35, 0, 1, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC21_BYPASS( 36, 0, 2, sraw, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + TEST_RR_SRC21_BYPASS( 37, 1, 0, sraw, 0xffffffffff000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC21_BYPASS( 38, 1, 1, sraw, 0xfffffffffffe0000, 0xffffffff80000000, 14 ); + TEST_RR_SRC21_BYPASS( 39, 2, 0, sraw, 0xffffffffffffffff, 0xffffffff80000000, 31 ); + + TEST_RR_ZEROSRC1( 40, sraw, 0, 15 ); + TEST_RR_ZEROSRC2( 41, sraw, 32, 32 ); + TEST_RR_ZEROSRC12( 42, sraw, 0 ); + TEST_RR_ZERODEST( 43, sraw, 1024, 2048 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/srl.S b/apps/riscv-tests/isa/rv64ui/srl.S new file mode 100644 index 0000000..5ee223f --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/srl.S @@ -0,0 +1,93 @@ +# See LICENSE for license details. + +#***************************************************************************** +# srl.S +#----------------------------------------------------------------------------- +# +# Test srl instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + +#define TEST_SRL(n, v, a) \ + TEST_RR_OP(n, srl, ((v) & ((1 << (__riscv_xlen-1) << 1) - 1)) >> (a), v, a) + + TEST_SRL( 2, 0xffffffff80000000, 0 ); + TEST_SRL( 3, 0xffffffff80000000, 1 ); + TEST_SRL( 4, 0xffffffff80000000, 7 ); + TEST_SRL( 5, 0xffffffff80000000, 14 ); + TEST_SRL( 6, 0xffffffff80000001, 31 ); + + TEST_SRL( 7, 0xffffffffffffffff, 0 ); + TEST_SRL( 8, 0xffffffffffffffff, 1 ); + TEST_SRL( 9, 0xffffffffffffffff, 7 ); + TEST_SRL( 10, 0xffffffffffffffff, 14 ); + TEST_SRL( 11, 0xffffffffffffffff, 31 ); + + TEST_SRL( 12, 0x0000000021212121, 0 ); + TEST_SRL( 13, 0x0000000021212121, 1 ); + TEST_SRL( 14, 0x0000000021212121, 7 ); + TEST_SRL( 15, 0x0000000021212121, 14 ); + TEST_SRL( 16, 0x0000000021212121, 31 ); + + # Verify that shifts only use bottom six(rv64) or five(rv32) bits + + TEST_RR_OP( 17, srl, 0x0000000021212121, 0x0000000021212121, 0xffffffffffffffc0 ); + TEST_RR_OP( 18, srl, 0x0000000010909090, 0x0000000021212121, 0xffffffffffffffc1 ); + TEST_RR_OP( 19, srl, 0x0000000000424242, 0x0000000021212121, 0xffffffffffffffc7 ); + TEST_RR_OP( 20, srl, 0x0000000000008484, 0x0000000021212121, 0xffffffffffffffce ); + TEST_RR_OP( 21, srl, 0x0000000000000000, 0x0000000021212121, 0xffffffffffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 22, srl, 0x01000000, 0x80000000, 7 ); + TEST_RR_SRC2_EQ_DEST( 23, srl, 0x00020000, 0x80000000, 14 ); + TEST_RR_SRC12_EQ_DEST( 24, srl, 0, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 25, 0, srl, 0x01000000, 0x80000000, 7 ); + TEST_RR_DEST_BYPASS( 26, 1, srl, 0x00020000, 0x80000000, 14 ); + TEST_RR_DEST_BYPASS( 27, 2, srl, 0x00000001, 0x80000000, 31 ); + + TEST_RR_SRC12_BYPASS( 28, 0, 0, srl, 0x01000000, 0x80000000, 7 ); + TEST_RR_SRC12_BYPASS( 29, 0, 1, srl, 0x00020000, 0x80000000, 14 ); + TEST_RR_SRC12_BYPASS( 30, 0, 2, srl, 0x00000001, 0x80000000, 31 ); + TEST_RR_SRC12_BYPASS( 31, 1, 0, srl, 0x01000000, 0x80000000, 7 ); + TEST_RR_SRC12_BYPASS( 32, 1, 1, srl, 0x00020000, 0x80000000, 14 ); + TEST_RR_SRC12_BYPASS( 33, 2, 0, srl, 0x00000001, 0x80000000, 31 ); + + TEST_RR_SRC21_BYPASS( 34, 0, 0, srl, 0x01000000, 0x80000000, 7 ); + TEST_RR_SRC21_BYPASS( 35, 0, 1, srl, 0x00020000, 0x80000000, 14 ); + TEST_RR_SRC21_BYPASS( 36, 0, 2, srl, 0x00000001, 0x80000000, 31 ); + TEST_RR_SRC21_BYPASS( 37, 1, 0, srl, 0x01000000, 0x80000000, 7 ); + TEST_RR_SRC21_BYPASS( 38, 1, 1, srl, 0x00020000, 0x80000000, 14 ); + TEST_RR_SRC21_BYPASS( 39, 2, 0, srl, 0x00000001, 0x80000000, 31 ); + + TEST_RR_ZEROSRC1( 40, srl, 0, 15 ); + TEST_RR_ZEROSRC2( 41, srl, 32, 32 ); + TEST_RR_ZEROSRC12( 42, srl, 0 ); + TEST_RR_ZERODEST( 43, srl, 1024, 2048 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/srli.S b/apps/riscv-tests/isa/rv64ui/srli.S new file mode 100644 index 0000000..3522957 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/srli.S @@ -0,0 +1,71 @@ +# See LICENSE for license details. + +#***************************************************************************** +# srli.S +#----------------------------------------------------------------------------- +# +# Test srli instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + +#define TEST_SRLI(n, v, a) \ + TEST_IMM_OP(n, srli, ((v) & ((1 << (__riscv_xlen-1) << 1) - 1)) >> (a), v, a) + + TEST_SRLI( 2, 0xffffffff80000000, 0 ); + TEST_SRLI( 3, 0xffffffff80000000, 1 ); + TEST_SRLI( 4, 0xffffffff80000000, 7 ); + TEST_SRLI( 5, 0xffffffff80000000, 14 ); + TEST_SRLI( 6, 0xffffffff80000001, 31 ); + + TEST_SRLI( 7, 0xffffffffffffffff, 0 ); + TEST_SRLI( 8, 0xffffffffffffffff, 1 ); + TEST_SRLI( 9, 0xffffffffffffffff, 7 ); + TEST_SRLI( 10, 0xffffffffffffffff, 14 ); + TEST_SRLI( 11, 0xffffffffffffffff, 31 ); + + TEST_SRLI( 12, 0x0000000021212121, 0 ); + TEST_SRLI( 13, 0x0000000021212121, 1 ); + TEST_SRLI( 14, 0x0000000021212121, 7 ); + TEST_SRLI( 15, 0x0000000021212121, 14 ); + TEST_SRLI( 16, 0x0000000021212121, 31 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, srli, 0x01000000, 0x80000000, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, srli, 0x01000000, 0x80000000, 7 ); + TEST_IMM_DEST_BYPASS( 19, 1, srli, 0x00020000, 0x80000000, 14 ); + TEST_IMM_DEST_BYPASS( 20, 2, srli, 0x00000001, 0x80000001, 31 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, srli, 0x01000000, 0x80000000, 7 ); + TEST_IMM_SRC1_BYPASS( 22, 1, srli, 0x00020000, 0x80000000, 14 ); + TEST_IMM_SRC1_BYPASS( 23, 2, srli, 0x00000001, 0x80000001, 31 ); + + TEST_IMM_ZEROSRC1( 24, srli, 0, 4 ); + TEST_IMM_ZERODEST( 25, srli, 33, 10 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/srliw.S b/apps/riscv-tests/isa/rv64ui/srliw.S new file mode 100644 index 0000000..471042f --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/srliw.S @@ -0,0 +1,75 @@ +# See LICENSE for license details. + +#***************************************************************************** +# srliw.S +#----------------------------------------------------------------------------- +# +# Test srliw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, srliw, 0xffffffff80000000, 0xffffffff80000000, 0 ); + TEST_IMM_OP( 3, srliw, 0x0000000040000000, 0xffffffff80000000, 1 ); + TEST_IMM_OP( 4, srliw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_IMM_OP( 5, srliw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_IMM_OP( 6, srliw, 0x0000000000000001, 0xffffffff80000001, 31 ); + + TEST_IMM_OP( 7, srliw, 0xffffffffffffffff, 0xffffffffffffffff, 0 ); + TEST_IMM_OP( 8, srliw, 0x000000007fffffff, 0xffffffffffffffff, 1 ); + TEST_IMM_OP( 9, srliw, 0x0000000001ffffff, 0xffffffffffffffff, 7 ); + TEST_IMM_OP( 10, srliw, 0x000000000003ffff, 0xffffffffffffffff, 14 ); + TEST_IMM_OP( 11, srliw, 0x0000000000000001, 0xffffffffffffffff, 31 ); + + TEST_IMM_OP( 12, srliw, 0x0000000021212121, 0x0000000021212121, 0 ); + TEST_IMM_OP( 13, srliw, 0x0000000010909090, 0x0000000021212121, 1 ); + TEST_IMM_OP( 14, srliw, 0x0000000000424242, 0x0000000021212121, 7 ); + TEST_IMM_OP( 15, srliw, 0x0000000000008484, 0x0000000021212121, 14 ); + TEST_IMM_OP( 16, srliw, 0x0000000000000000, 0x0000000021212121, 31 ); + + # Verify that shifts ignore top 32 (using true 64-bit values) + + TEST_IMM_OP( 44, srliw, 0x0000000012345678, 0xffffffff12345678, 0 ); + TEST_IMM_OP( 45, srliw, 0x0000000001234567, 0xffffffff12345678, 4 ); + TEST_IMM_OP( 46, srliw, 0xffffffff92345678, 0x0000000092345678, 0 ); + TEST_IMM_OP( 47, srliw, 0x0000000009234567, 0x0000000092345678, 4 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 17, srliw, 0x0000000001000000, 0xffffffff80000000, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 18, 0, srliw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_IMM_DEST_BYPASS( 19, 1, srliw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_IMM_DEST_BYPASS( 20, 2, srliw, 0x0000000000000001, 0xffffffff80000001, 31 ); + + TEST_IMM_SRC1_BYPASS( 21, 0, srliw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_IMM_SRC1_BYPASS( 22, 1, srliw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_IMM_SRC1_BYPASS( 23, 2, srliw, 0x0000000000000001, 0xffffffff80000001, 31 ); + + TEST_IMM_ZEROSRC1( 24, srliw, 0, 31 ); + TEST_IMM_ZERODEST( 25, srliw, 31, 28 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/srlw.S b/apps/riscv-tests/isa/rv64ui/srlw.S new file mode 100644 index 0000000..f0d1dae --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/srlw.S @@ -0,0 +1,97 @@ +# See LICENSE for license details. + +#***************************************************************************** +# srlw.S +#----------------------------------------------------------------------------- +# +# Test srlw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, srlw, 0xffffffff80000000, 0xffffffff80000000, 0 ); + TEST_RR_OP( 3, srlw, 0x0000000040000000, 0xffffffff80000000, 1 ); + TEST_RR_OP( 4, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_OP( 5, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_OP( 6, srlw, 0x0000000000000001, 0xffffffff80000001, 31 ); + + TEST_RR_OP( 7, srlw, 0xffffffffffffffff, 0xffffffffffffffff, 0 ); + TEST_RR_OP( 8, srlw, 0x000000007fffffff, 0xffffffffffffffff, 1 ); + TEST_RR_OP( 9, srlw, 0x0000000001ffffff, 0xffffffffffffffff, 7 ); + TEST_RR_OP( 10, srlw, 0x000000000003ffff, 0xffffffffffffffff, 14 ); + TEST_RR_OP( 11, srlw, 0x0000000000000001, 0xffffffffffffffff, 31 ); + + TEST_RR_OP( 12, srlw, 0x0000000021212121, 0x0000000021212121, 0 ); + TEST_RR_OP( 13, srlw, 0x0000000010909090, 0x0000000021212121, 1 ); + TEST_RR_OP( 14, srlw, 0x0000000000424242, 0x0000000021212121, 7 ); + TEST_RR_OP( 15, srlw, 0x0000000000008484, 0x0000000021212121, 14 ); + TEST_RR_OP( 16, srlw, 0x0000000000000000, 0x0000000021212121, 31 ); + + # Verify that shifts only use bottom five bits + + TEST_RR_OP( 17, srlw, 0x0000000021212121, 0x0000000021212121, 0xffffffffffffffe0 ); + TEST_RR_OP( 18, srlw, 0x0000000010909090, 0x0000000021212121, 0xffffffffffffffe1 ); + TEST_RR_OP( 19, srlw, 0x0000000000424242, 0x0000000021212121, 0xffffffffffffffe7 ); + TEST_RR_OP( 20, srlw, 0x0000000000008484, 0x0000000021212121, 0xffffffffffffffee ); + TEST_RR_OP( 21, srlw, 0x0000000000000000, 0x0000000021212121, 0xffffffffffffffff ); + + # Verify that shifts ignore top 32 (using true 64-bit values) + + TEST_RR_OP( 44, srlw, 0x0000000012345678, 0xffffffff12345678, 0 ); + TEST_RR_OP( 45, srlw, 0x0000000001234567, 0xffffffff12345678, 4 ); + TEST_RR_OP( 46, srlw, 0xffffffff92345678, 0x0000000092345678, 0 ); + TEST_RR_OP( 47, srlw, 0x0000000009234567, 0x0000000092345678, 4 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 22, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC2_EQ_DEST( 23, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_EQ_DEST( 24, srlw, 0, 7 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 25, 0, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_DEST_BYPASS( 26, 1, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_DEST_BYPASS( 27, 2, srlw, 0x0000000000000001, 0xffffffff80000000, 31 ); + + TEST_RR_SRC12_BYPASS( 28, 0, 0, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC12_BYPASS( 29, 0, 1, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_BYPASS( 30, 0, 2, srlw, 0x0000000000000001, 0xffffffff80000000, 31 ); + TEST_RR_SRC12_BYPASS( 31, 1, 0, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC12_BYPASS( 32, 1, 1, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_SRC12_BYPASS( 33, 2, 0, srlw, 0x0000000000000001, 0xffffffff80000000, 31 ); + + TEST_RR_SRC21_BYPASS( 34, 0, 0, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC21_BYPASS( 35, 0, 1, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_SRC21_BYPASS( 36, 0, 2, srlw, 0x0000000000000001, 0xffffffff80000000, 31 ); + TEST_RR_SRC21_BYPASS( 37, 1, 0, srlw, 0x0000000001000000, 0xffffffff80000000, 7 ); + TEST_RR_SRC21_BYPASS( 38, 1, 1, srlw, 0x0000000000020000, 0xffffffff80000000, 14 ); + TEST_RR_SRC21_BYPASS( 39, 2, 0, srlw, 0x0000000000000001, 0xffffffff80000000, 31 ); + + TEST_RR_ZEROSRC1( 40, srlw, 0, 15 ); + TEST_RR_ZEROSRC2( 41, srlw, 32, 32 ); + TEST_RR_ZEROSRC12( 42, srlw, 0 ); + TEST_RR_ZERODEST( 43, srlw, 1024, 2048 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sub.S b/apps/riscv-tests/isa/rv64ui/sub.S new file mode 100644 index 0000000..005bdea --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sub.S @@ -0,0 +1,83 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sub.S +#----------------------------------------------------------------------------- +# +# Test sub instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, sub, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 ); + TEST_RR_OP( 3, sub, 0x0000000000000000, 0x0000000000000001, 0x0000000000000001 ); + TEST_RR_OP( 4, sub, 0xfffffffffffffffc, 0x0000000000000003, 0x0000000000000007 ); + + TEST_RR_OP( 5, sub, 0x0000000000008000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, sub, 0xffffffff80000000, 0xffffffff80000000, 0x0000000000000000 ); + TEST_RR_OP( 7, sub, 0xffffffff80008000, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP( 8, sub, 0xffffffffffff8001, 0x0000000000000000, 0x0000000000007fff ); + TEST_RR_OP( 9, sub, 0x000000007fffffff, 0x000000007fffffff, 0x0000000000000000 ); + TEST_RR_OP( 10, sub, 0x000000007fff8000, 0x000000007fffffff, 0x0000000000007fff ); + + TEST_RR_OP( 11, sub, 0xffffffff7fff8001, 0xffffffff80000000, 0x0000000000007fff ); + TEST_RR_OP( 12, sub, 0x0000000080007fff, 0x000000007fffffff, 0xffffffffffff8000 ); + + TEST_RR_OP( 13, sub, 0x0000000000000001, 0x0000000000000000, 0xffffffffffffffff ); + TEST_RR_OP( 14, sub, 0xfffffffffffffffe, 0xffffffffffffffff, 0x0000000000000001 ); + TEST_RR_OP( 15, sub, 0x0000000000000000, 0xffffffffffffffff, 0xffffffffffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 16, sub, 2, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 17, sub, 3, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 18, sub, 0, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 19, 0, sub, 2, 13, 11 ); + TEST_RR_DEST_BYPASS( 20, 1, sub, 3, 14, 11 ); + TEST_RR_DEST_BYPASS( 21, 2, sub, 4, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 22, 0, 0, sub, 2, 13, 11 ); + TEST_RR_SRC12_BYPASS( 23, 0, 1, sub, 3, 14, 11 ); + TEST_RR_SRC12_BYPASS( 24, 0, 2, sub, 4, 15, 11 ); + TEST_RR_SRC12_BYPASS( 25, 1, 0, sub, 2, 13, 11 ); + TEST_RR_SRC12_BYPASS( 26, 1, 1, sub, 3, 14, 11 ); + TEST_RR_SRC12_BYPASS( 27, 2, 0, sub, 4, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 28, 0, 0, sub, 2, 13, 11 ); + TEST_RR_SRC21_BYPASS( 29, 0, 1, sub, 3, 14, 11 ); + TEST_RR_SRC21_BYPASS( 30, 0, 2, sub, 4, 15, 11 ); + TEST_RR_SRC21_BYPASS( 31, 1, 0, sub, 2, 13, 11 ); + TEST_RR_SRC21_BYPASS( 32, 1, 1, sub, 3, 14, 11 ); + TEST_RR_SRC21_BYPASS( 33, 2, 0, sub, 4, 15, 11 ); + + TEST_RR_ZEROSRC1( 34, sub, 15, -15 ); + TEST_RR_ZEROSRC2( 35, sub, 32, 32 ); + TEST_RR_ZEROSRC12( 36, sub, 0 ); + TEST_RR_ZERODEST( 37, sub, 16, 30 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/subw.S b/apps/riscv-tests/isa/rv64ui/subw.S new file mode 100644 index 0000000..9940d8c --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/subw.S @@ -0,0 +1,83 @@ +# See LICENSE for license details. + +#***************************************************************************** +# subw.S +#----------------------------------------------------------------------------- +# +# Test subw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, subw, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 ); + TEST_RR_OP( 3, subw, 0x0000000000000000, 0x0000000000000001, 0x0000000000000001 ); + TEST_RR_OP( 4, subw, 0xfffffffffffffffc, 0x0000000000000003, 0x0000000000000007 ); + + TEST_RR_OP( 5, subw, 0x0000000000008000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, subw, 0xffffffff80000000, 0xffffffff80000000, 0x0000000000000000 ); + TEST_RR_OP( 7, subw, 0xffffffff80008000, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP( 8, subw, 0xffffffffffff8001, 0x0000000000000000, 0x0000000000007fff ); + TEST_RR_OP( 9, subw, 0x000000007fffffff, 0x000000007fffffff, 0x0000000000000000 ); + TEST_RR_OP( 10, subw, 0x000000007fff8000, 0x000000007fffffff, 0x0000000000007fff ); + + TEST_RR_OP( 11, subw, 0x000000007fff8001, 0xffffffff80000000, 0x0000000000007fff ); + TEST_RR_OP( 12, subw, 0xffffffff80007fff, 0x000000007fffffff, 0xffffffffffff8000 ); + + TEST_RR_OP( 13, subw, 0x0000000000000001, 0x0000000000000000, 0xffffffffffffffff ); + TEST_RR_OP( 14, subw, 0xfffffffffffffffe, 0xffffffffffffffff, 0x0000000000000001 ); + TEST_RR_OP( 15, subw, 0x0000000000000000, 0xffffffffffffffff, 0xffffffffffffffff ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 16, subw, 2, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 17, subw, 3, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 18, subw, 0, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 19, 0, subw, 2, 13, 11 ); + TEST_RR_DEST_BYPASS( 20, 1, subw, 3, 14, 11 ); + TEST_RR_DEST_BYPASS( 21, 2, subw, 4, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 22, 0, 0, subw, 2, 13, 11 ); + TEST_RR_SRC12_BYPASS( 23, 0, 1, subw, 3, 14, 11 ); + TEST_RR_SRC12_BYPASS( 24, 0, 2, subw, 4, 15, 11 ); + TEST_RR_SRC12_BYPASS( 25, 1, 0, subw, 2, 13, 11 ); + TEST_RR_SRC12_BYPASS( 26, 1, 1, subw, 3, 14, 11 ); + TEST_RR_SRC12_BYPASS( 27, 2, 0, subw, 4, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 28, 0, 0, subw, 2, 13, 11 ); + TEST_RR_SRC21_BYPASS( 29, 0, 1, subw, 3, 14, 11 ); + TEST_RR_SRC21_BYPASS( 30, 0, 2, subw, 4, 15, 11 ); + TEST_RR_SRC21_BYPASS( 31, 1, 0, subw, 2, 13, 11 ); + TEST_RR_SRC21_BYPASS( 32, 1, 1, subw, 3, 14, 11 ); + TEST_RR_SRC21_BYPASS( 33, 2, 0, subw, 4, 15, 11 ); + + TEST_RR_ZEROSRC1( 34, subw, 15, -15 ); + TEST_RR_ZEROSRC2( 35, subw, 32, 32 ); + TEST_RR_ZEROSRC12( 36, subw, 0 ); + TEST_RR_ZERODEST( 37, subw, 16, 30 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/sw.S b/apps/riscv-tests/isa/rv64ui/sw.S new file mode 100644 index 0000000..ab094b3 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/sw.S @@ -0,0 +1,92 @@ +# See LICENSE for license details. + +#***************************************************************************** +# sw.S +#----------------------------------------------------------------------------- +# +# Test sw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Basic tests + #------------------------------------------------------------- + + TEST_ST_OP( 2, lw, sw, 0x0000000000aa00aa, 0, tdat ); + TEST_ST_OP( 3, lw, sw, 0xffffffffaa00aa00, 4, tdat ); + TEST_ST_OP( 4, lw, sw, 0x000000000aa00aa0, 8, tdat ); + TEST_ST_OP( 5, lw, sw, 0xffffffffa00aa00a, 12, tdat ); + + # Test with negative offset + + TEST_ST_OP( 6, lw, sw, 0x0000000000aa00aa, -12, tdat8 ); + TEST_ST_OP( 7, lw, sw, 0xffffffffaa00aa00, -8, tdat8 ); + TEST_ST_OP( 8, lw, sw, 0x000000000aa00aa0, -4, tdat8 ); + TEST_ST_OP( 9, lw, sw, 0xffffffffa00aa00a, 0, tdat8 ); + + # Test with a negative base + + TEST_CASE( 10, x5, 0x12345678, \ + la x1, tdat9; \ + li x2, 0x12345678; \ + addi x4, x1, -32; \ + sw x2, 32(x4); \ + lw x5, 0(x1); \ + ) + + # Test with unaligned base + + TEST_CASE( 11, x5, 0x58213098, \ + la x1, tdat9; \ + li x2, 0x58213098; \ + addi x1, x1, -3; \ + sw x2, 7(x1); \ + la x4, tdat10; \ + lw x5, 0(x4); \ + ) + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_ST_SRC12_BYPASS( 12, 0, 0, lw, sw, 0xffffffffaabbccdd, 0, tdat ); + TEST_ST_SRC12_BYPASS( 13, 0, 1, lw, sw, 0xffffffffdaabbccd, 4, tdat ); + TEST_ST_SRC12_BYPASS( 14, 0, 2, lw, sw, 0xffffffffddaabbcc, 8, tdat ); + TEST_ST_SRC12_BYPASS( 15, 1, 0, lw, sw, 0xffffffffcddaabbc, 12, tdat ); + TEST_ST_SRC12_BYPASS( 16, 1, 1, lw, sw, 0xffffffffccddaabb, 16, tdat ); + TEST_ST_SRC12_BYPASS( 17, 2, 0, lw, sw, 0xffffffffbccddaab, 20, tdat ); + + TEST_ST_SRC21_BYPASS( 18, 0, 0, lw, sw, 0x00112233, 0, tdat ); + TEST_ST_SRC21_BYPASS( 19, 0, 1, lw, sw, 0x30011223, 4, tdat ); + TEST_ST_SRC21_BYPASS( 20, 0, 2, lw, sw, 0x33001122, 8, tdat ); + TEST_ST_SRC21_BYPASS( 21, 1, 0, lw, sw, 0x23300112, 12, tdat ); + TEST_ST_SRC21_BYPASS( 22, 1, 1, lw, sw, 0x22330011, 16, tdat ); + TEST_ST_SRC21_BYPASS( 23, 2, 0, lw, sw, 0x12233001, 20, tdat ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +tdat: +tdat1: .word 0xdeadbeef +tdat2: .word 0xdeadbeef +tdat3: .word 0xdeadbeef +tdat4: .word 0xdeadbeef +tdat5: .word 0xdeadbeef +tdat6: .word 0xdeadbeef +tdat7: .word 0xdeadbeef +tdat8: .word 0xdeadbeef +tdat9: .word 0xdeadbeef +tdat10: .word 0xdeadbeef + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/xor.S b/apps/riscv-tests/isa/rv64ui/xor.S new file mode 100644 index 0000000..c4e9552 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/xor.S @@ -0,0 +1,69 @@ +# See LICENSE for license details. + +#***************************************************************************** +# xor.S +#----------------------------------------------------------------------------- +# +# Test xor instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Logical tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_OP( 3, xor, 0xff00ff00, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_OP( 4, xor, 0x0ff00ff0, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_OP( 5, xor, 0x00ff00ff, 0xf00ff00f, 0xf0f0f0f0 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 6, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC2_EQ_DEST( 7, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_EQ_DEST( 8, xor, 0x00000000, 0xff00ff00 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 9, 0, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_DEST_BYPASS( 10, 1, xor, 0xff00ff00, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_DEST_BYPASS( 11, 2, xor, 0x0ff00ff0, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_SRC12_BYPASS( 12, 0, 0, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 13, 0, 1, xor, 0xff00ff00, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_BYPASS( 14, 0, 2, xor, 0x0ff00ff0, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 15, 1, 0, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC12_BYPASS( 16, 1, 1, xor, 0xff00ff00, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC12_BYPASS( 17, 2, 0, xor, 0x0ff00ff0, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_SRC21_BYPASS( 18, 0, 0, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 19, 0, 1, xor, 0xff00ff00, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC21_BYPASS( 20, 0, 2, xor, 0x0ff00ff0, 0x00ff00ff, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 21, 1, 0, xor, 0xf00ff00f, 0xff00ff00, 0x0f0f0f0f ); + TEST_RR_SRC21_BYPASS( 22, 1, 1, xor, 0xff00ff00, 0x0ff00ff0, 0xf0f0f0f0 ); + TEST_RR_SRC21_BYPASS( 23, 2, 0, xor, 0x0ff00ff0, 0x00ff00ff, 0x0f0f0f0f ); + + TEST_RR_ZEROSRC1( 24, xor, 0xff00ff00, 0xff00ff00 ); + TEST_RR_ZEROSRC2( 25, xor, 0x00ff00ff, 0x00ff00ff ); + TEST_RR_ZEROSRC12( 26, xor, 0 ); + TEST_RR_ZERODEST( 27, xor, 0x11111111, 0x22222222 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64ui/xori.S b/apps/riscv-tests/isa/rv64ui/xori.S new file mode 100644 index 0000000..eb59d12 --- /dev/null +++ b/apps/riscv-tests/isa/rv64ui/xori.S @@ -0,0 +1,55 @@ +# See LICENSE for license details. + +#***************************************************************************** +# xori.S +#----------------------------------------------------------------------------- +# +# Test xori instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Logical tests + #------------------------------------------------------------- + + TEST_IMM_OP( 2, xori, 0xffffffffff00f00f, 0x0000000000ff0f00, 0xf0f ); + TEST_IMM_OP( 3, xori, 0x000000000ff00f00, 0x000000000ff00ff0, 0x0f0 ); + TEST_IMM_OP( 4, xori, 0x0000000000ff0ff0, 0x0000000000ff08ff, 0x70f ); + TEST_IMM_OP( 5, xori, 0xfffffffff00ff0ff, 0xfffffffff00ff00f, 0x0f0 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_IMM_SRC1_EQ_DEST( 6, xori, 0xffffffffff00f00f, 0xffffffffff00f700, 0x70f ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_IMM_DEST_BYPASS( 7, 0, xori, 0x000000000ff00f00, 0x000000000ff00ff0, 0x0f0 ); + TEST_IMM_DEST_BYPASS( 8, 1, xori, 0x0000000000ff0ff0, 0x0000000000ff08ff, 0x70f ); + TEST_IMM_DEST_BYPASS( 9, 2, xori, 0xfffffffff00ff0ff, 0xfffffffff00ff00f, 0x0f0 ); + + TEST_IMM_SRC1_BYPASS( 10, 0, xori, 0x000000000ff00f00, 0x000000000ff00ff0, 0x0f0 ); + TEST_IMM_SRC1_BYPASS( 11, 1, xori, 0x0000000000ff0ff0, 0x0000000000ff0fff, 0x00f ); + TEST_IMM_SRC1_BYPASS( 12, 2, xori, 0xfffffffff00ff0ff, 0xfffffffff00ff00f, 0x0f0 ); + + TEST_IMM_ZEROSRC1( 13, xori, 0x0f0, 0x0f0 ); + TEST_IMM_ZERODEST( 14, xori, 0x00ff00ff, 0x70f ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/Makefrag b/apps/riscv-tests/isa/rv64um/Makefrag new file mode 100644 index 0000000..360bd7a --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/Makefrag @@ -0,0 +1,13 @@ +#======================================================================= +# Makefrag for rv64um tests +#----------------------------------------------------------------------- + +rv64um_sc_tests = \ + div divu divuw divw \ + mul mulh mulhsu mulhu mulw \ + rem remu remuw remw \ + +rv64um_p_tests = $(addprefix rv64um-p-, $(rv64um_sc_tests)) +rv64um_v_tests = $(addprefix rv64um-v-, $(rv64um_sc_tests)) + +spike_tests += $(rv64um_p_tests) $(rv64um_v_tests) diff --git a/apps/riscv-tests/isa/rv64um/div.S b/apps/riscv-tests/isa/rv64um/div.S new file mode 100644 index 0000000..ee21f0c --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/div.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# div.S +#----------------------------------------------------------------------------- +# +# Test div instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, div, 3, 20, 6 ); + TEST_RR_OP( 3, div, -3, -20, 6 ); + TEST_RR_OP( 4, div, -3, 20, -6 ); + TEST_RR_OP( 5, div, 3, -20, -6 ); + + TEST_RR_OP( 6, div, -1<<63, -1<<63, 1 ); + TEST_RR_OP( 7, div, -1<<63, -1<<63, -1 ); + + TEST_RR_OP( 8, div, -1, -1<<63, 0 ); + TEST_RR_OP( 9, div, -1, 1, 0 ); + TEST_RR_OP(10, div, -1, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/divu.S b/apps/riscv-tests/isa/rv64um/divu.S new file mode 100644 index 0000000..e63fd65 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/divu.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# divu.S +#----------------------------------------------------------------------------- +# +# Test divu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, divu, 3, 20, 6 ); + TEST_RR_OP( 3, divu, 3074457345618258599, -20, 6 ); + TEST_RR_OP( 4, divu, 0, 20, -6 ); + TEST_RR_OP( 5, divu, 0, -20, -6 ); + + TEST_RR_OP( 6, divu, -1<<63, -1<<63, 1 ); + TEST_RR_OP( 7, divu, 0, -1<<63, -1 ); + + TEST_RR_OP( 8, divu, -1, -1<<63, 0 ); + TEST_RR_OP( 9, divu, -1, 1, 0 ); + TEST_RR_OP(10, divu, -1, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/divuw.S b/apps/riscv-tests/isa/rv64um/divuw.S new file mode 100644 index 0000000..4c9eee7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/divuw.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# divuw.S +#----------------------------------------------------------------------------- +# +# Test divuw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, divuw, 3, 20, 6 ); + TEST_RR_OP( 3, divuw, 715827879, -20 << 32 >> 32, 6 ); + TEST_RR_OP( 4, divuw, 0, 20, -6 ); + TEST_RR_OP( 5, divuw, 0, -20, -6 ); + + TEST_RR_OP( 6, divuw, -1<<31, -1<<31, 1 ); + TEST_RR_OP( 7, divuw, 0, -1<<31, -1 ); + + TEST_RR_OP( 8, divuw, -1, -1<<31, 0 ); + TEST_RR_OP( 9, divuw, -1, 1, 0 ); + TEST_RR_OP(10, divuw, -1, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/divw.S b/apps/riscv-tests/isa/rv64um/divw.S new file mode 100644 index 0000000..4cffa1a --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/divw.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# divw.S +#----------------------------------------------------------------------------- +# +# Test divw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, divw, 3, 20, 6 ); + TEST_RR_OP( 3, divw, -3, -20, 6 ); + TEST_RR_OP( 4, divw, -3, 20, -6 ); + TEST_RR_OP( 5, divw, 3, -20, -6 ); + + TEST_RR_OP( 6, divw, -1<<31, -1<<31, 1 ); + TEST_RR_OP( 7, divw, -1<<31, -1<<31, -1 ); + + TEST_RR_OP( 8, divw, -1, -1<<31, 0 ); + TEST_RR_OP( 9, divw, -1, 1, 0 ); + TEST_RR_OP(10, divw, -1, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/mul.S b/apps/riscv-tests/isa/rv64um/mul.S new file mode 100644 index 0000000..c647e97 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/mul.S @@ -0,0 +1,78 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mul.S +#----------------------------------------------------------------------------- +# +# Test mul instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP(32, mul, 0x0000000000001200, 0x0000000000007e00, 0x6db6db6db6db6db7 ); + TEST_RR_OP(33, mul, 0x0000000000001240, 0x0000000000007fc0, 0x6db6db6db6db6db7 ); + + TEST_RR_OP( 2, mul, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mul, 0x00000001, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mul, 0x00000015, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mul, 0x0000000000000000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, mul, 0x0000000000000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, mul, 0x0000400000000000, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP(30, mul, 0x000000000000ff7f, 0xaaaaaaaaaaaaaaab, 0x000000000002fe7d ); + TEST_RR_OP(31, mul, 0x000000000000ff7f, 0x000000000002fe7d, 0xaaaaaaaaaaaaaaab ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mul, 143, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 9, mul, 154, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 10, mul, 169, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mul, 143, 13, 11 ); + TEST_RR_DEST_BYPASS( 12, 1, mul, 154, 14, 11 ); + TEST_RR_DEST_BYPASS( 13, 2, mul, 165, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mul, 143, 13, 11 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mul, 154, 14, 11 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mul, 165, 15, 11 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mul, 143, 13, 11 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mul, 154, 14, 11 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mul, 165, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mul, 143, 13, 11 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mul, 154, 14, 11 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mul, 165, 15, 11 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mul, 143, 13, 11 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mul, 154, 14, 11 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mul, 165, 15, 11 ); + + TEST_RR_ZEROSRC1( 26, mul, 0, 31 ); + TEST_RR_ZEROSRC2( 27, mul, 0, 32 ); + TEST_RR_ZEROSRC12( 28, mul, 0 ); + TEST_RR_ZERODEST( 29, mul, 33, 34 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/mulh.S b/apps/riscv-tests/isa/rv64um/mulh.S new file mode 100644 index 0000000..1fd12a1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/mulh.S @@ -0,0 +1,72 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulh.S +#----------------------------------------------------------------------------- +# +# Test mulh instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulh, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulh, 0x00000000, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulh, 0x00000000, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulh, 0x0000000000000000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, mulh, 0x0000000000000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, mulh, 0x0000000000000000, 0xffffffff80000000, 0xffffffffffff8000 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulh, 143, 13<<32, 11<<32 ); + TEST_RR_SRC2_EQ_DEST( 9, mulh, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_EQ_DEST( 10, mulh, 169, 13<<32 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulh, 143, 13<<32, 11<<32 ); + TEST_RR_DEST_BYPASS( 12, 1, mulh, 154, 14<<32, 11<<32 ); + TEST_RR_DEST_BYPASS( 13, 2, mulh, 165, 15<<32, 11<<32 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulh, 143, 13<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulh, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulh, 165, 15<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulh, 143, 13<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulh, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulh, 165, 15<<32, 11<<32 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulh, 143, 13<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulh, 154, 14<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulh, 165, 15<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulh, 143, 13<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulh, 154, 14<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulh, 165, 15<<32, 11<<32 ); + + TEST_RR_ZEROSRC1( 26, mulh, 0, 31<<32 ); + TEST_RR_ZEROSRC2( 27, mulh, 0, 32<<32 ); + TEST_RR_ZEROSRC12( 28, mulh, 0 ); + TEST_RR_ZERODEST( 29, mulh, 33<<32, 34<<32 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/mulhsu.S b/apps/riscv-tests/isa/rv64um/mulhsu.S new file mode 100644 index 0000000..c037db2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/mulhsu.S @@ -0,0 +1,72 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulhsu.S +#----------------------------------------------------------------------------- +# +# Test mulhsu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulhsu, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulhsu, 0x00000000, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulhsu, 0x00000000, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulhsu, 0x0000000000000000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, mulhsu, 0x0000000000000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, mulhsu, 0xffffffff80000000, 0xffffffff80000000, 0xffffffffffff8000 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulhsu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC2_EQ_DEST( 9, mulhsu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_EQ_DEST( 10, mulhsu, 169, 13<<32 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulhsu, 143, 13<<32, 11<<32 ); + TEST_RR_DEST_BYPASS( 12, 1, mulhsu, 154, 14<<32, 11<<32 ); + TEST_RR_DEST_BYPASS( 13, 2, mulhsu, 165, 15<<32, 11<<32 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulhsu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulhsu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulhsu, 165, 15<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulhsu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulhsu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulhsu, 165, 15<<32, 11<<32 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulhsu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulhsu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulhsu, 165, 15<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulhsu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulhsu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulhsu, 165, 15<<32, 11<<32 ); + + TEST_RR_ZEROSRC1( 26, mulhsu, 0, 31<<32 ); + TEST_RR_ZEROSRC2( 27, mulhsu, 0, 32<<32 ); + TEST_RR_ZEROSRC12( 28, mulhsu, 0 ); + TEST_RR_ZERODEST( 29, mulhsu, 33<<32, 34<<32 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/mulhu.S b/apps/riscv-tests/isa/rv64um/mulhu.S new file mode 100644 index 0000000..aa7b762 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/mulhu.S @@ -0,0 +1,75 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulhu.S +#----------------------------------------------------------------------------- +# +# Test mulhu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulhu, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulhu, 0x00000000, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulhu, 0x00000000, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulhu, 0x0000000000000000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, mulhu, 0x0000000000000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, mulhu, 0xffffffff7fff8000, 0xffffffff80000000, 0xffffffffffff8000 ); + + TEST_RR_OP(30, mulhu, 0x000000000001fefe, 0xaaaaaaaaaaaaaaab, 0x000000000002fe7d ); + TEST_RR_OP(31, mulhu, 0x000000000001fefe, 0x000000000002fe7d, 0xaaaaaaaaaaaaaaab ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulhu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC2_EQ_DEST( 9, mulhu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_EQ_DEST( 10, mulhu, 169, 13<<32 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulhu, 143, 13<<32, 11<<32 ); + TEST_RR_DEST_BYPASS( 12, 1, mulhu, 154, 14<<32, 11<<32 ); + TEST_RR_DEST_BYPASS( 13, 2, mulhu, 165, 15<<32, 11<<32 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulhu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulhu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulhu, 165, 15<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulhu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulhu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulhu, 165, 15<<32, 11<<32 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulhu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulhu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulhu, 165, 15<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulhu, 143, 13<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulhu, 154, 14<<32, 11<<32 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulhu, 165, 15<<32, 11<<32 ); + + TEST_RR_ZEROSRC1( 26, mulhu, 0, 31<<32 ); + TEST_RR_ZEROSRC2( 27, mulhu, 0, 32<<32 ); + TEST_RR_ZEROSRC12( 28, mulhu, 0 ); + TEST_RR_ZERODEST( 29, mulhu, 33<<32, 34<<32 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/mulw.S b/apps/riscv-tests/isa/rv64um/mulw.S new file mode 100644 index 0000000..379c3f2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/mulw.S @@ -0,0 +1,72 @@ +# See LICENSE for license details. + +#***************************************************************************** +# mulw.S +#----------------------------------------------------------------------------- +# +# Test mulw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, mulw, 0x00000000, 0x00000000, 0x00000000 ); + TEST_RR_OP( 3, mulw, 0x00000001, 0x00000001, 0x00000001 ); + TEST_RR_OP( 4, mulw, 0x00000015, 0x00000003, 0x00000007 ); + + TEST_RR_OP( 5, mulw, 0x0000000000000000, 0x0000000000000000, 0xffffffffffff8000 ); + TEST_RR_OP( 6, mulw, 0x0000000000000000, 0xffffffff80000000, 0x00000000 ); + TEST_RR_OP( 7, mulw, 0x0000000000000000, 0xffffffff80000000, 0xffffffffffff8000 ); + + #------------------------------------------------------------- + # Source/Destination tests + #------------------------------------------------------------- + + TEST_RR_SRC1_EQ_DEST( 8, mulw, 143, 13, 11 ); + TEST_RR_SRC2_EQ_DEST( 9, mulw, 154, 14, 11 ); + TEST_RR_SRC12_EQ_DEST( 10, mulw, 169, 13 ); + + #------------------------------------------------------------- + # Bypassing tests + #------------------------------------------------------------- + + TEST_RR_DEST_BYPASS( 11, 0, mulw, 143, 13, 11 ); + TEST_RR_DEST_BYPASS( 12, 1, mulw, 154, 14, 11 ); + TEST_RR_DEST_BYPASS( 13, 2, mulw, 165, 15, 11 ); + + TEST_RR_SRC12_BYPASS( 14, 0, 0, mulw, 143, 13, 11 ); + TEST_RR_SRC12_BYPASS( 15, 0, 1, mulw, 154, 14, 11 ); + TEST_RR_SRC12_BYPASS( 16, 0, 2, mulw, 165, 15, 11 ); + TEST_RR_SRC12_BYPASS( 17, 1, 0, mulw, 143, 13, 11 ); + TEST_RR_SRC12_BYPASS( 18, 1, 1, mulw, 154, 14, 11 ); + TEST_RR_SRC12_BYPASS( 19, 2, 0, mulw, 165, 15, 11 ); + + TEST_RR_SRC21_BYPASS( 20, 0, 0, mulw, 143, 13, 11 ); + TEST_RR_SRC21_BYPASS( 21, 0, 1, mulw, 154, 14, 11 ); + TEST_RR_SRC21_BYPASS( 22, 0, 2, mulw, 165, 15, 11 ); + TEST_RR_SRC21_BYPASS( 23, 1, 0, mulw, 143, 13, 11 ); + TEST_RR_SRC21_BYPASS( 24, 1, 1, mulw, 154, 14, 11 ); + TEST_RR_SRC21_BYPASS( 25, 2, 0, mulw, 165, 15, 11 ); + + TEST_RR_ZEROSRC1( 26, mulw, 0, 31 ); + TEST_RR_ZEROSRC2( 27, mulw, 0, 32 ); + TEST_RR_ZEROSRC12( 28, mulw, 0 ); + TEST_RR_ZERODEST( 29, mulw, 33, 34 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/rem.S b/apps/riscv-tests/isa/rv64um/rem.S new file mode 100644 index 0000000..e3248ff --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/rem.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# rem.S +#----------------------------------------------------------------------------- +# +# Test rem instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, rem, 2, 20, 6 ); + TEST_RR_OP( 3, rem, -2, -20, 6 ); + TEST_RR_OP( 4, rem, 2, 20, -6 ); + TEST_RR_OP( 5, rem, -2, -20, -6 ); + + TEST_RR_OP( 6, rem, 0, -1<<63, 1 ); + TEST_RR_OP( 7, rem, 0, -1<<63, -1 ); + + TEST_RR_OP( 8, rem, -1<<63, -1<<63, 0 ); + TEST_RR_OP( 9, rem, 1, 1, 0 ); + TEST_RR_OP(10, rem, 0, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/remu.S b/apps/riscv-tests/isa/rv64um/remu.S new file mode 100644 index 0000000..6946d0d --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/remu.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# remu.S +#----------------------------------------------------------------------------- +# +# Test remu instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, remu, 2, 20, 6 ); + TEST_RR_OP( 3, remu, 2, -20, 6 ); + TEST_RR_OP( 4, remu, 20, 20, -6 ); + TEST_RR_OP( 5, remu, -20, -20, -6 ); + + TEST_RR_OP( 6, remu, 0, -1<<63, 1 ); + TEST_RR_OP( 7, remu, -1<<63, -1<<63, -1 ); + + TEST_RR_OP( 8, remu, -1<<63, -1<<63, 0 ); + TEST_RR_OP( 9, remu, 1, 1, 0 ); + TEST_RR_OP(10, remu, 0, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/remuw.S b/apps/riscv-tests/isa/rv64um/remuw.S new file mode 100644 index 0000000..334b5c5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/remuw.S @@ -0,0 +1,41 @@ +# See LICENSE for license details. + +#***************************************************************************** +# remuw.S +#----------------------------------------------------------------------------- +# +# Test remuw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, remuw, 2, 20, 6 ); + TEST_RR_OP( 3, remuw, 2, -20, 6 ); + TEST_RR_OP( 4, remuw, 20, 20, -6 ); + TEST_RR_OP( 5, remuw, -20, -20, -6 ); + + TEST_RR_OP( 6, remuw, 0, -1<<31, 1 ); + TEST_RR_OP( 7, remuw, -1<<31, -1<<31, -1 ); + + TEST_RR_OP( 8, remuw, -1<<31, -1<<31, 0 ); + TEST_RR_OP( 9, remuw, 1, 1, 0 ); + TEST_RR_OP(10, remuw, 0, 0, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64um/remw.S b/apps/riscv-tests/isa/rv64um/remw.S new file mode 100644 index 0000000..3ae8e3d --- /dev/null +++ b/apps/riscv-tests/isa/rv64um/remw.S @@ -0,0 +1,42 @@ +# See LICENSE for license details. + +#***************************************************************************** +# remw.S +#----------------------------------------------------------------------------- +# +# Test remw instruction. +# + +#include "riscv_test.h" +#include "test_macros.h" + +RVTEST_RV64U +RVTEST_CODE_BEGIN + + #------------------------------------------------------------- + # Arithmetic tests + #------------------------------------------------------------- + + TEST_RR_OP( 2, remw, 2, 20, 6 ); + TEST_RR_OP( 3, remw, -2, -20, 6 ); + TEST_RR_OP( 4, remw, 2, 20, -6 ); + TEST_RR_OP( 5, remw, -2, -20, -6 ); + + TEST_RR_OP( 6, remw, 0, -1<<31, 1 ); + TEST_RR_OP( 7, remw, 0, -1<<31, -1 ); + + TEST_RR_OP( 8, remw, -1<<31, -1<<31, 0 ); + TEST_RR_OP( 9, remw, 1, 1, 0 ); + TEST_RR_OP(10, remw, 0, 0, 0 ); + TEST_RR_OP(11, remw, 0xfffffffffffff897,0xfffffffffffff897, 0 ); + + TEST_PASSFAIL + +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END diff --git a/apps/riscv-tests/isa/rv64uv/Makefrag b/apps/riscv-tests/isa/rv64uv/Makefrag new file mode 100644 index 0000000..f2c1336 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/Makefrag @@ -0,0 +1,188 @@ +# Copyright 2021 ETH Zurich and University of Bologna. +# Solderpad Hardware License, Version 0.51, see LICENSE for details. +# SPDX-License-Identifier: SHL-0.51 +# +# Author: Matheus Cavalcante +# Basile Bougenot + +rv64uv_sc_tests = vaadd \ + vaaddu\ + vsadd \ + vsaddu \ + vsmul \ + vssra \ + vssrl \ + vnclip \ + vnclipu \ + vadd \ + vsub \ + vrsub \ + vwaddu \ + vwsubu \ + vwadd \ + vwsub \ + vsext \ + vzext \ + vadc \ + vmadc \ + vsbc \ + vmsbc \ + vand \ + vor \ + vxor \ + vsll \ + vsrl \ + vsra \ + vnsrl \ + vnsra \ + vmseq \ + vmsne \ + vmsltu \ + vmslt \ + vmsleu \ + vmsle \ + vmsgtu \ + vmsgt \ + vminu \ + vmin \ + vmaxu \ + vmax \ + vmul \ + vmulh \ + vmulhu \ + vmulhsu \ + vdivu \ + vdiv \ + vremu \ + vrem \ + vwmul \ + vwmulu \ + vwmulsu \ + vmacc \ + vnmsac \ + vmadd \ + vnmsub \ + vwmaccu \ + vwmacc \ + vwmaccsu \ + vwmaccus \ + vmerge \ + vmv \ + vmvxs \ + vmvsx \ + vfmvfs \ + vfmvsf \ + vmvnrr \ + vredsum \ + vredmaxu \ + vredmax \ + vredminu \ + vredmin \ + vredand \ + vredor \ + vredxor \ + vwredsumu \ + vwredsum \ + vfadd \ + vfsub \ + vfrsub \ + vfwadd \ + vfwsub \ + vfmul \ + vfdiv \ + vfrdiv \ + vfwmul \ + vfmacc \ + vfnmacc \ + vfmsac \ + vfnmsac \ + vfmadd \ + vfnmadd \ + vfmsub \ + vfnmsub \ + vfwmacc \ + vfwnmacc \ + vfwmsac \ + vfwnmsac \ + vfsqrt \ + vfmin \ + vfmax \ + vfredusum \ + vfredosum \ + vfredmin \ + vfredmax \ + vfwredusum \ + vfwredosum \ + vfclass \ + vfsgnj \ + vfsgnjn \ + vfsgnjx \ + vfmerge \ + vfmv \ + vmfeq \ + vmfne \ + vmflt \ + vmfle \ + vmfgt \ + vmfge \ + vfcvt \ + vfwcvt \ + vfncvt \ + vmand \ + vmnand \ + vmandnot \ + vmor \ + vmnor \ + vmornot \ + vmxor \ + vmxnor \ + vslideup \ + vslidedown \ + vslide1up \ + vfslide1up \ + vslide1down \ + vfslide1down \ + vl \ + vlff \ + vlseg \ + vlsseg \ + vluxseg \ + vl1r \ + vle1 \ + vls \ + vluxei \ + vs \ + vsseg \ + vssseg \ + vsuxseg \ + vs1r \ + vse1 \ + vss \ + vsuxei \ + vsetivli\ + vsetvli\ + vsetvl\ + vmsbf \ + vmsof \ + vmsif \ + viota \ + vid \ + vcpop \ + vfirst \ + vle8 \ + vse8 \ + vle16 \ + vse16 \ + vle32 \ + vse32 \ + vle64 \ + vse64 \ + vle_vse_hazards \ + vfrec7 \ + vfrsqrt7 \ + vrgather \ + vcompress + +rv64uv_p_tests = $(addprefix rv64uv-p-, $(rv64uv_sc_tests)) + +spike_ctests += $(rv64uv_p_tests) diff --git a/apps/riscv-tests/isa/rv64uv/vaadd.c b/apps/riscv-tests/isa/rv64uv/vaadd.c new file mode 100644 index 0000000..40cd9d4 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vaadd.c @@ -0,0 +1,59 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + set_vxrm(0); // setting vxrm to rnu rounding mode + VSET(4, e8, m1); + VLOAD_8(v1, 1, -2, -3, 4); + VLOAD_8(v2, 1, 2, -3, 3); + __asm__ volatile("vaadd.vv v3, v1, v2" ::); + VCMP_U8(1, v3, 1, 0, -3, 4); +} + +void TEST_CASE2(void) { + set_vxrm(1); // setting vxrm to rne rounding mode + VSET(4, e8, m1); + VLOAD_8(v1, 1, -2, -3, 4); + VLOAD_8(v2, 1, 9, -3, 5); + VLOAD_8(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vaadd.vv v3, v1, v2, v0.t" ::); + VCMP_U8(2, v3, 0, 4, 0, 4); +} + +void TEST_CASE3(void) { + set_vxrm(2); // setting vxrm to rdn rounding mode + VSET(4, e32, m1); + VLOAD_32(v1, 1, -2, 3, -4); + const uint32_t scalar = 5; + __asm__ volatile("vaadd.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(3, v3, 3, 1, 4, 0); +} + +// Dont use VCLEAR here, it results in a glitch where are values are off by 1 +void TEST_CASE4(void) { + set_vxrm(3); // setting vxrm to rod rounding mode + VSET(4, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4); + const uint32_t scalar = 5; + VLOAD_32(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vaadd.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(4, v3, 0, 3, 0, 5); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vaaddu.c b/apps/riscv-tests/isa/rv64uv/vaaddu.c new file mode 100644 index 0000000..44bea01 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vaaddu.c @@ -0,0 +1,59 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + set_vxrm(0); // setting vxrm to rnu rounding mode + VSET(4, e8, m1); + VLOAD_8(v1, 1, 2, 3, 5); + VLOAD_8(v2, 1, 3, 8, 4); + __asm__ volatile("vaaddu.vv v3, v1, v2" ::); + VCMP_U8(1, v3, 1, 3, 6, 5); +} + +void TEST_CASE2(void) { + set_vxrm(1); // setting vxrm to rne rounding mode + VSET(4, e8, m1); + VLOAD_8(v1, 5, 8, 3, 7); + VLOAD_8(v2, 7, 5, 3, 5); + VLOAD_8(v0, 0x0A, 0x00, 0x00, 0x00); + VCLEAR(v3); + __asm__ volatile("vaaddu.vv v3, v1, v2, v0.t" ::); + VCMP_U8(2, v3, 0, 6, 0, 6); +} + +void TEST_CASE3(void) { + set_vxrm(2); // setting vxrm to rdn rounding mode + VSET(4, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4); + const uint32_t scalar = 5; + __asm__ volatile("vaaddu.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(3, v3, 3, 3, 4, 4); +} + +// Dont use VCLEAR here, it results in a glitch where are values are off by 1 +void TEST_CASE4(void) { + set_vxrm(3); // setting vxrm to rod rounding mode + VSET(4, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4); + const uint32_t scalar = 5; + VLOAD_32(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vaaddu.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(4, v3, 0, 3, 0, 5); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vadc.c b/apps/riscv-tests/isa/rv64uv/vadc.c new file mode 100644 index 0000000..ec16d28 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vadc.c @@ -0,0 +1,103 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, -7, 7); + VLOAD_8(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, -8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vvm v3, v1, v2, v0"); + VCMP_U8(1, v3, 9, 10, 9, 10, 9, 10, 9, 10, 2, 5, 6, 9, 10, 13, 0, 0); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, -7, 7); + VLOAD_16(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, -8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vvm v3, v1, v2, v0"); + VCMP_U16(2, v3, 9, 10, 9, 10, 9, 10, 9, 10, 2, 5, 6, 9, 10, 13, 0, 0); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, -7, 7); + VLOAD_32(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, -8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vvm v3, v1, v2, v0"); + VCMP_U32(3, v3, 9, 10, 9, 10, 9, 10, 9, 10, 2, 5, 6, 9, 10, 13, 0, 0); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, -7, 7); + VLOAD_64(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, -8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vvm v3, v1, v2, v0"); + VCMP_U64(4, v3, 9, 10, 9, 10, 9, 10, 9, 10, 2, 5, 6, 9, 10, 13, 0, 0); +}; + +void TEST_CASE2(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U8(5, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U16(6, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U32(7, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U64(8, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vim v3, v1, 5, v0"); + VCMP_U8(9, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vim v3, v1, 5, v0"); + VCMP_U16(10, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vim v3, v1, 5, v0"); + VCMP_U32(11, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vadc.vim v3, v1, 5, v0"); + VCMP_U64(12, v3, 6, 8, 8, 10, 10, 12, 12, 14, 6, 8, 8, 10, 10, 12, 12, 14); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vadd.c b/apps/riscv-tests/isa/rv64uv/vadd.c new file mode 100644 index 0000000..b7fc41b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vadd.c @@ -0,0 +1,202 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vv v3, v1, v2"); + VCMP_U8(1, v3, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vv v3, v1, v2"); + VCMP_U16(2, v3, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vv v3, v1, v2"); + VCMP_U32(3, v3, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vv v3, v1, v2"); + VCMP_U64(4, v3, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vv v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vv v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vv v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vv v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); +} + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vi v3, v1, 5"); + VCMP_U8(9, v3, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vi v3, v1, 5"); + VCMP_U16(10, v3, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vi v3, v1, 5"); + VCMP_U32(11, v3, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vadd.vi v3, v1, 5"); + VCMP_U64(12, v3, 6, 7, 8, 9, 10, 11, 12, 13, 6, 7, 8, 9, 10, 11, 12, 13); +} + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vi v3, v1, 5, v0.t"); + VCMP_U8(13, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vi v3, v1, 5, v0.t"); + VCMP_U16(14, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vi v3, v1, 5, v0.t"); + VCMP_U32(15, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vi v3, v1, 5, v0.t"); + VCMP_U64(16, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); +} + +void TEST_CASE5(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v1, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vadd.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U8(17, v3, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vadd.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U16(18, v3, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vadd.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(19, v3, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vadd.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U64(20, v3, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); +} + +void TEST_CASE6(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(21, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(22, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(23, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vadd.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(24, v3, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); +} + +// Check that the addition also works when source register EEWs are changed +void TEST_CASE7(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET(8, e16, m1); + asm volatile("vadd.vv v3, v1, v2"); + VSET(16, e8, m1); + VCMP_U8(25, v3, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vand.c b/apps/riscv-tests/isa/rv64uv/vand.c new file mode 100644 index 0000000..521435a --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vand.c @@ -0,0 +1,309 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v3, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, + 0xf0); + asm volatile("vand.vv v1, v2, v3"); + VCMP_U8(1, v1, 0xf0, 0x01, 0xf0, 0xf0, 0x01, 0xf0, 0xf0, 0x01, 0xf0, 0xf0, + 0x01, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_16(v3, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, + 0xf0f0, 0xff00, 0x0003, 0xf0f0); + asm volatile("vand.vv v1, v2, v3"); + VCMP_U16(2, v1, 0xff00, 0x0001, 0xf0f0, 0xff00, 0x0001, 0xf0f0, 0xff00, + 0x0001, 0xf0f0, 0xff00, 0x0001, 0xf0f0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_32(v3, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, 0x00000003, + 0xf0f0f0f0, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, + 0x00000003, 0xf0f0f0f0); + asm volatile("vand.vv v1, v2, v3"); + VCMP_U32(3, v1, 0xffff0000, 0x00000001, 0xf0f0f0f0, 0xffff0000, 0x00000001, + 0xf0f0f0f0, 0xffff0000, 0x00000001, 0xf0f0f0f0, 0xffff0000, + 0x00000001, 0xf0f0f0f0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v3, 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); + asm volatile("vand.vv v1, v2, v3"); + VCMP_U64(4, v1, 0xffffffff00000000, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); +} + +void TEST_CASE2() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v3, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vand.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0xf0, 0xef, 0xf0, 0xf0, 0xef, 0xf0, 0xf0, 0xef, 0xf0, 0xf0, + 0xef, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_16(v3, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, + 0xf0f0, 0xff00, 0x0003, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vand.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0xff00, 0xbeef, 0xf0f0, 0xff00, 0xbeef, 0xf0f0, 0xff00, + 0xbeef, 0xf0f0, 0xff00, 0xbeef, 0xf0f0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_32(v3, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, 0x00000003, + 0xf0f0f0f0, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, + 0x00000003, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vand.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0xffff0000, 0xdeadbeef, 0xf0f0f0f0, 0xffff0000, 0xdeadbeef, + 0xf0f0f0f0, 0xffff0000, 0xdeadbeef, 0xf0f0f0f0, 0xffff0000, + 0xdeadbeef, 0xf0f0f0f0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v3, 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vand.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0xffffffff00000000, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0); +} + +void TEST_CASE3() { + const uint64_t scalar = 0x0ff00ff00ff00ff0; + + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + asm volatile("vand.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0xf0, 0x00, 0xf0, 0xf0, 0x00, 0xf0, 0xf0, 0x00, 0xf0, 0xf0, + 0x00, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + asm volatile("vand.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0x0ff0, 0x0000, 0x00f0, 0x0ff0, 0x0000, 0x00f0, 0x0ff0, + 0x0000, 0x00f0, 0x0ff0, 0x0000, 0x00f0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + asm volatile("vand.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0x0ff00ff0, 0x00000000, 0x00f000f0, 0x0ff00ff0, 0x00000000, + 0x00f000f0, 0x0ff00ff0, 0x00000000, 0x00f000f0, 0x0ff00ff0, + 0x00000000, 0x00f000f0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + asm volatile("vand.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0x0ff00ff00ff00ff0, 0x0000000000000000, 0x00f000f000f000f0, + 0x0ff00ff00ff00ff0, 0x0000000000000000, 0x00f000f000f000f0, + 0x0ff00ff00ff00ff0, 0x0000000000000000, 0x00f000f000f000f0, + 0x0ff00ff00ff00ff0, 0x0000000000000000, 0x00f000f000f000f0); +} + +void TEST_CASE4() { + const uint64_t scalar = 0x0ff00ff00ff00ff0; + + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vand.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0xf0, 0xef, 0xf0, 0xf0, 0xef, 0xf0, 0xf0, 0xef, 0xf0, 0xf0, + 0xef, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vand.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0x0ff0, 0xbeef, 0x00f0, 0x0ff0, 0xbeef, 0x00f0, 0x0ff0, + 0xbeef, 0x00f0, 0x0ff0, 0xbeef, 0x00f0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vand.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0x0ff00ff0, 0xdeadbeef, 0x00f000f0, 0x0ff00ff0, 0xdeadbeef, + 0x00f000f0, 0x0ff00ff0, 0xdeadbeef, 0x00f000f0, 0x0ff00ff0, + 0xdeadbeef, 0x00f000f0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vand.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0x0ff00ff00ff00ff0, 0xdeadbeefdeadbeef, 0x00f000f000f000f0, + 0x0ff00ff00ff00ff0, 0xdeadbeefdeadbeef, 0x00f000f000f000f0, + 0x0ff00ff00ff00ff0, 0xdeadbeefdeadbeef, 0x00f000f000f000f0, + 0x0ff00ff00ff00ff0, 0xdeadbeefdeadbeef, 0x00f000f000f000f0); +} + +void TEST_CASE5() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + asm volatile("vand.vi v1, v2, 15"); + VCMP_U8(17, v1, 0x0f, 0x01, 0x00, 0x0f, 0x01, 0x00, 0x0f, 0x01, 0x00, 0x0f, + 0x01, 0x00); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + asm volatile("vand.vi v1, v2, 15"); + VCMP_U16(18, v1, 0x000f, 0x0001, 0x0000, 0x000f, 0x0001, 0x0000, 0x000f, + 0x0001, 0x0000, 0x000f, 0x0001, 0x0000); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + asm volatile("vand.vi v1, v2, 15"); + VCMP_U32(19, v1, 0x0000000f, 0x00000001, 0x00000000, 0x0000000f, 0x00000001, + 0x00000000, 0x0000000f, 0x00000001, 0x00000000, 0x0000000f, + 0x00000001, 0x00000000); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + asm volatile("vand.vi v1, v2, 15"); + VCMP_U64(20, v1, 0x000000000000000f, 0x0000000000000001, 0x0000000000000000, + 0x000000000000000f, 0x0000000000000001, 0x0000000000000000, + 0x000000000000000f, 0x0000000000000001, 0x0000000000000000, + 0x000000000000000f, 0x0000000000000001, 0x0000000000000000); +} + +void TEST_CASE6() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vand.vi v1, v2, 15, v0.t"); + VCMP_U8(21, v1, 0x0f, 0xef, 0x00, 0x0f, 0xef, 0x00, 0x0f, 0xef, 0x00, 0x0f, + 0xef, 0x00); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vand.vi v1, v2, 15, v0.t"); + VCMP_U16(22, v1, 0x000f, 0xbeef, 0x0000, 0x000f, 0xbeef, 0x0000, 0x000f, + 0xbeef, 0x0000, 0x000f, 0xbeef, 0x0000); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vand.vi v1, v2, 15, v0.t"); + VCMP_U32(23, v1, 0x0000000f, 0xdeadbeef, 0x00000000, 0x0000000f, 0xdeadbeef, + 0x00000000, 0x0000000f, 0xdeadbeef, 0x00000000, 0x0000000f, + 0xdeadbeef, 0x00000000); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vand.vi v1, v2, 15, v0.t"); + VCMP_U64(24, v1, 0x000000000000000f, 0xdeadbeefdeadbeef, 0x0000000000000000, + 0x000000000000000f, 0xdeadbeefdeadbeef, 0x0000000000000000, + 0x000000000000000f, 0xdeadbeefdeadbeef, 0x0000000000000000, + 0x000000000000000f, 0xdeadbeefdeadbeef, 0x0000000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vasub.c b/apps/riscv-tests/isa/rv64uv/vasub.c new file mode 100644 index 0000000..760a333 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vasub.c @@ -0,0 +1,54 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20); + VLOAD_32(v2, -1, 2, -3, 4); + __asm__ volatile("vasub.vv v3, v1, v2" ::); + VEC_CMP_32(1, v3, 3, 4, 9, 8); +} + +void TEST_CASE2(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20); + VLOAD_32(v2, 1, 2, 3, -4); + VLOAD_32(v0, 10, 0, 0, 0); + CLEAR(v3); + __asm__ volatile("vasub.vv v3, v1, v2, v0.t" ::); + VEC_CMP_32(2, v3, 0, 4, 0, 12); +} + +void TEST_CASE3(void) { + VSET(4, e32, m1); + VLOAD_U32(v1, 5, 10, 15, 20); + const uint64_t scalar = -5; + __asm__ volatile("vasub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VEC_CMP_U32(3, v3, 5, 8, 10, 13); +} + +void TEST_CASE4(void) { + VSET(4, e32, m1); + VLOAD_U32(v1, 5, 10, 15, 20); + const uint64_t scalar = -5; + VLOAD_U32(v0, 10, 0, 0, 0); + CLEAR(v3); + __asm__ volatile("vasub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VEC_CMP_U32(4, v3, 0, 8, 0, 13); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vasubu.c b/apps/riscv-tests/isa/rv64uv/vasubu.c new file mode 100644 index 0000000..68ec9cd --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vasubu.c @@ -0,0 +1,54 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e32, m1); + VLOAD_U32(v1, 5, 10, 15, 20); + VLOAD_U32(v2, 1, 2, 3, 4); + __asm__ volatile("vasubu.vv v3, v1, v2" ::); + VEC_CMP_U32(1, v3, 2, 4, 6, 8); +} + +void TEST_CASE2(void) { + VSET(4, e32, m1); + VLOAD_U32(v1, 5, 10, 15, 20); + VLOAD_U32(v2, 1, 2, 3, 4); + VLOAD_U32(v0, 10, 0, 0, 0); + CLEAR(v3); + __asm__ volatile("vasubu.vv v3, v1, v2, v0.t" ::); + VEC_CMP_U32(2, v3, 0, 4, 0, 8); +} + +void TEST_CASE3(void) { + VSET(4, e32, m1); + VLOAD_U32(v1, 5, 10, 15, 20); + const uint64_t scalar = 5; + __asm__ volatile("vasubu.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VEC_CMP_U32(3, v3, 0, 3, 5, 8); +} + +void TEST_CASE4(void) { + VSET(4, e32, m1); + VLOAD_U32(v1, 5, 10, 15, 20); + const uint64_t scalar = 5; + VLOAD_U32(v0, 10, 0, 0, 0); + CLEAR(v3); + __asm__ volatile("vasubu.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VEC_CMP_U32(4, v3, 0, 3, 0, 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vcompress.c b/apps/riscv-tests/isa/rv64uv/vcompress.c new file mode 100644 index 0000000..d568d95 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vcompress.c @@ -0,0 +1,183 @@ +// Copyright 2024 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4); + VLOAD_64(v0, 12, 0, 0, 0); + VCLEAR(v2); + asm volatile("vcompress.vm v2, v4, v0"); + VCMP_U64(1, v2, 3, 4, 0, 0); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0b10111100, 0b10111111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vcompress.vm v2, v4, v0"); + VCMP_U8(2, v2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 0, 0, 0, 0); + + VSET(257, e16, m4); + VLOAD_16( + v28, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256); + VSET(9, e64, m1); + VLOAD_64(v0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff); + VSET(1024, e8, m4); + VCLEAR_AT_ONE(v24); + VSET(257, e16, m4); + asm volatile("vcompress.vm v24, v28, v0"); + VSET(512, e16, m4); + VCMP_U16( + 3, v24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff); + + VSET(257, e16, m4); + VLOAD_16( + v28, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256); + VSET(8, e64, m4); + VLOAD_64(v0, 0xffffffffffffffbc, 0xffffffffffffffbf, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff); + VSET(1024, e8, m4); + VCLEAR_AT_ONE(v24); + VSET(257, e16, m4); + asm volatile("vcompress.vm v24, v28, v0"); + VSET(512, e16, m4); + VCMP_U16( + 4, v24, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vcpop.c b/apps/riscv-tests/isa/rv64uv/vcpop.c new file mode 100644 index 0000000..3c96421 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vcpop.c @@ -0,0 +1,111 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +// masked +void TEST_CASE1(void) { + VSET(4, e32, m1); + VCLEAR(v2); + VLOAD_32(v2, 7, 0, 0, 0); + VLOAD_32(v0, 5, 0, 0, 0); + volatile uint32_t scalar = 1337; + volatile uint32_t OUP[] = {0, 0, 0, 0}; + asm volatile("vpopc.m %[A], v2, v0.t \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(1, OUP[0], 2); + + VSET(32, e32, m1); + VLOAD_32(v8, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, + 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, + 0x88, 0x1, 0x1F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + VLOAD_32(v0, 0xffffffffffffffff, 0xfffffffffffffff7, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xefffffffffffffff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + VSET(1024, e8, m8); + asm volatile("vpopc.m %[A], v8, v0.t \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(2, OUP[0], 159); +} + +// unmasked +void TEST_CASE2(void) { + VSET(4, e32, m1); + VLOAD_32(v2, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F); + volatile uint32_t scalar = 1337; + volatile uint32_t OUP[] = {0, 0, 0, 0}; + VSET(128, e32, m2); + asm volatile("vpopc.m %[A], v2 \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(3, OUP[0], 40); + + VSET(8, e32, m1); + VLOAD_32(v0, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, + 0x1, 0x1F); + VSET(256, e8, m8); + asm volatile("vpopc.m %[A], v0 \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(4, OUP[0], 80); + + VSET(16, e32, m1); + VLOAD_32(v0, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, + 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, + 0x88, 0x1, 0x1F); + VSET(1024, e8, m8); + asm volatile("vpopc.m %[A], v0 \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(5, OUP[0], 160); + + VSET(8, e32, m1); + VLOAD_32(v2, 0xFFFFFFF7FFFFFFFF, 0x88, 0x1, 0x1F, 0xFFFFFFF7FFFFFFFF, 0x88, + 0x1, 0x1F); + VSET(256, e8, m1); + asm volatile("vpopc.m %[A], v2 \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(6, OUP[0], 80); + + VSET(2, e32, m1); + VLOAD_8(v2, 0xFF, 0x88); + VSET(16, e16, m1); + asm volatile("vcpop.m %[A], v2 \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(7, OUP[0], 10); + + VSET(4, e32, m1); + VLOAD_32(v2, 0xF, 0, 0, 0); + asm volatile("vpopc.m %[A], v2 \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(8, OUP[0], 4); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vdiv.c b/apps/riscv-tests/isa/rv64uv/vdiv.c new file mode 100644 index 0000000..74a8b57 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vdiv.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xcd, 0x42, 0x2c, 0xc4, 0x7a, 0x7b, 0xd1, 0x21, 0x38, 0x1d, 0x2e, + 0x4f, 0xe7, 0x3d, 0x63, 0xd8); + VLOAD_8(v3, 0x11, 0xa1, 0x7c, 0xde, 0x02, 0x38, 0x4e, 0x03, 0x1e, 0xc6, 0x16, + 0xa0, 0xca, 0x83, 0x54, 0x90); + asm volatile("vdiv.vv v1, v2, v3"); + VCMP_I8(1, v1, 0xfd, 0x00, 0x00, 0x01, 0x3d, 0x02, 0x00, 0x0b, 0x01, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x9e55, 0xf806, 0xa137, 0xa5fc, 0x38ae, 0x58c3, 0x2a66, 0x6bd7, + 0x74e7, 0xa845, 0x2052, 0x6f9a, 0x6d88, 0x2861, 0xdaea, 0x2075); + VLOAD_16(v3, 0x5e64, 0x0a44, 0xdde5, 0x813f, 0x78b9, 0x29be, 0x28b4, 0x1b2f, + 0xc4a3, 0x4a05, 0x5501, 0x49bb, 0xe5f8, 0xfa20, 0x4edf, 0xf892); + asm volatile("vdiv.vv v1, v2, v3"); + VCMP_I16(2, v1, 0xffff, 0x0000, 0x0002, 0x0000, 0x0000, 0x0002, 0x0001, + 0x0003, 0xffff, 0xffff, 0x0000, 0x0001, 0xfffc, 0xfffa, 0x0000, + 0xfffc); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xed578a38, 0xba7b1912, 0xb99934ef, 0x21a85df9, 0xb01c09f2, + 0xd0cb54fc, 0x9b617331, 0xd32cf029, 0xaea08daa, 0xd76f06e2, + 0x99b8e084, 0x9fdc6bfc, 0x3103b573, 0xaf1e96b4, 0x54fe9ea1, + 0x0ceff9c0); + VLOAD_32(v3, 0x0000002d, 0x0000001e, 0x0000003e, 0xffffffe0, 0x0000004b, + 0x00000064, 0xffffff88, 0x0000003b, 0x00000011, 0xffffffc3, + 0xffffffa2, 0x0000004b, 0xffffffcc, 0xffffffb1, 0xffffff9d, + 0xffffffba); + asm volatile("vdiv.vv v1, v2, v3"); + VCMP_I32(3, v1, 0xff95db40, 0xfdaec51b, 0xfedd4f4f, 0xfef2bd11, 0xfeef4ea4, + 0xff872740, 0x00d6a792, 0xff3d81e7, 0xfb369eec, 0x00aa3ed6, + 0x01168b3a, 0xfeb7d87b, 0xff0eb2ab, 0x01061804, 0xff24374a, + 0xffd0afa2); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x7954dd7fc5e0687c, 0xfcf310f44f869aa0, 0x375fcbcf6aae0cac, + 0x6038c1825cfb5a72, 0x59046c6b324e7fb3, 0xbac247d729fb18e6, + 0x0cecf04984784b3f, 0x2cd8e8ea5be0c201, 0xcab2cf17c48b57cb, + 0xcb53d1b55097656d, 0xbeeb18a6fab9af8d, 0xbf94f3a0fa74670b, + 0x817c1dfb5ab3bfd7, 0x40951ef6459642d1, 0x4b5f994556f6ba42, + 0x63a8eaa417e6d29c); + VLOAD_64(v3, 0xffffff9bd8e00c88, 0x0000002057c200e4, 0x0000004c4c93640e, + 0x000000497b7bfcdd, 0x00000001feebe76a, 0xffffffb93a2c242c, + 0xffffff8523c47d2a, 0x00000019f01c4433, 0xffffffd940862ecc, + 0x00000016ac4df9c8, 0x0000001e9f15d00c, 0xffffffd0af22d791, + 0xffffff9feca249bc, 0xffffffac5eae7985, 0x0000003567fe8027, + 0x000000175355cab3); + asm volatile("vdiv.vv v1, v2, v3"); + VCMP_I64(4, v1, 0xfffffffffec9dd87, 0xffffffffffe7dac0, 0x0000000000b9cad9, + 0x00000000014f3850, 0x000000002c9a4382, 0x0000000000fa75a9, + 0xffffffffffe51146, 0x0000000001baa14f, 0x000000000160270e, + 0xfffffffffdad470e, 0xfffffffffddfe832, 0x00000000015c87ee, + 0x0000000001511bae, 0xffffffffff3a4e84, 0x0000000001694c75, + 0x000000000445c6cf); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xcd, 0x42, 0x2c, 0xc4, 0x7a, 0x7b, 0xd1, 0x21, 0x38, 0x1d, 0x2e, + 0x4f, 0xe7, 0x3d, 0x63, 0xd8); + VLOAD_8(v3, 0x11, 0xa1, 0x7c, 0xde, 0x02, 0x38, 0x4e, 0x03, 0x1e, 0xc6, 0x16, + 0xa0, 0xca, 0x83, 0x54, 0x90); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0x00, 0, 0x01, 0, 0x02, 0, 0x0b, 0, 0x00, 0, 0x00, 0, 0x00, + 0, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x9e55, 0xf806, 0xa137, 0xa5fc, 0x38ae, 0x58c3, 0x2a66, 0x6bd7, + 0x74e7, 0xa845, 0x2052, 0x6f9a, 0x6d88, 0x2861, 0xdaea, 0x2075); + VLOAD_16(v3, 0x5e64, 0x0a44, 0xdde5, 0x813f, 0x78b9, 0x29be, 0x28b4, 0x1b2f, + 0xc4a3, 0x4a05, 0x5501, 0x49bb, 0xe5f8, 0xfa20, 0x4edf, 0xf892); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0x0000, 0, 0x0000, 0, 0x0002, 0, 0x0003, 0, 0xffff, 0, + 0x0001, 0, 0xfffa, 0, 0xfffc); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xed578a38, 0xba7b1912, 0xb99934ef, 0x21a85df9, 0xb01c09f2, + 0xd0cb54fc, 0x9b617331, 0xd32cf029, 0xaea08daa, 0xd76f06e2, + 0x99b8e084, 0x9fdc6bfc, 0x3103b573, 0xaf1e96b4, 0x54fe9ea1, + 0x0ceff9c0); + VLOAD_32(v3, 0x0000002d, 0x0000001e, 0x0000003e, 0xffffffe0, 0x0000004b, + 0x00000064, 0xffffff88, 0x0000003b, 0x00000011, 0xffffffc3, + 0xffffffa2, 0x0000004b, 0xffffffcc, 0xffffffb1, 0xffffff9d, + 0xffffffba); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0xfdaec51b, 0, 0xfef2bd11, 0, 0xff872740, 0, 0xff3d81e7, 0, + 0x00aa3ed6, 0, 0xfeb7d87b, 0, 0x01061804, 0, 0xffd0afa2); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x7954dd7fc5e0687c, 0xfcf310f44f869aa0, 0x375fcbcf6aae0cac, + 0x6038c1825cfb5a72, 0x59046c6b324e7fb3, 0xbac247d729fb18e6, + 0x0cecf04984784b3f, 0x2cd8e8ea5be0c201, 0xcab2cf17c48b57cb, + 0xcb53d1b55097656d, 0xbeeb18a6fab9af8d, 0xbf94f3a0fa74670b, + 0x817c1dfb5ab3bfd7, 0x40951ef6459642d1, 0x4b5f994556f6ba42, + 0x63a8eaa417e6d29c); + VLOAD_64(v3, 0xffffff9bd8e00c88, 0x0000002057c200e4, 0x0000004c4c93640e, + 0x000000497b7bfcdd, 0x00000001feebe76a, 0xffffffb93a2c242c, + 0xffffff8523c47d2a, 0x00000019f01c4433, 0xffffffd940862ecc, + 0x00000016ac4df9c8, 0x0000001e9f15d00c, 0xffffffd0af22d791, + 0xffffff9feca249bc, 0xffffffac5eae7985, 0x0000003567fe8027, + 0x000000175355cab3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0xffffffffffe7dac0, 0, 0x00000000014f3850, 0, + 0x0000000000fa75a9, 0, 0x0000000001baa14f, 0, 0xfffffffffdad470e, 0, + 0x00000000015c87ee, 0, 0xffffffffff3a4e84, 0, 0x000000000445c6cf); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x14, 0xab, 0x4d, 0xcd, 0xc3, 0x7c, 0xb5, 0xf0, 0xc1, 0x90, 0x14, + 0x59, 0x98, 0xda, 0x76, 0x84); + int64_t scalar = 5; + asm volatile("vdiv.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0x04, 0xef, 0x0f, 0xf6, 0xf4, 0x18, 0xf1, 0xfd, 0xf4, 0xea, + 0x04, 0x11, 0xec, 0xf9, 0x17, 0xe8); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x19c9, 0x865a, 0x3063, 0xd5c2, 0xbe39, 0x98c7, 0x1ca7, 0x5d1e, + 0x8fdc, 0x3396, 0x9442, 0xee77, 0x7da8, 0xf200, 0xaba3, 0x4cd6); + scalar = -538; + asm volatile("vdiv.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0xfff4, 0x0039, 0xffe9, 0x0014, 0x001f, 0x0031, 0xfff3, + 0xffd4, 0x0035, 0xffe8, 0x0033, 0x0008, 0xffc5, 0x0006, 0x0028, + 0xffdc); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x49dd393c, 0xfc1d701e, 0x7670b541, 0x5ef6c28f, 0x60da5cab, + 0x6be56bc4, 0x6f629cde, 0xf1ab595a, 0x3d99363b, 0xb8a7840e, + 0x84071026, 0x6697d435, 0x3768cf44, 0x82f1a5a1, 0xf5d4f40e, + 0xcda97e6d); + scalar = 649; + asm volatile("vdiv.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0x001d22cc, 0xfffe77b2, 0x002eb818, 0x00257573, 0x00263435, + 0x002a8f5a, 0x002befac, 0xfffa58e4, 0x00184c36, 0xffe3db85, + 0xffcf1946, 0x002877d8, 0x0015db3d, 0xffceabd8, 0xfffbfd39, + 0xffec24e2); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xeea1bad034de2c3e, 0x5acd284816152166, 0x52a24c3b98af20f9, + 0x843d3c2e39d3221e, 0xda6c4bef77118459, 0x8c7e991a77cc3ddc, + 0x58f56c82eceafc72, 0xb4b1bac0a66d4984, 0x126283c905985ab8, + 0x3a859a64dbdb137e, 0x46674604f440792d, 0x04b1df734a3f312a, + 0xde91f735ce81d174, 0x3d254eb16d0c87f4, 0xc06ebbe7936e6774, + 0xb17ccbc475c8724e); + scalar = -59223; + asm volatile("vdiv.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0x000013383ad25844, 0xffff9b84f9ef594c, 0xffffa48eb726f738, + 0x000088f40e45bbd1, 0x0000299522c72a62, 0x00007fd16a16b1db, + 0xffff9d8efec5cf15, 0x000053554738ae55, 0xffffeba7c8cdd664, + 0xffffbf3d66c69bdf, 0xffffb2177f70bf18, 0xffffface02d012e3, + 0x000024fe4bc4a5dc, 0xffffbc56186f1f3d, 0x00004657f2ee1ea3, + 0x000056e1b88b70d9); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x14, 0xab, 0x4d, 0xcd, 0xc3, 0x7c, 0xb5, 0xf0, 0xc1, 0x90, 0x14, + 0x59, 0x98, 0xda, 0x76, 0x84); + int64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0xef, 0, 0xf6, 0, 0x18, 0, 0xfd, 0, 0xea, 0, 0x11, 0, 0xf9, + 0, 0xe8); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x19c9, 0x865a, 0x3063, 0xd5c2, 0xbe39, 0x98c7, 0x1ca7, 0x5d1e, + 0x8fdc, 0x3396, 0x9442, 0xee77, 0x7da8, 0xf200, 0xaba3, 0x4cd6); + scalar = -538; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0x0039, 0, 0x0014, 0, 0x0031, 0, 0xffd4, 0, 0xffe8, 0, + 0x0008, 0, 0x0006, 0, 0xffdc); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x49dd393c, 0xfc1d701e, 0x7670b541, 0x5ef6c28f, 0x60da5cab, + 0x6be56bc4, 0x6f629cde, 0xf1ab595a, 0x3d99363b, 0xb8a7840e, + 0x84071026, 0x6697d435, 0x3768cf44, 0x82f1a5a1, 0xf5d4f40e, + 0xcda97e6d); + scalar = 649; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0xfffe77b2, 0, 0x00257573, 0, 0x002a8f5a, 0, 0xfffa58e4, + 0, 0xffe3db85, 0, 0x002877d8, 0, 0xffceabd8, 0, 0xffec24e2); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xeea1bad034de2c3e, 0x5acd284816152166, 0x52a24c3b98af20f9, + 0x843d3c2e39d3221e, 0xda6c4bef77118459, 0x8c7e991a77cc3ddc, + 0x58f56c82eceafc72, 0xb4b1bac0a66d4984, 0x126283c905985ab8, + 0x3a859a64dbdb137e, 0x46674604f440792d, 0x04b1df734a3f312a, + 0xde91f735ce81d174, 0x3d254eb16d0c87f4, 0xc06ebbe7936e6774, + 0xb17ccbc475c8724e); + scalar = -59223; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdiv.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0xffff9b84f9ef594c, 0, 0x000088f40e45bbd1, 0, + 0x00007fd16a16b1db, 0, 0x000053554738ae55, 0, 0xffffbf3d66c69bdf, 0, + 0xffffface02d012e3, 0, 0xffffbc56186f1f3d, 0, 0x000056e1b88b70d9); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vdivu.c b/apps/riscv-tests/isa/rv64uv/vdivu.c new file mode 100644 index 0000000..89f50a3 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vdivu.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x85, 0x1d, 0x9f, 0x31, 0x8c, 0x4c, 0x4c, 0xf2, 0x11, 0xfc, 0xc8, + 0xab, 0xc2, 0xff, 0xf5, 0xc2); + VLOAD_8(v3, 0x3d, 0x06, 0x32, 0x36, 0x02, 0x0f, 0x27, 0x35, 0x1e, 0x0f, 0x36, + 0x1c, 0x24, 0x1a, 0x22, 0x01); + asm volatile("vdivu.vv v1, v2, v3"); + VCMP_I8(1, v1, 0x02, 0x04, 0x03, 0x00, 0x46, 0x05, 0x01, 0x04, 0x00, 0x10, + 0x03, 0x06, 0x05, 0x09, 0x07, 0xc2); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xd200, 0xa047, 0x7af8, 0x453d, 0xd6eb, 0xfabb, 0x604a, 0xea35, + 0xbc2d, 0x45e7, 0x8407, 0x3845, 0x1495, 0x8ee6, 0x7da4, 0xf34a); + VLOAD_16(v3, 0x03ad, 0x00b8, 0x001b, 0x0353, 0x013f, 0x008c, 0x015e, 0x01e6, + 0x00cd, 0x0093, 0x00ba, 0x03d0, 0x0117, 0x009d, 0x007b, 0x02cf); + asm volatile("vdivu.vv v1, v2, v3"); + VCMP_I16(2, v1, 0x0039, 0x00de, 0x048d, 0x0014, 0x00ac, 0x01ca, 0x0046, + 0x007b, 0x00ea, 0x0079, 0x00b5, 0x000e, 0x0012, 0x00e9, 0x0105, + 0x0056); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xd56bd03a, 0x1036c5ff, 0xaa01847f, 0x988dc35d, 0x4d8615dc, + 0xb62269e2, 0xe842ba75, 0x02fecbf9, 0xe536c712, 0xe93e2160, + 0x9ba34297, 0x554d290d, 0x319f668c, 0x0d6c2fbb, 0x6a7eb54a, + 0x3fa1cc84); + VLOAD_32(v3, 0x00000025, 0x00000057, 0x0000002e, 0x0000004c, 0x00000052, + 0x00000021, 0x0000001d, 0x0000002f, 0x00000029, 0x00000008, + 0x00000015, 0x00000029, 0x00000048, 0x00000051, 0x0000003f, + 0x00000007); + asm volatile("vdivu.vv v1, v2, v3"); + VCMP_I32(3, v1, 0x05c4a4c3, 0x002fb5c5, 0x03b21eb4, 0x0201dd84, 0x00f20682, + 0x0584ebef, 0x08024d0c, 0x00105098, 0x05973090, 0x1d27c42c, + 0x07694c50, 0x02149d19, 0x00b06fa5, 0x002a6c0b, 0x01b0bdcc, + 0x09171d37); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xf251717441f02108, 0x2668b5d7f073b9d1, 0x4708b49fd356a60a, + 0x195bedcb9ce5956b, 0x41ce2b35b4280568, 0x32e5b89eed21de3b, + 0x73f17f3d0e1f243f, 0x0d0aa119af3b0e95, 0x024cbba6ba662213, + 0xf7df98f44da5e55f, 0x3cf2951aa7e4c0a9, 0x0ed8987446e84f30, + 0xd983a7a0d4c648b4, 0x60eb8249069801a5, 0x529967e8b06df477, + 0x776410b4b0cc22ad); + VLOAD_64(v3, 0x000000000000695b, 0x0000000000007420, 0x000000000001850c, + 0x000000000000b46f, 0x000000000000e92c, 0x0000000000024e72, + 0x0000000000032774, 0x000000000001c36f, 0x00000000000063d2, + 0x0000000000037bb4, 0x000000000003692c, 0x000000000001d60c, + 0x000000000002cf7b, 0x0000000000037899, 0x0000000000038bcf, + 0x000000000003d0e4); + asm volatile("vdivu.vv v1, v2, v3"); + VCMP_I64(4, v1, 0x00024ccd25dd5faf, 0x000054ac6a930494, 0x00002ebddee9df57, + 0x000023fac7321f85, 0x0000483f73b2e3e2, 0x000016114f5d8a9e, + 0x000024c26869df0e, 0x00000765470f410f, 0x000005e5de9b769d, + 0x0000472988fa89c3, 0x000011de6d57a394, 0x00000815e7b8df73, + 0x00004d64ede3b4a6, 0x00001bec0e79307a, 0x0000174af5139f58, + 0x00001f497ec0ff30); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x85, 0x1d, 0x9f, 0x31, 0x8c, 0x4c, 0x4c, 0xf2, 0x11, 0xfc, 0xc8, + 0xab, 0xc2, 0xff, 0xf5, 0xc2); + VLOAD_8(v3, 0x3d, 0x06, 0x32, 0x36, 0x02, 0x0f, 0x27, 0x35, 0x1e, 0x0f, 0x36, + 0x1c, 0x24, 0x1a, 0x22, 0x01); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0x04, 0, 0x00, 0, 0x05, 0, 0x04, 0, 0x10, 0, 0x06, 0, 0x09, + 0, 0xc2); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xd200, 0xa047, 0x7af8, 0x453d, 0xd6eb, 0xfabb, 0x604a, 0xea35, + 0xbc2d, 0x45e7, 0x8407, 0x3845, 0x1495, 0x8ee6, 0x7da4, 0xf34a); + VLOAD_16(v3, 0x03ad, 0x00b8, 0x001b, 0x0353, 0x013f, 0x008c, 0x015e, 0x01e6, + 0x00cd, 0x0093, 0x00ba, 0x03d0, 0x0117, 0x009d, 0x007b, 0x02cf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0x00de, 0, 0x0014, 0, 0x01ca, 0, 0x007b, 0, 0x0079, 0, + 0x000e, 0, 0x00e9, 0, 0x0056); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xd56bd03a, 0x1036c5ff, 0xaa01847f, 0x988dc35d, 0x4d8615dc, + 0xb62269e2, 0xe842ba75, 0x02fecbf9, 0xe536c712, 0xe93e2160, + 0x9ba34297, 0x554d290d, 0x319f668c, 0x0d6c2fbb, 0x6a7eb54a, + 0x3fa1cc84); + VLOAD_32(v3, 0x00000025, 0x00000057, 0x0000002e, 0x0000004c, 0x00000052, + 0x00000021, 0x0000001d, 0x0000002f, 0x00000029, 0x00000008, + 0x00000015, 0x00000029, 0x00000048, 0x00000051, 0x0000003f, + 0x00000007); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0x002fb5c5, 0, 0x0201dd84, 0, 0x0584ebef, 0, 0x00105098, 0, + 0x1d27c42c, 0, 0x02149d19, 0, 0x002a6c0b, 0, 0x09171d37); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xf251717441f02108, 0x2668b5d7f073b9d1, 0x4708b49fd356a60a, + 0x195bedcb9ce5956b, 0x41ce2b35b4280568, 0x32e5b89eed21de3b, + 0x73f17f3d0e1f243f, 0x0d0aa119af3b0e95, 0x024cbba6ba662213, + 0xf7df98f44da5e55f, 0x3cf2951aa7e4c0a9, 0x0ed8987446e84f30, + 0xd983a7a0d4c648b4, 0x60eb8249069801a5, 0x529967e8b06df477, + 0x776410b4b0cc22ad); + VLOAD_64(v3, 0x000000000000695b, 0x0000000000007420, 0x000000000001850c, + 0x000000000000b46f, 0x000000000000e92c, 0x0000000000024e72, + 0x0000000000032774, 0x000000000001c36f, 0x00000000000063d2, + 0x0000000000037bb4, 0x000000000003692c, 0x000000000001d60c, + 0x000000000002cf7b, 0x0000000000037899, 0x0000000000038bcf, + 0x000000000003d0e4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0x000054ac6a930494, 0, 0x000023fac7321f85, 0, + 0x000016114f5d8a9e, 0, 0x00000765470f410f, 0, 0x0000472988fa89c3, 0, + 0x00000815e7b8df73, 0, 0x00001bec0e79307a, 0, 0x00001f497ec0ff30); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x0f, 0xbd, 0x0a, 0x58, 0x8e, 0x09, 0xa7, 0x02, 0x4b, 0xe8, 0xd2, + 0xfc, 0xa9, 0x8e, 0x67, 0x49); + uint64_t scalar = 5; + asm volatile("vdivu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0x03, 0x25, 0x02, 0x11, 0x1c, 0x01, 0x21, 0x00, 0x0f, 0x2e, + 0x2a, 0x32, 0x21, 0x1c, 0x14, 0x0e); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xcf2f, 0x0c02, 0x1417, 0x1747, 0x5e43, 0x9552, 0xe03e, 0x5367, + 0xb2f9, 0x09d8, 0x3b19, 0x8ed0, 0x4740, 0xa628, 0x5560, 0x713b); + scalar = 538; + asm volatile("vdivu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0x0062, 0x0005, 0x0009, 0x000b, 0x002c, 0x0047, 0x006a, + 0x0027, 0x0055, 0x0004, 0x001c, 0x0043, 0x0021, 0x004f, 0x0028, + 0x0035); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x643498d4, 0xe1e4c6d4, 0x2fef6b6f, 0xe68ef651, 0x9943599a, + 0x68af922e, 0x09a3beb2, 0x117ff561, 0x86a1a3f7, 0x03566f4f, + 0xc3c0c7de, 0x8cb524f8, 0x532e1652, 0xb0c26bf2, 0x886d0b1c, + 0xf94d6b63); + scalar = 649; + asm volatile("vdivu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0x002786be, 0x00591abc, 0x0012e87f, 0x005af1c8, 0x003c7480, + 0x00294b2b, 0x0003cd68, 0x0006e722, 0x00351b13, 0x00015108, + 0x004d3723, 0x003780a6, 0x0020cf84, 0x0045b92a, 0x0035d049, + 0x0062568c); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x751ea878eaf9f85f, 0x9843aba4c3e313af, 0xc2f56d78083dc0f2, + 0x4fcb920a2a4ebc8d, 0x33a71e7364643a7c, 0x76f96f8403af4ad7, + 0xcdbbb2002ea6ac93, 0xc380d0b6a5182bcc, 0x93b79fcc64af88cf, + 0x85d32b075e613f6c, 0x4f1f75bfa6d8f319, 0xd2a34a8d9a02d7f1, + 0x8679a27b237a032e, 0x7e0881a487bbb235, 0x17d97d9849271cec, + 0x1c85ac87ba3c7d1e); + scalar = 9223; + asm volatile("vdivu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0x000340383152452b, 0x000439f263aaf34a, 0x000569521e089c7c, + 0x0002370079144c76, 0x00016f07b37c5546, 0x00034d65d36c535c, + 0x0005b5e194247d88, 0x00056d3090f69ef0, 0x000419a3026cfde7, + 0x0003b6ebd974c870, 0x000232398140d5dd, 0x0005d8bb7bec2e99, + 0x0003bb8ab6abb03a, 0x00037f8e5aab0783, 0x0000a977deb32c78, + 0x0000caab9b4a8885); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x0f, 0xbd, 0x0a, 0x58, 0x8e, 0x09, 0xa7, 0x02, 0x4b, 0xe8, 0xd2, + 0xfc, 0xa9, 0x8e, 0x67, 0x49); + uint64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0x25, 0, 0x11, 0, 0x01, 0, 0x00, 0, 0x2e, 0, 0x32, 0, 0x1c, + 0, 0x0e); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xcf2f, 0x0c02, 0x1417, 0x1747, 0x5e43, 0x9552, 0xe03e, 0x5367, + 0xb2f9, 0x09d8, 0x3b19, 0x8ed0, 0x4740, 0xa628, 0x5560, 0x713b); + scalar = 538; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0x0005, 0, 0x000b, 0, 0x0047, 0, 0x0027, 0, 0x0004, 0, + 0x0043, 0, 0x004f, 0, 0x0035); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x643498d4, 0xe1e4c6d4, 0x2fef6b6f, 0xe68ef651, 0x9943599a, + 0x68af922e, 0x09a3beb2, 0x117ff561, 0x86a1a3f7, 0x03566f4f, + 0xc3c0c7de, 0x8cb524f8, 0x532e1652, 0xb0c26bf2, 0x886d0b1c, + 0xf94d6b63); + scalar = 649; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0x00591abc, 0, 0x005af1c8, 0, 0x00294b2b, 0, 0x0006e722, + 0, 0x00015108, 0, 0x003780a6, 0, 0x0045b92a, 0, 0x0062568c); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x751ea878eaf9f85f, 0x9843aba4c3e313af, 0xc2f56d78083dc0f2, + 0x4fcb920a2a4ebc8d, 0x33a71e7364643a7c, 0x76f96f8403af4ad7, + 0xcdbbb2002ea6ac93, 0xc380d0b6a5182bcc, 0x93b79fcc64af88cf, + 0x85d32b075e613f6c, 0x4f1f75bfa6d8f319, 0xd2a34a8d9a02d7f1, + 0x8679a27b237a032e, 0x7e0881a487bbb235, 0x17d97d9849271cec, + 0x1c85ac87ba3c7d1e); + scalar = 9223; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vdivu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0x000439f263aaf34a, 0, 0x0002370079144c76, 0, + 0x00034d65d36c535c, 0, 0x00056d3090f69ef0, 0, 0x0003b6ebd974c870, 0, + 0x0005d8bb7bec2e99, 0, 0x00037f8e5aab0783, 0, 0x0000caab9b4a8885); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfadd.c b/apps/riscv-tests/isa/rv64uv/vfadd.c new file mode 100644 index 0000000..d48ca8e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfadd.c @@ -0,0 +1,463 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Notes: hard to check if FS is Dirtied by the first vector FP instruction +// since it is not accessible in U mode and it is dirtied before the first vfp +// operation + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + /* + VSET(16, e8, m1); + // Enable this test only with 8-bit floating-point support on + VLOAD_8(v2, 0b11001100, 0b01011011, 0b11001100, 0b01011011, 0b11001100, + 0b01011011, 0b11001100, 0b01011011, 0b11001100, 0b01011011, 0b11001100, + 0b01011011, 0b11001100, 0b01011011, 0b11001100, 0b01011011); VLOAD_8(v3, + 0b01011011, 0b11001100, 0b01011011, 0b11001100, 0b01011011, 0b11001100, + 0b01011011, 0b11001100, 0b01011011, 0b11001100, 0b01011011, 0b11001100, + 0b01011011, 0b11001100, 0b01011011, 0b11001100); asm volatile("vfadd.vv v1, + v2, v3"); VCMP_U8(0, v1, 0b01011010, 0b01011010, 0b01011010, 0b01011010, + 0b01011010, 0b01011010, 0b01011010, 0b01011010, 0b01011010, 0b01011010, + 0b01011010, 0b01011010, 0b01011010, 0b01011010, 0b01011010, 0b01011010); + */ + + VSET(16, e16, m1); + // -0.8896, -0.3406, 0.7324, -0.6846, -0.2969, -0.7739, 0.5737, + // 0.4331, 0.8940, -0.4900, 0.4219, 0.4639, 0.6694, 0.4382, + // 0.1356, 0.5337 + VLOAD_16(v2, 0xbb1e, 0xb573, 0x39dc, 0xb97a, 0xb4c0, 0xba31, 0x3897, 0x36ee, + 0x3b27, 0xb7d7, 0x36c0, 0x376c, 0x395b, 0x3703, 0x3057, 0x0001); + // -0.8164, 0.6533, -0.4685, 0.6284, 0.1666, 0.9438, 0.0445, + // -0.1342, -0.8071, -0.3167, -0.8350, 0.2178, -0.0896, -0.3057, + // -0.3064, 0.2073 + VLOAD_16(v3, 0xba88, 0x393a, 0xb77f, 0x3907, 0x3155, 0x3b8d, 0x29b3, 0xb04b, + 0xba75, 0xb511, 0xbaae, 0x32f8, 0xadbc, 0xb4e4, 0xb4e7, 0x8010); + asm volatile("vfadd.vv v1, v2, v3"); + // -1.7061, 0.3127, 0.2639, -0.0562, -0.1302, 0.1699, 0.6182, + // 0.2988, 0.0869, -0.8066, -0.4131, 0.6816, 0.5801, 0.1326, + // -0.1708, 0.7412 + VCMP_U16(1, v1, 0xbed3, 0x3501, 0x3439, 0xab30, 0xb02b, 0x3170, 0x38f2, + 0x34c8, 0x2d90, 0xba74, 0xb69c, 0x3974, 0x38a4, 0x303e, 0xb177, + 0x800f); + + VSET(16, e32, m1); + // -0.28968573, 0.40292332, 0.33936000, 0.53889370, 0.39942014, + // -0.27004066, 0.78120714, -0.15632398, -0.49984047, + // -0.69259918, -0.03384063, -0.62385744, 0.00338853, 0.33711585, + // -0.34673852, 0.11450682 + VLOAD_32(v2, 0xbe9451b0, 0x3ece4bf7, 0x3eadc098, 0x3f09f4f0, 0x3ecc80cc, + 0xbe8a42c5, 0x3f47fd31, 0xbe201365, 0xbeffeb17, 0xbf314e2e, + 0xbd0a9c78, 0xbf1fb51f, 0x3b5e1209, 0x3eac9a73, 0xbeb187b6, + 0x3dea828d); + // -0.62142891, 0.63306540, 0.26511025, 0.85738784, + // -0.78492641, -0.44331804, -0.84668529, 0.13981950, 0.84909225, + // 0.23569171, 0.34283128, 0.56619811, 0.22596644, 0.55843508, + // 0.53194439, 0.02510819 + VLOAD_32(v3, 0xbf1f15f7, 0x3f221093, 0x3e87bc88, 0x3f5b7dc5, 0xbf48f0f0, + 0xbee2fa95, 0xbf58c05e, 0x3e0f2cd8, 0x3f595e1c, 0x3e71592b, + 0x3eaf8795, 0x3f10f25c, 0x3e6763bf, 0x3f0ef59a, 0x3f082d82, + 0x3ccdafb0); + asm volatile("vfadd.vv v1, v2, v3"); + // -0.91111463, 1.03598869, 0.60447025, 1.39628148, + // -0.38550627, -0.71335870, -0.06547815, -0.01650448, 0.34925178, + // -0.45690745, 0.30899066, -0.05765933, 0.22935496, 0.89555097, + // 0.18520588, 0.13961500 + VCMP_U32(2, v1, 0xbf693ecf, 0x3f849b47, 0x3f1abe90, 0x3fb2b95a, 0xbec56114, + 0xbf369ead, 0xbd861968, 0xbc873468, 0x3eb2d121, 0xbee9efc6, + 0x3e9e3406, 0xbd6c2c30, 0x3e6adc07, 0x3f6542d4, 0x3e3da69c, + 0x3e0ef73c); + + VSET(16, e64, m1); + // -0.1192486190170796, 0.7099687505713703, -0.6001652243371716, + // -0.9559723926483070, 0.7987976623002717, -0.3314459653039117, + // 0.7678805321182058, -0.3118871679402779, -0.7580588930783800, + // 0.5940681950113129, 0.6471754222100761, 0.4175915562917139, + // -0.3690504607938143, 0.0740574148132984, -0.1493616685664843, + // 0.3560295367616439 + VLOAD_64(v2, 0xbfbe8713d6c58260, 0x3fe6b810629c5a40, 0xbfe3348db3573060, + 0xbfee97536a49b50a, 0x3fe98fc01d766dee, 0xbfd536692357c5dc, + 0x3fe8927a3195d944, 0xbfd3f5f598961d8c, 0xbfe84204b946d5d6, + 0x3fe3029b4da55ad8, 0x3fe4b5a93b255a44, 0x3fdab9d1ef56f430, + 0xbfd79e85d2ebb8f0, 0x3fb2f56d3ea64090, 0xbfc31e487ce26ff0, + 0x3fd6c9301c334858); + // -0.7765903295164327, 0.4195489676706889, -0.3911414124398265, + // 0.6922029856623244, 0.5664741772288600, -0.1412820433489181, + // -0.1847941224896075, -0.4907136082532593, -0.9146160877742129, + // -0.7130864084314152, -0.5516927493459973, -0.4203081001100177, + // 0.6487326796833275, -0.5631384800254344, -0.0996872955425372, + // -0.4382844162164241 + VLOAD_64(v3, 0xbfe8d9d3f67536d2, 0x3fdad9e3e9cdd5bc, 0xbfd90875fda29450, + 0x3fe62686e0339faa, 0x3fe2208e74273f2c, 0xbfc21587add90b50, + 0xbfc7a755744afe30, 0xbfdf67da0cc99808, 0xbfed4488f52c57bc, + 0xbfe6d19a966debbe, 0xbfe1a7778d7c344c, 0xbfdae653f20dd9d4, + 0x3fe4c26b0962c342, 0xbfe2053afd5a822c, 0xbfb9851b4a2e8ff0, + 0xbfdc0cda147fbe5c); + asm volatile("vfadd.vv v1, v2, v3"); + // -0.8958389485335123, 1.1295177182420593, -0.9913066367769980, + // -0.2637694069859826, 1.3652718395291317, -0.4727280086528298, + // 0.5830864096285984, -0.8026007761935372, -1.6726749808525929, + // -0.1190182134201023, 0.0954826728640787, -0.0027165438183039, + // 0.2796822188895132, -0.4890810652121360, -0.2490489641090214, + // -0.0822548794547802 + VCMP_U64(3, v1, 0xbfecaab6714de71e, 0x3ff212812bc1a28f, 0xbfefb8c8b2287a88, + 0xbfd0e199142c2ac0, 0x3ff5d82748ced68d, 0xbfde412cfa444b84, + 0x3fe2a8a4d48319b8, 0xbfe9aee7d2afdaca, 0xbffac346d73996c9, + 0xbfbe77fa46448730, 0x3fb8718d6d492fc0, 0xbf6641015b72d200, + 0x3fd1e6503fd9cd94, 0xbfdf4d1aab0b7434, 0xbfcfe0d621f9b7e8, + 0xbfb50ea7e131d810); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 0xbb1e, 0xb573, 0x39dc, 0xb97a, 0xb4c0, 0xba31, 0x3897, 0x36ee, + 0x3b27, 0xb7d7, 0x36c0, 0x376c, 0x395b, 0x3703, 0x3057, 0x0001); + VLOAD_16(v3, 0xba88, 0x393a, 0xb77f, 0x3907, 0x3155, 0x3b8d, 0x29b3, 0xb04b, + 0xba75, 0xb511, 0xbaae, 0x32f8, 0xadbc, 0xb4e4, 0xb4e7, 0x8010); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vv v1, v2, v3, v0.t"); + VCMP_U16(4, v1, 0, 0x3501, 0, 0xab30, 0, 0x3170, 0, 0x34c8, 0, 0xba74, 0, + 0x3974, 0, 0x303e, 0, 0x800f); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xbe9451b0, 0x3ece4bf7, 0x3eadc098, 0x3f09f4f0, 0x3ecc80cc, + 0xbe8a42c5, 0x3f47fd31, 0xbe201365, 0xbeffeb17, 0xbf314e2e, + 0xbd0a9c78, 0xbf1fb51f, 0x3b5e1209, 0x3eac9a73, 0xbeb187b6, + 0x3dea828d); + VLOAD_32(v3, 0xbf1f15f7, 0x3f221093, 0x3e87bc88, 0x3f5b7dc5, 0xbf48f0f0, + 0xbee2fa95, 0xbf58c05e, 0x3e0f2cd8, 0x3f595e1c, 0x3e71592b, + 0x3eaf8795, 0x3f10f25c, 0x3e6763bf, 0x3f0ef59a, 0x3f082d82, + 0x3ccdafb0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vv v1, v2, v3, v0.t"); + VCMP_U32(5, v1, 0, 0x3f849b47, 0, 0x3fb2b95a, 0, 0xbf369ead, 0, 0xbc873468, 0, + 0xbee9efc6, 0, 0xbd6c2c30, 0, 0x3f6542d4, 0, 0x3e0ef73c); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xbfbe8713d6c58260, 0x3fe6b810629c5a40, 0xbfe3348db3573060, + 0xbfee97536a49b50a, 0x3fe98fc01d766dee, 0xbfd536692357c5dc, + 0x3fe8927a3195d944, 0xbfd3f5f598961d8c, 0xbfe84204b946d5d6, + 0x3fe3029b4da55ad8, 0x3fe4b5a93b255a44, 0x3fdab9d1ef56f430, + 0xbfd79e85d2ebb8f0, 0x3fb2f56d3ea64090, 0xbfc31e487ce26ff0, + 0x3fd6c9301c334858); + VLOAD_64(v3, 0xbfe8d9d3f67536d2, 0x3fdad9e3e9cdd5bc, 0xbfd90875fda29450, + 0x3fe62686e0339faa, 0x3fe2208e74273f2c, 0xbfc21587add90b50, + 0xbfc7a755744afe30, 0xbfdf67da0cc99808, 0xbfed4488f52c57bc, + 0xbfe6d19a966debbe, 0xbfe1a7778d7c344c, 0xbfdae653f20dd9d4, + 0x3fe4c26b0962c342, 0xbfe2053afd5a822c, 0xbfb9851b4a2e8ff0, + 0xbfdc0cda147fbe5c); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vv v1, v2, v3, v0.t"); + VCMP_U64(6, v1, 0, 0x3ff212812bc1a28f, 0, 0xbfd0e199142c2ac0, 0, + 0xbfde412cfa444b84, 0, 0xbfe9aee7d2afdaca, 0, 0xbfbe77fa46448730, 0, + 0xbf6641015b72d200, 0, 0xbfdf4d1aab0b7434, 0, 0xbfb50ea7e131d810); +}; + +// Edge-case tests +void TEST_CASE3(void) { + VSET(16, e16, m1); + VLOAD_16(v2, pInfh, pInfh, mInfh, qNaNh, pMaxh, pMaxh, pZero, mZeroh, pZero, + pMaxh, pZero, qNaNh, mInfh, pInfh, qNaNh, qNaNh); + VLOAD_16(v3, mInfh, pInfh, mInfh, pZero, pMaxh, mMaxh, pZero, mZeroh, mZeroh, + mZeroh, mMaxh, 0x1, 0xba88, pZero, qNaNh, 0xba88); + asm volatile("vfadd.vv v1, v2, v3"); + VCMP_U16(7, v1, qNaNh, pInfh, mInfh, qNaNh, pInfh, pZero, pZero, mZeroh, + pZero, pMaxh, mMaxh, qNaNh, mInfh, pInfh, qNaNh, qNaNh); + + VSET(16, e32, m1); + VLOAD_32(v2, pInff, pInff, mInff, qNaNf, pMaxf, pMaxf, pZero, mZerof, pZero, + pMaxf, pZero, qNaNf, mInff, pInff, qNaNf, qNaNf); + VLOAD_32(v3, mInff, pInff, mInff, pZero, pMaxf, mMaxf, pZero, mZerof, mZerof, + mZerof, mMaxf, 0x1, 0xbf48f0f0, pZero, qNaNf, 0xbf48f0f0); + asm volatile("vfadd.vv v1, v2, v3"); + VCMP_U32(8, v1, qNaNf, pInff, mInff, qNaNf, pInff, pZero, pZero, mZerof, + pZero, pMaxf, mMaxf, qNaNf, mInff, pInff, qNaNf, qNaNf); + + VSET(16, e64, m1); + VLOAD_64(v2, pInfd, pInfd, mInfd, qNaNd, pMaxd, pMaxd, pZero, mZerod, pZero, + pMaxd, pZero, qNaNd, mInfd, pInfd, qNaNd, qNaNd); + VLOAD_64(v3, mInfd, pInfd, mInfd, pZero, pMaxd, mMaxd, pZero, mZerod, mZerod, + mZerod, mMaxd, 0x1, 0xbfd90875fda29450, pZero, qNaNd, + 0xbfd90875fda29450); + asm volatile("vfadd.vv v1, v2, v3"); + VCMP_U64(9, v1, qNaNd, pInfd, mInfd, qNaNd, pInfd, pZero, pZero, mZerod, + pZero, pMaxd, mMaxd, qNaNd, mInfd, pInfd, qNaNd, qNaNd); +}; + +// Imprecise exceptions +// If the check is done immediately after the vector instruction, it fails as it +// is completed before the "faulty" operations are executed by Ara's FPU +void TEST_CASE4(void) { + // Overflow + Inexact + CLEAR_FFLAGS; + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, + pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh); + VLOAD_16(v3, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, + pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh, pMaxh); + asm volatile("vfadd.vv v1, v2, v3"); + VCMP_U16(10, v1, pInfh, pInfh, pInfh, pInfh, pInfh, pInfh, pInfh, pInfh, + pInfh, pInfh, pInfh, pInfh, pInfh, pInfh, pInfh, pInfh); + CHECK_FFLAGS(OF | NX); + + // Invalid operation, overflow + CLEAR_FFLAGS; + VSET(16, e32, m1); + CHECK_FFLAGS(0); + VLOAD_32(v2, pInff, pInff, pInff, pInff, pInff, pInff, pInff, pInff, pInff, + pInff, pInff, pInff, pInff, pInff, pInff, pInff); + VLOAD_32(v3, mInff, mInff, mInff, mInff, mInff, mInff, mInff, mInff, mInff, + mInff, mInff, mInff, mInff, mInff, mInff, mInff); + asm volatile("vfadd.vv v1, v2, v3"); + VCMP_U32(11, v1, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, + qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf, qNaNf); + CHECK_FFLAGS(NV); + + // Invalid operation, overflow, inexact + CLEAR_FFLAGS; + VSET(16, e64, m1); + CHECK_FFLAGS(0); + VLOAD_64(v2, pMaxd, pInfd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, + pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd); + VLOAD_64(v3, pMaxd, mInfd, 8000000000000001, pMaxd, pMaxd, pMaxd, pMaxd, + pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd); + asm volatile("vfadd.vv v1, v2, v3"); + VCMP_U64(12, v1, pInfd, qNaNd, pMaxd, pInfd, pInfd, pInfd, pInfd, pInfd, + pInfd, pInfd, pInfd, pInfd, pInfd, pInfd, pInfd, pInfd); + CHECK_FFLAGS(NV | OF | NX); +}; + +// Different rounding-mode + Back-to-back rm change and vfp operation +// Index 12 (starting from 0) rounds differently for RNE and RTZ +void TEST_CASE5(void) { + VSET(16, e16, m1); + // -0.8896, -0.3406, 0.7324, -0.6846, -0.2969, -0.7739, 0.5737, + // 0.4331, 0.8940, -0.4900, 0.4219, 0.4639, 0.6694, 0.4382, + // 0.1356, 0.5337 + VLOAD_16(v2, 0xbb1e, 0xb573, 0x39dc, 0xb97a, 0xb4c0, 0xba31, 0x3897, 0x36ee, + 0x3b27, 0xb7d7, 0x36c0, 0x376c, 0x395b, 0x3703, 0x3057, 0x0001); + // -0.8164, 0.6533, -0.4685, 0.6284, 0.1666, 0.9438, 0.0445, + // -0.1342, -0.8071, -0.3167, -0.8350, 0.2178, -0.0896, -0.3057, + // -0.3064, 0.2073 + VLOAD_16(v3, 0xba88, 0x393a, 0xb77f, 0x3907, 0x3155, 0x3b8d, 0x29b3, 0xb04b, + 0xba75, 0xb511, 0xbaae, 0x32f8, 0xadbc, 0xb4e4, 0xb4e7, 0x8010); + CHANGE_RM(RM_RTZ); + asm volatile("vfadd.vv v1, v2, v3"); + // -1.7061, 0.3127, 0.2639, -0.0562, -0.1302, 0.1699, 0.6182, + // 0.2988, 0.0869, -0.8066, -0.4131, 0.6816, 0.5801, 0.1326, + // -0.1708, 0.7412 + VCMP_U16(13, v1, 0xbed3, 0x3501, 0x3439, 0xab30, 0xb02b, 0x3170, 0x38f2, + 0x34c8, 0x2d90, 0xba74, 0xb69c, 0x3974, 0x38a3, 0x303e, 0xb177, + 0x800f); + + VSET(16, e16, m1); + // -0.8896, -0.3406, 0.7324, -0.6846, -0.2969, -0.7739, 0.5737, + // 0.4331, 0.8940, -0.4900, 0.4219, 0.4639, 0.6694, 0.4382, + // 0.1356, 0.5337 + VLOAD_16(v2, 0xbb1e, 0xb573, 0x39dc, 0xb97a, 0xb4c0, 0xba31, 0x3897, 0x36ee, + 0x3b27, 0xb7d7, 0x36c0, 0x376c, 0x395b, 0x3703, 0x3057, 0x0001); + // -0.8164, 0.6533, -0.4685, 0.6284, 0.1666, 0.9438, 0.0445, + // -0.1342, -0.8071, -0.3167, -0.8350, 0.2178, -0.0896, -0.3057, + // -0.3064, 0.2073 + VLOAD_16(v3, 0xba88, 0x393a, 0xb77f, 0x3907, 0x3155, 0x3b8d, 0x29b3, 0xb04b, + 0xba75, 0xb511, 0xbaae, 0x32f8, 0xadbc, 0xb4e4, 0xb4e7, 0x8010); + CHANGE_RM(RM_RNE); + asm volatile("vfadd.vv v1, v2, v3"); + // -1.7061, 0.3127, 0.2639, -0.0562, -0.1302, 0.1699, 0.6182, + // 0.2988, 0.0869, -0.8066, -0.4131, 0.6816, 0.5801, 0.1326, + // -0.1708, 0.7412 + VCMP_U16(14, v1, 0xbed3, 0x3501, 0x3439, 0xab30, 0xb02b, 0x3170, 0x38f2, + 0x34c8, 0x2d90, 0xba74, 0xb69c, 0x3974, 0x38a4, 0x303e, 0xb177, + 0x800f); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE6(void) { + VSET(16, e16, m1); + // -0.1481, -0.1797, -0.5454, 0.3228, 0.3237, -0.7212, -0.5195, + // -0.4500, 0.2681, 0.7300, 0.5059, 0.5830, 0.3198, -0.1713, + // -0.6431, 0.4841 + VLOAD_16(v2, 0xb0bd, 0xb1c0, 0xb85d, 0x352a, 0x352e, 0xb9c5, 0xb828, 0xb733, + 0x344a, 0x39d7, 0x380c, 0x38aa, 0x351e, 0xb17b, 0xb925, 0x37bf); + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + asm volatile("vfadd.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // -1.0859, -1.1172, -1.4834, -0.6152, -0.6143, -1.6592, + // -1.4570, -1.3877, -0.6699, -0.2080, -0.4321, -0.3550, + // -0.6182, -1.1094, -1.5811, -0.4539 + VCMP_U16(15, v1, 0xbc58, 0xbc78, 0xbdef, 0xb8ec, 0xb8ea, 0xbea3, 0xbdd4, + 0xbd8d, 0xb95c, 0xb2a8, 0xb6ea, 0xb5ae, 0xb8f2, 0xbc70, 0xbe53, + 0xb743); + + VSET(16, e32, m1); + // 0.86539453, -0.53925377, -0.47128764, 0.99265540, + // 0.32128176, -0.47335613, -0.30028856, 0.44394016, + // -0.72540921, -0.26464799, 0.77351445, -0.21725702, + // -0.25191557, -0.53123665, 0.80404943, 0.81841671 + VLOAD_32(v2, 0x3f5d8a7f, 0xbf0a0c89, 0xbef14c9d, 0x3f7e1eaa, 0x3ea47f0b, + 0xbef25bbc, 0xbe99bf6c, 0x3ee34c20, 0xbf39b46b, 0xbe877ff1, + 0x3f46050b, 0xbe5e78a0, 0xbe80fb14, 0xbf07ff20, 0x3f4dd62f, + 0x3f5183c2); + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + asm volatile("vfadd.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // -0.09516734, -1.49981570, -1.43184948, 0.03209352, + // -0.63928008, -1.43391800, -1.26085043, -0.51662171, + // -1.68597102, -1.22520983, -0.18704742, -1.17781889, + // -1.21247745, -1.49179852, -0.15651244, -0.14214516 + VCMP_U32(16, v1, 0xbdc2e718, 0xbfbff9f6, 0xbfb746d8, 0x3d037480, 0xbf23a7dc, + 0xbfb78aa0, 0xbfa1638c, 0xbf044152, 0xbfd7cde6, 0xbf9cd3ad, + 0xbe3f895c, 0xbf96c2c5, 0xbf9b3276, 0xbfbef341, 0xbe2044cc, + 0xbe118e80); + + VSET(16, e64, m1); + // -0.3488917150781869, -0.4501495513738740, 0.8731197104152684, + // 0.3256432550932964, 0.6502591178769535, -0.3169358689246526, + // -0.5396694979141685, -0.5417807430937591, + // -0.7971574213160249, -0.1764794100111047, 0.3564275916066595, + // -0.3754449946313438, 0.6580947137446858, + // -0.3328857144699515, 0.1761214464164236, 0.1429774118511240 + VLOAD_64(v2, 0xbfd6543dea86cb60, 0xbfdccf40105d6e5c, 0x3febf098bf37400c, + 0x3fd4d756ceb279f4, 0x3fe4ceec35a6a266, 0xbfd448ad61fd7c88, + 0xbfe144f8f7861540, 0xbfe1564491a616b8, 0xbfe9825047ca1cd6, + 0xbfc696e097352100, 0x3fd6cfb5ac55edec, 0xbfd8074a7158dd78, + 0x3fe50f1ca5268668, 0xbfd54dffe23d0eec, 0x3fc68b25c63dcaf0, + 0x3fc24d1575fbd080); + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + asm volatile("vfadd.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // 0.5619790110445508, 0.4607211747488638, 1.7839904365380062, + // 1.2365139812160342, 1.5611298439996912, 0.5939348571980851, + // 0.3712012282085693, 0.3690899830289787, 0.1137133048067129, + // 0.7343913161116331, 1.2672983177293973, 0.5354257314913939, + // 1.5689654398674235, 0.5779850116527863, 1.0869921725391614, + // 1.0538481379738618 + VCMP_U64(17, v1, 0x3fe1fbbb682f314e, 0x3fdd7c74aa87bfa0, 0x3ffc8b398e54eb85, + 0x3ff3c8c2e265e9fc, 0x3ff8fa63498c9cb2, 0x3fe30183ac73d8ba, + 0x3fd7c1c2cbd9037c, 0x3fd79f2b9799008c, 0x3fbd1c50ad43d140, + 0x3fe7802237a54ebe, 0x3ff446da99cec6fa, 0x3fe1223524c62842, + 0x3ff91a7b814c8eb3, 0x3fe27eda6c540f88, 0x3ff16451e78104dd, + 0x3ff0dc8fdd78c58f); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE7(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 0xb0bd, 0xb1c0, 0xb85d, 0x352a, 0x352e, 0xb9c5, 0xb828, 0xb733, + 0x344a, 0x39d7, 0x380c, 0x38aa, 0x351e, 0xb17b, 0xb925, 0x37bf); + double dscalar_16; + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VCMP_U16(18, v1, 0, 0xbc78, 0, 0xb8ec, 0, 0xbea3, 0, 0xbd8d, 0, 0xb2a8, 0, + 0xb5ae, 0, 0xbc70, 0, 0xb743); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3f5d8a7f, 0xbf0a0c89, 0xbef14c9d, 0x3f7e1eaa, 0x3ea47f0b, + 0xbef25bbc, 0xbe99bf6c, 0x3ee34c20, 0xbf39b46b, 0xbe877ff1, + 0x3f46050b, 0xbe5e78a0, 0xbe80fb14, 0xbf07ff20, 0x3f4dd62f, + 0x3f5183c2); + double dscalar_32; + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VCMP_U32(19, v1, 0, 0xbfbff9f6, 0, 0x3d037480, 0, 0xbfb78aa0, 0, 0xbf044152, + 0, 0xbf9cd3ad, 0, 0xbf96c2c5, 0, 0xbfbef341, 0, 0xbe118e80); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xbfd6543dea86cb60, 0xbfdccf40105d6e5c, 0x3febf098bf37400c, + 0x3fd4d756ceb279f4, 0x3fe4ceec35a6a266, 0xbfd448ad61fd7c88, + 0xbfe144f8f7861540, 0xbfe1564491a616b8, 0xbfe9825047ca1cd6, + 0xbfc696e097352100, 0x3fd6cfb5ac55edec, 0xbfd8074a7158dd78, + 0x3fe50f1ca5268668, 0xbfd54dffe23d0eec, 0x3fc68b25c63dcaf0, + 0x3fc24d1575fbd080); + double dscalar_64; + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VCMP_U64(20, v1, 0, 0x3fdd7c74aa87bfa0, 0, 0x3ff3c8c2e265e9fc, 0, + 0x3fe30183ac73d8ba, 0, 0x3fd79f2b9799008c, 0, 0x3fe7802237a54ebe, 0, + 0x3fe1223524c62842, 0, 0x3fe27eda6c540f88, 0, 0x3ff0dc8fdd78c58f); +}; + +// Raise exceptions only on active elements! +void TEST_CASE8(void) { + // Overflow and Inexact. Invalid operation should not be raised. + CLEAR_FFLAGS; + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, pInfh, pMaxh, pInfh, pMaxh, pInfh, pMaxh, pInfh, pMaxh, pInfh, + pMaxh, pInfh, pMaxh, pInfh, pMaxh, pInfh, pMaxh); + VLOAD_16(v3, mInfh, pMaxh, mInfh, pMaxh, mInfh, pMaxh, mInfh, pMaxh, mInfh, + pMaxh, mInfh, pMaxh, mInfh, pMaxh, mInfh, pMaxh); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vv v1, v2, v3, v0.t"); + VCMP_U16(21, v1, 0, pInfh, 0, pInfh, 0, pInfh, 0, pInfh, 0, pInfh, 0, pInfh, + 0, pInfh, 0, pInfh); + CHECK_FFLAGS(OF | NX); + + // Invalid operation. Overflow and Inexact should not be raised. + CLEAR_FFLAGS; + VSET(16, e32, m1); + CHECK_FFLAGS(0); + VLOAD_32(v2, pMaxf, pInff, pMaxf, pInff, pMaxf, pInff, pMaxf, pInff, pMaxf, + pInff, pMaxf, pInff, pMaxf, pInff, pMaxf, pInff); + VLOAD_32(v3, pMaxf, mInff, pMaxf, mInff, pMaxf, mInff, pMaxf, mInff, pMaxf, + mInff, pMaxf, mInff, pMaxf, mInff, pMaxf, mInff); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vv v1, v2, v3, v0.t"); + VCMP_U32(22, v1, 0, qNaNf, 0, qNaNf, 0, qNaNf, 0, qNaNf, 0, qNaNf, 0, qNaNf, + 0, qNaNf, 0, qNaNf); + CHECK_FFLAGS(NV); + + // No exception should be raised + CLEAR_FFLAGS; + VSET(16, e64, m1); + CHECK_FFLAGS(0); + VLOAD_64(v2, pMaxd, 0, pInfd, 0, pMaxd, 0, pMaxd, 0, pMaxd, 0, pMaxd, 0, + pMaxd, 0, pMaxd, 0); + VLOAD_64(v3, pMaxd, 0, mInfd, 0, pMaxd, 0, pMaxd, 0, pMaxd, 0, pMaxd, 0, + pMaxd, 0, pMaxd, 0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfadd.vv v1, v2, v3, v0.t"); + VCMP_U64(23, v1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + CHECK_FFLAGS(0); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfclass.c b/apps/riscv-tests/isa/rv64uv/vfclass.c new file mode 100644 index 0000000..40466bb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfclass.c @@ -0,0 +1,90 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Test all the different output possibilities +void TEST_CASE1(void) { + CLEAR_FFLAGS; + CHECK_FFLAGS(0); + + VSET(16, e16, m1); + VLOAD_16(v2, mInfh, pInfh, qNaNh, sNaNh, 0x3b27, 0xc767, pZero, mZeroh, + 0x8075, 0x00c5, mInfh, pInfh, qNaNh, sNaNh, 0x3b27, 0xb767); + asm volatile("vfclass.v v1, v2"); + VCMP_U16(1, v1, CLASS_mInf, CLASS_pInf, CLASS_qNAN, CLASS_sNAN, CLASS_pNorm, + CLASS_mNorm, CLASS_pZero, CLASS_mZero, CLASS_mSub, CLASS_pSub, + CLASS_mInf, CLASS_pInf, CLASS_qNAN, CLASS_sNAN, CLASS_pNorm, + CLASS_mNorm); + + VSET(16, e32, m1); + VLOAD_32(v2, mInff, pInff, qNaNf, sNaNf, 0x3f738772, 0xbdef32e4, pZero, + mZerof, 0x80000075, 0x000000c5, mInff, pInff, qNaNf, sNaNf, + 0x3f738772, 0xbdef32e4); + asm volatile("vfclass.v v1, v2"); + VCMP_U32(2, v1, CLASS_mInf, CLASS_pInf, CLASS_qNAN, CLASS_sNAN, CLASS_pNorm, + CLASS_mNorm, CLASS_pZero, CLASS_mZero, CLASS_mSub, CLASS_pSub, + CLASS_mInf, CLASS_pInf, CLASS_qNAN, CLASS_sNAN, CLASS_pNorm, + CLASS_mNorm); + + VSET(16, e64, m1); + VLOAD_64(v2, mInfd, pInfd, qNaNd, sNaNd, 0x3def3136584672de, + 0xbdef3136584672de, pZero, mZerod, 0x8000000000000075, + 0x0000000000000c5, mInfd, pInfd, qNaNd, sNaNd, 0x3def313584672de4, + 0xbdef313654672de4); + asm volatile("vfclass.v v1, v2"); + VCMP_U64(3, v1, CLASS_mInf, CLASS_pInf, CLASS_qNAN, CLASS_sNAN, CLASS_pNorm, + CLASS_mNorm, CLASS_pZero, CLASS_mZero, CLASS_mSub, CLASS_pSub, + CLASS_mInf, CLASS_pInf, CLASS_qNAN, CLASS_sNAN, CLASS_pNorm, + CLASS_mNorm); +}; + +// Test all the different output possibilities +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, mInfh, pInfh, qNaNh, sNaNh, 0x3b27, 0xc767, pZero, mZeroh, + 0x8075, 0x00c5, mInfh, pInfh, qNaNh, sNaNh, 0x3b27, 0xb767); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfclass.v v1, v2, v0.t"); + VCMP_U16(4, v1, 0, CLASS_pInf, 0, CLASS_sNAN, 0, CLASS_mNorm, 0, CLASS_mZero, + 0, CLASS_pSub, 0, CLASS_pInf, 0, CLASS_sNAN, 0, CLASS_mNorm); + + VSET(16, e32, m1); + VLOAD_32(v2, mInff, pInff, qNaNf, sNaNf, 0x3f738772, 0xbdef32e4, pZero, + mZerof, 0x80000075, 0x000000c5, mInff, pInff, qNaNf, sNaNf, + 0x3f738772, 0xbdef32e4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfclass.v v1, v2, v0.t"); + VCMP_U32(5, v1, 0, CLASS_pInf, 0, CLASS_sNAN, 0, CLASS_mNorm, 0, CLASS_mZero, + 0, CLASS_pSub, 0, CLASS_pInf, 0, CLASS_sNAN, 0, CLASS_mNorm); + + VSET(16, e64, m1); + VLOAD_64(v2, mInfd, pInfd, qNaNd, sNaNd, 0x3def313584672de4, + 0xbdef313658467de4, pZero, mZerod, 0x8000000000000075, + 0x0000000000000c5, mInfd, pInfd, qNaNd, sNaNd, 0x3def313658672de4, + 0xbdef313654672de4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfclass.v v1, v2, v0.t"); + VCMP_U64(6, v1, 0, CLASS_pInf, 0, CLASS_sNAN, 0, CLASS_mNorm, 0, CLASS_mZero, + 0, CLASS_pSub, 0, CLASS_pInf, 0, CLASS_sNAN, 0, CLASS_mNorm); + CHECK_FFLAGS(0); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + // No exception should be raised by vfclass.v + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfcvt.c b/apps/riscv-tests/isa/rv64uv/vfcvt.c new file mode 100644 index 0000000..26794bf --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfcvt.c @@ -0,0 +1,834 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// We assume RNE rounding when not specified by the encoding + +//////////////// +// vfcvt.xu.f // +//////////////// + +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -2372.000, 2978.000, -5132.000, -3426.000, -3878.000, + // 9680.000, 76.000, -8128.000, -2314.000, -4660.000, 8672.000, + // 8824.000, -5732.000, -1557.000, -2302.000, -407.250 + VLOAD_16(v2, 0xe8a2, 0x69d1, 0xed03, 0xeab1, 0xeb93, 0x70ba, 0x54c0, 0xeff0, + 0xe885, 0xec8d, 0x703c, 0x704f, 0xed99, 0xe615, 0xe87f, 0xde5d); + asm volatile("vfcvt.xu.f.v v3, v2"); + // 0, 2978, 0, 0, 0, + // 9680, 76, 0, 0, 0, + // 8672, 8824, 0, 0, 0, + // 0 + VCMP_U16(1, v3, 0x0000, 0x0ba2, 0x0000, 0x0000, 0x0000, 0x25d0, 0x004c, + 0x0000, 0x0000, 0x0000, 0x21e0, 0x2278, 0x0000, 0x0000, 0x0000, + 0x0000); + + VSET(16, e32, m1); + // -82436.352, -5427.481, -30119.082, 53784.066, 76500.719, + // 65152.020, -94151.375, 71894.320, -20547.545, 95485.906, + // 92834.711, -28081.711, -9716.506, 62508.508, 90410.883, + // 42708.285 + VLOAD_32(v2, 0xc7a1022d, 0xc5a99bd9, 0xc6eb4e2a, 0x47521811, 0x47956a5c, + 0x477e8005, 0xc7b7e3b0, 0x478c6b29, 0xc6a08717, 0x47ba7ef4, + 0x47b5515b, 0xc6db636c, 0xc617d206, 0x47742c82, 0x47b09571, + 0x4726d449); + asm volatile("vfcvt.xu.f.v v3, v2"); + // 0, 0, 0, 53784, 76501, + // 65152, 0, 71894, 0, 95486, + // 92835, 0, 0, 62509, + // 90411, 42708 + VCMP_U32(2, v3, 0x00000000, 0x00000000, 0x00000000, 0x0000d218, 0x00012ad5, + 0x0000fe80, 0x00000000, 0x000118d6, 0x00000000, 0x000174fe, + 0x00016aa3, 0x00000000, 0x00000000, 0x0000f42d, 0x0001612b, + 0x0000a6d4); + + VSET(16, e64, m1); + // 3554390.405, 3670449.443, 3880983.535, 3452087.537, + // -5447847.496, 498812.179, 9535291.051, 113884.868, + // 2124622.198, -2164534.614, 1377445.305, -2114478.485, + // -4704971.356, -7866057.432, 7002504.380, -2981734.692 + VLOAD_64(v2, 0x414b1e2b33d13be4, 0x414c00d8b8b34d48, 0x414d9c0bc4751d78, + 0x414a565bc4adf2d0, 0xc154c829dfc2d9f6, 0x411e71f0b7161c00, + 0x41622fe7619e55e2, 0x40fbcdcde34f1a00, 0x414035a7194d9794, + 0xc140839b4e886550, 0x413504a54df56888, 0xc14021d73e1606dc, + 0xc151f2b2d6cc57c8, 0xc15e01b25baceaba, 0x415ab6621850fa94, + 0xc146bfb358869da2); + asm volatile("vfcvt.xu.f.v v3, v2"); + // 3554390, 3670449, 3880984, + // 3452088, 0, 498812, + // 9535291, 113885, 2124622, 0, + // 1377445, 0, 0, 0, 7002504, + // 0 + VCMP_U64(3, v3, 0x0000000000363c56, 0x00000000003801b1, 0x00000000003b3818, + 0x000000000034acb8, 0x0000000000000000, 0x0000000000079c7c, + 0x0000000000917f3b, 0x000000000001bcdd, 0x0000000000206b4e, + 0x0000000000000000, 0x00000000001504a5, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x00000000006ad988, + 0x0000000000000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -2372.000, 2978.000, -5132.000, -3426.000, -3878.000, + // 9680.000, 76.000, -8128.000, -2314.000, -4660.000, 8672.000, + // 8824.000, -5732.000, -1557.000, -2302.000, -407.250 + VLOAD_16(v2, 0xe8a2, 0x69d1, 0xed03, 0xeab1, 0xeb93, 0x70ba, 0x54c0, 0xeff0, + 0xe885, 0xec8d, 0x703c, 0x704f, 0xed99, 0xe615, 0xe87f, 0xde5d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.xu.f.v v3, v2, v0.t"); + // 0, 2978, 0, 0, 0, + // 9680, 0, 0, 0, 0, + // 0, 8824, 0, 0, 0, 0 + VCMP_U16(4, v3, 0x0000, 0x0ba2, 0x0000, 0x0000, 0x0000, 0x25d0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2278, 0x0000, 0x0000, 0x0000, + 0x0000); + + VSET(16, e32, m1); + // -82436.352, -5427.481, -30119.082, 53784.066, 76500.719, + // 65152.020, -94151.375, 71894.320, -20547.545, 95485.906, + // 92834.711, -28081.711, -9716.506, 62508.508, 90410.883, + // 42708.285 + VLOAD_32(v2, 0xc7a1022d, 0xc5a99bd9, 0xc6eb4e2a, 0x47521811, 0x47956a5c, + 0x477e8005, 0xc7b7e3b0, 0x478c6b29, 0xc6a08717, 0x47ba7ef4, + 0x47b5515b, 0xc6db636c, 0xc617d206, 0x47742c82, 0x47b09571, + 0x4726d449); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.xu.f.v v3, v2, v0.t"); + // 0, 0, 0, 53784, 0, + // 65152, 0, 71894, 0, 95486, + // 0, 0, 0, 62509, 0, + // 42708 + VCMP_U32(5, v3, 0x00000000, 0x00000000, 0x00000000, 0x0000d218, 0x00000000, + 0x0000fe80, 0x00000000, 0x000118d6, 0x00000000, 0x000174fe, + 0x00000000, 0x00000000, 0x00000000, 0x0000f42d, 0x00000000, + 0x0000a6d4); + + VSET(16, e64, m1); + // 3554390.405, 3670449.443, 3880983.535, 3452087.537, + // -5447847.496, 498812.179, 9535291.051, 113884.868, + // 2124622.198, -2164534.614, 1377445.305, -2114478.485, + // -4704971.356, -7866057.432, 7002504.380, -2981734.692 + VLOAD_64(v2, 0x414b1e2b33d13be4, 0x414c00d8b8b34d48, 0x414d9c0bc4751d78, + 0x414a565bc4adf2d0, 0xc154c829dfc2d9f6, 0x411e71f0b7161c00, + 0x41622fe7619e55e2, 0x40fbcdcde34f1a00, 0x414035a7194d9794, + 0xc140839b4e886550, 0x413504a54df56888, 0xc14021d73e1606dc, + 0xc151f2b2d6cc57c8, 0xc15e01b25baceaba, 0x415ab6621850fa94, + 0xc146bfb358869da2); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.xu.f.v v3, v2, v0.t"); + // 0, 3670449, 0, 3452088, 0, + // 498812, 0, 113885, + // 0, 0, 0, 0, 0, 0, 0, + // 0 + VCMP_U64(6, v3, 0x0000000000000000, 0x00000000003801b1, 0x0000000000000000, + 0x000000000034acb8, 0x0000000000000000, 0x0000000000079c7c, + 0x0000000000000000, 0x000000000001bcdd, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000); +}; + +/////////////// +// vfcvt.x.f // +/////////////// + +// Unmasked vfcvt.x.f.c +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 4144.000, -861.500, -8680.000, 3792.000, 8800.000, + // -2330.000, -3066.000, -6148.000, 4776.000, 7360.000, + // -7880.000, -1843.000, -7896.000, -6520.000, -7092.000, + // -8344.000 + VLOAD_16(v2, 0x6c0c, 0xe2bb, 0xf03d, 0x6b68, 0x704c, 0xe88d, 0xe9fd, 0xee01, + 0x6caa, 0x6f30, 0xefb2, 0xe733, 0xefb6, 0xee5e, 0xeeed, 0xf013); + asm volatile("vfcvt.x.f.v v3, v2"); + // 4144, -862, -8680, 3792, 8800, + // -2330, -3066, -6148, 4776, 7360, + // -7880, -1843, -7896, -6520, -7092, + // -8344 + VCMP_U16(7, v3, 0x1030, 0xfca2, 0xde18, 0x0ed0, 0x2260, 0xf6e6, 0xf406, + 0xe7fc, 0x12a8, 0x1cc0, 0xe138, 0xf8cd, 0xe128, 0xe688, 0xe44c, + 0xdf68); + + VSET(16, e32, m1); + // -28075.818, -5455.616, 6106.086, -11952.592, -50887.914, + // -23028.832, -9221.246, -71657.047, -6655.005, -21208.561, + // -30018.096, -19766.838, 48541.953, -62313.625, 13515.192, + // -83224.820 + VLOAD_32(v2, 0xc6db57a3, 0xc5aa7ced, 0x45bed0b1, 0xc63ac25e, 0xc746c7ea, + 0xc6b3e9aa, 0xc61014fc, 0xc78bf486, 0xc5cff80a, 0xc6a5b11f, + 0xc6ea8431, 0xc69a6dad, 0x473d9df4, 0xc77369a0, 0x46532cc5, + 0xc7a28c69); + asm volatile("vfcvt.x.f.v v3, v2"); + // -28076, -5456, 6106, -11953, + // -50888, -23029, -9221, -71657, -6655, + // -21209, -30018, -19767, 48542, -62314, + // 13515, -83225 + VCMP_U32(8, v3, 0xffff9254, 0xffffeab0, 0x000017da, 0xffffd14f, 0xffff3938, + 0xffffa60b, 0xffffdbfb, 0xfffee817, 0xffffe601, 0xffffad27, + 0xffff8abe, 0xffffb2c9, 0x0000bd9e, 0xffff0c96, 0x000034cb, + 0xfffebae7); + + VSET(16, e64, m1); + // 3087905.033, -2534011.630, 7824302.813, + // -9294206.521, 6436555.847, 6645117.193, + // 1358075.867, 5694551.012, -9840938.636, + // 4621816.383, 2584370.751, 5569558.860, + // 495487.041, 4759865.418, -6831172.669, + // 8371055.296 + VLOAD_64(v2, 0x41478f10842c8b9c, 0xc143553dd0971c82, 0x415dd8ebb40e1fe0, + 0xc161ba2fd0a8a593, 0x41588db2f632700c, 0x4159595f4c588b60, + 0x4134b8fbde131210, 0x4155b915c0cb4294, 0xc162c52554566300, + 0x4151a17e187d1aa8, 0x4143b7996029dc68, 0x41553f05b70b6824, + 0x411e3dfc2a598ba0, 0x4152284e5ac4da5a, 0xc15a0f112acbf258, + 0x415feedbd2ed6038); + asm volatile("vfcvt.x.f.v v3, v2"); + // 3087905, -2534012, 7824303, + // -9294207, 6436556, 6645117, + // 1358076, 5694551, -9840939, + // 4621816, 2584371, 5569559, + // 495487, 4759865, -6831173, + // 8371055 + VCMP_U64(9, v3, 0x00000000002f1e21, 0xffffffffffd95584, 0x00000000007763af, + 0xffffffffff722e81, 0x00000000006236cc, 0x000000000065657d, + 0x000000000014b8fc, 0x000000000056e457, 0xffffffffff69d6d5, + 0x00000000004685f8, 0x0000000000276f33, 0x000000000054fc17, + 0x0000000000078f7f, 0x000000000048a139, 0xffffffffff97c3bb, + 0x00000000007fbb6f); +}; + +// Masked vfcvt.x.f.c +void TEST_CASE4(void) { + VSET(16, e16, m1); + // 4144.000, -861.500, -8680.000, 3792.000, 8800.000, + // -2330.000, -3066.000, -6148.000, 4776.000, 7360.000, + // -7880.000, -1843.000, -7896.000, -6520.000, -7092.000, + // -8344.000 + VLOAD_16(v2, 0x6c0c, 0xe2bb, 0xf03d, 0x6b68, 0x704c, 0xe88d, 0xe9fd, 0xee01, + 0x6caa, 0x6f30, 0xefb2, 0xe733, 0xefb6, 0xee5e, 0xeeed, 0xf013); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.x.f.v v3, v2, v0.t"); + // 0, -862, 0, 3792, 0, + // -2330, 0, -6148, 0, 7360, 0, + // -1843, 0, -6520, 0, -8344 + VCMP_U16(10, v3, 0x0000, 0xfca2, 0x0000, 0x0ed0, 0x0000, 0xf6e6, 0x0000, + 0xe7fc, 0x0000, 0x1cc0, 0x0000, 0xf8cd, 0x0000, 0xe688, 0x0000, + 0xdf68); + + VSET(16, e32, m1); + // -28075.818, -5455.616, 6106.086, -11952.592, + // -50887.914, -23028.832, -9221.246, -71657.047, + // -6655.005, -21208.561, -30018.096, -19766.838, 48541.953, + // -62313.625, 13515.192, -83224.820 + VLOAD_32(v2, 0xc6db57a3, 0xc5aa7ced, 0x45bed0b1, 0xc63ac25e, 0xc746c7ea, + 0xc6b3e9aa, 0xc61014fc, 0xc78bf486, 0xc5cff80a, 0xc6a5b11f, + 0xc6ea8431, 0xc69a6dad, 0x473d9df4, 0xc77369a0, 0x46532cc5, + 0xc7a28c69); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.x.f.v v3, v2, v0.t"); + // 0, -5456, 0, -11953, 0, + // -23029, 0, -71657, 0, + // -21209, 0, -19767, 0, + // -62314, 0, -83225 + VCMP_U32(11, v3, 0x00000000, 0xffffeab0, 0x00000000, 0xffffd14f, 0x00000000, + 0xffffa60b, 0x00000000, 0xfffee817, 0x00000000, 0xffffad27, + 0x00000000, 0xffffb2c9, 0x00000000, 0xffff0c96, 0x00000000, + 0xfffebae7); + + VSET(16, e64, m1); + // 3087905.033, -2534011.630, 7824302.813, -9294206.521, + // 6436555.847, 6645117.193, 1358075.867, 5694551.012, + // -9840938.636, 4621816.383, 2584370.751, 5569558.860, + // 495487.041, 4759865.418, -6831172.669, 8371055.296 + VLOAD_64(v2, 0x41478f10842c8b9c, 0xc143553dd0971c82, 0x415dd8ebb40e1fe0, + 0xc161ba2fd0a8a593, 0x41588db2f632700c, 0x4159595f4c588b60, + 0x4134b8fbde131210, 0x4155b915c0cb4294, 0xc162c52554566300, + 0x4151a17e187d1aa8, 0x4143b7996029dc68, 0x41553f05b70b6824, + 0x411e3dfc2a598ba0, 0x4152284e5ac4da5a, 0xc15a0f112acbf258, + 0x415feedbd2ed6038); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.x.f.v v3, v2, v0.t"); + // 0, -2534012, 0, -9294207, + // 0, 6645117, 0, 5694551, 0, + // 4621816, 0, 5569559, + // 0, 4759865, 0, 8371055 + VCMP_U64(12, v3, 0x0000000000000000, 0xffffffffffd95584, 0x0000000000000000, + 0xffffffffff722e81, 0x0000000000000000, 0x000000000065657d, + 0x0000000000000000, 0x000000000056e457, 0x0000000000000000, + 0x00000000004685f8, 0x0000000000000000, 0x000000000054fc17, + 0x0000000000000000, 0x000000000048a139, 0x0000000000000000, + 0x00000000007fbb6f); +}; + +//////////////////// +// vfcvt.rtz.xu.f // +//////////////////// + +// Simple random test with similar values +void TEST_CASE5(void) { + VSET(16, e16, m1); + // 6996.000, -7512.000, -4792.000, 7240.000, 8336.000, + // 6332.000, -277.750, -4074.000, 9352.000, 8832.000, + // -65.000, 5860.000, 6892.000, 2944.000, 9608.000, + // 4608.000 + VLOAD_16(v2, 0x6ed5, 0xef56, 0xecae, 0x6f12, 0x7012, 0x6e2f, 0xdc57, 0xebf5, + 0x7091, 0x7050, 0xd410, 0x6db9, 0x6ebb, 0x69c0, 0x70b1, 0x6c80); + asm volatile("vfcvt.rtz.xu.f.v v3, v2"); + // 6996, 0, 0, 7240, 8336, + // 6332, 0, 0, 9352, 8832, 0, + // 5860, 6892, 2944, 9608, 4608 + VCMP_U16(13, v3, 0x1b54, 0x0000, 0x0000, 0x1c48, 0x2090, 0x18bc, 0x0000, + 0x0000, 0x2488, 0x2280, 0x0000, 0x16e4, 0x1aec, 0x0b80, 0x2588, + 0x1200); + + VSET(16, e32, m1); + // 85074.883, -2035.769, 67397.633, -57745.480, 82113.172, + // 18415.770, 57859.465, 83291.773, -83693.375, 43321.199, + // 94626.156, -53520.090, 9604.658, -5764.834, 94299.633, + // 57572.980 + VLOAD_32(v2, 0x47a62971, 0xc4fe789f, 0x4783a2d1, 0xc761917b, 0x47a06096, + 0x468fdf8a, 0x47620377, 0x47a2ade3, 0xc7a376b0, 0x47293933, + 0x47b8d114, 0xc7511017, 0x461612a2, 0xc5b426ac, 0x47b82dd1, + 0x4760e4fb); + asm volatile("vfcvt.rtz.xu.f.v v3, v2"); + // 85074, 0, 67397, 0, 82113, + // 18415, 57859, 83291, 0, 43321, + // 94626, 0, 9604, 0, 94299, + // 57572 + VCMP_U32(14, v3, 0x00014c52, 0x00000000, 0x00010745, 0x00000000, 0x000140c1, + 0x000047ef, 0x0000e203, 0x0001455b, 0x00000000, 0x0000a939, + 0x000171a2, 0x00000000, 0x00002584, 0x00000000, 0x0001705b, + 0x0000e0e4); + + VSET(16, e64, m1); + // -5386285.220, -9081004.335, -9603879.062, -4621060.923, + // 2017661.058, 1106405.978, -2095853.299, 1911589.313, + // 4833261.528, 1291127.404, -9941577.120, 9259799.184, + // -8569693.727, 4926687.920, -7537625.130, -6328586.289 + VLOAD_64(v2, 0xc1548c0b4e12be63, 0xc16152158ab92a41, 0xc1625164e1fd6af4, + 0xc151a0c13b0c041c, 0x413ec97d0edd7a68, 0x4130e1e5fa5c8120, + 0xc13ffaed4c78fc7c, 0x413d2b2550357b50, 0x41526ffb61d23f42, + 0x4133b377675b6328, 0xc162f64923d5cce3, 0x4161a962e5e3a1e8, + 0xc160586bb74734b0, 0x4152cb37fae70f80, 0xc15cc0f6484f174c, + 0xc1582442928257b8); + asm volatile("vfcvt.rtz.xu.f.v v3, v2"); + // 0, 0, 0, 0, 2017661, + // 1106405, 0, 1911589, + // 4833261, 1291127, 0, + // 9259799, 0, 4926687, + // 0, 0 + VCMP_U64(15, v3, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x00000000001ec97d, 0x000000000010e1e5, + 0x0000000000000000, 0x00000000001d2b25, 0x000000000049bfed, + 0x000000000013b377, 0x0000000000000000, 0x00000000008d4b17, + 0x0000000000000000, 0x00000000004b2cdf, 0x0000000000000000, + 0x0000000000000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE6(void) { + VSET(16, e16, m1); + // 6996.000, -7512.000, -4792.000, 7240.000, 8336.000, + // 6332.000, -277.750, -4074.000, 9352.000, 8832.000, + // -65.000, 5860.000, 6892.000, 2944.000, 9608.000, + // 4608.000 + VLOAD_16(v2, 0x6ed5, 0xef56, 0xecae, 0x6f12, 0x7012, 0x6e2f, 0xdc57, 0xebf5, + 0x7091, 0x7050, 0xd410, 0x6db9, 0x6ebb, 0x69c0, 0x70b1, 0x6c80); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.rtz.xu.f.v v3, v2, v0.t"); + // 0, 0, 0, 7240, 0, + // 6332, 0, 0, 0, 8832, + // 0, 5860, 0, 2944, 0, + // 4608 + VCMP_U16(16, v3, 0x0000, 0x0000, 0x0000, 0x1c48, 0x0000, 0x18bc, 0x0000, + 0x0000, 0x0000, 0x2280, 0x0000, 0x16e4, 0x0000, 0x0b80, 0x0000, + 0x1200); + + VSET(16, e32, m1); + // 85074.883, -2035.769, 67397.633, -57745.480, 82113.172, + // 18415.770, 57859.465, 83291.773, -83693.375, 43321.199, + // 94626.156, -53520.090, 9604.658, -5764.834, 94299.633, + // 57572.980 + VLOAD_32(v2, 0x47a62971, 0xc4fe789f, 0x4783a2d1, 0xc761917b, 0x47a06096, + 0x468fdf8a, 0x47620377, 0x47a2ade3, 0xc7a376b0, 0x47293933, + 0x47b8d114, 0xc7511017, 0x461612a2, 0xc5b426ac, 0x47b82dd1, + 0x4760e4fb); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.rtz.xu.f.v v3, v2, v0.t"); + // 0, 0, 0, 0, 0, 18415, + // 0, 83291, 0, 43321, 0, 0, + // 0, 0, 0, 57572 + VCMP_U32(17, v3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x000047ef, 0x00000000, 0x0001455b, 0x00000000, 0x0000a939, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0000e0e4); + + VSET(16, e64, m1); + // -5386285.220, -9081004.335, -9603879.062, -4621060.923, + // 2017661.058, 1106405.978, -2095853.299, 1911589.313, + // 4833261.528, 1291127.404, -9941577.120, 9259799.184, + // -8569693.727, 4926687.920, -7537625.130, -6328586.289 + VLOAD_64(v2, 0xc1548c0b4e12be63, 0xc16152158ab92a41, 0xc1625164e1fd6af4, + 0xc151a0c13b0c041c, 0x413ec97d0edd7a68, 0x4130e1e5fa5c8120, + 0xc13ffaed4c78fc7c, 0x413d2b2550357b50, 0x41526ffb61d23f42, + 0x4133b377675b6328, 0xc162f64923d5cce3, 0x4161a962e5e3a1e8, + 0xc160586bb74734b0, 0x4152cb37fae70f80, 0xc15cc0f6484f174c, + 0xc1582442928257b8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.rtz.xu.f.v v3, v2, v0.t"); + // 0, 0, 0, 0, 0, + // 1106405, 0, 1911589, + // 0, 1291127, 0, 9259799, 0, + // 4926687, 0, 0 + VCMP_U64(18, v3, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x000000000010e1e5, + 0x0000000000000000, 0x00000000001d2b25, 0x0000000000000000, + 0x000000000013b377, 0x0000000000000000, 0x00000000008d4b17, + 0x0000000000000000, 0x00000000004b2cdf, 0x0000000000000000, + 0x0000000000000000); +}; + +/////////////////// +// vfcvt.rtz.x.f // +/////////////////// + +// Simple random test with similar values +void TEST_CASE7(void) { + VSET(16, e16, m1); + // 5116.000, 4640.000, 5720.000, 1316.000, 8104.000, + // 9952.000, 9400.000, -4120.000, -9368.000, 6076.000, + // 1782.000, -5332.000, -4284.000, -2878.000, -2752.000, + // 3714.000 + VLOAD_16(v2, 0x6cff, 0x6c88, 0x6d96, 0x6524, 0x6fea, 0x70dc, 0x7097, 0xec06, + 0xf093, 0x6def, 0x66f6, 0xed35, 0xec2f, 0xe99f, 0xe960, 0x6b41); + asm volatile("vfcvt.rtz.x.f.v v3, v2"); + // 5116, 4640, 5720, 1316, 8104, + // 9952, 9400, -4120, -9368, 6076, + // 1782, -5332, -4284, -2878, -2752, + // 3714 + VCMP_U16(19, v3, 0x13fc, 0x1220, 0x1658, 0x0524, 0x1fa8, 0x26e0, 0x24b8, + 0xefe8, 0xdb68, 0x17bc, 0x06f6, 0xeb2c, 0xef44, 0xf4c2, 0xf540, + 0x0e82); + + VSET(16, e32, m1); + // -31395.312, 38407.539, 39625.664, -19419.770, -77414.898, + // -96104.727, -8227.330, -45789.250, -74805.781, 78266.945, + // 1635.832, -33150.762, 17428.920, -93694.898, 93592.562, + // -83328.680 + VLOAD_32(v2, 0xc6f546a0, 0x4716078a, 0x471ac9aa, 0xc697b78a, 0xc7973373, + 0xc7bbb45d, 0xc6008d52, 0xc732dd40, 0xc7921ae4, 0x4798dd79, + 0x44cc7aa0, 0xc7017ec3, 0x468829d7, 0xc7b6ff73, 0x47b6cc48, + 0xc7a2c057); + asm volatile("vfcvt.rtz.x.f.v v3, v2"); + // -31395, 38407, 39625, -19419, + // -77414, -96104, -8227, -45789, + // -74805, 78266, 1635, -33150, 17428, + // -93694, 93592, -83328 + VCMP_U32(20, v3, 0xffff855d, 0x00009607, 0x00009ac9, 0xffffb425, 0xfffed19a, + 0xfffe8898, 0xffffdfdd, 0xffff4d23, 0xfffedbcb, 0x000131ba, + 0x00000663, 0xffff7e82, 0x00004414, 0xfffe9202, 0x00016d98, + 0xfffeba80); + + VSET(16, e64, m1); + // 1347922.217, 7326256.926, 2532328.150, -4365139.352, + // -3892733.643, -3401324.772, -2109243.969, 61221.157, + // -307581.498, -6001564.901, -1299579.664, -2048360.900, + // 3486773.936, -5491246.977, -2222467.648, 1432204.815 + VLOAD_64(v2, 0x413491523797bd28, 0x415bf28c3b410560, 0x414351f41339c8f8, + 0xc150a6d4d6864763, 0xc14db2fed245a01c, 0xc149f33662d1f60e, + 0xc140179dfc15a4ac, 0x40ede4a503831a00, 0xc112c5f5fdac3c80, + 0xc156e4e739a40168, 0xc133d47ba9e7da00, 0xc13f4168e650cc0c, + 0x414a9a1af7c5dda0, 0xc154f28bbe844db6, 0xc140f4c1d2e7a21a, + 0x4135da8cd09570f8); + asm volatile("vfcvt.rtz.x.f.v v3, v2"); + // 1347922, 7326256, 2532328, + // -4365139, -3892733, -3401324, + // -2109243, 61221, -307581, + // -6001564, -1299579, -2048360, + // 3486773, -5491246, -2222467, + // 1432204 + VCMP_U64(21, v3, 0x0000000000149152, 0x00000000006fca30, 0x000000000026a3e8, + 0xffffffffffbd64ad, 0xffffffffffc49a03, 0xffffffffffcc1994, + 0xffffffffffdfd0c5, 0x000000000000ef25, 0xfffffffffffb4e83, + 0xffffffffffa46c64, 0xffffffffffec2b85, 0xffffffffffe0be98, + 0x0000000000353435, 0xffffffffffac35d2, 0xffffffffffde167d, + 0x000000000015da8c); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE8(void) { + VSET(16, e16, m1); + // 5116.000, 4640.000, 5720.000, 1316.000, 8104.000, + // 9952.000, 9400.000, -4120.000, -9368.000, 6076.000, + // 1782.000, -5332.000, -4284.000, -2878.000, -2752.000, + // 3714.000 + VLOAD_16(v2, 0x6cff, 0x6c88, 0x6d96, 0x6524, 0x6fea, 0x70dc, 0x7097, 0xec06, + 0xf093, 0x6def, 0x66f6, 0xed35, 0xec2f, 0xe99f, 0xe960, 0x6b41); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.rtz.x.f.v v3, v2, v0.t"); + // 0, 4640, 0, 1316, 0, + // 9952, 0, -4120, 0, 6076, + // 0, -5332, 0, -2878, 0, + // 3714 + VCMP_U16(22, v3, 0x0000, 0x1220, 0x0000, 0x0524, 0x0000, 0x26e0, 0x0000, + 0xefe8, 0x0000, 0x17bc, 0x0000, 0xeb2c, 0x0000, 0xf4c2, 0x0000, + 0x0e82); + + VSET(16, e32, m1); + // -31395.312, 38407.539, 39625.664, -19419.770, -77414.898, + // -96104.727, -8227.330, -45789.250, -74805.781, 78266.945, + // 1635.832, -33150.762, 17428.920, -93694.898, 93592.562, + // -83328.680 + VLOAD_32(v2, 0xc6f546a0, 0x4716078a, 0x471ac9aa, 0xc697b78a, 0xc7973373, + 0xc7bbb45d, 0xc6008d52, 0xc732dd40, 0xc7921ae4, 0x4798dd79, + 0x44cc7aa0, 0xc7017ec3, 0x468829d7, 0xc7b6ff73, 0x47b6cc48, + 0xc7a2c057); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.rtz.x.f.v v3, v2, v0.t"); + // 0, 38407, 0, -19419, 0, + // -96104, 0, -45789, 0, 78266, + // 0, -33150, 0, -93694, 0, + // -83328 + VCMP_U32(23, v3, 0x00000000, 0x00009607, 0x00000000, 0xffffb425, 0x00000000, + 0xfffe8898, 0x00000000, 0xffff4d23, 0x00000000, 0x000131ba, + 0x00000000, 0xffff7e82, 0x00000000, 0xfffe9202, 0x00000000, + 0xfffeba80); + + VSET(16, e64, m1); + // 1347922.217, 7326256.926, 2532328.150, -4365139.352, + // -3892733.643, -3401324.772, -2109243.969, 61221.157, + // -307581.498, -6001564.901, -1299579.664, -2048360.900, + // 3486773.936, -5491246.977, -2222467.648, 1432204.815 + VLOAD_64(v2, 0x413491523797bd28, 0x415bf28c3b410560, 0x414351f41339c8f8, + 0xc150a6d4d6864763, 0xc14db2fed245a01c, 0xc149f33662d1f60e, + 0xc140179dfc15a4ac, 0x40ede4a503831a00, 0xc112c5f5fdac3c80, + 0xc156e4e739a40168, 0xc133d47ba9e7da00, 0xc13f4168e650cc0c, + 0x414a9a1af7c5dda0, 0xc154f28bbe844db6, 0xc140f4c1d2e7a21a, + 0x4135da8cd09570f8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.rtz.x.f.v v3, v2, v0.t"); + // 0, 7326256, 0, -4365139, + // 0, -3401324, 0, 61221, 0, + // -6001564, 0, + // -2048360, 0, + // -5491246, 0, 1432204 + VCMP_U64(24, v3, 0x0000000000000000, 0x00000000006fca30, 0x0000000000000000, + 0xffffffffffbd64ad, 0x0000000000000000, 0xffffffffffcc1994, + 0x0000000000000000, 0x000000000000ef25, 0x0000000000000000, + 0xffffffffffa46c64, 0x0000000000000000, 0xffffffffffe0be98, + 0x0000000000000000, 0xffffffffffac35d2, 0x0000000000000000, + 0x000000000015da8c); +}; + +//////////////// +// vfcvt.f.xu // +//////////////// + +void TEST_CASE9(void) { + VSET(16, e16, m1); + // 55973, 61786, 64322, 55940, 55857, + // 3425, 1068, 4246, 57901, 7342, + // 8693, 60988, 9047, 63358, 58389, + // 8076 + VLOAD_16(v2, 0xdaa5, 0xf15a, 0xfb42, 0xda84, 0xda31, 0x0d61, 0x042c, 0x1096, + 0xe22d, 0x1cae, 0x21f5, 0xee3c, 0x2357, 0xf77e, 0xe415, 0x1f8c); + asm volatile("vfcvt.f.xu.v v3, v2"); + // 55968.000, 61792.000, 64320.000, 55936.000, 55872.000, + // 3424.000, 1068.000, 4248.000, 57888.000, 7344.000, + // 8696.000, 60992.000, 9048.000, 63360.000, 58400.000, + // 8076.000 + VCMP_U16(25, v3, 0x7ad5, 0x7b8b, 0x7bda, 0x7ad4, 0x7ad2, 0x6ab0, 0x642c, + 0x6c26, 0x7b11, 0x6f2c, 0x703f, 0x7b72, 0x706b, 0x7bbc, 0x7b21, + 0x6fe3); + + VSET(16, e32, m1); + // 72473, 4294949057, 50975, 4294915723, + // 4294876584, 4294895088, 24967, 34761, + // 83805, 68361, 49397, 51562, 24877, + // 4294942241, 4294909502, 42562 + VLOAD_32(v2, 0x00011b19, 0xffffb8c1, 0x0000c71f, 0xffff368b, 0xfffe9da8, + 0xfffee5f0, 0x00006187, 0x000087c9, 0x0001475d, 0x00010b09, + 0x0000c0f5, 0x0000c96a, 0x0000612d, 0xffff9e21, 0xffff1e3e, + 0x0000a642); + asm volatile("vfcvt.f.xu.v v3, v2"); + // 72473.000, 4294949120.000, 50975.000, 4294915840.000, + // 4294876672.000, 4294895104.000, 24967.000, 34761.000, + // 83805.000, 68361.000, 49397.000, 51562.000, 24877.000, + // 4294942208.000, 4294909440.000, 42562.000 + VCMP_U32(26, v3, 0x478d8c80, 0x4f7fffb9, 0x47471f00, 0x4f7fff37, 0x4f7ffe9e, + 0x4f7ffee6, 0x46c30e00, 0x4707c900, 0x47a3ae80, 0x47858480, + 0x4740f500, 0x47496a00, 0x46c25a00, 0x4f7fff9e, 0x4f7fff1e, + 0x47264200); + + VSET(16, e64, m1); + // 18446744073707704187, 18446744073702261660, 4325496, + // 3834488, 18446744073707063867, 18446744073706356425, + // 5215660, 18446744073707545423, 69532, + // 18446744073707444829, 4236283, 3402850, + // 18446744073708706866, 275183, 4230347, + // 18446744073704794800 + VLOAD_64(v2, 0xffffffffffe3cf7b, 0xffffffffff90c39c, 0x0000000000420078, + 0x00000000003a8278, 0xffffffffffda0a3b, 0xffffffffffcf3ec9, + 0x00000000004f95ac, 0xffffffffffe1634f, 0x0000000000010f9c, + 0xffffffffffdfda5d, 0x000000000040a3fb, 0x000000000033ec62, + 0xfffffffffff31c32, 0x00000000000432ef, 0x0000000000408ccb, + 0xffffffffffb76ab0); + asm volatile("vfcvt.f.xu.v v3, v2"); + // 18446744073707704320.000, 18446744073702260736.000, + // 4325496.000, 3834488.000, 18446744073707063296.000, + // 18446744073706356736.000, 5215660.000, + // 18446744073707544576.000, 69532.000, + // 18446744073707444224.000, 4236283.000, 3402850.000, + // 18446744073708707840.000, 275183.000, 4230347.000, + // 18446744073704794112.000 + VCMP_U64(27, v3, 0x43effffffffffc7a, 0x43effffffffff218, 0x4150801e00000000, + 0x414d413c00000000, 0x43effffffffffb41, 0x43effffffffff9e8, + 0x4153e56b00000000, 0x43effffffffffc2c, 0x40f0f9c000000000, + 0x43effffffffffbfb, 0x415028fec0000000, 0x4149f63100000000, + 0x43effffffffffe64, 0x4110cbbc00000000, 0x41502332c0000000, + 0x43effffffffff6ed); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE10(void) { + VSET(16, e16, m1); + // 55973, 61786, 64322, 55940, 55857, + // 3425, 1068, 4246, 57901, 7342, + // 8693, 60988, 9047, 63358, 58389, + // 8076 + VLOAD_16(v2, 0xdaa5, 0xf15a, 0xfb42, 0xda84, 0xda31, 0x0d61, 0x042c, 0x1096, + 0xe22d, 0x1cae, 0x21f5, 0xee3c, 0x2357, 0xf77e, 0xe415, 0x1f8c); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.f.xu.v v3, v2, v0.t"); + // 0.000, 61792.000, 0.000, 55936.000, 0.000, 3424.000, + // 0.000, 4248.000, 0.000, 7344.000, 0.000, 60992.000, + // 0.000, 63360.000, 0.000, 8076.000 + VCMP_U16(28, v3, 0x0, 0x7b8b, 0x0, 0x7ad4, 0x0, 0x6ab0, 0x0, 0x6c26, 0x0, + 0x6f2c, 0x0, 0x7b72, 0x0, 0x7bbc, 0x0, 0x6fe3); + + VSET(16, e32, m1); + // 72473, 4294949057, 50975, 4294915723, + // 4294876584, 4294895088, 24967, 34761, + // 83805, 68361, 49397, 51562, 24877, + // 4294942241, 4294909502, 42562 + VLOAD_32(v2, 0x00011b19, 0xffffb8c1, 0x0000c71f, 0xffff368b, 0xfffe9da8, + 0xfffee5f0, 0x00006187, 0x000087c9, 0x0001475d, 0x00010b09, + 0x0000c0f5, 0x0000c96a, 0x0000612d, 0xffff9e21, 0xffff1e3e, + 0x0000a642); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.f.xu.v v3, v2, v0.t"); + // 0.000, 4294949120.000, 0.000, 4294915840.000, 0.000, + // 4294895104.000, 0.000, 34761.000, 0.000, 68361.000, + // 0.000, 51562.000, 0.000, 4294942208.000, 0.000, + // 42562.000 + VCMP_U32(29, v3, 0x0, 0x4f7fffb9, 0x0, 0x4f7fff37, 0x0, 0x4f7ffee6, 0x0, + 0x4707c900, 0x0, 0x47858480, 0x0, 0x47496a00, 0x0, 0x4f7fff9e, 0x0, + 0x47264200); + + VSET(16, e64, m1); + // 18446744073707704187, 18446744073702261660, 4325496, + // 3834488, 18446744073707063867, 18446744073706356425, + // 5215660, 18446744073707545423, 69532, + // 18446744073707444829, 4236283, 3402850, + // 18446744073708706866, 275183, 4230347, + // 18446744073704794800 + VLOAD_64(v2, 0xffffffffffe3cf7b, 0xffffffffff90c39c, 0x0000000000420078, + 0x00000000003a8278, 0xffffffffffda0a3b, 0xffffffffffcf3ec9, + 0x00000000004f95ac, 0xffffffffffe1634f, 0x0000000000010f9c, + 0xffffffffffdfda5d, 0x000000000040a3fb, 0x000000000033ec62, + 0xfffffffffff31c32, 0x00000000000432ef, 0x0000000000408ccb, + 0xffffffffffb76ab0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.f.xu.v v3, v2, v0.t"); + // 0.000, 18446744073702260736.000, 0.000, 3834488.000, + // 0.000, 18446744073706356736.000, 0.000, + // 18446744073707544576.000, 0.000, 18446744073707444224.000, + // 0.000, 3402850.000, 0.000, 275183.000, 0.000, + // 18446744073704794112.000 + VCMP_U64(30, v3, 0x0, 0x43effffffffff218, 0x0, 0x414d413c00000000, 0x0, + 0x43effffffffff9e8, 0x0, 0x43effffffffffc2c, 0x0, 0x43effffffffffbfb, + 0x0, 0x4149f63100000000, 0x0, 0x4110cbbc00000000, 0x0, + 0x43effffffffff6ed); +}; + +/////////////// +// vfcvt.f.x // +/////////////// + +void TEST_CASE11(void) { + VSET(16, e16, m1); + // -4779, 465, 9893, -6763, -4072, + // 1612, -9552, 2426, 325, 7561, + // -8581, -1741, -8518, -4699, 3653, + // 9937 + VLOAD_16(v2, 0xed55, 0x01d1, 0x26a5, 0xe595, 0xf018, 0x064c, 0xdab0, 0x097a, + 0x0145, 0x1d89, 0xde7b, 0xf933, 0xdeba, 0xeda5, 0x0e45, 0x26d1); + asm volatile("vfcvt.f.x.v v3, v2"); + // -4780.000, 465.000, 9896.000, -6764.000, -4072.000, + // 1612.000, -9552.000, 2426.000, 325.000, 7560.000, + // -8584.000, -1741.000, -8520.000, -4700.000, 3652.000, + // 9936.000 + VCMP_U16(31, v3, 0xecab, 0x5f44, 0x70d5, 0xee9b, 0xebf4, 0x664c, 0xf0aa, + 0x68bd, 0x5d14, 0x6f62, 0xf031, 0xe6cd, 0xf029, 0xec97, 0x6b22, + 0x70da); + + VSET(16, e32, m1); + // -39422, 54262, 12833, -40266, + // -64918, 28317, 89178, 54320, -99922, + // -73005, 95070, -24716, 60663, 59516, + // 14865, 26328 + VLOAD_32(v2, 0xffff6602, 0x0000d3f6, 0x00003221, 0xffff62b6, 0xffff026a, + 0x00006e9d, 0x00015c5a, 0x0000d430, 0xfffe79ae, 0xfffee2d3, + 0x0001735e, 0xffff9f74, 0x0000ecf7, 0x0000e87c, 0x00003a11, + 0x000066d8); + asm volatile("vfcvt.f.x.v v3, v2"); + // -39422.000, 54262.000, 12833.000, -40266.000, -64918.000, + // 28317.000, 89178.000, 54320.000, -99922.000, -73005.000, + // 95070.000, -24716.000, 60663.000, 59516.000, 14865.000, + // 26328.000 + VCMP_U32(32, v3, 0xc719fe00, 0x4753f600, 0x46488400, 0xc71d4a00, 0xc77d9600, + 0x46dd3a00, 0x47ae2d00, 0x47543000, 0xc7c32900, 0xc78e9680, + 0x47b9af00, 0xc6c11800, 0x476cf700, 0x47687c00, 0x46684400, + 0x46cdb000); + + VSET(16, e64, m1); + // -8860682, 8064547, -5636078, + // -3712253, 8492493, 9839246, + // -8271278, -6234598, -4538479, + // 8807688, 5640899, 3839761, + // -1394518, -6118355, 1783927, + // 5819812 + VLOAD_64(v2, 0xffffffffff78cbf6, 0x00000000007b0e23, 0xffffffffffaa0012, + 0xffffffffffc75b03, 0x00000000008195cd, 0x000000000096228e, + 0xffffffffff81ca52, 0xffffffffffa0de1a, 0xffffffffffbabf91, + 0x0000000000866508, 0x00000000005612c3, 0x00000000003a9711, + 0xffffffffffeab8aa, 0xffffffffffa2a42d, 0x00000000001b3877, + 0x000000000058cda4); + asm volatile("vfcvt.f.x.v v3, v2"); + // -8860682.000, 8064547.000, -5636078.000, -3712253.000, + // 8492493.000, 9839246.000, -8271278.000, -6234598.000, + // -4538479.000, 8807688.000, 5640899.000, 3839761.000, + // -1394518.000, -6118355.000, 1783927.000, 5819812.000 + VCMP_U64(33, v3, 0xc160e68140000000, 0x415ec388c0000000, 0xc1557ffb80000000, + 0xc14c527e80000000, 0x416032b9a0000000, 0x4162c451c0000000, + 0xc15f8d6b80000000, 0xc157c87980000000, 0xc151501bc0000000, + 0x4160cca100000000, 0x415584b0c0000000, 0x414d4b8880000000, + 0xc135475600000000, 0xc15756f4c0000000, 0x413b387700000000, + 0x4156336900000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE12(void) { + VSET(16, e16, m1); + // -4779, 465, 9893, -6763, -4072, + // 1612, -9552, 2426, 325, 7561, + // -8581, -1741, -8518, -4699, 3653, + // 9937 + VLOAD_16(v2, 0xed55, 0x01d1, 0x26a5, 0xe595, 0xf018, 0x064c, 0xdab0, 0x097a, + 0x0145, 0x1d89, 0xde7b, 0xf933, 0xdeba, 0xeda5, 0x0e45, 0x26d1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.f.x.v v3, v2, v0.t"); + // 0.000, 465.000, 0.000, -6764.000, 0.000, 1612.000, + // 0.000, 2426.000, 0.000, 7560.000, 0.000, -1741.000, + // 0.000, -4700.000, 0.000, 9936.000 + VCMP_U16(34, v3, 0x0, 0x5f44, 0x0, 0xee9b, 0x0, 0x664c, 0x0, 0x68bd, 0x0, + 0x6f62, 0x0, 0xe6cd, 0x0, 0xec97, 0x0, 0x70da); + + VSET(16, e32, m1); + // -39422, 54262, 12833, -40266, + // -64918, 28317, 89178, 54320, -99922, + // -73005, 95070, -24716, 60663, 59516, + // 14865, 26328 + VLOAD_32(v2, 0xffff6602, 0x0000d3f6, 0x00003221, 0xffff62b6, 0xffff026a, + 0x00006e9d, 0x00015c5a, 0x0000d430, 0xfffe79ae, 0xfffee2d3, + 0x0001735e, 0xffff9f74, 0x0000ecf7, 0x0000e87c, 0x00003a11, + 0x000066d8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.f.x.v v3, v2, v0.t"); + // 0.000, 54262.000, 0.000, -40266.000, 0.000, 28317.000, + // 0.000, 54320.000, 0.000, -73005.000, 0.000, + // -24716.000, 0.000, 59516.000, 0.000, 26328.000 + VCMP_U32(35, v3, 0x0, 0x4753f600, 0x0, 0xc71d4a00, 0x0, 0x46dd3a00, 0x0, + 0x47543000, 0x0, 0xc78e9680, 0x0, 0xc6c11800, 0x0, 0x47687c00, 0x0, + 0x46cdb000); + + VSET(16, e64, m1); + // -8860682, 8064547, -5636078, + // -3712253, 8492493, 9839246, + // -8271278, -6234598, -4538479, + // 8807688, 5640899, 3839761, + // -1394518, -6118355, 1783927, + // 5819812 + VLOAD_64(v2, 0xffffffffff78cbf6, 0x00000000007b0e23, 0xffffffffffaa0012, + 0xffffffffffc75b03, 0x00000000008195cd, 0x000000000096228e, + 0xffffffffff81ca52, 0xffffffffffa0de1a, 0xffffffffffbabf91, + 0x0000000000866508, 0x00000000005612c3, 0x00000000003a9711, + 0xffffffffffeab8aa, 0xffffffffffa2a42d, 0x00000000001b3877, + 0x000000000058cda4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfcvt.f.x.v v3, v2, v0.t"); + // 0.000, 8064547.000, 0.000, -3712253.000, 0.000, + // 9839246.000, 0.000, -6234598.000, 0.000, 8807688.000, + // 0.000, 3839761.000, 0.000, -6118355.000, 0.000, + // 5819812.000 + VCMP_U64(36, v3, 0x0, 0x415ec388c0000000, 0x0, 0xc14c527e80000000, 0x0, + 0x4162c451c0000000, 0x0, 0xc157c87980000000, 0x0, 0x4160cca100000000, + 0x0, 0x414d4b8880000000, 0x0, 0xc15756f4c0000000, 0x0, + 0x4156336900000000); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + + TEST_CASE7(); + TEST_CASE8(); + + TEST_CASE9(); + TEST_CASE10(); + + TEST_CASE11(); + TEST_CASE12(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfdiv.c b/apps/riscv-tests/isa/rv64uv/vfdiv.c new file mode 100644 index 0000000..eb90a66 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfdiv.c @@ -0,0 +1,355 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.8057, -0.8564, 0.3425, -0.3066, -0.7314, -0.6396, 0.7588, + // -0.3743, 0.8706, -0.3064, 0.0390, 0.6123, 0.0237, -0.6201, + // -0.4524, 0.3337 + VLOAD_16(v2, 0xba72, 0xbada, 0x357b, 0xb4e8, 0xb9da, 0xb91e, 0x3a12, 0xb5fd, + 0x3af7, 0xb4e7, 0x28fe, 0x38e6, 0x2612, 0xb8f6, 0xb73d, 0x3557); + // -0.4094, 0.0410, -0.7305, 0.9038, -0.3545, 0.2830, -0.7051, + // -0.7124, -0.6348, 0.1256, 0.5576, 0.1334, 0.8779, -0.4836, + // 0.3215, 0.4167 + VLOAD_16(v3, 0xb68d, 0x293e, 0xb9d8, 0x3b3b, 0xb5ac, 0x3487, 0xb9a4, 0xb9b3, + 0xb914, 0x3005, 0x3876, 0x3045, 0x3b06, 0xb7bd, 0x3525, 0x36ab); + asm volatile("vfdiv.vv v1, v2, v3"); + // 1.9678, -20.9062, -0.4690, -0.3394, 2.0625, -2.2598, + // -1.0762, 0.5254, -1.3711, -2.4395, 0.0699, 4.5898, 0.0270, + // 1.2822, -1.4072, 0.8008 + VCMP_U16(1, v1, 0x3fdf, 0xcd3a, 0xb780, 0xb56d, 0x4020, 0xc085, 0xbc4e, + 0x3833, 0xbd7c, 0xc0e0, 0x2c79, 0x4496, 0x26ea, 0x3d20, 0xbda0, + 0x3a68); + + VSET(16, e32, m1); + // 0.64838839, 0.00666664, -0.13619921, 0.21094505, + // -0.51040554, -0.77216595, 0.42111391, 0.82974166, + // -0.31227046, 0.68854737, -0.72970057, 0.10843290, + // -0.38442346, 0.18102080, 0.57249051, 0.76465768 + VLOAD_32(v2, 0x3f25fcc8, 0x3bda73da, 0xbe0b77ce, 0x3e5801fb, 0xbf02a9f0, + 0xbf45acab, 0x3ed79c3e, 0x3f5469f3, 0xbe9fe1ea, 0x3f3044a4, + 0xbf3acda8, 0x3dde1212, 0xbec4d327, 0x3e395d84, 0x3f128ebd, + 0x3f43c09b); + // -0.59629226, -0.46890569, 0.99662799, -0.49397555, + // 0.80701596, 0.55786854, -0.26524273, -0.04642257, + // -0.67671824, 0.64403933, 0.06642481, 0.26544699, + // -0.00225505, 0.27478188, 0.76509053, 0.36194146 + VLOAD_32(v3, 0xbf18a69c, 0xbef01468, 0x3f7f2303, 0xbefcea5d, 0x3f4e9899, + 0x3f0ed079, 0xbe87cde5, 0xbd3e2597, 0xbf2d3d68, 0x3f24dfc3, + 0x3d8809bb, 0x3e87e8ab, 0xbb13c97d, 0x3e8cb036, 0x3f43dcf9, + 0x3eb95064); + asm volatile("vfdiv.vv v1, v2, v3"); + // -1.08736682, -0.01421745, -0.13666002, -0.42703542, + // -0.63246030, -1.38413608, -1.58765483, -17.87367058, + // 0.46144828, 1.06910765, -10.98536205, 0.40849173, + // 170.47213745, 0.65877998, 0.74826509, 2.11265564 + VCMP_U32(2, v1, 0xbf8b2ed5, 0xbc68f04d, 0xbe0bf09b, 0xbedaa462, 0xbf21e8ea, + 0xbfb12b5e, 0xbfcb3846, 0xc18efd46, 0x3eec42f2, 0x3f88d884, + 0xc12fc40a, 0x3ed125d4, 0x432a78dd, 0x3f28a5cd, 0x3f3f8e4c, + 0x400735c0); + + VSET(16, e64, m1); + // -0.6201645522687720, 0.7701971477336478, 0.3292637140913006, + // -0.8434179184761514, -0.7347451981263740, 0.6543864439701519, + // 0.1228421097534835, -0.5052233099528094, -0.5128552707464591, + // 0.9434287237802566, -0.5723896115412233, -0.5719579148082712, + // -0.6537028651114556, 0.1091378410914579, -0.7602559429758879, + // 0.2908894437497427 + VLOAD_64(v2, 0xbfe3d86354c44060, 0x3fe8a5747d1fa1c6, 0x3fd512a81cf2063c, + 0xbfeafd479316e516, 0xbfe783085c9b10ee, 0x3fe4f0bbd6f98570, + 0x3fbf72949bf67da0, 0xbfe02aca132d92f2, 0xbfe0694f74edfe18, + 0x3fee30916f57c874, 0xbfe2510404c47868, 0xbfe24d7aaf5946b0, + 0xbfe4eb22455e9102, 0x3fbbf075223e6d60, 0xbfe854044575797c, + 0x3fd29deec1ea08a0); + // 0.6660375425590812, -0.9603615652916235, -0.1168804546788573, + // -0.3258082002843947, 0.0488865860405421, + // -0.1515621417461690, -0.1189568642850463, + // -0.1213016259965920, -0.1369814061459547, 0.5914369694708146, + // 0.7538814889966272, 0.2346701936201294, 0.9227364529293489, + // 0.9447507336323382, -0.4250995717346850, -0.0882167932097473 + VLOAD_64(v3, 0x3fe5502df6e661fe, 0xbfeebb482d68699c, 0xbfbdebe0a2632640, + 0xbfd4da0aa33f5db0, 0x3fa907a9a083b220, 0xbfc36663650e4608, + 0xbfbe73f501bd2e10, 0xbfbf0d9f949b6370, 0xbfc1889b51c74ac0, + 0x3fe2ed0d3930b850, 0x3fe81fcc12899c0a, 0x3fce09ac4378e388, + 0x3fed870e9905133a, 0x3fee3b65e3fa5532, 0xbfdb34d4d5893894, + 0xbfb6956031cb3a60); + asm volatile("vfdiv.vv v1, v2, v3"); + // -0.9311255186696326, -0.8019866429158581, -2.8170981623573508, + // 2.5886945685834193, -15.0295870019854370, -4.3176114854994303, + // -1.0326609606918302, 4.1650167984310764, 3.7439772679805032, + // 1.5951466892987514, -0.7592567530780479, -2.4372840282141826, + // -0.7084394065458121, 0.1155202501636058, 1.7884185106880846, + // -3.2974384260161655 + VCMP_U64(3, v1, 0xbfedcbc7be65070a, 0xbfe9a9dfe464e0ca, 0xc006896ac2e79279, + 0x4004b5a57f7b305c, 0xc02e0f26070bd40a, 0xc011453bf1fc3753, + 0xbff085c77fe07008, 0x4010a8fa29e23558, 0x400df3aa5a978cad, + 0x3ff985b888edc5e0, 0xbfe84bd4d177987a, 0xc0037f8ec4c1f1c6, + 0xbfe6ab891e49fb2d, 0x3fbd92bc307a7a1b, 0x3ffc9d5cba6f762a, + 0xc00a612765c28153); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.8057, -0.8564, 0.3425, -0.3066, -0.7314, -0.6396, 0.7588, + // -0.3743, 0.8706, -0.3064, 0.0390, 0.6123, 0.0237, -0.6201, + // -0.4524, 0.3337 + VLOAD_16(v2, 0xba72, 0xbada, 0x357b, 0xb4e8, 0xb9da, 0xb91e, 0x3a12, 0xb5fd, + 0x3af7, 0xb4e7, 0x28fe, 0x38e6, 0x2612, 0xb8f6, 0xb73d, 0x3557); + // -0.4094, 0.0410, -0.7305, 0.9038, -0.3545, 0.2830, -0.7051, + // -0.7124, -0.6348, 0.1256, 0.5576, 0.1334, 0.8779, -0.4836, + // 0.3215, 0.4167 + VLOAD_16(v3, 0xb68d, 0x293e, 0xb9d8, 0x3b3b, 0xb5ac, 0x3487, 0xb9a4, 0xb9b3, + 0xb914, 0x3005, 0x3876, 0x3045, 0x3b06, 0xb7bd, 0x3525, 0x36ab); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfdiv.vv v1, v2, v3, v0.t"); + // 0.0000, -20.9062, 0.0000, -0.3394, 0.0000, -2.2598, 0.0000, + // 0.5254, 0.0000, -2.4395, 0.0000, 4.5898, 0.0000, 1.2822, + // 0.0000, 0.8008 + VCMP_U16(4, v1, 0x0, 0xcd3a, 0x0, 0xb56d, 0x0, 0xc085, 0x0, 0x3833, 0x0, + 0xc0e0, 0x0, 0x4496, 0x0, 0x3d20, 0x0, 0x3a68); + + VSET(16, e32, m1); + // 0.64838839, 0.00666664, -0.13619921, 0.21094505, + // -0.51040554, -0.77216595, 0.42111391, 0.82974166, + // -0.31227046, 0.68854737, -0.72970057, 0.10843290, + // -0.38442346, 0.18102080, 0.57249051, 0.76465768 + VLOAD_32(v2, 0x3f25fcc8, 0x3bda73da, 0xbe0b77ce, 0x3e5801fb, 0xbf02a9f0, + 0xbf45acab, 0x3ed79c3e, 0x3f5469f3, 0xbe9fe1ea, 0x3f3044a4, + 0xbf3acda8, 0x3dde1212, 0xbec4d327, 0x3e395d84, 0x3f128ebd, + 0x3f43c09b); + // -0.59629226, -0.46890569, 0.99662799, -0.49397555, + // 0.80701596, 0.55786854, -0.26524273, -0.04642257, + // -0.67671824, 0.64403933, 0.06642481, 0.26544699, + // -0.00225505, 0.27478188, 0.76509053, 0.36194146 + VLOAD_32(v3, 0xbf18a69c, 0xbef01468, 0x3f7f2303, 0xbefcea5d, 0x3f4e9899, + 0x3f0ed079, 0xbe87cde5, 0xbd3e2597, 0xbf2d3d68, 0x3f24dfc3, + 0x3d8809bb, 0x3e87e8ab, 0xbb13c97d, 0x3e8cb036, 0x3f43dcf9, + 0x3eb95064); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfdiv.vv v1, v2, v3, v0.t"); + // 0.00000000, -0.01421745, 0.00000000, -0.42703542, + // 0.00000000, -1.38413608, 0.00000000, -17.87367058, + // 0.00000000, 1.06910765, 0.00000000, 0.40849173, + // 0.00000000, 0.65877998, 0.00000000, 2.11265564 + VCMP_U32(5, v1, 0x0, 0xbc68f04d, 0x0, 0xbedaa462, 0x0, 0xbfb12b5e, 0x0, + 0xc18efd46, 0x0, 0x3f88d884, 0x0, 0x3ed125d4, 0x0, 0x3f28a5cd, 0x0, + 0x400735c0); + + VSET(16, e64, m1); + // -0.6201645522687720, 0.7701971477336478, 0.3292637140913006, + // -0.8434179184761514, -0.7347451981263740, 0.6543864439701519, + // 0.1228421097534835, -0.5052233099528094, -0.5128552707464591, + // 0.9434287237802566, -0.5723896115412233, -0.5719579148082712, + // -0.6537028651114556, 0.1091378410914579, -0.7602559429758879, + // 0.2908894437497427 + VLOAD_64(v2, 0xbfe3d86354c44060, 0x3fe8a5747d1fa1c6, 0x3fd512a81cf2063c, + 0xbfeafd479316e516, 0xbfe783085c9b10ee, 0x3fe4f0bbd6f98570, + 0x3fbf72949bf67da0, 0xbfe02aca132d92f2, 0xbfe0694f74edfe18, + 0x3fee30916f57c874, 0xbfe2510404c47868, 0xbfe24d7aaf5946b0, + 0xbfe4eb22455e9102, 0x3fbbf075223e6d60, 0xbfe854044575797c, + 0x3fd29deec1ea08a0); + // 0.6660375425590812, -0.9603615652916235, -0.1168804546788573, + // -0.3258082002843947, 0.0488865860405421, + // -0.1515621417461690, -0.1189568642850463, + // -0.1213016259965920, -0.1369814061459547, 0.5914369694708146, + // 0.7538814889966272, 0.2346701936201294, 0.9227364529293489, + // 0.9447507336323382, -0.4250995717346850, -0.0882167932097473 + VLOAD_64(v3, 0x3fe5502df6e661fe, 0xbfeebb482d68699c, 0xbfbdebe0a2632640, + 0xbfd4da0aa33f5db0, 0x3fa907a9a083b220, 0xbfc36663650e4608, + 0xbfbe73f501bd2e10, 0xbfbf0d9f949b6370, 0xbfc1889b51c74ac0, + 0x3fe2ed0d3930b850, 0x3fe81fcc12899c0a, 0x3fce09ac4378e388, + 0x3fed870e9905133a, 0x3fee3b65e3fa5532, 0xbfdb34d4d5893894, + 0xbfb6956031cb3a60); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfdiv.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, -0.8019866429158581, + // 0.0000000000000000, 2.5886945685834193, 0.0000000000000000, + // -4.3176114854994303, 0.0000000000000000, 4.1650167984310764, + // 0.0000000000000000, 1.5951466892987514, 0.0000000000000000, + // -2.4372840282141826, 0.0000000000000000, 0.1155202501636058, + // 0.0000000000000000, -3.2974384260161655 + VCMP_U64(6, v1, 0x0, 0xbfe9a9dfe464e0ca, 0x0, 0x4004b5a57f7b305c, 0x0, + 0xc011453bf1fc3753, 0x0, 0x4010a8fa29e23558, 0x0, 0x3ff985b888edc5e0, + 0x0, 0xc0037f8ec4c1f1c6, 0x0, 0x3fbd92bc307a7a1b, 0x0, + 0xc00a612765c28153); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + // -0.0933, 0.4983, 0.5918, -0.0608, 0.0790, -0.2864, -0.7656, + // 0.4878, 0.8862, 0.4255, 0.9561, -0.7158, -0.3247, 0.9961, + // -0.4963, -0.4114 + VLOAD_16(v2, 0xadf9, 0x37f9, 0x38bc, 0xabc7, 0x2d0f, 0xb495, 0xba20, 0x37ce, + 0x3b17, 0x36cf, 0x3ba6, 0xb9ba, 0xb532, 0x3bf8, 0xb7f1, 0xb695); + double dscalar_16; + // -0.3206 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb521); + asm volatile("vfdiv.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // 0.2910, -1.5547, -1.8457, 0.1896, -0.2466, 0.8936, 2.3887, + // -1.5215, -2.7656, -1.3271, -2.9824, 2.2324, 1.0127, + // -3.1074, 1.5488, 1.2832 + VCMP_U16(7, v1, 0x34a8, 0xbe37, 0xbf62, 0x3210, 0xb3e3, 0x3b25, 0x40c6, + 0xbe16, 0xc187, 0xbd4f, 0xc1f7, 0x4077, 0x3c0d, 0xc236, 0x3e31, + 0x3d22); + + VSET(16, e32, m1); + // 0.74354362, 0.49774653, 0.25714639, 0.51635689, + // 0.74569613, 0.41876560, 0.21346331, 0.08743033, + // -0.15111920, -0.93289024, 0.08753468, -0.33427054, + // 0.06167563, -0.54564798, 0.78990245, -0.77273035 + VLOAD_32(v2, 0x3f3e58e0, 0x3efed8a2, 0x3e83a8b1, 0x3f042ff7, 0x3f3ee5f1, + 0x3ed66872, 0x3e5a9620, 0x3db30eac, 0xbe1abefe, 0xbf6ed1e5, + 0x3db34562, 0xbeab2582, 0x3d7c9f95, 0xbf0baf96, 0x3f4a370c, + 0xbf45d1a8); + double dscalar_32; + // -0.45971388 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbeeb5f9e); + asm volatile("vfdiv.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // -1.61740518, -1.08273113, -0.55936182, -1.12321365, + // -1.62208748, -0.91092664, -0.46433949, -0.19018422, + // 0.32872447, 2.02928448, -0.19041122, 0.72712737, + // -0.13416091, 1.18692958, -1.71824801, 1.68089414 + VCMP_U32(8, v1, 0xbfcf0722, 0xbf8a96ef, 0xbf0f3255, 0xbf8fc576, 0xbfcfa090, + 0xbf69327c, 0xbeedbde7, 0xbe42bfa7, 0x3ea84e93, 0x4001dfcc, + 0xbe42fb28, 0x3f3a2504, 0xbe096179, 0x3f97ed4e, 0xbfdbef8c, + 0x3fd72789); + + VSET(16, e64, m1); + // -0.8580137874650531, -0.4775160339931992, 0.3831482495481682, + // -0.3582952848420831, 0.0009796501269754, 0.5485795361059773, + // -0.8055070333165963, -0.2632019868496005, + // -0.0782680309690278, -0.7119901734202212, + // -0.5084969452651125, -0.7586325258910223, 0.6253847342253853, + // 0.5751160060426936, 0.0609762717873976, -0.7366654110036495 + VLOAD_64(v2, 0xbfeb74d95495be72, 0xbfde8f9f69544024, 0x3fd885803c550ed0, + 0xbfd6ee4f58ad4bcc, 0x3f500cf35070c000, 0x3fe18df6abda8f8e, + 0xbfe9c6b6af995e52, 0xbfd0d84d2570b86c, 0xbfb4095fa9559400, + 0xbfe6c89f9dbd3916, 0xbfe0459b62c0f228, 0xbfe846b7b80c4834, + 0x3fe40326d89d4d44, 0x3fe26759aeab8116, 0x3faf38482a5158c0, + 0xbfe792c3570b5cc2); + double dscalar_64; + // 0.0072652319849018 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3f7dc225dc5e3c00); + asm volatile("vfdiv.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // -118.0986084474836275, + // -65.7261922242188206, 52.7372354171766275, + // -49.3164272781202087, + // 0.1348408597290880, 75.5075044053657223, + // -110.8714814599939871, -36.2276094413188474, + // -10.7729568899768022, -97.9996474854262800, + // -69.9904622896889919, + // -104.4195873535172723, 86.0791142698573424, 79.1600333255520070, + // 8.3928870976336363, -101.3959929338175954 + VCMP_U64(9, v1, 0xc05d864f99ce434b, 0xc0506e79eef36846, 0x404a5e5dbaeb1cfe, + 0xc048a880b0658b57, 0x3fc142771d59b8f1, 0x4052e07af3c1e7c9, + 0xc05bb7c65a2c6fa6, 0xc0421d224e615cd6, 0xc0258bc101675622, + 0xc0587ffa39725bce, 0xc0517f63bbf188ac, 0xc05a1ada84ea4b00, + 0x40558510354c6bc9, 0x4053ca3dfc6ae106, 0x4020c9287f66b6b2, + 0xc0595957f2bf0c64); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + // -0.0933, 0.4983, 0.5918, -0.0608, 0.0790, -0.2864, + // -0.7656, 0.4878, 0.8862, 0.4255, 0.9561, -0.7158, + // -0.3247, 0.9961, -0.4963, -0.4114 + VLOAD_16(v2, 0xadf9, 0x37f9, 0x38bc, 0xabc7, 0x2d0f, 0xb495, 0xba20, 0x37ce, + 0x3b17, 0x36cf, 0x3ba6, 0xb9ba, 0xb532, 0x3bf8, 0xb7f1, 0xb695); + double dscalar_16; + // -0.3206 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb521); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfdiv.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, -1.5547, 0.0000, 0.1896, 0.0000, 0.8936, 0.0000, + // -1.5215, 0.0000, -1.3271, 0.0000, 2.2324, 0.0000, + // -3.1074, 0.0000, 1.2832 + VCMP_U16(10, v1, 0x0, 0xbe37, 0x0, 0x3210, 0x0, 0x3b25, 0x0, 0xbe16, 0x0, + 0xbd4f, 0x0, 0x4077, 0x0, 0xc236, 0x0, 0x3d22); + + VSET(16, e32, m1); + // 0.74354362, 0.49774653, 0.25714639, 0.51635689, + // 0.74569613, 0.41876560, 0.21346331, 0.08743033, + // -0.15111920, -0.93289024, 0.08753468, -0.33427054, + // 0.06167563, -0.54564798, 0.78990245, -0.77273035 + VLOAD_32(v2, 0x3f3e58e0, 0x3efed8a2, 0x3e83a8b1, 0x3f042ff7, 0x3f3ee5f1, + 0x3ed66872, 0x3e5a9620, 0x3db30eac, 0xbe1abefe, 0xbf6ed1e5, + 0x3db34562, 0xbeab2582, 0x3d7c9f95, 0xbf0baf96, 0x3f4a370c, + 0xbf45d1a8); + double dscalar_32; + // -0.45971388 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbeeb5f9e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfdiv.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, -1.08273113, 0.00000000, -1.12321365, + // 0.00000000, -0.91092664, 0.00000000, -0.19018422, + // 0.00000000, 2.02928448, 0.00000000, 0.72712737, + // 0.00000000, 1.18692958, 0.00000000, 1.68089414 + VCMP_U32(11, v1, 0x0, 0xbf8a96ef, 0x0, 0xbf8fc576, 0x0, 0xbf69327c, 0x0, + 0xbe42bfa7, 0x0, 0x4001dfcc, 0x0, 0x3f3a2504, 0x0, 0x3f97ed4e, 0x0, + 0x3fd72789); + + VSET(16, e64, m1); + // -0.8580137874650531, -0.4775160339931992, + // 0.3831482495481682, -0.3582952848420831, 0.0009796501269754, + // 0.5485795361059773, -0.8055070333165963, + // -0.2632019868496005, -0.0782680309690278, + // -0.7119901734202212, -0.5084969452651125, + // -0.7586325258910223, 0.6253847342253853, + // 0.5751160060426936, 0.0609762717873976, -0.7366654110036495 + VLOAD_64(v2, 0xbfeb74d95495be72, 0xbfde8f9f69544024, 0x3fd885803c550ed0, + 0xbfd6ee4f58ad4bcc, 0x3f500cf35070c000, 0x3fe18df6abda8f8e, + 0xbfe9c6b6af995e52, 0xbfd0d84d2570b86c, 0xbfb4095fa9559400, + 0xbfe6c89f9dbd3916, 0xbfe0459b62c0f228, 0xbfe846b7b80c4834, + 0x3fe40326d89d4d44, 0x3fe26759aeab8116, 0x3faf38482a5158c0, + 0xbfe792c3570b5cc2); + double dscalar_64; + // 0.0072652319849018 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3f7dc225dc5e3c00); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfdiv.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, -65.7261922242188206, + // 0.0000000000000000, -49.3164272781202087, + // 0.0000000000000000, 75.5075044053657223, + // 0.0000000000000000, -36.2276094413188474, + // 0.0000000000000000, -97.9996474854262800, + // 0.0000000000000000, -104.4195873535172723, + // 0.0000000000000000, 79.1600333255520070, + // 0.0000000000000000, -101.3959929338175954 + VCMP_U64(12, v1, 0x0, 0xc0506e79eef36846, 0x0, 0xc048a880b0658b57, 0x0, + 0x4052e07af3c1e7c9, 0x0, 0xc0421d224e615cd6, 0x0, 0xc0587ffa39725bce, + 0x0, 0xc05a1ada84ea4b00, 0x0, 0x4053ca3dfc6ae106, 0x0, + 0xc0595957f2bf0c64); +}; + +int main(void) { + enable_vec(); + enable_fp(); + // Change RM to RTZ since there are issues with FDIV + RNE in fpnew + // Update: there are issues also with RTZ... + CHANGE_RM(RM_RTZ); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfirst.c b/apps/riscv-tests/isa/rv64uv/vfirst.c new file mode 100644 index 0000000..c7657b4 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfirst.c @@ -0,0 +1,43 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e32, m1); + VLOAD_32(v2, 3); + VLOAD_32(v0, 2, 0, 0, 0); + volatile uint32_t scalar = 1337; + volatile uint32_t OUP[] = {0}; + __asm__ volatile("vfirst.m %[A], v2, v0.t \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(1, OUP[0], 1); +} + +void TEST_CASE2() { + VSET(4, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4); + VLOAD_32(v0, 0, 0, 0, 0); + volatile int32_t scalar = 1337; + volatile int32_t OUP[] = {0}; + __asm__ volatile("vfirst.m %[A], v2, v0.t \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(2, OUP[0], -1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmacc.c b/apps/riscv-tests/isa/rv64uv/vfmacc.c new file mode 100644 index 0000000..489359a --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmacc.c @@ -0,0 +1,356 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.6353, -0.2290, 0.6870, -0.1031, 0.5410, 0.4211, -0.4939, + // -0.8779, -0.3213, -0.6846, 0.9229, 0.0103, -0.5068, 0.8706, + // 0.6309, -0.3054 + VLOAD_16(v2, 0xb915, 0xb354, 0x397f, 0xae9a, 0x3854, 0x36bd, 0xb7e7, 0xbb06, + 0xb524, 0xb97a, 0x3b62, 0x2142, 0xb80e, 0x3af7, 0x390c, 0xb4e3); + // -0.8042, -0.9463, 0.4431, 0.3757, -0.5259, -0.1290, 0.4697, + // 0.0952, -0.9995, 0.8823, -0.6128, -0.5010, -0.9976, 0.0081, + // 0.9746, -0.7734 + VLOAD_16(v3, 0xba6f, 0xbb92, 0x3717, 0x3603, 0xb835, 0xb021, 0x3784, 0x2e17, + 0xbbff, 0x3b0f, 0xb8e7, 0xb802, 0xbbfb, 0x2022, 0x3bcc, 0xba30); + // 0.6509, 0.3452, 0.9360, 0.3616, -0.4258, -0.0945, -0.7295, + // -0.7734, 0.3411, -0.1519, -0.3557, 0.6060, 0.2598, + // -0.0171, -0.8042, -0.4419 + VLOAD_16(v1, 0x3935, 0x3586, 0x3b7d, 0x35c9, 0xb6d0, 0xae0d, 0xb9d6, 0xba30, + 0x3575, 0xb0dc, 0xb5b1, 0x38d9, 0x3428, 0xa45e, 0xba6f, 0xb712); + asm volatile("vfmacc.vv v1, v2, v3"); + // 1.1621, 0.5620, 1.2402, 0.3228, -0.7100, -0.1489, -0.9614, + // -0.8569, 0.6621, -0.7559, -0.9209, 0.6006, 0.7651, + // -0.0100, -0.1895, -0.2057 + VCMP_U16(1, v1, 0x3ca6, 0x387f, 0x3cf6, 0x352a, 0xb9af, 0xb0c4, 0xbbb1, + 0xbadb, 0x394c, 0xba0c, 0xbb5f, 0x38ce, 0x3a1f, 0xa123, 0xb20f, + 0xb295); + + VSET(16, e32, m1); + // 0.72754014, 0.34003398, 0.70107144, -0.41727209, + // -0.52331781, -0.11821542, -0.16069038, 0.30835113, + // -0.59407759, -0.53240144, -0.92390168, 0.33251825, + // -0.45979658, 0.32465541, -0.99342769, -0.16221718 + VLOAD_32(v2, 0x3f3a4012, 0x3eae18ef, 0x3f33796b, 0xbed5a4b0, 0xbf05f828, + 0xbdf21aed, 0xbe248c05, 0x3e9de033, 0xbf181578, 0xbf084b76, + 0xbf6c84d2, 0x3eaa3fd5, 0xbeeb6a75, 0x3ea6393c, 0xbf7e5147, + 0xbe261c43); + // 0.95104939, -0.11575679, 0.13276713, 0.22784369, + // 0.93318671, -0.32301557, 0.41414812, 0.81797487, + // -0.21847244, -0.00211347, -0.72070456, -0.58624452, + // 0.07381243, -0.16745377, 0.55389816, -0.23427610 + VLOAD_32(v3, 0x3f7377f9, 0xbded11e6, 0x3e07f41b, 0x3e694fdb, 0x3f6ee553, + 0xbea5624c, 0x3ed40b39, 0x3f5166cd, 0xbe5fb73d, 0xbb0a8224, + 0xbf388018, 0xbf16141f, 0x3d972af9, 0xbe2b7900, 0x3f0dcc45, + 0xbe6fe613); + // -0.07459558, -0.00461283, -0.97654468, 0.94394064, + // 0.24971253, 0.97819000, 0.55116856, -0.97427863, 0.61764765, + // 0.86367106, 0.48787504, -0.26353455, -0.22228357, 0.40454853, + // 0.64000225, -0.51787829 + VLOAD_32(v1, 0xbd98c591, 0xbb97273a, 0xbf79fed5, 0x3f71a618, 0x3e7fb4a4, + 0x3f7a6aa9, 0x3f0d1962, 0xbf796a53, 0x3f1e1e28, 0x3f5d198c, + 0x3ef9cac2, 0xbe86ee00, 0xbe639e4e, 0x3ecf20fc, 0x3f23d730, + 0xbf0493ac); + asm volatile("vfmacc.vv v1, v2, v3"); + // 0.61733103, -0.04397407, -0.88346541, 0.84886783, + // -0.23864070, 1.01637542, 0.48461893, -0.72205520, + // 0.74743724, 0.86479628, 1.15373516, -0.45847154, + // -0.25622228, 0.35018376, 0.08974451, -0.47987467 + VCMP_U32(2, v1, 0x3f1e0968, 0xbd341e29, 0xbf622aca, 0x3f594f67, 0xbe745e3a, + 0x3f821897, 0x3ef81ff9, 0xbf38d89b, 0x3f3f580c, 0x3f5d634a, + 0x3f93ad98, 0xbeeabcc8, 0xbe832f91, 0x3eb34b49, 0x3db7cbf5, + 0xbef5b222); + + VSET(16, e64, m1); + // -0.8992497708533775, 0.5795977429472710, -0.9421852470430045, + // 0.3407052467776674, -0.1137141395145149, 0.3284679540868891, + // 0.9781857174570949, 0.6033619236526551, -0.1287683269222892, + // 0.6555379481826638, 0.6785468173738887, 0.6923267883951645, + // 0.2185923779321672, -0.1310544396012536, -0.7596952716763763, + // -0.4011231994121780, + VLOAD_64(v2, 0xbfecc6a774980626, 0x3fe28c1090d967fc, 0xbfee2661acda592c, + 0x3fd5ce1d611f1590, 0xbfbd1c5eae4ec060, 0x3fd5059e742594fc, + 0x3fef4d4c223c8f84, 0x3fe34ebdaa37ac76, 0xbfc07b7b047228c0, + 0x3fe4fa2ab8176850, 0x3fe5b6a7d0ad9fa2, 0x3fe6278a8249a986, + 0x3fcbfad5c52fcfd8, 0xbfc0c664520a9f78, 0xbfe84f6c7558d3f0, + 0xbfd9ac00a3c919a8); + // 0.3028184794479449, 0.5016121947684244, 0.1900289524299839, + // 0.3294240614689632, 0.5945396967575391, -0.8758223026547887, + // 0.3719808177193829, 0.9159354723876536, 0.0805670751146079, + // 0.1775335284298603, -0.7021940272509897, 0.9279338928738479, + // -0.7358371767028979, 0.2529700403354449, + // -0.8333759771774525, -0.4016540133317048, + VLOAD_64(v3, 0x3fd36160c2769da4, 0x3fe00d350479c3ea, 0x3fc852de63fd6e08, + 0x3fd51548a8a19488, 0x3fe306781d37ea9a, 0xbfec06bc7e604fb8, + 0x3fd7ce88a1b60584, 0x3fed4f57e864d750, 0x3fb4a00b38c069f0, + 0x3fc6b96b2d465dc0, 0xbfe6785f9bcfaa42, 0x3fedb1a26b57c7d6, + 0xbfe78bfa6823d662, 0x3fd030a94086f244, 0xbfeaab0418e7f974, + 0xbfd9b4b308e446c8); + // -0.0664052564688480, -0.6742544994800144, 0.4321518669568931, + // -0.1627512425330113, 0.0193121553139675, -0.3517684494272582, + // -0.4834881433176264, 0.8328623424117183, 0.0264604353835154, + // 0.0322804237161178, -0.8345203693668675, 0.7175251091228996, + // -0.7419013213335950, -0.2977694001417877, 0.4556506623709609, + // -0.7832443836668095, + VLOAD_64(v1, 0xbfb0ffef54d0f220, 0xbfe5937e2c0e5202, 0x3fdba8604ddf0d80, + 0xbfc4d508600804d8, 0x3f93c690cdf47e40, 0xbfd6835fd0838044, + 0xbfdef17840e363cc, 0x3feaa6ceed574e1a, 0x3f9b1871c270c340, + 0x3fa0870f4852d0c0, 0xbfeab4640fc8d962, 0x3fe6f5f737b7bbe2, + 0xbfe7bda7d6ff9552, 0xbfd30ea762d6f1ec, 0x3fdd296165522d4c, + 0xbfe910568693fcea); + asm volatile("vfmacc.vv v1, v2, v3"); + // -0.3387147047225807, -0.3835212035574087, 0.2531093914663254, + // -0.0505147363757267, -0.0482954147100367, -0.6394480093239447, + // -0.1196218202565150, 1.3855029309732363, 0.0160859479159849, + // 0.1486603886766570, -1.3109918917369803, 1.3599586010192732, + // -0.9027497195599737, -0.3309222470138559, 1.0887624517613512, + // -0.6221316407824544, + VCMP_U64(3, v1, 0xbfd5ad8070dd4c48, 0xbfd88b9c84a68118, 0x3fd032f1bbaa2211, + 0xbfa9dd1149664d37, 0xbfa8ba2d3573e621, 0xbfe4765babf13c96, + 0xbfbe9f891de3c4d6, 0x3ff62b051f10acd5, 0x3f9078d5b0e5b2ba, + 0x3fc3074db9c9d78e, 0xbff4f9d2a2454dd5, 0x3ff5c263f334aac4, + 0xbfece353613f76db, 0xbfd52dd4811c5fc3, 0x3ff16b922d36d831, + 0xbfe3e8809d5ef572); +}; + +// Simple random test with similar values (masked, the numbers are taken from +// TEST_CASE1) +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 0xb915, 0xb354, 0x397f, 0xae9a, 0x3854, 0x36bd, 0xb7e7, 0xbb06, + 0xb524, 0xb97a, 0x3b62, 0x2142, 0xb80e, 0x3af7, 0x390c, 0xb4e3); + VLOAD_16(v3, 0xba6f, 0xbb92, 0x3717, 0x3603, 0xb835, 0xb021, 0x3784, 0x2e17, + 0xbbff, 0x3b0f, 0xb8e7, 0xb802, 0xbbfb, 0x2022, 0x3bcc, 0xba30); + VLOAD_16(v1, 0x3935, 0x3586, 0x3b7d, 0x35c9, 0xb6d0, 0xae0d, 0xb9d6, 0xba30, + 0x3575, 0xb0dc, 0xb5b1, 0x38d9, 0x3428, 0xa45e, 0xba6f, 0xb712); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfmacc.vv v1, v2, v3, v0.t"); + VCMP_U16(4, v1, 0x3935, 0x387f, 0x3b7d, 0x352a, 0xb6d0, 0xb0c4, 0xb9d6, + 0xbadb, 0x3575, 0xba0c, 0xb5b1, 0x38ce, 0x3428, 0xa123, 0xba6f, + 0xb295); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3f3a4012, 0x3eae18ef, 0x3f33796b, 0xbed5a4b0, 0xbf05f828, + 0xbdf21aed, 0xbe248c05, 0x3e9de033, 0xbf181578, 0xbf084b76, + 0xbf6c84d2, 0x3eaa3fd5, 0xbeeb6a75, 0x3ea6393c, 0xbf7e5147, + 0xbe261c43); + VLOAD_32(v3, 0x3f7377f9, 0xbded11e6, 0x3e07f41b, 0x3e694fdb, 0x3f6ee553, + 0xbea5624c, 0x3ed40b39, 0x3f5166cd, 0xbe5fb73d, 0xbb0a8224, + 0xbf388018, 0xbf16141f, 0x3d972af9, 0xbe2b7900, 0x3f0dcc45, + 0xbe6fe613); + VLOAD_32(v1, 0xbd98c591, 0xbb97273a, 0xbf79fed5, 0x3f71a618, 0x3e7fb4a4, + 0x3f7a6aa9, 0x3f0d1962, 0xbf796a53, 0x3f1e1e28, 0x3f5d198c, + 0x3ef9cac2, 0xbe86ee00, 0xbe639e4e, 0x3ecf20fc, 0x3f23d730, + 0xbf0493ac); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfmacc.vv v1, v2, v3, v0.t"); + VCMP_U32(5, v1, 0xbd98c591, 0xbd341e29, 0xbf79fed5, 0x3f594f67, 0x3e7fb4a4, + 0x3f821897, 0x3f0d1962, 0xbf38d89b, 0x3f1e1e28, 0x3f5d634a, + 0x3ef9cac2, 0xbeeabcc8, 0xbe639e4e, 0x3eb34b49, 0x3f23d730, + 0xbef5b222); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xbfecc6a774980626, 0x3fe28c1090d967fc, 0xbfee2661acda592c, + 0x3fd5ce1d611f1590, 0xbfbd1c5eae4ec060, 0x3fd5059e742594fc, + 0x3fef4d4c223c8f84, 0x3fe34ebdaa37ac76, 0xbfc07b7b047228c0, + 0x3fe4fa2ab8176850, 0x3fe5b6a7d0ad9fa2, 0x3fe6278a8249a986, + 0x3fcbfad5c52fcfd8, 0xbfc0c664520a9f78, 0xbfe84f6c7558d3f0, + 0xbfd9ac00a3c919a8); + VLOAD_64(v3, 0x3fd36160c2769da4, 0x3fe00d350479c3ea, 0x3fc852de63fd6e08, + 0x3fd51548a8a19488, 0x3fe306781d37ea9a, 0xbfec06bc7e604fb8, + 0x3fd7ce88a1b60584, 0x3fed4f57e864d750, 0x3fb4a00b38c069f0, + 0x3fc6b96b2d465dc0, 0xbfe6785f9bcfaa42, 0x3fedb1a26b57c7d6, + 0xbfe78bfa6823d662, 0x3fd030a94086f244, 0xbfeaab0418e7f974, + 0xbfd9b4b308e446c8); + VLOAD_64(v1, 0xbfb0ffef54d0f220, 0xbfe5937e2c0e5202, 0x3fdba8604ddf0d80, + 0xbfc4d508600804d8, 0x3f93c690cdf47e40, 0xbfd6835fd0838044, + 0xbfdef17840e363cc, 0x3feaa6ceed574e1a, 0x3f9b1871c270c340, + 0x3fa0870f4852d0c0, 0xbfeab4640fc8d962, 0x3fe6f5f737b7bbe2, + 0xbfe7bda7d6ff9552, 0xbfd30ea762d6f1ec, 0x3fdd296165522d4c, + 0xbfe910568693fcea); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfmacc.vv v1, v2, v3, v0.t"); + VCMP_U64(6, v1, 0xbfb0ffef54d0f220, 0xbfd88b9c84a68118, 0x3fdba8604ddf0d80, + 0xbfa9dd1149664d37, 0x3f93c690cdf47e40, 0xbfe4765babf13c96, + 0xbfdef17840e363cc, 0x3ff62b051f10acd5, 0x3f9b1871c270c340, + 0x3fc3074db9c9d78e, 0xbfeab4640fc8d962, 0x3ff5c263f334aac4, + 0xbfe7bda7d6ff9552, 0xbfd52dd4811c5fc3, 0x3fdd296165522d4c, + 0xbfe3e8809d5ef572); +}; + +// Simple random test with similar values (with scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 0.7407, -0.1365, 0.0000, -0.8525, -0.0812, 0.9609, -0.3740, + // 0.2800, 0.9692, 0.4045, 0.0205, -0.5503, 0.6499, 0.4470, + // -0.9360, -0.4426 + VLOAD_16(v3, 0x39ed, 0xb05e, 0x0000, 0xbad2, 0xad33, 0x3bb0, 0xb5fc, 0x347b, + 0x3bc1, 0x3679, 0x253e, 0xb867, 0x3933, 0x3727, 0xbb7d, 0xb715); + double dscalar_16; + // 0.5757 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x389b); + // -0.1472, -0.8906, 0.2247, 0.6118, -0.0908, -0.6450, -0.5415, + // 0.0505, -0.4595, 0.1157, -0.3494, 0.6670, -0.9658, -0.2944, + // -0.8096, -0.3364 + VLOAD_16(v1, 0xb0b6, 0xbb20, 0x3331, 0x38e5, 0xadcf, 0xb929, 0xb855, 0x2a77, + 0xb75a, 0x2f68, 0xb597, 0x3956, 0xbbba, 0xb4b6, 0xba7a, 0xb562); + asm volatile("vfmacc.vf v1, %[A], v3" ::[A] "f"(dscalar_16)); + // 0.2793, -0.9692, 0.2247, 0.1210, -0.1375, -0.0918, -0.7568, + // 0.2118, 0.0986, 0.3486, -0.3376, 0.3501, -0.5918, -0.0371, + // -1.3486, -0.5913 + VCMP_U16(7, v1, 0x3478, 0xbbc1, 0x3331, 0x2fbf, 0xb067, 0xade0, 0xba0e, + 0x32c6, 0x2e4e, 0x3594, 0xb567, 0x359a, 0xb8bc, 0xa8bf, 0xbd65, + 0xb8bb); + + VSET(16, e32, m1); + // -0.79164708, -0.13258822, -0.94492996, -0.93729085, + // 0.80344391, 0.77393818, 0.31253836, -0.42539355, + // -0.20085664, -0.63946086, 0.24876182, -0.45639724, + // 0.92842573, 0.39117134, -0.70563781, 0.13946204 + VLOAD_32(v3, 0xbf4aa962, 0xbe07c535, 0xbf71e6ee, 0xbf6ff24b, 0x3f4dae80, + 0x3f4620d0, 0x3ea00507, 0xbed9cd2f, 0xbe4dad5d, 0xbf23b3b5, + 0x3e7ebb6b, 0xbee9ace6, 0x3f6dad4f, 0x3ec8479c, 0xbf34a4ae, + 0x3e0ecf23); + double dscalar_32; + // 0.97630060 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f79eed6); + // -0.43768027, -0.74227923, 0.60234988, 0.43624315, + // 0.34759882, 0.65410614, 0.99296939, -0.31534156, + // -0.89647168, 0.47623411, -0.68185741, 0.77072626, + // 0.19827089, -0.16254151, 0.81625229, -0.24369264 + VLOAD_32(v1, 0xbee017a1, 0xbf3e0603, 0x3f1a339a, 0x3edf5b43, 0x3eb1f879, + 0x3f277380, 0x3f7e333e, 0xbea17473, 0xbf657f2b, 0x3ef3d4f5, + 0xbf2e8e35, 0x3f454e51, 0x3e4b0786, 0xbe267148, 0x3f50f5e9, + 0xbe798a90); + asm volatile("vfmacc.vf v1, %[A], v3" ::[A] "f"(dscalar_32)); + // -1.21056581, -0.87172520, -0.32018578, + // -0.47883448, 1.13200164, 1.40970242, 1.29810071, + // -0.73065352, -1.09256816, -0.14807191, -0.43899110, + // 0.32514536, 1.10469353, 0.21935931, 0.12733769, -0.10753576 + VCMP_U32(8, v1, 0xbf9af3d2, 0xbf5f2962, 0xbea3ef65, 0xbef529cb, 0x3f90e56e, + 0x3fb47121, 0x3fa6282b, 0xbf3b0c1c, 0xbf8bd946, 0xbe17a02a, + 0xbee0c371, 0x3ea67974, 0x3f8d6699, 0x3e609fb9, 0x3e0264cf, + 0xbddc3bb6); + + VSET(16, e64, m1); + // -0.1981785436218435, 0.2324321764718080, 0.3529425082887112, + // -0.4889737836823891, 0.1335009259637479, -0.7964186221277452, + // -0.2707335519445100, 0.8070543770008602, -0.1237072120160827, + // -0.2357903062216291, -0.0812498320849093, 0.8656662449573254, + // 0.7178262144151533, -0.3106178959409680, -0.1410836751949509, + // 0.6904294937898030 + VLOAD_64(v3, 0xbfc95dea1dcff710, 0x3fcdc0566a3e04a0, 0x3fd6969c2c9df760, + 0xbfdf4b58b2611a74, 0x3fc1168eef800078, 0xbfe97c42e7fed97a, + 0xbfd153b2d1e20588, 0x3fe9d363b369fec4, 0xbfbfab469de36f10, + 0xbfce2e6072f7c5c0, 0xbfb4ccc9fb9c3490, 0x3febb389b26af886, + 0x3fe6f86eae63fc74, 0xbfd3e129e2279a3c, 0xbfc20f07a57b1c48, + 0x3fe617ff9800ac5a); + double dscalar_64; + // 0.8738839355493300 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3febf6db7175e482); + // -0.9433584234417285, -0.0696473591160720, -0.8171557896146857, + // -0.9495656113293445, -0.6353537919969880, 0.8159507202507001, + // 0.0288919190409849, -0.6024741558584952, -0.9583084411212592, + // 0.7665070398551490, -0.7817863527411446, -0.2155326059803253, + // -0.7807395886866346, 0.2528540140694266, -0.1740695080779533, + // 0.7247829241803623 + VLOAD_64(v1, 0xbfee2ffe0122d3b6, 0xbfb1d468c9a80310, 0xbfea2623e6043a6c, + 0xbfee62d76bc21ae2, 0xbfe454d179c08866, 0x3fea1c44af53fb1a, + 0x3f9d95d7dd994d80, 0xbfe34777e1831e42, 0xbfeeaa7676c316f0, + 0x3fe88739c58a9cbe, 0xbfe90464d02f6f4c, 0xbfcb96928af41d88, + 0xbfe8fbd197034034, 0x3fd02ec29a45caf0, 0xbfc647e8de367aa0, + 0x3fe7316bf581b994); + asm volatile("vfmacc.vf v1, %[A], v3" ::[A] "f"(dscalar_64)); + // -1.1165434690834197, 0.1334713860074080, -0.5087250014486948, + // -1.3768719457941574, -0.5186894774163083, 0.1199732804009315, + // -0.2076977828175325, 0.1027976993173292, -1.0664141864137089, + // 0.5604536790898100, -0.8527892757662274, 0.5409592190351925, + // -0.1534427913930433, -0.0185899752875187, -0.2973602653990804, + // 1.3281381674327271 + VCMP_U64(9, v1, 0xbff1dd5caf44692a, 0x3fc1159722ed4311, 0xbfe04779a77c2679, + 0xbff607aae09f73e1, 0xbfe0991aacc90937, 0x3fbeb691a3b74133, + 0xbfca95d7485395ec, 0x3fba50f334ac0644, 0xbff11008526a327e, + 0x3fe1ef3c8dd3a2b9, 0xbfeb4a0cbc397482, 0x3fe14f89b5473a2f, + 0xbfc3a4036d6b8775, 0xbf9309401f92c802, 0xbfd307f359c13629, + 0x3ff5400dce9b1643); +}; + +// Simple random test with similar values (masked with scalar, values taken from +// TEST_CASE3) +void TEST_CASE4(void) { + VSET(16, e16, m1); + VLOAD_16(v3, 0x39ed, 0xb05e, 0x0000, 0xbad2, 0xad33, 0x3bb0, 0xb5fc, 0x347b, + 0x3bc1, 0x3679, 0x253e, 0xb867, 0x3933, 0x3727, 0xbb7d, 0xb715); + double dscalar_16; + BOX_HALF_IN_DOUBLE(dscalar_16, 0x389b); + VLOAD_16(v1, 0xb0b6, 0xbb20, 0x3331, 0x38e5, 0xadcf, 0xb929, 0xb855, 0x2a77, + 0xb75a, 0x2f68, 0xb597, 0x3956, 0xbbba, 0xb4b6, 0xba7a, 0xb562); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfmacc.vf v1, %[A], v3, v0.t" ::[A] "f"(dscalar_16)); + VCMP_U16(10, v1, 0xb0b6, 0xbbc1, 0x3331, 0x2fbf, 0xadcf, 0xade0, 0xb855, + 0x32c6, 0xb75a, 0x3594, 0xb597, 0x359a, 0xbbba, 0xa8bf, 0xba7a, + 0xb8bb); + + VSET(16, e32, m1); + VLOAD_32(v3, 0xbf4aa962, 0xbe07c535, 0xbf71e6ee, 0xbf6ff24b, 0x3f4dae80, + 0x3f4620d0, 0x3ea00507, 0xbed9cd2f, 0xbe4dad5d, 0xbf23b3b5, + 0x3e7ebb6b, 0xbee9ace6, 0x3f6dad4f, 0x3ec8479c, 0xbf34a4ae, + 0x3e0ecf23); + double dscalar_32; + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f79eed6); + VLOAD_32(v1, 0xbee017a1, 0xbf3e0603, 0x3f1a339a, 0x3edf5b43, 0x3eb1f879, + 0x3f277380, 0x3f7e333e, 0xbea17473, 0xbf657f2b, 0x3ef3d4f5, + 0xbf2e8e35, 0x3f454e51, 0x3e4b0786, 0xbe267148, 0x3f50f5e9, + 0xbe798a90); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfmacc.vf v1, %[A], v3, v0.t" ::[A] "f"(dscalar_32)); + VCMP_U32(11, v1, 0xbee017a1, 0xbf5f2962, 0x3f1a339a, 0xbef529cb, 0x3eb1f879, + 0x3fb47121, 0x3f7e333e, 0xbf3b0c1c, 0xbf657f2b, 0xbe17a02a, + 0xbf2e8e35, 0x3ea67974, 0x3e4b0786, 0x3e609fb9, 0x3f50f5e9, + 0xbddc3bb6); + + VSET(16, e64, m1); + VLOAD_64(v3, 0xbfc95dea1dcff710, 0x3fcdc0566a3e04a0, 0x3fd6969c2c9df760, + 0xbfdf4b58b2611a74, 0x3fc1168eef800078, 0xbfe97c42e7fed97a, + 0xbfd153b2d1e20588, 0x3fe9d363b369fec4, 0xbfbfab469de36f10, + 0xbfce2e6072f7c5c0, 0xbfb4ccc9fb9c3490, 0x3febb389b26af886, + 0x3fe6f86eae63fc74, 0xbfd3e129e2279a3c, 0xbfc20f07a57b1c48, + 0x3fe617ff9800ac5a); + double dscalar_64; + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3febf6db7175e482); + VLOAD_64(v1, 0xbfee2ffe0122d3b6, 0xbfb1d468c9a80310, 0xbfea2623e6043a6c, + 0xbfee62d76bc21ae2, 0xbfe454d179c08866, 0x3fea1c44af53fb1a, + 0x3f9d95d7dd994d80, 0xbfe34777e1831e42, 0xbfeeaa7676c316f0, + 0x3fe88739c58a9cbe, 0xbfe90464d02f6f4c, 0xbfcb96928af41d88, + 0xbfe8fbd197034034, 0x3fd02ec29a45caf0, 0xbfc647e8de367aa0, + 0x3fe7316bf581b994); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfmacc.vf v1, %[A], v3, v0.t" ::[A] "f"(dscalar_64)); + VCMP_U64(12, v1, 0xbfee2ffe0122d3b6, 0x3fc1159722ed4311, 0xbfea2623e6043a6c, + 0xbff607aae09f73e1, 0xbfe454d179c08866, 0x3fbeb691a3b74133, + 0x3f9d95d7dd994d80, 0x3fba50f334ac0644, 0xbfeeaa7676c316f0, + 0x3fe1ef3c8dd3a2b9, 0xbfe90464d02f6f4c, 0x3fe14f89b5473a2f, + 0xbfe8fbd197034034, 0xbf9309401f92c802, 0xbfc647e8de367aa0, + 0x3ff5400dce9b1643); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmadd.c b/apps/riscv-tests/isa/rv64uv/vfmadd.c new file mode 100644 index 0000000..cd61bfd --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmadd.c @@ -0,0 +1,433 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.3501, -0.3289, -0.8853, -0.4082, -0.4346, -0.2659, 0.9316, + // 0.5444, -0.0538, 0.7686, 0.8203, -0.8623, 0.3059, 0.0372, + // 0.5337, -0.5815 + VLOAD_16(v2, 0x359a, 0xb543, 0xbb15, 0xb688, 0xb6f4, 0xb441, 0x3b74, 0x385b, + 0xaae4, 0x3a26, 0x3a90, 0xbae6, 0x34e5, 0x28c4, 0x3845, 0xb8a7); + // -0.8105, 0.5000, -0.8374, -0.8394, 0.3098, 0.1328, -0.2864, + // -0.4041, -0.1729, 0.0196, 0.2739, 0.8071, -0.1553, 0.2815, + // -0.9067, -0.2495 + VLOAD_16(v3, 0xba7c, 0x3800, 0xbab3, 0xbab7, 0x34f5, 0x3040, 0xb495, 0xb677, + 0xb188, 0x2502, 0x3462, 0x3a75, 0xb0f8, 0x3481, 0xbb41, 0xb3fc); + // -0.6558, -0.1006, 0.4558, -0.0784, 0.1539, 0.6748, 0.3347, + // -0.3416, 0.0614, 0.2289, -0.0829, 0.3838, -0.6348, 0.0843, + // -0.6890, -0.2598 + VLOAD_16(v1, 0xb93f, 0xae71, 0x374b, 0xad05, 0x30ed, 0x3966, 0x355b, 0xb577, + 0x2bdc, 0x3353, 0xad4f, 0x3624, 0xb914, 0x2d65, 0xb983, 0xb428); + asm volatile("vfmadd.vv v1, v2, v3"); + // -1.0400, 0.5332, -1.2412, -0.8071, 0.2429, -0.0466, 0.0254, + // -0.5898, -0.1761, 0.1954, 0.2058, 0.4761, -0.3496, 0.2847, + // -1.2744, -0.0984 + VCMP_U16(1, v1, 0xbc29, 0x3844, 0xbcf7, 0xba75, 0x33c6, 0xa9f7, 0x2684, + 0xb8b8, 0xb1a3, 0x3241, 0x3297, 0x379e, 0xb597, 0x348e, 0xbd19, + 0xae4d); + + VSET(16, e32, m1); + // -0.20637949, -0.63321692, 0.40850523, 0.58702314, + // -0.25534528, -0.22053087, 0.96057665, 0.85530519, + // 0.74252450, -0.87175107, -0.00987994, -0.52556008, 0.26113954, + // -0.71307814, 0.78942811, 0.48685852 + VLOAD_32(v2, 0xbe535525, 0xbf221a81, 0x3ed12799, 0x3f164726, 0xbe82bc9e, + 0xbe61d2d8, 0x3f75e85a, 0x3f5af548, 0x3f3e1616, 0xbf5f2b14, + 0xbc21df78, 0xbf068b1b, 0x3e85b415, 0xbf368c4a, 0x3f4a17f6, + 0x3ef94585); + // -0.15712014, 0.83088422, 0.57509524, 0.85365236, + // -0.96695948, 0.71368766, 0.23281342, -0.67807233, + // 0.79363507, 0.62817359, 0.37205252, 0.27726358, + // -0.85021532, -0.16634122, -0.58148408, 0.06963744 + VLOAD_32(v3, 0xbe20e41a, 0x3f54b4d4, 0x3f133971, 0x3f5a88f6, 0xbf778aa8, + 0x3f36b43c, 0x3e6e66a4, 0xbf2d9626, 0x3f4b2bab, 0x3f20cffc, + 0x3ebe7dab, 0x3e8df57e, 0xbf59a7b6, 0xbe2a555a, 0xbf14dc24, + 0x3d8e9e13); + // -0.63061494, 0.57643133, 0.08198822, -0.06029604, + // -0.84276563, 0.00681775, 0.30881208, 0.27571887, + // 0.12349209, 0.29805747, -0.55497122, -0.52685922, 0.82809180, + // -0.83231467, 0.20959182, 0.15603130 + VLOAD_32(v1, 0xbf216ffb, 0x3f139101, 0x3da7e970, 0xbd76f8fa, 0xbf57bf7d, + 0x3bdf676d, 0x3e9e1c9e, 0x3e8d2b06, 0x3dfce96c, 0x3e989afd, + 0xbf0e1298, 0xbf06e03f, 0x3f53fdd3, 0xbf551293, 0x3e569f3d, + 0x3e1fc6ab); + asm volatile("vfmadd.vv v1, v2, v3"); + // -0.02697416, 0.46587816, 0.60858786, 0.81825721, + // -0.75176322, 0.71218413, 0.52945113, -0.44224855, + // 0.88533098, 0.36834168, 0.37753561, 0.55415976, + // -0.63396782, 0.42716417, -0.41602641, 0.14560261 + VCMP_U32(2, v1, 0xbcdcf8e5, 0x3eee8795, 0x3f1bcc6a, 0x3f51794e, 0xbf40738e, + 0x3f3651b3, 0x3f078a1b, 0xbee26e67, 0x3f62a50d, 0x3ebc9748, + 0x3ec14c59, 0x3f0ddd6a, 0xbf224bb7, 0x3edab544, 0xbed5016a, + 0x3e1518d9); + + VSET(16, e64, m1); + // 0.0308264568094008, 0.5865382185158325, 0.4543411851187289, + // 0.0036656924511687, -0.3103508259554966, 0.9658177901158624, + // -0.3381631341283657, -0.2003719333831677, 0.8989532087589025, + // -0.8054516243685412, 0.8701363884969631, + // -0.3585976675814562, 0.4150155349314333, + // -0.6908185611649824, 0.8412555125501906, -0.3357469205066645 + VLOAD_64(v2, 0x3f9f90f87f644880, 0x3fe2c4ebcc4c25b4, 0x3fdd13ed0cd3e484, + 0x3f6e0783a63d2400, 0xbfd3dcc9b5f0fd10, 0x3feee7fab5ce29f4, + 0xbfd5a476fc72d40c, 0xbfc9a5c99a756020, 0x3fecc43985081eb2, + 0xbfe9c6427c2588e6, 0x3febd8284474eda0, 0xbfd6f343a1abca7c, + 0x3fda8f9d51773268, 0xbfe61b2f86f58c4a, 0x3feaeb90ae3f72fc, + 0xbfd57ce0a6d3c3f8); + // 0.5881481456806663, -0.9882550591195853, -0.8483939717953815, + // -0.9684864200393222, -0.6743741213041285, 0.4372709704288931, + // -0.8339944484196176, -0.1519222509233684, + // -0.2540075520951832, 0.6661048539265222, 0.3013290199421905, + // -0.0367795249610035, -0.7178804756969177, 0.1577316726139908, + // -0.1242681642824526, -0.9006297759672148 + VLOAD_64(v3, 0x3fe2d21c0f5cd922, 0xbfef9fc912e0ce28, 0xbfeb260b1d5f82be, + 0xbfeefdd73b960c5a, 0xbfe594790988a396, 0x3fdbfc3f615edda8, + 0xbfeab01520204008, 0xbfc3723035a012c8, 0xbfd041a8e44be49c, + 0x3fe550bb206a47d8, 0x3fd348f9837f3238, 0xbfa2d4c411bd66e0, + 0xbfe6f8e079b1c412, 0x3fc4308d2bb5d1f0, 0xbfbfd009d586ef50, + 0xbfecd1f58932a7e4); + // -0.8344616273245185, 0.7077884806720691, -0.1882041492960900, + // -0.2751607560371576, 0.2338395078923734, -0.9938305657796487, + // -0.5345602642671559, 0.0887204597208056, 0.3045224871958914, + // -0.3946645040604191, 0.6818539464440989, 0.9719861381061521, + // -0.8471643748461517, 0.8077493118513845, 0.2789872574353331, + // 0.7073875082318823 + VLOAD_64(v1, 0xbfeab3e8dee4061e, 0x3fe6a634071f1b28, 0xbfc81712d5195ee0, + 0xbfd19c3bdc149f5c, 0x3fcdee73f7748a88, 0xbfefcd75c2393d96, + 0xbfe11b1e209897fa, 0x3fb6b66250fca870, 0x3fd37d4be2d9c9a4, + 0xbfd9422ee8753844, 0x3fe5d1bf5e1407b4, 0x3fef1a82ac6a99b4, + 0xbfeb1bf876899dc0, 0x3fe9d91515b8951c, 0x3fd1daed5eabdf0c, + 0x3fe6a2eb20ae8e42); + asm volatile("vfmadd.vv v1, v2, v3"); + // 0.5624246503668447, -0.5731100645801621, -0.9339028680308291, + // -0.9694950747455855, -0.7469464057195535, + // -0.5225882703620045, -0.6532258740745487, + // -0.1696993409682697, 0.0197439149088051, 0.9839880198025914, + // 0.8946349503834604, -0.3853314870073767, -1.0694668518985466, + // -0.4002765447811873, 0.1104314039662806, -1.1381329534609521 + VCMP_U64(3, v1, 0x3fe1ff61faf9464f, 0xbfe256eaeb0c2af6, 0xbfede288447aa80f, + 0xbfef061a88f54aac, 0xbfe7e6fc260dc471, 0xbfe0b90b094f4be7, + 0xbfe4e739f2c1a370, 0xbfc5b8b53fce44b1, 0x3f9437bfb3503463, + 0x3fef7cd47196a75e, 0x3feca0d979b82d6d, 0xbfd8a94565b434f4, + 0xbff11c894610f720, 0xbfd99e21834c3aa4, 0x3fbc453b847c8ddf, + 0xbff235cae659d5ba); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.3501, -0.3289, -0.8853, -0.4082, -0.4346, -0.2659, 0.9316, + // 0.5444, -0.0538, 0.7686, 0.8203, -0.8623, 0.3059, 0.0372, + // 0.5337, -0.5815 + VLOAD_16(v2, 0x359a, 0xb543, 0xbb15, 0xb688, 0xb6f4, 0xb441, 0x3b74, 0x385b, + 0xaae4, 0x3a26, 0x3a90, 0xbae6, 0x34e5, 0x28c4, 0x3845, 0xb8a7); + // -0.8105, 0.5000, -0.8374, -0.8394, 0.3098, 0.1328, -0.2864, + // -0.4041, -0.1729, 0.0196, 0.2739, 0.8071, -0.1553, 0.2815, + // -0.9067, -0.2495 + VLOAD_16(v3, 0xba7c, 0x3800, 0xbab3, 0xbab7, 0x34f5, 0x3040, 0xb495, 0xb677, + 0xb188, 0x2502, 0x3462, 0x3a75, 0xb0f8, 0x3481, 0xbb41, 0xb3fc); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.6558, -0.1006, 0.4558, -0.0784, 0.1539, 0.6748, 0.3347, + // -0.3416, 0.0614, 0.2289, -0.0829, 0.3838, -0.6348, 0.0843, + // -0.6890, -0.2598 + VLOAD_16(v1, 0xb93f, 0xae71, 0x374b, 0xad05, 0x30ed, 0x3966, 0x355b, 0xb577, + 0x2bdc, 0x3353, 0xad4f, 0x3624, 0xb914, 0x2d65, 0xb983, 0xb428); + asm volatile("vfmadd.vv v1, v2, v3, v0.t"); + VCMP_U16(4, v1, 0xb93f, 0x3844, 0x374b, 0xba75, 0x30ed, 0xa9f7, 0x355b, + 0xb8b8, 0x2bdc, 0x3241, 0xad4f, 0x379e, 0xb914, 0x348e, 0xb983, + 0xae4d); + + VSET(16, e32, m1); + // -0.20637949, -0.63321692, 0.40850523, 0.58702314, + // -0.25534528, -0.22053087, 0.96057665, 0.85530519, + // 0.74252450, -0.87175107, -0.00987994, -0.52556008, 0.26113954, + // -0.71307814, 0.78942811, 0.48685852 + VLOAD_32(v2, 0xbe535525, 0xbf221a81, 0x3ed12799, 0x3f164726, 0xbe82bc9e, + 0xbe61d2d8, 0x3f75e85a, 0x3f5af548, 0x3f3e1616, 0xbf5f2b14, + 0xbc21df78, 0xbf068b1b, 0x3e85b415, 0xbf368c4a, 0x3f4a17f6, + 0x3ef94585); + // -0.15712014, 0.83088422, 0.57509524, 0.85365236, + // -0.96695948, 0.71368766, 0.23281342, -0.67807233, + // 0.79363507, 0.62817359, 0.37205252, 0.27726358, + // -0.85021532, -0.16634122, -0.58148408, 0.06963744 + VLOAD_32(v3, 0xbe20e41a, 0x3f54b4d4, 0x3f133971, 0x3f5a88f6, 0xbf778aa8, + 0x3f36b43c, 0x3e6e66a4, 0xbf2d9626, 0x3f4b2bab, 0x3f20cffc, + 0x3ebe7dab, 0x3e8df57e, 0xbf59a7b6, 0xbe2a555a, 0xbf14dc24, + 0x3d8e9e13); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.63061494, 0.57643133, 0.08198822, -0.06029604, + // -0.84276563, 0.00681775, 0.30881208, 0.27571887, + // 0.12349209, 0.29805747, -0.55497122, -0.52685922, 0.82809180, + // -0.83231467, 0.20959182, 0.15603130 + VLOAD_32(v1, 0xbf216ffb, 0x3f139101, 0x3da7e970, 0xbd76f8fa, 0xbf57bf7d, + 0x3bdf676d, 0x3e9e1c9e, 0x3e8d2b06, 0x3dfce96c, 0x3e989afd, + 0xbf0e1298, 0xbf06e03f, 0x3f53fdd3, 0xbf551293, 0x3e569f3d, + 0x3e1fc6ab); + asm volatile("vfmadd.vv v1, v2, v3, v0.t"); + VCMP_U32(5, v1, 0xbf216ffb, 0x3eee8795, 0x3da7e970, 0x3f51794e, 0xbf57bf7d, + 0x3f3651b3, 0x3e9e1c9e, 0xbee26e67, 0x3dfce96c, 0x3ebc9748, + 0xbf0e1298, 0x3f0ddd6a, 0x3f53fdd3, 0x3edab544, 0x3e569f3d, + 0x3e1518d9); + + VSET(16, e64, m1); + // 0.0308264568094008, 0.5865382185158325, 0.4543411851187289, + // 0.0036656924511687, -0.3103508259554966, 0.9658177901158624, + // -0.3381631341283657, -0.2003719333831677, 0.8989532087589025, + // -0.8054516243685412, 0.8701363884969631, + // -0.3585976675814562, 0.4150155349314333, + // -0.6908185611649824, 0.8412555125501906, -0.3357469205066645 + VLOAD_64(v2, 0x3f9f90f87f644880, 0x3fe2c4ebcc4c25b4, 0x3fdd13ed0cd3e484, + 0x3f6e0783a63d2400, 0xbfd3dcc9b5f0fd10, 0x3feee7fab5ce29f4, + 0xbfd5a476fc72d40c, 0xbfc9a5c99a756020, 0x3fecc43985081eb2, + 0xbfe9c6427c2588e6, 0x3febd8284474eda0, 0xbfd6f343a1abca7c, + 0x3fda8f9d51773268, 0xbfe61b2f86f58c4a, 0x3feaeb90ae3f72fc, + 0xbfd57ce0a6d3c3f8); + // 0.5881481456806663, -0.9882550591195853, -0.8483939717953815, + // -0.9684864200393222, -0.6743741213041285, 0.4372709704288931, + // -0.8339944484196176, -0.1519222509233684, + // -0.2540075520951832, 0.6661048539265222, 0.3013290199421905, + // -0.0367795249610035, -0.7178804756969177, 0.1577316726139908, + // -0.1242681642824526, -0.9006297759672148 + VLOAD_64(v3, 0x3fe2d21c0f5cd922, 0xbfef9fc912e0ce28, 0xbfeb260b1d5f82be, + 0xbfeefdd73b960c5a, 0xbfe594790988a396, 0x3fdbfc3f615edda8, + 0xbfeab01520204008, 0xbfc3723035a012c8, 0xbfd041a8e44be49c, + 0x3fe550bb206a47d8, 0x3fd348f9837f3238, 0xbfa2d4c411bd66e0, + 0xbfe6f8e079b1c412, 0x3fc4308d2bb5d1f0, 0xbfbfd009d586ef50, + 0xbfecd1f58932a7e4); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.8344616273245185, 0.7077884806720691, -0.1882041492960900, + // -0.2751607560371576, 0.2338395078923734, -0.9938305657796487, + // -0.5345602642671559, 0.0887204597208056, 0.3045224871958914, + // -0.3946645040604191, 0.6818539464440989, 0.9719861381061521, + // -0.8471643748461517, 0.8077493118513845, 0.2789872574353331, + // 0.7073875082318823 + VLOAD_64(v1, 0xbfeab3e8dee4061e, 0x3fe6a634071f1b28, 0xbfc81712d5195ee0, + 0xbfd19c3bdc149f5c, 0x3fcdee73f7748a88, 0xbfefcd75c2393d96, + 0xbfe11b1e209897fa, 0x3fb6b66250fca870, 0x3fd37d4be2d9c9a4, + 0xbfd9422ee8753844, 0x3fe5d1bf5e1407b4, 0x3fef1a82ac6a99b4, + 0xbfeb1bf876899dc0, 0x3fe9d91515b8951c, 0x3fd1daed5eabdf0c, + 0x3fe6a2eb20ae8e42); + asm volatile("vfmadd.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, -0.5731100645801621, 0.0000000000000000, + // -0.9694950747455855, 0.0000000000000000, + // -0.5225882703620045, 0.0000000000000000, + // -0.1696993409682697, 0.0000000000000000, 0.9839880198025914, + // 0.0000000000000000, -0.3853314870073767, 0.0000000000000000, + // -0.4002765447811873, 0.0000000000000000, -1.1381329534609521 + VCMP_U64(6, v1, 0xbfeab3e8dee4061e, 0xbfe256eaeb0c2af6, 0xbfc81712d5195ee0, + 0xbfef061a88f54aac, 0x3fcdee73f7748a88, 0xbfe0b90b094f4be7, + 0xbfe11b1e209897fa, 0xbfc5b8b53fce44b1, 0x3fd37d4be2d9c9a4, + 0x3fef7cd47196a75e, 0x3fe5d1bf5e1407b4, 0xbfd8a94565b434f4, + 0xbfeb1bf876899dc0, 0xbfd99e21834c3aa4, 0x3fd1daed5eabdf0c, + 0xbff235cae659d5ba); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.6299 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x390a); + // -0.5352, 0.1115, 0.9541, -0.8857, -0.4143, 0.4045, 0.2949, + // -0.5479, 0.6733, 0.8965, 0.8882, 0.6294, 0.7568, 0.8735, + // -0.8569, 0.8271 + VLOAD_16(v2, 0xb848, 0x2f23, 0x3ba2, 0xbb16, 0xb6a1, 0x3679, 0x34b8, 0xb862, + 0x3963, 0x3b2c, 0x3b1b, 0x3909, 0x3a0e, 0x3afd, 0xbadb, 0x3a9e); + // 0.2844, 0.1008, 0.3777, 0.9790, -0.8613, 0.4951, 0.4126, + // 0.5518, -0.6680, -0.8340, 0.2094, 0.5884, -0.6509, -0.9360, + // -0.1609, -0.2527 + VLOAD_16(v1, 0x348d, 0x2e74, 0x360b, 0x3bd5, 0xbae4, 0x37ec, 0x369a, 0x386a, + 0xb958, 0xbaac, 0x32b3, 0x38b5, 0xb935, 0xbb7d, 0xb126, 0xb40b); + asm volatile("vfmadd.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.3560, 0.1750, 1.1924, -0.2690, -0.9570, 0.7163, 0.5547, + // -0.2002, 0.2527, 0.3711, 1.0195, 1.0000, 0.3469, 0.2842, + // -0.9580, 0.6680 + VCMP_U16(7, v1, 0xb5b2, 0x319a, 0x3cc5, 0xb44e, 0xbba8, 0x39bb, 0x3870, + 0xb269, 0x340b, 0x35f0, 0x3c15, 0x3c00, 0x358d, 0x348b, 0xbbab, + 0x3958); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80368215 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4dbe1d); + // 0.13072050, -0.19741143, 0.09370349, 0.41049519, + // -0.69910282, -0.90573430, 0.86481184, 0.33341369, + // 0.30657578, -0.90526944, -0.97891974, -0.50830764, + // 0.79750061, 0.96885878, 0.48752418, 0.64305341 + VLOAD_32(v2, 0x3e05db98, 0xbe4a2639, 0x3dbfe79e, 0x3ed22c6d, 0xbf32f867, + 0xbf67de34, 0x3f5d644f, 0x3eaab533, 0x3e9cf780, 0xbf67bfbd, + 0xbf7a9a7c, 0xbf022073, 0x3f4c2900, 0x3f780721, 0x3ef99cc5, + 0x3f249f26); + // -0.61117887, 0.81778014, -0.46267223, -0.30897874, + // -0.84296966, 0.50125730, 0.96147668, 0.65802389, + // 0.19629262, -0.73197508, -0.06948850, -0.60436314, + // -0.80817568, 0.72047287, -0.78180677, -0.40237895 + VLOAD_32(v1, 0xbf1c7638, 0x3f515a0a, 0xbeece360, 0xbe9e3276, 0xbf57ccdc, + 0x3f005266, 0x3f762356, 0x3f287441, 0x3e4900ef, 0xbf3b62b8, + 0xbd8e4ffc, 0xbf1ab78b, 0xbf4ee49a, 0x3f3870e9, 0xbf48247d, + 0xbece049d); + asm volatile("vfmadd.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // -0.36047307, 0.45982391, -0.27813792, 0.16217449, + // -1.37658250, -0.50288272, 1.63753343, 0.86225569, + // 0.46433264, -1.49354482, -1.03476644, -0.99402350, 0.14798427, + // 1.54788995, -0.14079997, 0.31966865 + VCMP_U32(8, v1, 0xbeb88fed, 0x3eeb6e09, 0xbe8e6818, 0x3e261112, 0xbfb033db, + 0xbf00bced, 0x3fd19ab2, 0x3f5cbccb, 0x3eedbd02, 0xbfbf2c79, + 0xbf84733a, 0xbf7e7853, 0x3e17892e, 0x3fc62142, 0xbe102ddd, + 0x3ea3ab9c); + + VSET(16, e64, m1); + double dscalar_64; + // 0.5717861827636179 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fe24c128968c808); + // -0.0978999279373105, -0.8066508697961206, 0.1001298330116740, + // 0.6183499729699258, -0.7091158569428311, 0.4713309006442494, + // -0.9363173157138223, 0.6720957973877764, + // -0.1684678230133414, -0.0206783343753454, + // -0.6941474840922310, 0.4809970389518419, + // -0.4671263490725479, 0.5176516826232249, + // -0.9714116214357187, 0.0212574845134876 + VLOAD_64(v2, 0xbfb90ff83cc58160, 0xbfe9d0157c220eae, 0x3fb9a21bd6239ad0, + 0x3fe3c985e1ec6d14, 0xbfe6b113bcd49f88, 0x3fde2a4914f71f28, + 0xbfedf64fbb356b82, 0x3fe581cf0bb1e7c4, 0xbfc5905a8722a398, + 0xbf952cb38782ee00, 0xbfe63674c8d8dba6, 0x3fdec8a7cdf1580c, + 0xbfdde565ea17744c, 0x3fe0909a42f2c184, 0xbfef15cdd320a9f0, + 0x3f95c485a31f6440); + // -0.8599787754583945, -0.8609648323347547, + // -0.5642848553711928, 0.8958493001041692, 0.3661374487395561, + // 0.1017901385891375, 0.2298954297904690, -0.4970717320718749, + // -0.5860844501192310, -0.6581386742527398, + // -0.8379133193505066, -0.6497652150347000, + // -0.4444119628309799, -0.8810041425660891, 0.4421772814931029, + // 0.0606105644967410 + VLOAD_64(v1, 0xbfeb84f2357b2242, 0xbfeb8d061ebc48de, 0xbfe20e9f1cee50cc, + 0x3fecaacc26c2f0d0, 0x3fd76ecbc40b5864, 0x3fba0eeb244baff0, + 0x3fcd6d36a4399740, 0xbfdfd005f440f21c, 0xbfe2c1342d3e9986, + 0xbfe50f78d644befe, 0xbfead02f97efc88a, 0xbfe4cae06b94e0d2, + 0xbfdc713edf93dac0, 0xbfec312f997ec7ac, 0x3fdc4ca1f0c30314, + 0x3faf0859109c77c0); + asm volatile("vfmadd.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // -0.5896239092143964, -1.2989386647705283, -0.2225204504323405, + // 1.1305842246079476, -0.4997635227612305, 0.5295330954311120, + // -0.8048662854791286, 0.3878770491466992, -0.5035828135241305, + // -0.3969929346554276, -1.1732547424504496, 0.1094702669545694, + // -0.7212349688741608, 0.0139056869464266, -0.7185807615459836, + // 0.0559137678222272 + VCMP_U64(9, v1, 0xbfe2de32f5e07f06, 0xbff4c873e8cb3071, 0xbfcc7b8cd4a627de, + 0x3ff216df7be108d1, 0xbfdffc20247f9130, 0x3fe0f1ef63e0d73b, + 0xbfe9c176f0b925be, 0x3fd8d2fa423d0f48, 0xbfe01d59b45d3de9, + 0xbfd968550dc5a3de, 0xbff2c5a6c3cb39b0, 0x3fbc063e50744ab8, + 0xbfe7145b5b8179a4, 0x3f8c7a95b54e78da, 0xbfe6fe9d14cbfe26, + 0x3faca0bab8629cdd); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.6299 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x390a); + // -0.5352, 0.1115, 0.9541, -0.8857, -0.4143, 0.4045, 0.2949, + // -0.5479, 0.6733, 0.8965, 0.8882, 0.6294, 0.7568, 0.8735, + // -0.8569, 0.8271 + VLOAD_16(v2, 0xb848, 0x2f23, 0x3ba2, 0xbb16, 0xb6a1, 0x3679, 0x34b8, 0xb862, + 0x3963, 0x3b2c, 0x3b1b, 0x3909, 0x3a0e, 0x3afd, 0xbadb, 0x3a9e); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.2844, 0.1008, 0.3777, 0.9790, -0.8613, 0.4951, 0.4126, + // 0.5518, -0.6680, -0.8340, 0.2094, 0.5884, -0.6509, + // -0.9360, -0.1609, -0.2527 + VLOAD_16(v1, 0x348d, 0x2e74, 0x360b, 0x3bd5, 0xbae4, 0x37ec, 0x369a, 0x386a, + 0xb958, 0xbaac, 0x32b3, 0x38b5, 0xb935, 0xbb7d, 0xb126, 0xb40b); + asm volatile("vfmadd.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + VCMP_U16(10, v1, 0x348d, 0x319a, 0x360b, 0xb44e, 0xbae4, 0x39bb, 0x369a, + 0xb269, 0xb958, 0x35f0, 0x32b3, 0x3c00, 0xb935, 0x348b, 0xb126, + 0x3958); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80368215 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4dbe1d); + // 0.13072050, -0.19741143, 0.09370349, 0.41049519, + // -0.69910282, -0.90573430, 0.86481184, 0.33341369, + // 0.30657578, -0.90526944, -0.97891974, -0.50830764, + // 0.79750061, 0.96885878, 0.48752418, 0.64305341 + VLOAD_32(v2, 0x3e05db98, 0xbe4a2639, 0x3dbfe79e, 0x3ed22c6d, 0xbf32f867, + 0xbf67de34, 0x3f5d644f, 0x3eaab533, 0x3e9cf780, 0xbf67bfbd, + 0xbf7a9a7c, 0xbf022073, 0x3f4c2900, 0x3f780721, 0x3ef99cc5, + 0x3f249f26); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.61117887, 0.81778014, -0.46267223, -0.30897874, + // -0.84296966, 0.50125730, 0.96147668, 0.65802389, + // 0.19629262, -0.73197508, -0.06948850, -0.60436314, + // -0.80817568, 0.72047287, -0.78180677, -0.40237895 + VLOAD_32(v1, 0xbf1c7638, 0x3f515a0a, 0xbeece360, 0xbe9e3276, 0xbf57ccdc, + 0x3f005266, 0x3f762356, 0x3f287441, 0x3e4900ef, 0xbf3b62b8, + 0xbd8e4ffc, 0xbf1ab78b, 0xbf4ee49a, 0x3f3870e9, 0xbf48247d, + 0xbece049d); + asm volatile("vfmadd.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + VCMP_U32(11, v1, 0xbf1c7638, 0x3eeb6e09, 0xbeece360, 0x3e261112, 0xbf57ccdc, + 0xbf00bced, 0x3f762356, 0x3f5cbccb, 0x3e4900ef, 0xbfbf2c79, + 0xbd8e4ffc, 0xbf7e7853, 0xbf4ee49a, 0x3fc62142, 0xbf48247d, + 0x3ea3ab9c); + + VSET(16, e64, m1); + double dscalar_64; + // 0.5717861827636179 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fe24c128968c808); + // -0.0978999279373105, -0.8066508697961206, + // 0.1001298330116740, 0.6183499729699258, + // -0.7091158569428311, 0.4713309006442494, + // -0.9363173157138223, 0.6720957973877764, + // -0.1684678230133414, -0.0206783343753454, + // -0.6941474840922310, 0.4809970389518419, + // -0.4671263490725479, 0.5176516826232249, + // -0.9714116214357187, 0.0212574845134876 + VLOAD_64(v2, 0xbfb90ff83cc58160, 0xbfe9d0157c220eae, 0x3fb9a21bd6239ad0, + 0x3fe3c985e1ec6d14, 0xbfe6b113bcd49f88, 0x3fde2a4914f71f28, + 0xbfedf64fbb356b82, 0x3fe581cf0bb1e7c4, 0xbfc5905a8722a398, + 0xbf952cb38782ee00, 0xbfe63674c8d8dba6, 0x3fdec8a7cdf1580c, + 0xbfdde565ea17744c, 0x3fe0909a42f2c184, 0xbfef15cdd320a9f0, + 0x3f95c485a31f6440); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.8599787754583945, -0.8609648323347547, + // -0.5642848553711928, 0.8958493001041692, + // 0.3661374487395561, 0.1017901385891375, 0.2298954297904690, + // -0.4970717320718749, -0.5860844501192310, + // -0.6581386742527398, -0.8379133193505066, + // -0.6497652150347000, -0.4444119628309799, + // -0.8810041425660891, 0.4421772814931029, 0.0606105644967410 + VLOAD_64(v1, 0xbfeb84f2357b2242, 0xbfeb8d061ebc48de, 0xbfe20e9f1cee50cc, + 0x3fecaacc26c2f0d0, 0x3fd76ecbc40b5864, 0x3fba0eeb244baff0, + 0x3fcd6d36a4399740, 0xbfdfd005f440f21c, 0xbfe2c1342d3e9986, + 0xbfe50f78d644befe, 0xbfead02f97efc88a, 0xbfe4cae06b94e0d2, + 0xbfdc713edf93dac0, 0xbfec312f997ec7ac, 0x3fdc4ca1f0c30314, + 0x3faf0859109c77c0); + asm volatile("vfmadd.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + VCMP_U64(12, v1, 0xbfeb84f2357b2242, 0xbff4c873e8cb3071, 0xbfe20e9f1cee50cc, + 0x3ff216df7be108d1, 0x3fd76ecbc40b5864, 0x3fe0f1ef63e0d73b, + 0x3fcd6d36a4399740, 0x3fd8d2fa423d0f48, 0xbfe2c1342d3e9986, + 0xbfd968550dc5a3de, 0xbfead02f97efc88a, 0x3fbc063e50744ab8, + 0xbfdc713edf93dac0, 0x3f8c7a95b54e78da, 0x3fdc4ca1f0c30314, + 0x3faca0bab8629cdd); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmax.c b/apps/riscv-tests/isa/rv64uv/vfmax.c new file mode 100644 index 0000000..732e9eb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmax.c @@ -0,0 +1,351 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.0445, -0.4812, 0.5732, 0.0634, 0.2072, -0.6416, 0.7759, + // -0.0042, 0.6138, 0.7847, -0.5337, 0.3455, 0.0304, 0.7920, + // 0.8179, -0.5659 + VLOAD_16(v2, 0x29b3, 0xb7b3, 0x3896, 0x2c0f, 0x32a1, 0xb922, 0x3a35, 0x9c4d, + 0x38e9, 0x3a47, 0xb845, 0x3587, 0x27ca, 0x3a56, 0x3a8b, 0xb887); + // 0.6426, -0.4099, -0.1183, 0.2915, 0.5972, -0.1932, -0.0265, + // -0.5913, -0.8560, 0.5029, -0.8975, -0.7373, 0.3701, 0.9546, + // -0.2671, -0.6855 + VLOAD_16(v3, 0x3924, 0xb68f, 0xaf93, 0x34aa, 0x38c7, 0xb22f, 0xa6c7, 0xb8bb, + 0xbad9, 0x3806, 0xbb2e, 0xb9e6, 0x35ec, 0x3ba3, 0xb446, 0xb97c); + asm volatile("vfmax.vv v1, v2, v3"); + // 0.6426, -0.4099, 0.5732, 0.2915, 0.5972, -0.1932, 0.7759, + // -0.0042, 0.6138, 0.7847, -0.5337, 0.3455, 0.3701, 0.9546, + // 0.8179, -0.5659 + VCMP_U16(1, v1, 0x3924, 0xb68f, 0x3896, 0x34aa, 0x38c7, 0xb22f, 0x3a35, + 0x9c4d, 0x38e9, 0x3a47, 0xb845, 0x3587, 0x35ec, 0x3ba3, 0x3a8b, + 0xb887); + + VSET(16, e32, m1); + // -0.19589283, 0.64597517, -0.09556163, 0.96582597, + // 0.93413597, 0.78331935, -0.18831402, -0.29520443, 0.09486515, + // 0.96548969, 0.74523991, 0.81442171, 0.25644442, + // -0.92091519, 0.25139943, -0.77403748 + VLOAD_32(v2, 0xbe489821, 0x3f255ea1, 0xbdc3b5d1, 0x3f77405f, 0x3f6f2389, + 0x3f48879e, 0xbe40d564, 0xbe972509, 0x3dc248a9, 0x3f772a55, + 0x3f3ec80b, 0x3f507df1, 0x3e834caf, 0xbf6bc119, 0x3e80b76d, + 0xbf462752); + // -0.58921623, 0.69345474, 0.64817399, -0.00869324, + // 0.15872470, -0.17028977, -0.99863762, -0.02739566, + // -0.08060763, 0.73060948, 0.62843031, 0.68798363, + // -0.35207590, 0.01353026, 0.25345275, -0.93635505 + VLOAD_32(v3, 0xbf16d6e0, 0x3f318640, 0x3f25eebb, 0xbc0e6e1c, 0x3e2288ba, + 0xbe2e6071, 0xbf7fa6b7, 0xbce06cdd, 0xbda5159d, 0x3f3b0939, + 0x3f20e0cf, 0x3f301fb2, 0xbeb4434b, 0x3c5dae02, 0x3e81c48f, + 0xbf6fb4f7); + asm volatile("vfmax.vv v1, v2, v3"); + // -0.19589283, 0.69345474, 0.64817399, 0.96582597, + // 0.93413597, 0.78331935, -0.18831402, -0.02739566, 0.09486515, + // 0.96548969, 0.74523991, 0.81442171, 0.25644442, 0.01353026, + // 0.25345275, -0.77403748 + VCMP_U32(2, v1, 0xbe489821, 0x3f318640, 0x3f25eebb, 0x3f77405f, 0x3f6f2389, + 0x3f48879e, 0xbe40d564, 0xbce06cdd, 0x3dc248a9, 0x3f772a55, + 0x3f3ec80b, 0x3f507df1, 0x3e834caf, 0x3c5dae02, 0x3e81c48f, + 0xbf462752); + + VSET(16, e64, m1); + // -0.4061329687298849, -0.2985478109200665, 0.0070087316277823, + // -0.2169778494878496, -0.8530745559533048, -0.1247477743553222, + // 0.5680045000966327, 0.9515829310663801, -0.9797693611753244, + // 0.0055288881366042, 0.3717566019240965, 0.0982171502328268, + // -0.1563664923399100, 0.9555697921812856, 0.4810293698835877, + // -0.1835757691555060 + VLOAD_64(v2, 0xbfd9fe1522a16c7c, 0xbfd31b68470c6bc4, 0x3f7cb530120b5400, + 0xbfcbc5ee1fc0dc58, 0xbfeb4c6302dbd036, 0xbfbfef785b1ada80, + 0x3fe22d17c5fcaaf0, 0x3fee735e0c0b94e4, 0xbfef5a45467bddd8, + 0x3f76a5759bade800, 0x3fd7cadc33d5826c, 0x3fb924c2582803f0, + 0xbfc403d135652390, 0x3fee940719ceda38, 0x3fdec92f69043118, + 0xbfc77f692a6e3368); + // -0.5461826062085420, -0.4431702866722571, -0.7458438472286320, + // -0.8611805160192025, 0.5288841839862100, 0.4836992661145783, + // -0.5942889927274901, 0.5287333894552471, 0.3093279352228719, + // -0.5415645292681506, 0.0094485111801912, -0.2151605186231076, + // -0.0785069829906857, 0.6345480854408712, 0.4658290296396683, + // -0.5143497066150833 + VLOAD_64(v3, 0xbfe17a53f1e9e958, 0xbfdc5ce6e7f43e14, 0xbfe7ddf3ea78a228, + 0xbfeb8eca710827f8, 0x3fe0ec9e8632f518, 0x3fdef4edc443ec94, + 0xbfe3046a59846530, 0x3fe0eb6249006ebc, 0x3fd3cc0765615f4c, + 0xbfe1547f22bc2bc2, 0x3f8359bdb41e5580, 0xbfcb8a613f7035f0, + 0xbfb419089c73df20, 0x3fe44e37c956a792, 0x3fddd0248ff51b48, + 0xbfe0758d8413ceaa); + asm volatile("vfmax.vv v1, v2, v3"); + // -0.4061329687298849, -0.2985478109200665, 0.0070087316277823, + // -0.2169778494878496, 0.5288841839862100, 0.4836992661145783, + // 0.5680045000966327, 0.9515829310663801, 0.3093279352228719, + // 0.0055288881366042, 0.3717566019240965, 0.0982171502328268, + // -0.0785069829906857, 0.9555697921812856, 0.4810293698835877, + // -0.1835757691555060 + VCMP_U64(3, v1, 0xbfd9fe1522a16c7c, 0xbfd31b68470c6bc4, 0x3f7cb530120b5400, + 0xbfcbc5ee1fc0dc58, 0x3fe0ec9e8632f518, 0x3fdef4edc443ec94, + 0x3fe22d17c5fcaaf0, 0x3fee735e0c0b94e4, 0x3fd3cc0765615f4c, + 0x3f76a5759bade800, 0x3fd7cadc33d5826c, 0x3fb924c2582803f0, + 0xbfb419089c73df20, 0x3fee940719ceda38, 0x3fdec92f69043118, + 0xbfc77f692a6e3368); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.0445, -0.4812, 0.5732, 0.0634, 0.2072, -0.6416, 0.7759, + // -0.0042, 0.6138, 0.7847, -0.5337, 0.3455, 0.0304, 0.7920, + // 0.8179, -0.5659 + VLOAD_16(v2, 0x29b3, 0xb7b3, 0x3896, 0x2c0f, 0x32a1, 0xb922, 0x3a35, 0x9c4d, + 0x38e9, 0x3a47, 0xb845, 0x3587, 0x27ca, 0x3a56, 0x3a8b, 0xb887); + // 0.6426, -0.4099, -0.1183, 0.2915, 0.5972, -0.1932, -0.0265, + // -0.5913, -0.8560, 0.5029, -0.8975, -0.7373, 0.3701, 0.9546, + // -0.2671, -0.6855 + VLOAD_16(v3, 0x3924, 0xb68f, 0xaf93, 0x34aa, 0x38c7, 0xb22f, 0xa6c7, 0xb8bb, + 0xbad9, 0x3806, 0xbb2e, 0xb9e6, 0x35ec, 0x3ba3, 0xb446, 0xb97c); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmax.vv v1, v2, v3, v0.t"); + // 0.0000, -0.4099, 0.0000, 0.2915, 0.0000, -0.1932, 0.0000, + // -0.0042, 0.0000, 0.7847, 0.0000, 0.3455, 0.0000, 0.9546, + // 0.0000, -0.5659 + VCMP_U16(4, v1, 0x0, 0xb68f, 0x0, 0x34aa, 0x0, 0xb22f, 0x0, 0x9c4d, 0x0, + 0x3a47, 0x0, 0x3587, 0x0, 0x3ba3, 0x0, 0xb887); + + VSET(16, e32, m1); + // -0.19589283, 0.64597517, -0.09556163, 0.96582597, + // 0.93413597, 0.78331935, -0.18831402, -0.29520443, 0.09486515, + // 0.96548969, 0.74523991, 0.81442171, 0.25644442, + // -0.92091519, 0.25139943, -0.77403748 + VLOAD_32(v2, 0xbe489821, 0x3f255ea1, 0xbdc3b5d1, 0x3f77405f, 0x3f6f2389, + 0x3f48879e, 0xbe40d564, 0xbe972509, 0x3dc248a9, 0x3f772a55, + 0x3f3ec80b, 0x3f507df1, 0x3e834caf, 0xbf6bc119, 0x3e80b76d, + 0xbf462752); + // -0.58921623, 0.69345474, 0.64817399, -0.00869324, + // 0.15872470, -0.17028977, -0.99863762, -0.02739566, + // -0.08060763, 0.73060948, 0.62843031, 0.68798363, + // -0.35207590, 0.01353026, 0.25345275, -0.93635505 + VLOAD_32(v3, 0xbf16d6e0, 0x3f318640, 0x3f25eebb, 0xbc0e6e1c, 0x3e2288ba, + 0xbe2e6071, 0xbf7fa6b7, 0xbce06cdd, 0xbda5159d, 0x3f3b0939, + 0x3f20e0cf, 0x3f301fb2, 0xbeb4434b, 0x3c5dae02, 0x3e81c48f, + 0xbf6fb4f7); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmax.vv v1, v2, v3, v0.t"); + // 0.00000000, 0.69345474, 0.00000000, 0.96582597, + // 0.00000000, 0.78331935, 0.00000000, -0.02739566, + // 0.00000000, 0.96548969, 0.00000000, 0.81442171, + // 0.00000000, 0.01353026, 0.00000000, -0.77403748 + VCMP_U32(5, v1, 0x0, 0x3f318640, 0x0, 0x3f77405f, 0x0, 0x3f48879e, 0x0, + 0xbce06cdd, 0x0, 0x3f772a55, 0x0, 0x3f507df1, 0x0, 0x3c5dae02, 0x0, + 0xbf462752); + + VSET(16, e64, m1); + // -0.4061329687298849, -0.2985478109200665, 0.0070087316277823, + // -0.2169778494878496, -0.8530745559533048, -0.1247477743553222, + // 0.5680045000966327, 0.9515829310663801, -0.9797693611753244, + // 0.0055288881366042, 0.3717566019240965, 0.0982171502328268, + // -0.1563664923399100, 0.9555697921812856, 0.4810293698835877, + // -0.1835757691555060 + VLOAD_64(v2, 0xbfd9fe1522a16c7c, 0xbfd31b68470c6bc4, 0x3f7cb530120b5400, + 0xbfcbc5ee1fc0dc58, 0xbfeb4c6302dbd036, 0xbfbfef785b1ada80, + 0x3fe22d17c5fcaaf0, 0x3fee735e0c0b94e4, 0xbfef5a45467bddd8, + 0x3f76a5759bade800, 0x3fd7cadc33d5826c, 0x3fb924c2582803f0, + 0xbfc403d135652390, 0x3fee940719ceda38, 0x3fdec92f69043118, + 0xbfc77f692a6e3368); + // -0.5461826062085420, -0.4431702866722571, -0.7458438472286320, + // -0.8611805160192025, 0.5288841839862100, 0.4836992661145783, + // -0.5942889927274901, 0.5287333894552471, 0.3093279352228719, + // -0.5415645292681506, 0.0094485111801912, -0.2151605186231076, + // -0.0785069829906857, 0.6345480854408712, 0.4658290296396683, + // -0.5143497066150833 + VLOAD_64(v3, 0xbfe17a53f1e9e958, 0xbfdc5ce6e7f43e14, 0xbfe7ddf3ea78a228, + 0xbfeb8eca710827f8, 0x3fe0ec9e8632f518, 0x3fdef4edc443ec94, + 0xbfe3046a59846530, 0x3fe0eb6249006ebc, 0x3fd3cc0765615f4c, + 0xbfe1547f22bc2bc2, 0x3f8359bdb41e5580, 0xbfcb8a613f7035f0, + 0xbfb419089c73df20, 0x3fe44e37c956a792, 0x3fddd0248ff51b48, + 0xbfe0758d8413ceaa); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmax.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, -0.2985478109200665, 0.0000000000000000, + // -0.2169778494878496, 0.0000000000000000, 0.4836992661145783, + // 0.0000000000000000, 0.9515829310663801, 0.0000000000000000, + // 0.0055288881366042, 0.0000000000000000, 0.0982171502328268, + // 0.0000000000000000, 0.9555697921812856, 0.0000000000000000, + // -0.1835757691555060 + VCMP_U64(6, v1, 0x0, 0xbfd31b68470c6bc4, 0x0, 0xbfcbc5ee1fc0dc58, 0x0, + 0x3fdef4edc443ec94, 0x0, 0x3fee735e0c0b94e4, 0x0, 0x3f76a5759bade800, + 0x0, 0x3fb924c2582803f0, 0x0, 0x3fee940719ceda38, 0x0, + 0xbfc77f692a6e3368); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.0368 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x28b5); + // -0.5518, 0.6772, 0.2756, 0.4421, 0.2081, 0.6250, 0.4136, + // 0.8203, -0.3535, -0.1597, -0.5244, 0.8696, 0.1744, 0.0793, + // -0.2445, -0.4031 + VLOAD_16(v2, 0xb86a, 0x396b, 0x3469, 0x3713, 0x32a9, 0x3900, 0x369e, 0x3a90, + 0xb5a8, 0xb11c, 0xb832, 0x3af5, 0x3195, 0x2d14, 0xb3d3, 0xb673); + asm volatile("vfmax.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // 0.0368, 0.6772, 0.2756, 0.4421, 0.2081, 0.6250, 0.4136, + // 0.8203, 0.0368, 0.0368, 0.0368, 0.8696, 0.1744, 0.0793, + // 0.0368, 0.0368 + VCMP_U16(7, v1, 0x28b5, 0x396b, 0x3469, 0x3713, 0x32a9, 0x3900, 0x369e, + 0x3a90, 0x28b5, 0x28b5, 0x28b5, 0x3af5, 0x3195, 0x2d14, 0x28b5, + 0x28b5); + + VSET(16, e32, m1); + double dscalar_32; + // -0.94383347 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf719f12); + // 0.51733643, 0.31252080, 0.47358772, 0.13738893, + // 0.11194360, -0.33637357, 0.83680850, 0.95792335, + // 0.41251704, 0.27496886, -0.06774041, -0.19357064, + // -0.48802575, -0.53921199, 0.32722279, 0.28428423 + VLOAD_32(v2, 0x3f047029, 0x3ea002ba, 0x3ef27a17, 0x3e0cafaf, 0x3de542b0, + 0xbeac3928, 0x3f563915, 0x3f753a77, 0x3ed3356f, 0x3e8cc8b8, + 0xbd8abb7c, 0xbe463762, 0xbef9de83, 0xbf0a09cc, 0x3ea789bf, + 0x3e918db4); + asm volatile("vfmax.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // 0.51733643, 0.31252080, 0.47358772, 0.13738893, + // 0.11194360, -0.33637357, 0.83680850, 0.95792335, + // 0.41251704, 0.27496886, -0.06774041, -0.19357064, + // -0.48802575, -0.53921199, 0.32722279, 0.28428423 + VCMP_U32(8, v1, 0x3f047029, 0x3ea002ba, 0x3ef27a17, 0x3e0cafaf, 0x3de542b0, + 0xbeac3928, 0x3f563915, 0x3f753a77, 0x3ed3356f, 0x3e8cc8b8, + 0xbd8abb7c, 0xbe463762, 0xbef9de83, 0xbf0a09cc, 0x3ea789bf, + 0x3e918db4); + + VSET(16, e64, m1); + double dscalar_64; + // -0.8274885128397702 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfea7ac9308eccb6); + // 0.9632225672084347, 0.4671677538923853, + // -0.1749283847947720, -0.0938698612480795, + // 0.3438198935172891, 0.2938331380713377, + // -0.3607699326176230, 0.6841623039857032, + // -0.6959644979744999, 0.4712155929452235, + // 0.1886883982201846, 0.9268486384654282, + // -0.9639662652720637, -0.2101071651393955, + // 0.0859470276611187, -0.7001184217853196 + VLOAD_64(v2, 0x3feed2b8221dbd8e, 0x3fdde613942dab28, 0xbfc6640da5eaf690, + 0xbfb807daf023fbb0, 0x3fd601252797bdcc, 0x3fd2ce29819fd630, + 0xbfd716dac57e4298, 0x3fe5e4a85818c992, 0xbfe6455756bf47f8, + 0x3fde2865724428b0, 0x3fc826f101bec2b8, 0x3feda8be79d1a2f4, + 0xbfeed8cfc7f94e06, 0xbfcae4caa576e8a8, 0x3fb6009fd8fe2f80, + 0xbfe6675ebf9ca482); + asm volatile("vfmax.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // 0.9632225672084347, 0.4671677538923853, -0.1749283847947720, + // -0.0938698612480795, 0.3438198935172891, 0.2938331380713377, + // -0.3607699326176230, 0.6841623039857032, + // -0.6959644979744999, 0.4712155929452235, 0.1886883982201846, + // 0.9268486384654282, -0.8274885128397702, -0.2101071651393955, + // 0.0859470276611187, -0.7001184217853196 + VCMP_U64(9, v1, 0x3feed2b8221dbd8e, 0x3fdde613942dab28, 0xbfc6640da5eaf690, + 0xbfb807daf023fbb0, 0x3fd601252797bdcc, 0x3fd2ce29819fd630, + 0xbfd716dac57e4298, 0x3fe5e4a85818c992, 0xbfe6455756bf47f8, + 0x3fde2865724428b0, 0x3fc826f101bec2b8, 0x3feda8be79d1a2f4, + 0xbfea7ac9308eccb6, 0xbfcae4caa576e8a8, 0x3fb6009fd8fe2f80, + 0xbfe6675ebf9ca482); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.0368 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x28b5); + // -0.5518, 0.6772, 0.2756, 0.4421, 0.2081, 0.6250, 0.4136, + // 0.8203, -0.3535, -0.1597, -0.5244, 0.8696, 0.1744, 0.0793, + // -0.2445, -0.4031 + VLOAD_16(v2, 0xb86a, 0x396b, 0x3469, 0x3713, 0x32a9, 0x3900, 0x369e, 0x3a90, + 0xb5a8, 0xb11c, 0xb832, 0x3af5, 0x3195, 0x2d14, 0xb3d3, 0xb673); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmax.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.6772, 0.0000, 0.4421, 0.0000, 0.6250, 0.0000, + // 0.8203, 0.0000, 0.0368, 0.0000, 0.8696, 0.0000, 0.0793, + // 0.0000, 0.0368 + VCMP_U16(10, v1, 0x0, 0x396b, 0x0, 0x3713, 0x0, 0x3900, 0x0, 0x3a90, 0x0, + 0x28b5, 0x0, 0x3af5, 0x0, 0x2d14, 0x0, 0x28b5); + + VSET(16, e32, m1); + double dscalar_32; + // -0.94383347 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf719f12); + // 0.51733643, 0.31252080, 0.47358772, 0.13738893, + // 0.11194360, -0.33637357, 0.83680850, 0.95792335, + // 0.41251704, 0.27496886, -0.06774041, -0.19357064, + // -0.48802575, -0.53921199, 0.32722279, 0.28428423 + VLOAD_32(v2, 0x3f047029, 0x3ea002ba, 0x3ef27a17, 0x3e0cafaf, 0x3de542b0, + 0xbeac3928, 0x3f563915, 0x3f753a77, 0x3ed3356f, 0x3e8cc8b8, + 0xbd8abb7c, 0xbe463762, 0xbef9de83, 0xbf0a09cc, 0x3ea789bf, + 0x3e918db4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmax.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, 0.31252080, 0.00000000, 0.13738893, + // 0.00000000, -0.33637357, 0.00000000, 0.95792335, + // 0.00000000, 0.27496886, 0.00000000, -0.19357064, + // 0.00000000, -0.53921199, 0.00000000, 0.28428423 + VCMP_U32(11, v1, 0x0, 0x3ea002ba, 0x0, 0x3e0cafaf, 0x0, 0xbeac3928, 0x0, + 0x3f753a77, 0x0, 0x3e8cc8b8, 0x0, 0xbe463762, 0x0, 0xbf0a09cc, 0x0, + 0x3e918db4); + + VSET(16, e64, m1); + double dscalar_64; + // -0.8274885128397702 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfea7ac9308eccb6); + // 0.9632225672084347, 0.4671677538923853, + // -0.1749283847947720, -0.0938698612480795, + // 0.3438198935172891, 0.2938331380713377, + // -0.3607699326176230, 0.6841623039857032, + // -0.6959644979744999, 0.4712155929452235, + // 0.1886883982201846, 0.9268486384654282, + // -0.9639662652720637, -0.2101071651393955, + // 0.0859470276611187, -0.7001184217853196 + VLOAD_64(v2, 0x3feed2b8221dbd8e, 0x3fdde613942dab28, 0xbfc6640da5eaf690, + 0xbfb807daf023fbb0, 0x3fd601252797bdcc, 0x3fd2ce29819fd630, + 0xbfd716dac57e4298, 0x3fe5e4a85818c992, 0xbfe6455756bf47f8, + 0x3fde2865724428b0, 0x3fc826f101bec2b8, 0x3feda8be79d1a2f4, + 0xbfeed8cfc7f94e06, 0xbfcae4caa576e8a8, 0x3fb6009fd8fe2f80, + 0xbfe6675ebf9ca482); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmax.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, 0.4671677538923853, 0.0000000000000000, + // -0.0938698612480795, 0.0000000000000000, + // 0.2938331380713377, 0.0000000000000000, 0.6841623039857032, + // 0.0000000000000000, 0.4712155929452235, 0.0000000000000000, + // 0.9268486384654282, 0.0000000000000000, + // -0.2101071651393955, 0.0000000000000000, + // -0.7001184217853196 + VCMP_U64(12, v1, 0x0, 0x3fdde613942dab28, 0x0, 0xbfb807daf023fbb0, 0x0, + 0x3fd2ce29819fd630, 0x0, 0x3fe5e4a85818c992, 0x0, 0x3fde2865724428b0, + 0x0, 0x3feda8be79d1a2f4, 0x0, 0xbfcae4caa576e8a8, 0x0, + 0xbfe6675ebf9ca482); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmerge.c b/apps/riscv-tests/isa/rv64uv/vfmerge.c new file mode 100644 index 0000000..b98192d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmerge.c @@ -0,0 +1,94 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.1481, -0.1797, -0.5454, 0.3228, 0.3237, -0.7212, -0.5195, + // -0.4500, 0.2681, 0.7300, 0.5059, 0.5830, 0.3198, -0.1713, + // -0.6431, 0.4841 + VLOAD_16(v2, 0xb0bd, 0xb1c0, 0xb85d, 0x352a, 0x352e, 0xb9c5, 0xb828, 0xb733, + 0x344a, 0x39d7, 0x380c, 0x38aa, 0x351e, 0xb17b, 0xb925, 0x37bf); + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + VLOAD_8(v0, 0x0F, 0xAA); + asm volatile("vfmerge.vfm v1, v2, %[A], v0" ::[A] "f"(dscalar_16)); + // -0.9380, -0.9380, -0.9380, -0.9380, 0.3237, -0.7212, + // -0.5195, -0.4500, 0.2681, -0.9380, 0.5059, -0.9380, 0.3198, + // -0.9380, -0.6431, -0.9380 + VCMP_U16(1, v1, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0x352e, 0xb9c5, 0xb828, + 0xb733, 0x344a, 0xbb81, 0x380c, 0xbb81, 0x351e, 0xbb81, 0xb925, + 0xbb81); + + VSET(16, e32, m1); + // 0.86539453, -0.53925377, -0.47128764, 0.99265540, + // 0.32128176, -0.47335613, -0.30028856, 0.44394016, + // -0.72540921, -0.26464799, 0.77351445, -0.21725702, + // -0.25191557, -0.53123665, 0.80404943, 0.81841671 + VLOAD_32(v2, 0x3f5d8a7f, 0xbf0a0c89, 0xbef14c9d, 0x3f7e1eaa, 0x3ea47f0b, + 0xbef25bbc, 0xbe99bf6c, 0x3ee34c20, 0xbf39b46b, 0xbe877ff1, + 0x3f46050b, 0xbe5e78a0, 0xbe80fb14, 0xbf07ff20, 0x3f4dd62f, + 0x3f5183c2); + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + VLOAD_8(v0, 0x0F, 0xAA); + asm volatile("vfmerge.vfm v1, v2, %[A], v0" ::[A] "f"(dscalar_32)); + // -0.96056187, -0.96056187, -0.96056187, -0.96056187, + // 0.32128176, -0.47335613, -0.30028856, 0.44394016, + // -0.72540921, -0.96056187, 0.77351445, -0.96056187, + // -0.25191557, -0.96056187, 0.80404943, -0.96056187 + VCMP_U32(2, v1, 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, 0x3ea47f0b, + 0xbef25bbc, 0xbe99bf6c, 0x3ee34c20, 0xbf39b46b, 0xbf75e762, + 0x3f46050b, 0xbf75e762, 0xbe80fb14, 0xbf75e762, 0x3f4dd62f, + 0xbf75e762); + + VSET(16, e64, m1); + // -0.3488917150781869, -0.4501495513738740, 0.8731197104152684, + // 0.3256432550932964, 0.6502591178769535, -0.3169358689246526, + // -0.5396694979141685, -0.5417807430937591, + // -0.7971574213160249, -0.1764794100111047, 0.3564275916066595, + // -0.3754449946313438, 0.6580947137446858, + // -0.3328857144699515, 0.1761214464164236, 0.1429774118511240 + VLOAD_64(v2, 0xbfd6543dea86cb60, 0xbfdccf40105d6e5c, 0x3febf098bf37400c, + 0x3fd4d756ceb279f4, 0x3fe4ceec35a6a266, 0xbfd448ad61fd7c88, + 0xbfe144f8f7861540, 0xbfe1564491a616b8, 0xbfe9825047ca1cd6, + 0xbfc696e097352100, 0x3fd6cfb5ac55edec, 0xbfd8074a7158dd78, + 0x3fe50f1ca5268668, 0xbfd54dffe23d0eec, 0x3fc68b25c63dcaf0, + 0x3fc24d1575fbd080); + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + VLOAD_8(v0, 0x0F, 0xAA); + asm volatile("vfmerge.vfm v1, v2, %[A], v0" ::[A] "f"(dscalar_64)); + // 0.9108707261227378, 0.9108707261227378, 0.9108707261227378, + // 0.9108707261227378, 0.6502591178769535, + // -0.3169358689246526, -0.5396694979141685, + // -0.5417807430937591 -0.7971574213160249, + // 0.9108707261227378, 0.3564275916066595, 0.9108707261227378, + // 0.6580947137446858, 0.9108707261227378, 0.1761214464164236, + // 0.9108707261227378 + VCMP_U64(3, v1, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, + 0x3fed25da5d7296fe, 0x3fe4ceec35a6a266, 0xbfd448ad61fd7c88, + 0xbfe144f8f7861540, 0xbfe1564491a616b8, 0xbfe9825047ca1cd6, + 0x3fed25da5d7296fe, 0x3fd6cfb5ac55edec, 0x3fed25da5d7296fe, + 0x3fe50f1ca5268668, 0x3fed25da5d7296fe, 0x3fc68b25c63dcaf0, + 0x3fed25da5d7296fe); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmin.c b/apps/riscv-tests/isa/rv64uv/vfmin.c new file mode 100644 index 0000000..1ebb2a5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmin.c @@ -0,0 +1,348 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.9390, 0.9619, 0.9121, 0.6265, 0.1193, -0.4492, -0.3562, + // 0.2365, -0.9897, 0.8638, -0.0379, -0.6201, 0.1809, 0.9824, + // -0.9922, -0.6851 + VLOAD_16(v2, 0x3b83, 0x3bb2, 0x3b4c, 0x3903, 0x2fa2, 0xb730, 0xb5b3, 0x3391, + 0xbbeb, 0x3ae9, 0xa8da, 0xb8f6, 0x31ca, 0x3bdc, 0xbbf0, 0xb97b); + // 0.9795, -0.1069, 0.7070, -0.7305, 0.0516, -0.1321, 0.3828, + // 0.0230, -0.9424, -0.8652, -0.3865, -0.1719, -0.7021, 0.1664, + // 0.7026, -0.8535 + VLOAD_16(v3, 0x3bd6, 0xaed8, 0x39a8, 0xb9d8, 0x2a9a, 0xb03a, 0x3620, 0x25e2, + 0xbb8a, 0xbaec, 0xb62f, 0xb180, 0xb99e, 0x3153, 0x399f, 0xbad4); + asm volatile("vfmin.vv v1, v2, v3"); + // 0.9390, -0.1069, 0.7070, -0.7305, 0.0516, -0.4492, -0.3562, + // 0.0230, -0.9897, -0.8652, -0.3865, -0.6201, -0.7021, 0.1664, + // -0.9922, -0.8535 + VCMP_U16(1, v1, 0x3b83, 0xaed8, 0x39a8, 0xb9d8, 0x2a9a, 0xb730, 0xb5b3, + 0x25e2, 0xbbeb, 0xbaec, 0xb62f, 0xb8f6, 0xb99e, 0x3153, 0xbbf0, + 0xbad4); + + VSET(16, e32, m1); + // 0.33477312, -0.14129849, -0.94871885, 0.83600986, + // -0.28163233, -0.47814348, 0.77408481, -0.54823470, + // -0.72419900, 0.27495387, -0.76835793, 0.71516198, + // 0.32305571, -0.76598656, -0.36499983, -0.52954155 + VLOAD_32(v2, 0x3eab6762, 0xbe10b08d, 0xbf72df3d, 0x3f5604be, 0xbe90321d, + 0xbef4cf39, 0x3f462a6c, 0xbf0c591c, 0xbf39651b, 0x3e8cc6c1, + 0xbf44b31b, 0x3f3714db, 0x3ea5678f, 0xbf4417b2, 0xbebae142, + 0xbf079009); + // 0.87184614, 0.40005061, 0.40118238, 0.97373396, + // 0.74085194, -0.99458516, -0.73125440, -0.46319291, + // -0.76140571, -0.82557100, 0.15205561, 0.39971715, + // -0.32876521, -0.53106725, 0.84727478, 0.21940185 + VLOAD_32(v3, 0x3f5f314f, 0x3eccd36f, 0x3ecd67c7, 0x3f7946a1, 0x3f3da879, + 0xbf7e9d22, 0xbf3b337d, 0xbeed279f, 0xbf42eb7c, 0xbf53589f, + 0x3e1bb477, 0x3ecca7ba, 0xbea853ea, 0xbf07f406, 0x3f58e700, + 0x3e60aae1); + asm volatile("vfmin.vv v1, v2, v3"); + // 0.33477312, -0.14129849, -0.94871885, 0.83600986, + // -0.28163233, -0.99458516, -0.73125440, -0.54823470, + // -0.76140571, -0.82557100, -0.76835793, 0.39971715, + // -0.32876521, -0.76598656, -0.36499983, -0.52954155 + VCMP_U32(2, v1, 0x3eab6762, 0xbe10b08d, 0xbf72df3d, 0x3f5604be, 0xbe90321d, + 0xbf7e9d22, 0xbf3b337d, 0xbf0c591c, 0xbf42eb7c, 0xbf53589f, + 0xbf44b31b, 0x3ecca7ba, 0xbea853ea, 0xbf4417b2, 0xbebae142, + 0xbf079009); + + VSET(16, e64, m1); + // 0.9387726994461698, 0.8517969615002949, -0.8864275043807637, + // 0.3621349692771021, 0.5392486258321831, -0.1288714247798126, + // -0.9149173505741688, -0.9378576380992047, + // -0.2263428385339852, 0.1016628884386184, 0.4783549203499486, + // 0.5394596797016060, 0.7861587828590215, 0.0194772848204161, + // -0.9126826319328591, 0.3997583898469530 + VLOAD_64(v2, 0x3fee0a6d0b4ff74a, 0x3feb41ebb38f3ae2, 0xbfec5d9d36b2e38c, + 0x3fd72d3826721e9c, 0x3fe14186558b96e0, 0xbfc07edbdd68bb68, + 0xbfed4700c06849e8, 0xbfee02ee057e1390, 0xbfccf8cd5897f8a0, + 0x3fba06943d0f8e20, 0x3fde9d5df4b22860, 0x3fe14340f23a8770, + 0x3fe9283676baf718, 0x3f93f1da754635c0, 0xbfed34b234f8ec38, + 0x3fd995a436ac6f1c); + // 0.4808082103120717, 0.7218925128932789, -0.9454618185734458, + // 0.7335258472548418, 0.9800819535502201, -0.6873536121819364, + // -0.7090903925273744, 0.7813319828098306, 0.6810234154055235, + // 0.1176441554686278, 0.4929731878752270, 0.0942028280153233, + // 0.9496420237972776, -0.4549651855719854, -0.9663401540020158, + // 0.4114236885680320 + VLOAD_64(v3, 0x3fdec58fccbc12a4, 0x3fe719be53c35314, 0xbfee413924cc77e4, + 0x3fe7790b32975e1a, 0x3fef5cd4d43cbc4e, 0xbfe5fecd00a37bfa, + 0xbfe6b0de55ba0314, 0x3fe900abee2f95f8, 0x3fe5caf19e1f4324, + 0x3fbe1ded684da4d0, 0x3fdf8cdf69eea758, 0x3fb81dad31843b10, + 0x3fee6377ab63bade, 0xbfdd1e264c366a78, 0xbfeeec422fc80224, + 0x3fda54c405ccc2c0); + asm volatile("vfmin.vv v1, v2, v3"); + // 0.4808082103120717, 0.7218925128932789, -0.9454618185734458, + // 0.3621349692771021, 0.5392486258321831, -0.6873536121819364, + // -0.9149173505741688, -0.9378576380992047, + // -0.2263428385339852, 0.1016628884386184, 0.4783549203499486, + // 0.0942028280153233, 0.7861587828590215, -0.4549651855719854, + // -0.9663401540020158, 0.3997583898469530 + VCMP_U64(3, v1, 0x3fdec58fccbc12a4, 0x3fe719be53c35314, 0xbfee413924cc77e4, + 0x3fd72d3826721e9c, 0x3fe14186558b96e0, 0xbfe5fecd00a37bfa, + 0xbfed4700c06849e8, 0xbfee02ee057e1390, 0xbfccf8cd5897f8a0, + 0x3fba06943d0f8e20, 0x3fde9d5df4b22860, 0x3fb81dad31843b10, + 0x3fe9283676baf718, 0xbfdd1e264c366a78, 0xbfeeec422fc80224, + 0x3fd995a436ac6f1c); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.9390, 0.9619, 0.9121, 0.6265, 0.1193, -0.4492, -0.3562, + // 0.2365, -0.9897, 0.8638, -0.0379, -0.6201, 0.1809, 0.9824, + // -0.9922, -0.6851 + VLOAD_16(v2, 0x3b83, 0x3bb2, 0x3b4c, 0x3903, 0x2fa2, 0xb730, 0xb5b3, 0x3391, + 0xbbeb, 0x3ae9, 0xa8da, 0xb8f6, 0x31ca, 0x3bdc, 0xbbf0, 0xb97b); + // 0.9795, -0.1069, 0.7070, -0.7305, 0.0516, -0.1321, 0.3828, + // 0.0230, -0.9424, -0.8652, -0.3865, -0.1719, -0.7021, 0.1664, + // 0.7026, -0.8535 + VLOAD_16(v3, 0x3bd6, 0xaed8, 0x39a8, 0xb9d8, 0x2a9a, 0xb03a, 0x3620, 0x25e2, + 0xbb8a, 0xbaec, 0xb62f, 0xb180, 0xb99e, 0x3153, 0x399f, 0xbad4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmin.vv v1, v2, v3, v0.t"); + // 0.0000, -0.1069, 0.0000, -0.7305, 0.0000, -0.4492, 0.0000, + // 0.0230, 0.0000, -0.8652, 0.0000, -0.6201, 0.0000, 0.1664, + // 0.0000, -0.8535 + VCMP_U16(4, v1, 0x0, 0xaed8, 0x0, 0xb9d8, 0x0, 0xb730, 0x0, 0x25e2, 0x0, + 0xbaec, 0x0, 0xb8f6, 0x0, 0x3153, 0x0, 0xbad4); + + VSET(16, e32, m1); + // 0.33477312, -0.14129849, -0.94871885, 0.83600986, + // -0.28163233, -0.47814348, 0.77408481, -0.54823470, + // -0.72419900, 0.27495387, -0.76835793, 0.71516198, + // 0.32305571, -0.76598656, -0.36499983, -0.52954155 + VLOAD_32(v2, 0x3eab6762, 0xbe10b08d, 0xbf72df3d, 0x3f5604be, 0xbe90321d, + 0xbef4cf39, 0x3f462a6c, 0xbf0c591c, 0xbf39651b, 0x3e8cc6c1, + 0xbf44b31b, 0x3f3714db, 0x3ea5678f, 0xbf4417b2, 0xbebae142, + 0xbf079009); + // 0.87184614, 0.40005061, 0.40118238, 0.97373396, + // 0.74085194, -0.99458516, -0.73125440, -0.46319291, + // -0.76140571, -0.82557100, 0.15205561, 0.39971715, + // -0.32876521, -0.53106725, 0.84727478, 0.21940185 + VLOAD_32(v3, 0x3f5f314f, 0x3eccd36f, 0x3ecd67c7, 0x3f7946a1, 0x3f3da879, + 0xbf7e9d22, 0xbf3b337d, 0xbeed279f, 0xbf42eb7c, 0xbf53589f, + 0x3e1bb477, 0x3ecca7ba, 0xbea853ea, 0xbf07f406, 0x3f58e700, + 0x3e60aae1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmin.vv v1, v2, v3, v0.t"); + // 0.00000000, -0.14129849, 0.00000000, 0.83600986, + // 0.00000000, -0.99458516, 0.00000000, -0.54823470, + // 0.00000000, -0.82557100, 0.00000000, 0.39971715, + // 0.00000000, -0.76598656, 0.00000000, -0.52954155 + VCMP_U32(5, v1, 0x0, 0xbe10b08d, 0x0, 0x3f5604be, 0x0, 0xbf7e9d22, 0x0, + 0xbf0c591c, 0x0, 0xbf53589f, 0x0, 0x3ecca7ba, 0x0, 0xbf4417b2, 0x0, + 0xbf079009); + + VSET(16, e64, m1); + // 0.9387726994461698, 0.8517969615002949, -0.8864275043807637, + // 0.3621349692771021, 0.5392486258321831, -0.1288714247798126, + // -0.9149173505741688, -0.9378576380992047, + // -0.2263428385339852, 0.1016628884386184, 0.4783549203499486, + // 0.5394596797016060, 0.7861587828590215, 0.0194772848204161, + // -0.9126826319328591, 0.3997583898469530 + VLOAD_64(v2, 0x3fee0a6d0b4ff74a, 0x3feb41ebb38f3ae2, 0xbfec5d9d36b2e38c, + 0x3fd72d3826721e9c, 0x3fe14186558b96e0, 0xbfc07edbdd68bb68, + 0xbfed4700c06849e8, 0xbfee02ee057e1390, 0xbfccf8cd5897f8a0, + 0x3fba06943d0f8e20, 0x3fde9d5df4b22860, 0x3fe14340f23a8770, + 0x3fe9283676baf718, 0x3f93f1da754635c0, 0xbfed34b234f8ec38, + 0x3fd995a436ac6f1c); + // 0.4808082103120717, 0.7218925128932789, -0.9454618185734458, + // 0.7335258472548418, 0.9800819535502201, -0.6873536121819364, + // -0.7090903925273744, 0.7813319828098306, 0.6810234154055235, + // 0.1176441554686278, 0.4929731878752270, 0.0942028280153233, + // 0.9496420237972776, -0.4549651855719854, -0.9663401540020158, + // 0.4114236885680320 + VLOAD_64(v3, 0x3fdec58fccbc12a4, 0x3fe719be53c35314, 0xbfee413924cc77e4, + 0x3fe7790b32975e1a, 0x3fef5cd4d43cbc4e, 0xbfe5fecd00a37bfa, + 0xbfe6b0de55ba0314, 0x3fe900abee2f95f8, 0x3fe5caf19e1f4324, + 0x3fbe1ded684da4d0, 0x3fdf8cdf69eea758, 0x3fb81dad31843b10, + 0x3fee6377ab63bade, 0xbfdd1e264c366a78, 0xbfeeec422fc80224, + 0x3fda54c405ccc2c0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmin.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, 0.7218925128932789, 0.0000000000000000, + // 0.3621349692771021, 0.0000000000000000, -0.6873536121819364, + // 0.0000000000000000, -0.9378576380992047, 0.0000000000000000, + // 0.1016628884386184, 0.0000000000000000, 0.0942028280153233, + // 0.0000000000000000, -0.4549651855719854, 0.0000000000000000, + // 0.3997583898469530 + VCMP_U64(6, v1, 0x0, 0x3fe719be53c35314, 0x0, 0x3fd72d3826721e9c, 0x0, + 0xbfe5fecd00a37bfa, 0x0, 0xbfee02ee057e1390, 0x0, 0x3fba06943d0f8e20, + 0x0, 0x3fb81dad31843b10, 0x0, 0xbfdd1e264c366a78, 0x0, + 0x3fd995a436ac6f1c); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.4434 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3718); + // -0.2537, 0.5449, 0.2070, -0.5752, -0.3008, 0.0165, -0.8447, + // 0.6279, 0.6802, 0.7300, 0.7720, -0.8525, 0.5264, -0.5249, + // -0.9839, 0.4875 + VLOAD_16(v2, 0xb40f, 0x385c, 0x32a0, 0xb89a, 0xb4d0, 0x2437, 0xbac2, 0x3906, + 0x3971, 0x39d7, 0x3a2d, 0xbad2, 0x3836, 0xb833, 0xbbdf, 0x37cd); + asm volatile("vfmin.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // -0.2537, 0.4434, 0.2070, -0.5752, -0.3008, 0.0165, -0.8447, + // 0.4434, 0.4434, 0.4434, 0.4434, -0.8525, 0.4434, -0.5249, + // -0.9839, 0.4434 + VCMP_U16(7, v1, 0xb40f, 0x3718, 0x32a0, 0xb89a, 0xb4d0, 0x2437, 0xbac2, + 0x3718, 0x3718, 0x3718, 0x3718, 0xbad2, 0x3718, 0xb833, 0xbbdf, + 0x3718); + + VSET(16, e32, m1); + double dscalar_32; + // 0.59499639 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f1851af); + // -0.94244474, -0.52559608, -0.72424960, -0.67824948, + // 0.22003150, -0.67564118, -0.90376341, 0.16465612, + // -0.15494362, -0.01763406, 0.97777683, -0.91671157, + // 0.81712914, -0.10151604, 0.03442690, -0.14597759 + VLOAD_32(v2, 0xbf71440f, 0xbf068d77, 0xbf39686c, 0xbf2da1c2, 0x3e614ff0, + 0xbf2cf6d2, 0xbf675d0a, 0x3e289b9d, 0xbe1ea98a, 0xbc90754e, + 0x3f7a4f95, 0xbf6aad9c, 0x3f512f60, 0xbdcfe7a4, 0x3d0d0338, + 0xbe157b26); + asm volatile("vfmin.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // -0.94244474, -0.52559608, -0.72424960, -0.67824948, + // 0.22003150, -0.67564118, -0.90376341, 0.16465612, + // -0.15494362, -0.01763406, 0.59499639, -0.91671157, + // 0.59499639, -0.10151604, 0.03442690, -0.14597759 + VCMP_U32(8, v1, 0xbf71440f, 0xbf068d77, 0xbf39686c, 0xbf2da1c2, 0x3e614ff0, + 0xbf2cf6d2, 0xbf675d0a, 0x3e289b9d, 0xbe1ea98a, 0xbc90754e, + 0x3f1851af, 0xbf6aad9c, 0x3f1851af, 0xbdcfe7a4, 0x3d0d0338, + 0xbe157b26); + + VSET(16, e64, m1); + double dscalar_64; + // 0.8631130564395617 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3feb9e9f45c51298); + // -0.0203711476424431, 0.4824066080711997, 0.5516514149436702, + // -0.0992829085793798, 0.7425996730256406, 0.3080149644930992, + // -0.6753031265127754, -0.3309631180416657, + // -0.7695072044924456, -0.6726760621514143, + // -0.9995830020822822, 0.2485224245452053, 0.7025040357726613, + // -0.6452676560401207, 0.5090044889036880, 0.0801949752856408 + VLOAD_64(v2, 0xbf94dc2c93a00800, 0x3fdedfbff74290e0, 0x3fe1a720de3f34c0, + 0xbfb96a9acd667320, 0x3fe7c36063b54b1e, 0x3fd3b68465cb4b28, + 0xbfe59c154d684914, 0xbfd52e7fee0af3fc, 0xbfe89fcd92aa9b24, + 0xbfe5868ff2f7c1a4, 0xbfeffc957df296c0, 0x3fcfcf9532df44b8, + 0x3fe67ae9be5e7376, 0xbfe4a6085afb7c12, 0x3fe049c3c82b791e, + 0x3fb487a86c27c560); + asm volatile("vfmin.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // -0.0203711476424431, 0.4824066080711997, 0.5516514149436702, + // -0.0992829085793798, 0.7425996730256406, 0.3080149644930992, + // -0.6753031265127754, -0.3309631180416657, -0.7695072044924456, + // -0.6726760621514143, -0.9995830020822822, 0.2485224245452053, + // 0.7025040357726613, -0.6452676560401207, 0.5090044889036880, + // 0.0801949752856408 + VCMP_U64(9, v1, 0xbf94dc2c93a00800, 0x3fdedfbff74290e0, 0x3fe1a720de3f34c0, + 0xbfb96a9acd667320, 0x3fe7c36063b54b1e, 0x3fd3b68465cb4b28, + 0xbfe59c154d684914, 0xbfd52e7fee0af3fc, 0xbfe89fcd92aa9b24, + 0xbfe5868ff2f7c1a4, 0xbfeffc957df296c0, 0x3fcfcf9532df44b8, + 0x3fe67ae9be5e7376, 0xbfe4a6085afb7c12, 0x3fe049c3c82b791e, + 0x3fb487a86c27c560); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.4434 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3718); + // -0.2537, 0.5449, 0.2070, -0.5752, -0.3008, 0.0165, + // -0.8447, 0.6279, 0.6802, 0.7300, 0.7720, -0.8525, 0.5264, + // -0.5249, -0.9839, 0.4875 + VLOAD_16(v2, 0xb40f, 0x385c, 0x32a0, 0xb89a, 0xb4d0, 0x2437, 0xbac2, 0x3906, + 0x3971, 0x39d7, 0x3a2d, 0xbad2, 0x3836, 0xb833, 0xbbdf, 0x37cd); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmin.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.4434, 0.0000, -0.5752, 0.0000, 0.0165, 0.0000, + // 0.4434, 0.0000, 0.4434, 0.0000, -0.8525, 0.0000, + // -0.5249, 0.0000, 0.4434 + VCMP_U16(10, v1, 0x0, 0x3718, 0x0, 0xb89a, 0x0, 0x2437, 0x0, 0x3718, 0x0, + 0x3718, 0x0, 0xbad2, 0x0, 0xb833, 0x0, 0x3718); + + VSET(16, e32, m1); + double dscalar_32; + // 0.59499639 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f1851af); + // -0.94244474, -0.52559608, -0.72424960, -0.67824948, + // 0.22003150, -0.67564118, -0.90376341, 0.16465612, + // -0.15494362, -0.01763406, 0.97777683, -0.91671157, + // 0.81712914, -0.10151604, 0.03442690, -0.14597759 + VLOAD_32(v2, 0xbf71440f, 0xbf068d77, 0xbf39686c, 0xbf2da1c2, 0x3e614ff0, + 0xbf2cf6d2, 0xbf675d0a, 0x3e289b9d, 0xbe1ea98a, 0xbc90754e, + 0x3f7a4f95, 0xbf6aad9c, 0x3f512f60, 0xbdcfe7a4, 0x3d0d0338, + 0xbe157b26); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmin.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, -0.52559608, 0.00000000, -0.67824948, + // 0.00000000, -0.67564118, 0.00000000, 0.16465612, + // 0.00000000, -0.01763406, 0.00000000, -0.91671157, + // 0.00000000, -0.10151604, 0.00000000, -0.14597759 + VCMP_U32(11, v1, 0x0, 0xbf068d77, 0x0, 0xbf2da1c2, 0x0, 0xbf2cf6d2, 0x0, + 0x3e289b9d, 0x0, 0xbc90754e, 0x0, 0xbf6aad9c, 0x0, 0xbdcfe7a4, 0x0, + 0xbe157b26); + + VSET(16, e64, m1); + double dscalar_64; + // 0.8631130564395617 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3feb9e9f45c51298); + // -0.0203711476424431, 0.4824066080711997, + // 0.5516514149436702, -0.0992829085793798, 0.7425996730256406, + // 0.3080149644930992, -0.6753031265127754, + // -0.3309631180416657, -0.7695072044924456, + // -0.6726760621514143, -0.9995830020822822, + // 0.2485224245452053, 0.7025040357726613, + // -0.6452676560401207, 0.5090044889036880, 0.0801949752856408 + VLOAD_64(v2, 0xbf94dc2c93a00800, 0x3fdedfbff74290e0, 0x3fe1a720de3f34c0, + 0xbfb96a9acd667320, 0x3fe7c36063b54b1e, 0x3fd3b68465cb4b28, + 0xbfe59c154d684914, 0xbfd52e7fee0af3fc, 0xbfe89fcd92aa9b24, + 0xbfe5868ff2f7c1a4, 0xbfeffc957df296c0, 0x3fcfcf9532df44b8, + 0x3fe67ae9be5e7376, 0xbfe4a6085afb7c12, 0x3fe049c3c82b791e, + 0x3fb487a86c27c560); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmin.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, 0.4824066080711997, 0.0000000000000000, + // -0.0992829085793798, 0.0000000000000000, + // 0.3080149644930992, 0.0000000000000000, + // -0.3309631180416657, 0.0000000000000000, + // -0.6726760621514143, 0.0000000000000000, + // 0.2485224245452053, 0.0000000000000000, + // -0.6452676560401207, 0.0000000000000000, 0.0801949752856408 + VCMP_U64(12, v1, 0x0, 0x3fdedfbff74290e0, 0x0, 0xbfb96a9acd667320, 0x0, + 0x3fd3b68465cb4b28, 0x0, 0xbfd52e7fee0af3fc, 0x0, 0xbfe5868ff2f7c1a4, + 0x0, 0x3fcfcf9532df44b8, 0x0, 0xbfe4a6085afb7c12, 0x0, + 0x3fb487a86c27c560); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmsac.c b/apps/riscv-tests/isa/rv64uv/vfmsac.c new file mode 100644 index 0000000..01e8ceb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmsac.c @@ -0,0 +1,454 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.9175, 0.0740, -0.0362, 0.2961, 0.6226, -0.8032, 0.7749, + // 0.8188, 0.2019, 0.4885, 0.5669, -0.1743, 0.4404, 0.0618, + // 0.8252, -0.5947 + VLOAD_16(v2, 0x3b57, 0x2cbc, 0xa8a3, 0x34bd, 0x38fb, 0xba6d, 0x3a33, 0x3a8d, + 0x3276, 0x37d1, 0x3889, 0xb194, 0x370c, 0x2bea, 0x3a9a, 0xb8c2); + // 0.2812, -0.6733, 0.3289, 0.9609, -0.6841, 0.5488, -0.1401, + // 0.5591, 0.2759, -0.6973, 0.1418, 0.2389, -0.3308, 0.8867, + // 0.8936, 0.3611 + VLOAD_16(v3, 0x3480, 0xb963, 0x3543, 0x3bb0, 0xb979, 0x3864, 0xb07c, 0x3879, + 0x346a, 0xb994, 0x308a, 0x33a5, 0xb54b, 0x3b18, 0x3b26, 0x35c7); + // 0.4780, -0.1810, 0.2800, 0.7529, 0.6484, -0.9526, + // 0.5947, 1.0000, -0.1874, 0.2949, -0.4280, 0.6934, 0.5444, + // 0.8823, -0.8911, 0.7603 + VLOAD_16(v1, 0x37a6, 0xb1cb, 0x347b, 0x3a06, 0x3930, 0xbb9f, 0x38c2, 0x3c00, + 0xb1ff, 0x34b8, 0xb6d9, 0x398c, 0x385b, 0x3b0f, 0xbb21, 0x3a15); + asm volatile("vfmsac.vv v1, v2, v3"); + // -0.2200, 0.1312, -0.2920, -0.4683, -1.0742, 0.5117, -0.7031, + // -0.5420, 0.2430, -0.6357, 0.5083, -0.7349, -0.6904, -0.8276, + // 1.6289, -0.9751 + VCMP_U16(1, v1, 0xb30a, 0x3033, 0xb4ac, 0xb77e, 0xbc4c, 0x3818, 0xb9a0, + 0xb856, 0x33c7, 0xb916, 0x3811, 0xb9e1, 0xb985, 0xba9f, 0x3e84, + 0xbbcd); + + VSET(16, e32, m1); + // -0.90310860, 0.30282700, 0.54854167, -0.38732994, + // 0.92121714, 0.99595129, -0.10263380, 0.83759040, + // -0.23468767, 0.03914077, -0.46234205, 0.38326120, + // 0.36417511, -0.50103557, 0.36991179, 0.44718841 + VLOAD_32(v2, 0xbf673220, 0x3e9b0c24, 0x3f0c6d3a, 0xbec6501c, 0x3f6bd4e3, + 0x3f7ef6aa, 0xbdd231ab, 0x3f566c53, 0xbe7051f7, 0x3d205212, + 0xbeecb819, 0x3ec43ad0, 0x3eba7529, 0xbf0043de, 0x3ebd6514, + 0x3ee4f5e1); + // 0.84989786, -0.04543342, -0.74596256, -0.30687407, + // -0.30795863, 0.57084304, 0.51653886, -0.97366458, + // 0.49300706, 0.62932760, 0.45846274, -0.73850167, + // -0.42686453, -0.31419462, -0.47245970, -0.87721694 + VLOAD_32(v3, 0x3f5992e8, 0xbd3a1866, 0xbf3ef767, 0xbe9d1e99, 0xbe9dacc1, + 0x3f1222c5, 0x3f043be4, 0xbf794215, 0x3efc6b6c, 0x3f211b9d, + 0x3eeabba1, 0xbf3d0e72, 0xbeda8dfd, 0xbea0de1e, 0xbef1e63d, + 0xbf60914a); + // -0.76813585, 0.87161541, -0.67958647, -0.98584491, + // 0.12284227, -0.04006640, -0.93113720, -0.93526161, + // -0.27461481, 0.64110506, 0.61687475, -0.43741968, + // 0.70502371, 0.37014356, -0.98105848, 0.77993429 + VLOAD_32(v1, 0xbf44a48d, 0x3f5f2230, 0xbf2df961, 0xbf7c6055, 0x3dfb94bb, + 0xbd241caa, 0xbf6e5f02, 0xbf6f6d4e, 0xbe8c9a50, 0x3f241f76, + 0x3f1deb81, 0xbedff579, 0x3f347c6f, 0x3ebd8375, 0xbf7b26a6, + 0x3f47a9c6); + asm volatile("vfmsac.vv v1, v2, v3"); + // 0.00058579, -0.88537389, 0.27039492, 1.10470641, + // -0.40653905, 0.60859829, 0.87812287, 0.11972952, + // 0.15891212, -0.61647266, -0.82884133, 0.15438065, + // -0.86047715, -0.21272089, 0.80629003, -1.17221546 + VCMP_U32(2, v1, 0x3a198f11, 0xbf62a7dd, 0x3e8a7134, 0x3f8d6705, 0xbed025e3, + 0x3f1bcd19, 0x3f60cca9, 0x3df534be, 0x3e22b9dd, 0xbf1dd127, + 0xbf542ef3, 0x3e1e15f6, 0xbf5c483b, 0xbe59d381, 0x3f4e6907, + 0xbf960b29); + + VSET(16, e64, m1); + // 0.0971325394189311, 0.6403859199401045, 0.3478142243141771, + // -0.4702414117546168, 0.8862438155310881, 0.6157878617136987, + // -0.9954501284062294, -0.2761157935600853, + // -0.7189549700888722, -0.2302799669824283, 0.0093666993515229, + // 0.9188774299961215, -0.4297410504980956, 0.2729294776457381, + // -0.1419575372981836, -0.8472908703054822 + VLOAD_64(v2, 0x3fb8ddad982e8680, 0x3fe47e0a9cdec59e, 0x3fd6429697a0d4f8, + 0xbfde186f6f2d8030, 0x3fec5c1bfd7f9ffe, 0x3fe3b488beeab100, + 0xbfefdaba3a49b85e, 0xbfd1abe193cffa54, 0xbfe701adda7a81f6, + 0xbfcd79d05f8e86d0, 0x3f832ed91b170d00, 0x3fed6771a3dbb538, + 0xbfdb80e09b68d514, 0x3fd177ad33269468, 0xbfc22baa220ee628, + 0xbfeb1d01be452a62); + // -0.2416734667201210, -0.2737616510555549, 0.6084509432766920, + // -0.4000545529138850, 0.5985258122916897, -0.9559409603601607, + // 0.5010970610326939, 0.5772808284477746, -0.4551243154247406, + // 0.6584804564152213, 0.6542532086910551, -0.2215058802905889, + // 0.3203723346938081, 0.0696368102348055, 0.8882580549203218, + // 0.7725843936650791 + VLOAD_64(v3, 0xbfceef27f9efdac8, 0xbfd1854f968baf44, 0x3fe3786e1cd2fff2, + 0xbfd99a7e695862ec, 0x3fe3271f9ab3593a, 0xbfee97117f34eb4c, + 0x3fe008fcb4283a76, 0x3fe27915a4d94fb2, 0xbfdd20c1bc974608, + 0x3fe512459b2b7912, 0x3fe4efa46cd43256, 0xbfcc5a4dffdc2170, + 0x3fd480faf7036588, 0x3fb1d3b7ce8e6640, 0x3fec6c9c280952c6, + 0x3fe8b902e80620ce); + // -0.8982912058335177, 0.5582779858188844, -0.3988318240568800, + // 0.0267896464795028, 0.8241806039831361, 0.2839220639224551, + // -0.4781090814672235, -0.1240154287362147, 0.4586341020154134, + // -0.6132901056934972, 0.1207753636997857, 0.4420874266235846, + // 0.8256868703569773, 0.0642541522901756, -0.3012484644971416, + // 0.7323810741358745 + VLOAD_64(v1, 0xbfecbecd32eadc10, 0x3fe1dd69cb65674e, 0xbfd98675ea3b69b0, + 0x3f9b6ebebe00e300, 0x3fea5fb000835cf4, 0x3fd22bc772ca399c, + 0xbfde9956d534a0f8, 0xbfbfbf79a29f1810, 0x3fdd5a42d93f2348, + 0xbfe3a012925d3f1c, 0x3fbeeb225d40ca30, 0x3fdc4b290fd48cd4, + 0x3fea6c06df1d6f14, 0x3fb072f5cab7f020, 0xbfd347a7a3bf1174, + 0x3fe76faa6f33ef10); + asm volatile("vfmsac.vv v1, v2, v3"); + // 0.8748168483008159, -0.7335910925744179, 0.6104597169258920, + // 0.1613325712615846, -0.2937408044039052, -0.8725789038271781, + // -0.0207080522817558, -0.0353809253176660, + // -0.1314202134325006, 0.4616552479316257, + // -0.1146471705942074, -0.6456241806340295, + // -0.9633640140188219, -0.0452482140478748, 0.1751535385353780, + // -1.3869847774287927 + VCMP_U64(3, v1, 0x3febfe7fe72e2334, 0xbfe7799406e7cf1f, 0x3fe388e2d0f71ba3, + 0x3fc4a68bb2ac8e62, 0xbfd2cca63b1a97a5, 0xbfebec2a97e3c096, + 0xbf95347ddd418906, 0xbfa21d72da487f01, 0xbfc0d260a75ceb46, + 0x3fdd8bc273f9289e, 0xbfbd59845847f323, 0xbfe4a8f40aaa8efa, + 0xbfeed3e0c4cb54ff, 0xbfa72ac61f1378a7, 0x3fc66b6e5fe4e141, + 0xbff63116f331b43d); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.9175, 0.0740, -0.0362, 0.2961, 0.6226, -0.8032, 0.7749, + // 0.8188, 0.2019, 0.4885, 0.5669, -0.1743, 0.4404, 0.0618, + // 0.8252, -0.5947 + VLOAD_16(v2, 0x3b57, 0x2cbc, 0xa8a3, 0x34bd, 0x38fb, 0xba6d, 0x3a33, 0x3a8d, + 0x3276, 0x37d1, 0x3889, 0xb194, 0x370c, 0x2bea, 0x3a9a, 0xb8c2); + // 0.2812, -0.6733, 0.3289, 0.9609, -0.6841, 0.5488, -0.1401, + // 0.5591, 0.2759, -0.6973, 0.1418, 0.2389, -0.3308, 0.8867, + // 0.8936, 0.3611 + VLOAD_16(v3, 0x3480, 0xb963, 0x3543, 0x3bb0, 0xb979, 0x3864, 0xb07c, 0x3879, + 0x346a, 0xb994, 0x308a, 0x33a5, 0xb54b, 0x3b18, 0x3b26, 0x35c7); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.4780, -0.1810, 0.2800, 0.7529, 0.6484, -0.9526, + // 0.5947, 1.0000, -0.1874, 0.2949, -0.4280, 0.6934, 0.5444, + // 0.8823, -0.8911, 0.7603 + VLOAD_16(v1, 0x37a6, 0xb1cb, 0x347b, 0x3a06, 0x3930, 0xbb9f, 0x38c2, 0x3c00, + 0xb1ff, 0x34b8, 0xb6d9, 0x398c, 0x385b, 0x3b0f, 0xbb21, 0x3a15); + asm volatile("vfmsac.vv v1, v2, v3, v0.t"); + // 0.4780, 0.1312, 0.2800, -0.4683, 0.6484, 0.5117, 0.5947, + // -0.5420, -0.1874, -0.6357, -0.4280, -0.7349, 0.5444, + // -0.8276, -0.8911, -0.9751 + VCMP_U16(4, v1, 0x37a6, 0x3033, 0x347b, 0xb77e, 0x3930, 0x3818, 0x38c2, + 0xb856, 0xb1ff, 0xb916, 0xb6d9, 0xb9e1, 0x385b, 0xba9f, 0xbb21, + 0xbbcd); + + VSET(16, e32, m1); + // -0.90310860, 0.30282700, 0.54854167, -0.38732994, + // 0.92121714, 0.99595129, -0.10263380, 0.83759040, + // -0.23468767, 0.03914077, -0.46234205, 0.38326120, + // 0.36417511, -0.50103557, 0.36991179, 0.44718841 + VLOAD_32(v2, 0xbf673220, 0x3e9b0c24, 0x3f0c6d3a, 0xbec6501c, 0x3f6bd4e3, + 0x3f7ef6aa, 0xbdd231ab, 0x3f566c53, 0xbe7051f7, 0x3d205212, + 0xbeecb819, 0x3ec43ad0, 0x3eba7529, 0xbf0043de, 0x3ebd6514, + 0x3ee4f5e1); + // 0.84989786, -0.04543342, -0.74596256, -0.30687407, + // -0.30795863, 0.57084304, 0.51653886, -0.97366458, + // 0.49300706, 0.62932760, 0.45846274, -0.73850167, + // -0.42686453, -0.31419462, -0.47245970, -0.87721694 + VLOAD_32(v3, 0x3f5992e8, 0xbd3a1866, 0xbf3ef767, 0xbe9d1e99, 0xbe9dacc1, + 0x3f1222c5, 0x3f043be4, 0xbf794215, 0x3efc6b6c, 0x3f211b9d, + 0x3eeabba1, 0xbf3d0e72, 0xbeda8dfd, 0xbea0de1e, 0xbef1e63d, + 0xbf60914a); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.76813585, 0.87161541, -0.67958647, -0.98584491, + // 0.12284227, -0.04006640, -0.93113720, -0.93526161, + // -0.27461481, 0.64110506, 0.61687475, -0.43741968, + // 0.70502371, 0.37014356, -0.98105848, 0.77993429 + VLOAD_32(v1, 0xbf44a48d, 0x3f5f2230, 0xbf2df961, 0xbf7c6055, 0x3dfb94bb, + 0xbd241caa, 0xbf6e5f02, 0xbf6f6d4e, 0xbe8c9a50, 0x3f241f76, + 0x3f1deb81, 0xbedff579, 0x3f347c6f, 0x3ebd8375, 0xbf7b26a6, + 0x3f47a9c6); + asm volatile("vfmsac.vv v1, v2, v3, v0.t"); + // -0.76813585, -0.88537389, -0.67958647, 1.10470641, + // 0.12284227, 0.60859829, -0.93113720, 0.11972952, + // -0.27461481, -0.61647266, 0.61687475, 0.15438065, + // 0.70502371, -0.21272089, -0.98105848, -1.17221546 + VCMP_U32(5, v1, 0xbf44a48d, 0xbf62a7dd, 0xbf2df961, 0x3f8d6705, 0x3dfb94bb, + 0x3f1bcd19, 0xbf6e5f02, 0x3df534be, 0xbe8c9a50, 0xbf1dd127, + 0x3f1deb81, 0x3e1e15f6, 0x3f347c6f, 0xbe59d381, 0xbf7b26a6, + 0xbf960b29); + + VSET(16, e64, m1); + // 0.0971325394189311, 0.6403859199401045, 0.3478142243141771, + // -0.4702414117546168, 0.8862438155310881, 0.6157878617136987, + // -0.9954501284062294, -0.2761157935600853, + // -0.7189549700888722, -0.2302799669824283, 0.0093666993515229, + // 0.9188774299961215, -0.4297410504980956, 0.2729294776457381, + // -0.1419575372981836, -0.8472908703054822 + VLOAD_64(v2, 0x3fb8ddad982e8680, 0x3fe47e0a9cdec59e, 0x3fd6429697a0d4f8, + 0xbfde186f6f2d8030, 0x3fec5c1bfd7f9ffe, 0x3fe3b488beeab100, + 0xbfefdaba3a49b85e, 0xbfd1abe193cffa54, 0xbfe701adda7a81f6, + 0xbfcd79d05f8e86d0, 0x3f832ed91b170d00, 0x3fed6771a3dbb538, + 0xbfdb80e09b68d514, 0x3fd177ad33269468, 0xbfc22baa220ee628, + 0xbfeb1d01be452a62); + // -0.2416734667201210, -0.2737616510555549, 0.6084509432766920, + // -0.4000545529138850, 0.5985258122916897, -0.9559409603601607, + // 0.5010970610326939, 0.5772808284477746, -0.4551243154247406, + // 0.6584804564152213, 0.6542532086910551, -0.2215058802905889, + // 0.3203723346938081, 0.0696368102348055, 0.8882580549203218, + // 0.7725843936650791 + VLOAD_64(v3, 0xbfceef27f9efdac8, 0xbfd1854f968baf44, 0x3fe3786e1cd2fff2, + 0xbfd99a7e695862ec, 0x3fe3271f9ab3593a, 0xbfee97117f34eb4c, + 0x3fe008fcb4283a76, 0x3fe27915a4d94fb2, 0xbfdd20c1bc974608, + 0x3fe512459b2b7912, 0x3fe4efa46cd43256, 0xbfcc5a4dffdc2170, + 0x3fd480faf7036588, 0x3fb1d3b7ce8e6640, 0x3fec6c9c280952c6, + 0x3fe8b902e80620ce); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.8982912058335177, 0.5582779858188844, -0.3988318240568800, + // 0.0267896464795028, 0.8241806039831361, 0.2839220639224551, + // -0.4781090814672235, -0.1240154287362147, 0.4586341020154134, + // -0.6132901056934972, 0.1207753636997857, 0.4420874266235846, + // 0.8256868703569773, 0.0642541522901756, -0.3012484644971416, + // 0.7323810741358745 + VLOAD_64(v1, 0xbfecbecd32eadc10, 0x3fe1dd69cb65674e, 0xbfd98675ea3b69b0, + 0x3f9b6ebebe00e300, 0x3fea5fb000835cf4, 0x3fd22bc772ca399c, + 0xbfde9956d534a0f8, 0xbfbfbf79a29f1810, 0x3fdd5a42d93f2348, + 0xbfe3a012925d3f1c, 0x3fbeeb225d40ca30, 0x3fdc4b290fd48cd4, + 0x3fea6c06df1d6f14, 0x3fb072f5cab7f020, 0xbfd347a7a3bf1174, + 0x3fe76faa6f33ef10); + asm volatile("vfmsac.vv v1, v2, v3, v0.t"); + // -0.8982912058335177, -0.7335910925744179, -0.3988318240568800, + // 0.1613325712615846, 0.8241806039831361, -0.8725789038271781, + // -0.4781090814672235, -0.0353809253176660, 0.4586341020154134, + // 0.4616552479316257, 0.1207753636997857, -0.6456241806340295, + // 0.8256868703569773, -0.0452482140478748, -0.3012484644971416, + // -1.3869847774287927 + VCMP_U64(6, v1, 0xbfecbecd32eadc10, 0xbfe7799406e7cf1f, 0xbfd98675ea3b69b0, + 0x3fc4a68bb2ac8e62, 0x3fea5fb000835cf4, 0xbfebec2a97e3c096, + 0xbfde9956d534a0f8, 0xbfa21d72da487f01, 0x3fdd5a42d93f2348, + 0x3fdd8bc273f9289e, 0x3fbeeb225d40ca30, 0xbfe4a8f40aaa8efa, + 0x3fea6c06df1d6f14, 0xbfa72ac61f1378a7, 0xbfd347a7a3bf1174, + 0xbff63116f331b43d); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.3911 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3642); + // 0.3203, -0.8521, 0.0744, 0.9370, 0.2056, 0.2866, -0.8379, + // -0.2668, -0.0878, -0.5703, 0.1272, -0.6606, -0.6919, 0.9189, + // 0.6245, 0.9932 + VLOAD_16(v2, 0x3520, 0xbad1, 0x2cc3, 0x3b7f, 0x3294, 0x3496, 0xbab4, 0xb445, + 0xad9f, 0xb890, 0x3012, 0xb949, 0xb989, 0x3b5a, 0x38ff, 0x3bf2); + // 0.8706, 0.4900, -0.9497, 0.4727, -0.7168, 0.0167, -0.3606, + // -0.1565, -0.5142, 0.8271, -0.4783, 0.6318, 0.0842, + // -0.6646, 0.1454, -0.3020 + VLOAD_16(v1, 0x3af7, 0x37d7, 0xbb99, 0x3790, 0xb9bc, 0x2445, 0xb5c5, 0xb102, + 0xb81d, 0x3a9e, 0xb7a7, 0x390e, 0x2d63, 0xb951, 0x30a7, 0xb4d5); + asm volatile("vfmsac.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.7451, -0.8232, 0.9790, -0.1062, 0.7974, 0.0955, 0.0330, + // 0.0521, 0.4797, -1.0498, 0.5278, -0.8901, -0.3547, 1.0234, + // 0.0989, 0.6904 + VCMP_U16(7, v1, 0xb9f6, 0xba96, 0x3bd5, 0xaecc, 0x3a61, 0x2e1b, 0x2836, + 0x2aac, 0x37ad, 0xbc33, 0x3839, 0xbb1f, 0xb5ad, 0x3c19, 0x2e54, + 0x3986); + + VSET(16, e32, m1); + double dscalar_32; + // -0.39704049 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbecb48e4); + // 0.43844241, 0.13734208, 0.15601240, 0.48965997, + // -0.41457745, -0.69918746, 0.38535324, 0.83301985, + // 0.79336989, -0.03326649, -0.85931808, 0.92554229, + // -0.77742523, 0.47821125, -0.53653014, -0.32442030 + VLOAD_32(v2, 0x3ee07b86, 0x3e0ca367, 0x3e1fc1b7, 0x3efab4b6, 0xbed4437f, + 0xbf32fdf3, 0x3ec54d05, 0x3f5540ca, 0x3f4b1a4a, 0xbd084272, + 0xbf5bfc45, 0x3f6cf057, 0xbf470557, 0x3ef4d81b, 0xbf095a0a, + 0xbea61a6b); + // -0.73119336, 0.87333083, -0.16325396, -0.30275631, + // 0.34779423, 0.22721651, 0.47497734, -0.58483958, + // -0.24916913, 0.13750601, -0.99799657, 0.66137350, + // 0.58565408, 0.68887448, -0.74538875, 0.99311894 + VLOAD_32(v1, 0xbf3b2f7d, 0x3f5f929c, 0xbe272c0c, 0xbe9b02e0, 0x3eb21216, + 0x3e68ab72, 0x3ef3303b, 0xbf15b80c, 0xbe7f2631, 0x3e0cce60, + 0xbf7f7cb4, 0x3f294fc6, 0x3f15ed6d, 0x3f305a14, 0xbf3ed1cc, + 0x3f7e3d0b); + asm volatile("vfmsac.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // 0.55711401, -0.92786121, 0.10131072, 0.10834149, + // -0.18319020, 0.05038923, -0.62797821, 0.25409698, + // -0.06583084, -0.12429786, 1.33918071, -1.02885127, + // -0.27698478, -0.87874371, 0.95841295, -0.86431098 + VCMP_U32(8, v1, 0x3f0e9f06, 0xbf6d8850, 0x3dcf7bff, 0x3ddde223, 0xbe3b9636, + 0x3d4e64ec, 0xbf20c32e, 0x3e821900, 0xbd86d252, 0xbdfe8fe1, + 0x3fab6a45, 0xbf83b166, 0xbe8dd0f3, 0xbf60f559, 0x3f755a8d, + 0xbf5d437b); + + VSET(16, e64, m1); + double dscalar_64; + // 0.0070730785066928 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3f7cf8a90de48000); + // -0.3542445595658672, 0.5861662785402695, 0.5713440701195280, + // 0.2841717566030781, 0.4022451154567073, -0.9804628417449213, + // -0.9703836833708208, 0.2288593539727362, 0.1806576644288407, + // 0.4892172254017777, 0.9508074316559227, -0.9022151172016701, + // -0.7929839752648156, 0.5513143449560454, 0.4823446191982377, + // -0.7486658065787619 + VLOAD_64(v2, 0xbfd6abf15f87c3c4, 0x3fe2c1dfc88b26c8, 0x3fe248735bfda932, + 0x3fd22fdebc43a768, 0x3fd9be624bf72ff4, 0xbfef5ff39c079aea, + 0xbfef0d621514ca4c, 0x3fcd4b43685929d8, 0x3fc71fca543f2eb8, + 0x3fdf4f55c3ef6448, 0x3fee6d03b4f830b0, 0xbfecdef23ccad0bc, + 0xbfe9601fee00766c, 0x3fe1a45dfb2cdc2e, 0x3fdedebbf736e98c, + 0xbfe7f511fe5c74b0); + // -0.7603855538897846, -0.0491604902215765, + // -0.3714656077097227, -0.6096204185796581, + // -0.2818689596683441, 0.3527700521309320, 0.1176602936422064, + // -0.2049443830034134, -0.6926950556538125, 0.7269529331298494, + // -0.2107692441818434, 0.1746722346734710, + // -0.5298547863982788, 0.2397543330794352, + // -0.8347981409736787, -0.6198539479673024 + VLOAD_64(v1, 0xbfe8551415c9d6cc, 0xbfa92b9053839560, 0xbfd7c617af2cedf8, + 0xbfe38202ae18c034, 0xbfd20a241ae21e00, 0x3fd693c8d73a46c0, + 0x3fbe1efc293b2500, 0xbfca3b9e173fd0c8, 0xbfe62a8ed24449ee, + 0x3fe74332cc30c46e, 0xbfcafa7c9161bf78, 0x3fc65ba8e7b88cc0, + 0xbfe0f4920666b5a4, 0x3fceb0451dd34270, 0xbfeab6aa9747cb24, + 0xbfe3d5d7f25a1d14); + asm volatile("vfmsac.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // 0.7578799543094064, 0.0533064903276678, 0.3755067691720115, + // 0.6116303877234964, 0.2847140709489031, -0.3597049427834890, + // -0.1245238936163020, 0.2065631231810536, 0.6939728614971534, + // -0.7234926612877562, 0.2174943797906927, + // -0.1810536730273635, 0.5242459484866814, + // -0.2358548434356951, 0.8382098023325486, 0.6145585759420944 + VCMP_U64(9, v1, 0x3fe8408d7641b126, 0x3fab4afd013e6639, 0x3fd8084d8b414e68, + 0x3fe39279e4106415, 0x3fd238c15ddbf0a4, 0xbfd70567e15dbc9b, + 0xbfbfe0cc42a710ce, 0x3fca70a9114fa5b7, 0x3fe63506930e2352, + 0xbfe726da14e40fb7, 0x3fcbd6db1821e5e6, 0xbfc72cc44a3c91ef, + 0x3fe0c69f7079f20d, 0xbfce307dd3946ada, 0x3fead29d5d068eb6, + 0x3fe3aa76bf24b95e); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.3911 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3642); + // 0.3203, -0.8521, 0.0744, 0.9370, 0.2056, 0.2866, + // -0.8379, -0.2668, -0.0878, -0.5703, 0.1272, -0.6606, + // -0.6919, 0.9189, 0.6245, 0.9932 + VLOAD_16(v2, 0x3520, 0xbad1, 0x2cc3, 0x3b7f, 0x3294, 0x3496, 0xbab4, 0xb445, + 0xad9f, 0xb890, 0x3012, 0xb949, 0xb989, 0x3b5a, 0x38ff, 0x3bf2); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.8706, 0.4900, -0.9497, 0.4727, -0.7168, 0.0167, + // -0.3606, -0.1565, -0.5142, 0.8271, -0.4783, 0.6318, + // 0.0842, -0.6646, 0.1454, -0.3020 + VLOAD_16(v1, 0x3af7, 0x37d7, 0xbb99, 0x3790, 0xb9bc, 0x2445, 0xb5c5, 0xb102, + 0xb81d, 0x3a9e, 0xb7a7, 0x390e, 0x2d63, 0xb951, 0x30a7, 0xb4d5); + asm volatile("vfmsac.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // 0.8706, -0.8232, -0.9497, -0.1062, -0.7168, 0.0955, + // -0.3606, 0.0521, -0.5142, -1.0498, -0.4783, -0.8901, + // 0.0842, 1.0234, 0.1454, 0.6904 + VCMP_U16(10, v1, 0x3af7, 0xba96, 0xbb99, 0xaecc, 0xb9bc, 0x2e1b, 0xb5c5, + 0x2aac, 0xb81d, 0xbc33, 0xb7a7, 0xbb1f, 0x2d63, 0x3c19, 0x30a7, + 0x3986); + + VSET(16, e32, m1); + double dscalar_32; + // -0.39704049 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbecb48e4); + // 0.43844241, 0.13734208, 0.15601240, 0.48965997, + // -0.41457745, -0.69918746, 0.38535324, 0.83301985, + // 0.79336989, -0.03326649, -0.85931808, 0.92554229, + // -0.77742523, 0.47821125, -0.53653014, -0.32442030 + VLOAD_32(v2, 0x3ee07b86, 0x3e0ca367, 0x3e1fc1b7, 0x3efab4b6, 0xbed4437f, + 0xbf32fdf3, 0x3ec54d05, 0x3f5540ca, 0x3f4b1a4a, 0xbd084272, + 0xbf5bfc45, 0x3f6cf057, 0xbf470557, 0x3ef4d81b, 0xbf095a0a, + 0xbea61a6b); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.73119336, 0.87333083, -0.16325396, -0.30275631, + // 0.34779423, 0.22721651, 0.47497734, -0.58483958, + // -0.24916913, 0.13750601, -0.99799657, 0.66137350, + // 0.58565408, 0.68887448, -0.74538875, 0.99311894 + VLOAD_32(v1, 0xbf3b2f7d, 0x3f5f929c, 0xbe272c0c, 0xbe9b02e0, 0x3eb21216, + 0x3e68ab72, 0x3ef3303b, 0xbf15b80c, 0xbe7f2631, 0x3e0cce60, + 0xbf7f7cb4, 0x3f294fc6, 0x3f15ed6d, 0x3f305a14, 0xbf3ed1cc, + 0x3f7e3d0b); + asm volatile("vfmsac.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // -0.73119336, -0.92786121, -0.16325396, 0.10834149, + // 0.34779423, 0.05038923, 0.47497734, 0.25409698, + // -0.24916913, -0.12429786, -0.99799657, -1.02885127, + // 0.58565408, -0.87874371, -0.74538875, -0.86431098 + VCMP_U32(11, v1, 0xbf3b2f7d, 0xbf6d8850, 0xbe272c0c, 0x3ddde223, 0x3eb21216, + 0x3d4e64ec, 0x3ef3303b, 0x3e821900, 0xbe7f2631, 0xbdfe8fe1, + 0xbf7f7cb4, 0xbf83b166, 0x3f15ed6d, 0xbf60f559, 0xbf3ed1cc, + 0xbf5d437b); + + VSET(16, e64, m1); + double dscalar_64; + // 0.0070730785066928 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3f7cf8a90de48000); + // -0.3542445595658672, 0.5861662785402695, + // 0.5713440701195280, 0.2841717566030781, 0.4022451154567073, + // -0.9804628417449213, -0.9703836833708208, + // 0.2288593539727362, 0.1806576644288407, 0.4892172254017777, + // 0.9508074316559227, -0.9022151172016701, + // -0.7929839752648156, 0.5513143449560454, + // 0.4823446191982377, -0.7486658065787619 + VLOAD_64(v2, 0xbfd6abf15f87c3c4, 0x3fe2c1dfc88b26c8, 0x3fe248735bfda932, + 0x3fd22fdebc43a768, 0x3fd9be624bf72ff4, 0xbfef5ff39c079aea, + 0xbfef0d621514ca4c, 0x3fcd4b43685929d8, 0x3fc71fca543f2eb8, + 0x3fdf4f55c3ef6448, 0x3fee6d03b4f830b0, 0xbfecdef23ccad0bc, + 0xbfe9601fee00766c, 0x3fe1a45dfb2cdc2e, 0x3fdedebbf736e98c, + 0xbfe7f511fe5c74b0); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.7603855538897846, -0.0491604902215765, + // -0.3714656077097227, -0.6096204185796581, + // -0.2818689596683441, 0.3527700521309320, + // 0.1176602936422064, -0.2049443830034134, + // -0.6926950556538125, 0.7269529331298494, + // -0.2107692441818434, 0.1746722346734710, + // -0.5298547863982788, 0.2397543330794352, + // -0.8347981409736787, -0.6198539479673024 + VLOAD_64(v1, 0xbfe8551415c9d6cc, 0xbfa92b9053839560, 0xbfd7c617af2cedf8, + 0xbfe38202ae18c034, 0xbfd20a241ae21e00, 0x3fd693c8d73a46c0, + 0x3fbe1efc293b2500, 0xbfca3b9e173fd0c8, 0xbfe62a8ed24449ee, + 0x3fe74332cc30c46e, 0xbfcafa7c9161bf78, 0x3fc65ba8e7b88cc0, + 0xbfe0f4920666b5a4, 0x3fceb0451dd34270, 0xbfeab6aa9747cb24, + 0xbfe3d5d7f25a1d14); + asm volatile("vfmsac.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + // -0.7603855538897846, 0.0533064903276678, + // -0.3714656077097227, 0.6116303877234964, + // -0.2818689596683441, -0.3597049427834890, 0.1176602936422064, + // 0.2065631231810536, -0.6926950556538125, -0.7234926612877562, + // -0.2107692441818434, -0.1810536730273635, + // -0.5298547863982788, -0.2358548434356951, + // -0.8347981409736787, 0.6145585759420944 + VCMP_U64(12, v1, 0xbfe8551415c9d6cc, 0x3fab4afd013e6639, 0xbfd7c617af2cedf8, + 0x3fe39279e4106415, 0xbfd20a241ae21e00, 0xbfd70567e15dbc9b, + 0x3fbe1efc293b2500, 0x3fca70a9114fa5b7, 0xbfe62a8ed24449ee, + 0xbfe726da14e40fb7, 0xbfcafa7c9161bf78, 0xbfc72cc44a3c91ef, + 0xbfe0f4920666b5a4, 0xbfce307dd3946ada, 0xbfeab6aa9747cb24, + 0x3fe3aa76bf24b95e); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmsub.c b/apps/riscv-tests/isa/rv64uv/vfmsub.c new file mode 100644 index 0000000..bbe5f92 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmsub.c @@ -0,0 +1,453 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.6821, 0.7749, 0.0299, 0.0299, -0.5410, -0.1865, 0.1885, + // 0.0228, -0.5410, 0.1902, -0.9160, -0.3511, -0.9287, -0.9961, + // -0.6509, -0.3940 + VLOAD_16(v2, 0x3975, 0x3a33, 0x27a5, 0x27a5, 0xb854, 0xb1f8, 0x3208, 0x25d8, + 0xb854, 0x3216, 0xbb54, 0xb59e, 0xbb6e, 0xbbf8, 0xb935, 0xb64e); + // -0.9048, 0.1698, 0.2411, 0.2411, -0.6147, 0.9580, 0.5117, + // 0.8330, -0.6147, 0.5591, 0.7031, -0.1556, 0.2397, 0.8154, + // 0.1646, 0.2693 + VLOAD_16(v3, 0xbb3d, 0x316f, 0x33b7, 0x33b7, 0xb8eb, 0x3baa, 0x3818, 0x3aaa, + 0xb8eb, 0x3879, 0x39a0, 0xb0fb, 0x33ac, 0x3a86, 0x3144, 0x344f); + // -0.2292, 0.7578, -0.7427, -0.7427, 0.1119, 0.2939, -0.2983, + // -0.3608, 0.1119, -0.5562, -0.0629, -0.1968, -0.8638, -0.2700, + // -0.7690, 0.4216 + VLOAD_16(v1, 0xb356, 0x3a10, 0xb9f1, 0xb9f1, 0x2f29, 0x34b4, 0xb4c6, 0xb5c6, + 0x2f29, 0xb873, 0xac06, 0xb24c, 0xbae9, 0xb452, 0xba27, 0x36bf); + asm volatile("vfmsub.vv v1, v2, v3"); + // 0.7485, 0.4175, -0.2632, -0.2632, 0.5542, -1.0127, -0.5679, + // -0.8413, 0.5542, -0.6650, -0.6455, 0.2247, 0.5625, + // -0.5464, 0.3359, -0.4355 + VCMP_U16(1, v1, 0x39fd, 0x36ae, 0xb436, 0xb436, 0x386f, 0xbc0d, 0xb88b, + 0xbabb, 0x386f, 0xb952, 0xb92a, 0x3331, 0x3880, 0xb85f, 0x3560, + 0xb6f8); + + VSET(16, e32, m1); + // -0.74553698, -0.16736358, -0.11869104, -0.85860848, + // -0.66138542, -0.68386567, -0.45389724, -0.12761629, + // -0.95652348, 0.71083277, 0.24187960, 0.01609672, + // -0.58867335, -0.55222940, -0.67417240, -0.06725668 + VLOAD_32(v2, 0xbf3edb83, 0xbe2b615c, 0xbdf3144a, 0xbf5bcdc4, 0xbf29508e, + 0xbf2f11d2, 0xbee86538, 0xbe02add8, 0xbf74deb9, 0x3f35f923, + 0x3e77af49, 0x3c83dd45, 0xbf16b34c, 0xbf0d5ee8, 0xbf2c9690, + 0xbd89bddf); + // -0.17500710, -0.81537211, -0.31956050, 0.22762603, + // 0.49659184, -0.09389434, 0.05757815, -0.13087828, + // -0.73042232, -0.79662275, -0.96801740, 0.03017101, + // 0.70759267, -0.35606241, 0.18037270, -0.35372722 + VLOAD_32(v3, 0xbe333510, 0xbf50bc3a, 0xbea39d6f, 0x3e6916cc, 0x3efe4149, + 0xbdc04bad, 0x3d6bd711, 0xbe0604f5, 0xbf3afcf5, 0xbf4bef78, + 0xbf77cffd, 0x3cf72932, 0x3f3524cb, 0xbeb64dd0, 0x3e38b39f, + 0xbeb51bbc); + // 0.92876774, 0.18572871, -0.42147154, -0.79289448, + // 0.90907055, 0.07037155, 0.07339484, 0.17415307, + // -0.61978233, -0.04939311, 0.56138068, -0.51601994, + // -0.80625385, -0.31227911, 0.91474551, 0.78424871 + VLOAD_32(v1, 0x3f6dc3b9, 0x3e3e2fab, 0xbed7cb1e, 0xbf4afb22, 0x3f68b8d9, + 0x3d901ef6, 0x3d965009, 0x3e32552f, 0xbf1eaa0e, 0xbd4a506e, + 0x3f0fb6a5, 0xbf0419e2, 0xbf4e66a7, 0xbe9fe30c, 0x3f6a2cc3, + 0x3f48c486); + asm volatile("vfmsub.vv v1, v2, v3"); + // -0.51742357, 0.78428787, 0.36958539, 0.45315993, + // -1.09783781, 0.04576965, -0.09089187, + // 0.10865352, 1.32325864, 0.76151252, 1.10380387, + // -0.03847724, -0.23297250, 0.52851212, -0.79706889, 0.30098125 + VCMP_U32(2, v1, 0xbf0475df, 0x3f48c717, 0x3ebd3a4c, 0x3ee80493, 0xbf8c85f3, + 0x3d3b78f5, 0xbdba2584, 0x3dde85bc, 0x3fa9608a, 0x3f42f27c, + 0x3f8d4973, 0xbd1d9a4f, 0xbe6e9058, 0x3f074c92, 0xbf4c0cb5, + 0x3e9a1a37); + + VSET(16, e64, m1); + // 0.3304351537536074, -0.7528197595818080, -0.7530937950641439, + // -0.7994160811423281, 0.0797802827518117, + // -0.6361377214985149, 0.1748070414096887, 0.8251843575618585, + // 0.0699629848559165, -0.8195631240215655, -0.4843919596862658, + // -0.9206444585342115, 0.9791118581337512, 0.5143481050333210, + // 0.5856279779979670, -0.5536419150604011 + VLOAD_64(v2, 0x3fd525d97cb482ac, 0xbfe8171976e5f762, 0xbfe819582893df6e, + 0xbfe994d1088ce396, 0x3fb46c7b0948dfc0, 0xbfe45b3d7eb2d188, + 0x3fc66013befb8968, 0x3fea67e9069cc438, 0x3fb1e9181be2ff10, + 0xbfea39dc71d5c454, 0xbfdf00472253102c, 0xbfed75eb5e14bcf6, + 0x3fef54e26439ed98, 0x3fe0758a283c1602, 0x3fe2bd76e2a3f6ca, + 0xbfe1b76f3fdc22ac); + // 0.4156163852505284, -0.7806302214299039, -0.8826873649954201, + // 0.4810449553239884, 0.9337837820126544, -0.5377837408558668, + // -0.1434453653318362, 0.1199087999382409, + // -0.2601268153647489, -0.1813009025048657, + // -0.2492371358416354, 0.4131695659117063, + // -0.9085600854772706, -0.3952216110937696, 0.0817663443229741, + // 0.1439804529607418 + VLOAD_64(v3, 0x3fda997577954be0, 0xbfe8faec3ae9f10e, 0xbfec3ef992a7ed86, + 0x3fdec970c7c16d8c, 0x3fede18e86a8f206, 0xbfe135863f697cd2, + 0xbfc25c6af06e7710, 0x3fbeb257d63cc310, 0xbfd0a5eaf1337874, + 0xbfc734de337f3100, 0xbfcfe700a1b1bb78, 0x3fda715ec352c558, + 0xbfed12ec99b26d4c, 0xbfd94b4f95947db0, 0x3fb4eea39ec7d8a0, + 0x3fc26df3945d6540); + // -0.2185765241217579, -0.9587275435281344, 0.1216903502931035, + // 0.7653655177934149, -0.5928258331230032, 0.9123074434439491, + // 0.1569052366565831, 0.2566745252901157, -0.9113595614847214, + // 0.1628442001087833, 0.2337303194688813, 0.1926350000139823, + // -0.6653994610877216, -0.6745212179353777, 0.8748797125997727, + // -0.7324641634418565 + VLOAD_64(v1, 0xbfcbfa50c7635df8, 0xbfeeade562a749c2, 0x3fbf27194abf66e0, + 0x3fe87ddfd38d1514, 0xbfe2f86de1af9792, 0x3fed319f612fa6f6, + 0x3fc4157886016dd8, 0x3fd06d5afcf59780, 0xbfed29db86ef2934, + 0x3fc4d81428e7be98, 0x3fcdeae00719eac8, 0x3fc8a84380900070, + 0xbfe54af3cf84bab0, 0xbfe595ad856fb278, 0x3febff03bd3198ce, + 0xbfe77058af6f3156); + asm volatile("vfmsub.vv v1, v2, v3"); + // -0.4878417526056305, 1.5023792602532113, 0.7910431172705017, + // -1.0928904581998689, -0.9810795946017860, -0.0425694375227023, + // 0.1708735055334605, 0.0918950033157782, 0.1963653801662987, + // 0.0478398011349183, 0.1360200483560070, -0.5905179111943168, + // 0.2570595827304748, 0.0482829008439404, 0.4305876927582732, + // 0.2615424092003222 + VCMP_U64(3, v1, 0xbfdf38cc9d4420dd, 0x3ff809bed5cf9e94, 0x3fe95039a7cce2e7, + 0xbff17c7ab4814324, 0xbfef650108b2cdb1, 0xbfa5cba94bf030ac, + 0x3fc5df2edb027178, 0x3fb7866e51e83656, 0x3fc9228032f0c004, + 0x3fa87e755aa4ab1c, 0x3fc1691adda50ab1, 0xbfe2e585d18904b2, + 0x3fd073aa093cd9d6, 0x3fa8b88950295616, 0x3fdb8ebfae9d3d83, + 0x3fd0bd1c5f821364); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.6821, 0.7749, 0.0299, 0.0299, -0.5410, -0.1865, 0.1885, + // 0.0228, 0.7217, 0.1902, -0.9160, -0.3511, -0.9287, -0.9961, + // -0.6509, -0.3940 + VLOAD_16(v2, 0x3975, 0x3a33, 0x27a5, 0x27a5, 0xb854, 0xb1f8, 0x3208, 0x25d8, + 0x39c6, 0x3216, 0xbb54, 0xb59e, 0xbb6e, 0xbbf8, 0xb935, 0xb64e); + // -0.9048, 0.1698, 0.2411, 0.2411, -0.6147, 0.9580, 0.5117, + // 0.8330, -0.8584, 0.5591, 0.7031, -0.1556, 0.2397, 0.8154, + // 0.1646, 0.2693 + VLOAD_16(v3, 0xbb3d, 0x316f, 0x33b7, 0x33b7, 0xb8eb, 0x3baa, 0x3818, 0x3aaa, + 0xbade, 0x3879, 0x39a0, 0xb0fb, 0x33ac, 0x3a86, 0x3144, 0x344f); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.2292, 0.7578, -0.7427, -0.7427, 0.1119, 0.2939, -0.2983, + // -0.3608, 0.3169, -0.5562, -0.0629, -0.1968, -0.8638, -0.2700, + // -0.7690, 0.4216 + VLOAD_16(v1, 0xb356, 0x3a10, 0xb9f1, 0xb9f1, 0x2f29, 0x34b4, 0xb4c6, 0xb5c6, + 0x3512, 0xb873, 0xac06, 0xb24c, 0xbae9, 0xb452, 0xba27, 0x36bf); + asm volatile("vfmsub.vv v1, v2, v3, v0.t"); + // -0.2292, 0.4175, -0.7427, -0.2632, 0.1119, -1.0127, -0.2983, + // -0.8413, 0.3169, -0.6650, -0.0629, 0.2247, -0.8638, -0.5464, + // -0.7690, -0.4355 + VCMP_U16(4, v1, 0xb356, 0x36ae, 0xb9f1, 0xb436, 0x2f29, 0xbc0d, 0xb4c6, + 0xbabb, 0x3512, 0xb952, 0xac06, 0x3331, 0xbae9, 0xb85f, 0xba27, + 0xb6f8); + + VSET(16, e32, m1); + // -0.74553698, -0.16736358, -0.11869104, -0.85860848, + // -0.66138542, -0.68386567, -0.45389724, -0.12761629, + // -0.95652348, 0.71083277, 0.24187960, 0.01609672, + // -0.58867335, -0.55222940, -0.67417240, -0.06725668 + VLOAD_32(v2, 0xbf3edb83, 0xbe2b615c, 0xbdf3144a, 0xbf5bcdc4, 0xbf29508e, + 0xbf2f11d2, 0xbee86538, 0xbe02add8, 0xbf74deb9, 0x3f35f923, + 0x3e77af49, 0x3c83dd45, 0xbf16b34c, 0xbf0d5ee8, 0xbf2c9690, + 0xbd89bddf); + // -0.17500710, -0.81537211, -0.31956050, 0.22762603, + // 0.49659184, -0.09389434, 0.05757815, -0.13087828, + // -0.73042232, -0.79662275, -0.96801740, 0.03017101, + // 0.70759267, -0.35606241, 0.18037270, -0.35372722 + VLOAD_32(v3, 0xbe333510, 0xbf50bc3a, 0xbea39d6f, 0x3e6916cc, 0x3efe4149, + 0xbdc04bad, 0x3d6bd711, 0xbe0604f5, 0xbf3afcf5, 0xbf4bef78, + 0xbf77cffd, 0x3cf72932, 0x3f3524cb, 0xbeb64dd0, 0x3e38b39f, + 0xbeb51bbc); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.92876774, 0.18572871, -0.42147154, -0.79289448, + // 0.90907055, 0.07037155, 0.07339484, 0.17415307, + // -0.61978233, -0.04939311, 0.56138068, -0.51601994, + // -0.80625385, -0.31227911, 0.91474551, 0.78424871 + VLOAD_32(v1, 0x3f6dc3b9, 0x3e3e2fab, 0xbed7cb1e, 0xbf4afb22, 0x3f68b8d9, + 0x3d901ef6, 0x3d965009, 0x3e32552f, 0xbf1eaa0e, 0xbd4a506e, + 0x3f0fb6a5, 0xbf0419e2, 0xbf4e66a7, 0xbe9fe30c, 0x3f6a2cc3, + 0x3f48c486); + asm volatile("vfmsub.vv v1, v2, v3, v0.t"); + // 0.92876774, 0.78428787, -0.42147154, 0.45315993, + // 0.90907055, 0.04576965, 0.07339484, 0.10865352, + // -0.61978233, 0.76151252, 0.56138068, -0.03847724, + // -0.80625385, 0.52851212, 0.91474551, 0.30098125 + VCMP_U32(5, v1, 0x3f6dc3b9, 0x3f48c717, 0xbed7cb1e, 0x3ee80493, 0x3f68b8d9, + 0x3d3b78f5, 0x3d965009, 0x3dde85bc, 0xbf1eaa0e, 0x3f42f27c, + 0x3f0fb6a5, 0xbd1d9a4f, 0xbf4e66a7, 0x3f074c92, 0x3f6a2cc3, + 0x3e9a1a37); + + VSET(16, e64, m1); + // 0.3304351537536074, -0.7528197595818080, -0.7530937950641439, + // -0.7994160811423281, 0.0797802827518117, + // -0.6361377214985149, 0.1748070414096887, 0.8251843575618585, + // 0.0699629848559165, -0.8195631240215655, -0.4843919596862658, + // -0.9206444585342115, 0.9791118581337512, 0.5143481050333210, + // 0.5856279779979670, -0.5536419150604011 + VLOAD_64(v2, 0x3fd525d97cb482ac, 0xbfe8171976e5f762, 0xbfe819582893df6e, + 0xbfe994d1088ce396, 0x3fb46c7b0948dfc0, 0xbfe45b3d7eb2d188, + 0x3fc66013befb8968, 0x3fea67e9069cc438, 0x3fb1e9181be2ff10, + 0xbfea39dc71d5c454, 0xbfdf00472253102c, 0xbfed75eb5e14bcf6, + 0x3fef54e26439ed98, 0x3fe0758a283c1602, 0x3fe2bd76e2a3f6ca, + 0xbfe1b76f3fdc22ac); + // 0.4156163852505284, -0.7806302214299039, -0.8826873649954201, + // 0.4810449553239884, 0.9337837820126544, -0.5377837408558668, + // -0.1434453653318362, 0.1199087999382409, + // -0.2601268153647489, -0.1813009025048657, + // -0.2492371358416354, 0.4131695659117063, + // -0.9085600854772706, -0.3952216110937696, 0.0817663443229741, + // 0.1439804529607418 + VLOAD_64(v3, 0x3fda997577954be0, 0xbfe8faec3ae9f10e, 0xbfec3ef992a7ed86, + 0x3fdec970c7c16d8c, 0x3fede18e86a8f206, 0xbfe135863f697cd2, + 0xbfc25c6af06e7710, 0x3fbeb257d63cc310, 0xbfd0a5eaf1337874, + 0xbfc734de337f3100, 0xbfcfe700a1b1bb78, 0x3fda715ec352c558, + 0xbfed12ec99b26d4c, 0xbfd94b4f95947db0, 0x3fb4eea39ec7d8a0, + 0x3fc26df3945d6540); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.2185765241217579, -0.9587275435281344, 0.1216903502931035, + // 0.7653655177934149, -0.5928258331230032, 0.9123074434439491, + // 0.1569052366565831, 0.2566745252901157, -0.9113595614847214, + // 0.1628442001087833, 0.2337303194688813, 0.1926350000139823, + // -0.6653994610877216, -0.6745212179353777, 0.8748797125997727, + // -0.7324641634418565 + VLOAD_64(v1, 0xbfcbfa50c7635df8, 0xbfeeade562a749c2, 0x3fbf27194abf66e0, + 0x3fe87ddfd38d1514, 0xbfe2f86de1af9792, 0x3fed319f612fa6f6, + 0x3fc4157886016dd8, 0x3fd06d5afcf59780, 0xbfed29db86ef2934, + 0x3fc4d81428e7be98, 0x3fcdeae00719eac8, 0x3fc8a84380900070, + 0xbfe54af3cf84bab0, 0xbfe595ad856fb278, 0x3febff03bd3198ce, + 0xbfe77058af6f3156); + asm volatile("vfmsub.vv v1, v2, v3, v0.t"); + // -0.2185765241217579, 1.5023792602532113, 0.1216903502931035, + // -1.0928904581998689, -0.5928258331230032, -0.0425694375227023, + // 0.1569052366565831, 0.0918950033157782, -0.9113595614847214, + // 0.0478398011349183, 0.2337303194688813, -0.5905179111943168, + // -0.6653994610877216, 0.0482829008439404, 0.8748797125997727, + // 0.2615424092003222 + VCMP_U64(6, v1, 0xbfcbfa50c7635df8, 0x3ff809bed5cf9e94, 0x3fbf27194abf66e0, + 0xbff17c7ab4814324, 0xbfe2f86de1af9792, 0xbfa5cba94bf030ac, + 0x3fc4157886016dd8, 0x3fb7866e51e83656, 0xbfed29db86ef2934, + 0x3fa87e755aa4ab1c, 0x3fcdeae00719eac8, 0xbfe2e585d18904b2, + 0xbfe54af3cf84bab0, 0x3fa8b88950295616, 0x3febff03bd3198ce, + 0x3fd0bd1c5f821364); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.1489 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x30c4); + // 0.8530, -0.3298, -0.1814, -0.2385, 0.9946, 0.6553, 0.8711, + // -0.6377, 0.4224, -0.1814, 0.7026, 0.2852, 0.0553, 0.7349, + // -0.8105, 0.0033 + VLOAD_16(v2, 0x3ad3, 0xb547, 0xb1ce, 0xb3a2, 0x3bf5, 0x393e, 0x3af8, 0xb91a, + 0x36c2, 0xb1ce, 0x399f, 0x3490, 0x2b15, 0x39e1, 0xba7c, 0x1abd); + // -0.2338, -0.2512, 0.0069, 0.0613, -0.1733, 0.8560, -0.2766, + // -0.0028, -0.1803, 0.0069, 0.7856, -0.0243, -0.1974, 0.6416, + // 0.7109, 0.0817 + VLOAD_16(v1, 0xb37b, 0xb405, 0x1f06, 0x2bd8, 0xb18c, 0x3ad9, 0xb46d, 0x99d2, + 0xb1c5, 0x1f06, 0x3a49, 0xa639, 0xb251, 0x3922, 0x39b0, 0x2d3a); + asm volatile("vfmsub.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.8877, 0.2925, 0.1824, 0.2477, -1.0205, -0.5278, -0.9121, + // 0.6372, -0.4492, 0.1824, -0.5854, -0.2888, -0.0847, -0.6392, + // 0.9165, 0.0089 + VCMP_U16(7, v1, 0xbb1a, 0x34ae, 0x31d6, 0x33ed, 0xbc15, 0xb839, 0xbb4c, + 0x3919, 0xb730, 0x31d6, 0xb8af, 0xb49f, 0xad6c, 0xb91d, 0x3b55, + 0x208b); + + VSET(16, e32, m1); + double dscalar_32; + // -0.12857932 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe03aa4c); + // 0.31050768, -0.13843875, 0.23405042, -0.30545133, + // -0.28880060, 0.46233574, -0.51105869, -0.11776974, + // -0.39969075, 0.51141965, 0.88750082, -0.22310242, + // 0.60111052, 0.58466393, -0.14306845, -0.01826003 + VLOAD_32(v2, 0x3e9efadd, 0xbe0dc2e3, 0x3e6faaea, 0xbe9c641e, 0xbe93ddac, + 0x3eecb745, 0xbf02d4be, 0xbdf13143, 0xbecca444, 0x3f02ec66, + 0x3f633341, 0xbe6474f6, 0x3f19e261, 0x3f15ac89, 0xbe128089, + 0xbc95960e); + // -0.51789892, 0.77328473, -0.88433731, 0.40865302, + // -0.50454420, 0.30827177, -0.25503114, 0.07736996, + // 0.20596179, -0.42633566, 0.89622146, 0.03779412, 0.50878429, + // 0.67896879, -0.17667305, 0.06984760 + VLOAD_32(v1, 0xbf049506, 0x3f45f5fd, 0xbf6263ee, 0x3ed13af8, 0xbf0129cf, + 0x3e9dd5cc, 0xbe829371, 0x3d9e7424, 0x3e52e7a6, 0xbeda48ab, + 0x3f656ec5, 0x3d1ace01, 0x3f023fb0, 0x3f2dd0e6, 0xbe34e9c8, + 0x3d8f0c42); + asm volatile("vfmsub.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // -0.24391660, 0.03901032, -0.12034293, 0.25290701, + // 0.35367453, -0.50197309, 0.54385042, 0.10782156, 0.37320831, + // -0.45660171, -1.00273633, 0.21824288, -0.66652966, + // -0.67196524, 0.16578496, 0.00927907 + VCMP_U32(8, v1, 0xbe79c546, 0x3d1fc94a, 0xbdf6765b, 0x3e817d07, 0x3eb514d5, + 0xbf00814f, 0x3f0b39c8, 0x3ddcd18d, 0x3ebf1529, 0xbee9c7b3, + 0xbf8059aa, 0x3e5f7b10, 0xbf2aa1b0, 0xbf2c05eb, 0x3e29c388, + 0x3c18073f); + + VSET(16, e64, m1); + double dscalar_64; + // -0.6953502965951812 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfe6404f43e47c8c); + // -0.8873182146436771, 0.3913246153259273, 0.8941416868753180, + // 0.2630283463166789, -0.8096670634564123, 0.6449486037845993, + // 0.8384405697279889, -0.9956067461953679, -0.8936777193492917, + // -0.4464070291333477, 0.5599998966835931, + // -0.3406088963725078, 0.4908382567748615, + // -0.5194254665571632, 0.0909287222245825, 0.5893410930389467 + VLOAD_64(v2, 0xbfec64e92b21453c, 0x3fd90b76663c74f4, 0x3fec9ccf06e3d51a, + 0x3fd0d574d8567864, 0xbfe9e8cae6c6325c, 0x3fe4a36b411b6206, + 0x3fead4815153e1da, 0xbfefdc02add2c126, 0xbfec990204389c42, + 0xbfdc91eec9b5438c, 0x3fe1eb84e7409f04, 0xbfd5cc8941a96178, + 0x3fdf69e4dd1e50c8, 0xbfe09f2227f25264, 0x3fb7471ad038be10, + 0x3fe2dbe1da195142); + // -0.4387964890891065, -0.2425720412460179, + // -0.8909058709916624, -0.7961584351708695, 0.0353694444236163, + // 0.2992862865812480, -0.4186756300648600, -0.5421957392048740, + // 0.3780444269462682, -0.6731508364205383, 0.1263808806166760, + // 0.8571806635726140, 0.5149747658358419, 0.3530123248386567, + // -0.3756405874818076, -0.4529815298587780 + VLOAD_64(v1, 0xbfdc153dde8f3078, 0xbfcf0c99c409ad98, 0xbfec824d0777279c, + 0xbfe97a21412fca1a, 0x3fa21bf19e277c80, 0x3fd32781ab407ee0, + 0xbfdacb94deb0b06c, 0xbfe159aae0fd4b9a, 0x3fd831e1408ad588, + 0xbfe58a739f7670b4, 0x3fc02d3faa8b4d88, 0x3feb6e062499dac6, + 0x3fe07aac5c30f764, 0x3fd697c1019115dc, 0xbfd80a7ed19236bc, + 0xbfdcfda63e1bdf38); + asm volatile("vfmsub.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // 1.1924354834767115, -0.2226520744998102, -0.2746500252428773, + // 0.2905806577161405, 0.7850729097860438, -0.8530574119257405, + // -0.5473143461852141, 1.3726227142641205, 0.6308044149460488, + // 0.9144826628916634, -0.6478788795043589, -0.2554319322783636, + // -0.8489261129378481, 0.2739582417788488, 0.1702730716940806, + // -0.2743602518995064 + VCMP_U64(9, v1, 0x3ff314373ac1f573, 0xbfcc7fdcf92e7eaa, 0xbfd193ddb310e0ff, + 0x3fd298df9d6f6c70, 0x3fe91f5139103634, 0xbfeb4c3f0eba9b49, + 0xbfe18399602fe862, 0x3ff5f6433c382dac, 0x3fe42f8cbd8bb3c3, + 0x3fed4371253c1e34, 0xbfe4bb6c7ce7b0ea, 0xbfd058ff2cdf5691, + 0xbfeb2a6718793b11, 0x3fd18888263a3a6e, 0x3fc5cb820d286398, + 0xbfd18f1e4d4ec3d2); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.1489 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x30c4); + // 0.8530, -0.3298, -0.1814, -0.2385, 0.9946, 0.6553, 0.8711, + // -0.6377, 0.4224, -0.1814, 0.7026, 0.2852, 0.0553, + // 0.7349, -0.8105, 0.0033 + VLOAD_16(v2, 0x3ad3, 0xb547, 0xb1ce, 0xb3a2, 0x3bf5, 0x393e, 0x3af8, 0xb91a, + 0x36c2, 0xb1ce, 0x399f, 0x3490, 0x2b15, 0x39e1, 0xba7c, 0x1abd); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.2338, -0.2512, 0.0069, 0.0613, -0.1733, 0.8560, + // -0.2766, -0.0028, -0.1803, 0.0069, 0.7856, -0.0243, + // -0.1974, 0.6416, 0.7109, 0.0817 + VLOAD_16(v1, 0xb37b, 0xb405, 0x1f06, 0x2bd8, 0xb18c, 0x3ad9, 0xb46d, 0x99d2, + 0xb1c5, 0x1f06, 0x3a49, 0xa639, 0xb251, 0x3922, 0x39b0, 0x2d3a); + asm volatile("vfmsub.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // -0.2338, 0.2925, 0.0069, 0.2477, -0.1733, -0.5278, + // -0.2766, 0.6372, -0.1803, 0.1824, 0.7856, -0.2888, + // -0.1974, -0.6392, 0.7109, 0.0089 + VCMP_U16(10, v1, 0xb37b, 0x34ae, 0x1f06, 0x33ed, 0xb18c, 0xb839, 0xb46d, + 0x3919, 0xb1c5, 0x31d6, 0x3a49, 0xb49f, 0xb251, 0xb91d, 0x39b0, + 0x208b); + + VSET(16, e32, m1); + double dscalar_32; + // -0.12857932 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe03aa4c); + // 0.31050768, -0.13843875, 0.23405042, -0.30545133, + // -0.28880060, 0.46233574, -0.51105869, -0.11776974, + // -0.39969075, 0.51141965, 0.88750082, -0.22310242, + // 0.60111052, 0.58466393, -0.14306845, -0.01826003 + VLOAD_32(v2, 0x3e9efadd, 0xbe0dc2e3, 0x3e6faaea, 0xbe9c641e, 0xbe93ddac, + 0x3eecb745, 0xbf02d4be, 0xbdf13143, 0xbecca444, 0x3f02ec66, + 0x3f633341, 0xbe6474f6, 0x3f19e261, 0x3f15ac89, 0xbe128089, + 0xbc95960e); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.51789892, 0.77328473, -0.88433731, 0.40865302, + // -0.50454420, 0.30827177, -0.25503114, 0.07736996, + // 0.20596179, -0.42633566, 0.89622146, 0.03779412, + // 0.50878429, 0.67896879, -0.17667305, 0.06984760 + VLOAD_32(v1, 0xbf049506, 0x3f45f5fd, 0xbf6263ee, 0x3ed13af8, 0xbf0129cf, + 0x3e9dd5cc, 0xbe829371, 0x3d9e7424, 0x3e52e7a6, 0xbeda48ab, + 0x3f656ec5, 0x3d1ace01, 0x3f023fb0, 0x3f2dd0e6, 0xbe34e9c8, + 0x3d8f0c42); + asm volatile("vfmsub.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // -0.51789892, 0.03901032, -0.88433731, 0.25290701, + // -0.50454420, -0.50197309, -0.25503114, 0.10782156, + // 0.20596179, -0.45660171, 0.89622146, 0.21824288, + // 0.50878429, -0.67196524, -0.17667305, 0.00927907 + VCMP_U32(11, v1, 0xbf049506, 0x3d1fc94a, 0xbf6263ee, 0x3e817d07, 0xbf0129cf, + 0xbf00814f, 0xbe829371, 0x3ddcd18d, 0x3e52e7a6, 0xbee9c7b3, + 0x3f656ec5, 0x3e5f7b10, 0x3f023fb0, 0xbf2c05eb, 0xbe34e9c8, + 0x3c18073f); + + VSET(16, e64, m1); + double dscalar_64; + // -0.6953502965951812 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfe6404f43e47c8c); + // -0.8873182146436771, 0.3913246153259273, + // 0.8941416868753180, 0.2630283463166789, + // -0.8096670634564123, 0.6449486037845993, + // 0.8384405697279889, -0.9956067461953679, + // -0.8936777193492917, -0.4464070291333477, + // 0.5599998966835931, -0.3406088963725078, 0.4908382567748615, + // -0.5194254665571632, 0.0909287222245825, 0.5893410930389467 + VLOAD_64(v2, 0xbfec64e92b21453c, 0x3fd90b76663c74f4, 0x3fec9ccf06e3d51a, + 0x3fd0d574d8567864, 0xbfe9e8cae6c6325c, 0x3fe4a36b411b6206, + 0x3fead4815153e1da, 0xbfefdc02add2c126, 0xbfec990204389c42, + 0xbfdc91eec9b5438c, 0x3fe1eb84e7409f04, 0xbfd5cc8941a96178, + 0x3fdf69e4dd1e50c8, 0xbfe09f2227f25264, 0x3fb7471ad038be10, + 0x3fe2dbe1da195142); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.4387964890891065, -0.2425720412460179, + // -0.8909058709916624, -0.7961584351708695, + // 0.0353694444236163, 0.2992862865812480, + // -0.4186756300648600, -0.5421957392048740, + // 0.3780444269462682, -0.6731508364205383, 0.1263808806166760, + // 0.8571806635726140, 0.5149747658358419, 0.3530123248386567, + // -0.3756405874818076, -0.4529815298587780 + VLOAD_64(v1, 0xbfdc153dde8f3078, 0xbfcf0c99c409ad98, 0xbfec824d0777279c, + 0xbfe97a21412fca1a, 0x3fa21bf19e277c80, 0x3fd32781ab407ee0, + 0xbfdacb94deb0b06c, 0xbfe159aae0fd4b9a, 0x3fd831e1408ad588, + 0xbfe58a739f7670b4, 0x3fc02d3faa8b4d88, 0x3feb6e062499dac6, + 0x3fe07aac5c30f764, 0x3fd697c1019115dc, 0xbfd80a7ed19236bc, + 0xbfdcfda63e1bdf38); + asm volatile("vfmsub.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + // -0.4387964890891065, -0.2226520744998102, + // -0.8909058709916624, 0.2905806577161405, 0.0353694444236163, + // -0.8530574119257405, + // -0.4186756300648600, 1.3726227142641205, 0.3780444269462682, + // 0.9144826628916634, 0.1263808806166760, -0.2554319322783636, + // 0.5149747658358419, 0.2739582417788488, -0.3756405874818076, + // -0.2743602518995064 + VCMP_U64(12, v1, 0xbfdc153dde8f3078, 0xbfcc7fdcf92e7eaa, 0xbfec824d0777279c, + 0x3fd298df9d6f6c70, 0x3fa21bf19e277c80, 0xbfeb4c3f0eba9b49, + 0xbfdacb94deb0b06c, 0x3ff5f6433c382dac, 0x3fd831e1408ad588, + 0x3fed4371253c1e34, 0x3fc02d3faa8b4d88, 0xbfd058ff2cdf5691, + 0x3fe07aac5c30f764, 0x3fd18888263a3a6e, 0xbfd80a7ed19236bc, + 0xbfd18f1e4d4ec3d2); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmul.c b/apps/riscv-tests/isa/rv64uv/vfmul.c new file mode 100644 index 0000000..fe2faec --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmul.c @@ -0,0 +1,350 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.5522, 0.0462, -0.4255, 0.4131, 0.4658, 0.3931, -0.4868, + // 0.5503, 0.3516, -0.3025, -0.2155, 0.9307, 0.9775, 0.8394, + // 0.7446, 0.3909 + VLOAD_16(v2, 0xb86b, 0x29e9, 0xb6cf, 0x369c, 0x3774, 0x364a, 0xb7ca, 0x3867, + 0x35a0, 0xb4d7, 0xb2e5, 0x3b72, 0x3bd2, 0x3ab7, 0x39f5, 0x3641); + // 0.8247, 0.4902, 0.5796, -0.9561, -0.7676, 0.1672, -0.1094, + // -0.9395, 0.4885, -0.2739, 0.8691, -0.3394, -0.8032, + // -0.4922, 0.4456, 0.2050 + VLOAD_16(v3, 0x3a99, 0x37d8, 0x38a3, 0xbba6, 0xba24, 0x315a, 0xaf01, 0xbb84, + 0x37d1, 0xb462, 0x3af4, 0xb56e, 0xba6d, 0xb7e0, 0x3721, 0x328f); + asm volatile("vfmul.vv v1, v2, v3"); + // -0.4553, 0.0226, -0.2466, -0.3950, -0.3577, 0.0657, 0.0533, + // -0.5171, 0.1718, 0.0829, -0.1873, -0.3159, -0.7852, -0.4131, + // 0.3318, 0.0801 + VCMP_U16(1, v1, 0xb749, 0x25cb, 0xb3e4, 0xb652, 0xb5b9, 0x2c35, 0x2ad2, + 0xb823, 0x317f, 0x2d4e, 0xb1fe, 0xb50e, 0xba48, 0xb69c, 0x354f, + 0x2d21); + + VSET(16, e32, m1); + // 0.48805356, 0.30350628, -0.10483003, 0.61108905, + // -0.09161828, 0.83353645, -0.55006021, -0.78635991, + // 0.49253011, -0.03583150, -0.77662903, 0.57397723, + // -0.54674339, 0.86299890, 0.65402901, -0.16832402 + VLOAD_32(v2, 0x3ef9e228, 0x3e9b652d, 0xbdd6b121, 0x3f1c7055, 0xbdbba25d, + 0x3f5562a5, 0xbf0cd0bf, 0xbf494ee2, 0x3efc2ce8, 0xbd12c40e, + 0xbf46d129, 0x3f12f02c, 0xbf0bf760, 0x3f5ced7f, 0x3f276e72, + 0xbe2c5d22); + // 0.87142652, -0.32756421, 0.76706660, -0.54420376, + // -0.99424285, 0.31885657, 0.18092929, -0.68290263, + // 0.45391774, -0.45151946, -0.08929581, 0.80524033, + // 0.81978256, -0.28325567, -0.53026456, -0.21847765 + VLOAD_32(v3, 0x3f5f15cf, 0xbea7b67f, 0x3f445e7a, 0xbf0b50f0, 0xbf7e86b3, + 0x3ea3412b, 0x3e394587, 0xbf2ed2b5, 0x3ee867e8, 0xbee72d8f, + 0xbdb6e0b9, 0x3f4e243b, 0x3f51dd45, 0xbe9106e3, 0xbf07bf6b, + 0xbe5fb89b); + asm volatile("vfmul.vv v1, v2, v3"); + // 0.42530280, -0.09941780, -0.08041162, -0.33255696, + // 0.09109081, 0.26577857, -0.09952200, 0.53700727, + // 0.22356816, 0.01617862, 0.06934972, 0.46218961, + // -0.44821069, -0.24444933, -0.34680840, 0.03677504 + VCMP_U32(2, v1, 0x3ed9c14a, 0xbdcb9b8f, 0xbda4aed9, 0xbeaa44e8, 0x3dba8dd2, + 0x3e881421, 0xbdcbd231, 0x3f09794f, 0x3e64ef0d, 0x3c848907, + 0x3d8e073a, 0x3eeca41e, 0xbee57bdf, 0xbe7a50ed, 0xbeb190df, + 0x3d16a16c); + + VSET(16, e64, m1); + // -0.7493892241714462, 0.7026559207451004, 0.6475697152132245, + // 0.0771197585157644, -0.2238692303359540, 0.8998213782649329, + // -0.9446193329247832, 0.8596730101791072, -0.0254417293392082, + // 0.1965035124326171, -0.4709662077579637, -0.2875069600640039, + // -0.4671574223295827, 0.3105385724706418, 0.1703390668980564, + // 0.1487690137320270 + VLOAD_64(v2, 0xbfe7faff1c39514c, 0x3fe67c2844fe1c76, 0x3fe4b8e41f971110, + 0x3fb3be1ed8b35c30, 0xbfcca7bf376fd290, 0x3feccb5633fc770c, + 0xbfee3a5252c299d8, 0x3feb8270f8ff23f8, 0xbf9a0d658ddcc1c0, + 0x3fc92706efb93e80, 0xbfde244f72f5dcb4, 0xbfd2668397b639c0, + 0xbfdde5e83ebf4f58, 0x3fd3dfdd2d3a1b90, 0x3fc5cdaba8c776a8, + 0x3fc30adcf05190c8); + // 0.6932733143704406, -0.2687556191190688, 0.2528829246597466, + // 0.7287253758892476, -0.5682564905667424, 0.0092122398882537, + // -0.5132517188156311, -0.0178020357545405, 0.0816988280997786, + // 0.6297663200296084, 0.3637508978200528, 0.6003193921430929, + // -0.9089688764960682, 0.1595578103621622, 0.2113473996516566, + // -0.4586515678904381 + VLOAD_64(v3, 0x3fe62f4b848d2362, 0xbfd1334ac4aee374, 0x3fd02f3bdcc85930, + 0x3fe751b7e126b540, 0xbfe22f283c572a1e, 0x3f82dddde857f980, + 0xbfe06c8ede5db9be, 0xbf923ab26578ce40, 0x3fb4ea36e2cf6110, + 0x3fe4270bb294c832, 0x3fd747b1d881c6e4, 0x3fe335d1038d1808, + 0xbfed1645e5b43d3e, 0x3fc46c63eca9d670, 0x3fcb0d6e7ccc9be0, + 0xbfdd5a8c1b164ebc); + asm volatile("vfmul.vv v1, v2, v3"); + // -0.5195315511948315, -0.1888427270075288, 0.1637593235041994, + // 0.0561991250128884, 0.1272151431765869, 0.0082893703931556, + // 0.4848274962501199, -0.0153039296644220, -0.0020785594718451, + // 0.1237512938975817, -0.1713143809148648, -0.1725960035025313, + // 0.4246315573217200, 0.0495488546564072, 0.0360007188479938, + // -0.0682331414017083 + VCMP_U64(3, v1, 0xbfe0a000a1b3e706, 0xbfc82bff9c4ada77, 0x3fc4f610c56ecca8, + 0x3facc621b7fd0401, 0x3fc04895f7bfec49, 0x3f80fa0475f1bbe1, + 0x3fdf0769e826220a, 0xbf8f57aaab459580, 0xbf61070e1e8a29ae, + 0x3fbfae2a3020b759, 0xbfc5eda12fae9203, 0xbfc617a0373b59a7, + 0x3fdb2d29d6e2f72e, 0x3fa95e77ac9b67ce, 0x3fa26eafac2b53dd, + 0xbfb177ba26d2dcbe); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.5522, 0.0462, -0.4255, 0.4131, 0.4658, 0.3931, -0.4868, + // 0.5503, 0.3516, -0.3025, -0.2155, 0.9307, 0.9775, 0.8394, + // 0.7446, 0.3909 + VLOAD_16(v2, 0xb86b, 0x29e9, 0xb6cf, 0x369c, 0x3774, 0x364a, 0xb7ca, 0x3867, + 0x35a0, 0xb4d7, 0xb2e5, 0x3b72, 0x3bd2, 0x3ab7, 0x39f5, 0x3641); + // 0.8247, 0.4902, 0.5796, -0.9561, -0.7676, 0.1672, -0.1094, + // -0.9395, 0.4885, -0.2739, 0.8691, -0.3394, -0.8032, + // -0.4922, 0.4456, 0.2050 + VLOAD_16(v3, 0x3a99, 0x37d8, 0x38a3, 0xbba6, 0xba24, 0x315a, 0xaf01, 0xbb84, + 0x37d1, 0xb462, 0x3af4, 0xb56e, 0xba6d, 0xb7e0, 0x3721, 0x328f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmul.vv v1, v2, v3, v0.t"); + // 0.0000, 0.0226, 0.0000, -0.3950, 0.0000, 0.0657, 0.0000, + // -0.5171, 0.0000, 0.0829, 0.0000, -0.3159, 0.0000, + // -0.4131, 0.0000, 0.0801 + VCMP_U16(4, v1, 0x0, 0x25cb, 0x0, 0xb652, 0x0, 0x2c35, 0x0, 0xb823, 0x0, + 0x2d4e, 0x0, 0xb50e, 0x0, 0xb69c, 0x0, 0x2d21); + + VSET(16, e32, m1); + // 0.48805356, 0.30350628, -0.10483003, 0.61108905, + // -0.09161828, 0.83353645, -0.55006021, -0.78635991, + // 0.49253011, -0.03583150, -0.77662903, 0.57397723, + // -0.54674339, 0.86299890, 0.65402901, -0.16832402 + VLOAD_32(v2, 0x3ef9e228, 0x3e9b652d, 0xbdd6b121, 0x3f1c7055, 0xbdbba25d, + 0x3f5562a5, 0xbf0cd0bf, 0xbf494ee2, 0x3efc2ce8, 0xbd12c40e, + 0xbf46d129, 0x3f12f02c, 0xbf0bf760, 0x3f5ced7f, 0x3f276e72, + 0xbe2c5d22); + // 0.87142652, -0.32756421, 0.76706660, -0.54420376, + // -0.99424285, 0.31885657, 0.18092929, -0.68290263, + // 0.45391774, -0.45151946, -0.08929581, 0.80524033, + // 0.81978256, -0.28325567, -0.53026456, -0.21847765 + VLOAD_32(v3, 0x3f5f15cf, 0xbea7b67f, 0x3f445e7a, 0xbf0b50f0, 0xbf7e86b3, + 0x3ea3412b, 0x3e394587, 0xbf2ed2b5, 0x3ee867e8, 0xbee72d8f, + 0xbdb6e0b9, 0x3f4e243b, 0x3f51dd45, 0xbe9106e3, 0xbf07bf6b, + 0xbe5fb89b); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmul.vv v1, v2, v3, v0.t"); + // 0.00000000, -0.09941780, 0.00000000, -0.33255696, + // 0.00000000, 0.26577857, 0.00000000, 0.53700727, + // 0.00000000, 0.01617862, 0.00000000, 0.46218961, + // 0.00000000, -0.24444933, 0.00000000, 0.03677504 + VCMP_U32(5, v1, 0x0, 0xbdcb9b8f, 0x0, 0xbeaa44e8, 0x0, 0x3e881421, 0x0, + 0x3f09794f, 0x0, 0x3c848907, 0x0, 0x3eeca41e, 0x0, 0xbe7a50ed, 0x0, + 0x3d16a16c); + + VSET(16, e64, m1); + // -0.7493892241714462, 0.7026559207451004, 0.6475697152132245, + // 0.0771197585157644, -0.2238692303359540, 0.8998213782649329, + // -0.9446193329247832, 0.8596730101791072, -0.0254417293392082, + // 0.1965035124326171, -0.4709662077579637, -0.2875069600640039, + // -0.4671574223295827, 0.3105385724706418, 0.1703390668980564, + // 0.1487690137320270 + VLOAD_64(v2, 0xbfe7faff1c39514c, 0x3fe67c2844fe1c76, 0x3fe4b8e41f971110, + 0x3fb3be1ed8b35c30, 0xbfcca7bf376fd290, 0x3feccb5633fc770c, + 0xbfee3a5252c299d8, 0x3feb8270f8ff23f8, 0xbf9a0d658ddcc1c0, + 0x3fc92706efb93e80, 0xbfde244f72f5dcb4, 0xbfd2668397b639c0, + 0xbfdde5e83ebf4f58, 0x3fd3dfdd2d3a1b90, 0x3fc5cdaba8c776a8, + 0x3fc30adcf05190c8); + // 0.6932733143704406, -0.2687556191190688, 0.2528829246597466, + // 0.7287253758892476, -0.5682564905667424, 0.0092122398882537, + // -0.5132517188156311, -0.0178020357545405, 0.0816988280997786, + // 0.6297663200296084, 0.3637508978200528, 0.6003193921430929, + // -0.9089688764960682, 0.1595578103621622, 0.2113473996516566, + // -0.4586515678904381 + VLOAD_64(v3, 0x3fe62f4b848d2362, 0xbfd1334ac4aee374, 0x3fd02f3bdcc85930, + 0x3fe751b7e126b540, 0xbfe22f283c572a1e, 0x3f82dddde857f980, + 0xbfe06c8ede5db9be, 0xbf923ab26578ce40, 0x3fb4ea36e2cf6110, + 0x3fe4270bb294c832, 0x3fd747b1d881c6e4, 0x3fe335d1038d1808, + 0xbfed1645e5b43d3e, 0x3fc46c63eca9d670, 0x3fcb0d6e7ccc9be0, + 0xbfdd5a8c1b164ebc); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmul.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, -0.1888427270075288, 0.0000000000000000, + // 0.0561991250128884, 0.0000000000000000, 0.0082893703931556, + // 0.0000000000000000, -0.0153039296644220, 0.0000000000000000, + // 0.1237512938975817, 0.0000000000000000, -0.1725960035025313, + // 0.0000000000000000, 0.0495488546564072, 0.0000000000000000, + // -0.0682331414017083 + VCMP_U64(6, v1, 0x0, 0xbfc82bff9c4ada77, 0x0, 0x3facc621b7fd0401, 0x0, + 0x3f80fa0475f1bbe1, 0x0, 0xbf8f57aaab459580, 0x0, 0x3fbfae2a3020b759, + 0x0, 0xbfc617a0373b59a7, 0x0, 0x3fa95e77ac9b67ce, 0x0, + 0xbfb177ba26d2dcbe); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + // -0.8423, 0.9531, 0.3889, -0.3704, -0.9731, -0.4636, -0.4797, + // -0.5903, 0.2959, 0.4685, -0.3660, 0.3167, -0.9766, 0.0052, + // -0.6489, -0.0474 + VLOAD_16(v2, 0xbabd, 0x3ba0, 0x3639, 0xb5ed, 0xbbc9, 0xb76b, 0xb7ad, 0xb8b9, + 0x34bc, 0x377f, 0xb5db, 0x3511, 0xbbd0, 0x1d48, 0xb931, 0xaa11); + double dscalar_16; + // 0.2971 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x34c1); + asm volatile("vfmul.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // -0.2502, 0.2832, 0.1155, -0.1100, -0.2891, -0.1377, -0.1426, + // -0.1754, 0.0879, 0.1392, -0.1088, 0.0941, -0.2900, 0.0015, + // -0.1927, -0.0141 + VCMP_U16(7, v1, 0xb401, 0x3488, 0x2f65, 0xaf0b, 0xb4a0, 0xb068, 0xb090, + 0xb19d, 0x2da0, 0x3074, 0xaef6, 0x2e05, 0xb4a4, 0x1647, 0xb22b, + 0xa336); + + VSET(16, e32, m1); + // -0.11454447, -0.46133029, 0.06972761, 0.20429718, + // -0.97134608, -0.95719630, -0.11250938, 0.48455358, + // 0.59656250, 0.46462929, 0.13447689, -0.32035729, 0.75118428, + // 0.90634471, 0.73552424, -0.53555632 + VLOAD_32(v2, 0xbdea964b, 0xbeec337c, 0x3d8ecd5a, 0x3e513348, 0xbf78aa23, + 0xbf750ad1, 0xbde66b52, 0x3ef81768, 0x3f18b852, 0x3eede3e4, + 0x3e09b44f, 0xbea405df, 0x3f404d9d, 0x3f680635, 0x3f3c4b51, + 0xbf091a38); + double dscalar_32; + // 0.94017404 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f70af3f); + asm volatile("vfmul.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // -0.10769174, -0.43373078, 0.06555609, 0.19207491, + // -0.91323435, -0.89993113, -0.10577840, 0.45556471, + // 0.56087255, 0.43683240, 0.12643167, -0.30119160, 0.70624399, + // 0.85212177, 0.69152081, -0.50351614 + VCMP_U32(8, v1, 0xbddc8d7d, 0xbede11f6, 0x3d864246, 0x3e44af49, 0xbf69c9ba, + 0xbf6661e3, 0xbdd8a259, 0x3ee93fc7, 0x3f0f9558, 0x3edfa87f, + 0x3e01774e, 0xbe9a35c9, 0x3f34cc68, 0x3f5a24a7, 0x3f310782, + 0xbf00e66f); + + VSET(16, e64, m1); + // -0.3344965024132001, -0.2497404698970234, 0.3402338726452623, + // -0.5885400342262450, -0.7135559920290824, 0.1114442794173345, + // -0.9541638058007114, 0.1021679621951177, + // -0.1364702451627324, -0.9351295729000717, + // -0.2701320849999789, 0.3582375365191053, + // -0.6137661452178358, 0.6195430637830983, 0.2731869234335833, + // -0.4075196944877124 + VLOAD_64(v2, 0xbfd56864049f6dd8, 0xbfcff77ee7590278, 0x3fd5c6644b002e60, + 0xbfe2d551e8ec6e20, 0xbfe6d573603426e0, 0x3fbc879cbf6c7a10, + 0xbfee8882889e1c44, 0x3fba27adf853b5f0, 0xbfc177db63eceed0, + 0xbfedec94daa41aac, 0xbfd149d815ab3680, 0x3fd6ed5d21e3257c, + 0xbfe3a3f8e623486e, 0x3fe3d34bf9ad2f82, 0x3fd17be50175e4e8, + 0xbfda14cd7c133da0); + double dscalar_64; + // -0.7970907277742201 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfe981c469f7860e); + asm volatile("vfmul.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // 0.2666240605464688, 0.1990658129048941, -0.2711972651602534, + // 0.4691198042056620, 0.5687688649941168, -0.0888312017870367, + // 0.7605551223815086, -0.0814371353413154, 0.1087791670362886, + // 0.7453831118261137, 0.2153197802278006, -0.2855478187000574, + // 0.4892273033748624, -0.4938320315983399, -0.2177547636180751, + // 0.3248301698615385 + VCMP_U64(9, v1, 0x3fd1105e5d17ec76, 0x3fc97afd1216ce6e, 0xbfd15b4bc6282ffc, + 0x3fde060f123e080e, 0x3fe2335ac3443fa9, 0xbfb6bda4428a29bb, + 0x3fe85677b22de228, 0xbfb4d91068f88b49, 0x3fbbd8f394e82fe7, + 0x3fe7da2daf091575, 0x3fcb8f993b2151e0, 0xbfd2466a5bb0b251, + 0x3fdf4f8009138a1b, 0xbfdf9af1aa5ba7aa, 0xbfcbdf635a24d80a, + 0x3fd4ca047b13cdbf); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + // -0.8423, 0.9531, 0.3889, -0.3704, -0.9731, -0.4636, + // -0.4797, -0.5903, 0.2959, 0.4685, -0.3660, 0.3167, + // -0.9766, 0.0052, -0.6489, -0.0474 + VLOAD_16(v2, 0xbabd, 0x3ba0, 0x3639, 0xb5ed, 0xbbc9, 0xb76b, 0xb7ad, 0xb8b9, + 0x34bc, 0x377f, 0xb5db, 0x3511, 0xbbd0, 0x1d48, 0xb931, 0xaa11); + double dscalar_16; + // 0.2971 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x34c1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmul.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.2832, 0.0000, -0.1100, 0.0000, -0.1377, 0.0000, + // -0.1754, 0.0000, 0.1392, 0.0000, 0.0941, 0.0000, + // 0.0015, 0.0000, -0.0141 + VCMP_U16(10, v1, 0x0, 0x3488, 0x0, 0xaf0b, 0x0, 0xb068, 0x0, 0xb19d, 0x0, + 0x3074, 0x0, 0x2e05, 0x0, 0x1647, 0x0, 0xa336); + + VSET(16, e32, m1); + // -0.11454447, -0.46133029, 0.06972761, 0.20429718, + // -0.97134608, -0.95719630, -0.11250938, 0.48455358, + // 0.59656250, 0.46462929, 0.13447689, -0.32035729, + // 0.75118428, 0.90634471, 0.73552424, -0.53555632 + VLOAD_32(v2, 0xbdea964b, 0xbeec337c, 0x3d8ecd5a, 0x3e513348, 0xbf78aa23, + 0xbf750ad1, 0xbde66b52, 0x3ef81768, 0x3f18b852, 0x3eede3e4, + 0x3e09b44f, 0xbea405df, 0x3f404d9d, 0x3f680635, 0x3f3c4b51, + 0xbf091a38); + double dscalar_32; + // 0.94017404 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f70af3f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmul.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, -0.43373078, 0.00000000, 0.19207491, + // 0.00000000, -0.89993113, 0.00000000, 0.45556471, + // 0.00000000, 0.43683240, 0.00000000, -0.30119160, + // 0.00000000, 0.85212177, 0.00000000, -0.50351614 + VCMP_U32(11, v1, 0x0, 0xbede11f6, 0x0, 0x3e44af49, 0x0, 0xbf6661e3, 0x0, + 0x3ee93fc7, 0x0, 0x3edfa87f, 0x0, 0xbe9a35c9, 0x0, 0x3f5a24a7, 0x0, + 0xbf00e66f); + + VSET(16, e64, m1); + // -0.3344965024132001, -0.2497404698970234, + // 0.3402338726452623, -0.5885400342262450, + // -0.7135559920290824, 0.1114442794173345, + // -0.9541638058007114, 0.1021679621951177, + // -0.1364702451627324, -0.9351295729000717, + // -0.2701320849999789, 0.3582375365191053, + // -0.6137661452178358, 0.6195430637830983, + // 0.2731869234335833, -0.4075196944877124 + VLOAD_64(v2, 0xbfd56864049f6dd8, 0xbfcff77ee7590278, 0x3fd5c6644b002e60, + 0xbfe2d551e8ec6e20, 0xbfe6d573603426e0, 0x3fbc879cbf6c7a10, + 0xbfee8882889e1c44, 0x3fba27adf853b5f0, 0xbfc177db63eceed0, + 0xbfedec94daa41aac, 0xbfd149d815ab3680, 0x3fd6ed5d21e3257c, + 0xbfe3a3f8e623486e, 0x3fe3d34bf9ad2f82, 0x3fd17be50175e4e8, + 0xbfda14cd7c133da0); + double dscalar_64; + // -0.7970907277742201 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfe981c469f7860e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfmul.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, 0.1990658129048941, 0.0000000000000000, + // 0.4691198042056620, 0.0000000000000000, + // -0.0888312017870367, 0.0000000000000000, + // -0.0814371353413154, 0.0000000000000000, + // 0.7453831118261137, 0.0000000000000000, + // -0.2855478187000574, 0.0000000000000000, + // -0.4938320315983399, 0.0000000000000000, 0.3248301698615385 + VCMP_U64(12, v1, 0x0, 0x3fc97afd1216ce6e, 0x0, 0x3fde060f123e080e, 0x0, + 0xbfb6bda4428a29bb, 0x0, 0xbfb4d91068f88b49, 0x0, 0x3fe7da2daf091575, + 0x0, 0xbfd2466a5bb0b251, 0x0, 0xbfdf9af1aa5ba7aa, 0x0, + 0x3fd4ca047b13cdbf); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmv.c b/apps/riscv-tests/isa/rv64uv/vfmv.c new file mode 100644 index 0000000..4f5cb63 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmv.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + VCLEAR(v1); + asm volatile("vfmv.v.f v1, %[A]" ::[A] "f"(dscalar_16)); + // -0.9380, -0.9380, -0.9380, -0.9380, -0.9380, -0.9380, -0.9380, + // -0.9380, -0.9380, -0.9380, -0.9380, -0.9380, -0.9380, -0.9380, + // -0.9380, -0.9380 + VCMP_U16(1, v1, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, + 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, 0xbb81, + 0xbb81); + + VSET(16, e32, m1); + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + VCLEAR(v1); + asm volatile("vfmv.v.f v1, %[A]" ::[A] "f"(dscalar_32)); + // -0.96056187, -0.96056187, -0.96056187, -0.96056187, + // -0.96056187, -0.96056187, -0.96056187, -0.96056187, + // -0.96056187, -0.96056187, -0.96056187, -0.96056187, + // -0.96056187, -0.96056187, -0.96056187, -0.96056187 + VCMP_U32(2, v1, 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, + 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, + 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, 0xbf75e762, + 0xbf75e762); + + VSET(16, e64, m1); + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + VCLEAR(v1); + asm volatile("vfmv.v.f v1, %[A]" ::[A] "f"(dscalar_64)); + // 0.9108707261227378, 0.9108707261227378, 0.9108707261227378, + // 0.9108707261227378, 0.9108707261227378, 0.9108707261227378, + // 0.9108707261227378, 0.9108707261227378, 0.9108707261227378, + // 0.9108707261227378, 0.9108707261227378, 0.9108707261227378, + // 0.9108707261227378, 0.9108707261227378, 0.9108707261227378, + // 0.9108707261227378 + VCMP_U64(3, v1, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, + 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, + 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, + 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, + 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, 0x3fed25da5d7296fe, + 0x3fed25da5d7296fe); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmvfs.c b/apps/riscv-tests/isa/rv64uv/vfmvfs.c new file mode 100644 index 0000000..25b339d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmvfs.c @@ -0,0 +1,90 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +double scalar_16b; +float scalar_32b; +double scalar_64b; + +void TEST_CASE1() { + BOX_HALF_IN_DOUBLE(scalar_16b, 0); + VSET(16, e16, m1); + VLOAD_16(v1, 0xbb1e, 0xb573, 0x39dc, 0xb97a, 0xb4c0, 0xba31, 0x3897, 0x36ee, + 0x3b27, 0xb7d7, 0x36c0, 0x376c, 0x395b, 0x3703, 0x3057, 0x0001); + asm volatile("vfmv.f.s %0, v1" : "=f"(scalar_16b)); + XCMP(1, *((uint16_t *)&scalar_16b), 0xbb1e); + + scalar_32b = 0; + VSET(16, e32, m1); + VLOAD_32(v1, 0xbe9451b0, 0x3ece4bf7, 0x3eadc098, 0x3f09f4f0, 0x3ecc80cc, + 0xbe8a42c5, 0x3f47fd31, 0xbe201365, 0xbeffeb17, 0xbf314e2e, + 0xbd0a9c78, 0xbf1fb51f, 0x3b5e1209, 0x3eac9a73, 0xbeb187b6, + 0x3dea828d); + asm volatile("vfmv.f.s %0, v1" : "=f"(scalar_32b)); + XCMP(2, *((uint32_t *)&scalar_32b), 0xbe9451b0); + + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 0xbfe8d9d3f67536d2, 0x3fdad9e3e9cdd5bc, 0xbfd90875fda29450, + 0x3fe62686e0339faa, 0x3fe2208e74273f2c, 0xbfc21587add90b50, + 0xbfc7a755744afe30, 0xbfdf67da0cc99808, 0xbfed4488f52c57bc, + 0xbfe6d19a966debbe, 0xbfe1a7778d7c344c, 0xbfdae653f20dd9d4, + 0x3fe4c26b0962c342, 0xbfe2053afd5a822c, 0xbfb9851b4a2e8ff0, + 0xbfdc0cda147fbe5c); + asm volatile("vfmv.f.s %0, v1" : "=f"(scalar_64b)); + XCMP(3, *((uint64_t *)&scalar_64b), 0xbfe8d9d3f67536d2); +} + +// Check special cases +void TEST_CASE2() { + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 0xbfe8d9d3f67536d2, 0x3fdad9e3e9cdd5bc, 0xbfd90875fda29450, + 0x3fe62686e0339faa, 0x3fe2208e74273f2c, 0xbfc21587add90b50, + 0xbfc7a755744afe30, 0xbfdf67da0cc99808, 0xbfed4488f52c57bc, + 0xbfe6d19a966debbe, 0xbfe1a7778d7c344c, 0xbfdae653f20dd9d4, + 0x3fe4c26b0962c342, 0xbfe2053afd5a822c, 0xbfb9851b4a2e8ff0, + 0xbfdc0cda147fbe5c); + VSET(16, e64, m8); + asm volatile("vfmv.f.s %0, v1" : "=f"(scalar_64b)); + XCMP(4, *((uint64_t *)&scalar_64b), 0xbfe8d9d3f67536d2); + + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 0xbfe8d9d3f67536d2, 0x3fdad9e3e9cdd5bc, 0xbfd90875fda29450, + 0x3fe62686e0339faa, 0x3fe2208e74273f2c, 0xbfc21587add90b50, + 0xbfc7a755744afe30, 0xbfdf67da0cc99808, 0xbfed4488f52c57bc, + 0xbfe6d19a966debbe, 0xbfe1a7778d7c344c, 0xbfdae653f20dd9d4, + 0x3fe4c26b0962c342, 0xbfe2053afd5a822c, 0xbfb9851b4a2e8ff0, + 0xbfdc0cda147fbe5c); + VSET_ZERO(e64, m1); + asm volatile("vfmv.f.s %0, v1" : "=f"(scalar_64b)); + XCMP(5, *((uint64_t *)&scalar_64b), 0xbfe8d9d3f67536d2); + + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 0xbfe8d9d3f67536d2, 0x3fdad9e3e9cdd5bc, 0xbfd90875fda29450, + 0x3fe62686e0339faa, 0x3fe2208e74273f2c, 0xbfc21587add90b50, + 0xbfc7a755744afe30, 0xbfdf67da0cc99808, 0xbfed4488f52c57bc, + 0xbfe6d19a966debbe, 0xbfe1a7778d7c344c, 0xbfdae653f20dd9d4, + 0x3fe4c26b0962c342, 0xbfe2053afd5a822c, 0xbfb9851b4a2e8ff0, + 0xbfdc0cda147fbe5c); + VSET_ZERO(e64, m8); + asm volatile("vfmv.f.s %0, v1" : "=f"(scalar_64b)); + XCMP(6, *((uint64_t *)&scalar_64b), 0xbfe8d9d3f67536d2); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfmvsf.c b/apps/riscv-tests/isa/rv64uv/vfmvsf.c new file mode 100644 index 0000000..5a751ed --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfmvsf.c @@ -0,0 +1,69 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +double scalar_16b; +float scalar_32b; +double scalar_64b; + +void TEST_CASE1() { + BOX_HALF_IN_DOUBLE(scalar_16b, 0xbb1e); + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vfmv.s.f v1, %0" ::"f"(scalar_16b)); + VCMP_U16(1, v1, *((uint16_t *)&scalar_16b)); + + scalar_32b = 0xbe9451b0; + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vfmv.s.f v1, %0" ::"f"(scalar_32b)); + VCMP_U32(2, v1, *((uint32_t *)&scalar_32b)); + + scalar_64b = 0xbfe8d9d3f67536d2; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vfmv.s.f v1, %0" ::"f"(scalar_64b)); + VCMP_U64(3, v1, *((uint64_t *)&scalar_64b)); +} + +// Check special cases +void TEST_CASE2() { + scalar_64b = 0xbfe8d9d3f67536d2; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET(16, e64, m8); + asm volatile("vfmv.s.f v1, %0" ::"f"(scalar_64b)); + VSET(1, e64, m1); + VCMP_U64(4, v1, *((uint64_t *)&scalar_64b)); + + scalar_64b = 0xbfe8d9d3f67536d2; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET_ZERO(e64, m1); + asm volatile("vfmv.s.f v1, %0" ::"f"(scalar_64b)); + VSET(1, e64, m1); + VCMP_U64(5, v1, 1); + + scalar_64b = 0xbfe8d9d3f67536d2; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET_ZERO(e64, m8); + asm volatile("vfmv.s.f v1, %0" ::"f"(scalar_64b)); + VSET(1, e64, m1); + VCMP_U64(6, v1, 1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfncvt.c b/apps/riscv-tests/isa/rv64uv/vfncvt.c new file mode 100644 index 0000000..19563ba --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfncvt.c @@ -0,0 +1,773 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +///////////////// +// vfncvt.xu.f // +///////////////// + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 9165.669, 5488.131, -1648.302, 80154.047, 7163.093, + // -6826.076, -6976.746, 2675.899, 9587.624, -3671.810, + // 3611.960, -9086.531, -5333.617, -3284.205, 5676.141, + // -8293.472 + VLOAD_32(v2, 0x460f36ad, 0x45ab810c, 0x479c8d06, 0xc59cf316, 0x45dfd8be, + 0xc5d5509c, 0xc5da05f8, 0x45273e62, 0x4615ce7f, 0xc5657cf5, + 0x4561bf5b, 0xc60dfa20, 0xc5a6acf0, 0xc54d4347, 0x45b16120, + 0xc60195e3); + asm volatile("vfncvt.xu.f.w v4, v2"); + // 9166, 5488, 65535, 0, 7163, 0, + // 0, 2676, 9588, 0, 3612, 0, 0, + // 0, 5676, 0 + VCMP_U16(1, v4, 0x23ce, 0x1570, 0xffff, 0x0000, 0x1bfb, 0x0000, 0x0000, + 0x0a74, 0x2574, 0x0000, 0x0e1c, 0x0000, 0x0000, 0x0000, 0x162c, + 0x0000); + + VSET(16, e32, m1); + // -3508862.563, 1678202.418, -799491.756, 1707676.429, + // -5056868.769, 4282070.604, 458667.918, 8393053.957, + // -4485003.775, -5016427.098, -9086965.507, -6796529.257, + // -7756776.890, -1173384.460, 4850684.145, 8658279.578 + VLOAD_64(v2, 0xc14ac53f4813ac38, 0x41399b7a6ae9e42f, 0xc128660783332e44, + 0x413a0e9c6ddfa609, 0xc1534a59313a407b, 0x415055b5a6a655de, + 0x411bfeafabb28b3f, 0x4160022bbe9fc5e9, 0xc1511be2f1a1ac8b, + 0xc15322dac64b7c31, 0xc16154feb0372db3, 0xc159ed3c506ab6eb, + 0xc15d96fa38fb0400, 0xc131e78875bc4ace, 0x415280ff09493a97, + 0x416083acf280b61e); + asm volatile("vfncvt.xu.f.w v4, v2"); + // 0, 1678202, 0, 1707676, 0, + // 4282071, 458668, 8393054, 0, 0, 0, + // 0, 0, 0, 4850684, + // 8658280 + VCMP_U32(2, v4, 0x00000000, 0x00199b7a, 0x00000000, 0x001a0e9c, 0x00000000, + 0x004156d7, 0x0006ffac, 0x0080115e, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x004a03fc, + 0x00841d68); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 9165.669, 5488.131, -1648.302, -5022.386, + // 7163.093, -6826.076, -6976.746, 2675.899, 9587.624, + // -3671.810, 3611.960, -9086.531, -5333.617, -3284.205, + // 5676.141, -8293.472 + VLOAD_32(v2, 0x460f36ad, 0x45ab810c, 0xc4ce09ad, 0xc59cf316, 0x45dfd8be, + 0xc5d5509c, 0xc5da05f8, 0x45273e62, 0x4615ce7f, 0xc5657cf5, + 0x4561bf5b, 0xc60dfa20, 0xc5a6acf0, 0xc54d4347, 0x45b16120, + 0xc60195e3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.xu.f.w v4, v2, v0.t"); + // 0, 5488, 0, 0, 0, 0, + // 0, 2676, 0, 0, 0, 0, + // 0, 0, 0, 0 + VCMP_U16(3, v4, 0x0000, 0x1570, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0a74, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000); + + VSET(16, e32, m1); + // -3508862.563, 1678202.418, -799491.756, + // 1707676.429, -5056868.769, 4282070.604, + // 458667.918, 8393053.957, -4485003.775, + // -5016427.098, -9086965.507, -6796529.257, + // -7756776.890, -1173384.460, 4850684.145, + // 8658279.578 + VLOAD_64(v2, 0xc14ac53f4813ac38, 0x41399b7a6ae9e42f, 0xc128660783332e44, + 0x413a0e9c6ddfa609, 0xc1534a59313a407b, 0x415055b5a6a655de, + 0x411bfeafabb28b3f, 0x4160022bbe9fc5e9, 0xc1511be2f1a1ac8b, + 0xc15322dac64b7c31, 0xc16154feb0372db3, 0xc159ed3c506ab6eb, + 0xc15d96fa38fb0400, 0xc131e78875bc4ace, 0x415280ff09493a97, + 0x416083acf280b61e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.xu.f.w v4, v2, v0.t"); + // 0, 1678202, 0, 1707676, 0, + // 4282071, 0, 8393054, 0, 0, 0, + // 0, 0, 0, 0, 8658280 + VCMP_U32(4, v4, 0x00000000, 0x00199b7a, 0x00000000, 0x001a0e9c, 0x00000000, + 0x004156d7, 0x00000000, 0x0080115e, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00841d68); +}; + +//////////////// +// vfncvt.x.f // +//////////////// + +// Simple random test with similar values +void TEST_CASE3(void) { + VSET(16, e16, m1); + // -7808.056, 9317.408, 1685.891, 3975.596, -5978.108, + // 9676.333, 6963.966, 3589.870, -4334.772, -3261.309, + // -2340.480, 6085.075, 4043.322, 2827.902, 4389.497, + // -5196.684 + VLOAD_32(v2, 0xc5f40072, 0x461195a2, 0x44d2bc86, 0x4578798a, 0xc5bad0dd, + 0x46173155, 0x45d99fbb, 0x45605ded, 0xc587762e, 0xc54bd4f0, + 0xc51247af, 0x45be2899, 0x457cb528, 0x4530be6f, 0x45892bfa, + 0xc5a26578); + asm volatile("vfncvt.x.f.w v4, v2"); + // -7808, 9317, 1686, 3976, -5978, + // 9676, 6964, 3590, -4335, -3261, + // -2340, 6085, 4043, 2828, 4389, + // -5197 + VCMP_U16(5, v4, 0xe180, 0x2465, 0x0696, 0x0f88, 0xe8a6, 0x25cc, 0x1b34, + 0x0e06, 0xef11, 0xf343, 0xf6dc, 0x17c5, 0x0fcb, 0x0b0c, 0x1125, + 0xebb3); + + VSET(16, e32, m1); + // 5365665.770, -7563846.858, 8056193.411, -2468299.255, + // -9624608.750, -6974543.165, 5868078.422, -5387798.170, + // 3847378.080, 1368753.124, 4380497.931, -8044304.268, + // 1687738.849, 3753399.509, -3684410.483, -7416477.444 + VLOAD_64(v2, 0x415477e8714aea69, 0xc15cda91b6eefd56, 0x415ebb605a479cd5, + 0xc142d4e5a0a1f367, 0xc1625b841802ee1d, 0xc15a9b13ca8c7bb6, + 0x4156628b9afacdc9, 0xc1548d858ae6df86, 0x414d5a690a2dbb5e, + 0x4134e2b11fa8e994, 0x4150b5d47b9c3df2, 0xc15eafc4112995f5, + 0x4139c0bad971859a, 0x414ca2dbc1288a12, 0xc14c1c1d3dcd1b39, + 0xc15c4aa75c6c5635); + asm volatile("vfncvt.x.f.w v4, v2"); + // 5365666, -7563847, 8056193, -2468299, + // -9624609, -6974543, 5868078, -5387798, + // 3847378, 1368753, 4380498, -8044304, + // 1687739, 3753400, -3684410, -7416477 + VCMP_U32(6, v4, 0x0051dfa2, 0xff8c95b9, 0x007aed81, 0xffda5635, 0xff6d23df, + 0xff9593b1, 0x00598a2e, 0xffadc9ea, 0x003ab4d2, 0x0014e2b1, + 0x0042d752, 0xff8540f0, 0x0019c0bb, 0x003945b8, 0xffc7c7c6, + 0xff8ed563); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE4(void) { + VSET(16, e16, m1); + // -7808.056, 9317.408, 1685.891, 3975.596, -5978.108, + // 9676.333, 6963.966, 3589.870, -4334.772, -3261.309, + // -2340.480, 6085.075, 4043.322, 2827.902, 4389.497, + // -5196.684 + VLOAD_32(v2, 0xc5f40072, 0x461195a2, 0x44d2bc86, 0x4578798a, 0xc5bad0dd, + 0x46173155, 0x45d99fbb, 0x45605ded, 0xc587762e, 0xc54bd4f0, + 0xc51247af, 0x45be2899, 0x457cb528, 0x4530be6f, 0x45892bfa, + 0xc5a26578); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.x.f.w v4, v2, v0.t"); + // 0, 9317, 0, 3976, 0, + // 9676, 0, 3590, 0, -3261, + // 0, 6085, 0, 2828, 0, + // -5197 + VCMP_U16(7, v4, 0x0000, 0x2465, 0x0000, 0x0f88, 0x0000, 0x25cc, 0x0000, + 0x0e06, 0x0000, 0xf343, 0x0000, 0x17c5, 0x0000, 0x0b0c, 0x0000, + 0xebb3); + + VSET(16, e32, m1); + // 5365665.770, -7563846.858, 8056193.411, -2468299.255, + // -9624608.750, -6974543.165, 5868078.422, -5387798.170, + // 3847378.080, 1368753.124, 4380497.931, -8044304.268, + // 1687738.849, 3753399.509, -3684410.483, -7416477.444 + VLOAD_64(v2, 0x415477e8714aea69, 0xc15cda91b6eefd56, 0x415ebb605a479cd5, + 0xc142d4e5a0a1f367, 0xc1625b841802ee1d, 0xc15a9b13ca8c7bb6, + 0x4156628b9afacdc9, 0xc1548d858ae6df86, 0x414d5a690a2dbb5e, + 0x4134e2b11fa8e994, 0x4150b5d47b9c3df2, 0xc15eafc4112995f5, + 0x4139c0bad971859a, 0x414ca2dbc1288a12, 0xc14c1c1d3dcd1b39, + 0xc15c4aa75c6c5635); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.x.f.w v4, v2, v0.t"); + // 0, -7563847, 0, -2468299, 0, + // -6974543, 0, -5387798, 0, + // 1368753, 0, -8044304, 0, + // 3753400, 0, -7416477 + VCMP_U32(8, v4, 0x00000000, 0xff8c95b9, 0x00000000, 0xffda5635, 0x00000000, + 0xff9593b1, 0x00000000, 0xffadc9ea, 0x00000000, 0x0014e2b1, + 0x00000000, 0xff8540f0, 0x00000000, 0x003945b8, 0x00000000, + 0xff8ed563); +}; + +///////////////////// +// vfncvt.rtz.xu.f // +///////////////////// + +// Simple random test with similar values +void TEST_CASE5(void) { + VSET(16, e16, m1); + // -9750.252, -4363.736, -2345.615, 6996.062, -7115.004, + // 6670.171, -4079.234, -1773.082, 254.350, 53.058, + // -9041.926, -8137.022, 1522.146, 198.516, -920.430, + // 2857.583 + VLOAD_32(v2, 0xc6185902, 0xc5885de3, 0xc51299d6, 0x45daa07e, 0xc5de5808, + 0x45d0715e, 0xc57ef3bf, 0xc4dda29c, 0x437e5998, 0x42543afb, + 0xc60d47b4, 0xc5fe482e, 0x44be44af, 0x43468433, 0xc4661b8b, + 0x45329953); + asm volatile("vfncvt.rtz.xu.f.w v4, v2"); + // 0, 0, 0, 6996, 0, + // 6670, 0, 0, 254, 53, + // 0, 0, 1522, 198, 0, + // 2857 + VCMP_U16(9, v4, 0x0000, 0x0000, 0x0000, 0x1b54, 0x0000, 0x1a0e, 0x0000, + 0x0000, 0x00fe, 0x0035, 0x0000, 0x0000, 0x05f2, 0x00c6, 0x0000, + 0x0b29); + + VSET(16, e32, m1); + // -8404683.758, 3627605.540, -4368861.865, -2883871.623, + // 5750957.328, -7243911.338, -8202847.045, 5348152.868, + // 9957770.965, 8018962.598, -8478197.842, -9780786.953, + // 184470.081, 250336.923, -6517203.475, -7691903.192 + VLOAD_64(v2, 0xc16007d978438b7f, 0x414bad2ac51eade4, 0xc150aa777763eeda, + 0xc146008fcfc2093b, 0x4155f02b54fbd105, 0xc15ba221d5a4f5c3, + 0xc15f4a97c2e2daa6, 0x415466ce378e9269, 0x4162fe315edeecec, + 0x415e9704a64d845e, 0xc1602bbebaf40bb8, 0xc162a7c65e8002a9, + 0x410684b0a4ee482d, 0x410e8f07623ffd06, 0xc158dc74de617fbc, + 0xc15d579fcc41ba16); + asm volatile("vfncvt.rtz.xu.f.w v4, v2"); + // 0, 3627605, 0, 0, 5750957, 0, + // 0, 5348152, 9957770, 8018962, 0, 0, + // 184470, 250336, 0, 0 + VCMP_U32(10, v4, 0x00000000, 0x00375a55, 0x00000000, 0x00000000, 0x0057c0ad, + 0x00000000, 0x00000000, 0x00519b38, 0x0097f18a, 0x007a5c12, + 0x00000000, 0x00000000, 0x0002d096, 0x0003d1e0, 0x00000000, + 0x00000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE6(void) { + VSET(16, e16, m1); + // -9750.252, -4363.736, -2345.615, 6996.062, -7115.004, + // 6670.171, -4079.234, -1773.082, 254.350, 53.058, + // -9041.926, -8137.022, 1522.146, 198.516, -920.430, + // 2857.583 + VLOAD_32(v2, 0xc6185902, 0xc5885de3, 0xc51299d6, 0x45daa07e, 0xc5de5808, + 0x45d0715e, 0xc57ef3bf, 0xc4dda29c, 0x437e5998, 0x42543afb, + 0xc60d47b4, 0xc5fe482e, 0x44be44af, 0x43468433, 0xc4661b8b, + 0x45329953); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.rtz.xu.f.w v4, v2, v0.t"); + // 0, 0, 0, 6996, 0, + // 6670, 0, 0, 0, 53, + // 0, 0, 0, 198, 0, + // 2857 + VCMP_U16(11, v4, 0x0000, 0x0000, 0x0000, 0x1b54, 0x0000, 0x1a0e, 0x0000, + 0x0000, 0x0000, 0x0035, 0x0000, 0x0000, 0x0000, 0x00c6, 0x0000, + 0x0b29); + + VSET(16, e32, m1); + // -8404683.758, 3627605.540, -4368861.865, -2883871.623, + // 5750957.328, -7243911.338, -8202847.045, 5348152.868, + // 9957770.965, 8018962.598, -8478197.842, -9780786.953, + // 184470.081, 250336.923, -6517203.475, -7691903.192 + VLOAD_64(v2, 0xc16007d978438b7f, 0x414bad2ac51eade4, 0xc150aa777763eeda, + 0xc146008fcfc2093b, 0x4155f02b54fbd105, 0xc15ba221d5a4f5c3, + 0xc15f4a97c2e2daa6, 0x415466ce378e9269, 0x4162fe315edeecec, + 0x415e9704a64d845e, 0xc1602bbebaf40bb8, 0xc162a7c65e8002a9, + 0x410684b0a4ee482d, 0x410e8f07623ffd06, 0xc158dc74de617fbc, + 0xc15d579fcc41ba16); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.rtz.xu.f.w v4, v2, v0.t"); + // 0, 3627605, 0, 0, 0, 0, 0, + // 5348152, 0, 8018962, 0, 0, 0, + // 250336, 0, 0 + VCMP_U32(12, v4, 0x00000000, 0x00375a55, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00519b38, 0x00000000, 0x007a5c12, + 0x00000000, 0x00000000, 0x00000000, 0x0003d1e0, 0x00000000, + 0x00000000); +}; + +//////////////////// +// vfncvt.rtz.x.f // +//////////////////// + +// Simple random test with similar values +void TEST_CASE7(void) { + VSET(16, e16, m1); + // 9352.418, -5719.459, 4617.815, -3012.009, -3597.063, + // -5717.140, -3327.545, 1286.004, 1797.767, 3842.966, + // -2148.369, -7283.256, 8783.331, -7958.880, -6728.271, + // 4727.792 + VLOAD_32(v2, 0x461221ac, 0xc5b2bbac, 0x45904e86, 0xc53c4026, 0xc560d104, + 0xc5b2a91e, 0xc54ff8b9, 0x44a0c01e, 0x44e0b88c, 0x45702f76, + 0xc50645e9, 0xc5e39a0c, 0x46093d53, 0xc5f8b70a, 0xc5d2422c, + 0x4593be56); + asm volatile("vfncvt.rtz.x.f.w v4, v2"); + // 9352, -5719, 4617, -3012, -3597, + // -5717, -3327, 1286, 1797, 3842, + // -2148, -7283, 8783, -7958, -6728, + // 4727 + VCMP_U16(13, v4, 0x2488, 0xe9a9, 0x1209, 0xf43c, 0xf1f3, 0xe9ab, 0xf301, + 0x0506, 0x0705, 0x0f02, 0xf79c, 0xe38d, 0x224f, 0xe0ea, 0xe5b8, + 0x1277); + + VSET(16, e32, m1); + // 1563546.261, -1988965.594, 6496092.888, 5054778.769, + // 9551708.952, -336377.787, -2352111.643, 4412162.570, + // 7087155.475, 338850.875, 2765611.498, 2723631.912, + // -3252079.308, 1096915.326, 5492109.280, -7265880.245 + VLOAD_64(v2, 0x4137db9a42b839bd, 0xc13e596598118127, 0x4158c7d738d1eec8, + 0x4153484eb13573ed, 0x416237eb9e79d2a8, 0xc11487e725f1ce50, + 0xc141f1f7d2451c3d, 0x4150d4c0a47be906, 0x415b090cde6b0575, + 0x4114ae8b8081532d, 0x41451995bfc3bc74, 0x4144c797f4b307dd, + 0xc148cfb7a76dea0f, 0x4130bcd353667e5d, 0x4154f36351f3a3c5, + 0xc15bb7960fb007a5); + asm volatile("vfncvt.rtz.x.f.w v4, v2"); + // 1563546, -1988965, 6496092, 5054778, + // 9551708, -336377, -2352111, 4412162, + // 7087155, 338850, 2765611, 2723631, + // -3252079, 1096915, 5492109, -7265880 + VCMP_U32(14, v4, 0x0017db9a, 0xffe1a69b, 0x00631f5c, 0x004d213a, 0x0091bf5c, + 0xfffade07, 0xffdc1c11, 0x00435302, 0x006c2433, 0x00052ba2, + 0x002a332b, 0x00298f2f, 0xffce6091, 0x0010bcd3, 0x0053cd8d, + 0xff9121a8); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE8(void) { + VSET(16, e16, m1); + // 9352.418, -5719.459, 4617.815, -3012.009, -3597.063, + // -5717.140, -3327.545, 1286.004, 1797.767, 3842.966, + // -2148.369, -7283.256, 8783.331, -7958.880, -6728.271, + // 4727.792 + VLOAD_32(v2, 0x461221ac, 0xc5b2bbac, 0x45904e86, 0xc53c4026, 0xc560d104, + 0xc5b2a91e, 0xc54ff8b9, 0x44a0c01e, 0x44e0b88c, 0x45702f76, + 0xc50645e9, 0xc5e39a0c, 0x46093d53, 0xc5f8b70a, 0xc5d2422c, + 0x4593be56); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.rtz.x.f.w v4, v2, v0.t"); + // 0, -5719, 0, -3012, 0, + // -5717, 0, 1286, 0, 3842, 0, + // -7283, 0, -7958, 0, 4727 + VCMP_U16(15, v4, 0x0000, 0xe9a9, 0x0000, 0xf43c, 0x0000, 0xe9ab, 0x0000, + 0x0506, 0x0000, 0x0f02, 0x0000, 0xe38d, 0x0000, 0xe0ea, 0x0000, + 0x1277); + + VSET(16, e32, m1); + // 1563546.261, -1988965.594, 6496092.888, 5054778.769, + // 9551708.952, -336377.787, -2352111.643, 4412162.570, + // 7087155.475, 338850.875, 2765611.498, 2723631.912, + // -3252079.308, 1096915.326, 5492109.280, -7265880.245 + VLOAD_64(v2, 0x4137db9a42b839bd, 0xc13e596598118127, 0x4158c7d738d1eec8, + 0x4153484eb13573ed, 0x416237eb9e79d2a8, 0xc11487e725f1ce50, + 0xc141f1f7d2451c3d, 0x4150d4c0a47be906, 0x415b090cde6b0575, + 0x4114ae8b8081532d, 0x41451995bfc3bc74, 0x4144c797f4b307dd, + 0xc148cfb7a76dea0f, 0x4130bcd353667e5d, 0x4154f36351f3a3c5, + 0xc15bb7960fb007a5); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.rtz.x.f.w v4, v2, v0.t"); + // 0, -1988965, 0, 5054778, 0, + // -336377, 0, 4412162, 0, + // 338850, 0, 2723631, 0, + // 1096915, 0, -7265880 + VCMP_U32(16, v4, 0x00000000, 0xffe1a69b, 0x00000000, 0x004d213a, 0x00000000, + 0xfffade07, 0x00000000, 0x00435302, 0x00000000, 0x00052ba2, + 0x00000000, 0x00298f2f, 0x00000000, 0x0010bcd3, 0x00000000, + 0xff9121a8); +}; + +///////////////// +// vfncvt.f.xu // +///////////////// + +// Simple random test with similar values +void TEST_CASE9(void) { + VSET(16, e16, m1); + // 4294964178, 5853, 4294962638, 4294962082, 4585, + // 1637, 3984, 4294964217, 9553, 4294962615, + // 4294962166, 9867, 4294958580, 4294966752, 5172, + // 7478 + VLOAD_32(v2, 0xfffff3d2, 0x000016dd, 0xffffedce, 0xffffeba2, 0x000011e9, + 0x00000665, 0x00000f90, 0xfffff3f9, 0x00002551, 0xffffedb7, + 0xffffebf6, 0x0000268b, 0xffffddf4, 0xfffffde0, 0x00001434, + 0x00001d36); + asm volatile("vfncvt.f.xu.w v4, v2"); + // inf, 5852.000, inf, inf, 4584.000, 1637.000, + // 3984.000, inf, 9552.000, inf, inf, 9864.000, + // inf, inf, 5172.000, 7480.000 + VCMP_U16(17, v4, 0x7c00, 0x6db7, 0x7c00, 0x7c00, 0x6c7a, 0x6665, 0x6bc8, + 0x7c00, 0x70aa, 0x7c00, 0x7c00, 0x70d1, 0x7c00, 0x7c00, 0x6d0d, + 0x6f4e); + + VSET(16, e32, m1); + // 18446744073704835106, 18446744073709117625, + // 18446744073705901616, 2086515, 18446744073699655996, + // 932771, 255753, 3148047, + // 18446744073705977615, 18446744073704792883, + // 18446744073704699584, 8685460, 18446744073709143843, + // 18446744073703142874, 3905530, 18446744073704152149 + VLOAD_64(v2, 0xffffffffffb80822, 0xfffffffffff960b9, 0xffffffffffc84e30, + 0x00000000001fd673, 0xffffffffff69013c, 0x00000000000e3ba3, + 0x000000000003e709, 0x000000000030090f, 0xffffffffffc9770f, + 0xffffffffffb76333, 0xffffffffffb5f6c0, 0x0000000000848794, + 0xfffffffffff9c723, 0xffffffffff9e35da, 0x00000000003b97fa, + 0xffffffffffad9c55); + asm volatile("vfncvt.f.xu.w v4, v2"); + // 18446744073709551616.000, 18446744073709551616.000, + // 18446744073709551616.000, 2086515.000, + // 18446744073709551616.000, 932771.000, 255753.000, + // 3148047.000, 18446744073709551616.000, + // 18446744073709551616.000, 18446744073709551616.000, + // 8685460.000, 18446744073709551616.000, + // 18446744073709551616.000, 3905530.000, + // 18446744073709551616.000 + VCMP_U32(18, v4, 0x5f800000, 0x5f800000, 0x5f800000, 0x49feb398, 0x5f800000, + 0x4963ba30, 0x4879c240, 0x4a40243c, 0x5f800000, 0x5f800000, + 0x5f800000, 0x4b048794, 0x5f800000, 0x5f800000, 0x4a6e5fe8, + 0x5f800000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE10(void) { + VSET(16, e16, m1); + // 4294964178, 5853, 4294962638, 4294962082, 4585, + // 1637, 3984, 4294964217, 9553, 4294962615, + // 4294962166, 9867, 4294958580, 4294966752, 5172, + // 7478 + VLOAD_32(v2, 0xfffff3d2, 0x000016dd, 0xffffedce, 0xffffeba2, 0x000011e9, + 0x00000665, 0x00000f90, 0xfffff3f9, 0x00002551, 0xffffedb7, + 0xffffebf6, 0x0000268b, 0xffffddf4, 0xfffffde0, 0x00001434, + 0x00001d36); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.f.xu.w v4, v2, v0.t"); + // 0.000, 5852.000, 0.000, inf, 0.000, 1637.000, + // 0.000, inf, 0.000, inf, 0.000, 9864.000, 0.000, + // inf, 0.000, 7480.000 + VCMP_U16(19, v4, 0x0, 0x6db7, 0x0, 0x7c00, 0x0, 0x6665, 0x0, 0x7c00, 0x0, + 0x7c00, 0x0, 0x70d1, 0x0, 0x7c00, 0x0, 0x6f4e); + + VSET(16, e32, m1); + // 18446744073704835106, 18446744073709117625, + // 18446744073705901616, 2086515, 18446744073699655996, + // 932771, 255753, 3148047, + // 18446744073705977615, 18446744073704792883, + // 18446744073704699584, 8685460, 18446744073709143843, + // 18446744073703142874, 3905530, 18446744073704152149 + VLOAD_64(v2, 0xffffffffffb80822, 0xfffffffffff960b9, 0xffffffffffc84e30, + 0x00000000001fd673, 0xffffffffff69013c, 0x00000000000e3ba3, + 0x000000000003e709, 0x000000000030090f, 0xffffffffffc9770f, + 0xffffffffffb76333, 0xffffffffffb5f6c0, 0x0000000000848794, + 0xfffffffffff9c723, 0xffffffffff9e35da, 0x00000000003b97fa, + 0xffffffffffad9c55); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.f.xu.w v4, v2, v0.t"); + // 0.000, 18446744073709551616.000, 0.000, 2086515.000, + // 0.000, 932771.000, 0.000, 3148047.000, 0.000, + // 18446744073709551616.000, 0.000, 8685460.000, 0.000, + // 18446744073709551616.000, 0.000, 18446744073709551616.000 + VCMP_U32(20, v4, 0x0, 0x5f800000, 0x0, 0x49feb398, 0x0, 0x4963ba30, 0x0, + 0x4a40243c, 0x0, 0x5f800000, 0x0, 0x4b048794, 0x0, 0x5f800000, 0x0, + 0x5f800000); +}; + +//////////////// +// vfncvt.f.x // +//////////////// + +// Simple random test with similar values +void TEST_CASE11(void) { + VSET(16, e16, m1); + // -6279, 3717, 9022, -8925, -5530, + // 3851, 5592, -3692, -2747, -748, + // -2621, -9352, 4018, 3174, -6975, + // -4466 + VLOAD_32(v2, 0xffffe779, 0x00000e85, 0x0000233e, 0xffffdd23, 0xffffea66, + 0x00000f0b, 0x000015d8, 0xfffff194, 0xfffff545, 0xfffffd14, + 0xfffff5c3, 0xffffdb78, 0x00000fb2, 0x00000c66, 0xffffe4c1, + 0xffffee8e); + asm volatile("vfncvt.f.x.w v4, v2"); + // -6280.000, 3716.000, 9024.000, -8928.000, -5528.000, + // 3852.000, 5592.000, -3692.000, -2748.000, -748.000, + // -2620.000, -9352.000, 4018.000, 3174.000, -6976.000, + // -4464.000 + VCMP_U16(21, v4, 0xee22, 0x6b42, 0x7068, 0xf05c, 0xed66, 0x6b86, 0x6d76, + 0xeb36, 0xe95e, 0xe1d8, 0xe91e, 0xf091, 0x6bd9, 0x6a33, 0xeed0, + 0xec5c); + + VSET(16, e32, m1); + // 757099, -9365555, 3016973, + // -9277105, -8350486, -650348, + // -1775160, 4659116, 148573, + // 4475248, -2937762, 3310433, + // 9151745, -2201488, -1506850, + // 1593161 + VLOAD_64(v2, 0x00000000000b8d6b, 0xffffffffff7117cd, 0x00000000002e090d, + 0xffffffffff72714f, 0xffffffffff8094ea, 0xfffffffffff61394, + 0xffffffffffe4e9c8, 0x00000000004717ac, 0x000000000002445d, + 0x0000000000444970, 0xffffffffffd32c5e, 0x0000000000328361, + 0x00000000008ba501, 0xffffffffffde6870, 0xffffffffffe901de, + 0x0000000000184f49); + asm volatile("vfncvt.f.x.w v4, v2"); + // 757099.000, -9365555.000, 3016973.000, -9277105.000, + // -8350486.000, -650348.000, -1775160.000, 4659116.000, + // 148573.000, 4475248.000, -2937762.000, 3310433.000, + // 9151745.000, -2201488.000, -1506850.000, 1593161.000 + VCMP_U32(22, v4, 0x4938d6b0, 0xcb0ee833, 0x4a382434, 0xcb0d8eb1, 0xcafed62c, + 0xc91ec6c0, 0xc9d8b1c0, 0x4a8e2f58, 0x48111740, 0x4a8892e0, + 0xca334e88, 0x4a4a0d84, 0x4b0ba501, 0xca065e40, 0xc9b7f110, + 0x49c27a48); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE12(void) { + VSET(16, e16, m1); + // -6279, 3717, 9022, -8925, -5530, + // 3851, 5592, -3692, -2747, -748, + // -2621, -9352, 4018, 3174, -6975, + // -4466 + VLOAD_32(v2, 0xffffe779, 0x00000e85, 0x0000233e, 0xffffdd23, 0xffffea66, + 0x00000f0b, 0x000015d8, 0xfffff194, 0xfffff545, 0xfffffd14, + 0xfffff5c3, 0xffffdb78, 0x00000fb2, 0x00000c66, 0xffffe4c1, + 0xffffee8e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.f.x.w v4, v2, v0.t"); + // 0.000, 3716.000, 0.000, -8928.000, 0.000, 3852.000, + // 0.000, -3692.000, 0.000, -748.000, 0.000, -9352.000, + // 0.000, 3174.000, 0.000, -4464.000 + VCMP_U16(23, v4, 0x0, 0x6b42, 0x0, 0xf05c, 0x0, 0x6b86, 0x0, 0xeb36, 0x0, + 0xe1d8, 0x0, 0xf091, 0x0, 0x6a33, 0x0, 0xec5c); + + VSET(16, e32, m1); + // 757099, -9365555, 3016973, -9277105, + // -8350486, -650348, -1775160, 4659116, + // 148573, 4475248, -2937762, 3310433, + // 9151745, -2201488, -1506850, 1593161 + VLOAD_64(v2, 0x00000000000b8d6b, 0xffffffffff7117cd, 0x00000000002e090d, + 0xffffffffff72714f, 0xffffffffff8094ea, 0xfffffffffff61394, + 0xffffffffffe4e9c8, 0x00000000004717ac, 0x000000000002445d, + 0x0000000000444970, 0xffffffffffd32c5e, 0x0000000000328361, + 0x00000000008ba501, 0xffffffffffde6870, 0xffffffffffe901de, + 0x0000000000184f49); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.f.x.w v4, v2, v0.t"); + // 0.000, -9365555.000, 0.000, -9277105.000, 0.000, + // -650348.000, 0.000, 4659116.000, 0.000, 4475248.000, + // 0.000, 3310433.000, 0.000, -2201488.000, 0.000, + // 1593161.000 + VCMP_U32(24, v4, 0x0, 0xcb0ee833, 0x0, 0xcb0d8eb1, 0x0, 0xc91ec6c0, 0x0, + 0x4a8e2f58, 0x0, 0x4a8892e0, 0x0, 0x4a4a0d84, 0x0, 0xca065e40, 0x0, + 0x49c27a48); +}; + +//////////////// +// vfncvt.f.f // +//////////////// + +// Simple random test with similar values +void TEST_CASE13(void) { + VSET(16, e16, m1); + // 908.994, -6788.630, -5789.335, 8054.104, 3947.551, 9596.856, + // 2474.506, 3094.286, 7684.992, -6850.149, -54.922, 7737.443, + // 4171.873, 5266.611, 9163.839, 5679.187 + VLOAD_32(v2, 0x44633fa3, 0xc5d4250b, 0xc5b4eaaf, 0x45fbb0d4, 0x4576b8d0, + 0x4615f36d, 0x451aa818, 0x45416494, 0x45f027ef, 0xc5d61131, + 0xc25bb026, 0x45f1cb8c, 0x45825efb, 0x45a494e4, 0x460f2f5b, + 0x45b1797f); + asm volatile("vfncvt.f.f.w v4, v2"); + // 909.000, -6788.000, -5788.000, 8056.000, 3948.000, 9600.000, + // 2474.000, 3094.000, 7684.000, -6852.000, -54.938, 7736.000, + // 4172.000, 5268.000, 9160.000, 5680.000 + VCMP_U16(25, v4, 0x631a, 0xeea1, 0xeda7, 0x6fde, 0x6bb6, 0x70b0, 0x68d5, + 0x6a0b, 0x6f81, 0xeeb1, 0xd2de, 0x6f8e, 0x6c13, 0x6d25, 0x7079, + 0x6d8c); + + VSET(16, e32, m1); + // 153431.766, -7796010.957, -6652812.196, 1049714.758, + // 7538298.328, -8731739.480, 537176.622, -3884944.157, + // 7612336.042, -2270131.404, -4976406.726, -5260237.163, + // -4947737.810, 3583352.355, 7648790.331, -9360989.228 + VLOAD_64(v2, 0x4102babe20435c2f, 0xc15dbd4abd4015a9, 0xc15960e30c871450, + 0x41300472c1efbd9f, 0x415cc19e94ffb79b, 0xc160a78b6f5bcd25, + 0x412064b13e931aa9, 0xc14da3c81425b914, 0x415d09ec02a8cc93, + 0xc14151d9b3c1ecaf, 0xc152fbc5ae718384, 0xc15410f34a6ddb48, + 0xc152dfc673d9ba53, 0x414b56bc2d765fad, 0x415d2d85952e8398, + 0xc161dacba74d791e); + asm volatile("vfncvt.f.f.w v4, v2"); + // 153431.766, -7796011.000, -6652812.000, 1049714.750, + // 7538298.500, -8731739.000, 537176.625, -3884944.250, + // 7612336.000, -2270131.500, -4976406.500, -5260237.000, + // -4947738.000, 3583352.250, 7648790.500, -9360989.000 + VCMP_U32(26, v4, 0x4815d5f1, 0xcaedea56, 0xcacb0718, 0x49802396, 0x4ae60cf5, + 0xcb053c5b, 0x4903258a, 0xca6d1e41, 0x4ae84f60, 0xca0a8ece, + 0xca97de2d, 0xcaa0879a, 0xca96fe34, 0x4a5ab5e1, 0x4ae96c2d, + 0xcb0ed65d); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE14(void) { + VSET(16, e16, m1); + // 908.994, -6788.630, -5789.335, 8054.104, 3947.551, 9596.856, + // 2474.506, 3094.286, 7684.992, -6850.149, -54.922, 7737.443, + // 4171.873, 5266.611, 9163.839, 5679.187 + VLOAD_32(v2, 0x44633fa3, 0xc5d4250b, 0xc5b4eaaf, 0x45fbb0d4, 0x4576b8d0, + 0x4615f36d, 0x451aa818, 0x45416494, 0x45f027ef, 0xc5d61131, + 0xc25bb026, 0x45f1cb8c, 0x45825efb, 0x45a494e4, 0x460f2f5b, + 0x45b1797f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.f.f.w v4, v2, v0.t"); + // 0.000, -6788.000, 0.000, 8056.000, 0.000, 9600.000, 0.000, + // 3094.000, 0.000, -6852.000, 0.000, 7736.000, 0.000, 5268.000, + // 0.000, 5680.000 + VCMP_U16(27, v4, 0x0, 0xeea1, 0x0, 0x6fde, 0x0, 0x70b0, 0x0, 0x6a0b, 0x0, + 0xeeb1, 0x0, 0x6f8e, 0x0, 0x6d25, 0x0, 0x6d8c); + + VSET(16, e32, m1); + // 153431.766, -7796010.957, -6652812.196, 1049714.758, + // 7538298.328, -8731739.480, 537176.622, -3884944.157, + // 7612336.042, -2270131.404, -4976406.726, -5260237.163, + // -4947737.810, 3583352.355, 7648790.331, -9360989.228 + VLOAD_64(v2, 0x4102babe20435c2f, 0xc15dbd4abd4015a9, 0xc15960e30c871450, + 0x41300472c1efbd9f, 0x415cc19e94ffb79b, 0xc160a78b6f5bcd25, + 0x412064b13e931aa9, 0xc14da3c81425b914, 0x415d09ec02a8cc93, + 0xc14151d9b3c1ecaf, 0xc152fbc5ae718384, 0xc15410f34a6ddb48, + 0xc152dfc673d9ba53, 0x414b56bc2d765fad, 0x415d2d85952e8398, + 0xc161dacba74d791e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.f.f.w v4, v2, v0.t"); + // 0.000, -7796011.000, 0.000, 1049714.750, 0.000, -8731739.000, + // 0.000, -3884944.250, 0.000, -2270131.500, 0.000, -5260237.000, + // 0.000, 3583352.250, 0.000, -9360989.000 + VCMP_U32(28, v4, 0x0, 0xcaedea56, 0x0, 0x49802396, 0x0, 0xcb053c5b, 0x0, + 0xca6d1e41, 0x0, 0xca0a8ece, 0x0, 0xcaa0879a, 0x0, 0x4a5ab5e1, 0x0, + 0xcb0ed65d); +}; + +//////////////////// +// vfncvt.rod.f.f // +//////////////////// + +// Simple random test with similar values +void TEST_CASE15(void) { + VSET(16, e16, m1); + // 908.994, -6788.630, -5789.335, 8054.104, 3947.551, + // 9596.856, 2474.506, 3094.286, 7684.992, -6850.149, + // -54.922, 7737.443, 4171.873, 5266.611, 9163.839, + // 5679.187 + VLOAD_32(v2, 0x44633fa3, 0xc5d4250b, 0xc5b4eaaf, 0x45fbb0d4, 0x4576b8d0, + 0x4615f36d, 0x451aa818, 0x45416494, 0x45f027ef, 0xc5d61131, + 0xc25bb026, 0x45f1cb8c, 0x45825efb, 0x45a494e4, 0x460f2f5b, + 0x45b1797f); + asm volatile("vfncvt.rod.f.f.w v4, v2"); + // 909.000, -6788.000, -5788.000, 8056.000, 3948.000, + // 9600.000, 2474.000, 3094.000, 7684.000, -6852.000, + // -54.938, 7736.000, 4172.000, 5268.000, 9160.000, 5680.000 + VCMP_U16(29, v4, 0x6319, 0xeea1, 0xeda7, 0x6fdd, 0x6bb5, 0x70af, 0x68d5, + 0x6a0b, 0x6f81, 0xeeb1, 0xd2dd, 0x6f8f, 0x6c13, 0x6d25, 0x7079, + 0x6d8b); + + VSET(16, e32, m1); + // 153431.9687, 153431.984375, -6652812.196, + // 1049714.758, 7538298.328, -8731739.480, 537176.622, + // -3884944.157, 7612336.042, -2270131.404, + // -4976406.726, -5260237.163, -4947737.810, + // 3583352.355, 7648790.331, -9360989.228 + VLOAD_64(v2, 0x4102babfc0000000, 0x4102babfe0000000, 0xc15960e30c871450, + 0x41300472c1efbd9f, 0x415cc19e94ffb79b, 0xc160a78b6f5bcd25, + 0x412064b13e931aa9, 0xc14da3c81425b914, 0x415d09ec02a8cc93, + 0xc14151d9b3c1ecaf, 0xc152fbc5ae718384, 0xc15410f34a6ddb48, + 0xc152dfc673d9ba53, 0x414b56bc2d765fad, 0x415d2d85952e8398, + 0xc161dacba74d791e); + asm volatile("vfncvt.rod.f.f.w v4, v2"); + // 153431.9687, 153431.984375, -6652812.500, + // 1049714.875, 7538298.500, -8731739.000, + // 537176.5625, -3884944.250, 7612336.500, + // -2270131.250, -4976406.500, -5260237.500, + // -4947737.500, 3583352.250, 7648790.500, + // -9360989.000 + VCMP_U32(30, v4, 0x4815d5fe, 0x4815d5ff, 0xcacb0719, 0x49802397, 0x4ae60cf5, + 0xcb053c5b, 0x49032589, 0xca6d1e41, 0x4ae84f61, 0xca0a8ecd, + 0xca97de2d, 0xcaa0879b, 0xca96fe33, 0x4a5ab5e1, 0x4ae96c2d, + 0xcb0ed65d); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE16(void) { + VSET(16, e16, m1); + // 908.994, -6788.630, -5789.335, 8054.104, 3947.551, 9596.856, + // 2474.506, 3094.286, 7684.992, -6850.149, -54.922, 7737.443, + // 4171.873, 5266.611, 9163.839, 5679.187 + VLOAD_32(v2, 0x44633fa3, 0xc5d4250b, 0xc5b4eaaf, 0x45fbb0d4, 0x4576b8d0, + 0x4615f36d, 0x451aa818, 0x45416494, 0x45f027ef, 0xc5d61131, + 0xc25bb026, 0x45f1cb8c, 0x45825efb, 0x45a494e4, 0x460f2f5b, + 0x45b1797f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.rod.f.f.w v4, v2, v0.t"); + // 0.000, -6788.000, 0.000, 8056.000, 0.000, 9600.000, 0.000, + // 3094.000, 0.000, -6852.000, 0.000, 7736.000, 0.000, 5268.000, + // 0.000, 5680.000 + VCMP_U16(31, v4, 0x0, 0xeea1, 0x0, 0x6fdd, 0x0, 0x70af, 0x0, 0x6a0b, 0x0, + 0xeeb1, 0x0, 0x6f8f, 0x0, 0x6d25, 0x0, 0x6d8b); + + VSET(16, e32, m1); + // 153431.766, -7796010.957, -6652812.196, 1049714.758, + // 7538298.328, -8731739.480, 537176.622, -3884944.157, + // 7612336.042, -2270131.404, -4976406.726, -5260237.163, + // -4947737.810, 3583352.355, 7648790.331, -9360989.228 + VLOAD_64(v2, 0x4102babe20435c2f, 0xc15dbd4abd4015a9, 0xc15960e30c871450, + 0x41300472c1efbd9f, 0x415cc19e94ffb79b, 0xc160a78b6f5bcd25, + 0x412064b13e931aa9, 0xc14da3c81425b914, 0x415d09ec02a8cc93, + 0xc14151d9b3c1ecaf, 0xc152fbc5ae718384, 0xc15410f34a6ddb48, + 0xc152dfc673d9ba53, 0x414b56bc2d765fad, 0x415d2d85952e8398, + 0xc161dacba74d791e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfncvt.rod.f.f.w v4, v2, v0.t"); + // 0.000, -7796011.000, 0.000, 1049714.750, 0.000, -8731739.000, + // 0.000, -3884944.250, 0.000, -2270131.500, 0.000, -5260237.000, + // 0.000, 3583352.250, 0.000, -9360989.000 + VCMP_U32(32, v4, 0x0, 0xcaedea55, 0x0, 0x49802397, 0x0, 0xcb053c5b, 0x0, + 0xca6d1e41, 0x0, 0xca0a8ecd, 0x0, 0xcaa0879b, 0x0, 0x4a5ab5e1, 0x0, + 0xcb0ed65d); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + + TEST_CASE7(); + TEST_CASE8(); + + TEST_CASE9(); + TEST_CASE10(); + + TEST_CASE11(); + TEST_CASE12(); + + TEST_CASE13(); + TEST_CASE14(); + + TEST_CASE15(); + TEST_CASE16(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfnmacc.c b/apps/riscv-tests/isa/rv64uv/vfnmacc.c new file mode 100644 index 0000000..76cbdbe --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfnmacc.c @@ -0,0 +1,456 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.6377, -0.2332, 0.9458, -0.2612, -0.6772, 0.4543, 0.1002, + // 0.7764, 0.7979, -0.8599, 0.7837, -0.2461, 0.4221, 0.2251, + // 0.7739, 0.1461 + VLOAD_16(v2, 0xb91a, 0xb376, 0x3b91, 0xb42e, 0xb96b, 0x3745, 0x2e69, 0x3a36, + 0x3a62, 0xbae1, 0x3a45, 0xb3e0, 0x36c1, 0x3334, 0x3a31, 0x30ad); + // 0.9551, -0.6787, 0.5605, -0.7305, -0.7197, -0.1581, 0.7271, + // 0.6113, 0.2971, -0.8062, 0.9668, -0.5278, 0.3972, -0.1084, + // -0.3015, 0.9556 + VLOAD_16(v3, 0x3ba4, 0xb96e, 0x387c, 0xb9d8, 0xb9c2, 0xb10f, 0x39d1, 0x38e4, + 0x34c1, 0xba73, 0x3bbc, 0xb839, 0x365b, 0xaef0, 0xb4d3, 0x3ba5); + // 0.7402, 0.0935, 0.1455, -0.2771, 0.3347, 0.7964, 0.6543, + // -0.7534, 0.2476, 0.0338, 0.9980, 0.3284, 0.2239, + // -0.4551, 0.6694, -0.8550 + VLOAD_16(v1, 0x39ec, 0x2dfc, 0x30a8, 0xb46f, 0x355b, 0x3a5f, 0x393c, 0xba07, + 0x33ec, 0x2853, 0x3bfc, 0x3541, 0x332a, 0xb748, 0x395b, 0xbad7); + asm volatile("vfnmacc.vv v1, v2, v3"); + // -0.1313, -0.2517, -0.6758, 0.0863, -0.8223, -0.7246, -0.7271, + // 0.2788, -0.4846, -0.7271, -1.7559, -0.4583, -0.3916, 0.4795, + // -0.4360, 0.7153 + VCMP_U16(1, v1, 0xb033, 0xb407, 0xb968, 0x2d86, 0xba94, 0xb9cc, 0xb9d1, + 0x3476, 0xb7c1, 0xb9d1, 0xbf06, 0xb755, 0xb644, 0x37ac, 0xb6fa, + 0x39b9); + + VSET(16, e32, m1); + // -0.17374928, -0.36242354, -0.18093164, 0.94970566, + // -0.45790458, -0.17780401, -0.51985794, -0.04832974, + // 0.13252106, 0.77533042, 0.42536697, -0.72199643, + // -0.25088808, 0.28798762, 0.66300607, -0.63549894 + VLOAD_32(v2, 0xbe31eb55, 0xbeb98f94, 0xbe394625, 0x3f731fe9, 0xbeea7278, + 0xbe361241, 0xbf051569, 0xbd45f569, 0x3e07b39a, 0x3f467c0e, + 0x3ed9c9b3, 0xbf38d4c2, 0xbe807467, 0x3e93731d, 0x3f29bac4, + 0xbf22b00f); + // -0.61242568, 0.71439523, -0.15632962, 0.10917858, + // 0.19637996, -0.88467985, 0.73412597, -0.98048240, 0.25438991, + // -0.02058743, -0.00876777, 0.21936898, -0.71130067, + // -0.29675287, -0.96093589, 0.24695934 + VLOAD_32(v3, 0xbf1cc7ee, 0x3f36e29b, 0xbe2014df, 0x3ddf9905, 0x3e4917d4, + 0xbf627a61, 0x3f3befae, 0xbf7b00e5, 0x3e823f65, 0xbca8a6f9, + 0xbc0fa6af, 0x3e60a243, 0xbf3617cd, 0xbe97effe, 0xbf75ffe5, + 0x3e7ce2e9); + // 0.77600455, 0.02542816, -0.63618338, 0.11704731, + // 0.45613721, -0.90825689, 0.21235447, 0.35766414, + // 0.08650716, -0.98431164, 0.21029140, -0.92919809, + // 0.46440944, 0.70648551, -0.80876821, -0.19595607 + VLOAD_32(v1, 0x3f46a83c, 0x3cd04eb8, 0xbf22dcea, 0x3defb680, 0x3ee98ad1, + 0xbf688386, 0x3e597373, 0x3eb71fc1, 0x3db12aaa, 0xbf7bfbd9, + 0x3e5756a1, 0xbf6ddfed, 0x3eedc713, 0x3f34dc3c, 0xbf4f0b6f, + 0xbe48a8b5); + asm volatile("vfnmacc.vv v1, v2, v3"); + // -0.88241309, 0.23348548, 0.60789841, -0.22073483, + // -0.36621392, 0.75095725, 0.16928674, -0.40505061, + // -0.12021918, 1.00027370, -0.20656188, 1.08758175, + // -0.64286631, -0.62102437, 1.44587445, 0.35289848 + VCMP_U32(2, v1, 0xbf61e5d3, 0x3e6f16d2, 0x3f1b9f3b, 0xbe62084f, 0xbebb8064, + 0x3f403ebc, 0x3e2d5982, 0xbecf62cb, 0xbdf63579, 0x3f8008f8, + 0xbe5384f5, 0x3f8b35e1, 0xbf2492e3, 0xbf1efb74, 0x3fb9126b, + 0x3eb4af1c); + + VSET(16, e64, m1); + // -0.3252450595073633, 0.4758165631309326, -0.1595578232245429, + // -0.5062008461482019, -0.8497827573746595, -0.1941654045426651, + // 0.5653121187716577, -0.9852357785633095, -0.4238236947700038, + // 0.5852522737985073, 0.4009389814391957, -0.8725649196362917, + // -0.5946782335830663, 0.4175703122760628, -0.6355596052793091, + // -0.3469340725892474 + VLOAD_64(v2, 0xbfd4d0d0a77142c0, 0x3fde73c75062b7e8, 0xbfc46c6408490198, + 0xbfe032cc1ded3ff0, 0xbfeb316b9bf41faa, 0xbfc8da6977433ee0, + 0x3fe2170970c503fe, 0xbfef870d2ef8e992, 0xbfdb1fed6b13a6c0, + 0x3fe2ba62f9fbf9aa, 0x3fd9a8fbf93e43f0, 0xbfebec0d442f3114, + 0xbfe3079aa59c3bf4, 0x3fdab978d4c06588, 0xbfe4568118eaaa68, + 0xbfd6342af7e8e3dc); + // 0.9024789401717532, 0.1750129013440402, 0.5031110880652467, + // -0.2303324647743561, -0.3880673069078899, + // -0.9441232974464955, -0.9718449040015202, 0.6713775626400460, + // -0.0912048565692380, -0.5347347522064834, + // -0.5209348837668262, 0.1676058792979986, + // -0.3611782231841894, 0.5839305722445856, + // -0.5690013462620132, -0.7273345685963009 + VLOAD_64(v3, 0x3fece11b83abb9b8, 0x3fc666d29fd34b08, 0x3fe0197c6cafd8c4, + 0xbfcd7b88c1b4daf0, 0xbfd8d61841f43c54, 0xbfee36420fbd9482, + 0xbfef195a7bef10b4, 0x3fe57beccc59d47e, 0xbfb7593394338500, + 0xbfe11c8c0e185e4a, 0xbfe0ab7fa223f876, 0x3fc5741c0519e298, + 0xbfd71d8b44269f74, 0x3fe2af8f2add9a18, 0xbfe235424fb26902, + 0xbfe74653252be25a); + // -0.0769255470598902, -0.8447241112550155, -0.1913688167412757, + // 0.7663381230505260, 0.2058488268749510, -0.0251549939511286, + // 0.5275264461714482, -0.7602756587514194, 0.6498044022974587, + // -0.7128277097157256, -0.8385947434294139, 0.8834902787005550, + // 0.5936682304042178, 0.1532178226844403, -0.5096194622607613, + // -0.8578075287458693 + VLOAD_64(v1, 0xbfb3b16484d96110, 0xbfeb07fadbff7462, 0xbfc87ec5fcb06230, + 0x3fe885d78705c2d4, 0x3fca59411dac8758, 0xbf99c23b11679a80, + 0x3fe0e17f24429b70, 0xbfe8542d9e4907ce, 0x3fe4cb329a1542de, + 0xbfe6cf7c0e9d2c04, 0xbfead5c4a4b40f1a, 0x3fec458d67ab4a36, + 0x3fe2ff5484485472, 0x3fc39ca440cc0820, 0xbfe04ecd797a151a, + 0xbfeb7328c6473c1e); + asm volatile("vfnmacc.vv v1, v2, v3"); + // 0.3704523636601942, 0.7614500740339213, 0.2716441267930978, + // -0.8829326116147059, -0.5356217329860959, + // -0.1581610880357251, 0.0218692556270895, 1.4217408543890222, + // -0.6884591815896014, 1.0257824393236514, 1.0474578451230310, + // -0.7372432681003268, -0.8084530581760619, + // -0.3970498940841519, 0.1479851912270807, 0.6054703847278113 + VCMP_U64(3, v1, 0x3fd7b57dd4a95f28, 0x3fe85dcc8bb06629, 0x3fd1629e0c2e846c, + 0xbfec40fbe46ea001, 0xbfe123d0304677d2, 0xbfc43e9f5e4e7ddd, + 0x3f9664e4e6d32991, 0x3ff6bf73568fcea3, 0xbfe607db8cb1dd4b, + 0x3ff0699ad8db4c8b, 0x3ff0c263284bdf71, 0xbfe7977f31b5fc6d, + 0xbfe9ded8f2a6f4b5, 0xbfd96943f57e3046, 0x3fc2f12dc24e6a42, + 0x3fe360036da34794); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.6377, -0.2332, 0.9458, -0.2612, -0.6772, 0.4543, 0.1002, + // 0.7764, 0.7979, -0.8599, 0.7837, -0.2461, 0.4221, 0.2251, + // 0.7739, 0.1461 + VLOAD_16(v2, 0xb91a, 0xb376, 0x3b91, 0xb42e, 0xb96b, 0x3745, 0x2e69, 0x3a36, + 0x3a62, 0xbae1, 0x3a45, 0xb3e0, 0x36c1, 0x3334, 0x3a31, 0x30ad); + // 0.9551, -0.6787, 0.5605, -0.7305, -0.7197, -0.1581, 0.7271, + // 0.6113, 0.2971, -0.8062, 0.9668, -0.5278, 0.3972, -0.1084, + // -0.3015, 0.9556 + VLOAD_16(v3, 0x3ba4, 0xb96e, 0x387c, 0xb9d8, 0xb9c2, 0xb10f, 0x39d1, 0x38e4, + 0x34c1, 0xba73, 0x3bbc, 0xb839, 0x365b, 0xaef0, 0xb4d3, 0x3ba5); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.7402, 0.0935, 0.1455, -0.2771, 0.3347, 0.7964, 0.6543, + // -0.7534, 0.2476, 0.0338, 0.9980, 0.3284, 0.2239, + // -0.4551, 0.6694, -0.8550 + VLOAD_16(v1, 0x39ec, 0x2dfc, 0x30a8, 0xb46f, 0x355b, 0x3a5f, 0x393c, 0xba07, + 0x33ec, 0x2853, 0x3bfc, 0x3541, 0x332a, 0xb748, 0x395b, 0xbad7); + asm volatile("vfnmacc.vv v1, v2, v3, v0.t"); + // 0.0000, -0.2517, 0.0000, 0.0863, 0.0000, -0.7246, 0.0000, + // 0.2788, 0.0000, -0.7271, 0.0000, -0.4583, 0.0000, 0.4795, + // 0.0000, 0.7153 + VCMP_U16(4, v1, 0x39ec, 0xb407, 0x30a8, 0x2d86, 0x355b, 0xb9cc, 0x393c, + 0x3476, 0x33ec, 0xb9d1, 0x3bfc, 0xb755, 0x332a, 0x37ac, 0x395b, + 0x39b9); + + VSET(16, e32, m1); + // -0.17374928, -0.36242354, -0.18093164, 0.94970566, + // -0.45790458, -0.17780401, -0.51985794, -0.04832974, + // 0.13252106, 0.77533042, 0.42536697, -0.72199643, + // -0.25088808, 0.28798762, 0.66300607, -0.63549894 + VLOAD_32(v2, 0xbe31eb55, 0xbeb98f94, 0xbe394625, 0x3f731fe9, 0xbeea7278, + 0xbe361241, 0xbf051569, 0xbd45f569, 0x3e07b39a, 0x3f467c0e, + 0x3ed9c9b3, 0xbf38d4c2, 0xbe807467, 0x3e93731d, 0x3f29bac4, + 0xbf22b00f); + // -0.61242568, 0.71439523, -0.15632962, 0.10917858, + // 0.19637996, -0.88467985, 0.73412597, -0.98048240, 0.25438991, + // -0.02058743, -0.00876777, 0.21936898, -0.71130067, + // -0.29675287, -0.96093589, 0.24695934 + VLOAD_32(v3, 0xbf1cc7ee, 0x3f36e29b, 0xbe2014df, 0x3ddf9905, 0x3e4917d4, + 0xbf627a61, 0x3f3befae, 0xbf7b00e5, 0x3e823f65, 0xbca8a6f9, + 0xbc0fa6af, 0x3e60a243, 0xbf3617cd, 0xbe97effe, 0xbf75ffe5, + 0x3e7ce2e9); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.77600455, 0.02542816, -0.63618338, 0.11704731, + // 0.45613721, -0.90825689, 0.21235447, 0.35766414, + // 0.08650716, -0.98431164, 0.21029140, -0.92919809, + // 0.46440944, 0.70648551, -0.80876821, -0.19595607 + VLOAD_32(v1, 0x3f46a83c, 0x3cd04eb8, 0xbf22dcea, 0x3defb680, 0x3ee98ad1, + 0xbf688386, 0x3e597373, 0x3eb71fc1, 0x3db12aaa, 0xbf7bfbd9, + 0x3e5756a1, 0xbf6ddfed, 0x3eedc713, 0x3f34dc3c, 0xbf4f0b6f, + 0xbe48a8b5); + asm volatile("vfnmacc.vv v1, v2, v3, v0.t"); + // 0.00000000, 0.23348548, 0.00000000, -0.22073483, + // 0.00000000, 0.75095725, 0.00000000, -0.40505061, + // 0.00000000, 1.00027370, 0.00000000, 1.08758175, + // 0.00000000, -0.62102437, 0.00000000, 0.35289848 + VCMP_U32(5, v1, 0x3f46a83c, 0x3e6f16d2, 0xbf22dcea, 0xbe62084f, 0x3ee98ad1, + 0x3f403ebc, 0x3e597373, 0xbecf62cb, 0x3db12aaa, 0x3f8008f8, + 0x3e5756a1, 0x3f8b35e1, 0x3eedc713, 0xbf1efb74, 0xbf4f0b6f, + 0x3eb4af1c); + + VSET(16, e64, m1); + // -0.3252450595073633, 0.4758165631309326, -0.1595578232245429, + // -0.5062008461482019, -0.8497827573746595, -0.1941654045426651, + // 0.5653121187716577, -0.9852357785633095, -0.4238236947700038, + // 0.5852522737985073, 0.4009389814391957, -0.8725649196362917, + // -0.5946782335830663, 0.4175703122760628, -0.6355596052793091, + // -0.3469340725892474 + VLOAD_64(v2, 0xbfd4d0d0a77142c0, 0x3fde73c75062b7e8, 0xbfc46c6408490198, + 0xbfe032cc1ded3ff0, 0xbfeb316b9bf41faa, 0xbfc8da6977433ee0, + 0x3fe2170970c503fe, 0xbfef870d2ef8e992, 0xbfdb1fed6b13a6c0, + 0x3fe2ba62f9fbf9aa, 0x3fd9a8fbf93e43f0, 0xbfebec0d442f3114, + 0xbfe3079aa59c3bf4, 0x3fdab978d4c06588, 0xbfe4568118eaaa68, + 0xbfd6342af7e8e3dc); + // 0.9024789401717532, 0.1750129013440402, 0.5031110880652467, + // -0.2303324647743561, -0.3880673069078899, + // -0.9441232974464955, -0.9718449040015202, 0.6713775626400460, + // -0.0912048565692380, -0.5347347522064834, + // -0.5209348837668262, 0.1676058792979986, + // -0.3611782231841894, 0.5839305722445856, + // -0.5690013462620132, -0.7273345685963009 + VLOAD_64(v3, 0x3fece11b83abb9b8, 0x3fc666d29fd34b08, 0x3fe0197c6cafd8c4, + 0xbfcd7b88c1b4daf0, 0xbfd8d61841f43c54, 0xbfee36420fbd9482, + 0xbfef195a7bef10b4, 0x3fe57beccc59d47e, 0xbfb7593394338500, + 0xbfe11c8c0e185e4a, 0xbfe0ab7fa223f876, 0x3fc5741c0519e298, + 0xbfd71d8b44269f74, 0x3fe2af8f2add9a18, 0xbfe235424fb26902, + 0xbfe74653252be25a); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.0769255470598902, -0.8447241112550155, -0.1913688167412757, + // 0.7663381230505260, 0.2058488268749510, -0.0251549939511286, + // 0.5275264461714482, -0.7602756587514194, 0.6498044022974587, + // -0.7128277097157256, -0.8385947434294139, 0.8834902787005550, + // 0.5936682304042178, 0.1532178226844403, -0.5096194622607613, + // -0.8578075287458693 + VLOAD_64(v1, 0xbfb3b16484d96110, 0xbfeb07fadbff7462, 0xbfc87ec5fcb06230, + 0x3fe885d78705c2d4, 0x3fca59411dac8758, 0xbf99c23b11679a80, + 0x3fe0e17f24429b70, 0xbfe8542d9e4907ce, 0x3fe4cb329a1542de, + 0xbfe6cf7c0e9d2c04, 0xbfead5c4a4b40f1a, 0x3fec458d67ab4a36, + 0x3fe2ff5484485472, 0x3fc39ca440cc0820, 0xbfe04ecd797a151a, + 0xbfeb7328c6473c1e); + asm volatile("vfnmacc.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, 0.7614500740339213, 0.0000000000000000, + // -0.8829326116147059, 0.0000000000000000, + // -0.1581610880357251, 0.0000000000000000, 1.4217408543890222, + // 0.0000000000000000, 1.0257824393236514, 0.0000000000000000, + // -0.7372432681003268, 0.0000000000000000, + // -0.3970498940841519, 0.0000000000000000, 0.6054703847278113 + VCMP_U64(6, v1, 0xbfb3b16484d96110, 0x3fe85dcc8bb06629, 0xbfc87ec5fcb06230, + 0xbfec40fbe46ea001, 0x3fca59411dac8758, 0xbfc43e9f5e4e7ddd, + 0x3fe0e17f24429b70, 0x3ff6bf73568fcea3, 0x3fe4cb329a1542de, + 0x3ff0699ad8db4c8b, 0xbfead5c4a4b40f1a, 0xbfe7977f31b5fc6d, + 0x3fe2ff5484485472, 0xbfd96943f57e3046, 0xbfe04ecd797a151a, + 0x3fe360036da34794); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.1300 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3029); + // -0.2844, 0.4070, -0.1837, -0.2321, -0.5283, -0.6104, -0.7183, + // -0.1191, 0.7998, 0.1169, 0.1169, -0.9214, -0.4360, -0.6250, + // -0.5386, 0.6543 + VLOAD_16(v2, 0xb48d, 0x3683, 0xb1e1, 0xb36d, 0xb83a, 0xb8e2, 0xb9bf, 0xaf9f, + 0x3a66, 0x2f7c, 0x2f7c, 0xbb5f, 0xb6fa, 0xb900, 0xb84f, 0x393c); + // 0.9268, -0.3337, -0.3225, -0.8306, -0.1857, -0.6831, 0.0557, + // 0.5586, 0.2352, 0.6294, 0.6294, -0.8877, -0.2426, 0.5488, + // 0.4001, 0.1772 + VLOAD_16(v1, 0x3b6a, 0xb557, 0xb529, 0xbaa5, 0xb1f1, 0xb977, 0x2b21, 0x3878, + 0x3387, 0x3909, 0x3909, 0xbb1a, 0xb3c3, 0x3864, 0x3667, 0x31ac); + asm volatile("vfnmacc.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.8896, 0.2808, 0.3464, 0.8608, 0.2544, 0.7627, 0.0377, + // -0.5430, -0.3394, -0.6445, -0.6445, 1.0078, 0.2993, -0.4675, + // -0.3301, -0.2622 + VCMP_U16(7, v1, 0xbb1e, 0x347e, 0x358b, 0x3ae3, 0x3412, 0x3a1a, 0x28d3, + 0xb858, 0xb56d, 0xb928, 0xb928, 0x3c08, 0x34ca, 0xb77b, 0xb548, + 0xb432); + + VSET(16, e32, m1); + double dscalar_32; + // -0.26917368 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe89d122); + // -0.27745819, -0.86308837, -0.16746511, -0.68674469, + // -0.49064314, -0.74352056, -0.17169137, 0.26071417, + // 0.71857828, 0.07920383, -0.43244356, -0.58339220, 0.80679923, + // 0.23900302, 0.73513943, -0.80685192 + VLOAD_32(v2, 0xbe8e0f00, 0xbf5cf35c, 0xbe2b7bf9, 0xbf2fce80, 0xbefb3594, + 0xbf3e575d, 0xbe2fcfdd, 0x3e857c54, 0x3f37f4bf, 0x3da2359e, + 0xbedd693e, 0xbf155931, 0x3f4e8a65, 0x3e74bd35, 0x3f3c3219, + 0xbf4e8dd9); + // 0.13509545, -0.29169917, 0.80494332, -0.63637137, + // 0.63772237, -0.87242430, -0.44194883, -0.41286576, + // -0.57735479, 0.61664599, 0.94073379, -0.89744234, + // -0.70681161, 0.23247144, 0.06774496, -0.38581881 + VLOAD_32(v1, 0x3e0a5676, 0xbe955998, 0x3f4e10c4, 0xbf22e93c, 0x3f2341c6, + 0xbf5f5733, 0xbee2471e, 0xbed36324, 0xbf13cd86, 0x3f1ddc83, + 0x3f70d3ee, 0xbf65bec8, 0xbf34f19b, 0x3e6e0cfe, 0x3d8abdde, + 0xbec58a0b); + asm volatile("vfnmacc.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // -0.20977989, 0.05937849, -0.85002053, 0.45151776, + // -0.76979059, 0.67228812, 0.39573404, 0.48304313, + // 0.77077717, -0.59532642, -1.05713618, 0.74040854, 0.92398071, + // -0.16813812, 0.13013524, 0.16863550 + VCMP_U32(8, v1, 0xbe56d08a, 0x3d7336de, 0xbf599af2, 0x3ee72d57, 0xbf4510ff, + 0x3f2c1b13, 0x3eca9da7, 0x3ef7516f, 0x3f4551a7, 0xbf186750, + 0xbf87503d, 0x3f3d8b6a, 0x3f6c8a00, 0xbe2c2c66, 0x3e05422c, + 0x3e2caec9); + + VSET(16, e64, m1); + double dscalar_64; + // 0.1021836258281641 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fba28b4c31e60e0); + // 0.3274079371230154, 0.9254873656544997, 0.9683609308176633, + // -0.6778040243955326, 0.9669615854915627, + // 0.8026267269428324, -0.7388821308618641, 0.7432413708598076, + // 0.9355143976513562, -0.4219868517017851, 0.8950700270161456, + // 0.6727820676214205, -0.8833440526985297, 0.0357808590148252, + // -0.3802125831332157, 0.9831607630398518 + VLOAD_64(v2, 0x3fd4f4406b993a2c, 0x3fed9d97ae0b1cd6, 0x3feefcd01012c05e, + 0xbfe5b09210bc082e, 0x3feef1596c459614, 0x3fe9af1e3ee3adfa, + 0xbfe7a4ec2374d0e2, 0x3fe7c8a2209c110c, 0x3fedefbbe3db30dc, + 0xbfdb01d523d9acc0, 0x3feca469e5b540fa, 0x3fe5876e42389dca, + 0xbfec445abf2e99e4, 0x3fa251de66953a60, 0xbfd8556728856e10, + 0x3fef760d8f7eee22); + // 0.1671854121593166, 0.6264287337062140, 0.1587305627009998, + // -0.3348358495277817, 0.4721131630506652, + // 0.2878076790245236, 0.5083797506594245, 0.9444607965181537, + // -0.2805814092841707, -0.7218856627753110, + // -0.3443302881655670, 0.3680926220616383, + // -0.2344410843781140, 0.3553553454507421, + // 0.0951222110617760, -0.8329780449088213 + VLOAD_64(v1, 0x3fc56654e2cbd888, 0x3fe40bb445915f4a, 0x3fc4514877d696a0, + 0xbfd56df357d00344, 0x3fde371a20d41408, 0x3fd26b70e63cabf0, + 0x3fe044a59c60fcd4, 0x3fee3905d92cc95e, 0xbfd1f50bba2f6e40, + 0xbfe719aff62247a4, 0xbfd60981e7ac601c, 0x3fd78ed45b69d4fc, + 0xbfce022a5b1f1348, 0x3fd6be2458cadcb0, 0x3fb859ede1a22f80, + 0xbfeaa7c192a56bc8); + asm volatile("vfnmacc.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // -0.2006411422994659, -0.7209983883869466, -0.2576811937222847, + // 0.4040963223414386, -0.5709208038927434, -0.3698229881701340, + // -0.4328780954683192, -1.0204078946581041, 0.1849871561177042, + // 0.7650058093340112, 0.2528687874349445, -0.4368399331233641, + // 0.3247043825365946, -0.3590115633601233, -0.0562707107317317, + // 0.7325151133694248 + VCMP_U64(9, v1, 0xbfc9ae9be43442c9, 0xbfe7126b3652e68a, 0xbfd07dd942f53687, + 0x3fd9dcb6d238fb8a, 0xbfe244fbb4aa695e, 0xbfd7ab2e09dffb6d, + 0xbfdbb44653cc3c92, 0xbff053973a823036, 0x3fc7ada8bcda50a5, + 0x3fe87aed768addeb, 0x3fd02f00910d95b4, 0xbfdbf52f7a9681dc, + 0x3fd4c7f4e3f733f9, 0xbfd6fa0ba2e11fba, 0xbfaccf83bca18481, + 0x3fe770c388f7eacc); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.1300 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3029); + // -0.2844, 0.4070, -0.1837, -0.2321, -0.5283, -0.6104, + // -0.7183, -0.1191, 0.7998, 0.1169, 0.2551, -0.9214, + // -0.4360, -0.6250, -0.5386, 0.6543 + VLOAD_16(v2, 0xb48d, 0x3683, 0xb1e1, 0xb36d, 0xb83a, 0xb8e2, 0xb9bf, 0xaf9f, + 0x3a66, 0x2f7c, 0x3415, 0xbb5f, 0xb6fa, 0xb900, 0xb84f, 0x393c); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.9268, -0.3337, -0.3225, -0.8306, -0.1857, -0.6831, 0.0557, + // 0.5586, 0.2352, 0.6294, -0.0325, -0.8877, -0.2426, 0.5488, + // 0.4001, 0.1772 + VLOAD_16(v1, 0x3b6a, 0xb557, 0xb529, 0xbaa5, 0xb1f1, 0xb977, 0x2b21, 0x3878, + 0x3387, 0x3909, 0xa828, 0xbb1a, 0xb3c3, 0x3864, 0x3667, 0x31ac); + asm volatile("vfnmacc.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.2808, 0.0000, 0.8608, 0.0000, 0.7627, 0.0000, + // -0.5430, 0.0000, -0.6445, 0.0000, 1.0078, 0.0000, + // -0.4675, 0.0000, -0.2622 + VCMP_U16(10, v1, 0x3b6a, 0x347e, 0xb529, 0x3ae3, 0xb1f1, 0x3a1a, 0x2b21, + 0xb858, 0x3387, 0xb928, 0xa828, 0x3c08, 0xb3c3, 0xb77b, 0x3667, + 0xb432); + + VSET(16, e32, m1); + double dscalar_32; + // -0.26917368 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe89d122); + // -0.27745819, -0.86308837, -0.16746511, -0.68674469, + // -0.49064314, -0.74352056, -0.17169137, 0.26071417, + // 0.71857828, 0.07920383, -0.43244356, -0.58339220, + // 0.80679923, 0.23900302, 0.73513943, -0.80685192 + VLOAD_32(v2, 0xbe8e0f00, 0xbf5cf35c, 0xbe2b7bf9, 0xbf2fce80, 0xbefb3594, + 0xbf3e575d, 0xbe2fcfdd, 0x3e857c54, 0x3f37f4bf, 0x3da2359e, + 0xbedd693e, 0xbf155931, 0x3f4e8a65, 0x3e74bd35, 0x3f3c3219, + 0xbf4e8dd9); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.13509545, -0.29169917, 0.80494332, -0.63637137, + // 0.63772237, -0.87242430, -0.44194883, -0.41286576, + // -0.57735479, 0.61664599, 0.94073379, -0.89744234, + // -0.70681161, 0.23247144, 0.06774496, -0.38581881 + VLOAD_32(v1, 0x3e0a5676, 0xbe955998, 0x3f4e10c4, 0xbf22e93c, 0x3f2341c6, + 0xbf5f5733, 0xbee2471e, 0xbed36324, 0xbf13cd86, 0x3f1ddc83, + 0x3f70d3ee, 0xbf65bec8, 0xbf34f19b, 0x3e6e0cfe, 0x3d8abdde, + 0xbec58a0b); + asm volatile("vfnmacc.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, 0.05937849, 0.00000000, 0.45151776, + // 0.00000000, 0.67228812, 0.00000000, 0.48304313, + // 0.00000000, -0.59532642, 0.00000000, 0.74040854, + // 0.00000000, -0.16813812, 0.00000000, 0.16863550 + VCMP_U32(11, v1, 0x3e0a5676, 0x3d7336de, 0x3f4e10c4, 0x3ee72d57, 0x3f2341c6, + 0x3f2c1b13, 0xbee2471e, 0x3ef7516f, 0xbf13cd86, 0xbf186750, + 0x3f70d3ee, 0x3f3d8b6a, 0xbf34f19b, 0xbe2c2c66, 0x3d8abdde, + 0x3e2caec9); + + VSET(16, e64, m1); + double dscalar_64; + // 0.1021836258281641 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fba28b4c31e60e0); + // 0.3274079371230154, 0.9254873656544997, + // 0.9683609308176633, -0.6778040243955326, + // 0.9669615854915627, 0.8026267269428324, + // -0.7388821308618641, 0.7432413708598076, + // 0.9355143976513562, -0.4219868517017851, + // 0.8950700270161456, 0.6727820676214205, + // -0.8833440526985297, 0.0357808590148252, + // -0.3802125831332157, 0.9831607630398518 + VLOAD_64(v2, 0x3fd4f4406b993a2c, 0x3fed9d97ae0b1cd6, 0x3feefcd01012c05e, + 0xbfe5b09210bc082e, 0x3feef1596c459614, 0x3fe9af1e3ee3adfa, + 0xbfe7a4ec2374d0e2, 0x3fe7c8a2209c110c, 0x3fedefbbe3db30dc, + 0xbfdb01d523d9acc0, 0x3feca469e5b540fa, 0x3fe5876e42389dca, + 0xbfec445abf2e99e4, 0x3fa251de66953a60, 0xbfd8556728856e10, + 0x3fef760d8f7eee22); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.1671854121593166, 0.6264287337062140, + // 0.1587305627009998, -0.3348358495277817, + // 0.4721131630506652, 0.2878076790245236, + // 0.5083797506594245, 0.9444607965181537, + // -0.2805814092841707, -0.7218856627753110, + // -0.3443302881655670, 0.3680926220616383, + // -0.2344410843781140, 0.3553553454507421, + // 0.0951222110617760, -0.8329780449088213 + VLOAD_64(v1, 0x3fc56654e2cbd888, 0x3fe40bb445915f4a, 0x3fc4514877d696a0, + 0xbfd56df357d00344, 0x3fde371a20d41408, 0x3fd26b70e63cabf0, + 0x3fe044a59c60fcd4, 0x3fee3905d92cc95e, 0xbfd1f50bba2f6e40, + 0xbfe719aff62247a4, 0xbfd60981e7ac601c, 0x3fd78ed45b69d4fc, + 0xbfce022a5b1f1348, 0x3fd6be2458cadcb0, 0x3fb859ede1a22f80, + 0xbfeaa7c192a56bc8); + asm volatile("vfnmacc.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + // -0.2006411422994659, -0.7209983883869466, + // -0.2576811937222847, 0.4040963223414386, + // -0.5709208038927434, -0.3698229881701340, + // -0.4328780954683192, -1.0204078946581041, + // 0.1849871561177042, 0.7650058093340112, 0.2528687874349445, + // -0.4368399331233641, 0.3247043825365946, + // -0.3590115633601233, -0.0562707107317317, 0.7325151133694248 + VCMP_U64(12, v1, 0x3fc56654e2cbd888, 0xbfe7126b3652e68a, 0x3fc4514877d696a0, + 0x3fd9dcb6d238fb8a, 0x3fde371a20d41408, 0xbfd7ab2e09dffb6d, + 0x3fe044a59c60fcd4, 0xbff053973a823036, 0xbfd1f50bba2f6e40, + 0x3fe87aed768addeb, 0xbfd60981e7ac601c, 0xbfdbf52f7a9681dc, + 0xbfce022a5b1f1348, 0xbfd6fa0ba2e11fba, 0x3fb859ede1a22f80, + 0x3fe770c388f7eacc); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfnmadd.c b/apps/riscv-tests/isa/rv64uv/vfnmadd.c new file mode 100644 index 0000000..307666f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfnmadd.c @@ -0,0 +1,458 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.7461, 0.0514, -0.3071, -0.4934, -0.5220, -0.7983, 0.4907, + // -0.9028, 0.1752, 0.0676, 0.1040, 0.4526, 0.3525, -0.2686, + // 0.3540, -0.0847 + VLOAD_16(v2, 0xb9f8, 0x2a94, 0xb4ea, 0xb7e5, 0xb82d, 0xba63, 0x37da, 0xbb39, + 0x319b, 0x2c54, 0x2ea8, 0x373e, 0x35a4, 0xb44c, 0x35aa, 0xad6c); + // 0.1573, -0.7700, 0.0804, -0.9438, 0.0790, 0.7998, -0.2854, + // 0.1963, -0.0687, -0.2123, 0.3625, -0.0002, 0.7168, -0.4033, + // 0.2812, -0.3159 + VLOAD_16(v3, 0x3109, 0xba29, 0x2d25, 0xbb8d, 0x2d0e, 0x3a66, 0xb491, 0x3248, + 0xac65, 0xb2cb, 0x35cd, 0x897c, 0x39bc, 0xb674, 0x3480, 0xb50e); + // 0.0337, 0.2034, -0.1886, 0.8242, 0.3225, 0.0331, 0.0698, + // 0.6777, -0.2539, -0.5825, -0.4319, -0.6323, 0.0674, -0.2903, + // -0.8145, 0.1893 + VLOAD_16(v1, 0x284f, 0x3282, 0xb209, 0x3a98, 0x3529, 0x283b, 0x2c77, 0x396c, + 0xb410, 0xb8a9, 0xb6e9, 0xb90f, 0x2c50, 0xb4a5, 0xba84, 0x320f); + asm volatile("vfnmadd.vv v1, v2, v3"); + // -0.1322, 0.7598, -0.1383, 1.3506, 0.0894, -0.7734, 0.2512, + // 0.4155, 0.1132, 0.2517, -0.3176, 0.2864, -0.7407, 0.3254, + // 0.0071, 0.3320 + VCMP_U16(1, v1, 0xb03b, 0x3a14, 0xb06d, 0x3d67, 0x2db8, 0xba30, 0x3405, + 0x36a6, 0x2f3e, 0x3407, 0xb515, 0x3495, 0xb9ed, 0x3535, 0x1f3d, + 0x3550); + + VSET(16, e32, m1); + // -0.36820358, 0.10496315, -0.32905263, -0.92334682, + // 0.43153936, 0.92736709, -0.59600371, 0.75117606, 0.84123290, + // 0.33028743, -0.43412161, 0.95273590, 0.06816643, + // -0.88978988, 0.18573478, 0.61926919 + VLOAD_32(v2, 0xbebc852e, 0x3dd6f6ec, 0xbea87996, 0xbf6c6075, 0x3edcf2ba, + 0x3f6d67ee, 0xbf1893b3, 0x3f404d13, 0x3f575b0a, 0x3ea91b6f, + 0xbede4530, 0x3f73e680, 0x3d8b9ad8, 0xbf63c945, 0x3e3e3142, + 0x3f1e886d); + // 0.69083834, -0.31329882, -0.54809541, 0.25019145, + // -0.67489260, 0.23259214, -0.14038530, 0.09741956, + // -0.23567833, 0.75417399, -0.90357685, -0.87489468, + // 0.54726779, -0.06705534, -0.15476358, -0.96940458 + VLOAD_32(v3, 0x3f30dac8, 0xbea068b4, 0xbf0c4ffb, 0x3e801918, 0xbf2cc5c3, + 0x3e6e2ca2, 0xbe0fc12a, 0x3dc783e8, 0xbe7155a9, 0x3f41118c, + 0xbf6750d0, 0xbf5ff919, 0x3f0c19be, 0xbd895450, 0xbe1e7a58, + 0xbf782ae6); + // 0.03722767, 0.80796093, 0.53925264, -0.50804031, + // 0.63562357, -0.45508829, -0.22051410, 0.42499006, + // -0.59229839, -0.50074077, -0.80474108, -0.20762257, + // 0.15367362, 0.98349953, -0.15871963, -0.07445616 + VLOAD_32(v1, 0x3d187c0a, 0x3f4ed687, 0x3f0a0c76, 0xbf020eee, 0x3f22b83a, + 0xbee90155, 0xbe61ce73, 0x3ed9984c, 0xbf17a0de, 0xbf00308c, + 0xbf4e0383, 0xbe549b03, 0x3e1d5c9e, 0x3f7bc6a0, 0xbe228766, + 0xbd987c79); + asm volatile("vfnmadd.vv v1, v2, v3"); + // -0.67713100, 0.22849269, 0.72553790, -0.71928883, + // 0.40059602, 0.18944177, 0.00895807, -0.41666192, 0.73393923, + // -0.58878565, 0.55422139, 1.07270420, -0.55774319, + // 0.94216329, 0.18424334, 1.01551294 + VCMP_U32(2, v1, 0xbf2d5875, 0x3e69f9fd, 0x3f39bcda, 0xbf382350, 0x3ecd1aec, + 0x3e41fd06, 0x3c12c4e5, 0xbed554b6, 0x3f3be371, 0xbf16baa7, + 0x3f0de173, 0x3f894e5f, 0xbf0ec842, 0x3f71319d, 0x3e3caa49, + 0x3f81fc54); + + VSET(16, e64, m1); + // -0.1517393950396491, -0.0976116299317518, 0.4195080955516000, + // -0.8346165642452430, 0.0078216057137750, -0.5126918345148062, + // -0.9302856586058497, -0.8971839537614414, 0.1317157676127678, + // -0.3423297874984121, 0.7678405723111816, -0.6465198020108864, + // 0.4795090517472360, -0.9006147069685106, 0.9841759200408695, + // 0.8437352562659637 + VLOAD_64(v2, 0xbfc36c324d9ae520, 0xbfb8fd1366442100, 0x3fdad9387bb34990, + 0xbfeab52dcc044330, 0x3f8004c625f16600, 0xbfe067f8b4c55ad2, + 0xbfedc4e66df4cc5a, 0xbfecb5bb1f7cd800, 0x3fc0dc0ff121d700, + 0xbfd5e8bb327025d8, 0x3fe892266453ca54, 0xbfe4b04a4bbb4d06, + 0x3fdeb046bbd8fb80, 0xbfecd1d5ef173e7a, 0x3fef7e5e7fc2c286, + 0x3feaffe114849fb0); + // 0.3915682245289982, 0.0468282563045201, 0.4640582663413180, + // 0.9199907734666593, -0.6702920875531786, 0.6250479001245852, + // -0.3716310293668668, 0.2191474803863191, + // -0.3398132406457823, -0.1436002174993440, + // -0.7049093483038609, 0.0726450331160087, 0.3054536350672581, + // -0.9906780567812383, 0.2659677084286980, -0.6111168392293305 + VLOAD_64(v3, 0x3fd90f742ba04f2c, 0x3fa7f9df8ab696e0, 0x3fddb3217157f678, + 0x3fed70907d95274a, 0xbfe573086459defe, 0x3fe40064742efe82, + 0xbfd7c8cd8353cefc, 0x3fcc0d064ea14910, 0xbfd5bf8008d49208, + 0xbfc2617deeedd880, 0xbfe68e9e0cb3831e, 0x3fb298dd69733960, + 0x3fd38c8d6743b96c, 0xbfefb3a277d7b020, 0x3fd1059d6c5f9294, + 0xbfe38e44e6d0cbb0); + // 0.8932002267748917, 0.5237198185024288, -0.3716642114238491, + // 0.8806741908360942, 0.4285584084885536, -0.9185899240339090, + // -0.3906189235600976, -0.8681987020972610, + // -0.8703598457154336, -0.2254866845234647, 0.7002825787534324, + // 0.0892712008047818, 0.9241326299982451, 0.6615225744181676, + // 0.7351775340550828, -0.4044996673659886 + VLOAD_64(v1, 0x3fec9518a458e4ea, 0x3fe0c25010978504, 0xbfd7c958b04a2e10, + 0x3fec2e7ba402502e, 0x3fdb6d803f3895dc, 0xbfed6516b24524fa, + 0xbfd8ffe68378eb00, 0xbfebc848a4fdff0a, 0xbfebd9fce4232e3a, + 0xbfccdcbf67db1aa0, 0x3fe668b702b68b90, 0x3fb6da7a37ee6240, + 0x3fed927e97e0492a, 0x3fe52b3163d622de, 0x3fe786930930a7fe, + 0xbfd9e35292a51b70); + asm volatile("vfnmadd.vv v1, v2, v3"); + // -0.2560345624688988, 0.0042928888070631, -0.3081421208222118, + // -0.1849655060915788, 0.6669400726566582, -1.0960014534443465, + // 0.0082438467988533, -0.9980814245844917, 0.4544533558235209, + // 0.0664094087027049, 0.1672039722542752, -0.0149294340464271, + // -0.7485835961663959, 1.5864550162939111, -0.9895117344007368, + // 0.9524074697338700 + VCMP_U64(3, v1, 0xbfd062deca1cc612, 0x3f71956b9081d880, 0xbfd3b899badce50e, + 0xbfc7acf31fc694ed, 0x3fe55792b50e7883, 0xbff18938d1ee9749, + 0x3f80e22663278b8b, 0xbfeff04874aabc45, 0x3fdd15c38734723f, + 0x3fb10034fe865a4b, 0x3fc566f0944bf4a6, 0xbf8e9352b7d14aa9, + 0xbfe7f46595fb6a6d, 0x3ff9621ea7b8eb80, 0xbfefaa1483484d07, + 0x3fee7a1f3adf237b); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.7461, 0.0514, -0.3071, -0.4934, -0.5220, -0.7983, 0.4907, + // -0.9028, 0.1752, 0.0676, 0.1040, 0.4526, 0.3525, -0.2686, + // 0.3540, -0.0847 + VLOAD_16(v2, 0xb9f8, 0x2a94, 0xb4ea, 0xb7e5, 0xb82d, 0xba63, 0x37da, 0xbb39, + 0x319b, 0x2c54, 0x2ea8, 0x373e, 0x35a4, 0xb44c, 0x35aa, 0xad6c); + // 0.1573, -0.7700, 0.0804, -0.9438, 0.0790, 0.7998, -0.2854, + // 0.1963, -0.0687, -0.2123, 0.3625, -0.0002, 0.7168, -0.4033, + // 0.2812, -0.3159 + VLOAD_16(v3, 0x3109, 0xba29, 0x2d25, 0xbb8d, 0x2d0e, 0x3a66, 0xb491, 0x3248, + 0xac65, 0xb2cb, 0x35cd, 0x897c, 0x39bc, 0xb674, 0x3480, 0xb50e); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.0337, 0.2034, -0.1886, 0.8242, 0.3225, 0.0331, 0.0698, + // 0.6777, -0.2539, -0.5825, -0.4319, -0.6323, 0.0674, -0.2903, + // -0.8145, 0.1893 + VLOAD_16(v1, 0x284f, 0x3282, 0xb209, 0x3a98, 0x3529, 0x283b, 0x2c77, 0x396c, + 0xb410, 0xb8a9, 0xb6e9, 0xb90f, 0x2c50, 0xb4a5, 0xba84, 0x320f); + asm volatile("vfnmadd.vv v1, v2, v3, v0.t"); + // 0.0337, 0.7598, -0.1886, 1.3506, 0.3225, -0.7734, 0.0698, + // 0.4155, -0.2539, 0.2517, -0.4319, 0.2864, 0.0674, 0.3254, + // -0.8145, 0.3320 + VCMP_U16(4, v1, 0x284f, 0x3a14, 0xb209, 0x3d67, 0x3529, 0xba30, 0x2c77, + 0x36a6, 0xb410, 0x3407, 0xb6e9, 0x3495, 0x2c50, 0x3535, 0xba84, + 0x3550); + + VSET(16, e32, m1); + // -0.36820358, 0.10496315, -0.32905263, -0.92334682, + // 0.43153936, 0.92736709, -0.59600371, 0.75117606, 0.84123290, + // 0.33028743, -0.43412161, 0.95273590, 0.06816643, + // -0.88978988, 0.18573478, 0.61926919 + VLOAD_32(v2, 0xbebc852e, 0x3dd6f6ec, 0xbea87996, 0xbf6c6075, 0x3edcf2ba, + 0x3f6d67ee, 0xbf1893b3, 0x3f404d13, 0x3f575b0a, 0x3ea91b6f, + 0xbede4530, 0x3f73e680, 0x3d8b9ad8, 0xbf63c945, 0x3e3e3142, + 0x3f1e886d); + // 0.69083834, -0.31329882, -0.54809541, 0.25019145, + // -0.67489260, 0.23259214, -0.14038530, 0.09741956, + // -0.23567833, 0.75417399, -0.90357685, -0.87489468, + // 0.54726779, -0.06705534, -0.15476358, -0.96940458 + VLOAD_32(v3, 0x3f30dac8, 0xbea068b4, 0xbf0c4ffb, 0x3e801918, 0xbf2cc5c3, + 0x3e6e2ca2, 0xbe0fc12a, 0x3dc783e8, 0xbe7155a9, 0x3f41118c, + 0xbf6750d0, 0xbf5ff919, 0x3f0c19be, 0xbd895450, 0xbe1e7a58, + 0xbf782ae6); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.03722767, 0.80796093, 0.53925264, -0.50804031, + // 0.63562357, -0.45508829, -0.22051410, 0.42499006, + // -0.59229839, -0.50074077, -0.80474108, -0.20762257, + // 0.15367362, 0.98349953, -0.15871963, -0.07445616 + VLOAD_32(v1, 0x3d187c0a, 0x3f4ed687, 0x3f0a0c76, 0xbf020eee, 0x3f22b83a, + 0xbee90155, 0xbe61ce73, 0x3ed9984c, 0xbf17a0de, 0xbf00308c, + 0xbf4e0383, 0xbe549b03, 0x3e1d5c9e, 0x3f7bc6a0, 0xbe228766, + 0xbd987c79); + asm volatile("vfnmadd.vv v1, v2, v3, v0.t"); + // 0.03722767, 0.22849269, 0.53925264, -0.71928883, + // 0.63562357, 0.18944177, -0.22051410, -0.41666192, + // -0.59229839, -0.58878565, -0.80474108, 1.07270420, + // 0.15367362, 0.94216329, -0.15871963, 1.01551294 + VCMP_U32(5, v1, 0x3d187c0a, 0x3e69f9fd, 0x3f0a0c76, 0xbf382350, 0x3f22b83a, + 0x3e41fd06, 0xbe61ce73, 0xbed554b6, 0xbf17a0de, 0xbf16baa7, + 0xbf4e0383, 0x3f894e5f, 0x3e1d5c9e, 0x3f71319d, 0xbe228766, + 0x3f81fc54); + + VSET(16, e64, m1); + // -0.1517393950396491, -0.0976116299317518, 0.4195080955516000, + // -0.8346165642452430, 0.0078216057137750, -0.5126918345148062, + // -0.9302856586058497, -0.8971839537614414, 0.1317157676127678, + // -0.3423297874984121, 0.7678405723111816, -0.6465198020108864, + // 0.4795090517472360, -0.9006147069685106, 0.9841759200408695, + // 0.8437352562659637 + VLOAD_64(v2, 0xbfc36c324d9ae520, 0xbfb8fd1366442100, 0x3fdad9387bb34990, + 0xbfeab52dcc044330, 0x3f8004c625f16600, 0xbfe067f8b4c55ad2, + 0xbfedc4e66df4cc5a, 0xbfecb5bb1f7cd800, 0x3fc0dc0ff121d700, + 0xbfd5e8bb327025d8, 0x3fe892266453ca54, 0xbfe4b04a4bbb4d06, + 0x3fdeb046bbd8fb80, 0xbfecd1d5ef173e7a, 0x3fef7e5e7fc2c286, + 0x3feaffe114849fb0); + // 0.3915682245289982, 0.0468282563045201, 0.4640582663413180, + // 0.9199907734666593, -0.6702920875531786, 0.6250479001245852, + // -0.3716310293668668, 0.2191474803863191, + // -0.3398132406457823, -0.1436002174993440, + // -0.7049093483038609, 0.0726450331160087, 0.3054536350672581, + // -0.9906780567812383, 0.2659677084286980, -0.6111168392293305 + VLOAD_64(v3, 0x3fd90f742ba04f2c, 0x3fa7f9df8ab696e0, 0x3fddb3217157f678, + 0x3fed70907d95274a, 0xbfe573086459defe, 0x3fe40064742efe82, + 0xbfd7c8cd8353cefc, 0x3fcc0d064ea14910, 0xbfd5bf8008d49208, + 0xbfc2617deeedd880, 0xbfe68e9e0cb3831e, 0x3fb298dd69733960, + 0x3fd38c8d6743b96c, 0xbfefb3a277d7b020, 0x3fd1059d6c5f9294, + 0xbfe38e44e6d0cbb0); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.8932002267748917, 0.5237198185024288, -0.3716642114238491, + // 0.8806741908360942, 0.4285584084885536, -0.9185899240339090, + // -0.3906189235600976, -0.8681987020972610, + // -0.8703598457154336, -0.2254866845234647, 0.7002825787534324, + // 0.0892712008047818, 0.9241326299982451, 0.6615225744181676, + // 0.7351775340550828, -0.4044996673659886 + VLOAD_64(v1, 0x3fec9518a458e4ea, 0x3fe0c25010978504, 0xbfd7c958b04a2e10, + 0x3fec2e7ba402502e, 0x3fdb6d803f3895dc, 0xbfed6516b24524fa, + 0xbfd8ffe68378eb00, 0xbfebc848a4fdff0a, 0xbfebd9fce4232e3a, + 0xbfccdcbf67db1aa0, 0x3fe668b702b68b90, 0x3fb6da7a37ee6240, + 0x3fed927e97e0492a, 0x3fe52b3163d622de, 0x3fe786930930a7fe, + 0xbfd9e35292a51b70); + asm volatile("vfnmadd.vv v1, v2, v3, v0.t"); + // 0.8932002267748917, 0.0042928888070631, -0.3716642114238491, + // -0.1849655060915788, 0.4285584084885536, + // -1.0960014534443465, -0.3906189235600976, + // -0.9980814245844917, -0.8703598457154336, 0.0664094087027049, + // 0.7002825787534324, -0.0149294340464271, + // 0.9241326299982451, 1.5864550162939111, 0.7351775340550828, + // 0.9524074697338700 + VCMP_U64(6, v1, 0x3fec9518a458e4ea, 0x3f71956b9081d880, 0xbfd7c958b04a2e10, + 0xbfc7acf31fc694ed, 0x3fdb6d803f3895dc, 0xbff18938d1ee9749, + 0xbfd8ffe68378eb00, 0xbfeff04874aabc45, 0xbfebd9fce4232e3a, + 0x3fb10034fe865a4b, 0x3fe668b702b68b90, 0xbf8e9352b7d14aa9, + 0x3fed927e97e0492a, 0x3ff9621ea7b8eb80, 0x3fe786930930a7fe, + 0x3fee7a1f3adf237b); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.2646 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x343c); + // 0.4216, -0.2148, 0.0047, 0.6802, -0.8965, -0.2986, -0.1786, + // -0.1904, 0.2805, 0.5322, -0.5298, 0.3208, 0.0567, + // -0.9897, -0.5400, -0.4187 + VLOAD_16(v2, 0x36bf, 0xb2e0, 0x1cc3, 0x3971, 0xbb2c, 0xb4c7, 0xb1b7, 0xb218, + 0x347d, 0x3842, 0xb83d, 0x3522, 0x2b41, 0xbbeb, 0xb852, 0xb6b3); + // -0.7886, -0.5435, -0.8345, 0.7793, 0.5796, -0.8374, -0.8623, + // -0.3313, -0.2690, -0.9214, 0.2126, -0.6772, -0.6514, -0.5703, + // -0.2585, -0.3320 + VLOAD_16(v1, 0xba4f, 0xb859, 0xbaad, 0x3a3c, 0x38a3, 0xbab3, 0xbae6, 0xb54d, + 0xb44e, 0xbb5f, 0x32ce, 0xb96b, 0xb936, 0xb890, 0xb423, 0xb550); + asm volatile("vfnmadd.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.2129, 0.3586, 0.2162, -0.8867, 0.7432, 0.5200, 0.4067, + // 0.2781, -0.2092, -0.2883, 0.4736, -0.1416, 0.1157, 1.1406, + // 0.6084, 0.5068 + VCMP_U16(7, v1, 0xb2d0, 0x35bd, 0x32eb, 0xbb17, 0x39f2, 0x3829, 0x3682, + 0x3473, 0xb2b3, 0xb49d, 0x3793, 0xb088, 0x2f68, 0x3c90, 0x38de, + 0x380d); + + VSET(16, e32, m1); + double dscalar_32; + // -0.13809182 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe0d67f1); + // -0.16977388, -0.30800357, -0.37010264, -0.92290556, + // 0.55768263, 0.47349435, 0.77556002, 0.16363664, 0.80314618, + // -0.48171839, -0.60694915, 0.16937894, 0.86316317, + // 0.00897404, -0.96310323, -0.27890080 + VLOAD_32(v2, 0xbe2dd934, 0xbe9db2a5, 0xbebd7e18, 0xbf6c438a, 0x3f0ec44a, + 0x3ef26dda, 0x3f468b1a, 0x3e27905d, 0x3f4d9afd, 0xbef6a3cb, + 0xbf1b6105, 0x3e2d71ac, 0x3f5cf843, 0x3c1307df, 0xbf768def, + 0xbe8ecc16); + // -0.33133313, -0.48972869, 0.95656961, -0.89211702, + // 0.72045243, -0.36672497, 0.69402671, 0.44954479, + // -0.77024877, -0.83221292, 0.37576449, -0.77536738, + // -0.55040795, -0.71568310, -0.75874990, 0.91956782 + VLOAD_32(v1, 0xbea9a47f, 0xbefabdb8, 0x3f74e1bf, 0xbf6461c8, 0x3f386f92, + 0xbebbc360, 0x3f31abbc, 0x3ee62abc, 0xbf452f06, 0xbf550be8, + 0x3ec06434, 0xbf467e7a, 0xbf0ce789, 0xbf373702, 0xbf423d6f, + 0x3f6b68cc); + asm volatile("vfnmadd.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // 0.12401948, 0.24037606, 0.50219709, 0.79971153, + // -0.45819405, -0.52413607, -0.67972064, -0.10155818, + // -0.90951121, 0.36679661, 0.65883917, -0.27645081, + // -0.93917000, -0.10780402, 0.85832608, 0.40588558 + VCMP_U32(8, v1, 0x3dfdfded, 0x3e762524, 0x3f008ffd, 0x3f4cb9e5, 0xbeea9869, + 0xbf062dc8, 0xbf2e022c, 0xbdcffdbd, 0xbf68d5ba, 0x3ebbccc3, + 0x3f28a9af, 0xbe8d8af6, 0xbf706d72, 0xbddcc85b, 0x3f5bbb42, + 0x3ecfd03d); + + VSET(16, e64, m1); + double dscalar_64; + // 0.8978909040536565 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fecbb85b489299a); + // 0.4119623576675431, -0.1190899643735133, 0.9903323592718865, + // 0.5311038519754858, 0.1686986553141236, + // -0.8788301781199843, 0.1880579223718752, + // 0.7610824660598337, -0.0872931389118274, + // -0.6855627317033812, -0.0181686933036735, + // -0.9796673648941667, 0.2148282430178909, + // -0.1529278220414154, -0.7708574130314993, + // -0.4104905538508556 + VLOAD_64(v2, 0x3fda5d975d575ea8, 0xbfbe7cae0e441b80, 0x3fefb0cd7ce7c8e8, + 0x3fe0fecd81607572, 0x3fc597eae3ba06f8, 0xbfec1f6077386c08, + 0x3fc81248312ba2f8, 0x3fe85ac99da9270a, 0xbfb658d7d8ca9eb0, + 0xbfe5f0214100b7de, 0xbf929ad05e338a40, 0xbfef596f5fa5b9ea, + 0x3fcb7f7deb026e00, 0xbfc393238d287f60, 0xbfe8aadd2a5b2eba, + 0xbfda457a2c06ce78); + // 0.5050016609492949, 0.8257750946258060, + // -0.2631016891694440, 0.8041841986447893, + // -0.0322547653971421, -0.3994438840519345, + // -0.6154540433263920, -0.9209485498858390, + // 0.3334000822950238, -0.6004917796663505, 0.4588428764280068, + // 0.8937156106780619, 0.8421999503441004, 0.3083609158934253, + // -0.2219824502919918, 0.5118870280625194 + VLOAD_64(v1, 0x3fe028f93e467e2c, 0x3fea6cbfe4289cd0, 0xbfd0d6a877a053e0, + 0x3fe9bbe080247574, 0xbfa083b2550ab080, 0xbfd9907d14a5c710, + 0xbfe3b1ccad88e3e8, 0xbfed786917e1dd9e, 0x3fd5566d4c7c36a8, + 0xbfe3373a8965e1cc, 0x3fdd5dae8310b1e8, 0x3fec99517af92ea6, + 0x3feaf34d4f6d76aa, 0x3fd3bc2f6c481e9c, 0xbfcc69ebc2252060, + 0x3fe06160e798ce12); + asm volatile("vfnmadd.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // -0.8653987555659035, -0.6223659818850454, -0.7540957457254903, + // -1.2531735291223209, -0.1397373948516451, 1.2374872082900796, + // 0.3645526649939371, 0.0658288599840662, + // -0.2120637623916150, 1.2247388386247897, -0.3938221518308497, + // 0.1772082472555760, -0.9710319178262998, -0.1239466395049457, + // 0.9701734360082217, -0.0491281525495393 + VCMP_U64(9, v1, 0xbfebb158bb24f2ec, 0xbfe3ea6c104adab7, 0xbfe8218d66be32e5, + 0xbff40cffafbcb13e, 0xbfc1e2ea3a754147, 0x3ff3ccbf630d300f, + 0x3fd754d4b3746402, 0x3fb0da2900c3b814, 0xbfcb24e7c611c0f4, + 0x3ff39887c0a08d49, 0xbfd93461d3a37236, 0x3fc6aec28545a7b7, + 0xbfef12b1874df4ac, 0xbfbfbaf78b1f72ad, 0x3fef0ba929634dea, + 0xbfa927534106be44); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.2646 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x343c); + // 0.4216, -0.2148, 0.0047, 0.6802, -0.8965, -0.2986, + // -0.1786, -0.1904, 0.2805, 0.5322, -0.5298, 0.3208, + // 0.0567, -0.9897, -0.5400, -0.4187 + VLOAD_16(v2, 0x36bf, 0xb2e0, 0x1cc3, 0x3971, 0xbb2c, 0xb4c7, 0xb1b7, 0xb218, + 0x347d, 0x3842, 0xb83d, 0x3522, 0x2b41, 0xbbeb, 0xb852, 0xb6b3); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.7886, -0.5435, -0.8345, 0.7793, 0.5796, -0.8374, + // -0.8623, -0.3313, -0.2690, -0.9214, 0.2126, -0.6772, + // -0.6514, -0.5703, -0.2585, -0.3320 + VLOAD_16(v1, 0xba4f, 0xb859, 0xbaad, 0x3a3c, 0x38a3, 0xbab3, 0xbae6, 0xb54d, + 0xb44e, 0xbb5f, 0x32ce, 0xb96b, 0xb936, 0xb890, 0xb423, 0xb550); + asm volatile("vfnmadd.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // -0.7886, 0.3586, -0.8345, -0.8867, 0.5796, 0.5200, + // -0.8623, 0.2781, -0.2690, -0.2883, 0.2126, -0.1416, + // -0.6514, 1.1406, -0.2585, 0.5068 + VCMP_U16(10, v1, 0xba4f, 0x35bd, 0xbaad, 0xbb17, 0x38a3, 0x3829, 0xbae6, + 0x3473, 0xb44e, 0xb49d, 0x32ce, 0xb088, 0xb936, 0x3c90, 0xb423, + 0x380d); + + VSET(16, e32, m1); + double dscalar_32; + // -0.13809182 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe0d67f1); + // -0.16977388, -0.30800357, -0.37010264, -0.92290556, + // 0.55768263, 0.47349435, 0.77556002, 0.16363664, + // 0.80314618, -0.48171839, -0.60694915, 0.16937894, + // 0.86316317, 0.00897404, -0.96310323, -0.27890080 + VLOAD_32(v2, 0xbe2dd934, 0xbe9db2a5, 0xbebd7e18, 0xbf6c438a, 0x3f0ec44a, + 0x3ef26dda, 0x3f468b1a, 0x3e27905d, 0x3f4d9afd, 0xbef6a3cb, + 0xbf1b6105, 0x3e2d71ac, 0x3f5cf843, 0x3c1307df, 0xbf768def, + 0xbe8ecc16); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.33133313, -0.48972869, 0.95656961, -0.89211702, + // 0.72045243, -0.36672497, 0.69402671, 0.44954479, + // -0.77024877, -0.83221292, 0.37576449, -0.77536738, + // -0.55040795, -0.71568310, -0.75874990, 0.91956782 + VLOAD_32(v1, 0xbea9a47f, 0xbefabdb8, 0x3f74e1bf, 0xbf6461c8, 0x3f386f92, + 0xbebbc360, 0x3f31abbc, 0x3ee62abc, 0xbf452f06, 0xbf550be8, + 0x3ec06434, 0xbf467e7a, 0xbf0ce789, 0xbf373702, 0xbf423d6f, + 0x3f6b68cc); + asm volatile("vfnmadd.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // -0.33133313, 0.24037606, 0.95656961, 0.79971153, + // 0.72045243, -0.52413607, 0.69402671, -0.10155818, + // -0.77024877, 0.36679661, 0.37576449, -0.27645081, + // -0.55040795, -0.10780402, -0.75874990, 0.40588558 + VCMP_U32(11, v1, 0xbea9a47f, 0x3e762524, 0x3f74e1bf, 0x3f4cb9e5, 0x3f386f92, + 0xbf062dc8, 0x3f31abbc, 0xbdcffdbd, 0xbf452f06, 0x3ebbccc3, + 0x3ec06434, 0xbe8d8af6, 0xbf0ce789, 0xbddcc85b, 0xbf423d6f, + 0x3ecfd03d); + + VSET(16, e64, m1); + double dscalar_64; + // 0.8978909040536565 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fecbb85b489299a); + // 0.4119623576675431, -0.1190899643735133, + // 0.9903323592718865, 0.5311038519754858, + // 0.1686986553141236, -0.8788301781199843, + // 0.1880579223718752, 0.7610824660598337, + // -0.0872931389118274, -0.6855627317033812, + // -0.0181686933036735, -0.9796673648941667, + // 0.2148282430178909, -0.1529278220414154, + // -0.7708574130314993, -0.4104905538508556 + VLOAD_64(v2, 0x3fda5d975d575ea8, 0xbfbe7cae0e441b80, 0x3fefb0cd7ce7c8e8, + 0x3fe0fecd81607572, 0x3fc597eae3ba06f8, 0xbfec1f6077386c08, + 0x3fc81248312ba2f8, 0x3fe85ac99da9270a, 0xbfb658d7d8ca9eb0, + 0xbfe5f0214100b7de, 0xbf929ad05e338a40, 0xbfef596f5fa5b9ea, + 0x3fcb7f7deb026e00, 0xbfc393238d287f60, 0xbfe8aadd2a5b2eba, + 0xbfda457a2c06ce78); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.5050016609492949, 0.8257750946258060, + // -0.2631016891694440, 0.8041841986447893, + // -0.0322547653971421, -0.3994438840519345, + // -0.6154540433263920, -0.9209485498858390, + // 0.3334000822950238, -0.6004917796663505, + // 0.4588428764280068, 0.8937156106780619, + // 0.8421999503441004, 0.3083609158934253, + // -0.2219824502919918, 0.5118870280625194 + VLOAD_64(v1, 0x3fe028f93e467e2c, 0x3fea6cbfe4289cd0, 0xbfd0d6a877a053e0, + 0x3fe9bbe080247574, 0xbfa083b2550ab080, 0xbfd9907d14a5c710, + 0xbfe3b1ccad88e3e8, 0xbfed786917e1dd9e, 0x3fd5566d4c7c36a8, + 0xbfe3373a8965e1cc, 0x3fdd5dae8310b1e8, 0x3fec99517af92ea6, + 0x3feaf34d4f6d76aa, 0x3fd3bc2f6c481e9c, 0xbfcc69ebc2252060, + 0x3fe06160e798ce12); + asm volatile("vfnmadd.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + // 0.5050016609492949, -0.6223659818850454, + // -0.2631016891694440, -1.2531735291223209, + // -0.0322547653971421, 1.2374872082900796, + // -0.6154540433263920, 0.0658288599840662, + // 0.3334000822950238, 1.2247388386247897, 0.4588428764280068, + // 0.1772082472555760, 0.8421999503441004, + // -0.1239466395049457, -0.2219824502919918, + // -0.0491281525495393 + VCMP_U64(12, v1, 0x3fe028f93e467e2c, 0xbfe3ea6c104adab7, 0xbfd0d6a877a053e0, + 0xbff40cffafbcb13e, 0xbfa083b2550ab080, 0x3ff3ccbf630d300f, + 0xbfe3b1ccad88e3e8, 0x3fb0da2900c3b814, 0x3fd5566d4c7c36a8, + 0x3ff39887c0a08d49, 0x3fdd5dae8310b1e8, 0x3fc6aec28545a7b7, + 0x3feaf34d4f6d76aa, 0xbfbfbaf78b1f72ad, 0xbfcc69ebc2252060, + 0xbfa927534106be44); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfnmsac.c b/apps/riscv-tests/isa/rv64uv/vfnmsac.c new file mode 100644 index 0000000..7db965a --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfnmsac.c @@ -0,0 +1,455 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.3474, -0.9888, 0.2810, 0.4199, 0.1704, -0.3772, 0.2998, + // 0.7871, -0.2527, -0.8618, 0.2646, 0.5488, -0.3184, -0.3508, + // -0.3589, -0.3914 + VLOAD_16(v2, 0x358f, 0xbbe9, 0x347f, 0x36b8, 0x3174, 0xb609, 0x34cc, 0x3a4c, + 0xb40b, 0xbae5, 0x343c, 0x3864, 0xb518, 0xb59d, 0xb5be, 0xb643); + // 0.0417, 0.3862, -0.9619, -0.5659, 0.1731, 0.4827, 0.7334, + // -0.7271, -0.9814, 0.8003, -0.4836, 0.5234, -0.8540, + // -0.2036, -0.8823, 0.2603 + VLOAD_16(v3, 0x2958, 0x362e, 0xbbb2, 0xb887, 0x318a, 0x37b9, 0x39de, 0xb9d1, + 0xbbda, 0x3a67, 0xb7bd, 0x3830, 0xbad5, 0xb284, 0xbb0f, 0x342a); + // -0.2739, 0.2146, 0.5264, -0.8853, 0.8877, -0.6748, -0.7563, + // -0.9634, 0.7451, -0.5166, 0.0698, 0.4790, -0.0681, -0.9746, + // 0.2129, 0.9072 + VLOAD_16(v1, 0xb462, 0x32de, 0x3836, 0xbb15, 0x3b1a, 0xb966, 0xba0d, 0xbbb5, + 0x39f6, 0xb822, 0x2c77, 0x37aa, 0xac5b, 0xbbcc, 0x32d0, 0x3b42); + asm volatile("vfnmsac.vv v1, v2, v3"); + // -0.2883, 0.5967, 0.7969, -0.6475, 0.8584, -0.4927, -0.9761, + // -0.3911, 0.4971, 0.1733, 0.1978, 0.1917, -0.3401, -1.0459, + // -0.1038, 1.0088 + VCMP_U16(1, v1, 0xb49d, 0x38c6, 0x3a60, 0xb92e, 0x3ade, 0xb7e2, 0xbbcf, + 0xb642, 0x37f4, 0x318a, 0x3254, 0x3223, 0xb570, 0xbc2f, 0xaea4, + 0x3c09); + + VSET(16, e32, m1); + // 0.11577118, -0.10074481, 0.13861528, 0.44782066, + // 0.42196107, -0.67597556, 0.34948668, -0.87903690, + // -0.34136006, -0.19722189, 0.76997000, -0.68663412, + // 0.45603558, 0.60629857, -0.86984915, -0.08019307 + VLOAD_32(v2, 0x3ded1971, 0xbdce534c, 0x3e0df12a, 0x3ee548c0, 0x3ed80b48, + 0xbf2d0cbc, 0x3eb2efeb, 0xbf610890, 0xbeaec6bf, 0xbe49f489, + 0x3f451cc1, 0xbf2fc741, 0x3ee97d7f, 0x3f1b3662, 0xbf5eae6f, + 0xbda43c43); + // -0.38970658, 0.40460527, 0.69067985, -0.98108912, + // 0.47494572, -0.34277225, -0.54462087, -0.90492284, 0.60100728, + // -0.02819708, -0.46859986, 0.87238866, 0.46812481, + // 0.49922746, 0.97036403, 0.04279163 + VLOAD_32(v3, 0xbec7879f, 0x3ecf286c, 0x3f30d065, 0xbf7b28a8, 0x3ef32c16, + 0xbeaf7fd8, 0xbf0b6c46, 0xbf67a906, 0x3f19db9d, 0xbce6fd92, + 0xbeefec52, 0x3f5f54dd, 0x3eefae0e, 0x3eff9abe, 0x3f7869c7, + 0x3d2f4647); + // 0.79804420, -0.70010293, -0.51047552, 0.38566175, + // 0.15318950, 0.15531392, -0.20705318, -0.82493448, + // 0.12047531, 0.57526720, 0.23939800, -0.19725421, + // 0.15403098, 0.03931713, -0.45930895, -0.15395784 + VLOAD_32(v1, 0x3f4c4ca0, 0xbf3339f2, 0xbf02ae86, 0x3ec57575, 0x3e1cddb5, + 0x3e1f0a9d, 0xbe5405c0, 0xbf532ee8, 0x3df6bbc3, 0x3f1344b6, + 0x3e7524c0, 0xbe49fd02, 0x3e1dba4c, 0x3d210b00, 0xbeeb2a8b, + 0xbe1da720); + asm volatile("vfnmsac.vv v1, v2, v3"); + // 0.84316099, -0.65934104, -0.60621428, 0.82501376, + // -0.04721911, -0.07639174, -0.01671545, -1.62039506, + // 0.32563519, 0.56970614, 0.60020584, 0.40175763, + // -0.05945060, -0.26336378, 0.38476136, -0.15052626 + VCMP_U32(2, v1, 0x3f57d966, 0xbf28ca93, 0xbf1b30dc, 0x3f53341a, 0xbd4168d3, + 0xbd9c7345, 0xbc88eed4, 0xbfcf691b, 0x3ea6b9a8, 0x3f11d843, + 0x3f19a717, 0x3ecdb32c, 0xbd738277, 0xbe86d79e, 0x3ec4ff71, + 0xbe1a238e); + + VSET(16, e64, m1); + // -0.1779684802061718, 0.1122733699429854, -0.0166033088608786, + // -0.0418350503858864, 0.0809510021720363, -0.9993917101510512, + // -0.2139048161619248, 0.7196716914796224, 0.6489783595942558, + // 0.5950689618839839, -0.7376256302221853, -0.5442228345597713, + // -0.8234113806545975, -0.6424001059348645, -0.3817524674245201, + // -0.8801262923106541 + VLOAD_64(v2, 0xbfc6c7abd11a2788, 0x3fbcbdf2941de8b0, 0xbf91007532405e80, + 0xbfa56b675a77c100, 0x3fb4b93472e84630, 0xbfeffb0452dfc0ba, + 0xbfcb613ba6efa978, 0x3fe7078ced586224, 0x3fe4c46e43c89c1c, + 0x3fe30ace10450114, 0xbfe79aa110cfdc92, 0xbfe16a46018575da, + 0xbfea5962d2e21a3e, 0xbfe48e8aaabdfd5e, 0xbfd86ea1e6b05c10, + 0xbfec29fe9d3a5e2c); + // 0.6809772463364707, -0.3512739833826983, -0.3746023351803702, + // -0.7912172181005324, 0.8292434726428350, 0.4103374079106952, + // -0.0850673796598582, -0.5834949864830523, + // -0.9215678788036654, 0.4412210589054084, 0.3537359089001260, + // -0.4889461402031243, 0.2341577339668230, 0.0593866008892341, + // -0.4825773777931026, 0.8989772522533539 + VLOAD_64(v3, 0x3fe5ca90cb4aba98, 0xbfd67b45dfa41e18, 0xbfd7f97c12a6b704, + 0xbfe951a6c578c3ac, 0x3fea89299b6d84b0, 0x3fda42f7d4d35178, + 0xbfb5c6f9cd987320, 0xbfe2abfdad8a63b6, 0xbfed7d7beb902fcc, + 0x3fdc3cf7409388b4, 0x3fd6a39bf009666c, 0xbfdf4ae4c06b61e4, + 0x3fcdf8e170bf19c0, 0x3fae67eba9479c60, 0xbfdee28c39da4ac0, + 0x3fecc46bf148d5ca); + // 0.2213384305747967, -0.6962211546566610, -0.0896076892809434, + // -0.1334142611967066, 0.1988436916560323, + // -0.3391391007320459, -0.6137202819751713, 0.6759552396290200, + // -0.7798663937316326, -0.1025181838739857, 0.5296250728149803, + // 0.8832422045338422, 0.8373555508937671, -0.8622529212135799, + // 0.4241832213372883, 0.7769982087360683 + VLOAD_64(v1, 0x3fcc54d154555708, 0xbfe6477196411436, 0xbfb6f0878eee8940, + 0xbfc113b7f0547630, 0x3fc973b5c856db48, 0xbfd5b4747c9c185c, + 0xbfe3a398b77f3552, 0x3fe5a16ce1f8870a, 0xbfe8f4aa5e0a7552, + 0xbfba3ea1b6fbece0, 0x3fe0f2b047dc3902, 0x3fec438527dd6ef6, + 0x3feacb9dde46cf34, 0xbfeb9793702fc4f0, 0x3fdb25d161c9f510, + 0x3fe8dd2b58f24dc8); + asm volatile("vfnmsac.vv v1, v2, v3"); + // 0.3425309161602823, -0.6567824407689892, -0.0958273275519495, + // -0.1665148733821233, 0.1317156015009752, 0.0709487030987733, + // -0.6319166041826899, 1.0958800635211576, + // -0.1817887834908719, -0.3650751413581792, 0.7905497455496533, + // 0.6171465501654385, 1.0301636939103409, -0.8241029625112244, + // 0.2399581166415165, 1.5682117246334322 + VCMP_U64(3, v1, 0x3fd5ec06cab1bfc9, 0xbfe5045c9bf61361, 0xbfb88823c5e61162, + 0xbfc5505bffbca57e, 0x3fc0dc0e8c68ea87, 0x3fb229b1b780ba72, + 0xbfe438a92b9872ef, 0x3ff188b9889296a1, 0xbfc744dad7efbbd3, + 0xbfd75d64202dd23c, 0x3fe94c2efadfe675, 0x3fe3bfaa1f3997d0, + 0x3ff07b8cecedf189, 0xbfea5f0d2d10b7b0, 0x3fceb6f293b149df, + 0x3ff917652d6811d0); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.3474, -0.9888, 0.2810, 0.4199, 0.1704, -0.3772, 0.2998, + // 0.7871, -0.2527, -0.8618, 0.2646, 0.5488, -0.3184, -0.3508, + // -0.3589, -0.3914 + VLOAD_16(v2, 0x358f, 0xbbe9, 0x347f, 0x36b8, 0x3174, 0xb609, 0x34cc, 0x3a4c, + 0xb40b, 0xbae5, 0x343c, 0x3864, 0xb518, 0xb59d, 0xb5be, 0xb643); + // 0.0417, 0.3862, -0.9619, -0.5659, 0.1731, 0.4827, 0.7334, + // -0.7271, -0.9814, 0.8003, -0.4836, 0.5234, -0.8540, + // -0.2036, -0.8823, 0.2603 + VLOAD_16(v3, 0x2958, 0x362e, 0xbbb2, 0xb887, 0x318a, 0x37b9, 0x39de, 0xb9d1, + 0xbbda, 0x3a67, 0xb7bd, 0x3830, 0xbad5, 0xb284, 0xbb0f, 0x342a); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.2739, 0.2146, 0.5264, -0.8853, 0.8877, -0.6748, -0.7563, + // -0.9634, 0.7451, -0.5166, 0.0698, 0.4790, -0.0681, -0.9746, + // 0.2129, 0.9072 + VLOAD_16(v1, 0xb462, 0x32de, 0x3836, 0xbb15, 0x3b1a, 0xb966, 0xba0d, 0xbbb5, + 0x39f6, 0xb822, 0x2c77, 0x37aa, 0xac5b, 0xbbcc, 0x32d0, 0x3b42); + asm volatile("vfnmsac.vv v1, v2, v3, v0.t"); + // -0.2739, 0.5967, 0.5264, -0.6475, 0.8877, -0.4927, -0.7563, + // -0.3911, 0.7451, 0.1733, 0.0698, 0.1917, -0.0681, -1.0459, + // 0.2129, 1.0088 + VCMP_U16(4, v1, 0xb462, 0x38c6, 0x3836, 0xb92e, 0x3b1a, 0xb7e2, 0xba0d, + 0xb642, 0x39f6, 0x318a, 0x2c77, 0x3223, 0xac5b, 0xbc2f, 0x32d0, + 0x3c09); + + VSET(16, e32, m1); + // 0.11577118, -0.10074481, 0.13861528, 0.44782066, + // 0.42196107, -0.67597556, 0.34948668, -0.87903690, + // -0.34136006, -0.19722189, 0.76997000, -0.68663412, + // 0.45603558, 0.60629857, -0.86984915, -0.08019307 + VLOAD_32(v2, 0x3ded1971, 0xbdce534c, 0x3e0df12a, 0x3ee548c0, 0x3ed80b48, + 0xbf2d0cbc, 0x3eb2efeb, 0xbf610890, 0xbeaec6bf, 0xbe49f489, + 0x3f451cc1, 0xbf2fc741, 0x3ee97d7f, 0x3f1b3662, 0xbf5eae6f, + 0xbda43c43); + // -0.38970658, 0.40460527, 0.69067985, -0.98108912, + // 0.47494572, -0.34277225, -0.54462087, -0.90492284, 0.60100728, + // -0.02819708, -0.46859986, 0.87238866, 0.46812481, + // 0.49922746, 0.97036403, 0.04279163 + VLOAD_32(v3, 0xbec7879f, 0x3ecf286c, 0x3f30d065, 0xbf7b28a8, 0x3ef32c16, + 0xbeaf7fd8, 0xbf0b6c46, 0xbf67a906, 0x3f19db9d, 0xbce6fd92, + 0xbeefec52, 0x3f5f54dd, 0x3eefae0e, 0x3eff9abe, 0x3f7869c7, + 0x3d2f4647); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.79804420, -0.70010293, -0.51047552, 0.38566175, + // 0.15318950, 0.15531392, -0.20705318, -0.82493448, + // 0.12047531, 0.57526720, 0.23939800, -0.19725421, + // 0.15403098, 0.03931713, -0.45930895, -0.15395784 + VLOAD_32(v1, 0x3f4c4ca0, 0xbf3339f2, 0xbf02ae86, 0x3ec57575, 0x3e1cddb5, + 0x3e1f0a9d, 0xbe5405c0, 0xbf532ee8, 0x3df6bbc3, 0x3f1344b6, + 0x3e7524c0, 0xbe49fd02, 0x3e1dba4c, 0x3d210b00, 0xbeeb2a8b, + 0xbe1da720); + asm volatile("vfnmsac.vv v1, v2, v3, v0.t"); + // 0.79804420, -0.65934104, -0.51047552, 0.82501376, + // 0.15318950, -0.07639174, -0.20705318, -1.62039506, + // 0.12047531, 0.56970614, 0.23939800, 0.40175763, + // 0.15403098, -0.26336378, -0.45930895, -0.15052626 + VCMP_U32(5, v1, 0x3f4c4ca0, 0xbf28ca93, 0xbf02ae86, 0x3f53341a, 0x3e1cddb5, + 0xbd9c7345, 0xbe5405c0, 0xbfcf691b, 0x3df6bbc3, 0x3f11d843, + 0x3e7524c0, 0x3ecdb32c, 0x3e1dba4c, 0xbe86d79e, 0xbeeb2a8b, + 0xbe1a238e); + + VSET(16, e64, m1); + // -0.1779684802061718, 0.1122733699429854, -0.0166033088608786, + // -0.0418350503858864, 0.0809510021720363, -0.9993917101510512, + // -0.2139048161619248, 0.7196716914796224, 0.6489783595942558, + // 0.5950689618839839, -0.7376256302221853, -0.5442228345597713, + // -0.8234113806545975, -0.6424001059348645, -0.3817524674245201, + // -0.8801262923106541 + VLOAD_64(v2, 0xbfc6c7abd11a2788, 0x3fbcbdf2941de8b0, 0xbf91007532405e80, + 0xbfa56b675a77c100, 0x3fb4b93472e84630, 0xbfeffb0452dfc0ba, + 0xbfcb613ba6efa978, 0x3fe7078ced586224, 0x3fe4c46e43c89c1c, + 0x3fe30ace10450114, 0xbfe79aa110cfdc92, 0xbfe16a46018575da, + 0xbfea5962d2e21a3e, 0xbfe48e8aaabdfd5e, 0xbfd86ea1e6b05c10, + 0xbfec29fe9d3a5e2c); + // 0.6809772463364707, -0.3512739833826983, -0.3746023351803702, + // -0.7912172181005324, 0.8292434726428350, 0.4103374079106952, + // -0.0850673796598582, -0.5834949864830523, + // -0.9215678788036654, 0.4412210589054084, 0.3537359089001260, + // -0.4889461402031243, 0.2341577339668230, 0.0593866008892341, + // -0.4825773777931026, 0.8989772522533539 + VLOAD_64(v3, 0x3fe5ca90cb4aba98, 0xbfd67b45dfa41e18, 0xbfd7f97c12a6b704, + 0xbfe951a6c578c3ac, 0x3fea89299b6d84b0, 0x3fda42f7d4d35178, + 0xbfb5c6f9cd987320, 0xbfe2abfdad8a63b6, 0xbfed7d7beb902fcc, + 0x3fdc3cf7409388b4, 0x3fd6a39bf009666c, 0xbfdf4ae4c06b61e4, + 0x3fcdf8e170bf19c0, 0x3fae67eba9479c60, 0xbfdee28c39da4ac0, + 0x3fecc46bf148d5ca); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.2213384305747967, -0.6962211546566610, -0.0896076892809434, + // -0.1334142611967066, 0.1988436916560323, + // -0.3391391007320459, -0.6137202819751713, 0.6759552396290200, + // -0.7798663937316326, -0.1025181838739857, 0.5296250728149803, + // 0.8832422045338422, 0.8373555508937671, -0.8622529212135799, + // 0.4241832213372883, 0.7769982087360683 + VLOAD_64(v1, 0x3fcc54d154555708, 0xbfe6477196411436, 0xbfb6f0878eee8940, + 0xbfc113b7f0547630, 0x3fc973b5c856db48, 0xbfd5b4747c9c185c, + 0xbfe3a398b77f3552, 0x3fe5a16ce1f8870a, 0xbfe8f4aa5e0a7552, + 0xbfba3ea1b6fbece0, 0x3fe0f2b047dc3902, 0x3fec438527dd6ef6, + 0x3feacb9dde46cf34, 0xbfeb9793702fc4f0, 0x3fdb25d161c9f510, + 0x3fe8dd2b58f24dc8); + asm volatile("vfnmsac.vv v1, v2, v3, v0.t"); + // 0.2213384305747967, -0.6567824407689892, -0.0896076892809434, + // -0.1665148733821233, 0.1988436916560323, 0.0709487030987733, + // -0.6137202819751713, 1.0958800635211576, + // -0.7798663937316326, -0.3650751413581792, 0.5296250728149803, + // 0.6171465501654385, 0.8373555508937671, -0.8241029625112244, + // 0.4241832213372883, 1.5682117246334322 + VCMP_U64(6, v1, 0x3fcc54d154555708, 0xbfe5045c9bf61361, 0xbfb6f0878eee8940, + 0xbfc5505bffbca57e, 0x3fc973b5c856db48, 0x3fb229b1b780ba72, + 0xbfe3a398b77f3552, 0x3ff188b9889296a1, 0xbfe8f4aa5e0a7552, + 0xbfd75d64202dd23c, 0x3fe0f2b047dc3902, 0x3fe3bfaa1f3997d0, + 0x3feacb9dde46cf34, 0xbfea5f0d2d10b7b0, 0x3fdb25d161c9f510, + 0x3ff917652d6811d0); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.4771 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb7a2); + // -0.6172, 0.8584, -0.1088, -0.6719, 0.3579, 0.5889, 0.1724, + // -0.5239, -0.5732, -0.6167, 0.8271, -0.7334, 0.3489, -0.7607, + // -0.7788, -0.5264 + VLOAD_16(v2, 0xb8f0, 0x3ade, 0xaef7, 0xb960, 0x35ba, 0x38b6, 0x3184, 0xb831, + 0xb896, 0xb8ef, 0x3a9e, 0xb9de, 0x3595, 0xba16, 0xba3b, 0xb836); + // 0.0186, 0.9351, 0.6201, 0.9463, 0.2512, 0.5786, 0.9424, + // -0.5132, -0.7646, 0.0194, -0.2507, -0.2905, 0.3452, + // -0.7803, -0.7666, -0.1387 + VLOAD_16(v1, 0x24c1, 0x3b7b, 0x38f6, 0x3b92, 0x3405, 0x38a1, 0x3b8a, 0xb81b, + 0xba1e, 0x24f6, 0xb403, 0xb4a6, 0x3586, 0xba3e, 0xba22, 0xb070); + asm volatile("vfnmsac.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.2759, 1.3447, 0.5684, 0.6260, 0.4219, 0.8594, 1.0244, + // -0.7632, -1.0381, -0.2749, 0.1438, -0.6406, 0.5117, -1.1426, + // -1.1387, -0.3899 + VCMP_U16(7, v1, 0xb46a, 0x3d61, 0x388c, 0x3902, 0x36c0, 0x3ae0, 0x3c19, + 0xba1b, 0xbc27, 0xb466, 0x309a, 0xb920, 0x3818, 0xbc93, 0xbc8d, + 0xb63d); + + VSET(16, e32, m1); + double dscalar_32; + // -0.73549986 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf3c49b8); + // 0.74252719, 0.73023552, 0.75118375, 0.04020444, + // -0.77184784, -0.41120139, -0.57577437, -0.15976480, + // -0.05041125, 0.42673740, 0.88473374, -0.49891368, + // -0.84324479, -0.26009968, -0.01877740, -0.13754985 + VLOAD_32(v2, 0x3f3e1643, 0x3f3af0b7, 0x3f404d94, 0x3d24ad6a, 0xbf4597d2, + 0xbed288fd, 0xbf1365f3, 0xbe239962, 0xbd4e7c07, 0x3eda7d53, + 0x3f627de9, 0xbeff719d, 0xbf57dee4, 0xbe852bc9, 0xbc99d30f, + 0xbe0cd9de); + // 0.89538908, 0.68592542, 0.67501348, 0.08327232, + // 0.28473541, -0.93230879, -0.77235961, -0.92498165, + // -0.55227244, 0.97729182, 0.28253901, 0.45306230, + // -0.50359881, 0.40307203, -0.65891176, -0.59297264 + VLOAD_32(v1, 0x3f653838, 0x3f2f98cf, 0x3f2ccdaf, 0x3daa8aad, 0x3e91c8d7, + 0xbf6eabca, 0xbf45b95c, 0xbf6ccb99, 0xbf0d61ba, 0x3f7a2fcc, + 0x3e90a8f4, 0x3ee7f7c8, 0xbf00ebda, 0x3ece5f75, 0xbf28ae71, + 0xbf17cd0e); + asm volatile("vfnmsac.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // 1.44151771, 1.22301352, 1.22750902, 0.11284268, + // -0.28295860, -1.23474741, -1.19584155, -1.04248869, + // -0.58934993, 1.29115713, 0.93326056, 0.08611137, + // -1.12380528, 0.21176875, -0.67272252, -0.69414055 + VCMP_U32(8, v1, 0x3fb883a7, 0x3f9c8bb5, 0x3f9d1f04, 0x3de71a10, 0xbe90dff2, + 0xbf9e0c34, 0xbf991156, 0xbf857045, 0xbf16dfa3, 0x3fa544a3, + 0x3f6eea2a, 0x3db05b27, 0xbf8fd8da, 0x3e58d9e8, 0xbf2c378b, + 0xbf31b332); + + VSET(16, e64, m1); + double dscalar_64; + // 0.5178244899339752 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fe09204aa2ab2a0); + // 0.8646249694399413, 0.0049558737185129, 0.9278624830778543, + // -0.8820434014846885, 0.9252937592855630, + // -0.0640564429957495, -0.9483662154664578, + // 0.6036726974274773, 0.6321354499926264, 0.8250130840364809, + // 0.1494192541908572, 0.0196333207724690, + // -0.2272946521816408, 0.9289723385226867, + // -0.5162193242581365, -0.3917544955022987 + VLOAD_64(v2, 0x3febab01fbe195e4, 0x3f744c9c38b4b600, 0x3fedb10ca98026d0, + 0xbfec39b31560f050, 0x3fed9c01a86a6166, 0xbfb06600c7c3cc10, + 0xbfee59041b01e946, 0x3fe35149679e0d42, 0x3fe43a741f8b89d2, + 0x3fea6681d6d6ae5e, 0x3fc3202b8d123b90, 0x3f941ac1da84be40, + 0xbfcd17fdbcd68200, 0x3fedba24329afe9c, 0xbfe084de63680fb2, + 0xbfd91281728f9314); + // 0.3888129269587612, -0.8225750100551035, 0.8430062678626642, + // -0.6316792665412014, -0.6696614660277347, + // 0.6130084754374303, -0.2295750183537659, 0.1572393304616742, + // -0.7542147373874082, 0.6149250820738357, + // 0.1236692515687874, 0.9290168852760794, + // -0.0433411597165929, -0.8422695068160440, + // 0.6519328829008422, -0.3347506024828231 + VLOAD_64(v1, 0x3fd8e24f9d6331d4, 0xbfea5288d3d6317c, 0x3feaf9e847d9618e, + 0xbfe436b76feb621e, 0xbfe56ddde1ff608c, 0x3fe39dc3f345962e, + 0xbfcd62b6d5e76d58, 0x3fc4206b1afd2970, 0xbfe82286f1e7af48, + 0x3fe3ad775d9fe964, 0x3fbfa8c9bf023cb0, 0x3fedba819e762954, + 0xbfa630cfff1b61a0, 0xbfeaf3df2e462cb6, 0x3fe4dca25967e02c, + 0xbfd56c8dca7eb8ac); + asm volatile("vfnmsac.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // -0.0589110568256553, -0.8251412828355696, 0.3625363508340025, + // -0.1749355920677641, -1.1488012349688719, 0.6461784703586890, + // 0.2615122334407671, -0.1553571761707763, -1.0815499543490239, + // 0.1877131026437891, 0.0462963024810918, 0.9188502709613655, + // 0.0743575776140855, -1.3233141341743264, 0.9192438911788732, + // -0.1318905306700034 + VCMP_U64(9, v1, 0xbfae29970ce0c2e6, 0xbfea678eb10b76d9, 0x3fd733cbaa9c5dc5, + 0xbfc6644a1b6b315b, 0xbff2617d675cbb41, 0x3fe4ad7e78b23c6a, + 0x3fd0bc9dce8872e3, 0xbfc3e2be736d1b43, 0xbff14e07532eb5a9, + 0x3fc806fba27160c3, 0x3fa7b4262229fd93, 0x3fed6738aef664ca, + 0x3fb30919240ff186, 0xbff52c4b7109d007, 0x3fed6a722a352743, + 0xbfc0e1c9f5f09ba4); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.4771 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb7a2); + // -0.6172, 0.8584, -0.1088, -0.6719, 0.3579, 0.5889, 0.1724, + // -0.5239, -0.5732, -0.6167, 0.8271, -0.7334, 0.3489, + // -0.7607, -0.7788, -0.5264 + VLOAD_16(v2, 0xb8f0, 0x3ade, 0xaef7, 0xb960, 0x35ba, 0x38b6, 0x3184, 0xb831, + 0xb896, 0xb8ef, 0x3a9e, 0xb9de, 0x3595, 0xba16, 0xba3b, 0xb836); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.0186, 0.9351, 0.6201, 0.9463, 0.2512, 0.5786, 0.9424, + // -0.5132, -0.7646, 0.0194, -0.2507, -0.2905, 0.3452, + // -0.7803, -0.7666, -0.1387 + VLOAD_16(v1, 0x24c1, 0x3b7b, 0x38f6, 0x3b92, 0x3405, 0x38a1, 0x3b8a, 0xb81b, + 0xba1e, 0x24f6, 0xb403, 0xb4a6, 0x3586, 0xba3e, 0xba22, 0xb070); + asm volatile("vfnmsac.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // 0.0186, 1.3447, 0.6201, 0.6260, 0.2512, 0.8594, 0.9424, + // -0.7632, -0.7646, -0.2749, -0.2507, -0.6406, 0.3452, + // -1.1426, -0.7666, -0.3899 + VCMP_U16(10, v1, 0x24c1, 0x3d61, 0x38f6, 0x3902, 0x3405, 0x3ae0, 0x3b8a, + 0xba1b, 0xba1e, 0xb466, 0xb403, 0xb920, 0x3586, 0xbc93, 0xba22, + 0xb63d); + + VSET(16, e32, m1); + double dscalar_32; + // -0.73549986 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf3c49b8); + // 0.74252719, 0.73023552, 0.75118375, 0.04020444, + // -0.77184784, -0.41120139, -0.57577437, -0.15976480, + // -0.05041125, 0.42673740, 0.88473374, -0.49891368, + // -0.84324479, -0.26009968, -0.01877740, -0.13754985 + VLOAD_32(v2, 0x3f3e1643, 0x3f3af0b7, 0x3f404d94, 0x3d24ad6a, 0xbf4597d2, + 0xbed288fd, 0xbf1365f3, 0xbe239962, 0xbd4e7c07, 0x3eda7d53, + 0x3f627de9, 0xbeff719d, 0xbf57dee4, 0xbe852bc9, 0xbc99d30f, + 0xbe0cd9de); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.89538908, 0.68592542, 0.67501348, 0.08327232, + // 0.28473541, -0.93230879, -0.77235961, -0.92498165, + // -0.55227244, 0.97729182, 0.28253901, 0.45306230, + // -0.50359881, 0.40307203, -0.65891176, -0.59297264 + VLOAD_32(v1, 0x3f653838, 0x3f2f98cf, 0x3f2ccdaf, 0x3daa8aad, 0x3e91c8d7, + 0xbf6eabca, 0xbf45b95c, 0xbf6ccb99, 0xbf0d61ba, 0x3f7a2fcc, + 0x3e90a8f4, 0x3ee7f7c8, 0xbf00ebda, 0x3ece5f75, 0xbf28ae71, + 0xbf17cd0e); + asm volatile("vfnmsac.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // 0.89538908, 1.22301352, 0.67501348, 0.11284268, + // 0.28473541, -1.23474741, -0.77235961, -1.04248869, + // -0.55227244, 1.29115713, 0.28253901, 0.08611137, + // -0.50359881, 0.21176875, -0.65891176, -0.69414055 + VCMP_U32(11, v1, 0x3f653838, 0x3f9c8bb5, 0x3f2ccdaf, 0x3de71a10, 0x3e91c8d7, + 0xbf9e0c34, 0xbf45b95c, 0xbf857045, 0xbf0d61ba, 0x3fa544a3, + 0x3e90a8f4, 0x3db05b27, 0xbf00ebda, 0x3e58d9e8, 0xbf28ae71, + 0xbf31b332); + + VSET(16, e64, m1); + double dscalar_64; + // 0.5178244899339752 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fe09204aa2ab2a0); + // 0.8646249694399413, 0.0049558737185129, + // 0.9278624830778543, -0.8820434014846885, + // 0.9252937592855630, -0.0640564429957495, + // -0.9483662154664578, 0.6036726974274773, + // 0.6321354499926264, 0.8250130840364809, + // 0.1494192541908572, 0.0196333207724690, + // -0.2272946521816408, 0.9289723385226867, + // -0.5162193242581365, -0.3917544955022987 + VLOAD_64(v2, 0x3febab01fbe195e4, 0x3f744c9c38b4b600, 0x3fedb10ca98026d0, + 0xbfec39b31560f050, 0x3fed9c01a86a6166, 0xbfb06600c7c3cc10, + 0xbfee59041b01e946, 0x3fe35149679e0d42, 0x3fe43a741f8b89d2, + 0x3fea6681d6d6ae5e, 0x3fc3202b8d123b90, 0x3f941ac1da84be40, + 0xbfcd17fdbcd68200, 0x3fedba24329afe9c, 0xbfe084de63680fb2, + 0xbfd91281728f9314); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.3888129269587612, -0.8225750100551035, + // 0.8430062678626642, -0.6316792665412014, + // -0.6696614660277347, 0.6130084754374303, + // -0.2295750183537659, 0.1572393304616742, + // -0.7542147373874082, 0.6149250820738357, + // 0.1236692515687874, 0.9290168852760794, + // -0.0433411597165929, -0.8422695068160440, + // 0.6519328829008422, -0.3347506024828231 + VLOAD_64(v1, 0x3fd8e24f9d6331d4, 0xbfea5288d3d6317c, 0x3feaf9e847d9618e, + 0xbfe436b76feb621e, 0xbfe56ddde1ff608c, 0x3fe39dc3f345962e, + 0xbfcd62b6d5e76d58, 0x3fc4206b1afd2970, 0xbfe82286f1e7af48, + 0x3fe3ad775d9fe964, 0x3fbfa8c9bf023cb0, 0x3fedba819e762954, + 0xbfa630cfff1b61a0, 0xbfeaf3df2e462cb6, 0x3fe4dca25967e02c, + 0xbfd56c8dca7eb8ac); + asm volatile("vfnmsac.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + // 0.3888129269587612, -0.8251412828355696, 0.8430062678626642, + // -0.1749355920677641, -0.6696614660277347, + // 0.6461784703586890, -0.2295750183537659, + // -0.1553571761707763, -0.7542147373874082, + // 0.1877131026437891, 0.1236692515687874, 0.9188502709613655, + // -0.0433411597165929, -1.3233141341743264, + // 0.6519328829008422, -0.1318905306700034 + VCMP_U64(12, v1, 0x3fd8e24f9d6331d4, 0xbfea678eb10b76d9, 0x3feaf9e847d9618e, + 0xbfc6644a1b6b315b, 0xbfe56ddde1ff608c, 0x3fe4ad7e78b23c6a, + 0xbfcd62b6d5e76d58, 0xbfc3e2be736d1b43, 0xbfe82286f1e7af48, + 0x3fc806fba27160c3, 0x3fbfa8c9bf023cb0, 0x3fed6738aef664ca, + 0xbfa630cfff1b61a0, 0xbff52c4b7109d007, 0x3fe4dca25967e02c, + 0xbfc0e1c9f5f09ba4); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfnmsub.c b/apps/riscv-tests/isa/rv64uv/vfnmsub.c new file mode 100644 index 0000000..efb561c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfnmsub.c @@ -0,0 +1,454 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.0091, -0.3794, -0.0005, -0.0464, 0.4834, 0.2932, -0.3042, + // -0.3096, -0.9844, -0.1815, -0.8760, 0.0853, -0.3723, -0.8877, + // 0.1584, 0.1943 + VLOAD_16(v2, 0xa0ac, 0xb612, 0x8f83, 0xa9f0, 0x37bc, 0x34b1, 0xb4de, 0xb4f4, + 0xbbe0, 0xb1cf, 0xbb02, 0x2d75, 0xb5f5, 0xbb1a, 0x3112, 0x3238); + // -0.3301, 0.7769, 0.6572, -0.8193, 0.4529, 0.2349, 0.5264, + // -0.2456, 0.0873, 0.5381, 0.4670, 0.8564, -0.1790, 0.6641, + // 0.0182, 0.0447 + VLOAD_16(v3, 0xb548, 0x3a37, 0x3942, 0xba8e, 0x373f, 0x3384, 0x3836, 0xb3dc, + 0x2d97, 0x384e, 0x3779, 0x3ada, 0xb1ba, 0x3950, 0x24a7, 0x29b9); + // 0.5835, 0.4404, -0.3459, 0.0516, -0.4866, -0.2191, 0.0685, + // -0.5430, -0.1429, -0.7539, -0.6416, -0.6758, -0.1147, 0.3438, + // 0.3440, 0.1991 + VLOAD_16(v1, 0x38ab, 0x370c, 0xb589, 0x2a9b, 0xb7c9, 0xb303, 0x2c62, 0xb858, + 0xb093, 0xba08, 0xb922, 0xb968, 0xaf57, 0x3580, 0x3581, 0x325f); + asm volatile("vfnmsub.vv v1, v2, v3"); + // -0.3247, 0.9438, 0.6572, -0.8169, 0.6880, 0.2991, 0.5474, + // -0.4136, -0.0534, 0.4014, -0.0950, 0.9141, -0.2217, 0.9692, + // -0.0363, 0.0060 + VCMP_U16(1, v1, 0xb532, 0x3b8d, 0x3942, 0xba89, 0x3981, 0x34c9, 0x3861, + 0xb69e, 0xaad5, 0x366b, 0xae14, 0x3b50, 0xb318, 0x3bc1, 0xa8a7, + 0x1e29); + + VSET(16, e32, m1); + // 0.76259303, -0.43966120, -0.19390504, -0.57240725, + // -0.57148474, -0.93710214, 0.24273214, 0.44242114, + // -0.93160200, -0.56412256, -0.75430351, -0.02741535, + // -0.60542876, -0.93627954, 0.02798123, 0.23119579 + VLOAD_32(v2, 0x3f43394c, 0xbee11b46, 0xbe468f0b, 0xbf128948, 0xbf124cd3, + 0xbf6fe5ed, 0x3e788ec6, 0x3ee28506, 0xbf6e7d78, 0xbf106a56, + 0xbf411a09, 0xbce09629, 0xbf1afd61, 0xbf6fb004, 0x3ce538e6, + 0x3e6cbe97); + // 0.48736989, 0.19715627, -0.47227743, 0.13752034, + // -0.16710435, 0.84761631, 0.37147006, 0.25389814, + // -0.44707820, 0.38169226, -0.82191414, -0.81056035, + // 0.29047397, -0.46743703, -0.91869444, -0.08079135 + VLOAD_32(v3, 0x3ef9888c, 0x3e49e355, 0xbef1ce59, 0x3e0cd222, 0xbe2b1d67, + 0x3f58fd62, 0x3ebe3153, 0x3e81fef0, 0xbee4e76f, 0x3ec36d2b, + 0xbf5268f7, 0xbf4f80e2, 0x3e94b901, 0xbeef53e8, 0xbf6b2f8f, + 0xbda575f0); + // -0.48655373, -0.87417608, 0.17854533, 0.67417324, + // 0.46947387, 0.29113689, -0.11920074, 0.63394654, + // -0.82611400, -0.84088647, -0.13328743, 0.29885510, + // 0.91797447, -0.15480036, 0.76857966, 0.16230854 + VLOAD_32(v1, 0xbef91d92, 0xbf5fca01, 0x3e36d496, 0x3f2c969e, 0x3ef05ee1, + 0x3e950fe5, 0xbdf41f84, 0x3f224a52, 0xbf537c35, 0xbf574456, + 0xbe087c80, 0x3e990389, 0x3f6b0060, 0xbe1e83fc, 0x3f44c1a3, + 0x3e263436); + asm volatile("vfnmsub.vv v1, v2, v3"); + // 0.85841238, -0.18718503, -0.43765658, 0.52342200, + // 0.10119282, 1.12044132, 0.40040392, -0.02657321, + // -1.21668768, -0.09267077, -0.92245328, -0.80236715, + // 0.84624207, -0.61237341, -0.94020027, -0.11831641 + VCMP_U32(2, v1, 0x3f5bc0ea, 0xbe3fad70, 0xbee01486, 0x3f05fefc, 0x3dcf3e2c, + 0x3f8f6a9f, 0x3ecd01be, 0xbcd9b00d, 0xbf9bbc6c, 0xbdbdca2c, + 0xbf6c25e6, 0xbf4d67ef, 0x3f58a353, 0xbf1cc481, 0xbf70b0f7, + 0xbdf24fdf); + + VSET(16, e64, m1); + // -0.1307639483617093, 0.9224167823566942, 0.8635785104096312, + // -0.1786758246437388, 0.0810514505300033, 0.4196384170211611, + // 0.9100790646565715, -0.5457616411379209, -0.5513001815564993, + // -0.4320693373833464, 0.2818536966914695, 0.5493933224246561, + // 0.0505621823765807, 0.7247332126666939, -0.8702311369694951, + // -0.0660417836134264 + VLOAD_64(v2, 0xbfc0bcdf80daccc8, 0x3fed847033301d18, 0x3feba26f66779bbe, + 0xbfc6ded973b720d0, 0x3fb4bfc9b151d990, 0x3fdadb5b175011f8, + 0x3fed1f5e216f2d02, 0xbfe176e11e032836, 0xbfe1a44047420c82, + 0xbfdba706266a9d80, 0x3fd209e41662faec, 0x3fe194a14e0e8cc0, + 0x3fa9e3494f719000, 0x3fe73103b4d74f92, 0xbfebd8eef827d60a, + 0xbfb0e81d44ca0760); + // 0.6650460871127466, -0.8389896062690501, 0.3260860096573337, + // 0.4421797679090849, -0.1921872051427089, -0.1798768047606598, + // -0.5065656464186716, 0.8248933299429206, + // -0.3169052211432897, -0.0970247500649024, 0.8584276150948376, + // -0.2642287948226270, 0.2403355182026823, + // -0.0814065713760876, -0.7437013715700231, -0.6226210619792329 + VLOAD_64(v3, 0x3fe5480ebb4f6ca8, 0xbfead900bb1380ea, 0x3fd4de97daca5430, + 0x3fdc4cac5e87d53c, 0xbfc8999720661708, 0xbfc7063400e0c4f8, + 0xbfe035c92894a640, 0x3fea6586b2596362, 0xbfd4482cd62f7e30, + 0xbfb8d69d306e6ba0, 0x3feb783d309a196c, 0xbfd0e91fe41b2de8, + 0x3fcec350735fb5b8, 0xbfb4d70fa1bd62a0, 0xbfe7cc66d19c4666, + 0xbfe3ec8301600d10); + // -0.2122847293404504, 0.9074328134093839, -0.4150374170703475, + // -0.4511563805942409, -0.9126942371441604, -0.8237861842027401, + // -0.0636244117792013, 0.7124530373845765, -0.4126670585839094, + // -0.2810978842877421, -0.3240264495739638, 0.5540367578795606, + // 0.7398533272929233, 0.4690189457399407, -0.2427822500985419, + // 0.2399358773396087 + VLOAD_64(v1, 0xbfcb2c2560fa8d98, 0x3fed09b08a1d236c, 0xbfda8ff9193bbdb8, + 0xbfdcdfbf03022cf4, 0xbfed34ca8b7904d0, 0xbfea5c74d801844e, + 0xbfb049b07fd1a3e0, 0x3fe6cc6a4ff0157a, 0xbfda692318304834, + 0xbfd1fd81faff66b8, 0xbfd4bcd96efd6300, 0x3fe1baab4b7bfc96, + 0x3fe7ace0e291ea9e, 0x3fde04680a4a1390, 0xbfcf137d201c7be0, + 0x3fceb6380527c498); + asm volatile("vfnmsub.vv v1, v2, v3"); + // 0.6372868977272925, -1.6760208622190165, 0.6845034040552052, + // 0.3615690295631244, -0.1182120133317999, 0.1658155255420807, + // -0.4486624012573315, 1.2137228688596235, + // -0.5444086454629855, -0.2184785266689677, 0.9497556677330713, + // -0.5686128899794636, 0.2029269193361774, + // -0.4213201787237407, -0.9549780451092895, -0.6067752686868729 + VCMP_U64(3, v1, 0x3fe464a77dfd0e7c, 0xbffad0fb406a4f74, 0x3fe5e773aecd5e74, + 0x3fd723f26d4e15bc, 0xbfbe43247b412024, 0x3fc5397171afa72c, + 0xbfdcb6e281161599, 0x3ff36b68abc28cd2, 0xbfe16bcbadfd8ab4, + 0xbfcbf71ab775f310, 0x3fee6465ff835579, 0xbfe23213a8d1778a, + 0x3fc9f982610371db, 0xbfdaf6e8e930da95, 0xbfee8f2e1e048ea3, + 0xbfe36ab3f7e103f3); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.0091, -0.3794, -0.0005, -0.0464, 0.4834, 0.2932, -0.3042, + // -0.3096, -0.9844, -0.1815, -0.8760, 0.0853, -0.3723, -0.8877, + // 0.1584, 0.1943 + VLOAD_16(v2, 0xa0ac, 0xb612, 0x8f83, 0xa9f0, 0x37bc, 0x34b1, 0xb4de, 0xb4f4, + 0xbbe0, 0xb1cf, 0xbb02, 0x2d75, 0xb5f5, 0xbb1a, 0x3112, 0x3238); + // -0.3301, 0.7769, 0.6572, -0.8193, 0.4529, 0.2349, 0.5264, + // -0.2456, 0.0873, 0.5381, 0.4670, 0.8564, -0.1790, 0.6641, + // 0.0182, 0.0447 + VLOAD_16(v3, 0xb548, 0x3a37, 0x3942, 0xba8e, 0x373f, 0x3384, 0x3836, 0xb3dc, + 0x2d97, 0x384e, 0x3779, 0x3ada, 0xb1ba, 0x3950, 0x24a7, 0x29b9); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.5835, 0.4404, -0.3459, 0.0516, -0.4866, -0.2191, 0.0685, + // -0.5430, -0.1429, -0.7539, -0.6416, -0.6758, -0.1147, 0.3438, + // 0.3440, 0.1991 + VLOAD_16(v1, 0x38ab, 0x370c, 0xb589, 0x2a9b, 0xb7c9, 0xb303, 0x2c62, 0xb858, + 0xb093, 0xba08, 0xb922, 0xb968, 0xaf57, 0x3580, 0x3581, 0x325f); + asm volatile("vfnmsub.vv v1, v2, v3, v0.t"); + // 0.5835, 0.9438, -0.3459, -0.8169, -0.4866, 0.2991, 0.0685, + // -0.4136, -0.1429, 0.4014, -0.6416, 0.9141, -0.1147, 0.9692, + // 0.3440, 0.0060 + VCMP_U16(4, v1, 0x38ab, 0x3b8d, 0xb589, 0xba89, 0xb7c9, 0x34c9, 0x2c62, + 0xb69e, 0xb093, 0x366b, 0xb922, 0x3b50, 0xaf57, 0x3bc1, 0x3581, + 0x1e29); + + VSET(16, e32, m1); + // 0.76259303, -0.43966120, -0.19390504, -0.57240725, + // -0.57148474, -0.93710214, 0.24273214, 0.44242114, + // -0.93160200, -0.56412256, -0.75430351, -0.02741535, + // -0.60542876, -0.93627954, 0.02798123, 0.23119579 + VLOAD_32(v2, 0x3f43394c, 0xbee11b46, 0xbe468f0b, 0xbf128948, 0xbf124cd3, + 0xbf6fe5ed, 0x3e788ec6, 0x3ee28506, 0xbf6e7d78, 0xbf106a56, + 0xbf411a09, 0xbce09629, 0xbf1afd61, 0xbf6fb004, 0x3ce538e6, + 0x3e6cbe97); + // 0.48736989, 0.19715627, -0.47227743, 0.13752034, + // -0.16710435, 0.84761631, 0.37147006, 0.25389814, + // -0.44707820, 0.38169226, -0.82191414, -0.81056035, + // 0.29047397, -0.46743703, -0.91869444, -0.08079135 + VLOAD_32(v3, 0x3ef9888c, 0x3e49e355, 0xbef1ce59, 0x3e0cd222, 0xbe2b1d67, + 0x3f58fd62, 0x3ebe3153, 0x3e81fef0, 0xbee4e76f, 0x3ec36d2b, + 0xbf5268f7, 0xbf4f80e2, 0x3e94b901, 0xbeef53e8, 0xbf6b2f8f, + 0xbda575f0); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.48655373, -0.87417608, 0.17854533, 0.67417324, + // 0.46947387, 0.29113689, -0.11920074, 0.63394654, + // -0.82611400, -0.84088647, -0.13328743, 0.29885510, + // 0.91797447, -0.15480036, 0.76857966, 0.16230854 + VLOAD_32(v1, 0xbef91d92, 0xbf5fca01, 0x3e36d496, 0x3f2c969e, 0x3ef05ee1, + 0x3e950fe5, 0xbdf41f84, 0x3f224a52, 0xbf537c35, 0xbf574456, + 0xbe087c80, 0x3e990389, 0x3f6b0060, 0xbe1e83fc, 0x3f44c1a3, + 0x3e263436); + asm volatile("vfnmsub.vv v1, v2, v3, v0.t"); + // -0.48655373, -0.18718503, 0.17854533, 0.52342200, + // 0.46947387, 1.12044132, -0.11920074, -0.02657321, + // -0.82611400, -0.09267077, -0.13328743, -0.80236715, + // 0.91797447, -0.61237341, 0.76857966, -0.11831641 + VCMP_U32(5, v1, 0xbef91d92, 0xbe3fad70, 0x3e36d496, 0x3f05fefc, 0x3ef05ee1, + 0x3f8f6a9f, 0xbdf41f84, 0xbcd9b00d, 0xbf537c35, 0xbdbdca2c, + 0xbe087c80, 0xbf4d67ef, 0x3f6b0060, 0xbf1cc481, 0x3f44c1a3, + 0xbdf24fdf); + + VSET(16, e64, m1); + // -0.1307639483617093, 0.9224167823566942, 0.8635785104096312, + // -0.1786758246437388, 0.0810514505300033, 0.4196384170211611, + // 0.9100790646565715, -0.5457616411379209, -0.5513001815564993, + // -0.4320693373833464, 0.2818536966914695, 0.5493933224246561, + // 0.0505621823765807, 0.7247332126666939, -0.8702311369694951, + // -0.0660417836134264 + VLOAD_64(v2, 0xbfc0bcdf80daccc8, 0x3fed847033301d18, 0x3feba26f66779bbe, + 0xbfc6ded973b720d0, 0x3fb4bfc9b151d990, 0x3fdadb5b175011f8, + 0x3fed1f5e216f2d02, 0xbfe176e11e032836, 0xbfe1a44047420c82, + 0xbfdba706266a9d80, 0x3fd209e41662faec, 0x3fe194a14e0e8cc0, + 0x3fa9e3494f719000, 0x3fe73103b4d74f92, 0xbfebd8eef827d60a, + 0xbfb0e81d44ca0760); + // 0.6650460871127466, -0.8389896062690501, 0.3260860096573337, + // 0.4421797679090849, -0.1921872051427089, -0.1798768047606598, + // -0.5065656464186716, 0.8248933299429206, + // -0.3169052211432897, -0.0970247500649024, 0.8584276150948376, + // -0.2642287948226270, 0.2403355182026823, + // -0.0814065713760876, -0.7437013715700231, -0.6226210619792329 + VLOAD_64(v3, 0x3fe5480ebb4f6ca8, 0xbfead900bb1380ea, 0x3fd4de97daca5430, + 0x3fdc4cac5e87d53c, 0xbfc8999720661708, 0xbfc7063400e0c4f8, + 0xbfe035c92894a640, 0x3fea6586b2596362, 0xbfd4482cd62f7e30, + 0xbfb8d69d306e6ba0, 0x3feb783d309a196c, 0xbfd0e91fe41b2de8, + 0x3fcec350735fb5b8, 0xbfb4d70fa1bd62a0, 0xbfe7cc66d19c4666, + 0xbfe3ec8301600d10); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.2122847293404504, 0.9074328134093839, -0.4150374170703475, + // -0.4511563805942409, -0.9126942371441604, -0.8237861842027401, + // -0.0636244117792013, 0.7124530373845765, -0.4126670585839094, + // -0.2810978842877421, -0.3240264495739638, 0.5540367578795606, + // 0.7398533272929233, 0.4690189457399407, -0.2427822500985419, + // 0.2399358773396087 + VLOAD_64(v1, 0xbfcb2c2560fa8d98, 0x3fed09b08a1d236c, 0xbfda8ff9193bbdb8, + 0xbfdcdfbf03022cf4, 0xbfed34ca8b7904d0, 0xbfea5c74d801844e, + 0xbfb049b07fd1a3e0, 0x3fe6cc6a4ff0157a, 0xbfda692318304834, + 0xbfd1fd81faff66b8, 0xbfd4bcd96efd6300, 0x3fe1baab4b7bfc96, + 0x3fe7ace0e291ea9e, 0x3fde04680a4a1390, 0xbfcf137d201c7be0, + 0x3fceb6380527c498); + asm volatile("vfnmsub.vv v1, v2, v3, v0.t"); + // -0.2122847293404504, -1.6760208622190165, -0.4150374170703475, + // 0.3615690295631244, -0.9126942371441604, 0.1658155255420807, + // -0.0636244117792013, 1.2137228688596235, -0.4126670585839094, + // -0.2184785266689677, -0.3240264495739638, -0.5686128899794636, + // 0.7398533272929233, -0.4213201787237407, -0.2427822500985419, + // -0.6067752686868729 + VCMP_U64(6, v1, 0xbfcb2c2560fa8d98, 0xbffad0fb406a4f74, 0xbfda8ff9193bbdb8, + 0x3fd723f26d4e15bc, 0xbfed34ca8b7904d0, 0x3fc5397171afa72c, + 0xbfb049b07fd1a3e0, 0x3ff36b68abc28cd2, 0xbfda692318304834, + 0xbfcbf71ab775f310, 0xbfd4bcd96efd6300, 0xbfe23213a8d1778a, + 0x3fe7ace0e291ea9e, 0xbfdaf6e8e930da95, 0xbfcf137d201c7be0, + 0xbfe36ab3f7e103f3); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.1346 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb04f); + // -0.1886, 0.9912, -0.0325, 0.5850, 0.2578, -0.2350, -0.8701, + // 0.9209, 0.5859, -0.4795, 0.8682, 0.9233, -0.8896, -0.5981, + // -0.3223, 0.6924 + VLOAD_16(v2, 0xb209, 0x3bee, 0xa82a, 0x38ae, 0x3420, 0xb385, 0xbaf6, 0x3b5e, + 0x38b0, 0xb7ac, 0x3af2, 0x3b63, 0xbb1e, 0xb8c9, 0xb528, 0x398a); + // -0.0126, 0.9678, 0.8945, -0.9600, -0.9272, 0.4412, 0.5527, + // 0.1136, 0.7207, -0.5181, -0.2810, -0.4048, 0.1648, 0.7612, + // -0.8853, 0.1761 + VLOAD_16(v1, 0xa27a, 0x3bbe, 0x3b28, 0xbbae, 0xbb6b, 0x370f, 0x386c, 0x2f45, + 0x39c4, 0xb825, 0xb47f, 0xb67a, 0x3146, 0x3a17, 0xbb15, 0x31a3); + asm volatile("vfnmsub.vf v1, %[A], v2" ::[A] "f"(dscalar_16)); + // -0.1903, 1.1211, 0.0879, 0.4556, 0.1329, -0.1755, -0.7959, + // 0.9360, 0.6831, -0.5493, 0.8301, 0.8687, -0.8677, -0.4956, + // -0.4414, 0.7163 + VCMP_U16(7, v1, 0xb217, 0x3c7c, 0x2da0, 0x374b, 0x3041, 0xb19e, 0xba5e, + 0x3b7d, 0x3977, 0xb865, 0x3aa5, 0x3af3, 0xbaf1, 0xb7ee, 0xb710, + 0x39bb); + + VSET(16, e32, m1); + double dscalar_32; + // -0.16110219 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe24f7f9); + // -0.31537205, -0.17563045, -0.79069936, 0.22939304, + // -0.89379781, 0.26157290, 0.56702632, -0.11594663, + // 0.09605245, 0.45930776, -0.76518077, -0.26341528, 0.74385208, + // 0.89362013, -0.21185355, 0.23924881 + VLOAD_32(v2, 0xbea17872, 0xbe33d878, 0xbf4a6b46, 0x3e6ae602, 0xbf64cfef, + 0x3e85ece2, 0x3f1128a3, 0xbded756d, 0x3dc4b726, 0x3eeb2a63, + 0xbf43e2e3, 0xbe86de5e, 0x3f3e6d17, 0x3f64c44a, 0xbe58f023, + 0x3e74fda4); + // 0.31856158, 0.48641542, 0.57264513, 0.30210373, + // -0.19719712, 0.85649359, 0.36901370, -0.78377151, + // 0.22567192, -0.75179213, -0.65690833, 0.11298654, + // -0.64884853, -0.48376039, -0.11539485, -0.42667609 + VLOAD_32(v1, 0x3ea31a81, 0x3ef90b71, 0x3f1298df, 0x3e9aad57, 0xbe49ee0b, + 0x3f5b432a, 0x3ebcef5d, 0xbf48a540, 0x3e67168a, 0xbf407573, + 0xbf282b25, 0x3de7657d, 0xbf261af0, 0xbef7af71, 0xbdec5422, + 0xbeda754a); + asm volatile("vfnmsub.vf v1, %[A], v2" ::[A] "f"(dscalar_32)); + // -0.26405108, -0.09726786, -0.69844496, 0.27806261, + // -0.92556667, 0.39955589, 0.62647521, -0.24221393, + // 0.13240869, 0.33819240, -0.87101012, -0.24521290, 0.63932115, + // 0.81568527, -0.23044391, 0.17051035 + VCMP_U32(8, v1, 0xbe8731b4, 0xbdc7345f, 0xbf32cd4a, 0x3e8e5e39, 0xbf6cf1f1, + 0x3ecc9297, 0x3f2060ae, 0xbe7806ee, 0x3e079625, 0x3ead278e, + 0xbf5efa85, 0xbe7b1917, 0x3f23aa8d, 0x3f50d0c0, 0xbe6bf97d, + 0x3e2e9a44); + + VSET(16, e64, m1); + double dscalar_64; + // 0.5849101968457469 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fe2b79596d194ba); + // -0.7607808895269514, -0.0192591699518767, 0.6815284686654297, + // -0.5163928614577513, -0.9560613023939111, + // -0.8652684824342871, 0.4588682754059621, + // -0.5708244737077264, -0.7636024500128011, 0.2236424444447431, + // 0.8245435877598175, 0.8527344486412596, -0.3097355632002228, + // 0.0764086736442742, 0.2567358761671383, 0.1904958118727702 + VLOAD_64(v2, 0xbfe8585129fe14da, 0xbf93b8ad045d9c40, 0x3fe5cf14ca86c05c, + 0xbfe0864a527b2a32, 0xbfee980ddf5818b2, 0xbfebb047874a12f4, + 0x3fdd5e190b029804, 0xbfe24431afca9858, 0xbfe86f6e67be6a22, + 0x3fcca050cc719f20, 0x3fea62a93bf1c1ec, 0x3feb4999c122c714, + 0xbfd3d2b51c969928, 0x3fb38f84d26ed230, 0x3fd06e5c4ff641c8, + 0x3fc8622ab1025ec0); + // 0.1182575129292827, -0.8756460666506833, + // -0.3686593299789440, 0.2802900907620893, + // -0.5167592439660142, 0.3872686605057347, + // -0.0640775227939985, -0.4352087179743556, + // -0.1509314378482451, -0.9803534868251271, + // 0.9211862470421908, 0.7804942879773937, 0.5029472314120484, + // 0.1158347026033590, 0.7422982722940397, 0.0792254120441500 + VLOAD_64(v1, 0x3fbe461fd6899df0, 0xbfec054ae66457d4, 0xbfd7981d4d67fd54, + 0x3fd1f045d94dd3b0, 0xbfe0894aae97abc2, 0x3fd8c9027de8d2a8, + 0xbfb0676270cf1540, 0xbfdbda75aaa8928c, 0xbfc351b8aabf8c50, + 0xbfef5f0e468ddf22, 0x3fed7a5b94924728, 0x3fe8f9cf28327c9e, + 0x3fe01824cad0e968, 0x3fbda757d36c5e40, 0x3fe7c0e84e6c2aa0, + 0x3fb4481dd9bde340); + asm volatile("vfnmsub.vf v1, %[A], v2" ::[A] "f"(dscalar_64)); + // -0.8299509146929066, 0.4929151432599784, 0.8971610699324351, + // -0.6803373936193172, -0.6538035512838903, -1.0917858708828851, + // 0.4963478718767876, -0.3162664568083610, -0.6753211129907725, + // 0.7970611954020426, 0.2857323586707750, 0.3962153810234212, + // -0.6039145273284674, 0.0086557749429749, -0.1774419523986262, + // 0.1441560605188410 + VCMP_U64(9, v1, 0xbfea8ef5387c85b1, 0x3fdf8bebf5004e06, 0x3fecb58b21d3556c, + 0xbfe5c552ecfae837, 0xbfe4ebf56cd8bc27, 0xbff177f4761ad476, + 0x3fdfc429dd49999d, 0xbfd43db5aa3413c6, 0xbfe59c3b05d2ff7f, + 0x3fe981867ae532b2, 0x3fd249705ff9984b, 0x3fd95b97c1eabccb, + 0xbfe353448f0e8fe6, 0x3f81ba1e7269b44b, 0xbfc6b66afb3ec852, + 0x3fc273b4aeb96c59); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.1346 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb04f); + // -0.1886, 0.9912, -0.0325, 0.5850, 0.2578, -0.2350, + // -0.8701, 0.9209, 0.5859, -0.4795, 0.8682, 0.9233, + // -0.8896, -0.5981, -0.3223, 0.6924 + VLOAD_16(v2, 0xb209, 0x3bee, 0xa82a, 0x38ae, 0x3420, 0xb385, 0xbaf6, 0x3b5e, + 0x38b0, 0xb7ac, 0x3af2, 0x3b63, 0xbb1e, 0xb8c9, 0xb528, 0x398a); + VLOAD_8(v0, 0xAA, 0xAA); + // -0.0126, 0.9678, 0.8945, -0.9600, -0.9272, 0.4412, 0.5527, + // 0.1136, 0.7207, -0.5181, -0.2810, -0.4048, 0.1648, 0.7612, + // -0.8853, 0.1761 + VLOAD_16(v1, 0xa27a, 0x3bbe, 0x3b28, 0xbbae, 0xbb6b, 0x370f, 0x386c, 0x2f45, + 0x39c4, 0xb825, 0xb47f, 0xb67a, 0x3146, 0x3a17, 0xbb15, 0x31a3); + asm volatile("vfnmsub.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // -0.0126, 1.1211, 0.8945, 0.4556, -0.9272, -0.1755, 0.5527, + // 0.9360, 0.7207, -0.5493, -0.2810, 0.8687, 0.1648, -0.4956, + // -0.8853, 0.7163 + VCMP_U16(10, v1, 0xa27a, 0x3c7c, 0x3b28, 0x374b, 0xbb6b, 0xb19e, 0x386c, + 0x3b7d, 0x39c4, 0xb865, 0xb47f, 0x3af3, 0x3146, 0xb7ee, 0xbb15, + 0x39bb); + + VSET(16, e32, m1); + double dscalar_32; + // -0.16110219 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe24f7f9); + // -0.31537205, -0.17563045, -0.79069936, 0.22939304, + // -0.89379781, 0.26157290, 0.56702632, -0.11594663, + // 0.09605245, 0.45930776, -0.76518077, -0.26341528, + // 0.74385208, 0.89362013, -0.21185355, 0.23924881 + VLOAD_32(v2, 0xbea17872, 0xbe33d878, 0xbf4a6b46, 0x3e6ae602, 0xbf64cfef, + 0x3e85ece2, 0x3f1128a3, 0xbded756d, 0x3dc4b726, 0x3eeb2a63, + 0xbf43e2e3, 0xbe86de5e, 0x3f3e6d17, 0x3f64c44a, 0xbe58f023, + 0x3e74fda4); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.31856158, 0.48641542, 0.57264513, 0.30210373, + // -0.19719712, 0.85649359, 0.36901370, -0.78377151, + // 0.22567192, -0.75179213, -0.65690833, 0.11298654, + // -0.64884853, -0.48376039, -0.11539485, -0.42667609 + VLOAD_32(v1, 0x3ea31a81, 0x3ef90b71, 0x3f1298df, 0x3e9aad57, 0xbe49ee0b, + 0x3f5b432a, 0x3ebcef5d, 0xbf48a540, 0x3e67168a, 0xbf407573, + 0xbf282b25, 0x3de7657d, 0xbf261af0, 0xbef7af71, 0xbdec5422, + 0xbeda754a); + asm volatile("vfnmsub.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // 0.31856158, -0.09726786, 0.57264513, 0.27806261, + // -0.19719712, 0.39955589, 0.36901370, -0.24221393, + // 0.22567192, 0.33819240, -0.65690833, -0.24521290, + // -0.64884853, 0.81568527, -0.11539485, 0.17051035 + VCMP_U32(11, v1, 0x3ea31a81, 0xbdc7345f, 0x3f1298df, 0x3e8e5e39, 0xbe49ee0b, + 0x3ecc9297, 0x3ebcef5d, 0xbe7806ee, 0x3e67168a, 0x3ead278e, + 0xbf282b25, 0xbe7b1917, 0xbf261af0, 0x3f50d0c0, 0xbdec5422, + 0x3e2e9a44); + + VSET(16, e64, m1); + double dscalar_64; + // 0.5849101968457469 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fe2b79596d194ba); + // -0.7607808895269514, -0.0192591699518767, + // 0.6815284686654297, -0.5163928614577513, + // -0.9560613023939111, -0.8652684824342871, + // 0.4588682754059621, -0.5708244737077264, + // -0.7636024500128011, 0.2236424444447431, + // 0.8245435877598175, 0.8527344486412596, + // -0.3097355632002228, 0.0764086736442742, + // 0.2567358761671383, 0.1904958118727702 + VLOAD_64(v2, 0xbfe8585129fe14da, 0xbf93b8ad045d9c40, 0x3fe5cf14ca86c05c, + 0xbfe0864a527b2a32, 0xbfee980ddf5818b2, 0xbfebb047874a12f4, + 0x3fdd5e190b029804, 0xbfe24431afca9858, 0xbfe86f6e67be6a22, + 0x3fcca050cc719f20, 0x3fea62a93bf1c1ec, 0x3feb4999c122c714, + 0xbfd3d2b51c969928, 0x3fb38f84d26ed230, 0x3fd06e5c4ff641c8, + 0x3fc8622ab1025ec0); + VLOAD_8(v0, 0xAA, 0xAA); + // 0.1182575129292827, -0.8756460666506833, + // -0.3686593299789440, 0.2802900907620893, + // -0.5167592439660142, 0.3872686605057347, + // -0.0640775227939985, -0.4352087179743556, + // -0.1509314378482451, -0.9803534868251271, + // 0.9211862470421908, 0.7804942879773937, + // 0.5029472314120484, 0.1158347026033590, + // 0.7422982722940397, 0.0792254120441500 + VLOAD_64(v1, 0x3fbe461fd6899df0, 0xbfec054ae66457d4, 0xbfd7981d4d67fd54, + 0x3fd1f045d94dd3b0, 0xbfe0894aae97abc2, 0x3fd8c9027de8d2a8, + 0xbfb0676270cf1540, 0xbfdbda75aaa8928c, 0xbfc351b8aabf8c50, + 0xbfef5f0e468ddf22, 0x3fed7a5b94924728, 0x3fe8f9cf28327c9e, + 0x3fe01824cad0e968, 0x3fbda757d36c5e40, 0x3fe7c0e84e6c2aa0, + 0x3fb4481dd9bde340); + asm volatile("vfnmsub.vf v1, %[A], v2, v0.t" ::[A] "f"(dscalar_64)); + // 0.1182575129292827, 0.4929151432599784, + // -0.3686593299789440, -0.6803373936193172, + // -0.5167592439660142, -1.0917858708828851, + // -0.0640775227939985, -0.3162664568083610, + // -0.1509314378482451, 0.7970611954020426, + // 0.9211862470421908, 0.3962153810234212, 0.5029472314120484, + // 0.0086557749429749, 0.7422982722940397, 0.1441560605188410 + VCMP_U64(12, v1, 0x3fbe461fd6899df0, 0x3fdf8bebf5004e06, 0xbfd7981d4d67fd54, + 0xbfe5c552ecfae837, 0xbfe0894aae97abc2, 0xbff177f4761ad476, + 0xbfb0676270cf1540, 0xbfd43db5aa3413c6, 0xbfc351b8aabf8c50, + 0x3fe981867ae532b2, 0x3fed7a5b94924728, 0x3fd95b97c1eabccb, + 0x3fe01824cad0e968, 0x3f81ba1e7269b44b, 0x3fe7c0e84e6c2aa0, + 0x3fc273b4aeb96c59); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfrdiv.c b/apps/riscv-tests/isa/rv64uv/vfrdiv.c new file mode 100644 index 0000000..f676427 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfrdiv.c @@ -0,0 +1,179 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values (vector-scalar) +void TEST_CASE1(void) { + VSET(16, e16, m1); + double dscalar_16; + // -35.5312, -61.8125, -37.3125, 23.5938, 44.4688, 38.1250, + // -93.5000, -23.2031, -62.8125, 27.9844, -26.2344, -10.3594, + // -10.7109, -42.0938, 11.0625, 17.8281 + VLOAD_16(v2, 0xd071, 0xd3ba, 0xd0aa, 0x4de6, 0x518f, 0x50c4, 0xd5d8, 0xcdcd, + 0xd3da, 0x4eff, 0xce8f, 0xc92e, 0xc95b, 0xd143, 0x4988, 0x4c75); + // -17.4844 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xcc5f); + asm volatile("vfrdiv.vf v4, v2, %[A]" ::[A] "f"(dscalar_16)); + // 0.4922, 0.2830, 0.4685, -0.7412, -0.3931, -0.4585, 0.1870, + // 0.7534, 0.2783, -0.6250, 0.6665, 1.6875, 1.6328, 0.4153, + // -1.5801, -0.9810 + VCMP_U16(1, v4, 0x37df, 0x3486, 0x377f, 0xb9ed, 0xb64a, 0xb756, 0x31fb, + 0x3a07, 0x3474, 0xb8ff, 0x3954, 0x3ec0, 0x3e87, 0x36a5, 0xbe52, + 0xbbd8); + + VSET(16, e32, m1); + double dscalar_32; + // 981163.06250000, -831670.37500000, -85439.06250000, + // 64225.75781250, -215361.43750000, -292944.75000000, + // 396490.21875000, 954345.93750000, 241910.40625000, + // -62372.83593750, 391838.50000000, 263890.03125000, + // 755217.06250000, -6653.31689453, 526939.25000000, + // -759232.75000000 + VLOAD_32(v2, 0x496f8ab1, 0xc94b0b66, 0xc7a6df88, 0x477ae1c2, 0xc852505c, + 0xc88f0a18, 0x48c19947, 0x4968fe9f, 0x486c3d9a, 0xc773a4d6, + 0x48bf53d0, 0x4880da41, 0x49386111, 0xc5cfea89, 0x4900a5b4, + 0xc9395c0c); + // -816463.43750000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc94754f7); + asm volatile("vfrdiv.vf v4, v2, %[A]" ::[A] "f"(dscalar_32)); + // -0.83213836, 0.98171520, 9.55609035, + // -12.71239853, 3.79113102, 2.78709030, -2.05922723, + // -0.85552144, -3.37506533, 13.09004879, -2.08367324, + // -3.09395337, -1.08109772, 122.71524811, + // -1.54944515, 1.07537961 + VCMP_U32(2, v4, 0xbf550705, 0x3f7b51af, 0x4118e5bf, 0xc14b65fc, 0x4072a1e4, + 0x40325faf, 0xc003ca60, 0xbf5b0374, 0xc0580112, 0x415170d6, + 0xc0055ae7, 0xc0460354, 0xbf8a6168, 0x42f56e35, 0xbfc65437, + 0x3f89a60a); + + VSET(16, e64, m1); + double dscalar_64; + // -1436518.0384849868714809, 7616315.8933699131011963, + // -3920170.8619796745479107, -8788296.3276759665459394, + // -4048340.2138868225738406, 7863298.6869412772357464, + // 6686376.3073008488863707, 7004262.4451152756810188, + // 5533006.3396991230547428, 2002846.6050684414803982, + // -1239975.7277694121003151, 4133787.1656649876385927, + // 2465999.3703419454395771, -4337686.8389181373640895, + // -5741249.6292232554405928, 1762825.0474482532590628 + VLOAD_64(v2, 0xc135eb6609da26f0, 0x415d0dcef92cf900, 0xc14de8956e555998, + 0xc160c3290a7c524f, 0xc14ee2ea1b60a4b6, 0x415dff00abf6d88c, + 0x415981aa13aad12e, 0x415ab8199c7cc4c8, 0x41551b5395bda164, + 0x413e8f9e9ae5c3f0, 0xc132eba7ba4f18a0, 0x414f89cd953482a4, + 0x4142d067af675d68, 0xc1508c05b5b0d5b3, 0xc155e6b06845319e, + 0x413ae6090c259198); + // -181636.6228598635643721 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xc1062c24fb9df3c0); + asm volatile("vfrdiv.vf v4, v2, %[A]" ::[A] "f"(dscalar_64)); + // 0.1264422847425051, -0.0238483573164265, 0.0463338536137523, + // 0.0206680130126992, 0.0448669363895861, -0.0230992907800273, + // -0.0271651810355835, -0.0259322982659703, + // -0.0328278356662322, -0.0906892332144711, 0.1464840148013292, + // -0.0439395197625382, -0.0736563946626949, 0.0418740747326899, + // 0.0316371233773435, -0.1030372373723578 + VCMP_U64(3, v4, 0x3fc02f42c2e6795f, 0xbf986bb42af3122b, 0x3fa7b91223effbc4, + 0x3f9529fedfd9f42e, 0x3fa6f8cc90ee127a, 0xbf97a75729d81370, + 0xbf9bd130708d0e6e, 0xbf9a8dff13d98f11, 0xbfa0cecf612b7be2, + 0xbfb73768dac16680, 0x3fc2bffcfa7aafc4, 0xbfa67f3da0c39bb5, + 0xbfb2db253e37b0f2, 0x3fa57084cb0de853, 0x3fa032bdb47d8bce, + 0xbfba60a5fcc8d2be); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + double dscalar_16; + // -35.5312, -61.8125, -37.3125, 23.5938, 44.4688, 38.1250, + // -93.5000, -23.2031, -62.8125, 27.9844, -26.2344, -10.3594, + // -10.7109, -42.0938, 11.0625, 17.8281 + VLOAD_16(v2, 0xd071, 0xd3ba, 0xd0aa, 0x4de6, 0x518f, 0x50c4, 0xd5d8, 0xcdcd, + 0xd3da, 0x4eff, 0xce8f, 0xc92e, 0xc95b, 0xd143, 0x4988, 0x4c75); + // -17.4844 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xcc5f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfrdiv.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.2830, 0.0000, -0.7412, 0.0000, -0.4585, 0.0000, + // 0.7534, 0.0000, -0.6250, 0.0000, 1.6875, 0.0000, 0.4153, + // 0.0000, -0.9810 + VCMP_U16(4, v4, 0x0, 0x3486, 0x0, 0xb9ed, 0x0, 0xb756, 0x0, 0x3a07, 0x0, + 0xb8ff, 0x0, 0x3ec0, 0x0, 0x36a5, 0x0, 0xbbd8); + + VSET(16, e32, m1); + double dscalar_32; + // 981163.06250000, -831670.37500000, -85439.06250000, + // 64225.75781250, -215361.43750000, -292944.75000000, + // 396490.21875000, 954345.93750000, 241910.40625000, + // -62372.83593750, 391838.50000000, 263890.03125000, + // 755217.06250000, -6653.31689453, 526939.25000000, + // -759232.75000000 + VLOAD_32(v2, 0x496f8ab1, 0xc94b0b66, 0xc7a6df88, 0x477ae1c2, 0xc852505c, + 0xc88f0a18, 0x48c19947, 0x4968fe9f, 0x486c3d9a, 0xc773a4d6, + 0x48bf53d0, 0x4880da41, 0x49386111, 0xc5cfea89, 0x4900a5b4, + 0xc9395c0c); + // -816463.43750000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc94754f7); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfrdiv.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, 0.98171520, 0.00000000, -12.71239853, + // 0.00000000, 2.78709030, 0.00000000, -0.85552144, + // 0.00000000, 13.09004879, 0.00000000, -3.09395337, + // 0.00000000, 122.71524811, 0.00000000, 1.07537961 + VCMP_U32(5, v4, 0x0, 0x3f7b51af, 0x0, 0xc14b65fc, 0x0, 0x40325faf, 0x0, + 0xbf5b0374, 0x0, 0x415170d6, 0x0, 0xc0460354, 0x0, 0x42f56e35, 0x0, + 0x3f89a60a); + + VSET(16, e64, m1); + double dscalar_64; + // -1436518.0384849868714809, 7616315.8933699131011963, + // -3920170.8619796745479107, -8788296.3276759665459394, + // -4048340.2138868225738406, 7863298.6869412772357464, + // 6686376.3073008488863707, 7004262.4451152756810188, + // 5533006.3396991230547428, 2002846.6050684414803982, + // -1239975.7277694121003151, 4133787.1656649876385927, + // 2465999.3703419454395771, -4337686.8389181373640895, + // -5741249.6292232554405928, 1762825.0474482532590628 + VLOAD_64(v2, 0xc135eb6609da26f0, 0x415d0dcef92cf900, 0xc14de8956e555998, + 0xc160c3290a7c524f, 0xc14ee2ea1b60a4b6, 0x415dff00abf6d88c, + 0x415981aa13aad12e, 0x415ab8199c7cc4c8, 0x41551b5395bda164, + 0x413e8f9e9ae5c3f0, 0xc132eba7ba4f18a0, 0x414f89cd953482a4, + 0x4142d067af675d68, 0xc1508c05b5b0d5b3, 0xc155e6b06845319e, + 0x413ae6090c259198); + // -181636.6228598635643721 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xc1062c24fb9df3c0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfrdiv.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, -0.0238483573164265, 0.0000000000000000, + // 0.0206680130126992, 0.0000000000000000, + // -0.0230992907800273, 0.0000000000000000, + // -0.0259322982659703, 0.0000000000000000, + // -0.0906892332144711, 0.0000000000000000, + // -0.0439395197625382, 0.0000000000000000, + // 0.0418740747326899, 0.0000000000000000, -0.1030372373723578 + VCMP_U64(6, v4, 0x0, 0xbf986bb42af3122b, 0x0, 0x3f9529fedfd9f42e, 0x0, + 0xbf97a75729d81370, 0x0, 0xbf9a8dff13d98f11, 0x0, 0xbfb73768dac16680, + 0x0, 0xbfa67f3da0c39bb5, 0x0, 0x3fa57084cb0de853, 0x0, + 0xbfba60a5fcc8d2be); +}; + +int main(void) { + enable_vec(); + enable_fp(); + // Change RM to RTZ since there are issues with FDIV + RNE in fpnew + // Update: there are issues also with RTZ... + CHANGE_RM(RM_RTZ); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfrec7.c b/apps/riscv-tests/isa/rv64uv/vfrec7.c new file mode 100644 index 0000000..fe3bd7d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfrec7.c @@ -0,0 +1,121 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot +// Shafiullah Khan + +#include "float_macros.h" +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, mInfh, pInfh, qNaNh, sNaNh, pZero, mZeroh, 0xba72, 0x3a12, + 0x3af7, 0x00fe, 0x01e6, 0x75e6, 0x80fe, 0xb5fd, 0xb4e7, 0x7bc0); + asm volatile("vfrec7.v v1, v2"); + VCMP_U16(1, v1, mZeroh, pZero, qNaNh, qNaNh, pInfh, mInfh, 0xbcf8, 0x3d40, + 0x3c98, pInfh, 0x7838, 0x02b8, mInfh, 0xc158, 0xc288, 0x0108); + + VSET(16, e32, m1); + VLOAD_32(v2, mInff, pInff, qNaNf, sNaNf, pZero, mZerof, 0xfe7fca13, + 0x00800000, 0x807ee93e, 0x803ee93e, 0x00200000, 0x00400000, + 0x00800000, 0xff787a12, 0xff000005, 0x800dd27e); + asm volatile("vfrec7.v v1, v2"); + VCMP_U32(2, v1, mZerof, pZero, qNaNf, qNaNf, pInff, mInff, 0x80800000, + 0x7e7f0000, 0xfe810000, 0xff020000, 0x7f7f0000, 0x7eff0000, + 0x7e7f0000, 0x80210000, 0x803fc000, mInff); + VSET(16, e64, m1); + VLOAD_64(v2, mInfd, pInfd, qNaNd, sNaNd, pZero, mZerod, 0xffee384e0c3fbf7c, + 0xffdfa4dc68d2ae1a, 0xffcf49b8d1aa1fda, 0x800f47ea9ea8e436, + 0x800747ea961ff344, 0x00060000005e7fcf, 0x000bffffd07b5869, + 0x7fbfffff9bfec946, 0x7fdc709c2bde6967, 0x000347ea91db7acb); + asm volatile("vfrec7.v v1, v2"); + VCMP_U64(3, v1, mZerod, pZero, qNaNd, qNaNd, pInfd, mInfd, 0x8004400000000000, + 0x8008100000000000, 0x8010600000000000, 0xffd0c00000000000, + 0xffe1a00000000000, 0x7fe5400000000000, 0x7fd5600000000000, + 0x0020000000000000, 0x0009000000000000, pInfd); +}; +// Test to check DZ flag +void TEST_CASE2(void) { + CLEAR_FFLAGS; + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, pZero, mZeroh, pZero, mZeroh, pZero, mZeroh, pZero, mZeroh, + pZero, mZeroh, pZero, mZeroh, pZero, mZeroh, pZero, mZeroh); + asm volatile("vfrec7.v v1, v2"); + VCMP_U16(4, v1, pInfh, mInfh, pInfh, mInfh, pInfh, mInfh, pInfh, mInfh, pInfh, + mInfh, pInfh, mInfh, pInfh, mInfh, pInfh, mInfh); + CHECK_FFLAGS(DZ); + + CLEAR_FFLAGS; + VSET(16, e32, m1); + CHECK_FFLAGS(0); + VLOAD_32(v2, pZero, mZerof, pZero, mZerof, pZero, mZerof, pZero, mZerof, + pZero, mZerof, pZero, mZerof, pZero, mZerof, pZero, mZerof); + asm volatile("vfrec7.v v1, v2"); + VCMP_U32(5, v1, pInff, mInff, pInff, mInff, pInff, mInff, pInff, mInff, pInff, + mInff, pInff, mInff, pInff, mInff, pInff, mInff); + CHECK_FFLAGS(DZ); + + CLEAR_FFLAGS; + VSET(16, e64, m1); + CHECK_FFLAGS(0); + VLOAD_64(v2, pZero, mZerod, pZero, mZerod, pZero, mZerod, pZero, mZerod, + pZero, mZerod, pZero, mZerod, pZero, mZerod, pZero, mZerod); + asm volatile("vfrec7.v v1, v2"); + VCMP_U64(6, v1, pInfd, mInfd, pInfd, mInfd, pInfd, mInfd, pInfd, mInfd, pInfd, + mInfd, pInfd, mInfd, pInfd, mInfd, pInfd, mInfd); + CHECK_FFLAGS(DZ); +}; +// Test to check NX,OF flags as well as for subnormal numbers with sig=00.. +void TEST_CASE3(void) { + CLEAR_FFLAGS; + VSET(16, e16, m1); + CHECK_FFLAGS(0); + CHANGE_RM(RM_RUP); + VLOAD_16(v2, 0x80fe, 0x807e, 0x803e, 0x801e, 0x800e, 0x8006, 0x8002, 0x8030, + 0x00fe, 0x007e, 0x003e, 0x001e, 0x000e, 0x0006, 0x0002, 0x0030); + asm volatile("vfrec7.v v1, v2"); + VCMP_U16(7, v1, mMaxh, mMaxh, mMaxh, mMaxh, mMaxh, mMaxh, mMaxh, mMaxh, pInfh, + pInfh, pInfh, pInfh, pInfh, pInfh, pInfh, pInfh); + CHECK_FFLAGS(NX | OF); + + CLEAR_FFLAGS; + VSET(16, e32, m1); + CHECK_FFLAGS(0); + CHANGE_RM(RM_RDN); + VLOAD_32(v2, 0x800dd27e, 0x8005d27e, 0x8005d27c, 0x8001d27c, 0x8000d27c, + 0x8000527c, 0x8000127c, 0x8000107c, 0x000dd27e, 0x0005d27e, + 0x0005d27c, 0x0001d27c, 0x0000d27c, 0x0000527c, 0x0000127c, + 0x0000107c); + asm volatile("vfrec7.v v1, v2"); + VCMP_U32(8, v1, mInff, mInff, mInff, mInff, mInff, mInff, mInff, mInff, pMaxf, + pMaxf, pMaxf, pMaxf, pMaxf, pMaxf, pMaxf, pMaxf); + CHECK_FFLAGS(NX | OF); + + CLEAR_FFLAGS; + VSET(16, e64, m1); + CHECK_FFLAGS(0); + CHANGE_RM(RM_RTZ); + VLOAD_64(v2, 0x000147ea91db7acb, 0x000347ea91db7acb, 0x000047ea91db7acb, + 0x000347ea91db70cb, 0x000347ea91db7a0b, 0x000347ea91db7ac0, + 0x000347ea91db0acb, 0x000348e91db7acb, 0x800147ea91db7acb, + 0x800347ea91db7acb, 0x800047ea91db7acb, 0x800347ea91db70cb, + 0x800347ea91db7a0b, 0x800347ea91db7ac0, 0x800347ea91db0acb, + 0x800147ea91db7a0b); + asm volatile("vfrec7.v v1, v2"); + VCMP_U64(9, v1, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, pMaxd, mMaxd, + mMaxd, mMaxd, mMaxd, mMaxd, mMaxd, mMaxd, mMaxd); + CHECK_FFLAGS(NX | OF); +}; +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfredmax.c b/apps/riscv-tests/isa/rv64uv/vfredmax.c new file mode 100644 index 0000000..ddfb104 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfredmax.c @@ -0,0 +1,348 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Xiaorui Yin +// Date: 2022/05/03 + +#include "float_macros.h" +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U16(1, v1, 0x4800); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U32(2, v1, 0x41000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U64(3, v1, 0x4020000000000000); + + // Super lang vector length + VSET(64, e32, m1); + VLOAD_32( + v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, + 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U32(4, v1, 0x41000000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredmax.vs v1, v2, v3, v0.t"); + VCMP_U16(5, v1, 0x4800); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredmax.vs v1, v2, v3, v0.t"); + VCMP_U32(6, v1, 0x41000000); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredmax.vs v1, v2, v3, v0.t"); + VCMP_U64(7, v1, 0x4020000000000000); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U16(8, v1, 0x4800, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U32(9, v1, 0x41000000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U64(10, v1, 0x4020000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U64(11, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(3, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U64(12, v1, 0x4008000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(7, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U64(13, v1, 0x401C000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(15, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmax.vs v1, v2, v3"); + VCMP_U64(14, v1, 0x4020000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(7, e16, m1); + VLOAD_8(v0, 0x00, 0xff); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredmax.vs v1, v2, v3, v0.t"); + VCMP_U16(15, v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(1, e32, m1); + VLOAD_8(v0, 0xff, 0x00); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredmax.vs v1, v2, v3, v0.t"); + VCMP_U32(16, v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(3, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmax.vs v1, v2, v3, v0.t"); + VCMP_U64(17, v1, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfredmin.c b/apps/riscv-tests/isa/rv64uv/vfredmin.c new file mode 100644 index 0000000..5823797 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfredmin.c @@ -0,0 +1,348 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Xiaorui Yin +// Date: 2022/05/03 + +#include "float_macros.h" +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U16(1, v1, 0x3c00); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U32(2, v1, 0x3F800000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U64(3, v1, 0x3FF0000000000000); + + // Super lang vector length + VSET(64, e32, m1); + VLOAD_32( + v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, + 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U32(4, v1, 0x3F800000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredmin.vs v1, v2, v3, v0.t"); + VCMP_U16(5, v1, 0x3c00); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredmin.vs v1, v2, v3, v0.t"); + VCMP_U32(6, v1, 0x3F800000); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredmin.vs v1, v2, v3, v0.t"); + VCMP_U64(7, v1, 0x3FF0000000000000); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U16(8, v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U32(9, v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U64(10, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U64(11, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(3, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U64(12, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(7, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U64(13, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(15, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmin.vs v1, v2, v3"); + VCMP_U64(14, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(7, e16, m1); + VLOAD_8(v0, 0x00, 0xff); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredmin.vs v1, v2, v3, v0.t"); + VCMP_U16(15, v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(1, e32, m1); + VLOAD_8(v0, 0xff, 0x00); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredmin.vs v1, v2, v3, v0.t"); + VCMP_U32(16, v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(3, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredmin.vs v1, v2, v3, v0.t"); + VCMP_U64(17, v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfredosum.c b/apps/riscv-tests/isa/rv64uv/vfredosum.c new file mode 100644 index 0000000..c193b6e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfredosum.c @@ -0,0 +1,348 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Xiaorui Yin +// Date: 2022/05/03 + +#include "float_macros.h" +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U16(1, v1, 0x5490); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U32(2, v1, 0x42920000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U64(3, v1, 0x4052400000000000); + + // Super lang vector length + VSET(64, e32, m1); + VLOAD_32( + v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, + 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U32(4, v1, 0x43908000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredosum.vs v1, v2, v3, v0.t"); + VCMP_U16(5, v1, 0x50A0); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredosum.vs v1, v2, v3, v0.t"); + VCMP_U32(6, v1, 0x42140000); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredosum.vs v1, v2, v3, v0.t"); + VCMP_U64(7, v1, 0x4042800000000000); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U16(8, v1, 0x5490, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U32(9, v1, 0x42920000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U64(10, v1, 0x4052400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U64(11, v1, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(3, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U64(12, v1, 0x401C000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(7, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U64(13, v1, 0x403d000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(15, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredosum.vs v1, v2, v3"); + VCMP_U64(14, v1, 0x4050400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(7, e16, m1); + VLOAD_8(v0, 0x00, 0xff); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredosum.vs v1, v2, v3, v0.t"); + VCMP_U16(15, v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(1, e32, m1); + VLOAD_8(v0, 0xff, 0x00); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredosum.vs v1, v2, v3, v0.t"); + VCMP_U32(16, v1, 0x40000000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(3, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredosum.vs v1, v2, v3, v0.t"); + VCMP_U64(17, v1, 0x4008000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfredusum.c b/apps/riscv-tests/isa/rv64uv/vfredusum.c new file mode 100644 index 0000000..9bf6b68 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfredusum.c @@ -0,0 +1,348 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Xiaorui Yin +// Date: 2022/05/03 + +#include "float_macros.h" +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_U16(1, v1, 0x5490); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F32(2, v1, 0x42920000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F64(3, v1, 0x4052400000000000); + + // Super lang vector length + VSET(64, e32, m1); + VLOAD_32( + v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, + 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000, + + 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, + 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, + 0x40A00000, 0x40C00000, 0x40E00000, 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F32(4, v1, 0x43908000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00); + asm volatile("vfredsum.vs v1, v2, v3, v0.t"); + VCMP_U16(5, v1, 0x50A0); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000); + asm volatile("vfredsum.vs v1, v2, v3, v0.t"); + VCMP_F32(6, v1, 0x42140000); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000); + asm volatile("vfredsum.vs v1, v2, v3, v0.t"); + VCMP_F64(7, v1, 0x4042800000000000); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_U16(8, v1, 0x5490, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F32(9, v1, 0x42920000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F64(10, v1, 0x4052400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F64(11, v1, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(3, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F64(12, v1, 0x401C000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(7, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F64(13, v1, 0x403d000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3ff0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(15, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredsum.vs v1, v2, v3"); + VCMP_F64(14, v1, 0x4050400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(7, e16, m1); + VLOAD_8(v0, 0x00, 0xff); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v2, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v3, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_16(v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfredsum.vs v1, v2, v3, v0.t"); + VCMP_U16(15, v1, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, + 0x4800); + + VSET(1, e32, m1); + VLOAD_8(v0, 0xff, 0x00); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v3, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v1, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfredsum.vs v1, v2, v3, v0.t"); + VCMP_F32(16, v1, 0x40000000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(3, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v3, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v1, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfredsum.vs v1, v2, v3, v0.t"); + VCMP_F64(17, v1, 0x4008000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfrsqrt7.c b/apps/riscv-tests/isa/rv64uv/vfrsqrt7.c new file mode 100644 index 0000000..268f9cd --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfrsqrt7.c @@ -0,0 +1,71 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot +// Shafiullah Khan + +#include "float_macros.h" +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, mInfh, pInfh, qNaNh, sNaNh, pZero, mZeroh, 0x3a12, 0x0001, + 0x3af7, 0x00fe, 0x01e6, 0x75e6, 0x80fe, 0x35fd, 0x20a7, 0x7bc0); + asm volatile("vfrsqrt7.v v1, v2"); + VCMP_U16(1, v1, qNaNh, pZero, qNaNh, qNaNh, pInfh, mInfh, 0x3c98, 0x6bf8, + 0x3c48, 0x5c00, 0x59d0, 0x1e98, qNaNh, 0x3e90, 0x4940, 0x1c10); + VSET(16, e32, m1); + VLOAD_32(v2, mInff, pInff, qNaNf, 0xfe7fca13, 0x00800000, 0x00200000, + 0x003f3cde, 0x00400000, 0x7f787a12, 0x7f000005, 0x7ef0f42d, + 0x7f765432, 0x00718abc, 0x00e50000, 0x001ee941, 0x00000001); + asm volatile("vfrsqrt7.v v1, v2"); + VCMP_U32(2, v1, qNaNf, pZero, qNaNf, qNaNf, 0x5eff0000, 0x5f7f0000, + 0x5f360000, 0x5f340000, 0x1f820000, 0x1fb40000, 0x1fbb0000, + 0x1f820000, 0x5f080000, 0x5ebf0000, 0x5f820000, 0x64b40000); + VSET(16, e64, m1); + VLOAD_64(v2, mInfd, pInfd, qNaNd, sNaNd, pZero, mZerod, 0xffee384e0c3fbf7c, + 0x00060000005e7fcf, 0x000bffffd07b5869, 0x7fbfffff9bfec946, + 0x7fdc709c2bde6967, 0x000347ea91db7acb, 0x7fd5600000000000, + 0x000000000000001, 0x000000000000ded, 0x7fdc000000006967); + asm volatile("vfrsqrt7.v v1, v2"); + VCMP_U64(3, v1, qNaNd, pZero, qNaNd, qNaNd, pInfd, mInfd, qNaNd, + 0x5fea000000000000, 0x5fe2800000000000, 0x2006a00000000000, + 0x1ff8000000000000, 0x5ff1c00000000000, 0x1ffba00000000000, + 0x617fe00000000000, 0x6121200000000000, 0x1ff8200000000000); +}; +// Exceptions check +void TEST_CASE2(void) { + // Invalid operation + CLEAR_FFLAGS; + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, mInfh, sNaNh, 0xba12, 0x8001, 0xbaf7, 0x80fe, 0x81e6, 0xf5e6, + 0x80ff, 0xb5fd, 0xa0a7, 0xfbc0, mInfh, sNaNh, mInfh, sNaNh); + asm volatile("vfrsqrt7.v v1, v2"); + VCMP_U16(4, v1, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, + qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh, qNaNh); + CHECK_FFLAGS(NV); + + // Divide by zero + CLEAR_FFLAGS; + VSET(16, e32, m1); + CHECK_FFLAGS(0); + VLOAD_32(v2, pZero, mZerof, pZero, mZerof, pZero, mZerof, pZero, mZerof, + pZero, mZerof, pZero, mZerof, pZero, mZerof, pZero, mZerof); + asm volatile("vfrsqrt7.v v1, v2"); + VCMP_U32(5, v1, pInff, mInff, pInff, mInff, pInff, mInff, pInff, mInff, pInff, + mInff, pInff, mInff, pInff, mInff, pInff, mInff); + CHECK_FFLAGS(DZ); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfrsub.c b/apps/riscv-tests/isa/rv64uv/vfrsub.c new file mode 100644 index 0000000..4dcf3d7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfrsub.c @@ -0,0 +1,167 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values (vector-scalar) +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.0273, -0.8511, 0.7173, 0.9551, -0.7842, -0.6509, -0.5771, + // 0.6060, -0.5361, 0.6099, 0.2859, 0.6318, -0.9521, 0.3818, + // 0.2783, -0.7905 + VLOAD_16(v2, 0xa700, 0xbacf, 0x39bd, 0x3ba4, 0xba46, 0xb935, 0xb89e, 0x38d9, + 0xb84a, 0x38e1, 0x3493, 0x390e, 0xbb9e, 0x361c, 0x3474, 0xba53); + double dscalar_16; + // 0.3062 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x34e6); + asm volatile("vfrsub.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // 0.3335, 1.1572, -0.4111, -0.6489, 1.0898, 0.9570, 0.8833, + // -0.2998, 0.8423, -0.3037, 0.0203, -0.3257, 1.2578, + // -0.0757, 0.0278, 1.0967 + VCMP_U16(1, v1, 0x3556, 0x3ca1, 0xb694, 0xb931, 0x3c5c, 0x3ba8, 0x3b11, + 0xb4cc, 0x3abd, 0xb4dc, 0x2530, 0xb536, 0x3d08, 0xacd8, 0x2720, + 0x3c63); + + VSET(16, e32, m1); + // 0.61218858, 0.50298065, 0.82400811, -0.50508654, + // -0.08447543, -0.66344708, -0.94741052, 0.85856712, + // -0.16725175, -0.36700448, -0.86911696, 0.82600677, + // -0.95377433, 0.06016647, 0.67027277, 0.08167093 + VLOAD_32(v2, 0x3f1cb864, 0x3f00c357, 0x3f52f232, 0xbf014d5a, 0xbdad0174, + 0xbf29d7ab, 0xbf72897f, 0x3f5bcb0e, 0xbe2b440b, 0xbebbe803, + 0xbf5e7e73, 0x3f53752e, 0xbf742a8e, 0x3d76711d, 0x3f2b96ff, + 0x3da74316); + double dscalar_32; + // -0.78482366 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf48ea34); + asm volatile("vfrsub.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // -1.39701223, -1.28780437, -1.60883176, -0.27973711, + // -0.70034826, -0.12137657, 0.16258687, -1.64339077, + // -0.61757189, -0.41781917, 0.08429331, -1.61083043, + // 0.16895068, -0.84499013, -1.45509648, -0.86649460 + VCMP_U32(2, v1, 0xbfb2d14c, 0xbfa4d6c6, 0xbfcdee33, 0xbe8f39b4, 0xbf334a06, + 0xbdf89448, 0x3e267d2c, 0xbfd25aa1, 0xbf1e1931, 0xbed5ec65, + 0x3daca1f8, 0xbfce2fb1, 0x3e2d0168, 0xbf585146, 0xbfba409a, + 0xbf5dd297); + + VSET(16, e64, m1); + // -0.0920900511004143, 0.2386858516984947, 0.7068975504949517, + // 0.5997172971219242, 0.7714780386644180, -0.1053493184316212, + // 0.8711121216121871, -0.7388672665065719, 0.0889924652556937, + // 0.3266446452514173, -0.5909707717470494, -0.2733520923877579, + // 0.2365505631181986, 0.9616545156279142, -0.9315790291358075, + // -0.8056559777055108 + VLOAD_64(v2, 0xbfb79336adc36440, 0x3fce8d420b880e70, 0x3fe69ee79c9ff24a, + 0x3fe330e2543f7e66, 0x3fe8aff2b634ab34, 0xbfbaf82c4551d810, + 0x3febe026872f2710, 0xbfe7a4ccf737616c, 0x3fb6c835cfdd1640, + 0x3fd4e7bef1312ccc, 0xbfe2e93b89317464, 0xbfd17e99c6464f50, + 0x3fce4749f238b5c0, 0x3feec5dfb0d5860a, 0xbfedcf7ed2f8e31e, + 0xbfe9c7ef0b824e6e); + double dscalar_64; + // -0.4500891854782252 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfdcce42defa6264); + asm volatile("vfrsub.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // -0.3579991343778108, -0.6887750371767198, -1.1569867359731769, + // -1.0498064826001494, -1.2215672241426432, -0.3447398670466040, + // -1.3212013070904123, 0.2887780810283467, -0.5390816507339189, + // -0.7767338307296425, 0.1408815862688242, -0.1767370930904673, + // -0.6866397485964237, -1.4117437011061393, 0.4814898436575823, + // 0.3555667922272856 + VCMP_U64(3, v1, 0xbfd6e97533898954, 0xbfe60a71f25f34ce, 0xbff28304860e91be, + 0xbff0cc01e1de57cc, 0xbff38b8a12d8ee33, 0xbfd61037cda5ec60, + 0xbff523a3fb562c21, 0x3fd27b570f746074, 0xbfe140282978d3fa, + 0xbfe8db00e815c798, 0x3fc2086866d10cc8, 0xbfc69f5231682628, + 0xbfe5f8f3ec0b5ea2, 0xbff6968090295b9e, 0x3fded0bac6f763d8, + 0x3fd6c19b380a3a78); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.0273, -0.8511, 0.7173, 0.9551, -0.7842, -0.6509, + // -0.5771, 0.6060, -0.5361, 0.6099, 0.2859, 0.6318, + // -0.9521, 0.3818, 0.2783, -0.7905 + VLOAD_16(v2, 0xa700, 0xbacf, 0x39bd, 0x3ba4, 0xba46, 0xb935, 0xb89e, 0x38d9, + 0xb84a, 0x38e1, 0x3493, 0x390e, 0xbb9e, 0x361c, 0x3474, 0xba53); + double dscalar_16; + // 0.3062 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x34e6); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfrsub.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 1.1572, 0.0000, -0.6489, 0.0000, 0.9570, 0.0000, + // -0.2998, 0.0000, -0.3037, 0.0000, -0.3257, 0.0000, + // -0.0757, 0.0000, 1.0967 + VCMP_U16(4, v1, 0x0, 0x3ca1, 0x0, 0xb931, 0x0, 0x3ba8, 0x0, 0xb4cc, 0x0, + 0xb4dc, 0x0, 0xb536, 0x0, 0xacd8, 0x0, 0x3c63); + + VSET(16, e32, m1); + // 0.61218858, 0.50298065, 0.82400811, -0.50508654, + // -0.08447543, -0.66344708, -0.94741052, 0.85856712, + // -0.16725175, -0.36700448, -0.86911696, 0.82600677, + // -0.95377433, 0.06016647, 0.67027277, 0.08167093 + VLOAD_32(v2, 0x3f1cb864, 0x3f00c357, 0x3f52f232, 0xbf014d5a, 0xbdad0174, + 0xbf29d7ab, 0xbf72897f, 0x3f5bcb0e, 0xbe2b440b, 0xbebbe803, + 0xbf5e7e73, 0x3f53752e, 0xbf742a8e, 0x3d76711d, 0x3f2b96ff, + 0x3da74316); + double dscalar_32; + // -0.78482366 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf48ea34); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfrsub.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, -1.28780437, 0.00000000, -0.27973711, + // 0.00000000, -0.12137657, 0.00000000, -1.64339077, + // 0.00000000, -0.41781917, 0.00000000, -1.61083043, + // 0.00000000, -0.84499013, 0.00000000, -0.86649460 + VCMP_U32(5, v1, 0x0, 0xbfa4d6c6, 0x0, 0xbe8f39b4, 0x0, 0xbdf89448, 0x0, + 0xbfd25aa1, 0x0, 0xbed5ec65, 0x0, 0xbfce2fb1, 0x0, 0xbf585146, 0x0, + 0xbf5dd297); + + VSET(16, e64, m1); + // -0.0920900511004143, 0.2386858516984947, + // 0.7068975504949517, 0.5997172971219242, 0.7714780386644180, + // -0.1053493184316212, 0.8711121216121871, + // -0.7388672665065719, 0.0889924652556937, + // 0.3266446452514173, -0.5909707717470494, + // -0.2733520923877579, 0.2365505631181986, + // 0.9616545156279142, -0.9315790291358075, -0.8056559777055108 + VLOAD_64(v2, 0xbfb79336adc36440, 0x3fce8d420b880e70, 0x3fe69ee79c9ff24a, + 0x3fe330e2543f7e66, 0x3fe8aff2b634ab34, 0xbfbaf82c4551d810, + 0x3febe026872f2710, 0xbfe7a4ccf737616c, 0x3fb6c835cfdd1640, + 0x3fd4e7bef1312ccc, 0xbfe2e93b89317464, 0xbfd17e99c6464f50, + 0x3fce4749f238b5c0, 0x3feec5dfb0d5860a, 0xbfedcf7ed2f8e31e, + 0xbfe9c7ef0b824e6e); + double dscalar_64; + // -0.4500891854782252 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfdcce42defa6264); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfrsub.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, -0.6887750371767198, 0.0000000000000000, + // -1.0498064826001494, 0.0000000000000000, + // -0.3447398670466040, 0.0000000000000000, + // 0.2887780810283467, 0.0000000000000000, + // -0.7767338307296425, 0.0000000000000000, + // -0.1767370930904673, 0.0000000000000000, + // -1.4117437011061393, 0.0000000000000000, 0.3555667922272856 + VCMP_U64(6, v1, 0x0, 0xbfe60a71f25f34ce, 0x0, 0xbff0cc01e1de57cc, 0x0, + 0xbfd61037cda5ec60, 0x0, 0x3fd27b570f746074, 0x0, 0xbfe8db00e815c798, + 0x0, 0xbfc69f5231682628, 0x0, 0xbff6968090295b9e, 0x0, + 0x3fd6c19b380a3a78); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfsgnj.c b/apps/riscv-tests/isa/rv64uv/vfsgnj.c new file mode 100644 index 0000000..b7cbe50 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfsgnj.c @@ -0,0 +1,408 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.3784, 0.9043, -0.4600, -0.6748, 0.4448, 0.8804, 0.1497, + // 0.7285, 0.9927, 0.9922, 0.8965, 0.8672, -0.1860, 0.9336, + // -0.2959, 0.9668 + VLOAD_16(v2, 0x360e, 0x3b3c, 0xb75c, 0xb966, 0x371e, 0x3b0b, 0x30ca, 0x39d4, + 0x3bf1, 0x3bf0, 0x3b2c, 0x3af0, 0xb1f4, 0x3b78, 0xb4bc, 0x3bbc); + // -0.7988, -0.5054, -0.9380, -0.7383, -0.7168, 0.2181, -0.1597, + // 0.1833, 0.0045, -0.2152, 0.1919, -0.6914, 0.1748, -0.8604, + // 0.6084, 0.1591 + VLOAD_16(v3, 0xba64, 0xb80b, 0xbb81, 0xb9e8, 0xb9bc, 0x32fb, 0xb11c, 0x31de, + 0x1c8f, 0xb2e3, 0x3224, 0xb988, 0x3198, 0xbae2, 0x38de, 0x3117); + asm volatile("vfsgnj.vv v1, v2, v3"); + // -0.3784, -0.9043, -0.4600, -0.6748, -0.4448, 0.8804, -0.1497, + // 0.7285, 0.9927, -0.9922, 0.8965, -0.8672, 0.1860, -0.9336, + // 0.2959, 0.9668 + VCMP_U16(1, v1, 0xb60e, 0xbb3c, 0xb75c, 0xb966, 0xb71e, 0x3b0b, 0xb0ca, + 0x39d4, 0x3bf1, 0xbbf0, 0x3b2c, 0xbaf0, 0x31f4, 0xbb78, 0x34bc, + 0x3bbc); + + VSET(16, e32, m1); + // 0.30226409, 0.06318295, -0.82590002, -0.17829193, + // 0.45379546, 0.85831785, -0.43186289, -0.32250872, + // 0.35404092, -0.55081791, 0.09124859, -0.13254598, + // 0.95786512, 0.95395225, 0.19890578, 0.76956910 + VLOAD_32(v2, 0x3e9ac25c, 0x3d816610, 0xbf536e2f, 0xbe369229, 0x3ee857e1, + 0x3f5bbab8, 0xbedd1d22, 0xbea51fdd, 0x3eb544da, 0xbf0d0267, + 0x3dbae08b, 0xbe07ba22, 0x3f7536a6, 0x3f743637, 0x3e4badf5, + 0x3f45027b); + // 0.06560040, 0.31805936, 0.14663234, -0.85004497, + // -0.49171701, 0.32139263, -0.09995110, -0.34368968, + // 0.33917251, 0.07372360, 0.70147520, 0.82915747, + // -0.14581841, -0.19974701, -0.58837658, 0.95794803 + VLOAD_32(v3, 0x3d865981, 0x3ea2d8ad, 0x3e1626ca, 0xbf599c8c, 0xbefbc255, + 0x3ea48d93, 0xbdccb329, 0xbeaff818, 0x3eada805, 0x3d96fc66, + 0x3f3393e1, 0x3f5443aa, 0xbe15516c, 0xbe4c8a7b, 0xbf169fd9, + 0x3f753c15); + asm volatile("vfsgnj.vv v1, v2, v3"); + // 0.30226409, 0.06318295, 0.82590002, -0.17829193, + // -0.45379546, 0.85831785, -0.43186289, -0.32250872, + // 0.35404092, 0.55081791, 0.09124859, 0.13254598, + // -0.95786512, -0.95395225, -0.19890578, 0.76956910 + VCMP_U32(2, v1, 0x3e9ac25c, 0x3d816610, 0x3f536e2f, 0xbe369229, 0xbee857e1, + 0x3f5bbab8, 0xbedd1d22, 0xbea51fdd, 0x3eb544da, 0x3f0d0267, + 0x3dbae08b, 0x3e07ba22, 0xbf7536a6, 0xbf743637, 0xbe4badf5, + 0x3f45027b); + + VSET(16, e64, m1); + // -0.1900636538602862, -0.9484843154859770, 0.5869658512198073, + // 0.4707187701595239, 0.1954104859873083, 0.0486819373954939, + // -0.1899986048192088, -0.1837438621239862, 0.2694105234528963, + // -0.7960262036276018, 0.6381040017115214, 0.2199215324293253, + // 0.4219965521278597, -0.6541697303087526, 0.7254411745966671, + // 0.2439726910863504 + VLOAD_64(v2, 0xbfc854017cbe7d20, 0xbfee59fbc778ffbc, 0x3fe2c86c9bdb73b4, + 0x3fde20419edcb428, 0x3fc90335f74e33c8, 0x3fa8ecd6c20a0480, + 0xbfc851dfd0fdf7f8, 0xbfc784eb3b54e580, 0x3fd13e05a2db6b68, + 0xbfe9790bf1eadde4, 0x3fe46b59155986dc, 0x3fcc266386bc2e10, + 0x3fdb01fdd39a7d9c, 0xbfe4eef55bb6b208, 0x3fe736d06902107a, + 0x3fcf3a7f44aa9f48); + // 0.0713540199640168, 0.3499800646587572, -0.5478360240866667, + // -0.7324007835973676, 0.5646664961108800, + // -0.7430380608733607, -0.5676032662558192, + // -0.7382565525776155, -0.7933198466305424, + // -0.0650991402083496, -0.1766522935757786, + // -0.4663829943595241, -0.1565231028144627, + // -0.0629224333525875, -0.9086692399439535, -0.1206057821437510 + VLOAD_64(v3, 0x3fb24441ce2eff50, 0x3fd66612c8fd8664, 0xbfe187df69e0bb9c, + 0xbfe76fd3c4a3b1e8, 0x3fe211bf78be2e36, 0xbfe7c6f7c1644c86, + 0xbfe229ce53357d20, 0xbfe79fcc34ac1d30, 0xbfe962e04d917824, + 0xbfb0aa5656314cf0, 0xbfc69c8ad7d5ef20, 0xbfddd9380f0bd244, + 0xbfc408f2f3d40a40, 0xbfb01baf416f2160, 0xbfed13d1838e183a, + 0xbfbee005420412c0); + asm volatile("vfsgnj.vv v1, v2, v3"); + // 0.1900636538602862, 0.9484843154859770, -0.5869658512198073, + // -0.4707187701595239, 0.1954104859873083, + // -0.0486819373954939, -0.1899986048192088, + // -0.1837438621239862, -0.2694105234528963, + // -0.7960262036276018, -0.6381040017115214, + // -0.2199215324293253, -0.4219965521278597, + // -0.6541697303087526, -0.7254411745966671, -0.2439726910863504 + VCMP_U64(3, v1, 0x3fc854017cbe7d20, 0x3fee59fbc778ffbc, 0xbfe2c86c9bdb73b4, + 0xbfde20419edcb428, 0x3fc90335f74e33c8, 0xbfa8ecd6c20a0480, + 0xbfc851dfd0fdf7f8, 0xbfc784eb3b54e580, 0xbfd13e05a2db6b68, + 0xbfe9790bf1eadde4, 0xbfe46b59155986dc, 0xbfcc266386bc2e10, + 0xbfdb01fdd39a7d9c, 0xbfe4eef55bb6b208, 0xbfe736d06902107a, + 0xbfcf3a7f44aa9f48); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.3784, 0.9043, -0.4600, -0.6748, 0.4448, 0.8804, 0.1497, + // 0.7285, 0.9927, 0.9922, 0.8965, 0.8672, -0.1860, 0.9336, + // -0.2959, 0.9668 + VLOAD_16(v2, 0x360e, 0x3b3c, 0xb75c, 0xb966, 0x371e, 0x3b0b, 0x30ca, 0x39d4, + 0x3bf1, 0x3bf0, 0x3b2c, 0x3af0, 0xb1f4, 0x3b78, 0xb4bc, 0x3bbc); + // -0.7988, -0.5054, -0.9380, -0.7383, -0.7168, 0.2181, -0.1597, + // 0.1833, 0.0045, -0.2152, 0.1919, -0.6914, 0.1748, -0.8604, + // 0.6084, 0.1591 + VLOAD_16(v3, 0xba64, 0xb80b, 0xbb81, 0xb9e8, 0xb9bc, 0x32fb, 0xb11c, 0x31de, + 0x1c8f, 0xb2e3, 0x3224, 0xb988, 0x3198, 0xbae2, 0x38de, 0x3117); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnj.vv v1, v2, v3, v0.t"); + // 0.0000, -0.9043, 0.0000, -0.6748, 0.0000, 0.8804, 0.0000, + // 0.7285, 0.0000, -0.9922, 0.0000, -0.8672, 0.0000, -0.9336, + // 0.0000, 0.9668 + VCMP_U16(4, v1, 0x0, 0xbb3c, 0x0, 0xb966, 0x0, 0x3b0b, 0x0, 0x39d4, 0x0, + 0xbbf0, 0x0, 0xbaf0, 0x0, 0xbb78, 0x0, 0x3bbc); + + VSET(16, e32, m1); + // 0.30226409, 0.06318295, -0.82590002, -0.17829193, + // 0.45379546, 0.85831785, -0.43186289, -0.32250872, + // 0.35404092, -0.55081791, 0.09124859, -0.13254598, + // 0.95786512, 0.95395225, 0.19890578, 0.76956910 + VLOAD_32(v2, 0x3e9ac25c, 0x3d816610, 0xbf536e2f, 0xbe369229, 0x3ee857e1, + 0x3f5bbab8, 0xbedd1d22, 0xbea51fdd, 0x3eb544da, 0xbf0d0267, + 0x3dbae08b, 0xbe07ba22, 0x3f7536a6, 0x3f743637, 0x3e4badf5, + 0x3f45027b); + // 0.06560040, 0.31805936, 0.14663234, -0.85004497, + // -0.49171701, 0.32139263, -0.09995110, -0.34368968, + // 0.33917251, 0.07372360, 0.70147520, 0.82915747, + // -0.14581841, -0.19974701, -0.58837658, 0.95794803 + VLOAD_32(v3, 0x3d865981, 0x3ea2d8ad, 0x3e1626ca, 0xbf599c8c, 0xbefbc255, + 0x3ea48d93, 0xbdccb329, 0xbeaff818, 0x3eada805, 0x3d96fc66, + 0x3f3393e1, 0x3f5443aa, 0xbe15516c, 0xbe4c8a7b, 0xbf169fd9, + 0x3f753c15); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnj.vv v1, v2, v3, v0.t"); + // 0.00000000, 0.06318295, 0.00000000, -0.17829193, + // 0.00000000, 0.85831785, 0.00000000, -0.32250872, + // 0.00000000, 0.55081791, 0.00000000, 0.13254598, + // 0.00000000, -0.95395225, 0.00000000, 0.76956910 + VCMP_U32(5, v1, 0x0, 0x3d816610, 0x0, 0xbe369229, 0x0, 0x3f5bbab8, 0x0, + 0xbea51fdd, 0x0, 0x3f0d0267, 0x0, 0x3e07ba22, 0x0, 0xbf743637, 0x0, + 0x3f45027b); + + VSET(16, e64, m1); + // -0.1900636538602862, -0.9484843154859770, 0.5869658512198073, + // 0.4707187701595239, 0.1954104859873083, 0.0486819373954939, + // -0.1899986048192088, -0.1837438621239862, 0.2694105234528963, + // -0.7960262036276018, 0.6381040017115214, 0.2199215324293253, + // 0.4219965521278597, -0.6541697303087526, 0.7254411745966671, + // 0.2439726910863504 + VLOAD_64(v2, 0xbfc854017cbe7d20, 0xbfee59fbc778ffbc, 0x3fe2c86c9bdb73b4, + 0x3fde20419edcb428, 0x3fc90335f74e33c8, 0x3fa8ecd6c20a0480, + 0xbfc851dfd0fdf7f8, 0xbfc784eb3b54e580, 0x3fd13e05a2db6b68, + 0xbfe9790bf1eadde4, 0x3fe46b59155986dc, 0x3fcc266386bc2e10, + 0x3fdb01fdd39a7d9c, 0xbfe4eef55bb6b208, 0x3fe736d06902107a, + 0x3fcf3a7f44aa9f48); + // 0.0713540199640168, 0.3499800646587572, -0.5478360240866667, + // -0.7324007835973676, 0.5646664961108800, + // -0.7430380608733607, -0.5676032662558192, + // -0.7382565525776155, -0.7933198466305424, + // -0.0650991402083496, -0.1766522935757786, + // -0.4663829943595241, -0.1565231028144627, + // -0.0629224333525875, -0.9086692399439535, -0.1206057821437510 + VLOAD_64(v3, 0x3fb24441ce2eff50, 0x3fd66612c8fd8664, 0xbfe187df69e0bb9c, + 0xbfe76fd3c4a3b1e8, 0x3fe211bf78be2e36, 0xbfe7c6f7c1644c86, + 0xbfe229ce53357d20, 0xbfe79fcc34ac1d30, 0xbfe962e04d917824, + 0xbfb0aa5656314cf0, 0xbfc69c8ad7d5ef20, 0xbfddd9380f0bd244, + 0xbfc408f2f3d40a40, 0xbfb01baf416f2160, 0xbfed13d1838e183a, + 0xbfbee005420412c0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnj.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, 0.9484843154859770, 0.0000000000000000, + // -0.4707187701595239, 0.0000000000000000, + // -0.0486819373954939, 0.0000000000000000, + // -0.1837438621239862, 0.0000000000000000, + // -0.7960262036276018, 0.0000000000000000, + // -0.2199215324293253, 0.0000000000000000, + // -0.6541697303087526, 0.0000000000000000, -0.2439726910863504 + VCMP_U64(6, v1, 0x0, 0x3fee59fbc778ffbc, 0x0, 0xbfde20419edcb428, 0x0, + 0xbfa8ecd6c20a0480, 0x0, 0xbfc784eb3b54e580, 0x0, 0xbfe9790bf1eadde4, + 0x0, 0xbfcc266386bc2e10, 0x0, 0xbfe4eef55bb6b208, 0x0, + 0xbfcf3a7f44aa9f48); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.9023 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3b38); + // 0.5586, 0.0221, 0.7397, 0.9844, -0.1426, 0.6958, 0.0319, + // 0.3943, -0.5425, 0.9814, 0.7852, -0.7271, -0.1810, -0.7485, + // -0.3499, -0.2178 + VLOAD_16(v2, 0x3878, 0x25a7, 0x39eb, 0x3be0, 0xb090, 0x3991, 0x2816, 0x364f, + 0xb857, 0x3bda, 0x3a48, 0xb9d1, 0xb1cb, 0xb9fd, 0xb599, 0xb2f8); + asm volatile("vfsgnj.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // 0.5586, 0.0221, 0.7397, 0.9844, 0.1426, 0.6958, 0.0319, + // 0.3943, 0.5425, 0.9814, 0.7852, 0.7271, 0.1810, 0.7485, + // 0.3499, 0.2178 + VCMP_U16(7, v1, 0x3878, 0x25a7, 0x39eb, 0x3be0, 0x3090, 0x3991, 0x2816, + 0x364f, 0x3857, 0x3bda, 0x3a48, 0x39d1, 0x31cb, 0x39fd, 0x3599, + 0x32f8); + + VSET(16, e32, m1); + double dscalar_32; + // 0.64529878 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f25324d); + // 0.27794743, 0.64720273, 0.88201439, -0.27750894, + // -0.02381280, -0.27677080, -0.58998328, 0.15329099, + // 0.52908343, -0.63265759, 0.48432603, 0.70191479, + // -0.55785930, 0.34719029, -0.06872076, -0.69960916 + VLOAD_32(v2, 0x3e8e4f20, 0x3f25af14, 0x3f61cbb2, 0xbe8e15a7, 0xbcc31310, + 0xbe8db4e7, 0xbf170925, 0x3e1cf850, 0x3f077203, 0xbf21f5d9, + 0x3ef7f995, 0x3f33b0b0, 0xbf0ecfde, 0x3eb1c2ed, 0xbd8cbd78, + 0xbf331996); + asm volatile("vfsgnj.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // 0.27794743, 0.64720273, 0.88201439, 0.27750894, + // 0.02381280, 0.27677080, 0.58998328, 0.15329099, + // 0.52908343, 0.63265759, 0.48432603, 0.70191479, + // 0.55785930, 0.34719029, 0.06872076, 0.69960916 + VCMP_U32(8, v1, 0x3e8e4f20, 0x3f25af14, 0x3f61cbb2, 0x3e8e15a7, 0x3cc31310, + 0x3e8db4e7, 0x3f170925, 0x3e1cf850, 0x3f077203, 0x3f21f5d9, + 0x3ef7f995, 0x3f33b0b0, 0x3f0ecfde, 0x3eb1c2ed, 0x3d8cbd78, + 0x3f331996); + + VSET(16, e64, m1); + double dscalar_64; + // 0.4863995754678485 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fdf212baf5b0d68); + // 0.4577518787562838, -0.0989909265811582, + // -0.5406373582107198, -0.6896639688670565, + // 0.9053190721589099, -0.7617679756965072, 0.4649312111760273, + // 0.6917063611214438, 0.2205644023843889, 0.1217272698758698, + // -0.3345487709580650, 0.1693366988903542, + // 0.4095982059989967, 0.7157757577569959, + // -0.5339346851091937, 0.4946553559543683 + VLOAD_64(v2, 0x3fdd4bce893c3600, 0xbfb9577828444dc0, 0xbfe14ce6b790591e, + 0xbfe611ba2bf06f2a, 0x3fecf85fb3ebc33c, 0xbfe860673bd8363e, + 0x3fddc16ed6b90158, 0x3fe6227560ee74e0, 0x3fcc3b744f738cd0, + 0x3fbf2984b325f230, 0xbfd5693f3f8ba3fc, 0x3fc5acd32fdf92e8, + 0x3fda36db64d10584, 0x3fe6e7a28fdabfd2, 0xbfe115fe3157cf38, + 0x3fdfa86ef0276044); + asm volatile("vfsgnj.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // 0.4577518787562838, 0.0989909265811582, 0.5406373582107198, + // 0.6896639688670565, 0.9053190721589099, 0.7617679756965072, + // 0.4649312111760273, 0.6917063611214438, 0.2205644023843889, + // 0.1217272698758698, 0.3345487709580650, 0.1693366988903542, + // 0.4095982059989967, 0.7157757577569959, 0.5339346851091937, + // 0.4946553559543683 + VCMP_U64(9, v1, 0x3fdd4bce893c3600, 0x3fb9577828444dc0, 0x3fe14ce6b790591e, + 0x3fe611ba2bf06f2a, 0x3fecf85fb3ebc33c, 0x3fe860673bd8363e, + 0x3fddc16ed6b90158, 0x3fe6227560ee74e0, 0x3fcc3b744f738cd0, + 0x3fbf2984b325f230, 0x3fd5693f3f8ba3fc, 0x3fc5acd32fdf92e8, + 0x3fda36db64d10584, 0x3fe6e7a28fdabfd2, 0x3fe115fe3157cf38, + 0x3fdfa86ef0276044); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 0.9023 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x3b38); + // 0.5586, 0.0221, 0.7397, 0.9844, -0.1426, 0.6958, 0.0319, + // 0.3943, -0.5425, 0.9814, 0.7852, -0.7271, -0.1810, + // -0.7485, -0.3499, -0.2178 + VLOAD_16(v2, 0x3878, 0x25a7, 0x39eb, 0x3be0, 0xb090, 0x3991, 0x2816, 0x364f, + 0xb857, 0x3bda, 0x3a48, 0xb9d1, 0xb1cb, 0xb9fd, 0xb599, 0xb2f8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnj.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.0221, 0.0000, 0.9844, 0.0000, 0.6958, 0.0000, + // 0.3943, 0.0000, 0.9814, 0.0000, 0.7271, 0.0000, 0.7485, + // 0.0000, 0.2178 + VCMP_U16(10, v1, 0x0, 0x25a7, 0x0, 0x3be0, 0x0, 0x3991, 0x0, 0x364f, 0x0, + 0x3bda, 0x0, 0x39d1, 0x0, 0x39fd, 0x0, 0x32f8); + + VSET(16, e32, m1); + double dscalar_32; + // 0.64529878 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f25324d); + // 0.27794743, 0.64720273, 0.88201439, -0.27750894, + // -0.02381280, -0.27677080, -0.58998328, 0.15329099, + // 0.52908343, -0.63265759, 0.48432603, 0.70191479, + // -0.55785930, 0.34719029, -0.06872076, -0.69960916 + VLOAD_32(v2, 0x3e8e4f20, 0x3f25af14, 0x3f61cbb2, 0xbe8e15a7, 0xbcc31310, + 0xbe8db4e7, 0xbf170925, 0x3e1cf850, 0x3f077203, 0xbf21f5d9, + 0x3ef7f995, 0x3f33b0b0, 0xbf0ecfde, 0x3eb1c2ed, 0xbd8cbd78, + 0xbf331996); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnj.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, 0.64720273, 0.00000000, 0.27750894, + // 0.00000000, 0.27677080, 0.00000000, 0.15329099, + // 0.00000000, 0.63265759, 0.00000000, 0.70191479, + // 0.00000000, 0.34719029, 0.00000000, 0.69960916 + VCMP_U32(11, v1, 0x0, 0x3f25af14, 0x0, 0x3e8e15a7, 0x0, 0x3e8db4e7, 0x0, + 0x3e1cf850, 0x0, 0x3f21f5d9, 0x0, 0x3f33b0b0, 0x0, 0x3eb1c2ed, 0x0, + 0x3f331996); + + VSET(16, e64, m1); + double dscalar_64; + // 0.4863995754678485 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fdf212baf5b0d68); + // 0.4577518787562838, -0.0989909265811582, + // -0.5406373582107198, -0.6896639688670565, + // 0.9053190721589099, -0.7617679756965072, + // 0.4649312111760273, 0.6917063611214438, + // 0.2205644023843889, 0.1217272698758698, + // -0.3345487709580650, 0.1693366988903542, + // 0.4095982059989967, 0.7157757577569959, + // -0.5339346851091937, 0.4946553559543683 + VLOAD_64(v2, 0x3fdd4bce893c3600, 0xbfb9577828444dc0, 0xbfe14ce6b790591e, + 0xbfe611ba2bf06f2a, 0x3fecf85fb3ebc33c, 0xbfe860673bd8363e, + 0x3fddc16ed6b90158, 0x3fe6227560ee74e0, 0x3fcc3b744f738cd0, + 0x3fbf2984b325f230, 0xbfd5693f3f8ba3fc, 0x3fc5acd32fdf92e8, + 0x3fda36db64d10584, 0x3fe6e7a28fdabfd2, 0xbfe115fe3157cf38, + 0x3fdfa86ef0276044); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnj.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, 0.0989909265811582, 0.0000000000000000, + // 0.6896639688670565, 0.0000000000000000, 0.7617679756965072, + // 0.0000000000000000, 0.6917063611214438, 0.0000000000000000, + // 0.1217272698758698, 0.0000000000000000, 0.1693366988903542, + // 0.0000000000000000, 0.7157757577569959, 0.0000000000000000, + // 0.4946553559543683 + VCMP_U64(12, v1, 0x0, 0x3fb9577828444dc0, 0x0, 0x3fe611ba2bf06f2a, 0x0, + 0x3fe860673bd8363e, 0x0, 0x3fe6227560ee74e0, 0x0, 0x3fbf2984b325f230, + 0x0, 0x3fc5acd32fdf92e8, 0x0, 0x3fe6e7a28fdabfd2, 0x0, + 0x3fdfa86ef0276044); +}; + +// The sign injection should work with NaNs and special values, and should not +// raise any exceptions +void TEST_CASE5(void) { + CLEAR_FFLAGS; + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, 0x0000, 0x3b3c, 0xb75c, 0x7fff, 0x371e, 0x3b0b, 0x30ca, 0x39d4, + 0x3bf1, 0x3bf0, 0x0000, 0x3af0, 0xb1f4, 0x3b78, 0xb4bc, 0x3bbc); + VLOAD_16(v3, 0x8000, 0xffff, 0xffff, 0xb9e8, 0xb9bc, 0x7fff, 0xb11c, 0x31de, + 0x1c8f, 0xb2e3, 0x7fff, 0xb988, 0x3198, 0xbae2, 0x38de, 0x3117); + asm volatile("vfsgnj.vv v1, v2, v3"); + VCMP_U16(13, v1, 0x8000, 0xbb3c, 0xb75c, 0xffff, 0xb71e, 0x3b0b, 0xb0ca, + 0x39d4, 0x3bf1, 0xbbf0, 0x0000, 0xbaf0, 0x31f4, 0xbb78, 0x34bc, + 0x3bbc); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000000, 0x3d816610, 0xbf536e2f, 0xbe369229, 0x3ee857e1, + 0x7fffffff, 0x80000000, 0xbea51fdd, 0x3eb544da, 0xbf0d0267, + 0x3dbae08b, 0xbe07ba22, 0x3f7536a6, 0x3f743637, 0x3e4badf5, + 0x3f45027b); + VLOAD_32(v3, 0x80000000, 0x7fffffff, 0x3e1626ca, 0xffffffff, 0xbefbc255, + 0x7fffffff, 0xffffffff, 0xbeaff818, 0x3eada805, 0x3d96fc66, + 0x3f3393e1, 0x3f5443aa, 0xbe15516c, 0xbe4c8a7b, 0xbf169fd9, + 0x3f753c15); + asm volatile("vfsgnj.vv v1, v2, v3"); + VCMP_U32(14, v1, 0x80000000, 0x3d816610, 0x3f536e2f, 0xbe369229, 0xbee857e1, + 0x7fffffff, 0x80000000, 0xbea51fdd, 0x3eb544da, 0x3f0d0267, + 0x3dbae08b, 0x3e07ba22, 0xbf7536a6, 0xbf743637, 0xbe4badf5, + 0x3f45027b); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000000, 0xbfee59fbc778ffbc, 0x7fffffffffffffff, + 0x3fde20419edcb428, 0x8000000000000000, 0x3fa8ecd6c20a0480, + 0xbfc851dfd0fdf7f8, 0xbfc784eb3b54e580, 0x3fd13e05a2db6b68, + 0xbfe9790bf1eadde4, 0x3fe46b59155986dc, 0x3fcc266386bc2e10, + 0x3fdb01fdd39a7d9c, 0xbfe4eef55bb6b208, 0x3fe736d06902107a, + 0x3fcf3a7f44aa9f48); + VLOAD_64(v3, 0x8000000000000000, 0x7fffffffffffffff, 0xbfe187df69e0bb9c, + 0xbfe76fd3c4a3b1e8, 0x0000000000000001, 0xbfe7c6f7c1644c86, + 0xbfe229ce53357d20, 0xbfe79fcc34ac1d30, 0xbfe962e04d917824, + 0xbfb0aa5656314cf0, 0xbfc69c8ad7d5ef20, 0xbfddd9380f0bd244, + 0xbfc408f2f3d40a40, 0xbfb01baf416f2160, 0xbfed13d1838e183a, + 0xbfbee005420412c0); + asm volatile("vfsgnj.vv v1, v2, v3"); + VCMP_U64(15, v1, 0x8000000000000000, 0x3fee59fbc778ffbc, 0xffffffffffffffff, + 0xbfde20419edcb428, 0x0000000000000000, 0xbfa8ecd6c20a0480, + 0xbfc851dfd0fdf7f8, 0xbfc784eb3b54e580, 0xbfd13e05a2db6b68, + 0xbfe9790bf1eadde4, 0xbfe46b59155986dc, 0xbfcc266386bc2e10, + 0xbfdb01fdd39a7d9c, 0xbfe4eef55bb6b208, 0xbfe736d06902107a, + 0xbfcf3a7f44aa9f48); + CHECK_FFLAGS(0); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfsgnjn.c b/apps/riscv-tests/isa/rv64uv/vfsgnjn.c new file mode 100644 index 0000000..6312e72 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfsgnjn.c @@ -0,0 +1,350 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.5278, -0.6548, 0.2776, 0.8730, 0.2180, 0.6172, -0.8408, + // 0.9922, 0.4250, 0.7393, 0.2549, 0.4998, 0.4609, -0.6348, + // 0.1127, -0.1804 + VLOAD_16(v2, 0x3839, 0xb93d, 0x3471, 0x3afc, 0x32fa, 0x38f0, 0xbaba, 0x3bf0, + 0x36cd, 0x39ea, 0x3414, 0x37ff, 0x3760, 0xb914, 0x2f36, 0xb1c6); + // -0.6348, -0.4368, -0.1896, 0.9419, -0.6108, -0.3594, -0.5166, + // -0.1266, -0.9233, 0.2368, 0.1243, 0.3745, 0.0945, -0.3088, + // 0.0190, -0.6289 + VLOAD_16(v3, 0xb914, 0xb6fd, 0xb211, 0x3b89, 0xb8e3, 0xb5c0, 0xb822, 0xb00d, + 0xbb63, 0x3394, 0x2ff5, 0x35fe, 0x2e0c, 0xb4f1, 0x24da, 0xb908); + asm volatile("vfsgnjn.vv v1, v2, v3"); + // 0.5278, 0.6548, 0.2776, -0.8730, 0.2180, 0.6172, 0.8408, + // 0.9922, 0.4250, -0.7393, -0.2549, -0.4998, -0.4609, 0.6348, + // -0.1127, 0.1804 + VCMP_U16(1, v1, 0x3839, 0x393d, 0x3471, 0xbafc, 0x32fa, 0x38f0, 0x3aba, + 0x3bf0, 0x36cd, 0xb9ea, 0xb414, 0xb7ff, 0xb760, 0x3914, 0xaf36, + 0x31c6); + + VSET(16, e32, m1); + // -0.64186704, 0.87601262, -0.93132722, 0.53574133, + // 0.17954259, -0.80486834, -0.95272040, -0.45182621, 0.20335940, + // 0.96179944, 0.80393785, 0.06180594, 0.86447370, + // -0.24008171, -0.42264909, -0.01868468 + VLOAD_32(v2, 0xbf245166, 0x3f60425d, 0xbf6e6b76, 0x3f092658, 0x3e37da03, + 0xbf4e0bda, 0xbf73e57c, 0xbee755c4, 0x3e503d72, 0x3f76387d, + 0x3f4dcedf, 0x3d7d283b, 0x3f5d4e26, 0xbe75d7fb, 0xbed86576, + 0xbc99109c); + // 0.32984266, -0.78281105, 0.73037797, 0.99060333, + // 0.44768164, 0.66998041, 0.39474848, -0.39895460, + // -0.06065369, 0.53388232, -0.60164928, -0.09839682, + // -0.38704434, 0.47123700, 0.40912241, -0.54495376 + VLOAD_32(v3, 0x3ea8e123, 0xbf48664e, 0x3f3afa0d, 0x3f7d982e, 0x3ee53687, + 0x3f2b83d6, 0x3eca1c79, 0xbecc43c7, 0xbd787002, 0x3f08ac83, + 0xbf1a05b0, 0xbdc98446, 0xbec62aad, 0x3ef145fa, 0x3ed1787e, + 0xbf0b8217); + asm volatile("vfsgnjn.vv v1, v2, v3"); + // -0.64186704, 0.87601262, -0.93132722, -0.53574133, + // -0.17954259, -0.80486834, -0.95272040, 0.45182621, + // 0.20335940, -0.96179944, 0.80393785, 0.06180594, 0.86447370, + // -0.24008171, -0.42264909, 0.01868468 + VCMP_U32(2, v1, 0xbf245166, 0x3f60425d, 0xbf6e6b76, 0xbf092658, 0xbe37da03, + 0xbf4e0bda, 0xbf73e57c, 0x3ee755c4, 0x3e503d72, 0xbf76387d, + 0x3f4dcedf, 0x3d7d283b, 0x3f5d4e26, 0xbe75d7fb, 0xbed86576, + 0x3c99109c); + + VSET(16, e64, m1); + // 0.3054868811191440, -0.2848737407493320, 0.8796894022735833, + // -0.2053728688878902, -0.3336030943630310, 0.2807217618714037, + // 0.4723331455917303, -0.8582398814993568, 0.8015611350975347, + // 0.0545934239457773, 0.8461592442963186, 0.5731810427237676, + // 0.9004228762726765, -0.5815114412549589, -0.4481603571708770, + // -0.3109452697316515 + VLOAD_64(v2, 0x3fd38d18d8f0e180, 0xbfd23b5f12007bec, 0x3fec266a63ace3f8, + 0xbfca49a87dadf9c0, 0xbfd559c0cb088d3c, 0x3fd1f75868a0d7ec, + 0x3fde3ab4cd4887cc, 0xbfeb76b37be53474, 0x3fe9a663899fa232, + 0x3fabf3ab54d8f940, 0x3feb13bc8d2ebe92, 0x3fe2577fc525f1c0, + 0x3fecd043a2c52a30, 0xbfe29bbde1ce1372, 0xbfdcaea8c75a67f8, + 0xbfd3e686fd15f950); + // -0.8601583185162320, -0.2023208019417544, 0.7046992650654684, + // 0.0669209072111863, -0.9495814052980500, 0.4501419112888980, + // 0.1528430256162707, -0.2750771515266404, -0.5539880061109905, + // -0.7302340801247744, 0.1579280396497211, -0.6128023516491234, + // 0.2706272563647967, -0.7982929669593624, -0.2521632643799878, + // 0.9025785865542095 + VLOAD_64(v3, 0xbfeb866abced1b2e, 0xbfc9e5a5e5d1f648, 0x3fe68ce5791f15e4, + 0x3fb121ba83e404a0, 0xbfee62f88b14a294, 0x3fdccf2004e2dd30, + 0x3fc3905c3a38c700, 0xbfd19add326bc2ac, 0xbfe1ba450e13ef3a, + 0xbfe75e13dc91f006, 0x3fc436fc6ab55e68, 0xbfe39c13ad67d608, + 0x3fd151f4fbdf8d78, 0xbfe98b9db136f3e0, 0xbfd023716370f004, + 0x3fece1ec7cea3f5e); + asm volatile("vfsgnjn.vv v1, v2, v3"); + // 0.3054868811191440, 0.2848737407493320, -0.8796894022735833, + // -0.2053728688878902, 0.3336030943630310, + // -0.2807217618714037, -0.4723331455917303, 0.8582398814993568, + // 0.8015611350975347, 0.0545934239457773, -0.8461592442963186, + // 0.5731810427237676, -0.9004228762726765, 0.5815114412549589, + // 0.4481603571708770, -0.3109452697316515 + VCMP_U64(3, v1, 0x3fd38d18d8f0e180, 0x3fd23b5f12007bec, 0xbfec266a63ace3f8, + 0xbfca49a87dadf9c0, 0x3fd559c0cb088d3c, 0xbfd1f75868a0d7ec, + 0xbfde3ab4cd4887cc, 0x3feb76b37be53474, 0x3fe9a663899fa232, + 0x3fabf3ab54d8f940, 0xbfeb13bc8d2ebe92, 0x3fe2577fc525f1c0, + 0xbfecd043a2c52a30, 0x3fe29bbde1ce1372, 0x3fdcaea8c75a67f8, + 0xbfd3e686fd15f950); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.5278, -0.6548, 0.2776, 0.8730, 0.2180, 0.6172, -0.8408, + // 0.9922, 0.4250, 0.7393, 0.2549, 0.4998, 0.4609, -0.6348, + // 0.1127, -0.1804 + VLOAD_16(v2, 0x3839, 0xb93d, 0x3471, 0x3afc, 0x32fa, 0x38f0, 0xbaba, 0x3bf0, + 0x36cd, 0x39ea, 0x3414, 0x37ff, 0x3760, 0xb914, 0x2f36, 0xb1c6); + // -0.6348, -0.4368, -0.1896, 0.9419, -0.6108, -0.3594, -0.5166, + // -0.1266, -0.9233, 0.2368, 0.1243, 0.3745, 0.0945, -0.3088, + // 0.0190, -0.6289 + VLOAD_16(v3, 0xb914, 0xb6fd, 0xb211, 0x3b89, 0xb8e3, 0xb5c0, 0xb822, 0xb00d, + 0xbb63, 0x3394, 0x2ff5, 0x35fe, 0x2e0c, 0xb4f1, 0x24da, 0xb908); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjn.vv v1, v2, v3, v0.t"); + // 0.0000, 0.6548, 0.0000, -0.8730, 0.0000, 0.6172, 0.0000, + // 0.9922, 0.0000, -0.7393, 0.0000, -0.4998, 0.0000, 0.6348, + // 0.0000, 0.1804 + VCMP_U16(4, v1, 0x0, 0x393d, 0x0, 0xbafc, 0x0, 0x38f0, 0x0, 0x3bf0, 0x0, + 0xb9ea, 0x0, 0xb7ff, 0x0, 0x3914, 0x0, 0x31c6); + + VSET(16, e32, m1); + // -0.64186704, 0.87601262, -0.93132722, 0.53574133, + // 0.17954259, -0.80486834, -0.95272040, -0.45182621, 0.20335940, + // 0.96179944, 0.80393785, 0.06180594, 0.86447370, + // -0.24008171, -0.42264909, -0.01868468 + VLOAD_32(v2, 0xbf245166, 0x3f60425d, 0xbf6e6b76, 0x3f092658, 0x3e37da03, + 0xbf4e0bda, 0xbf73e57c, 0xbee755c4, 0x3e503d72, 0x3f76387d, + 0x3f4dcedf, 0x3d7d283b, 0x3f5d4e26, 0xbe75d7fb, 0xbed86576, + 0xbc99109c); + // 0.32984266, -0.78281105, 0.73037797, 0.99060333, + // 0.44768164, 0.66998041, 0.39474848, -0.39895460, + // -0.06065369, 0.53388232, -0.60164928, -0.09839682, + // -0.38704434, 0.47123700, 0.40912241, -0.54495376 + VLOAD_32(v3, 0x3ea8e123, 0xbf48664e, 0x3f3afa0d, 0x3f7d982e, 0x3ee53687, + 0x3f2b83d6, 0x3eca1c79, 0xbecc43c7, 0xbd787002, 0x3f08ac83, + 0xbf1a05b0, 0xbdc98446, 0xbec62aad, 0x3ef145fa, 0x3ed1787e, + 0xbf0b8217); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjn.vv v1, v2, v3, v0.t"); + // 0.00000000, 0.87601262, 0.00000000, -0.53574133, + // 0.00000000, -0.80486834, 0.00000000, 0.45182621, + // 0.00000000, -0.96179944, 0.00000000, 0.06180594, + // 0.00000000, -0.24008171, 0.00000000, 0.01868468 + VCMP_U32(5, v1, 0x0, 0x3f60425d, 0x0, 0xbf092658, 0x0, 0xbf4e0bda, 0x0, + 0x3ee755c4, 0x0, 0xbf76387d, 0x0, 0x3d7d283b, 0x0, 0xbe75d7fb, 0x0, + 0x3c99109c); + + VSET(16, e64, m1); + // 0.3054868811191440, -0.2848737407493320, 0.8796894022735833, + // -0.2053728688878902, -0.3336030943630310, 0.2807217618714037, + // 0.4723331455917303, -0.8582398814993568, 0.8015611350975347, + // 0.0545934239457773, 0.8461592442963186, 0.5731810427237676, + // 0.9004228762726765, -0.5815114412549589, -0.4481603571708770, + // -0.3109452697316515 + VLOAD_64(v2, 0x3fd38d18d8f0e180, 0xbfd23b5f12007bec, 0x3fec266a63ace3f8, + 0xbfca49a87dadf9c0, 0xbfd559c0cb088d3c, 0x3fd1f75868a0d7ec, + 0x3fde3ab4cd4887cc, 0xbfeb76b37be53474, 0x3fe9a663899fa232, + 0x3fabf3ab54d8f940, 0x3feb13bc8d2ebe92, 0x3fe2577fc525f1c0, + 0x3fecd043a2c52a30, 0xbfe29bbde1ce1372, 0xbfdcaea8c75a67f8, + 0xbfd3e686fd15f950); + // -0.8601583185162320, -0.2023208019417544, 0.7046992650654684, + // 0.0669209072111863, -0.9495814052980500, 0.4501419112888980, + // 0.1528430256162707, -0.2750771515266404, -0.5539880061109905, + // -0.7302340801247744, 0.1579280396497211, -0.6128023516491234, + // 0.2706272563647967, -0.7982929669593624, -0.2521632643799878, + // 0.9025785865542095 + VLOAD_64(v3, 0xbfeb866abced1b2e, 0xbfc9e5a5e5d1f648, 0x3fe68ce5791f15e4, + 0x3fb121ba83e404a0, 0xbfee62f88b14a294, 0x3fdccf2004e2dd30, + 0x3fc3905c3a38c700, 0xbfd19add326bc2ac, 0xbfe1ba450e13ef3a, + 0xbfe75e13dc91f006, 0x3fc436fc6ab55e68, 0xbfe39c13ad67d608, + 0x3fd151f4fbdf8d78, 0xbfe98b9db136f3e0, 0xbfd023716370f004, + 0x3fece1ec7cea3f5e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjn.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, 0.2848737407493320, 0.0000000000000000, + // -0.2053728688878902, 0.0000000000000000, + // -0.2807217618714037, 0.0000000000000000, 0.8582398814993568, + // 0.0000000000000000, 0.0545934239457773, 0.0000000000000000, + // 0.5731810427237676, 0.0000000000000000, 0.5815114412549589, + // 0.0000000000000000, -0.3109452697316515 + VCMP_U64(6, v1, 0x0, 0x3fd23b5f12007bec, 0x0, 0xbfca49a87dadf9c0, 0x0, + 0xbfd1f75868a0d7ec, 0x0, 0x3feb76b37be53474, 0x0, 0x3fabf3ab54d8f940, + 0x0, 0x3fe2577fc525f1c0, 0x0, 0x3fe29bbde1ce1372, 0x0, + 0xbfd3e686fd15f950); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.6143 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb8ea); + // -0.9351, 0.6538, -0.6743, -0.4695, -0.1439, 0.6250, -0.1511, + // -0.7476, 0.8496, 0.6279, 0.5234, 0.2610, 0.6299, -0.0123, + // -0.9995, -0.3872 + VLOAD_16(v2, 0xbb7b, 0x393b, 0xb965, 0xb783, 0xb09b, 0x3900, 0xb0d6, 0xb9fb, + 0x3acc, 0x3906, 0x3830, 0x342d, 0x390a, 0xa24d, 0xbbff, 0xb632); + asm volatile("vfsgnjn.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // 0.9351, 0.6538, 0.6743, 0.4695, 0.1439, 0.6250, 0.1511, + // 0.7476, 0.8496, 0.6279, 0.5234, 0.2610, 0.6299, 0.0123, + // 0.9995, 0.3872 + VCMP_U16(7, v1, 0x3b7b, 0x393b, 0x3965, 0x3783, 0x309b, 0x3900, 0x30d6, + 0x39fb, 0x3acc, 0x3906, 0x3830, 0x342d, 0x390a, 0x224d, 0x3bff, + 0x3632); + + VSET(16, e32, m1); + double dscalar_32; + // 0.56259364 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f100623); + // -0.00813205, -0.38676089, 0.94379848, 0.39548567, + // 0.90217608, 0.57424510, 0.05995686, -0.00974263, + // -0.45620662, -0.36967716, -0.56535333, -0.93745488, + // -0.55570704, 0.04399948, -0.57520008, -0.05702910 + VLOAD_32(v2, 0xbc053c4a, 0xbec60586, 0x3f719cc7, 0x3eca7d19, 0x3f66f503, + 0x3f1301ba, 0x3d759554, 0xbc1f9f8d, 0xbee993ea, 0xbebd4653, + 0xbf10baff, 0xbf6ffd0b, 0xbf0e42d1, 0x3d3438cd, 0xbf134050, + 0xbd699758); + asm volatile("vfsgnjn.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // -0.00813205, -0.38676089, -0.94379848, -0.39548567, + // -0.90217608, -0.57424510, -0.05995686, -0.00974263, + // -0.45620662, -0.36967716, -0.56535333, -0.93745488, + // -0.55570704, -0.04399948, -0.57520008, -0.05702910 + VCMP_U32(8, v1, 0xbc053c4a, 0xbec60586, 0xbf719cc7, 0xbeca7d19, 0xbf66f503, + 0xbf1301ba, 0xbd759554, 0xbc1f9f8d, 0xbee993ea, 0xbebd4653, + 0xbf10baff, 0xbf6ffd0b, 0xbf0e42d1, 0xbd3438cd, 0xbf134050, + 0xbd699758); + + VSET(16, e64, m1); + double dscalar_64; + // 0.1909501680714165 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fc8710e1b8426e8); + // -0.2692390874696449, -0.3268380231167121, 0.8386824891028197, + // -0.5650452268361481, -0.6389787807266418, 0.5318945600667211, + // -0.7817543128402196, -0.5679136293897145, + // -0.0001555883762874, 0.5283267089670276, 0.5439688283816015, + // -0.2866314604291811, -0.0576946087921848, 0.7960283598249005, + // -0.8999056473475127, 0.2142070697411482 + VLOAD_64(v2, 0xbfd13b3694df2b24, 0xbfd4eaea07180958, 0x3fead67ca8cd9566, + 0xbfe214d9ba40b584, 0xbfe47283a0c1e25c, 0x3fe10547bd8d051e, + 0xbfe904219ee4fb76, 0xbfe22c593425cec0, 0xbf2464adf9bfe000, + 0x3fe0e80d6a13bbf4, 0x3fe1683150fe2844, 0xbfd2582b7b231344, + 0xbfad8a25d3d5fd40, 0x3fe9791077845df2, 0xbfeccc06ed9afc1e, + 0x3fcb6b23238e1bc8); + asm volatile("vfsgnjn.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // -0.2692390874696449, -0.3268380231167121, -0.8386824891028197, + // -0.5650452268361481, -0.6389787807266418, -0.5318945600667211, + // -0.7817543128402196, -0.5679136293897145, -0.0001555883762874, + // -0.5283267089670276, -0.5439688283816015, -0.2866314604291811, + // -0.0576946087921848, -0.7960283598249005, -0.8999056473475127, + // -0.2142070697411482 + VCMP_U64(9, v1, 0xbfd13b3694df2b24, 0xbfd4eaea07180958, 0xbfead67ca8cd9566, + 0xbfe214d9ba40b584, 0xbfe47283a0c1e25c, 0xbfe10547bd8d051e, + 0xbfe904219ee4fb76, 0xbfe22c593425cec0, 0xbf2464adf9bfe000, + 0xbfe0e80d6a13bbf4, 0xbfe1683150fe2844, 0xbfd2582b7b231344, + 0xbfad8a25d3d5fd40, 0xbfe9791077845df2, 0xbfeccc06ed9afc1e, + 0xbfcb6b23238e1bc8); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.6143 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb8ea); + // -0.9351, 0.6538, -0.6743, -0.4695, -0.1439, 0.6250, + // -0.1511, -0.7476, 0.8496, 0.6279, 0.5234, 0.2610, 0.6299, + // -0.0123, -0.9995, -0.3872 + VLOAD_16(v2, 0xbb7b, 0x393b, 0xb965, 0xb783, 0xb09b, 0x3900, 0xb0d6, 0xb9fb, + 0x3acc, 0x3906, 0x3830, 0x342d, 0x390a, 0xa24d, 0xbbff, 0xb632); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjn.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.6538, 0.0000, 0.4695, 0.0000, 0.6250, 0.0000, + // 0.7476, 0.0000, 0.6279, 0.0000, 0.2610, 0.0000, 0.0123, + // 0.0000, 0.3872 + VCMP_U16(10, v1, 0x0, 0x393b, 0x0, 0x3783, 0x0, 0x3900, 0x0, 0x39fb, 0x0, + 0x3906, 0x0, 0x342d, 0x0, 0x224d, 0x0, 0x3632); + + VSET(16, e32, m1); + double dscalar_32; + // 0.56259364 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f100623); + // -0.00813205, -0.38676089, 0.94379848, 0.39548567, + // 0.90217608, 0.57424510, 0.05995686, -0.00974263, + // -0.45620662, -0.36967716, -0.56535333, -0.93745488, + // -0.55570704, 0.04399948, -0.57520008, -0.05702910 + VLOAD_32(v2, 0xbc053c4a, 0xbec60586, 0x3f719cc7, 0x3eca7d19, 0x3f66f503, + 0x3f1301ba, 0x3d759554, 0xbc1f9f8d, 0xbee993ea, 0xbebd4653, + 0xbf10baff, 0xbf6ffd0b, 0xbf0e42d1, 0x3d3438cd, 0xbf134050, + 0xbd699758); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjn.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, -0.38676089, 0.00000000, -0.39548567, + // 0.00000000, -0.57424510, 0.00000000, -0.00974263, + // 0.00000000, -0.36967716, 0.00000000, -0.93745488, + // 0.00000000, -0.04399948, 0.00000000, -0.05702910 + VCMP_U32(11, v1, 0x0, 0xbec60586, 0x0, 0xbeca7d19, 0x0, 0xbf1301ba, 0x0, + 0xbc1f9f8d, 0x0, 0xbebd4653, 0x0, 0xbf6ffd0b, 0x0, 0xbd3438cd, 0x0, + 0xbd699758); + + VSET(16, e64, m1); + double dscalar_64; + // 0.1909501680714165 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fc8710e1b8426e8); + // -0.2692390874696449, -0.3268380231167121, + // 0.8386824891028197, -0.5650452268361481, + // -0.6389787807266418, 0.5318945600667211, + // -0.7817543128402196, -0.5679136293897145, + // -0.0001555883762874, 0.5283267089670276, + // 0.5439688283816015, -0.2866314604291811, + // -0.0576946087921848, 0.7960283598249005, + // -0.8999056473475127, 0.2142070697411482 + VLOAD_64(v2, 0xbfd13b3694df2b24, 0xbfd4eaea07180958, 0x3fead67ca8cd9566, + 0xbfe214d9ba40b584, 0xbfe47283a0c1e25c, 0x3fe10547bd8d051e, + 0xbfe904219ee4fb76, 0xbfe22c593425cec0, 0xbf2464adf9bfe000, + 0x3fe0e80d6a13bbf4, 0x3fe1683150fe2844, 0xbfd2582b7b231344, + 0xbfad8a25d3d5fd40, 0x3fe9791077845df2, 0xbfeccc06ed9afc1e, + 0x3fcb6b23238e1bc8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjn.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, -0.3268380231167121, 0.0000000000000000, + // -0.5650452268361481, 0.0000000000000000, + // -0.5318945600667211, 0.0000000000000000, + // -0.5679136293897145, 0.0000000000000000, + // -0.5283267089670276, 0.0000000000000000, + // -0.2866314604291811, 0.0000000000000000, + // -0.7960283598249005, 0.0000000000000000, + // -0.2142070697411482 + VCMP_U64(12, v1, 0x0, 0xbfd4eaea07180958, 0x0, 0xbfe214d9ba40b584, 0x0, + 0xbfe10547bd8d051e, 0x0, 0xbfe22c593425cec0, 0x0, 0xbfe0e80d6a13bbf4, + 0x0, 0xbfd2582b7b231344, 0x0, 0xbfe9791077845df2, 0x0, + 0xbfcb6b23238e1bc8); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfsgnjx.c b/apps/riscv-tests/isa/rv64uv/vfsgnjx.c new file mode 100644 index 0000000..8e9c4d8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfsgnjx.c @@ -0,0 +1,348 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.0371, 0.8374, 0.7183, 0.8086, -0.8940, 0.4626, 0.5449, + // 0.6831, 0.4661, 0.2981, 0.5615, -0.6167, -0.7075, -0.7603, + // 0.8438, -0.2742 + VLOAD_16(v2, 0xa8c1, 0x3ab3, 0x39bf, 0x3a78, 0xbb27, 0x3767, 0x385c, 0x3977, + 0x3775, 0x34c5, 0x387e, 0xb8ef, 0xb9a9, 0xba15, 0x3ac0, 0xb463); + // 0.3516, 0.7925, -0.5034, -0.1672, 0.0703, -0.9731, 0.0361, + // -0.4077, 0.8965, 0.8242, -0.7822, 0.0265, -0.5361, 0.1226, + // -0.9917, 0.5415 + VLOAD_16(v3, 0x35a0, 0x3a57, 0xb807, 0xb15a, 0x2c7f, 0xbbc9, 0x289f, 0xb686, + 0x3b2c, 0x3a98, 0xba42, 0x26cb, 0xb84a, 0x2fd8, 0xbbef, 0x3855); + asm volatile("vfsgnjx.vv v1, v2, v3"); + // -0.0371, 0.8374, -0.7183, -0.8086, -0.8940, -0.4626, 0.5449, + // -0.6831, 0.4661, 0.2981, -0.5615, -0.6167, 0.7075, -0.7603, + // -0.8438, -0.2742 + VCMP_U16(1, v1, 0xa8c1, 0x3ab3, 0xb9bf, 0xba78, 0xbb27, 0xb767, 0x385c, + 0xb977, 0x3775, 0x34c5, 0xb87e, 0xb8ef, 0x39a9, 0xba15, 0xbac0, + 0xb463); + + VSET(16, e32, m1); + // -0.00918692, -0.23372029, 0.42919466, 0.95128548, + // 0.05014091, 0.08194520, 0.65458435, 0.38167605, + // -0.52784044, 0.46330592, 0.66792834, 0.94584799, + // -0.11679628, 0.12139154, 0.61421394, -0.71422517 + VLOAD_32(v2, 0xbc1684ba, 0xbe6f545f, 0x3edbbf67, 0x3f738772, 0x3d4d608d, + 0x3da7d2e2, 0x3f2792d7, 0x3ec36b0b, 0xbf07208d, 0x3eed366f, + 0x3f2afd5a, 0x3f722318, 0xbdef32e4, 0x3df89c21, 0x3f1d3d20, + 0xbf36d776); + // -0.96525091, -0.82903022, -0.98528612, 0.36915505, + // 0.23285799, 0.19133335, 0.78484982, -0.40654737, + // -0.40144378, -0.94419461, 0.60990387, -0.37662670, + // 0.75369638, -0.82297397, 0.24545205, -0.75572032 + VLOAD_32(v3, 0xbf771aaf, 0xbf543b53, 0xbf7c3bb6, 0x3ebd01e4, 0x3e6e7253, + 0x3e43ece4, 0x3f48ebeb, 0xbed026fa, 0xbecd8a0a, 0xbf71b6bd, + 0x3f1c22a9, 0xbec0d537, 0x3f40f23f, 0xbf52ae6c, 0x3e7b57c8, + 0xbf4176e3); + asm volatile("vfsgnjx.vv v1, v2, v3"); + // 0.00918692, 0.23372029, -0.42919466, 0.95128548, + // 0.05014091, 0.08194520, 0.65458435, -0.38167605, + // 0.52784044, -0.46330592, 0.66792834, -0.94584799, + // -0.11679628, -0.12139154, 0.61421394, 0.71422517 + VCMP_U32(2, v1, 0x3c1684ba, 0x3e6f545f, 0xbedbbf67, 0x3f738772, 0x3d4d608d, + 0x3da7d2e2, 0x3f2792d7, 0xbec36b0b, 0x3f07208d, 0xbeed366f, + 0x3f2afd5a, 0xbf722318, 0xbdef32e4, 0xbdf89c21, 0x3f1d3d20, + 0x3f36d776); + + VSET(16, e64, m1); + // -0.4085246287477386, 0.8681744372264055, -0.9782992825101422, + // 0.9959576051606904, -0.7910104167136705, 0.0799315061445605, + // 0.2562329212571202, -0.0401280831920132, -0.6164331117742006, + // 0.0314794700215042, -0.2391312835511448, 0.2944948324466776, + // -0.3469257666022745, 0.3129356083924371, 0.1418123916338592, + // -0.2697778839142546 + VLOAD_64(v2, 0xbfda25447c0540c8, 0x3febc815c1e38a2c, 0xbfef4e3a4c029a38, + 0x3fefdee27bcbc3c2, 0xbfe94ff513d293d6, 0x3fb4766424cf97d0, + 0x3fd0661ec43d4dd0, 0xbfa48bab09ebf660, 0xbfe3b9d1eee7bc0a, + 0x3fa01e13bc79bd60, 0xbfce9bda9926bde0, 0x3fd2d900da8cc448, + 0xbfd63408216c936c, 0x3fd4072312f3290c, 0x3fc226e8901e1378, + 0xbfd1440a752621b8); + // -0.9042358342806300, 0.2953863994960662, -0.4373909703642964, + // 0.1464626280814265, -0.5161207396769107, -0.3525096032632213, + // -0.0692332757289065, -0.9900711773455610, 0.6225050177521096, + // -0.1361158534833962, 0.1558021548512183, 0.9766583762298613, + // 0.2768845956890595, 0.6672273199701737, -0.4444943981200347, + // 0.5095574851608440 + VLOAD_64(v3, 0xbfecef7ffd03691e, 0x3fd2e79c5b6133f0, 0xbfdbfe36b251f164, + 0x3fc2bf4992d91480, 0xbfe0840fa43663a0, 0xbfd68f847062a774, + 0xbfb1b9459f0cf460, 0xbfefaea9bfed2a32, 0x3fe3eb8fa49aeb32, + 0xbfc16c3e8996d300, 0x3fc3f15333ddbc58, 0x3fef40c91128b1ea, + 0x3fd1b87a2ad00b5c, 0x3fe559ed1bc8a0c2, 0xbfdc7298a1cb9174, + 0x3fe04e4b7fc654a0); + asm volatile("vfsgnjx.vv v1, v2, v3"); + // 0.4085246287477386, 0.8681744372264055, 0.9782992825101422, + // 0.9959576051606904, 0.7910104167136705, -0.0799315061445605, + // -0.2562329212571202, 0.0401280831920132, + // -0.6164331117742006, -0.0314794700215042, + // -0.2391312835511448, 0.2944948324466776, + // -0.3469257666022745, 0.3129356083924371, + // -0.1418123916338592, -0.2697778839142546 + VCMP_U64(3, v1, 0x3fda25447c0540c8, 0x3febc815c1e38a2c, 0x3fef4e3a4c029a38, + 0x3fefdee27bcbc3c2, 0x3fe94ff513d293d6, 0xbfb4766424cf97d0, + 0xbfd0661ec43d4dd0, 0x3fa48bab09ebf660, 0xbfe3b9d1eee7bc0a, + 0xbfa01e13bc79bd60, 0xbfce9bda9926bde0, 0x3fd2d900da8cc448, + 0xbfd63408216c936c, 0x3fd4072312f3290c, 0xbfc226e8901e1378, + 0xbfd1440a752621b8); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.0371, 0.8374, 0.7183, 0.8086, -0.8940, 0.4626, 0.5449, + // 0.6831, 0.4661, 0.2981, 0.5615, -0.6167, -0.7075, -0.7603, + // 0.8438, -0.2742 + VLOAD_16(v2, 0xa8c1, 0x3ab3, 0x39bf, 0x3a78, 0xbb27, 0x3767, 0x385c, 0x3977, + 0x3775, 0x34c5, 0x387e, 0xb8ef, 0xb9a9, 0xba15, 0x3ac0, 0xb463); + // 0.3516, 0.7925, -0.5034, -0.1672, 0.0703, -0.9731, 0.0361, + // -0.4077, 0.8965, 0.8242, -0.7822, 0.0265, -0.5361, 0.1226, + // -0.9917, 0.5415 + VLOAD_16(v3, 0x35a0, 0x3a57, 0xb807, 0xb15a, 0x2c7f, 0xbbc9, 0x289f, 0xb686, + 0x3b2c, 0x3a98, 0xba42, 0x26cb, 0xb84a, 0x2fd8, 0xbbef, 0x3855); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjx.vv v1, v2, v3, v0.t"); + // 0.0000, 0.8374, 0.0000, -0.8086, 0.0000, -0.4626, 0.0000, + // -0.6831, 0.0000, 0.2981, 0.0000, -0.6167, 0.0000, + // -0.7603, 0.0000, -0.2742 + VCMP_U16(4, v1, 0x0, 0x3ab3, 0x0, 0xba78, 0x0, 0xb767, 0x0, 0xb977, 0x0, + 0x34c5, 0x0, 0xb8ef, 0x0, 0xba15, 0x0, 0xb463); + + VSET(16, e32, m1); + // -0.00918692, -0.23372029, 0.42919466, 0.95128548, + // 0.05014091, 0.08194520, 0.65458435, 0.38167605, + // -0.52784044, 0.46330592, 0.66792834, 0.94584799, + // -0.11679628, 0.12139154, 0.61421394, -0.71422517 + VLOAD_32(v2, 0xbc1684ba, 0xbe6f545f, 0x3edbbf67, 0x3f738772, 0x3d4d608d, + 0x3da7d2e2, 0x3f2792d7, 0x3ec36b0b, 0xbf07208d, 0x3eed366f, + 0x3f2afd5a, 0x3f722318, 0xbdef32e4, 0x3df89c21, 0x3f1d3d20, + 0xbf36d776); + // -0.96525091, -0.82903022, -0.98528612, 0.36915505, + // 0.23285799, 0.19133335, 0.78484982, -0.40654737, + // -0.40144378, -0.94419461, 0.60990387, -0.37662670, + // 0.75369638, -0.82297397, 0.24545205, -0.75572032 + VLOAD_32(v3, 0xbf771aaf, 0xbf543b53, 0xbf7c3bb6, 0x3ebd01e4, 0x3e6e7253, + 0x3e43ece4, 0x3f48ebeb, 0xbed026fa, 0xbecd8a0a, 0xbf71b6bd, + 0x3f1c22a9, 0xbec0d537, 0x3f40f23f, 0xbf52ae6c, 0x3e7b57c8, + 0xbf4176e3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjx.vv v1, v2, v3, v0.t"); + // 0.00000000, 0.23372029, 0.00000000, 0.95128548, + // 0.00000000, 0.08194520, 0.00000000, -0.38167605, + // 0.00000000, -0.46330592, 0.00000000, -0.94584799, + // 0.00000000, -0.12139154, 0.00000000, 0.71422517 + VCMP_U32(5, v1, 0x0, 0x3e6f545f, 0x0, 0x3f738772, 0x0, 0x3da7d2e2, 0x0, + 0xbec36b0b, 0x0, 0xbeed366f, 0x0, 0xbf722318, 0x0, 0xbdf89c21, 0x0, + 0x3f36d776); + + VSET(16, e64, m1); + // -0.4085246287477386, 0.8681744372264055, -0.9782992825101422, + // 0.9959576051606904, -0.7910104167136705, 0.0799315061445605, + // 0.2562329212571202, -0.0401280831920132, -0.6164331117742006, + // 0.0314794700215042, -0.2391312835511448, 0.2944948324466776, + // -0.3469257666022745, 0.3129356083924371, 0.1418123916338592, + // -0.2697778839142546 + VLOAD_64(v2, 0xbfda25447c0540c8, 0x3febc815c1e38a2c, 0xbfef4e3a4c029a38, + 0x3fefdee27bcbc3c2, 0xbfe94ff513d293d6, 0x3fb4766424cf97d0, + 0x3fd0661ec43d4dd0, 0xbfa48bab09ebf660, 0xbfe3b9d1eee7bc0a, + 0x3fa01e13bc79bd60, 0xbfce9bda9926bde0, 0x3fd2d900da8cc448, + 0xbfd63408216c936c, 0x3fd4072312f3290c, 0x3fc226e8901e1378, + 0xbfd1440a752621b8); + // -0.9042358342806300, 0.2953863994960662, -0.4373909703642964, + // 0.1464626280814265, -0.5161207396769107, -0.3525096032632213, + // -0.0692332757289065, -0.9900711773455610, 0.6225050177521096, + // -0.1361158534833962, 0.1558021548512183, 0.9766583762298613, + // 0.2768845956890595, 0.6672273199701737, -0.4444943981200347, + // 0.5095574851608440 + VLOAD_64(v3, 0xbfecef7ffd03691e, 0x3fd2e79c5b6133f0, 0xbfdbfe36b251f164, + 0x3fc2bf4992d91480, 0xbfe0840fa43663a0, 0xbfd68f847062a774, + 0xbfb1b9459f0cf460, 0xbfefaea9bfed2a32, 0x3fe3eb8fa49aeb32, + 0xbfc16c3e8996d300, 0x3fc3f15333ddbc58, 0x3fef40c91128b1ea, + 0x3fd1b87a2ad00b5c, 0x3fe559ed1bc8a0c2, 0xbfdc7298a1cb9174, + 0x3fe04e4b7fc654a0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjx.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, 0.8681744372264055, 0.0000000000000000, + // 0.9959576051606904, 0.0000000000000000, -0.0799315061445605, + // 0.0000000000000000, 0.0401280831920132, 0.0000000000000000, + // -0.0314794700215042, 0.0000000000000000, 0.2944948324466776, + // 0.0000000000000000, 0.3129356083924371, 0.0000000000000000, + // -0.2697778839142546 + VCMP_U64(6, v1, 0x0, 0x3febc815c1e38a2c, 0x0, 0x3fefdee27bcbc3c2, 0x0, + 0xbfb4766424cf97d0, 0x0, 0x3fa48bab09ebf660, 0x0, 0xbfa01e13bc79bd60, + 0x0, 0x3fd2d900da8cc448, 0x0, 0x3fd4072312f3290c, 0x0, + 0xbfd1440a752621b8); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.9766 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbbd0); + // 0.8535, -0.3750, -0.8066, -0.9097, -0.2216, -0.5645, -0.3149, + // -0.4512, 0.5981, 0.6587, 0.9546, -0.3040, -0.6157, 0.5723, + // 0.8438, -0.1544 + VLOAD_16(v2, 0x3ad4, 0xb600, 0xba74, 0xbb47, 0xb317, 0xb884, 0xb50a, 0xb738, + 0x38c9, 0x3945, 0x3ba3, 0xb4dd, 0xb8ed, 0x3894, 0x3ac0, 0xb0f1); + asm volatile("vfsgnjx.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // -0.8535, 0.3750, 0.8066, 0.9097, 0.2216, 0.5645, 0.3149, + // 0.4512, -0.5981, -0.6587, -0.9546, 0.3040, 0.6157, -0.5723, + // -0.8438, 0.1544 + VCMP_U16(7, v1, 0xbad4, 0x3600, 0x3a74, 0x3b47, 0x3317, 0x3884, 0x350a, + 0x3738, 0xb8c9, 0xb945, 0xbba3, 0x34dd, 0x38ed, 0xb894, 0xbac0, + 0x30f1); + + VSET(16, e32, m1); + double dscalar_32; + // -0.71056527 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf35e79b); + // -0.13350210, -0.18642496, 0.30152589, -0.62076813, + // 0.00040700, -0.59566921, -0.88075870, 0.08096603, 0.94059193, + // -0.29601631, -0.54263371, -0.86016685, -0.57158113, + // 0.85538357, -0.76839548, 0.28374606 + VLOAD_32(v2, 0xbe08b4c6, 0xbe3ee62f, 0x3e9a619a, 0xbf1eeaa9, 0x39d561f4, + 0xbf187dc7, 0xbf617967, 0x3da5d185, 0x3f70caa2, 0xbe978f73, + 0xbf0aea0b, 0xbf5c33e5, 0xbf125324, 0x3f5afa6b, 0xbf44b591, + 0x3e91472a); + asm volatile("vfsgnjx.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // 0.13350210, 0.18642496, -0.30152589, 0.62076813, + // -0.00040700, 0.59566921, 0.88075870, -0.08096603, + // -0.94059193, 0.29601631, 0.54263371, 0.86016685, + // 0.57158113, -0.85538357, 0.76839548, -0.28374606 + VCMP_U32(8, v1, 0x3e08b4c6, 0x3e3ee62f, 0xbe9a619a, 0x3f1eeaa9, 0xb9d561f4, + 0x3f187dc7, 0x3f617967, 0xbda5d185, 0xbf70caa2, 0x3e978f73, + 0x3f0aea0b, 0x3f5c33e5, 0x3f125324, 0xbf5afa6b, 0x3f44b591, + 0xbe91472a); + + VSET(16, e64, m1); + double dscalar_64; + // -0.1599292306617626 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfc4788f9faef060); + // -0.3770377828689853, 0.5963307040587882, + // -0.4228346580189990, -0.8395360297727528, 0.2884308755790033, + // -0.9332093226534830, -0.3077793113682024, + // -0.3241690978469995, 0.9848431705043186, 0.5835571766262024, + // 0.6934128987139432, -0.8499240402166686, 0.9392758702585176, + // 0.8754505566292561, -0.4187493105472220, -0.7967172481248119 + VLOAD_64(v2, 0xbfd8216314b1d540, 0x3fe3152420f10f90, 0xbfdb0fb918f3a4fc, + 0xbfeadd7aa9f60146, 0x3fd275a6c6712e84, 0xbfeddcd9cc23cf06, + 0xbfd3b2a7ff2d8ea0, 0xbfd4bf2fbe681ba4, 0x3fef83d5d32028f6, + 0x3fe2ac80199e9490, 0x3fe630703f533af4, 0xbfeb3293e69a12ae, + 0x3fee0e8c4515d52c, 0x3fec03b0e2bf9ad6, 0xbfdaccc9e88176a4, + 0xbfe97eb52b9b5dac); + asm volatile("vfsgnjx.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // 0.3770377828689853, -0.5963307040587882, 0.4228346580189990, + // 0.8395360297727528, -0.2884308755790033, 0.9332093226534830, + // 0.3077793113682024, 0.3241690978469995, -0.9848431705043186, + // -0.5835571766262024, -0.6934128987139432, 0.8499240402166686, + // -0.9392758702585176, -0.8754505566292561, 0.4187493105472220, + // 0.7967172481248119 + VCMP_U64(9, v1, 0x3fd8216314b1d540, 0xbfe3152420f10f90, 0x3fdb0fb918f3a4fc, + 0x3feadd7aa9f60146, 0xbfd275a6c6712e84, 0x3feddcd9cc23cf06, + 0x3fd3b2a7ff2d8ea0, 0x3fd4bf2fbe681ba4, 0xbfef83d5d32028f6, + 0xbfe2ac80199e9490, 0xbfe630703f533af4, 0x3feb3293e69a12ae, + 0xbfee0e8c4515d52c, 0xbfec03b0e2bf9ad6, 0x3fdaccc9e88176a4, + 0x3fe97eb52b9b5dac); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.9766 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbbd0); + // 0.8535, -0.3750, -0.8066, -0.9097, -0.2216, -0.5645, + // -0.3149, -0.4512, 0.5981, 0.6587, 0.9546, -0.3040, + // -0.6157, 0.5723, 0.8438, -0.1544 + VLOAD_16(v2, 0x3ad4, 0xb600, 0xba74, 0xbb47, 0xb317, 0xb884, 0xb50a, 0xb738, + 0x38c9, 0x3945, 0x3ba3, 0xb4dd, 0xb8ed, 0x3894, 0x3ac0, 0xb0f1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjx.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 0.3750, 0.0000, 0.9097, 0.0000, 0.5645, 0.0000, + // 0.4512, 0.0000, -0.6587, 0.0000, 0.3040, 0.0000, + // -0.5723, 0.0000, 0.1544 + VCMP_U16(10, v1, 0x0, 0x3600, 0x0, 0x3b47, 0x0, 0x3884, 0x0, 0x3738, 0x0, + 0xb945, 0x0, 0x34dd, 0x0, 0xb894, 0x0, 0x30f1); + + VSET(16, e32, m1); + double dscalar_32; + // -0.71056527 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf35e79b); + // -0.13350210, -0.18642496, 0.30152589, -0.62076813, + // 0.00040700, -0.59566921, -0.88075870, 0.08096603, + // 0.94059193, -0.29601631, -0.54263371, -0.86016685, + // -0.57158113, 0.85538357, -0.76839548, 0.28374606 + VLOAD_32(v2, 0xbe08b4c6, 0xbe3ee62f, 0x3e9a619a, 0xbf1eeaa9, 0x39d561f4, + 0xbf187dc7, 0xbf617967, 0x3da5d185, 0x3f70caa2, 0xbe978f73, + 0xbf0aea0b, 0xbf5c33e5, 0xbf125324, 0x3f5afa6b, 0xbf44b591, + 0x3e91472a); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjx.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, 0.18642496, 0.00000000, 0.62076813, + // 0.00000000, 0.59566921, 0.00000000, -0.08096603, + // 0.00000000, 0.29601631, 0.00000000, 0.86016685, + // 0.00000000, -0.85538357, 0.00000000, -0.28374606 + VCMP_U32(11, v1, 0x0, 0x3e3ee62f, 0x0, 0x3f1eeaa9, 0x0, 0x3f187dc7, 0x0, + 0xbda5d185, 0x0, 0x3e978f73, 0x0, 0x3f5c33e5, 0x0, 0xbf5afa6b, 0x0, + 0xbe91472a); + + VSET(16, e64, m1); + double dscalar_64; + // -0.1599292306617626 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfc4788f9faef060); + // -0.3770377828689853, 0.5963307040587882, + // -0.4228346580189990, -0.8395360297727528, + // 0.2884308755790033, -0.9332093226534830, + // -0.3077793113682024, -0.3241690978469995, + // 0.9848431705043186, 0.5835571766262024, 0.6934128987139432, + // -0.8499240402166686, 0.9392758702585176, + // 0.8754505566292561, -0.4187493105472220, -0.7967172481248119 + VLOAD_64(v2, 0xbfd8216314b1d540, 0x3fe3152420f10f90, 0xbfdb0fb918f3a4fc, + 0xbfeadd7aa9f60146, 0x3fd275a6c6712e84, 0xbfeddcd9cc23cf06, + 0xbfd3b2a7ff2d8ea0, 0xbfd4bf2fbe681ba4, 0x3fef83d5d32028f6, + 0x3fe2ac80199e9490, 0x3fe630703f533af4, 0xbfeb3293e69a12ae, + 0x3fee0e8c4515d52c, 0x3fec03b0e2bf9ad6, 0xbfdaccc9e88176a4, + 0xbfe97eb52b9b5dac); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsgnjx.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, -0.5963307040587882, 0.0000000000000000, + // 0.8395360297727528, 0.0000000000000000, 0.9332093226534830, + // 0.0000000000000000, 0.3241690978469995, 0.0000000000000000, + // -0.5835571766262024, 0.0000000000000000, + // 0.8499240402166686, 0.0000000000000000, + // -0.8754505566292561, 0.0000000000000000, 0.7967172481248119 + VCMP_U64(12, v1, 0x0, 0xbfe3152420f10f90, 0x0, 0x3feadd7aa9f60146, 0x0, + 0x3feddcd9cc23cf06, 0x0, 0x3fd4bf2fbe681ba4, 0x0, 0xbfe2ac80199e9490, + 0x0, 0x3feb3293e69a12ae, 0x0, 0xbfec03b0e2bf9ad6, 0x0, + 0x3fe97eb52b9b5dac); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfslide1down.c b/apps/riscv-tests/isa/rv64uv/vfslide1down.c new file mode 100644 index 0000000..db6c325 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfslide1down.c @@ -0,0 +1,107 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +void TEST_CASE1() { + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vfslide1down.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VCMP_U16(1, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0xbb81); + + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vfslide1down.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VCMP_U32(2, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 0xbf75e762); + + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vfslide1down.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VCMP_U64(3, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 0x3fed25da5d7296fe); +} + +void TEST_CASE2() { + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vfslide1down.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VCMP_U16(6, v1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1, 16, -1); + + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfslide1down.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VCMP_U32(7, v1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, + 0xbf75e762); + + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vfslide1down.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VCMP_U64(8, v1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1, 16, -1); +} + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfslide1up.c b/apps/riscv-tests/isa/rv64uv/vfslide1up.c new file mode 100644 index 0000000..90fc5a8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfslide1up.c @@ -0,0 +1,90 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +void TEST_CASE1() { + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vfslide1up.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VCMP_U16(1, v1, 0xbb81, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vfslide1up.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VCMP_U32(2, v1, 0xbf75e762, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15); + + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vfslide1up.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VCMP_U64(3, v1, 0x3fed25da5d7296fe, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15); +} + +void TEST_CASE2() { + double dscalar_16; + // -0.9380 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbb81); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vfslide1up.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VCMP_U16(4, v1, 0xbb81, -1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, + -1); + + double dscalar_32; + // -0.96056187 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf75e762); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vfslide1up.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VCMP_U32(5, v1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15); + + double dscalar_64; + // 0.9108707261227378 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0x3fed25da5d7296fe); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vfslide1up.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VCMP_U64(6, v1, 0x3fed25da5d7296fe, -1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, + 12, -1, 14, -1); +} + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfsqrt.c b/apps/riscv-tests/isa/rv64uv/vfsqrt.c new file mode 100644 index 0000000..12421bd --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfsqrt.c @@ -0,0 +1,142 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -4628.000, 5116.000, -9928.000, 9392.000, -140.875, + // 6112.000, 2598.000, 3210.000, 528.000, -3298.000, + // -3674.000, 368.250, 1712.000, -8584.000, -2080.000, + // 4336.000 + VLOAD_16(v2, 0xec85, 0x6cff, 0xf0d9, 0x7096, 0xd867, 0x6df8, 0x6913, 0x6a45, + 0x6020, 0xea71, 0xeb2d, 0x5dc1, 0x66b0, 0xf031, 0xe810, 0x6c3c); + asm volatile("vfsqrt.v v3, v2"); + // nan, 71.500, nan, 96.938, + // nan, 78.188, 50.969, 56.656, 22.984, nan, + // nan, 19.188, 41.375, nan, nan, 65.875 + VCMP_U16(1, v3, 0x7e00, 0x5478, 0x7e00, 0x560e, 0x7e00, 0x54e2, 0x525f, + 0x5315, 0x4dbe, 0x7e00, 0x7e00, 0x4ccc, 0x512c, 0x7e00, 0x7e00, + 0x541d); + + VSET(16, e32, m1); + // 53688.590, -5719.180, -59560.355, -34640.023, -22323.398, + // -52381.586, 19136.160, 13055.238, -68576.781, + // -35066.488, 62475.219, -25604.578, 54705.039, + // -19827.459, 17792.961, -28415.572 + VLOAD_32(v2, 0x4751b897, 0xc5b2b971, 0xc768a85b, 0xc7075006, 0xc6ae66cc, + 0xc74c9d96, 0x46958052, 0x464bfcf4, 0xc785f064, 0xc708fa7d, + 0x47740b38, 0xc6c80928, 0x4755b10a, 0xc69ae6eb, 0x468b01ec, + 0xc6ddff25); + asm volatile("vfsqrt.v v3, v2"); + // 231.708, nan, nan, nan, nan, nan, 138.334, + // 114.260, nan, nan, 249.950, nan, 233.891, nan, + // 133.390, nan + VCMP_U32(2, v3, 0x4367b53e, 0x7fc00000, 0x7fc00000, 0x7fc00000, 0x7fc00000, + 0x7fc00000, 0x430a5560, 0x42e484e0, 0x7fc00000, 0x7fc00000, + 0x4379f34f, 0x7fc00000, 0x4369e41e, 0x7fc00000, 0x430563e7, + 0x7fc00000); + + VSET(16, e64, m1); + // -2532126.867, -601715.939, -7176821.248, 9617114.284, + // -4651296.040, -9962642.835, 4027953.647, 7849763.850, + // -9544132.585, -8682313.823, 7018932.012, 639358.130, + // -7598169.215, -9585529.793, -4604984.668, 314584.590 + VLOAD_64(v2, 0xc143518f6efce4ae, 0xc1225ce7e096cbf0, 0xc15b609d4fd8b968, + 0x416257db4912ef24, 0xc151be4802974a67, 0xc16300925abc1630, + 0x414ebb18d2c34030, 0x415df1c8f662a87c, 0xc162343892b8d28c, + 0xc1608f693a52837e, 0x415ac66d00c810d8, 0x412382fc427c96a0, + 0xc15cfc164dc9e320, 0xc162486f39607ee9, 0xc151910e2ac0e818, + 0x411333625c861bc0); + asm volatile("vfsqrt.v v3, v2"); + // nan, nan, nan, 3101.147, nan, nan, 2006.976, + // 2801.743, nan, nan, 2649.327, 799.599, nan, nan, + // nan, 560.878 + VCMP_U64(3, v3, 0x7ff8000000000000, 0x7ff8000000000000, 0x7ff8000000000000, + 0x40a83a4b64b82189, 0x7ff8000000000000, 0x7ff8000000000000, + 0x409f5be7acad5998, 0x40a5e37c6ac52c2f, 0x7ff8000000000000, + 0x7ff8000000000000, 0x40a4b2a7466e763d, 0x4088fcca333ab72d, + 0x7ff8000000000000, 0x7ff8000000000000, 0x7ff8000000000000, + 0x40818706fb9cc11b); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -4628.000, 5116.000, -9928.000, 9392.000, -140.875, + // 6112.000, 2598.000, 3210.000, 528.000, -3298.000, + // -3674.000, 368.250, 1712.000, -8584.000, -2080.000, + // 4336.000 + VLOAD_16(v2, 0xec85, 0x6cff, 0xf0d9, 0x7096, 0xd867, 0x6df8, 0x6913, 0x6a45, + 0x6020, 0xea71, 0xeb2d, 0x5dc1, 0x66b0, 0xf031, 0xe810, 0x6c3c); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfsqrt.v v3, v2, v0.t"); + // 0.000, 71.500, 0.000, 96.938, 0.000, 78.188, + // 0.000, 56.656, 0.000, nan, 0.000, 19.188, 0.000, + // nan, 0.000, 65.875 + VCMP_U16(4, v3, 0x0, 0x5478, 0x0, 0x560e, 0x0, 0x54e2, 0x0, 0x5315, 0x0, + 0x7e00, 0x0, 0x4ccc, 0x0, 0x7e00, 0x0, 0x541d); + + VSET(16, e32, m1); + // 53688.590, -5719.180, -59560.355, -34640.023, -22323.398, + // -52381.586, 19136.160, 13055.238, -68576.781, + // -35066.488, 62475.219, -25604.578, 54705.039, + // -19827.459, 17792.961, -28415.572 + VLOAD_32(v2, 0x4751b897, 0xc5b2b971, 0xc768a85b, 0xc7075006, 0xc6ae66cc, + 0xc74c9d96, 0x46958052, 0x464bfcf4, 0xc785f064, 0xc708fa7d, + 0x47740b38, 0xc6c80928, 0x4755b10a, 0xc69ae6eb, 0x468b01ec, + 0xc6ddff25); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfsqrt.v v3, v2, v0.t"); + // 0.000, nan, 0.000, nan, 0.000, nan, 0.000, + // 114.260, 0.000, nan, 0.000, nan, 0.000, nan, + // 0.000, nan + VCMP_U32(5, v3, 0x0, 0x7fc00000, 0x0, 0x7fc00000, 0x0, 0x7fc00000, 0x0, + 0x42e484e0, 0x0, 0x7fc00000, 0x0, 0x7fc00000, 0x0, 0x7fc00000, 0x0, + 0x7fc00000); + + VSET(16, e64, m1); + // -2532126.867, -601715.939, -7176821.248, 9617114.284, + // -4651296.040, -9962642.835, 4027953.647, 7849763.850, + // -9544132.585, -8682313.823, 7018932.012, 639358.130, + // -7598169.215, -9585529.793, -4604984.668, 314584.590 + VLOAD_64(v2, 0xc143518f6efce4ae, 0xc1225ce7e096cbf0, 0xc15b609d4fd8b968, + 0x416257db4912ef24, 0xc151be4802974a67, 0xc16300925abc1630, + 0x414ebb18d2c34030, 0x415df1c8f662a87c, 0xc162343892b8d28c, + 0xc1608f693a52837e, 0x415ac66d00c810d8, 0x412382fc427c96a0, + 0xc15cfc164dc9e320, 0xc162486f39607ee9, 0xc151910e2ac0e818, + 0x411333625c861bc0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vfsqrt.v v3, v2, v0.t"); + // 0.000, nan, 0.000, 3101.147, 0.000, nan, 0.000, + // 2801.743, 0.000, nan, 0.000, 799.599, 0.000, nan, + // 0.000, 560.878 + VCMP_U64(6, v3, 0x0, 0x7ff8000000000000, 0x0, 0x40a83a4b64b82189, 0x0, + 0x7ff8000000000000, 0x0, 0x40a5e37c6ac52c2f, 0x0, 0x7ff8000000000000, + 0x0, 0x4088fcca333ab72d, 0x0, 0x7ff8000000000000, 0x0, + 0x40818706fb9cc11b); +}; + +int main(void) { + enable_vec(); + enable_fp(); + // Change RM to RTZ since there are issues with FDIV + RNE in fpnew + // Update: there are issues also with RTZ... + CHANGE_RM(RM_RTZ); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfsub.c b/apps/riscv-tests/isa/rv64uv/vfsub.c new file mode 100644 index 0000000..195e6bb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfsub.c @@ -0,0 +1,349 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values + 1 subnormal +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -0.2161, 0.7432, 0.7871, 0.7583, -0.4546, -0.0478, 0.1260, + // -0.4824, 0.9282, -0.6221, 0.6543, 0.3025, -0.1420, -0.7236, + // 0.2333, -0.0269 + VLOAD_16(v2, 0xb2ea, 0x39f2, 0x3a4c, 0x3a11, 0xb746, 0xaa1f, 0x3008, 0xb7b8, + 0x3b6d, 0xb8fa, 0x393c, 0x34d7, 0xb08b, 0xb9ca, 0x3377, 0xa6e5); + // -0.3289, -0.8408, -0.1754, -0.8472, 0.7739, -0.9111, -0.3152, + // 0.4519, -0.2537, 0.9287, -0.7163, -0.2318, 0.0615, -0.2563, + // 0.1448, 0.6606 + VLOAD_16(v3, 0xb543, 0xbaba, 0xb19d, 0xbac7, 0x3a31, 0xbb4a, 0xb50b, 0x373b, + 0xb40f, 0x3b6e, 0xb9bb, 0xb36b, 0x2bde, 0xb41a, 0x30a2, 0x3949); + asm volatile("vfsub.vv v1, v2, v3"); + // 0.1128, 1.5840, 0.9624, 1.6055, -1.2285, 0.8633, 0.4412, + // -0.9346, 1.1816, -1.5508, 1.3711, 0.5342, -0.2034, + // -0.4673, 0.0885, -0.6875 + VCMP_U16(1, v1, 0x2f38, 0x3e56, 0x3bb3, 0x3e6c, 0xbcea, 0x3ae8, 0x370f, + 0xbb7a, 0x3cba, 0xbe34, 0x3d7c, 0x3846, 0xb282, 0xb77a, 0x2daa, + 0xb980); + + VSET(16, e32, m1); + // -0.12869358, 0.96847999, -0.85811919, -0.21122381, + // -0.05195865, 0.43910158, 0.86828148, -0.90407801, + // 0.62089461, -0.65907389, 0.91886526, -0.57595438, + // -0.35377914, -0.26657876, 0.49153560, 0.42637765 + VLOAD_32(v2, 0xbe03c840, 0x3f77ee4e, 0xbf5badb3, 0xbe584b0e, 0xbd54d298, + 0x3ee0d1ec, 0x3f5e47b2, 0xbf6771a8, 0x3f1ef2f3, 0xbf28b911, + 0x3f6b3ac1, 0xbf1371bf, 0xbeb5228a, 0xbe887d03, 0x3efbaa8e, + 0x3eda4e2c); + // -0.50821143, -0.56901741, -0.88642830, 0.91128469, + // -0.00441748, 0.72763014, 0.81834352, -0.49977919, + // -0.94507313, -0.60766727, 0.21069343, 0.35644454, + // -0.51639801, -0.74812186, -0.97028691, 0.42650157 + VLOAD_32(v3, 0xbf021a25, 0xbf11ab20, 0xbf62ecf7, 0x3f6949f4, 0xbb90c083, + 0x3f3a45f8, 0x3f517ef6, 0xbeffe30f, 0xbf71f050, 0xbf1b9015, + 0x3e57c005, 0x3eb67fe6, 0xbf0432a9, 0xbf3f84ea, 0xbf7864b9, + 0x3eda5e6a); + asm volatile("vfsub.vv v1, v2, v3"); + // 0.37951785, 1.53749740, 0.02830911, -1.12250853, + // -0.04754117, -0.28852856, 0.04993796, + // -0.40429881, 1.56596780, -0.05140662, 0.70817184, + // -0.93239892, 0.16261888, 0.48154309, 1.46182251, + // -0.00012392 + VCMP_U32(2, v1, 0x3ec2502a, 0x3fc4ccb7, 0x3ce7e880, 0xbf8fae5c, 0xbd42ba88, + 0xbe93ba04, 0x3d4c8bc0, 0xbecf0041, 0x3fc871a2, 0xbd528fc0, + 0x3f354ac0, 0xbf6eb1b2, 0x3e268590, 0x3ef68cd1, 0x3fbb1d00, + 0xb901f000); + + VSET(16, e64, m1); + // -0.5053356652713634, -0.6291854947278097, 0.6181258713941662, + // -0.6097328085365348, 0.8960683065358290, 0.1233825892982841, + // -0.7071646124826323, -0.6783334309218909, 0.3533001486660008, + // 0.4732651306122215, -0.7335080825789513, -0.9296500813876505, + // 0.5349827137885166, -0.0621174552558810, -0.8122743533756343, + // -0.8908485518923974 + VLOAD_64(v2, 0xbfe02bb5b37af91c, 0xbfe422499e5f271a, 0x3fe3c7afe84e61dc, + 0xbfe382ee60fece00, 0x3fecac9770f1b62e, 0x3fbf960059ee92f0, + 0xbfe6a117ae700ba0, 0xbfe5b4e84fb2f9d4, 0x3fd69c783a0c5078, + 0x3fde49f9d4944428, 0xbfe778e5f140e788, 0xbfedbfb18709140c, + 0x3fe11e941174b448, 0xbfafcddbedab64a0, 0xbfe9fe26c8e417ba, + 0xbfec81d4d2822346); + // -0.6041772411195545, 0.1691588460867453, -0.3855578735230800, + // -0.9206749118255901, 0.7025181961160538, -0.9905598942344518, + // 0.9510997049380876, 0.2754176494545910, 0.5271936205102918, + // 0.8778238674058336, 0.9294006140978470, -0.8775508592745904, + // 0.7472392658861982, -0.3880038279796372, -0.6483706997783654, + // -0.1530785884604509 + VLOAD_64(v3, 0xbfe3556b82731260, 0x3fc5a6ff3fe2c608, 0xbfd8acfaee5fcdc0, + 0xbfed762b3b913c28, 0x3fe67b0770a53a4a, 0xbfefb2aaa9ceeb06, + 0x3fee6f68a5fe3800, 0x3fd1a071594983a8, 0x3fe0dec527d80c9a, + 0x3fec172214450060, 0x3fedbda65b4dd79c, 0xbfec14e58a252770, + 0x3fe7e962522895aa, 0xbfd8d50e01f94d70, 0xbfe4bf73e8e77264, + 0xbfc398144593e6c0); + asm volatile("vfsub.vv v1, v2, v3"); + // 0.0988415758481911, -0.7983443408145550, 1.0036837449172462, + // 0.3109421032890554, 0.1935501104197752, 1.1139424835327358, + // -1.6582643174207199, -0.9537510803764819, + // -0.1738934718442910, -0.4045587367936121, + // -1.6629086966767983, -0.0520992221130601, + // -0.2122565520976816, 0.3258863727237562, + // -0.1639036535972689, -0.7377699634319466 + VCMP_U64(3, v1, 0x3fb94dae77c0ca20, 0xbfe98c096e57d89c, 0x3ff00f16afbf245e, + 0x3fd3e679b524dc50, 0x3fc8c6400131ef90, 0x3ff1d2b55a865eb2, + 0xbffa88402a3721d0, 0xbfee8520fc57bba8, 0xbfc642242b479178, + 0xbfd9e44a53f5bc98, 0xbffa9b4626475f92, 0xbfaaacbfce3ec9c0, + 0xbfcb2b3902cf8588, 0x3fd4db528443e0dc, 0xbfc4facb7ff29558, + 0xbfe79bcfc11d2996); +}; + +// Simple random test with similar values + 1 subnormal (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -0.2161, 0.7432, 0.7871, 0.7583, -0.4546, -0.0478, 0.1260, + // -0.4824, 0.9282, -0.6221, 0.6543, 0.3025, -0.1420, -0.7236, + // 0.2333, -0.0269 + VLOAD_16(v2, 0xb2ea, 0x39f2, 0x3a4c, 0x3a11, 0xb746, 0xaa1f, 0x3008, 0xb7b8, + 0x3b6d, 0xb8fa, 0x393c, 0x34d7, 0xb08b, 0xb9ca, 0x3377, 0xa6e5); + // -0.3289, -0.8408, -0.1754, -0.8472, 0.7739, -0.9111, -0.3152, + // 0.4519, -0.2537, 0.9287, -0.7163, -0.2318, 0.0615, -0.2563, + // 0.1448, 0.6606 + VLOAD_16(v3, 0xb543, 0xbaba, 0xb19d, 0xbac7, 0x3a31, 0xbb4a, 0xb50b, 0x373b, + 0xb40f, 0x3b6e, 0xb9bb, 0xb36b, 0x2bde, 0xb41a, 0x30a2, 0x3949); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsub.vv v1, v2, v3, v0.t"); + // 0.0000, 1.5840, 0.0000, 1.6055, 0.0000, 0.8633, 0.0000, + // -0.9346, 0.0000, -1.5508, 0.0000, 0.5342, 0.0000, + // -0.4673, 0.0000, -0.6875 + VCMP_U16(4, v1, 0x0, 0x3e56, 0x0, 0x3e6c, 0x0, 0x3ae8, 0x0, 0xbb7a, 0x0, + 0xbe34, 0x0, 0x3846, 0x0, 0xb77a, 0x0, 0xb980); + + VSET(16, e32, m1); + // -0.12869358, 0.96847999, -0.85811919, -0.21122381, + // -0.05195865, 0.43910158, 0.86828148, -0.90407801, + // 0.62089461, -0.65907389, 0.91886526, -0.57595438, + // -0.35377914, -0.26657876, 0.49153560, 0.42637765 + VLOAD_32(v2, 0xbe03c840, 0x3f77ee4e, 0xbf5badb3, 0xbe584b0e, 0xbd54d298, + 0x3ee0d1ec, 0x3f5e47b2, 0xbf6771a8, 0x3f1ef2f3, 0xbf28b911, + 0x3f6b3ac1, 0xbf1371bf, 0xbeb5228a, 0xbe887d03, 0x3efbaa8e, + 0x3eda4e2c); + // -0.50821143, -0.56901741, -0.88642830, 0.91128469, + // -0.00441748, 0.72763014, 0.81834352, -0.49977919, + // -0.94507313, -0.60766727, 0.21069343, 0.35644454, + // -0.51639801, -0.74812186, -0.97028691, 0.42650157 + VLOAD_32(v3, 0xbf021a25, 0xbf11ab20, 0xbf62ecf7, 0x3f6949f4, 0xbb90c083, + 0x3f3a45f8, 0x3f517ef6, 0xbeffe30f, 0xbf71f050, 0xbf1b9015, + 0x3e57c005, 0x3eb67fe6, 0xbf0432a9, 0xbf3f84ea, 0xbf7864b9, + 0x3eda5e6a); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsub.vv v1, v2, v3, v0.t"); + // 0.00000000, 1.53749740, 0.00000000, -1.12250853, + // 0.00000000, -0.28852856, 0.00000000, -0.40429881, + // 0.00000000, -0.05140662, 0.00000000, -0.93239892, + // 0.00000000, 0.48154309, 0.00000000, -0.00012392 + VCMP_U32(5, v1, 0x0, 0x3fc4ccb7, 0x0, 0xbf8fae5c, 0x0, 0xbe93ba04, 0x0, + 0xbecf0041, 0x0, 0xbd528fc0, 0x0, 0xbf6eb1b2, 0x0, 0x3ef68cd1, 0x0, + 0xb901f000); + + VSET(16, e64, m1); + // -0.5053356652713634, -0.6291854947278097, 0.6181258713941662, + // -0.6097328085365348, 0.8960683065358290, 0.1233825892982841, + // -0.7071646124826323, -0.6783334309218909, 0.3533001486660008, + // 0.4732651306122215, -0.7335080825789513, -0.9296500813876505, + // 0.5349827137885166, -0.0621174552558810, -0.8122743533756343, + // -0.8908485518923974 + VLOAD_64(v2, 0xbfe02bb5b37af91c, 0xbfe422499e5f271a, 0x3fe3c7afe84e61dc, + 0xbfe382ee60fece00, 0x3fecac9770f1b62e, 0x3fbf960059ee92f0, + 0xbfe6a117ae700ba0, 0xbfe5b4e84fb2f9d4, 0x3fd69c783a0c5078, + 0x3fde49f9d4944428, 0xbfe778e5f140e788, 0xbfedbfb18709140c, + 0x3fe11e941174b448, 0xbfafcddbedab64a0, 0xbfe9fe26c8e417ba, + 0xbfec81d4d2822346); + // -0.6041772411195545, 0.1691588460867453, -0.3855578735230800, + // -0.9206749118255901, 0.7025181961160538, -0.9905598942344518, + // 0.9510997049380876, 0.2754176494545910, 0.5271936205102918, + // 0.8778238674058336, 0.9294006140978470, -0.8775508592745904, + // 0.7472392658861982, -0.3880038279796372, -0.6483706997783654, + // -0.1530785884604509 + VLOAD_64(v3, 0xbfe3556b82731260, 0x3fc5a6ff3fe2c608, 0xbfd8acfaee5fcdc0, + 0xbfed762b3b913c28, 0x3fe67b0770a53a4a, 0xbfefb2aaa9ceeb06, + 0x3fee6f68a5fe3800, 0x3fd1a071594983a8, 0x3fe0dec527d80c9a, + 0x3fec172214450060, 0x3fedbda65b4dd79c, 0xbfec14e58a252770, + 0x3fe7e962522895aa, 0xbfd8d50e01f94d70, 0xbfe4bf73e8e77264, + 0xbfc398144593e6c0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsub.vv v1, v2, v3, v0.t"); + // 0.0000000000000000, -0.7983443408145550, 0.0000000000000000, + // 0.3109421032890554, 0.0000000000000000, 1.1139424835327358, + // 0.0000000000000000, -0.9537510803764819, 0.0000000000000000, + // -0.4045587367936121, 0.0000000000000000, + // -0.0520992221130601, 0.0000000000000000, 0.3258863727237562, + // 0.0000000000000000, -0.7377699634319466 + VCMP_U64(6, v1, 0x0, 0xbfe98c096e57d89c, 0x0, 0x3fd3e679b524dc50, 0x0, + 0x3ff1d2b55a865eb2, 0x0, 0xbfee8520fc57bba8, 0x0, 0xbfd9e44a53f5bc98, + 0x0, 0xbfaaacbfce3ec9c0, 0x0, 0x3fd4db528443e0dc, 0x0, + 0xbfe79bcfc11d2996); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 0.9727, 0.7676, 0.0876, -0.4526, -0.1158, 0.6221, 0.7612, + // -0.7539, 0.3875, -0.2002, 0.2168, -0.1055, -0.4348, 0.9795, + // 0.3650, 0.5171 + VLOAD_16(v2, 0x3bc8, 0x3a24, 0x2d9c, 0xb73e, 0xaf6a, 0x38fa, 0x3a17, 0xba08, + 0x3633, 0xb268, 0x32f0, 0xaec0, 0xb6f5, 0x3bd6, 0x35d7, 0x3823); + double dscalar_16; + // -0.8667 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbaef); + asm volatile("vfsub.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + // 1.8398, 1.6348, 0.9541, 0.4141, 0.7510, 1.4883, 1.6279, + // 0.1128, 1.2539, 0.6665, 1.0840, 0.7612, + // 0.4319, 1.8457, 1.2314, 1.3838 + VCMP_U16(7, v1, 0x3f5c, 0x3e8a, 0x3ba2, 0x36a0, 0x3a02, 0x3df4, 0x3e83, + 0x2f38, 0x3d04, 0x3955, 0x3c56, 0x3a17, 0x36e9, 0x3f62, 0x3ced, + 0x3d89); + + VSET(16, e32, m1); + // 0.85933530, -0.31821987, 0.18340160, -0.58902484, + // -0.83326858, -0.98716992, -0.74268776, -0.50486410, + // 0.91496444, -0.46108878, -0.75265163, -0.17853038, + // 0.09909800, -0.22828153, 0.31248060, 0.70940411 + VLOAD_32(v2, 0x3f5bfd66, 0xbea2edb7, 0x3e3bcda1, 0xbf16ca55, 0xbf555117, + 0xbf7cb72b, 0xbf3e20c9, 0xbf013ec6, 0x3f6a3b1c, 0xbeec13d4, + 0xbf40adc7, 0xbe36d0ab, 0x3dcaf3e5, 0xbe69c2a2, 0x3e9ffd75, + 0x3f359b82); + double dscalar_32; + // -0.16449618 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe2871b0); + asm volatile("vfsub.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + // 1.02383149, -0.15372369, 0.34789777, -0.42452866, + // -0.66877240, -0.82267374, -0.57819158, + // -0.34036791, 1.07946062, -0.29659259, -0.58815545, + // -0.01403420, 0.26359418, -0.06378534, 0.47697678, + // 0.87390029 + VCMP_U32(8, v1, 0x3f830ce9, 0xbe1d69be, 0x3eb21fa8, 0xbed95bd2, 0xbf2b34ab, + 0xbf529abf, 0xbf14045d, 0xbeae44b4, 0x3f8a2bc4, 0xbe97dafc, + 0xbf16915b, 0xbc65efb0, 0x3e86f5d1, 0xbd82a1e4, 0x3ef4364d, + 0x3f5fb7ee); + + VSET(16, e64, m1); + // -0.5270370833343294, -0.3892108170289901, 0.3278104985181656, + // 0.8978904717616114, 0.2838388271052681, 0.1890152734369528, + // -0.5587120809764872, 0.0329118609761476, 0.2661042157694802, + // 0.4284631655495406, 0.3525175873513684, -0.7218762878034530, + // -0.1902187411555145, 0.0621279131630217, + // -0.3175600204168794, 0.2653267716685161 + VLOAD_64(v2, 0xbfe0dd7cdf9667ce, 0xbfd8e8d47c98e498, 0x3fd4fad8e29af14c, + 0x3fecbb84cc736570, 0x3fd22a6a53f022d0, 0x3fc831a708ed9848, + 0xbfe1e0f82875925c, 0x3fa0d9d2cd160b00, 0x3fd107d9fa03b074, + 0x3fdb6bf0c4e4dbb8, 0x3fd68fa5ed3c17c4, 0xbfe7199c4cfbf578, + 0xbfc85916742cb360, 0x3fafcf3ad6686660, 0xbfd452e7438d4924, + 0x3fd0fb1d23c47348); + double dscalar_64; + // -0.3447987329466446 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd6112eb46d5120); + asm volatile("vfsub.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + // -0.1822383503876848, -0.0444120840823454, + // 0.6726092314648102, 1.2426892047082561, 0.6286375600519127, + // 0.5338140063835974, -0.2139133480298425, 0.3777105939227923, + // 0.6109029487161248, 0.7732618984961852, 0.6973163202980130, + // -0.3770775548568084, 0.1545799917911301, 0.4069266461096663, + // 0.0272387125297653, 0.6101255046151608 + VCMP_U64(9, v1, 0xbfc75396157efcf8, 0xbfa6bd2e415c9bc0, 0x3fe58603cb842136, + 0x3ff3e20e13550700, 0x3fe41dcc842eb9f8, 0x3fe115011c720ea2, + 0xbfcb618338fba730, 0x3fd82c690e101280, 0x3fe38c84573880ca, + 0x3fe8be8fbca9166c, 0x3fe6506a50d4b472, 0xbfd82209e58a99d0, + 0x3fc3c946f4adeee0, 0x3fda0b160f3a5dec, 0x3f9be4770e007fc0, + 0x3fe38625ec18e234); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + // 0.9727, 0.7676, 0.0876, -0.4526, -0.1158, 0.6221, 0.7612, + // -0.7539, 0.3875, -0.2002, 0.2168, -0.1055, -0.4348, + // 0.9795, 0.3650, 0.5171 + VLOAD_16(v2, 0x3bc8, 0x3a24, 0x2d9c, 0xb73e, 0xaf6a, 0x38fa, 0x3a17, 0xba08, + 0x3633, 0xb268, 0x32f0, 0xaec0, 0xb6f5, 0x3bd6, 0x35d7, 0x3823); + double dscalar_16; + // -0.8667 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xbaef); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsub.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.0000, 1.6348, 0.0000, 0.4141, 0.0000, 1.4883, 0.0000, + // 0.1128, 0.0000, 0.6665, 0.0000, 0.7612, 0.0000, 1.8457, + // 0.0000, 1.3838 + VCMP_U16(10, v1, 0x0, 0x3e8a, 0x0, 0x36a0, 0x0, 0x3df4, 0x0, 0x2f38, 0x0, + 0x3955, 0x0, 0x3a17, 0x0, 0x3f62, 0x0, 0x3d89); + + VSET(16, e32, m1); + // 0.85933530, -0.31821987, 0.18340160, -0.58902484, + // -0.83326858, -0.98716992, -0.74268776, -0.50486410, + // 0.91496444, -0.46108878, -0.75265163, -0.17853038, + // 0.09909800, -0.22828153, 0.31248060, 0.70940411 + VLOAD_32(v2, 0x3f5bfd66, 0xbea2edb7, 0x3e3bcda1, 0xbf16ca55, 0xbf555117, + 0xbf7cb72b, 0xbf3e20c9, 0xbf013ec6, 0x3f6a3b1c, 0xbeec13d4, + 0xbf40adc7, 0xbe36d0ab, 0x3dcaf3e5, 0xbe69c2a2, 0x3e9ffd75, + 0x3f359b82); + double dscalar_32; + // -0.16449618 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbe2871b0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsub.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.00000000, -0.15372369, 0.00000000, -0.42452866, + // 0.00000000, -0.82267374, 0.00000000, -0.34036791, + // 0.00000000, -0.29659259, 0.00000000, -0.01403420, + // 0.00000000, -0.06378534, 0.00000000, 0.87390029 + VCMP_U32(11, v1, 0x0, 0xbe1d69be, 0x0, 0xbed95bd2, 0x0, 0xbf529abf, 0x0, + 0xbeae44b4, 0x0, 0xbe97dafc, 0x0, 0xbc65efb0, 0x0, 0xbd82a1e4, 0x0, + 0x3f5fb7ee); + + VSET(16, e64, m1); + // -0.5270370833343294, -0.3892108170289901, + // 0.3278104985181656, 0.8978904717616114, 0.2838388271052681, + // 0.1890152734369528, -0.5587120809764872, 0.0329118609761476, + // 0.2661042157694802, 0.4284631655495406, 0.3525175873513684, + // -0.7218762878034530, -0.1902187411555145, + // 0.0621279131630217, -0.3175600204168794, 0.2653267716685161 + VLOAD_64(v2, 0xbfe0dd7cdf9667ce, 0xbfd8e8d47c98e498, 0x3fd4fad8e29af14c, + 0x3fecbb84cc736570, 0x3fd22a6a53f022d0, 0x3fc831a708ed9848, + 0xbfe1e0f82875925c, 0x3fa0d9d2cd160b00, 0x3fd107d9fa03b074, + 0x3fdb6bf0c4e4dbb8, 0x3fd68fa5ed3c17c4, 0xbfe7199c4cfbf578, + 0xbfc85916742cb360, 0x3fafcf3ad6686660, 0xbfd452e7438d4924, + 0x3fd0fb1d23c47348); + double dscalar_64; + // -0.3447987329466446 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd6112eb46d5120); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vfsub.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + // 0.0000000000000000, -0.0444120840823454, 0.0000000000000000, + // 1.2426892047082561, 0.0000000000000000, 0.5338140063835974, + // 0.0000000000000000, 0.3777105939227923, 0.0000000000000000, + // 0.7732618984961852, 0.0000000000000000, + // -0.3770775548568084, 0.0000000000000000, + // 0.4069266461096663, 0.0000000000000000, 0.6101255046151608 + VCMP_U64(12, v1, 0x0, 0xbfa6bd2e415c9bc0, 0x0, 0x3ff3e20e13550700, 0x0, + 0x3fe115011c720ea2, 0x0, 0x3fd82c690e101280, 0x0, 0x3fe8be8fbca9166c, + 0x0, 0xbfd82209e58a99d0, 0x0, 0x3fda0b160f3a5dec, 0x0, + 0x3fe38625ec18e234); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwadd.c b/apps/riscv-tests/isa/rv64uv/vfwadd.c new file mode 100644 index 0000000..0879277 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwadd.c @@ -0,0 +1,523 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 10.5312, 79.6250, 12.2891, 89.5000, 62.5938, 53.5625, + // -37.3438, -48.3750, 49.3438, 1.1475, -79.6250, 52.0000, + // -61.0312, 5.1641, 48.7500, -25.6250 + VLOAD_16(v2, 0x4944, 0x54fa, 0x4a25, 0x5598, 0x53d3, 0x52b2, 0xd0ab, 0xd20c, + 0x522b, 0x3c97, 0xd4fa, 0x5280, 0xd3a1, 0x452a, 0x5218, 0xce68); + // 68.1875, + // -7.0742, 20.2656, 72.3125, 88.5625, 36.0000, 96.6250, 70.4375, + // -87.6875, 87.6875, 8.7891, -18.8906, -40.1562, 88.8750, + // -55.5312, 2.1875 + VLOAD_16(v3, 0x5443, 0xc713, 0x4d11, 0x5485, 0x5589, 0x5080, 0x560a, 0x5467, + 0xd57b, 0x557b, 0x4865, 0xccb9, 0xd105, 0x558e, 0xd2f1, 0x4060); + asm volatile("vfwadd.vv v4, v2, v3"); + // 78.71875000, 72.55078125, 32.55468750, 161.81250000, + // 151.15625000, 89.56250000, 59.28125000, 22.06250000, + // -38.34375000, 88.83496094, -70.83593750, 33.10937500, + // -101.18750000, 94.03906250, -6.78125000, -23.43750000 + VCMP_U32(1, v4, 0x429d7000, 0x42911a00, 0x42023800, 0x4321d000, 0x43172800, + 0x42b32000, 0x426d2000, 0x41b08000, 0xc2196000, 0x42b1ab80, + 0xc28dac00, 0x42047000, 0xc2ca6000, 0x42bc1400, 0xc0d90000, + 0xc1bb8000); + + VSET(16, e32, m1); + // -35386.17187500, -52670.69531250, 69391.31250000, + // 3219.84130859, 74596.35156250, -45488.69921875, + // 6598.72949219, 20221.24609375, 75105.62500000, + // 67354.82031250, 32844.19140625, -73470.18750000, + // -28377.67382812, 61998.10937500, 24691.54296875, + // -29873.45507812 + VLOAD_32(v2, 0xc70a3a2c, 0xc74dbeb2, 0x478787a8, 0x45493d76, 0x4791b22d, + 0xc731b0b3, 0x45ce35d6, 0x469dfa7e, 0x4792b0d0, 0x47838d69, + 0x47004c31, 0xc78f7f18, 0xc6ddb359, 0x47722e1c, 0x46c0e716, + 0xc6e962e9); + // -90937.21875000, -72297.07031250, 18867.19531250, + // -516.01525879, -13301.11425781, 85173.41406250, + // -32079.35546875, -23770.60937500, 39295.43359375, + // 38042.19140625, -61343.24218750, 76844.01562500, + // 26642.50390625, 91893.05468750, 88349.72656250, + // 29134.96093750 + VLOAD_32(v3, 0xc7b19c9c, 0xc78d3489, 0x46936664, 0xc40100fa, 0xc64fd475, + 0x47a65ab5, 0xc6fa9eb6, 0xc6b9b538, 0x47197f6f, 0x47149a31, + 0xc76f9f3e, 0x47961602, 0x46d02502, 0x47b37a87, 0x47ac8edd, + 0x46e39dec); + asm volatile("vfwadd.vv v4, v2, v3"); + // -126323.3906250000000000, -124967.7656250000000000, + // 88258.5078125000000000, 2703.8260498046875000, + // 61295.2373046875000000, 39684.7148437500000000, + // -25480.6259765625000000, -3549.3632812500000000, + // 114401.0585937500000000, 105397.0117187500000000, + // -28499.0507812500000000, 3373.8281250000000000, + // -1735.1699218750000000, 153891.1640625000000000, + // 113041.2695312500000000, -738.4941406250000000 + VCMP_U64(2, v4, 0xc0fed73640000000, 0xc0fe827c40000000, 0x40f58c2820000000, + 0x40a51fa6f0000000, 0x40edede798000000, 0x40e36096e0000000, + 0xc0d8e22810000000, 0xc0abbaba00000000, 0x40fbee10f0000000, + 0x40f9bb5030000000, 0xc0dbd4c340000000, 0x40aa5ba800000000, + 0xc09b1cae00000000, 0x4102c91950000000, 0x40fb991450000000, + 0xc08713f400000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 10.5312, 79.6250, 12.2891, 89.5000, 62.5938, 53.5625, + // -37.3438, -48.3750, 49.3438, 1.1475, -79.6250, 52.0000, + // -61.0312, 5.1641, 48.7500, -25.6250 + VLOAD_16(v2, 0x4944, 0x54fa, 0x4a25, 0x5598, 0x53d3, 0x52b2, 0xd0ab, 0xd20c, + 0x522b, 0x3c97, 0xd4fa, 0x5280, 0xd3a1, 0x452a, 0x5218, 0xce68); + // 68.1875, + // -7.0742, 20.2656, 72.3125, 88.5625, 36.0000, 96.6250, 70.4375, + // -87.6875, 87.6875, 8.7891, -18.8906, -40.1562, 88.8750, + // -55.5312, 2.1875 + VLOAD_16(v3, 0x5443, 0xc713, 0x4d11, 0x5485, 0x5589, 0x5080, 0x560a, 0x5467, + 0xd57b, 0x557b, 0x4865, 0xccb9, 0xd105, 0x558e, 0xd2f1, 0x4060); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.vv v4, v2, v3, v0.t"); + // 0.00000000, 72.55078125, 0.00000000, 161.81250000, + // 0.00000000, 89.56250000, 0.00000000, 22.06250000, + // 0.00000000, 88.83496094, 0.00000000, 33.10937500, + // 0.00000000, 94.03906250, 0.00000000, -23.43750000 + VCMP_U32(3, v4, 0x0, 0x42911a00, 0x0, 0x4321d000, 0x0, 0x42b32000, 0x0, + 0x41b08000, 0x0, 0x42b1ab80, 0x0, 0x42047000, 0x0, 0x42bc1400, 0x0, + 0xc1bb8000); + + VSET(16, e32, m1); + // -35386.17187500, -52670.69531250, 69391.31250000, + // 3219.84130859, 74596.35156250, -45488.69921875, + // 6598.72949219, 20221.24609375, 75105.62500000, + // 67354.82031250, 32844.19140625, -73470.18750000, + // -28377.67382812, 61998.10937500, 24691.54296875, + // -29873.45507812 + VLOAD_32(v2, 0xc70a3a2c, 0xc74dbeb2, 0x478787a8, 0x45493d76, 0x4791b22d, + 0xc731b0b3, 0x45ce35d6, 0x469dfa7e, 0x4792b0d0, 0x47838d69, + 0x47004c31, 0xc78f7f18, 0xc6ddb359, 0x47722e1c, 0x46c0e716, + 0xc6e962e9); + // -90937.21875000, -72297.07031250, 18867.19531250, + // -516.01525879, -13301.11425781, 85173.41406250, + // -32079.35546875, -23770.60937500, 39295.43359375, + // 38042.19140625, -61343.24218750, 76844.01562500, + // 26642.50390625, 91893.05468750, 88349.72656250, + // 29134.96093750 + VLOAD_32(v3, 0xc7b19c9c, 0xc78d3489, 0x46936664, 0xc40100fa, 0xc64fd475, + 0x47a65ab5, 0xc6fa9eb6, 0xc6b9b538, 0x47197f6f, 0x47149a31, + 0xc76f9f3e, 0x47961602, 0x46d02502, 0x47b37a87, 0x47ac8edd, + 0x46e39dec); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.vv v4, v2, v3, v0.t"); + // 0.0000000000000000, -124967.7656250000000000, + // 0.0000000000000000, 2703.8260498046875000, + // 0.0000000000000000, 39684.7148437500000000, + // 0.0000000000000000, -3549.3632812500000000, + // 0.0000000000000000, 105397.0117187500000000, + // 0.0000000000000000, 3373.8281250000000000, + // 0.0000000000000000, 153891.1640625000000000, + // 0.0000000000000000, -738.4941406250000000 + VCMP_U64(4, v4, 0x0, 0xc0fe827c40000000, 0x0, 0x40a51fa6f0000000, 0x0, + 0x40e36096e0000000, 0x0, 0xc0abbaba00000000, 0x0, 0x40f9bb5030000000, + 0x0, 0x40aa5ba800000000, 0x0, 0x4102c91950000000, 0x0, + 0xc08713f400000000); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 12.5859 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x4a4b); + // 2.1094, 59.2188, 89.4375, 75.2500, -4.0742, 64.7500, + // -82.9375, -84.9375, -48.0625, + // -6.1016, 29.9688, 10.6172, 52.5938, -8.5000, 70.5000, + // -83.6875 + VLOAD_16(v2, 0x4038, 0x5367, 0x5597, 0x54b4, 0xc413, 0x540c, 0xd52f, 0xd54f, + 0xd202, 0xc61a, 0x4f7e, 0x494f, 0x5293, 0xc840, 0x5468, 0xd53b); + asm volatile("vfwadd.vf v4, v2, %[A]" ::[A] "f"(dscalar_16)); + // 14.69531250, 71.80468750, + // 102.02343750, 87.83593750, 8.51171875, 77.33593750, + // -70.35156250, -72.35156250, + // -35.47656250, 6.48437500, 42.55468750, 23.20312500, 65.17968750, + // 4.08593750, 83.08593750, -71.10156250 + VCMP_U32(5, v4, 0x416b2000, 0x428f9c00, 0x42cc0c00, 0x42afac00, 0x41083000, + 0x429aac00, 0xc28cb400, 0xc290b400, 0xc20de800, 0x40cf8000, + 0x422a3800, 0x41b9a000, 0x42825c00, 0x4082c000, 0x42a62c00, + 0xc28e3400); + + VSET(16, e32, m1); + double dscalar_32; + // -497871.25000000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc8f319e8); + // -568507.00000000, 457995.96875000, 409553.18750000, + // -797866.87500000, 263520.50000000, 290072.90625000, + // 530785.75000000, 226941.43750000, 285558.65625000, + // -987117.31250000, -423428.21875000, -140664.31250000, + // -844580.25000000, 549948.50000000, 304879.87500000, + // -655518.43750000 + VLOAD_32(v2, 0xc90acbb0, 0x48dfa17f, 0x48c7fa26, 0xc942caae, 0x4880ac10, + 0x488da31d, 0x4901961c, 0x485d9f5c, 0x488b6ed5, 0xc970fed5, + 0xc8cec087, 0xc8095e14, 0xc94e3244, 0x490643c8, 0x4894ddfc, + 0xc92009e7); + asm volatile("vfwadd.vf v4, v2, %[A]" ::[A] "f"(dscalar_32)); + // -1066378.2500000000000000, -39875.2812500000000000, + // -88318.0625000000000000, -1295738.1250000000000000, + // -234350.7500000000000000, -207798.3437500000000000, + // 32914.5000000000000000, -270929.8125000000000000, + // -212312.5937500000000000, -1484988.5625000000000000, + // -921299.4687500000000000, -638535.5625000000000000, + // -1342451.5000000000000000, 52077.2500000000000000, + // -192991.3750000000000000, -1153389.6875000000000000 + VCMP_U64(6, v4, 0xc130458a40000000, 0xc0e3786900000000, 0xc0f58fe100000000, + 0xc133c57a20000000, 0xc10c9b7600000000, 0xc1095db2c0000000, + 0x40e0125000000000, 0xc110894740000000, 0xc109eac4c0000000, + 0xc136a8bc90000000, 0xc12c1da6f0000000, 0xc1237c8f20000000, + 0xc1347bf380000000, 0x40e96da800000000, 0xc1078efb00000000, + 0xc131996db0000000); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 12.5859 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x4a4b); + // 2.1094, 59.2188, 89.4375, 75.2500, -4.0742, 64.7500, + // -82.9375, -84.9375, -48.0625, + // -6.1016, 29.9688, 10.6172, 52.5938, -8.5000, 70.5000, + // -83.6875 + VLOAD_16(v2, 0x4038, 0x5367, 0x5597, 0x54b4, 0xc413, 0x540c, 0xd52f, 0xd54f, + 0xd202, 0xc61a, 0x4f7e, 0x494f, 0x5293, 0xc840, 0x5468, 0xd53b); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.00000000, 71.80468750, 0.00000000, 87.83593750, + // 0.00000000, 77.33593750, 0.00000000, -72.35156250, + // 0.00000000, 6.48437500, 0.00000000, 23.20312500, + // 0.00000000, 4.08593750, 0.00000000, -71.10156250 + VCMP_U32(7, v4, 0x0, 0x428f9c00, 0x0, 0x42afac00, 0x0, 0x429aac00, 0x0, + 0xc290b400, 0x0, 0x40cf8000, 0x0, 0x41b9a000, 0x0, 0x4082c000, 0x0, + 0xc28e3400); + + VSET(16, e32, m1); + double dscalar_32; + // -497871.25000000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc8f319e8); + // -568507.00000000, 457995.96875000, 409553.18750000, + // -797866.87500000, 263520.50000000, 290072.90625000, + // 530785.75000000, 226941.43750000, 285558.65625000, + // -987117.31250000, -423428.21875000, -140664.31250000, + // -844580.25000000, 549948.50000000, 304879.87500000, + // -655518.43750000 + VLOAD_32(v2, 0xc90acbb0, 0x48dfa17f, 0x48c7fa26, 0xc942caae, 0x4880ac10, + 0x488da31d, 0x4901961c, 0x485d9f5c, 0x488b6ed5, 0xc970fed5, + 0xc8cec087, 0xc8095e14, 0xc94e3244, 0x490643c8, 0x4894ddfc, + 0xc92009e7); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.0000000000000000, -39875.2812500000000000, + // 0.0000000000000000, -1295738.1250000000000000, + // 0.0000000000000000, -207798.3437500000000000, + // 0.0000000000000000, -270929.8125000000000000, + // 0.0000000000000000, -1484988.5625000000000000, + // 0.0000000000000000, -638535.5625000000000000, + // 0.0000000000000000, 52077.2500000000000000, + // 0.0000000000000000, -1153389.6875000000000000 + VCMP_U64(8, v4, 0x0, 0xc0e3786900000000, 0x0, 0xc133c57a20000000, 0x0, + 0xc1095db2c0000000, 0x0, 0xc110894740000000, 0x0, 0xc136a8bc90000000, + 0x0, 0xc1237c8f20000000, 0x0, 0x40e96da800000000, 0x0, + 0xc131996db0000000); +}; + +// Simple random test with similar values +void TEST_CASE5(void) { + VSET(16, e16, m1); + // -4.22890615, 94.35176849, -2.66183305, 81.53971863, + // -30.80995941, -61.45680237, 53.70308304, 26.43629074, + // -50.49792862, 12.57134342, -18.77090454, -0.50017655, + // -33.71574402, 14.64656544, 89.57390594, 94.32437897 + VLOAD_32(v2, 0xc0875333, 0x42bcb41b, 0xc02a5b79, 0x42a31456, 0xc1f67acc, + 0xc275d3c4, 0x4256cff5, 0x41d37d86, 0xc249fde1, 0x41492439, + 0xc1962ad0, 0xbf000b92, 0xc206dcec, 0x416a5855, 0x42b325d7, + 0x42bca615); + // -38.1875, + // -22.7500, 51.3438, 8.8594, 23.0938, 32.6875, 71.7500, 7.6758, + // -12.8047, 98.0625, -8.7734, -73.5625, + // -59.0312, 44.9688, 63.8438, 30.1406 + VLOAD_16(v3, 0xd0c6, 0xcdb0, 0x526b, 0x486e, 0x4dc6, 0x5016, 0x547c, 0x47ad, + 0xca67, 0x5621, 0xc863, 0xd499, 0xd361, 0x519f, 0x53fb, 0x4f89); + asm volatile("vfwadd.wv v4, v2, v3"); + // -42.41640472, 71.60176849, 48.68191528, 90.39909363, + // -7.71620941, -28.76930237, 125.45307922, 34.11207199, + // -63.30261612, 110.63384247, -27.54434204, -74.06267548, + // -92.74699402, 59.61531448, 153.41766357, 124.46500397 + VCMP_U32(9, v4, 0xc229aa66, 0x428f341b, 0x4242ba48, 0x42b4cc56, 0xc0f6eb30, + 0xc1e62788, 0x42fae7fa, 0x420872c3, 0xc27d35e1, 0x42dd4487, + 0xc1dc5ad0, 0xc2942017, 0xc2b97e76, 0x426e7615, 0x43196aec, + 0x42f8ee15); + + VSET(16, e32, m1); + // -55997.9824854041071376, 64501.1750668793683872, + // -29542.1742966430028901, -97235.1376669598394074, + // -76290.1568635256844573, -53719.7602741207738291, + // -71738.9507989753619768, 76087.4621994893532246, + // 88201.1680542646208778, -10676.6526112916035345, + // -87188.1793410585087258, 19855.3190320774738211, + // 17509.5892884960630909, 30185.4023848686192650, + // 54203.3669640090665780, -57884.3948619379953016 + VLOAD_64(v2, 0xc0eb57bf70853aee, 0x40ef7ea59a25db30, 0xc0dcd98b27ad1b60, + 0xc0f7bd3233e24524, 0xc0f2a0228283540c, 0xc0ea3af8542a6497, + 0xc0f183af3678fc84, 0x40f29377652b4ab0, 0x40f58892b059ab28, + 0xc0c4da5388c44d38, 0xc0f54942de94bad2, 0x40d363d46b0584c8, + 0x40d11965b6e718a0, 0x40dd7a59c0ac76c8, 0x40ea776bbe2b4e38, + 0xc0ec438ca2b580c4); + // -73536.78125000, 57454.64062500, -32693.95507812, + // -56205.09375000, 12513.70898438, 20858.82226562, + // 12284.94335938, 61625.35156250, -11893.36132812, + // -46430.30078125, 30247.85937500, -94111.64843750, + // 89016.30468750, -52090.74609375, 72764.65625000, + // -47109.86328125 + VLOAD_32(v3, 0xc78fa064, 0x47606ea4, 0xc6ff6be9, 0xc75b8d18, 0x464386d6, + 0x46a2f5a5, 0x463ff3c6, 0x4770b95a, 0xc639d572, 0xc7355e4d, + 0x46ec4fb8, 0xc7b7cfd3, 0x47addc27, 0xc74b7abf, 0x478e1e54, + 0xc73805dd); + asm volatile("vfwadd.wv v4, v2, v3"); + // -129534.7637354041071376, 121955.8156918793683872, + // -62236.1293747680028901, -153440.2314169598394074, + // -63776.4478791506844573, -32860.9380084957738291, + // -59454.0074396003619768, 137712.8137619893532246, + // 76307.8067261396208778, -57106.9533925416035345, + // -56940.3199660585087258, -74256.3294054225261789, + // 106525.8939759960630909, -21905.3437088813807350, + // 126968.0232140090665780, -104994.2581431879953016 + VCMP_U64(10, v4, 0xc0ff9fec38429d77, 0x40fdc63d0d12ed98, 0xc0ee638423d68db0, + 0xc102bb01d9f12292, 0xc0ef240e5506a818, 0xc0e00b9e042a6497, + 0xc0ed07c03cf1f908, 0x4100cf868295a558, 0x40f2a13ce859ab28, + 0xc0ebe25e8231134e, 0xc0ebcd8a3d2975a4, 0xc0f22105453e9ece, + 0x40fa01de4db9c628, 0xc0d56455ff538938, 0x40feff805f15a71c, + 0xc0f9a224215ac062); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE6(void) { + VSET(16, e16, m1); + // -4.22890615, 94.35176849, -2.66183305, 81.53971863, + // -30.80995941, -61.45680237, 53.70308304, 26.43629074, + // -50.49792862, 12.57134342, -18.77090454, -0.50017655, + // -33.71574402, 14.64656544, 89.57390594, 94.32437897 + VLOAD_32(v2, 0xc0875333, 0x42bcb41b, 0xc02a5b79, 0x42a31456, 0xc1f67acc, + 0xc275d3c4, 0x4256cff5, 0x41d37d86, 0xc249fde1, 0x41492439, + 0xc1962ad0, 0xbf000b92, 0xc206dcec, 0x416a5855, 0x42b325d7, + 0x42bca615); + // -38.1875, + // -22.7500, 51.3438, 8.8594, 23.0938, 32.6875, 71.7500, 7.6758, + // -12.8047, 98.0625, -8.7734, -73.5625, + // -59.0312, 44.9688, 63.8438, 30.1406 + VLOAD_16(v3, 0xd0c6, 0xcdb0, 0x526b, 0x486e, 0x4dc6, 0x5016, 0x547c, 0x47ad, + 0xca67, 0x5621, 0xc863, 0xd499, 0xd361, 0x519f, 0x53fb, 0x4f89); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.wv v4, v2, v3, v0.t"); + // 0.00000000, 71.60176849, 0.00000000, 90.39909363, + // 0.00000000, -28.76930237, 0.00000000, 34.11207199, + // 0.00000000, 110.63384247, 0.00000000, -74.06267548, + // 0.00000000, 59.61531448, 0.00000000, 124.46500397 + VCMP_U32(11, v4, 0x0, 0x428f341b, 0x0, 0x42b4cc56, 0x0, 0xc1e62788, 0x0, + 0x420872c3, 0x0, 0x42dd4487, 0x0, 0xc2942017, 0x0, 0x426e7615, 0x0, + 0x42f8ee15); + + VSET(16, e32, m1); + // -55997.9824854041071376, 64501.1750668793683872, + // -29542.1742966430028901, -97235.1376669598394074, + // -76290.1568635256844573, -53719.7602741207738291, + // -71738.9507989753619768, 76087.4621994893532246, + // 88201.1680542646208778, -10676.6526112916035345, + // -87188.1793410585087258, 19855.3190320774738211, + // 17509.5892884960630909, 30185.4023848686192650, + // 54203.3669640090665780, -57884.3948619379953016 + VLOAD_64(v2, 0xc0eb57bf70853aee, 0x40ef7ea59a25db30, 0xc0dcd98b27ad1b60, + 0xc0f7bd3233e24524, 0xc0f2a0228283540c, 0xc0ea3af8542a6497, + 0xc0f183af3678fc84, 0x40f29377652b4ab0, 0x40f58892b059ab28, + 0xc0c4da5388c44d38, 0xc0f54942de94bad2, 0x40d363d46b0584c8, + 0x40d11965b6e718a0, 0x40dd7a59c0ac76c8, 0x40ea776bbe2b4e38, + 0xc0ec438ca2b580c4); + // -73536.78125000, 57454.64062500, -32693.95507812, + // -56205.09375000, 12513.70898438, 20858.82226562, + // 12284.94335938, 61625.35156250, -11893.36132812, + // -46430.30078125, 30247.85937500, -94111.64843750, + // 89016.30468750, -52090.74609375, 72764.65625000, + // -47109.86328125 + VLOAD_32(v3, 0xc78fa064, 0x47606ea4, 0xc6ff6be9, 0xc75b8d18, 0x464386d6, + 0x46a2f5a5, 0x463ff3c6, 0x4770b95a, 0xc639d572, 0xc7355e4d, + 0x46ec4fb8, 0xc7b7cfd3, 0x47addc27, 0xc74b7abf, 0x478e1e54, + 0xc73805dd); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.wv v4, v2, v3, v0.t"); + // 0.0000000000000000, 121955.8156918793683872, + // 0.0000000000000000, -153440.2314169598394074, + // 0.0000000000000000, -32860.9380084957738291, + // 0.0000000000000000, 137712.8137619893532246, + // 0.0000000000000000, -57106.9533925416035345, + // 0.0000000000000000, -74256.3294054225261789, + // 0.0000000000000000, -21905.3437088813807350, + // 0.0000000000000000, -104994.2581431879953016 + VCMP_U64(12, v4, 0x0, 0x40fdc63d0d12ed98, 0x0, 0xc102bb01d9f12292, 0x0, + 0xc0e00b9e042a6497, 0x0, 0x4100cf868295a558, 0x0, 0xc0ebe25e8231134e, + 0x0, 0xc0f22105453e9ece, 0x0, 0xc0d56455ff538938, 0x0, + 0xc0f9a224215ac062); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE7(void) { + VSET(16, e16, m1); + double dscalar_16; + // -16.64103889, 69.17821503, 38.24327850, + // -60.26666641, 97.95110321, -47.38455200, 94.12043762, + // -90.39623260, -17.02018356, 28.09982681, + // -85.91639709, 73.60102081, -98.61261749, + // -81.75864410, 40.07990265, 55.56723022 + VLOAD_32(v2, 0xc18520d9, 0x428a5b3f, 0x4218f91e, 0xc2711111, 0x42c3e6f7, + 0xc23d89c8, 0x42bc3daa, 0xc2b4cadf, 0xc1882956, 0x41e0cc72, + 0xc2abd532, 0x429333b9, 0xc2c539a9, 0xc2a3846d, 0x422051d2, + 0x425e44d8); + // 53.8750 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x52bc); + asm volatile("vfwadd.wf v4, v2, %[A]" ::[A] "f"(dscalar_16)); + // 37.23396301, 123.05321503, 92.11827850, -6.39166641, + // 151.82611084, 6.49044800, 147.99543762, + // -36.52123260, 36.85481644, 81.97482300, -32.04139709, + // 127.47602081, -44.73761749, -27.88364410, 93.95490265, + // 109.44223022 + VCMP_U32(13, v4, 0x4214ef94, 0x42f61b3f, 0x42b83c8f, 0xc0cc8888, 0x4317d37c, + 0x40cfb1c0, 0x4313fed5, 0xc21215be, 0x42136b55, 0x42a3f31c, + 0xc2002a64, 0x42fef3b9, 0xc232f352, 0xc1df11b4, 0x42bbe8e9, + 0x42dae26c); + + VSET(16, e32, m1); + double dscalar_32; + // 366783.2934919928666204, -648147.5638866436202079, + // 24949.3815817765425891, -211759.8585660880198702, + // 337740.3714956413023174, -528559.3617047512670979, + // -863948.2704646114725620, -463848.5980863422155380, + // 958859.3069495267700404, -853775.5625991101842374, + // -7020.6864214694360271, 839278.6509590207133442, + // -443325.1460256360005587, 97289.3425237806513906, + // 220009.0786798361223191, 491284.4355713783297688 + VLOAD_64(v2, 0x411662fd2c892a3c, 0xc123c7a720b5c00a, 0x40d85d586bd5f8c0, + 0xc109d97ede57e5ac, 0x41149d317c695a78, 0xc120215eb9315d7b, + 0xc12a5d988a7a566a, 0xc11c4fa26470bf00, 0x412d43169d287d06, + 0xc12a0e1f200cfd96, 0xc0bb6cafb9514280, 0x41299cdd4d4a8032, + 0xc11b0ef49587be8c, 0x40f7c0957afa3740, 0x410adb48a122e4d8, + 0x411dfc51be066c64); + // 572932.37500000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x490be046); + asm volatile("vfwadd.wf v4, v2, %[A]" ::[A] "f"(dscalar_32)); + // 939715.6684919928666204, -75215.1888866436202079, + // 597881.7565817765425891, 361172.5164339119801298, + // 910672.7464956413023174, 44373.0132952487329021, + // -291015.8954646114725620, 109083.7769136577844620, + // 1531791.6819495267700404, -280843.1875991101842374, + // 565911.6885785305639729, 1412211.0259590207133442, + // 129607.2289743639994413, 670221.7175237806513906, + // 792941.4536798361223191, 1064216.8105713783297688 + VCMP_U64(14, v4, 0x412cad875644951e, 0xc0f25cf305ae0050, 0x41223ef3835eafc6, + 0x41160b5210d40d2a, 0x412bcaa17e34ad3c, 0x40e5aaa06cea2850, + 0xc111c31f94f4acd4, 0x40faa1bc6e3d0400, 0x41375f8fae943e83, + 0xc111242cc019fb2c, 0x4121452f608d5d7b, 0x41358c7306a54019, + 0x40ffa473a9e105d0, 0x4124741b6f5f46e8, 0x412832dae848b936, + 0x41303d18cf819b19); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE8(void) { + VSET(16, e16, m1); + double dscalar_16; + // -16.64103889, 69.17821503, 38.24327850, + // -60.26666641, 97.95110321, -47.38455200, 94.12043762, + // -90.39623260, -17.02018356, 28.09982681, + // -85.91639709, 73.60102081, -98.61261749, + // -81.75864410, 40.07990265, 55.56723022 + VLOAD_32(v2, 0xc18520d9, 0x428a5b3f, 0x4218f91e, 0xc2711111, 0x42c3e6f7, + 0xc23d89c8, 0x42bc3daa, 0xc2b4cadf, 0xc1882956, 0x41e0cc72, + 0xc2abd532, 0x429333b9, 0xc2c539a9, 0xc2a3846d, 0x422051d2, + 0x425e44d8); + // 53.8750 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x52bc); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.wf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.00000000, 123.05321503, 0.00000000, -6.39166641, + // 0.00000000, 6.49044800, 0.00000000, -36.52123260, + // 0.00000000, 81.97482300, 0.00000000, 127.47602081, + // 0.00000000, -27.88364410, 0.00000000, 109.44223022 + VCMP_U32(15, v4, 0x0, 0x42f61b3f, 0x0, 0xc0cc8888, 0x0, 0x40cfb1c0, 0x0, + 0xc21215be, 0x0, 0x42a3f31c, 0x0, 0x42fef3b9, 0x0, 0xc1df11b4, 0x0, + 0x42dae26c); + + VSET(16, e32, m1); + double dscalar_32; + // 366783.2934919928666204, -648147.5638866436202079, + // 24949.3815817765425891, -211759.8585660880198702, + // 337740.3714956413023174, -528559.3617047512670979, + // -863948.2704646114725620, -463848.5980863422155380, + // 958859.3069495267700404, -853775.5625991101842374, + // -7020.6864214694360271, 839278.6509590207133442, + // -443325.1460256360005587, 97289.3425237806513906, + // 220009.0786798361223191, 491284.4355713783297688 + VLOAD_64(v2, 0x411662fd2c892a3c, 0xc123c7a720b5c00a, 0x40d85d586bd5f8c0, + 0xc109d97ede57e5ac, 0x41149d317c695a78, 0xc120215eb9315d7b, + 0xc12a5d988a7a566a, 0xc11c4fa26470bf00, 0x412d43169d287d06, + 0xc12a0e1f200cfd96, 0xc0bb6cafb9514280, 0x41299cdd4d4a8032, + 0xc11b0ef49587be8c, 0x40f7c0957afa3740, 0x410adb48a122e4d8, + 0x411dfc51be066c64); + // 572932.37500000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x490be046); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwadd.wf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.0000000000000000, -75215.1888866436202079, + // 0.0000000000000000, 361172.5164339119801298, + // 0.0000000000000000, 44373.0132952487329021, + // 0.0000000000000000, 109083.7769136577844620, + // 0.0000000000000000, -280843.1875991101842374, + // 0.0000000000000000, 1412211.0259590207133442, + // 0.0000000000000000, 670221.7175237806513906, + // 0.0000000000000000, 1064216.8105713783297688 + VCMP_U64(16, v4, 0x0, 0xc0f25cf305ae0050, 0x0, 0x41160b5210d40d2a, 0x0, + 0x40e5aaa06cea2850, 0x0, 0x40faa1bc6e3d0400, 0x0, 0xc111242cc019fb2c, + 0x0, 0x41358c7306a54019, 0x0, 0x4124741b6f5f46e8, 0x0, + 0x41303d18cf819b19); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwcvt.c b/apps/riscv-tests/isa/rv64uv/vfwcvt.c new file mode 100644 index 0000000..84db96d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwcvt.c @@ -0,0 +1,656 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "float_macros.h" +#include "vector_macros.h" + +// We assume RNE rounding when not specified by the encoding + +///////////////// +// vfwcvt.xu.f // +///////////////// + +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 56.438, -30.938, -68.438, -32.969, 56.438, + // -5.816, 53.094, -29.875, -93.562, -90.750, -65.875, + // -91.062, 16.281, -77.938, -67.000, -51.844 + VLOAD_16(v2, 0x530e, 0xcfbc, 0xd447, 0xd01f, 0x530e, 0xc5d1, 0x52a3, 0xcf78, + 0xd5d9, 0xd5ac, 0xd41e, 0xd5b1, 0x4c12, 0xd4df, 0xd430, 0xd27b); + asm volatile("vfwcvt.xu.f.v v4, v2"); + // 56, 0, 0, 0, 56, 0, 53, + // 0, 0, 0, 0, 0, 16, 0, + // 0, 0 + VCMP_U32(1, v4, 0x00000038, 0x00000000, 0x00000000, 0x00000000, 0x00000038, + 0x00000000, 0x00000035, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0x00000000, + 0x00000000); + + VSET(16, e32, m1); + // -54444.973, 43481.863, 88447.461, 32690.551, + // -37979.809, 68218.094, -43036.512, -38011.395, + // -36599.363, 48418.234, 81414.820, 16330.853, + // 75606.320, -85030.219, 13033.059, 7375.421 + VLOAD_32(v2, 0xc754acf9, 0x4729d9dd, 0x47acbfbb, 0x46ff651a, 0xc7145bcf, + 0x47853d0c, 0xc7281c83, 0xc7147b65, 0xc70ef75d, 0x473d223c, + 0x479f0369, 0x467f2b69, 0x4793ab29, 0xc7a6131c, 0x464ba43c, + 0x45e67b5f); + asm volatile("vfwcvt.xu.f.v v4, v2"); + // 0, 43482, 88447, 32691, + // 0, 68218, 0, 0, 0, + // 48418, 81415, 16331, + // 75606, 0, 13033, + // 7375 + VCMP_U64(2, v4, 0x0000000000000000, 0x000000000000a9da, 0x000000000001597f, + 0x0000000000007fb3, 0x0000000000000000, 0x0000000000010a7a, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x000000000000bd22, 0x0000000000013e07, 0x0000000000003fcb, + 0x0000000000012756, 0x0000000000000000, 0x00000000000032e9, + 0x0000000000001ccf); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -36.375, 56.438, -68.438, -32.969, 56.438, + // -5.816, 53.094, -29.875, -93.562, -90.750, -65.875, + // -91.062, 16.281, -77.938, -67.000, -51.844 + VLOAD_16(v2, 0xd08c, 0x530e, 0xd447, 0xd01f, 0x530e, 0xc5d1, 0x52a3, 0xcf78, + 0xd5d9, 0xd5ac, 0xd41e, 0xd5b1, 0x4c12, 0xd4df, 0xd430, 0xd27b); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.xu.f.v v4, v2, v0.t"); + // 0, 56, 0, 0, 0, 0, 0, 0, + // 0, 0, 0, 0, 0, 0, 0, 0 + VCMP_U32(3, v4, 0x00000000, 0x00000038, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000); + + VSET(16, e32, m1); + // -54444.973, 43481.863, 88447.461, 32690.551, -37979.809, + // 68218.094, -43036.512, -38011.395, -36599.363, 48418.234, + // 81414.820, 16330.853, 75606.320, -85030.219, 13033.059, + // 7375.421 + VLOAD_32(v2, 0xc754acf9, 0x4729d9dd, 0x47acbfbb, 0x46ff651a, 0xc7145bcf, + 0x47853d0c, 0xc7281c83, 0xc7147b65, 0xc70ef75d, 0x473d223c, + 0x479f0369, 0x467f2b69, 0x4793ab29, 0xc7a6131c, 0x464ba43c, + 0x45e67b5f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.xu.f.v v4, v2, v0.t"); + // 0, 43482, 0, 32691, 0, + // 68218, 0, 0, 0, + // 48418, 0, 16331, 0, + // 0, 0, 7375 + VCMP_U64(4, v4, 0x0000000000000000, 0x000000000000a9da, 0x0000000000000000, + 0x0000000000007fb3, 0x0000000000000000, 0x0000000000010a7a, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x000000000000bd22, 0x0000000000000000, 0x0000000000003fcb, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000001ccf); +}; + +//////////////// +// vfwcvt.x.f // +//////////////// + +// Simple random test with similar values +void TEST_CASE3(void) { + VSET(16, e16, m1); + // -55.656, -23.391, 53.094, -0.356, 26.859, -81.938, + // 63.625, -54.594, -36.375, 77.312, 73.188, -79.500, + // -22.047, -30.500, 33.375, -26.281 + VLOAD_16(v2, 0xd2f5, 0xcdd9, 0x52a3, 0xb5b2, 0x4eb7, 0xd51f, 0x53f4, 0xd2d3, + 0xd08c, 0x54d5, 0x5493, 0xd4f8, 0xcd83, 0xcfa0, 0x502c, 0xce92); + asm volatile("vfwcvt.x.f.v v4, v2"); + // -56, -23, 53, 0, 27, -82, + // 64, -55, -36, 77, + // 73, -80, -22, -30, + // 33, -26 + VCMP_U32(5, v4, 0xffffffc8, 0xffffffe9, 0x00000035, 0x00000000, 0x0000001b, + 0xffffffae, 0x00000040, 0xffffffc9, 0xffffffdc, 0x0000004d, + 0x00000049, 0xffffffb0, 0xffffffea, 0xffffffe2, 0x00000021, + 0xffffffe6); + + VSET(16, e32, m1); + // -22345.104, -55208.160, 60155.754, -4924.268, + // -42337.285, -60609.004, 51795.328, 33876.547, + // -99812.922, 59419.867, -78706.844, 72266.555, + // -70664.008, -83501.727, -15981.749, -2004.535 + VLOAD_32(v2, 0xc6ae9235, 0xc757a829, 0x476afbc1, 0xc599e225, 0xc7256149, + 0xc76cc101, 0x474a5354, 0x4704548c, 0xc7c2f276, 0x47681bde, + 0xc799b96c, 0x478d2547, 0xc78a0401, 0xc7a316dd, 0xc679b6ff, + 0xc4fa9120); + asm volatile("vfwcvt.x.f.v v4, v2"); + // -22345, -55208, 60156, -4924, + // -42337, -60609, 51795, 33877, + // -99813, 59420, -78707, 72267, + // -70664, -83502, -15982, -2005 + VCMP_U64(6, v4, 0xffffffffffffa8b7, 0xffffffffffff2858, 0x000000000000eafc, + 0xffffffffffffecc4, 0xffffffffffff5a9f, 0xffffffffffff133f, + 0x000000000000ca53, 0x0000000000008455, 0xfffffffffffe7a1b, + 0x000000000000e81c, 0xfffffffffffecc8d, 0x0000000000011a4b, + 0xfffffffffffeebf8, 0xfffffffffffeb9d2, 0xffffffffffffc192, + 0xfffffffffffff82b); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE4(void) { + VSET(16, e16, m1); + // -55.656, -23.391, 53.094, -0.356, 26.859, + // -81.938, 63.625, -54.594, -36.375, 77.312, 73.188, + // -79.500, -22.047, -30.500, 33.375, -26.281 + VLOAD_16(v2, 0xd2f5, 0xcdd9, 0x52a3, 0xb5b2, 0x4eb7, 0xd51f, 0x53f4, 0xd2d3, + 0xd08c, 0x54d5, 0x5493, 0xd4f8, 0xcd83, 0xcfa0, 0x502c, 0xce92); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.x.f.v v4, v2, v0.t"); + // 0, -23, 0, 0, 0, -82, 0, + // -55, 0, 77, 0, -80, 0, + // -30, 0, -26 + VCMP_U32(7, v4, 0x00000000, 0xffffffe9, 0x00000000, 0x00000000, 0x00000000, + 0xffffffae, 0x00000000, 0xffffffc9, 0x00000000, 0x0000004d, + 0x00000000, 0xffffffb0, 0x00000000, 0xffffffe2, 0x00000000, + 0xffffffe6); + + VSET(16, e32, m1); + // -22345.104, -55208.160, 60155.754, -4924.268, + // -42337.285, -60609.004, 51795.328, 33876.547, + // -99812.922, 59419.867, -78706.844, 72266.555, + // -70664.008, -83501.727, -15981.749, -2004.535 + VLOAD_32(v2, 0xc6ae9235, 0xc757a829, 0x476afbc1, 0xc599e225, 0xc7256149, + 0xc76cc101, 0x474a5354, 0x4704548c, 0xc7c2f276, 0x47681bde, + 0xc799b96c, 0x478d2547, 0xc78a0401, 0xc7a316dd, 0xc679b6ff, + 0xc4fa9120); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.x.f.v v4, v2, v0.t"); + // 0, -55208, 0, -4924, 0, + // -60609, 0, 33877, 0, + // 59420, 0, 72267, 0, + // -83502, 0, -2005 + VCMP_U64(8, v4, 0x0000000000000000, 0xffffffffffff2858, 0x0000000000000000, + 0xffffffffffffecc4, 0x0000000000000000, 0xffffffffffff133f, + 0x0000000000000000, 0x0000000000008455, 0x0000000000000000, + 0x000000000000e81c, 0x0000000000000000, 0x0000000000011a4b, + 0x0000000000000000, 0xfffffffffffeb9d2, 0x0000000000000000, + 0xfffffffffffff82b); +}; + +///////////////////// +// vfwcvt.rtz.xu.f // +///////////////////// + +// Simple random test with similar values +void TEST_CASE5(void) { + VSET(16, e16, m1); + // 26304.000, -31056.000, 6932.000, 63168.000, -10920.000, + // -38528.000, inf, -inf, -1313.000, 52736.000, inf, + // -inf, -61024.000, -inf, -5672.000, 53824.000 + VLOAD_16(v2, 0x766c, 0xf795, 0x6ec5, 0x7bb6, 0xf155, 0xf8b4, 0x7c00, 0xfc00, + 0xe521, 0x7a70, 0x7c00, 0xfc00, 0xfb73, 0xfc00, 0xed8a, 0x7a92); + asm volatile("vfwcvt.rtz.xu.f.v v4, v2"); + // 26304, 0, 6932, 63168, 0, 0, + // 0, 0, 0, 52736, 0, + // 0, 0, 0, 0, + // 53824 + VCMP_U32(9, v4, 0x000066c0, 0x00000000, 0x00001b14, 0x0000f6c0, 0x00000000, + 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x0000ce00, + 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0000d240); + + VSET(16, e32, m1); + // -139027333120.000, 783549530112.000, 166903955456.000, + // -848099999744.000, -671032279040.000, -402660294656.000, + // -259808854016.000, 248555126784.000, 712853684224.000, + // -492155797504.000, -448682098688.000, -916605566976.000, + // 67602378752.000, 519669350400.000, 569111478272.000, + // -920229773312.000 + VLOAD_32(v2, 0xd2017ab3, 0x53366f31, 0x521b7101, 0xd34576b3, 0xd31c3ca4, + 0xd2bb80d9, 0xd271f742, 0x52677c29, 0x5325f964, 0xd2e52d8b, + 0xd2d0ef13, 0xd35569f3, 0x517bd6a7, 0x52f1fd6a, 0x530481b0, + 0xd35641f8); + asm volatile("vfwcvt.rtz.xu.f.v v4, v2"); + // 0, 783549530112, 166903955456, + // 0, 0, 0, 0, + // 248555126784, 712853684224, 0, + // 0, 0, 67602378752, + // 519669350400, 569111478272, 0 + VCMP_U64(10, v4, 0x0000000000000000, 0x000000b66f310000, 0x00000026dc404000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x00000039df0a4000, 0x000000a5f9640000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000fbd6a7000, 0x00000078feb50000, 0x0000008481b00000, + 0x0000000000000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE6(void) { + VSET(16, e16, m1); + // 26304.000, -31056.000, 6932.000, 63168.000, -10920.000, + // -38528.000, inf, -inf, -1313.000, 52736.000, inf, + // -inf, -61024.000, -inf, -5672.000, 53824.000 + VLOAD_16(v2, 0x766c, 0xf795, 0x6ec5, 0x7bb6, 0xf155, 0xf8b4, 0x7c00, 0xfc00, + 0xe521, 0x7a70, 0x7c00, 0xfc00, 0xfb73, 0xfc00, 0xed8a, 0x7a92); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.rtz.xu.f.v v4, v2, v0.t"); + // 0, 0, 0, 63168, 0, 0, + // 0, 0, 0, 52736, 0, 0, + // 0, 0, 0, 53824 + VCMP_U32(11, v4, 0x00000000, 0x00000000, 0x00000000, 0x0000f6c0, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000ce00, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0000d240); + + VSET(16, e32, m1); + // -139027333120.000, 783549530112.000, 166903955456.000, + // -848099999744.000, -671032279040.000, -402660294656.000, + // -259808854016.000, 248555126784.000, 712853684224.000, + // -492155797504.000, -448682098688.000, -916605566976.000, + // 67602378752.000, 519669350400.000, 569111478272.000, + // -920229773312.000 + VLOAD_32(v2, 0xd2017ab3, 0x53366f31, 0x521b7101, 0xd34576b3, 0xd31c3ca4, + 0xd2bb80d9, 0xd271f742, 0x52677c29, 0x5325f964, 0xd2e52d8b, + 0xd2d0ef13, 0xd35569f3, 0x517bd6a7, 0x52f1fd6a, 0x530481b0, + 0xd35641f8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.rtz.xu.f.v v4, v2, v0.t"); + // 0, 783549530112, 0, 0, 0, 0, 0, + // 248555126784, 0, 0, + // 0, 0, 0, + // 519669350400, 0, 0 + VCMP_U64(12, v4, 0x0000000000000000, 0x000000b66f310000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x00000039df0a4000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x00000078feb50000, 0x0000000000000000, + 0x0000000000000000); +}; + +//////////////////// +// vfwcvt.rtz.x.f // +//////////////////// + +// Simple random test with similar values +void TEST_CASE7(void) { + VSET(16, e16, m1); + // 5.844, 36.219, -86.250, 20.406, -45.688, 13.961, + // -96.562, 81.000, -32.594, 51.281, 80.750, + // -17.750, 14.516, 58.000, 69.938, -94.688 + VLOAD_16(v2, 0x45d8, 0x5087, 0xd564, 0x4d1a, 0xd1b6, 0x4afb, 0xd609, 0x5510, + 0xd013, 0x5269, 0x550c, 0xcc70, 0x4b42, 0x5340, 0x545f, 0xd5eb); + asm volatile("vfwcvt.rtz.x.f.v v4, v2"); + // 5, 36, -86, 20, -45, 13, + // -96, 81, -32, 51, 80, -17, + // 14, 58, 69, -94 + VCMP_U32(13, v4, 0x00000005, 0x00000024, 0xffffffaa, 0x00000014, 0xffffffd3, + 0x0000000d, 0xffffffa0, 0x00000051, 0xffffffe0, 0x00000033, + 0x00000050, 0xffffffef, 0x0000000e, 0x0000003a, 0x00000045, + 0xffffffa2); + + VSET(16, e32, m1); + // 2116.345, -810274979840.000, -5833.340, -6088.383, + // -9260.508, -2389.850, 9361.639, 5574.592, -6825.026, + // 2473.934, -6756.971, -7155.075, 2251.162, -2899.548, + // -3184.759, -1954.714 + VLOAD_32(v2, 0x45044584, 0xd33ca827, 0xc5b64ab9, 0xc5be4311, 0xc610b208, + 0xc5155d98, 0x4612468e, 0x45ae34bd, 0xc5d54835, 0x451a9ef1, + 0xc5d327c5, 0xc5df9899, 0x450cb297, 0xc53538c6, 0xc5470c23, + 0xc4f456dc); + asm volatile("vfwcvt.rtz.x.f.v v4, v2"); + // 2116, -810274979840, -5833, -6088, + // -9260, -2389, 9361, 5574, + // -6825, 2473, -6756, -7155, + // 2251, -2899, -3184, -1954 + VCMP_U64(14, v4, 0x0000000000000844, 0xffffff4357d90000, 0xffffffffffffe937, + 0xffffffffffffe838, 0xffffffffffffdbd4, 0xfffffffffffff6ab, + 0x0000000000002491, 0x00000000000015c6, 0xffffffffffffe557, + 0x00000000000009a9, 0xffffffffffffe59c, 0xffffffffffffe40d, + 0x00000000000008cb, 0xfffffffffffff4ad, 0xfffffffffffff390, + 0xfffffffffffff85e); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE8(void) { + VSET(16, e16, m1); + // 5.844, 36.219, -86.250, 20.406, -45.688, 13.961, + // -96.562, 81.000, -32.594, 51.281, 80.750, + // -17.750, 14.516, 58.000, 69.938, -94.688 + VLOAD_16(v2, 0x45d8, 0x5087, 0xd564, 0x4d1a, 0xd1b6, 0x4afb, 0xd609, 0x5510, + 0xd013, 0x5269, 0x550c, 0xcc70, 0x4b42, 0x5340, 0x545f, 0xd5eb); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.rtz.x.f.v v4, v2, v0.t"); + // 0, 36, 0, 20, 0, 13, 0, + // 81, 0, 51, 0, -17, 0, + // 58, 0, -94 + VCMP_U32(15, v4, 0x00000000, 0x00000024, 0x00000000, 0x00000014, 0x00000000, + 0x0000000d, 0x00000000, 0x00000051, 0x00000000, 0x00000033, + 0x00000000, 0xffffffef, 0x00000000, 0x0000003a, 0x00000000, + 0xffffffa2); + + VSET(16, e32, m1); + // 2116.345, -6652.860, -5833.340, -6088.383, -9260.508, + // -2389.850, 9361.639, 5574.592, -6825.026, 2473.934, + // -6756.971, -7155.075, 2251.162, -2899.548, -3184.759, + // -1954.714 + VLOAD_32(v2, 0x45044584, 0xc5cfe6e1, 0xc5b64ab9, 0xc5be4311, 0xc610b208, + 0xc5155d98, 0x4612468e, 0x45ae34bd, 0xc5d54835, 0x451a9ef1, + 0xc5d327c5, 0xc5df9899, 0x450cb297, 0xc53538c6, 0xc5470c23, + 0xc4f456dc); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.rtz.x.f.v v4, v2, v0.t"); + // 0, -6652, 0, -6088, 0, + // -2389, 0, 5574, 0, + // 2473, 0, -7155, 0, + // -2899, 0, -1954 + VCMP_U64(16, v4, 0x0000000000000000, 0xffffffffffffe604, 0x0000000000000000, + 0xffffffffffffe838, 0x0000000000000000, 0xfffffffffffff6ab, + 0x0000000000000000, 0x00000000000015c6, 0x0000000000000000, + 0x00000000000009a9, 0x0000000000000000, 0xffffffffffffe40d, + 0x0000000000000000, 0xfffffffffffff4ad, 0x0000000000000000, + 0xfffffffffffff85e); +}; + +///////////////// +// vfwcvt.f.xu // +///////////////// + +// Simple random test with similar values +void TEST_CASE9(void) { + VSET(16, e16, m1); + // 64656, 64687, 64823, 970, 543, + // 65038, 65122, 966, 180, 389, 337, + // 341, 65240, 51, 64922, 64676 + VLOAD_16(v2, 0xfc90, 0xfcaf, 0xfd37, 0x03ca, 0x021f, 0xfe0e, 0xfe62, 0x03c6, + 0x00b4, 0x0185, 0x0151, 0x0155, 0xfed8, 0x0033, 0xfd9a, 0xfca4); + asm volatile("vfwcvt.f.xu.v v4, v2"); + // 64656.000, 64687.000, 64823.000, 970.000, + // 543.000, 65038.000, 65122.000, 966.000, + // 180.000, 389.000, 337.000, 341.000, + // 65240.000, 51.000, 64922.000, 64676.000 + VCMP_U32(17, v4, 0x477c9000, 0x477caf00, 0x477d3700, 0x44728000, 0x4407c000, + 0x477e0e00, 0x477e6200, 0x44718000, 0x43340000, 0x43c28000, + 0x43a88000, 0x43aa8000, 0x477ed800, 0x424c0000, 0x477d9a00, + 0x477ca400); + + VSET(16, e32, m1); + // 97144, 4294936082, 42555, + // 4294893205, 55337, 4294948570, + // 4294931792, 4294924170, 4294912208, + // 4294947132, 4294903099, 4294944521, + // 4294923920, 4294889958, 31133, 30359 + VLOAD_32(v2, 0x00017b78, 0xffff8612, 0x0000a63b, 0xfffede95, 0x0000d829, + 0xffffb6da, 0xffff7550, 0xffff578a, 0xffff28d0, 0xffffb13c, + 0xffff053b, 0xffffa709, 0xffff5690, 0xfffed1e6, 0x0000799d, + 0x00007697); + asm volatile("vfwcvt.f.xu.v v4, v2"); + // 97144.000, 4294936082.000, 42555.000, + // 4294893205.000, 55337.000, 4294948570.000, + // 4294931792.000, 4294924170.000, 4294912208.000, + // 4294947132.000, 4294903099.000, 4294944521.000, + // 4294923920.000, 4294889958.000, 31133.000, + // 30359.000 + VCMP_U64(18, v4, 0x40f7b78000000000, 0x41effff0c2400000, 0x40e4c76000000000, + 0x41efffdbd2a00000, 0x40eb052000000000, 0x41effff6db400000, + 0x41efffeeaa000000, 0x41efffeaf1400000, 0x41efffe51a000000, + 0x41effff627800000, 0x41efffe0a7600000, 0x41effff4e1200000, + 0x41efffead2000000, 0x41efffda3cc00000, 0x40de674000000000, + 0x40dda5c000000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE10(void) { + VSET(16, e16, m1); + // 64656, 64687, 64823, 970, 543, + // 65038, 65122, 966, 180, 389, 337, + // 341, 65240, 51, 64922, 64676 + VLOAD_16(v2, 0xfc90, 0xfcaf, 0xfd37, 0x03ca, 0x021f, 0xfe0e, 0xfe62, 0x03c6, + 0x00b4, 0x0185, 0x0151, 0x0155, 0xfed8, 0x0033, 0xfd9a, 0xfca4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.f.xu.v v4, v2, v0.t"); + // 0.000, 64687.000, 0.000, 970.000, 0.000, + // 65038.000, 0.000, 966.000, 0.000, 389.000, + // 0.000, 341.000, 0.000, 51.000, 0.000, + // 64676.000 + VCMP_U32(19, v4, 0x0, 0x477caf00, 0x0, 0x44728000, 0x0, 0x477e0e00, 0x0, + 0x44718000, 0x0, 0x43c28000, 0x0, 0x43aa8000, 0x0, 0x424c0000, 0x0, + 0x477ca400); + + VSET(16, e32, m1); + // 97144, 4294936082, 42555, + // 4294893205, 55337, 4294948570, + // 4294931792, 4294924170, 4294912208, + // 4294947132, 4294903099, 4294944521, + // 4294923920, 4294889958, 31133, 30359 + VLOAD_32(v2, 0x00017b78, 0xffff8612, 0x0000a63b, 0xfffede95, 0x0000d829, + 0xffffb6da, 0xffff7550, 0xffff578a, 0xffff28d0, 0xffffb13c, + 0xffff053b, 0xffffa709, 0xffff5690, 0xfffed1e6, 0x0000799d, + 0x00007697); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.f.xu.v v4, v2, v0.t"); + // 0.000, 4294936082.000, 0.000, 4294893205.000, + // 0.000, 4294948570.000, 0.000, 4294924170.000, + // 0.000, 4294947132.000, 0.000, 4294944521.000, + // 0.000, 4294889958.000, 0.000, 30359.000 + VCMP_U64(20, v4, 0x0, 0x41effff0c2400000, 0x0, 0x41efffdbd2a00000, 0x0, + 0x41effff6db400000, 0x0, 0x41efffeaf1400000, 0x0, 0x41effff627800000, + 0x0, 0x41effff4e1200000, 0x0, 0x41efffda3cc00000, 0x0, + 0x40dda5c000000000); +}; + +//////////////// +// vfwcvt.f.x // +//////////////// + +// Simple random test with similar values +void TEST_CASE11(void) { + VSET(16, e16, m1); + // -263, -943, 111, -140, -792, + // -320, -384, 250, -308, 578, -830, + // -865, 908, 264, 93, 833 + VLOAD_16(v2, 0xfef9, 0xfc51, 0x006f, 0xff74, 0xfce8, 0xfec0, 0xfe80, 0x00fa, + 0xfecc, 0x0242, 0xfcc2, 0xfc9f, 0x038c, 0x0108, 0x005d, 0x0341); + asm volatile("vfwcvt.f.x.v v4, v2"); + // -263.000, -943.000, 111.000, -140.000, + // -792.000, -320.000, -384.000, 250.000, + // -308.000, 578.000, -830.000, -865.000, + // 908.000, 264.000, 93.000, 833.000 + VCMP_U32(21, v4, 0xc3838000, 0xc46bc000, 0x42de0000, 0xc30c0000, 0xc4460000, + 0xc3a00000, 0xc3c00000, 0x437a0000, 0xc39a0000, 0x44108000, + 0xc44f8000, 0xc4584000, 0x44630000, 0x43840000, 0x42ba0000, + 0x44504000); + + VSET(16, e32, m1); + // -85277, 33391, 84804, + // -45155, -68903, 19141, + // -10026, 87992, 13128, + // 95737, -70832, 43360, + // 32471, 51, 50027, + // -57346 + VLOAD_32(v2, 0xfffeb2e3, 0x0000826f, 0x00014b44, 0xffff4f9d, 0xfffef2d9, + 0x00004ac5, 0xffffd8d6, 0x000157b8, 0x00003348, 0x000175f9, + 0xfffeeb50, 0x0000a960, 0x00007ed7, 0x00000033, 0x0000c36b, + 0xffff1ffe); + asm volatile("vfwcvt.f.x.v v4, v2"); + // -85277.000, 33391.000, 84804.000, -45155.000, + // -68903.000, 19141.000, -10026.000, 87992.000, + // 13128.000, 95737.000, -70832.000, 43360.000, + // 32471.000, 51.000, 50027.000, -57346.000 + VCMP_U64(22, v4, 0xc0f4d1d000000000, 0x40e04de000000000, 0x40f4b44000000000, + 0xc0e60c6000000000, 0xc0f0d27000000000, 0x40d2b14000000000, + 0xc0c3950000000000, 0x40f57b8000000000, 0x40c9a40000000000, + 0x40f75f9000000000, 0xc0f14b0000000000, 0x40e52c0000000000, + 0x40dfb5c000000000, 0x4049800000000000, 0x40e86d6000000000, + 0xc0ec004000000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE12(void) { + VSET(16, e16, m1); + // -263, -943, 111, -140, -792, + // -320, -384, 250, -308, 578, -830, + // -865, 908, 264, 93, 833 + VLOAD_16(v2, 0xfef9, 0xfc51, 0x006f, 0xff74, 0xfce8, 0xfec0, 0xfe80, 0x00fa, + 0xfecc, 0x0242, 0xfcc2, 0xfc9f, 0x038c, 0x0108, 0x005d, 0x0341); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.f.x.v v4, v2, v0.t"); + // 0.000, -943.000, 0.000, -140.000, 0.000, + // -320.000, 0.000, 250.000, 0.000, 578.000, + // 0.000, -865.000, 0.000, 264.000, 0.000, + // 833.000 + VCMP_U32(23, v4, 0x0, 0xc46bc000, 0x0, 0xc30c0000, 0x0, 0xc3a00000, 0x0, + 0x437a0000, 0x0, 0x44108000, 0x0, 0xc4584000, 0x0, 0x43840000, 0x0, + 0x44504000); + + VSET(16, e32, m1); + // -85277, 33391, 84804, + // -45155, -68903, 19141, + // -10026, 87992, 13128, + // 95737, -70832, 43360, + // 32471, 51, 50027, + // -57346 + VLOAD_32(v2, 0xfffeb2e3, 0x0000826f, 0x00014b44, 0xffff4f9d, 0xfffef2d9, + 0x00004ac5, 0xffffd8d6, 0x000157b8, 0x00003348, 0x000175f9, + 0xfffeeb50, 0x0000a960, 0x00007ed7, 0x00000033, 0x0000c36b, + 0xffff1ffe); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.f.x.v v4, v2, v0.t"); + // 0.000, 33391.000, 0.000, -45155.000, 0.000, + // 19141.000, 0.000, 87992.000, 0.000, + // 95737.000, 0.000, 43360.000, + // 0.000, 51.000, 0.000, -57346.000 + VCMP_U64(24, v4, 0x0, 0x40e04de000000000, 0x0, 0xc0e60c6000000000, 0x0, + 0x40d2b14000000000, 0x0, 0x40f57b8000000000, 0x0, 0x40f75f9000000000, + 0x0, 0x40e52c0000000000, 0x0, 0x4049800000000000, 0x0, + 0xc0ec004000000000); +}; + +//////////////// +// vfwcvt.f.f // +//////////////// + +// Simple random test with similar values +void TEST_CASE13(void) { + VSET(16, e16, m1); + // 83.312, -83.188, 62.469, 94.812, 10.797, -13.070, + // -9.039, 54.250, -92.188, 63.688, -32.875, -81.688, + // -62.219, -78.250, -29.703, -1.137 + VLOAD_16(v2, 0x5535, 0xd533, 0x53cf, 0x55ed, 0x4966, 0xca89, 0xc885, 0x52c8, + 0xd5c3, 0x53f6, 0xd01c, 0xd51b, 0xd3c7, 0xd4e4, 0xcf6d, 0xbc8c); + asm volatile("vfwcvt.f.f.v v4, v2"); + // 83.312, -83.188, 62.469, 94.812, 10.797, -13.070, + // -9.039, 54.250, -92.188, 63.688, -32.875, -81.688, + // -62.219, -78.250, -29.703, -1.137 + VCMP_U32(25, v4, 0x42a6a000, 0xc2a66000, 0x4279e000, 0x42bda000, 0x412cc000, + 0xc1512000, 0xc110a000, 0x42590000, 0xc2b86000, 0x427ec000, + 0xc2038000, 0xc2a36000, 0xc278e000, 0xc29c8000, 0xc1eda000, + 0xbf918000); + + VSET(16, e32, m1); + // -69280.273, -24625.789, 58970.254, 57986.516, 34031.016, + // 61977.340, -84548.211, 89658.250, 4958.967, -73911.508, + // -83526.188, -59814.750, 71544.742, 93401.383, 79319.078, + // 4639.214 + VLOAD_32(v2, 0xc7875023, 0xc6c06394, 0x47665a41, 0x47628284, 0x4704ef04, + 0x47721957, 0xc7a5221b, 0x47af1d20, 0x459af7bc, 0xc7905bc1, + 0xc7a32318, 0xc769a6c0, 0x478bbc5f, 0x47b66cb1, 0x479aeb8a, + 0x4590f9b7); + asm volatile("vfwcvt.f.f.v v4, v2"); + // -69280.273, -24625.789, 58970.254, 57986.516, 34031.016, + // 61977.340, -84548.211, 89658.250, 4958.967, -73911.508, + // -83526.188, -59814.750, 71544.742, 93401.383, 79319.078, + // 4639.214 + VCMP_U64(26, v4, 0xc0f0ea0460000000, 0xc0d80c7280000000, 0x40eccb4820000000, + 0x40ec505080000000, 0x40e09de080000000, 0x40ee432ae0000000, + 0xc0f4a44360000000, 0x40f5e3a400000000, 0x40b35ef780000000, + 0xc0f20b7820000000, 0xc0f4646300000000, 0xc0ed34d800000000, + 0x40f1778be0000000, 0x40f6cd9620000000, 0x40f35d7140000000, + 0x40b21f36e0000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE14(void) { + VSET(16, e16, m1); + // 83.312, -83.188, 62.469, 94.812, 10.797, -13.070, + // -9.039, 54.250, -92.188, 63.688, -32.875, -81.688, + // -62.219, -78.250, -29.703, -1.137 + VLOAD_16(v2, 0x5535, 0xd533, 0x53cf, 0x55ed, 0x4966, 0xca89, 0xc885, 0x52c8, + 0xd5c3, 0x53f6, 0xd01c, 0xd51b, 0xd3c7, 0xd4e4, 0xcf6d, 0xbc8c); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.f.f.v v4, v2, v0.t"); + // 0.000, -83.188, 0.000, 94.812, 0.000, -13.070, 0.000, + // 54.250, 0.000, 63.688, 0.000, -81.688, 0.000, + // -78.250, 0.000, -1.137 + VCMP_U32(27, v4, 0x0, 0xc2a66000, 0x0, 0x42bda000, 0x0, 0xc1512000, 0x0, + 0x42590000, 0x0, 0x427ec000, 0x0, 0xc2a36000, 0x0, 0xc29c8000, 0x0, + 0xbf918000); + + VSET(16, e32, m1); + // -69280.273, -24625.789, 58970.254, 57986.516, 34031.016, + // 61977.340, -84548.211, 89658.250, 4958.967, -73911.508, + // -83526.188, -59814.750, 71544.742, 93401.383, 79319.078, + // 4639.214 + VLOAD_32(v2, 0xc7875023, 0xc6c06394, 0x47665a41, 0x47628284, 0x4704ef04, + 0x47721957, 0xc7a5221b, 0x47af1d20, 0x459af7bc, 0xc7905bc1, + 0xc7a32318, 0xc769a6c0, 0x478bbc5f, 0x47b66cb1, 0x479aeb8a, + 0x4590f9b7); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwcvt.f.f.v v4, v2, v0.t"); + // 0.000, -24625.789, 0.000, 57986.516, 0.000, 61977.340, + // 0.000, 89658.250, 0.000, -73911.508, 0.000, + // -59814.750, 0.000, 93401.383, 0.000, 4639.214 + VCMP_U64(28, v4, 0x0, 0xc0d80c7280000000, 0x0, 0x40ec505080000000, 0x0, + 0x40ee432ae0000000, 0x0, 0x40f5e3a400000000, 0x0, 0xc0f20b7820000000, + 0x0, 0xc0ed34d800000000, 0x0, 0x40f6cd9620000000, 0x0, + 0x40b21f36e0000000); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + + TEST_CASE7(); + TEST_CASE8(); + + TEST_CASE9(); + TEST_CASE10(); + + TEST_CASE11(); + TEST_CASE12(); + + TEST_CASE13(); + TEST_CASE14(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwmacc.c b/apps/riscv-tests/isa/rv64uv/vfwmacc.c new file mode 100644 index 0000000..0ed2899 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwmacc.c @@ -0,0 +1,351 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 52.7812, 74.1875, 0.3564, 97.5000, 7.8477, 53.2188, + // -26.4688, -48.1250, -32.9688, 7.8750, + // -38.4375, 51.5625, 46.2188, -75.1875, 23.5625, -77.8125 + VLOAD_16(v2, 0x5299, 0x54a3, 0x35b4, 0x5618, 0x47d9, 0x52a7, 0xce9e, 0xd204, + 0xd01f, 0x47e0, 0xd0ce, 0x5272, 0x51c7, 0xd4b3, 0x4de4, 0xd4dd); + // 49.6875, 28.5312, 13.4766, -90.5625, 58.0000, + // -63.8125, 49.0625, 0.3325, 30.8906, 11.2266, -93.9375, + // -54.6875, 61.7500, 38.3438, 95.8125, 10.0938 + VLOAD_16(v6, 0x5236, 0x4f22, 0x4abd, 0xd5a9, 0x5340, 0xd3fa, 0x5222, 0x3552, + 0x4fb9, 0x499d, 0xd5df, 0xd2d6, 0x53b8, 0x50cb, 0x55fd, 0x490c); + // -83.87223053, -48.34465408, 70.48658752, -1.26614821, + // -24.13150024, -65.13838196, + // 0.84671319, 34.34510040, 72.80049896, + // -86.23424530, 25.52654839, -68.44364929, 9.81109142, + // -85.20966339, -81.00300598, 16.25512505 + VLOAD_32(v4, 0xc2a7be95, 0xc24160ed, 0x428cf922, 0xbfa21125, 0xc1c10d50, + 0xc28246da, 0x3f58c232, 0x42096162, 0x429199db, 0xc2ac77ef, + 0x41cc365f, 0xc288e326, 0x411cfa3b, 0xc2aa6b59, 0xc2a2018a, + 0x41820a7f); + asm volatile("vfwmacc.vv v4, v2, v6"); + // 2538.69604492, 2068.31738281, 75.29024506, -8831.11035156, + // 431.03256226, -3461.15991211, -1297.77636719, 18.34259796, + // -945.62481689, 2.17493439, 3636.24926758, -2888.26782227, + // 2863.81884766, -2968.18041992, 2176.57910156, -769.16479492 + VCMP_U32(1, v4, 0x451eab23, 0x45014514, 0x4296949b, 0xc609fc71, 0x43d7842b, + 0xc558528f, 0xc4a238d8, 0x4192bda4, 0xc46c67fd, 0x400b3220, + 0x456343fd, 0xc5348449, 0x4532fd1a, 0xc53982e3, 0x45080944, + 0xc4404a8c); + + VSET(16, e32, m1); + // -3306.98510742, -33314.88281250, 64578.31250000, + // 11648.08203125, -92704.16406250, 33998.11328125, + // 23406.90429688, 44169.36718750, -1206.53601074, + // 4568.00048828, -89687.13281250, 47865.25781250, + // -72205.21875000, 40772.06640625, 95904.72656250, + // 96043.19531250 + VLOAD_32(v2, 0xc54eafc3, 0xc70222e2, 0x477c4250, 0x46360054, 0xc7b51015, + 0x4704ce1d, 0x46b6ddcf, 0x472c895e, 0xc496d127, 0x458ec001, + 0xc7af2b91, 0x473af942, 0xc78d069c, 0x471f4411, 0x47bb505d, + 0x47bb9599); + // -52385.05468750, -31301.09960938, 1862.59667969, + // 86344.56250000, 9560.06835938, -93766.92187500, + // -68756.87500000, 42627.23046875, -89604.89062500, + // -47420.98437500, -40235.07421875, 44342.39453125, + // 90261.61718750, 76035.55468750, -92912.59375000, + // 40474.20703125 + VLOAD_32(v6, 0xc74ca10e, 0xc6f48a33, 0x44e8d318, 0x47a8a448, 0x46156046, + 0xc7b72376, 0xc7864a70, 0x4726833b, 0xc7af0272, 0xc7393cfc, + 0xc71d2b13, 0x472d3665, 0x47b04acf, 0x479481c7, 0xc7b5784c, + 0x471e1a35); + // -10044.0368110413110116, 13040.9349537673260784, + // 88916.1136409099854063, 79168.4367756713472772, + // 21611.0950133731239475, -26455.6752808090968756, + // 5979.6755084589240141, -99733.4556307629245566, + // 85141.1192070578690618, -87838.0155233480472816, + // 53604.5772563865466509, -30101.3490022116457112, + // 80638.7360704737366177, -75019.8948306038219016, + // 63887.5576457676361315, 1225.3713199536578031 + VLOAD_64(v4, 0xc0c39e04b6396548, 0x40c97877ac90a6f8, 0x40f5b541d179217e, + 0x40f35406fd087c82, 0x40d51ac614b2f890, 0xc0d9d5eb37ccffac, + 0x40b75bacee1f5340, 0xc0f859574a437b9d, 0x40f4c951e845a8f0, + 0xc0f571e03f956903, 0x40ea2c9278e262b4, 0xc0dd6556560d5f50, + 0x40f3afebc6f1d544, 0xc0f250be5139e52e, 0x40ef31f1d83befd8, + 0x4093257c3b4c4540); + asm volatile("vfwmacc.vv v4, v2, v6"); + // 173226551.6662319302558899, 1042805506.3236714601516724, + // 120372266.5559626817703247, 1005827715.3891682624816895, + // -886236534.5412018299102783, -3187924887.6156492233276367, + // -1609379613.2016887664794922, 1882718061.3047757148742676, + // 108196668.3968845903873444, -216706917.7953008711338043, + // 3608622049.7550821304321289, 2122430044.9128692150115967, + // -6517279175.0161266326904297, 3100051665.0599727630615234, + // -8910693010.2487506866455078, 3887273396.3922243118286133 + VCMP_U64(2, v4, 0x41a4a6746f551c5a, 0x41cf13f981296e11, 0x419cb2f0aa394e48, + 0x41cdf9db41b1d044, 0xc1ca6972bb45461a, 0xc1e7c07bf2f3b366, + 0xc1d7fb4bc74ce878, 0x41dc0dffdb538172, 0x4199cbccf19668ea, + 0xc1a9d55ecb9731ad, 0x41eae2e67c3829a2, 0x41dfa06d973a6c73, + 0xc1f8475c9c70420e, 0x41e718e11a21eb4c, 0xc20098f31491fd71, + 0x41ecf662b68c8d1a); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 52.7812, 74.1875, 0.3564, 97.5000, 7.8477, 53.2188, + // -26.4688, -48.1250, -32.9688, 7.8750, + // -38.4375, 51.5625, 46.2188, -75.1875, 23.5625, -77.8125 + VLOAD_16(v2, 0x5299, 0x54a3, 0x35b4, 0x5618, 0x47d9, 0x52a7, 0xce9e, 0xd204, + 0xd01f, 0x47e0, 0xd0ce, 0x5272, 0x51c7, 0xd4b3, 0x4de4, 0xd4dd); + // 49.6875, 28.5312, 13.4766, -90.5625, 58.0000, + // -63.8125, 49.0625, 0.3325, 30.8906, 11.2266, -93.9375, + // -54.6875, 61.7500, 38.3438, 95.8125, 10.0938 + VLOAD_16(v6, 0x5236, 0x4f22, 0x4abd, 0xd5a9, 0x5340, 0xd3fa, 0x5222, 0x3552, + 0x4fb9, 0x499d, 0xd5df, 0xd2d6, 0x53b8, 0x50cb, 0x55fd, 0x490c); + VLOAD_8(v0, 0xAA, 0xAA); + // -83.87223053, -48.34465408, 70.48658752, -1.26614821, + // -24.13150024, -65.13838196, + // 0.84671319, 34.34510040, 72.80049896, + // -86.23424530, 25.52654839, -68.44364929, 9.81109142, + // -85.20966339, -81.00300598, 16.25512505 + VLOAD_32(v4, 0xc2a7be95, 0xc24160ed, 0x428cf922, 0xbfa21125, 0xc1c10d50, + 0xc28246da, 0x3f58c232, 0x42096162, 0x429199db, 0xc2ac77ef, + 0x41cc365f, 0xc288e326, 0x411cfa3b, 0xc2aa6b59, 0xc2a2018a, + 0x41820a7f); + asm volatile("vfwmacc.vv v4, v2, v6, v0.t"); + // -83.87223053, 2068.31738281, 70.48658752, -8831.11035156, + // -24.13150024, -3461.15991211, + // 0.84671319, 18.34259796, 72.80049896, 2.17493439, 25.52654839, + // -2888.26782227, 9.81109142, -2968.18041992, -81.00300598, + // -769.16479492 + VCMP_U32(3, v4, 0xc2a7be95, 0x45014514, 0x428cf922, 0xc609fc71, 0xc1c10d50, + 0xc558528f, 0x3f58c232, 0x4192bda4, 0x429199db, 0x400b3220, + 0x41cc365f, 0xc5348449, 0x411cfa3b, 0xc53982e3, 0xc2a2018a, + 0xc4404a8c); + + VSET(16, e32, m1); + // -3306.98510742, -33314.88281250, 64578.31250000, + // 11648.08203125, -92704.16406250, 33998.11328125, + // 23406.90429688, 44169.36718750, -1206.53601074, + // 4568.00048828, -89687.13281250, 47865.25781250, + // -72205.21875000, 40772.06640625, 95904.72656250, + // 96043.19531250 + VLOAD_32(v2, 0xc54eafc3, 0xc70222e2, 0x477c4250, 0x46360054, 0xc7b51015, + 0x4704ce1d, 0x46b6ddcf, 0x472c895e, 0xc496d127, 0x458ec001, + 0xc7af2b91, 0x473af942, 0xc78d069c, 0x471f4411, 0x47bb505d, + 0x47bb9599); + // -52385.05468750, -31301.09960938, 1862.59667969, + // 86344.56250000, 9560.06835938, -93766.92187500, + // -68756.87500000, 42627.23046875, -89604.89062500, + // -47420.98437500, -40235.07421875, 44342.39453125, + // 90261.61718750, 76035.55468750, -92912.59375000, + // 40474.20703125 + VLOAD_32(v6, 0xc74ca10e, 0xc6f48a33, 0x44e8d318, 0x47a8a448, 0x46156046, + 0xc7b72376, 0xc7864a70, 0x4726833b, 0xc7af0272, 0xc7393cfc, + 0xc71d2b13, 0x472d3665, 0x47b04acf, 0x479481c7, 0xc7b5784c, + 0x471e1a35); + VLOAD_8(v0, 0xAA, 0xAA); + // -10044.0368110413110116, 13040.9349537673260784, + // 88916.1136409099854063, 79168.4367756713472772, + // 21611.0950133731239475, -26455.6752808090968756, + // 5979.6755084589240141, -99733.4556307629245566, + // 85141.1192070578690618, -87838.0155233480472816, + // 53604.5772563865466509, -30101.3490022116457112, + // 80638.7360704737366177, -75019.8948306038219016, + // 63887.5576457676361315, 1225.3713199536578031 + VLOAD_64(v4, 0xc0c39e04b6396548, 0x40c97877ac90a6f8, 0x40f5b541d179217e, + 0x40f35406fd087c82, 0x40d51ac614b2f890, 0xc0d9d5eb37ccffac, + 0x40b75bacee1f5340, 0xc0f859574a437b9d, 0x40f4c951e845a8f0, + 0xc0f571e03f956903, 0x40ea2c9278e262b4, 0xc0dd6556560d5f50, + 0x40f3afebc6f1d544, 0xc0f250be5139e52e, 0x40ef31f1d83befd8, + 0x4093257c3b4c4540); + asm volatile("vfwmacc.vv v4, v2, v6, v0.t"); + // -10044.0368110413110116, 1042805506.3236714601516724, + // 88916.1136409099854063, 1005827715.3891682624816895, + // 21611.0950133731239475, -3187924887.6156492233276367, + // 5979.6755084589240141, 1882718061.3047757148742676, + // 85141.1192070578690618, -216706917.7953008711338043, + // 53604.5772563865466509, 2122430044.9128692150115967, + // 80638.7360704737366177, 3100051665.0599727630615234, + // 63887.5576457676361315, 3887273396.3922243118286133 + VCMP_U64(4, v4, 0xc0c39e04b6396548, 0x41cf13f981296e11, 0x40f5b541d179217e, + 0x41cdf9db41b1d044, 0x40d51ac614b2f890, 0xc1e7c07bf2f3b366, + 0x40b75bacee1f5340, 0x41dc0dffdb538172, 0x40f4c951e845a8f0, + 0xc1a9d55ecb9731ad, 0x40ea2c9278e262b4, 0x41dfa06d973a6c73, + 0x40f3afebc6f1d544, 0x41e718e11a21eb4c, 0x40ef31f1d83befd8, + 0x41ecf662b68c8d1a); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -15.3750, 11.9375, + // -31.7656, 27.0625, 3.0684, 71.2500, 63.2500, -95.6875, + // -62.0625, -27.7344, 55.5312, -62.1875, -42.1875, + // -95.3125, 27.1406, -16.9219 + VLOAD_16(v2, 0xcbb0, 0x49f8, 0xcff1, 0x4ec4, 0x4223, 0x5474, 0x53e8, 0xd5fb, + 0xd3c2, 0xceef, 0x52f1, 0xd3c6, 0xd146, 0xd5f5, 0x4ec9, 0xcc3b); + // 32.2812 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x5009); + // -70.22966003, 68.36327362, -69.75650787, -92.51078796, + // -53.56798553, + // -92.09814453, 92.33961487, 42.48206329, 99.15431976, + // -5.94871950, -55.92549133, 59.99367523, -45.05080032, + // -68.93397522, 55.13935089, -80.23659515 + VLOAD_32(v4, 0xc28c7596, 0x4288b9ff, 0xc28b8355, 0xc2b90586, 0xc256459e, + 0xc2b83240, 0x42b8ade2, 0x4229eda2, 0x42c64f03, 0xc0be5be9, + 0xc25fb3b4, 0x426ff986, 0xc2343405, 0xc289de32, 0x425c8eb2, + 0xc2a07923); + asm volatile("vfwmacc.vf v4, %[A], v2" ::[A] "f"(dscalar_16)); + // -566.55389404, 453.72070312, -1095.19055176, + // 781.10052490, 45.48249054, 2207.94091797, 2134.12866211, + // -3046.42993164, -1904.30078125, -901.24902344, 1736.69262695, + // -1947.49658203, -1406.91601562, -3145.74072266, 931.27264404, + // -626.49584961 + VCMP_U32(5, v4, 0xc40da373, 0x43e2dc40, 0xc488e619, 0x4443466f, 0x4235ee12, + 0x4509ff0e, 0x4505620f, 0xc53e66e1, 0xc4ee09a0, 0xc4614ff0, + 0x44d9162a, 0xc4f36fe4, 0xc4afdd50, 0xc5449bda, 0x4468d173, + 0xc41c9fbc); + + VSET(16, e32, m1); + double dscalar_32; + // -260866.17187500, -221967.43750000, -907157.25000000, + // 754760.87500000, -585546.12500000, 260611.84375000, + // -768453.25000000, -117569.82812500, -469705.78125000, + // 775094.50000000, 533114.81250000, -798136.87500000, + // 66693.82812500, 246179.67187500, 728220.87500000, + // -749270.75000000 + VLOAD_32(v2, 0xc87ec08b, 0xc858c3dc, 0xc95d7954, 0x4938448e, 0xc90ef4a2, + 0x487e80f6, 0xc93b9c54, 0xc7e5a0ea, 0xc8e55939, 0x493d3b68, + 0x490227ad, 0xc942db8e, 0x478242ea, 0x487068eb, 0x4931c9ce, + 0xc936ed6c); + // -164832.20312500 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc820f80d); + // -730249.9193813583115116, -885955.2111547881504521, + // -739704.0702666083816439, 991252.9466537751723081, + // -543412.1947198503185064, 859135.3883249030914158, + // 862259.4763332824222744, 331294.3916525302920491, + // 936699.0835190876387060, -813722.4244660194963217, + // -602138.5575914122164249, 253718.7884360067546368, + // 7255.4825419568223879, 957493.0229552322998643, + // -446793.8022573012858629, -757660.7323241395642981 + VLOAD_64(v4, 0xc1264913d6b92745, 0xc12b09866c1c7afb, 0xc12692f023f9fc22, + 0x412e4029e4afcdba, 0xc120956863b251fa, 0x412a37fec6d2858e, + 0x412a5066f3e1f4bc, 0x41143879910d5c64, 0x412c95f62ac3038c, + 0xc128d534d9539c30, 0xc12260351d7c9f20, 0x410ef8b64eb78980, + 0x40bc577b87dea380, 0x412d386a0bc0c9c8, 0xc11b45273582f020, + 0xc1271f3976f3308b); + asm volatile("vfwmacc.vf v4, %[A], v2" ::[A] "f"(dscalar_32)); + // 42998415581.0217819213867188, 36586495789.9245910644531250, + // 149527988394.2461547851562500, + // -124407906605.8560791015625000, 96516314402.8619232177734375, + // -42956365230.3924331665039062, 126666704455.5427398681640625, + // 19379625085.2629890441894531, 77423575443.0703430175781250, + // -127761347787.4947814941406250, + // -87875091201.5038757324218750, 131558913220.3411712646484375, + // -10993283369.2012958526611328, -40577380186.7228927612304688, + // -120034697981.6674957275390625, 123503190798.8887634277343750 + VCMP_U64(6, v4, 0x422405cf81ba0b27, 0x422109733e5bd964, 0x4241684804551f82, + 0xc23cf74a012ddb28, 0x423678d21522dca7, 0xc22400cc3b5cc8ed, + 0x423d7dec86478af1, 0x42120c7671f50d4d, 0x423206ce01931202, + 0xc23dbf2b74cb7eaa, 0xc23475c37b0180fe, 0x423ea185b4c45757, + 0xc2047a0189499c41, 0xc222e5335eb5721f, 0xc23bf2a022fdaae1, + 0x423cc15d230ee386); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -15.3750, 11.9375, + // -31.7656, 27.0625, 3.0684, 71.2500, 63.2500, -95.6875, + // -62.0625, -27.7344, 55.5312, -62.1875, -42.1875, + // -95.3125, 27.1406, -16.9219 + VLOAD_16(v2, 0xcbb0, 0x49f8, 0xcff1, 0x4ec4, 0x4223, 0x5474, 0x53e8, 0xd5fb, + 0xd3c2, 0xceef, 0x52f1, 0xd3c6, 0xd146, 0xd5f5, 0x4ec9, 0xcc3b); + // 32.2812 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x5009); + VLOAD_8(v0, 0xAA, 0xAA); + // -70.22966003, 68.36327362, -69.75650787, -92.51078796, + // -53.56798553, + // -92.09814453, 92.33961487, 42.48206329, 99.15431976, + // -5.94871950, -55.92549133, 59.99367523, -45.05080032, + // -68.93397522, 55.13935089, -80.23659515 + VLOAD_32(v4, 0xc28c7596, 0x4288b9ff, 0xc28b8355, 0xc2b90586, 0xc256459e, + 0xc2b83240, 0x42b8ade2, 0x4229eda2, 0x42c64f03, 0xc0be5be9, + 0xc25fb3b4, 0x426ff986, 0xc2343405, 0xc289de32, 0x425c8eb2, + 0xc2a07923); + asm volatile("vfwmacc.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // -70.22966003, 453.72070312, -69.75650787, 781.10052490, + // -53.56798553, 2207.94091797, 92.33961487, + // -3046.42993164, 99.15431976, -901.24902344, -55.92549133, + // -1947.49658203, -45.05080032, -3145.74072266, 55.13935089, + // -626.49584961 + VCMP_U32(7, v4, 0xc28c7596, 0x43e2dc40, 0xc28b8355, 0x4443466f, 0xc256459e, + 0x4509ff0e, 0x42b8ade2, 0xc53e66e1, 0x42c64f03, 0xc4614ff0, + 0xc25fb3b4, 0xc4f36fe4, 0xc2343405, 0xc5449bda, 0x425c8eb2, + 0xc41c9fbc); + + VSET(16, e32, m1); + double dscalar_32; + // -260866.17187500, -221967.43750000, -907157.25000000, + // 754760.87500000, -585546.12500000, 260611.84375000, + // -768453.25000000, -117569.82812500, -469705.78125000, + // 775094.50000000, 533114.81250000, -798136.87500000, + // 66693.82812500, 246179.67187500, 728220.87500000, + // -749270.75000000 + VLOAD_32(v2, 0xc87ec08b, 0xc858c3dc, 0xc95d7954, 0x4938448e, 0xc90ef4a2, + 0x487e80f6, 0xc93b9c54, 0xc7e5a0ea, 0xc8e55939, 0x493d3b68, + 0x490227ad, 0xc942db8e, 0x478242ea, 0x487068eb, 0x4931c9ce, + 0xc936ed6c); + // -164832.20312500 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc820f80d); + VLOAD_8(v0, 0xAA, 0xAA); + // -730249.9193813583115116, -885955.2111547881504521, + // -739704.0702666083816439, 991252.9466537751723081, + // -543412.1947198503185064, 859135.3883249030914158, + // 862259.4763332824222744, 331294.3916525302920491, + // 936699.0835190876387060, -813722.4244660194963217, + // -602138.5575914122164249, 253718.7884360067546368, + // 7255.4825419568223879, 957493.0229552322998643, + // -446793.8022573012858629, -757660.7323241395642981 + VLOAD_64(v4, 0xc1264913d6b92745, 0xc12b09866c1c7afb, 0xc12692f023f9fc22, + 0x412e4029e4afcdba, 0xc120956863b251fa, 0x412a37fec6d2858e, + 0x412a5066f3e1f4bc, 0x41143879910d5c64, 0x412c95f62ac3038c, + 0xc128d534d9539c30, 0xc12260351d7c9f20, 0x410ef8b64eb78980, + 0x40bc577b87dea380, 0x412d386a0bc0c9c8, 0xc11b45273582f020, + 0xc1271f3976f3308b); + asm volatile("vfwmacc.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // -730249.9193813583115116, 36586495789.9245910644531250, + // -739704.0702666083816439, -124407906605.8560791015625000, + // -543412.1947198503185064, -42956365230.3924331665039062, + // 862259.4763332824222744, 19379625085.2629890441894531, + // 936699.0835190876387060, -127761347787.4947814941406250, + // -602138.5575914122164249, 131558913220.3411712646484375, + // 7255.4825419568223879, -40577380186.7228927612304688, + // -446793.8022573012858629, 123503190798.8887634277343750 + VCMP_U64(8, v4, 0xc1264913d6b92745, 0x422109733e5bd964, 0xc12692f023f9fc22, + 0xc23cf74a012ddb28, 0xc120956863b251fa, 0xc22400cc3b5cc8ed, + 0x412a5066f3e1f4bc, 0x42120c7671f50d4d, 0x412c95f62ac3038c, + 0xc23dbf2b74cb7eaa, 0xc12260351d7c9f20, 0x423ea185b4c45757, + 0x40bc577b87dea380, 0xc222e5335eb5721f, 0xc11b45273582f020, + 0x423cc15d230ee386); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwmsac.c b/apps/riscv-tests/isa/rv64uv/vfwmsac.c new file mode 100644 index 0000000..d38bb1c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwmsac.c @@ -0,0 +1,353 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -93.0000, -55.1250, -68.5625, 76.3125, -61.2188, 48.9375, + // -56.3125, 71.0000, -74.5625, -38.7188, + // -50.3438, 93.3750, 80.2500, -7.4141, 93.8125, 83.1875 + VLOAD_16(v2, 0xd5d0, 0xd2e4, 0xd449, 0x54c5, 0xd3a7, 0x521e, 0xd30a, 0x5470, + 0xd4a9, 0xd0d7, 0xd24b, 0x55d6, 0x5504, 0xc76a, 0x55dd, 0x5533); + // -60.0312, -31.7188, -74.2500, -0.9077, 30.4844, -56.2500, + // -4.8320, 34.2812, 66.6875, 37.9375, 78.1875, 5.6094, + // -81.8125, 67.6250, 29.4531, -64.9375 + VLOAD_16(v6, 0xd381, 0xcfee, 0xd4a4, 0xbb43, 0x4f9f, 0xd308, 0xc4d5, 0x5049, + 0x542b, 0x50be, 0x54e3, 0x459c, 0xd51d, 0x543a, 0x4f5d, 0xd40f); + // 31.29529381, -66.12346649, + // -48.59321213, 21.66906929, 92.08473206, 1.95985305, + // -96.55027771, 77.65225220, -82.48660278, + // -35.32508850, 42.91923141, + // -76.65069580, 25.13817024, 72.89311981, 21.44047737, 69.71634674 + VLOAD_32(v4, 0x41fa5cc3, 0xc2843f37, 0xc2425f73, 0x41ad5a41, 0x42b82b62, + 0x3ffadc77, 0xc2c119be, 0x429b4df4, 0xc2a4f924, 0xc20d4ce4, + 0x422bad4b, 0xc2994d28, 0x41c91af9, 0x4291c947, 0x41ab8619, + 0x428b6ec5); + asm volatile("vfwmsac.vv v4, v2, v6"); + // 5551.61083984, 1814.61950684, 5139.35888672, -90.93905640, + // -1958.30004883, -2754.69433594, 368.65405273, 2356.31640625, + // -4889.89990234, -1433.56750488, -3979.17114258, 600.42608643, + // -6590.59130859, -574.26910400, 2741.63085938, -5471.70458984 + VCMP_U32(1, v4, 0x45ad7ce3, 0x44e2d3d3, 0x45a09adf, 0xc2b5e0cc, 0xc4f4c99a, + 0xc52c2b1c, 0x43b853b8, 0x45134510, 0xc598cf33, 0xc4b33229, + 0xc578b2bd, 0x44161b45, 0xc5cdf4bb, 0xc40f9139, 0x452b5a18, + 0xc5aafda3); + + VSET(16, e32, m1); + // -71423.96093750, -46625.21875000, -59851.39453125, + // -43461.99218750, -10255.72753906, 37671.59765625, + // 96842.05468750, 33293.05859375, 27126.79296875, + // -27343.42187500, 26815.15429688, 28654.72070312, + // -5699.91699219, 70582.03906250, -5936.72802734, + // 43479.90234375 + VLOAD_32(v2, 0xc78b7ffb, 0xc7362138, 0xc769cb65, 0xc729c5fe, 0xc6203ee9, + 0x47132799, 0x47bd2507, 0x47020d0f, 0x46d3ed96, 0xc6d59ed8, + 0x46d17e4f, 0x46dfdd71, 0xc5b21f56, 0x4789db05, 0xc5b985d3, + 0x4729d7e7); + // 93657.15625000, -28369.10156250, -42169.91406250, + // -21377.95507812, 16308.38183594, 64517.84375000, + // -12469.71679688, -76994.53125000, -33687.83593750, + // -84006.54687500, 31506.48437500, 2731.77905273, + // -20272.41992188, 53550.01953125, -85441.62500000, + // -33418.07031250 + VLOAD_32(v6, 0x47b6ec94, 0xc6dda234, 0xc724b9ea, 0xc6a703e9, 0x467ed187, + 0x477c05d8, 0xc642d6de, 0xc7966144, 0xc70397d6, 0xc7a41346, + 0x46f624f8, 0x452abc77, 0xc69e60d7, 0x47512e05, 0xc7a6e0d0, + 0xc7028a12); + // 15054.1952512034331448, -39042.3922682931588497, + // -83554.3539477824524511, 35787.9235785690543707, + // -34715.2784411938628182, 35880.5352577352605294, + // -52433.9701052222590079, -40831.3148960549369804, + // -3569.6808186589187244, 77018.1414445060363505, + // 58906.1301468654128257, -84146.7844421620393405, + // -23969.5482366856886074, 92255.7186088700836990, + // -35519.3091108352309675, -65623.9480113173485734 + VLOAD_64(v4, 0x40cd6718fdfdcea0, 0xc0e3104c8d763c4c, 0xc0f46625a9c52662, + 0x40e1797d8df4a4ac, 0xc0e0f368e8fd81b0, 0x40e1851120d4d47c, + 0xc0e99a3f0b1a1b69, 0xc0e3efea13a0e433, 0xc0abe35c94436520, + 0x40f2cda2435b507a, 0x40ecc3442a29c254, 0xc0f48b2c8d133979, + 0xc0d76863164f52e0, 0x40f685fb7f6c03ba, 0xc0e157e9e43c6805, + 0xc0f0057f2b0dea44); + asm volatile("vfwmsac.vv v4, v2, v6"); + // -6689380123.7125854492187500, 1322754608.4847974777221680, + // 2524011718.2575426101684570, 929092728.6666160821914673, + // -167219605.4339296817779541, 2430454370.8635458946228027, + // -1207540562.0105009078979492, -2563342608.9896693229675293, + // -913839381.3609598875045776, 2296949433.3236432075500488, + // 844792333.7375594377517700, 78362512.5631930530071259, + // 115575080.3336923867464066, 3779577314.6337165832519531, + // 507279209.1484052538871765, -1452948809.7560596466064453 + VCMP_U64(2, v4, 0xc1f8eb7d71bb66c0, 0x41d3b5e88c1f06ec, 0x41e2ce2b98c83dca, + 0x41cbb06a3c5553ad, 0xc1a3ef232ade2c08, 0x41e21bb94c5ba22b, + 0xc1d1fe66d480ac0c, 0xc1e31930221fab5f, 0xc1cb3c0a8aae33ef, + 0x41e11d15572a5b49, 0x41c92d4106de6859, 0x4192aede4240b5ae, + 0x419b8e24a155b375, 0x41ec28f8bc544768, 0x41be3c776925fde3, + 0xc1d5a68f52706348); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -93.0000, -55.1250, -68.5625, 76.3125, -61.2188, 48.9375, + // -56.3125, 71.0000, -74.5625, -38.7188, + // -50.3438, 93.3750, 80.2500, -7.4141, 93.8125, 83.1875 + VLOAD_16(v2, 0xd5d0, 0xd2e4, 0xd449, 0x54c5, 0xd3a7, 0x521e, 0xd30a, 0x5470, + 0xd4a9, 0xd0d7, 0xd24b, 0x55d6, 0x5504, 0xc76a, 0x55dd, 0x5533); + // -60.0312, -31.7188, -74.2500, -0.9077, 30.4844, -56.2500, + // -4.8320, 34.2812, 66.6875, 37.9375, 78.1875, 5.6094, + // -81.8125, 67.6250, 29.4531, -64.9375 + VLOAD_16(v6, 0xd381, 0xcfee, 0xd4a4, 0xbb43, 0x4f9f, 0xd308, 0xc4d5, 0x5049, + 0x542b, 0x50be, 0x54e3, 0x459c, 0xd51d, 0x543a, 0x4f5d, 0xd40f); + VLOAD_8(v0, 0xAA, 0xAA); + // 31.29529381, -66.12346649, + // -48.59321213, 21.66906929, 92.08473206, 1.95985305, + // -96.55027771, 77.65225220, -82.48660278, + // -35.32508850, 42.91923141, + // -76.65069580, 25.13817024, 72.89311981, 21.44047737, 69.71634674 + VLOAD_32(v4, 0x41fa5cc3, 0xc2843f37, 0xc2425f73, 0x41ad5a41, 0x42b82b62, + 0x3ffadc77, 0xc2c119be, 0x429b4df4, 0xc2a4f924, 0xc20d4ce4, + 0x422bad4b, 0xc2994d28, 0x41c91af9, 0x4291c947, 0x41ab8619, + 0x428b6ec5); + asm volatile("vfwmsac.vv v4, v2, v6, v0.t"); + // 31.29529381, 1814.61950684, -48.59321213, + // -90.93905640, 92.08473206, -2754.69433594, -96.55027771, + // 2356.31640625, -82.48660278, -1433.56750488, 42.91923141, + // 600.42608643, 25.13817024, -574.26910400, 21.44047737, + // -5471.70458984 + VCMP_U32(3, v4, 0x41fa5cc3, 0x44e2d3d3, 0xc2425f73, 0xc2b5e0cc, 0x42b82b62, + 0xc52c2b1c, 0xc2c119be, 0x45134510, 0xc2a4f924, 0xc4b33229, + 0x422bad4b, 0x44161b45, 0x41c91af9, 0xc40f9139, 0x41ab8619, + 0xc5aafda3); + + VSET(16, e32, m1); + // -71423.96093750, -46625.21875000, -59851.39453125, + // -43461.99218750, -10255.72753906, 37671.59765625, + // 96842.05468750, 33293.05859375, 27126.79296875, + // -27343.42187500, 26815.15429688, 28654.72070312, + // -5699.91699219, 70582.03906250, -5936.72802734, + // 43479.90234375 + VLOAD_32(v2, 0xc78b7ffb, 0xc7362138, 0xc769cb65, 0xc729c5fe, 0xc6203ee9, + 0x47132799, 0x47bd2507, 0x47020d0f, 0x46d3ed96, 0xc6d59ed8, + 0x46d17e4f, 0x46dfdd71, 0xc5b21f56, 0x4789db05, 0xc5b985d3, + 0x4729d7e7); + // 93657.15625000, -28369.10156250, -42169.91406250, + // -21377.95507812, 16308.38183594, 64517.84375000, + // -12469.71679688, -76994.53125000, -33687.83593750, + // -84006.54687500, 31506.48437500, 2731.77905273, + // -20272.41992188, 53550.01953125, -85441.62500000, + // -33418.07031250 + VLOAD_32(v6, 0x47b6ec94, 0xc6dda234, 0xc724b9ea, 0xc6a703e9, 0x467ed187, + 0x477c05d8, 0xc642d6de, 0xc7966144, 0xc70397d6, 0xc7a41346, + 0x46f624f8, 0x452abc77, 0xc69e60d7, 0x47512e05, 0xc7a6e0d0, + 0xc7028a12); + VLOAD_8(v0, 0xAA, 0xAA); + // 15054.1952512034331448, -39042.3922682931588497, + // -83554.3539477824524511, 35787.9235785690543707, + // -34715.2784411938628182, 35880.5352577352605294, + // -52433.9701052222590079, -40831.3148960549369804, + // -3569.6808186589187244, 77018.1414445060363505, + // 58906.1301468654128257, -84146.7844421620393405, + // -23969.5482366856886074, 92255.7186088700836990, + // -35519.3091108352309675, -65623.9480113173485734 + VLOAD_64(v4, 0x40cd6718fdfdcea0, 0xc0e3104c8d763c4c, 0xc0f46625a9c52662, + 0x40e1797d8df4a4ac, 0xc0e0f368e8fd81b0, 0x40e1851120d4d47c, + 0xc0e99a3f0b1a1b69, 0xc0e3efea13a0e433, 0xc0abe35c94436520, + 0x40f2cda2435b507a, 0x40ecc3442a29c254, 0xc0f48b2c8d133979, + 0xc0d76863164f52e0, 0x40f685fb7f6c03ba, 0xc0e157e9e43c6805, + 0xc0f0057f2b0dea44); + asm volatile("vfwmsac.vv v4, v2, v6, v0.t"); + // 15054.1952512034331448, 1322754608.4847974777221680, + // -83554.3539477824524511, 929092728.6666160821914673, + // -34715.2784411938628182, 2430454370.8635458946228027, + // -52433.9701052222590079, -2563342608.9896693229675293, + // -3569.6808186589187244, 2296949433.3236432075500488, + // 58906.1301468654128257, 78362512.5631930530071259, + // -23969.5482366856886074, 3779577314.6337165832519531, + // -35519.3091108352309675, -1452948809.7560596466064453 + VCMP_U64(4, v4, 0x40cd6718fdfdcea0, 0x41d3b5e88c1f06ec, 0xc0f46625a9c52662, + 0x41cbb06a3c5553ad, 0xc0e0f368e8fd81b0, 0x41e21bb94c5ba22b, + 0xc0e99a3f0b1a1b69, 0xc1e31930221fab5f, 0xc0abe35c94436520, + 0x41e11d15572a5b49, 0x40ecc3442a29c254, 0x4192aede4240b5ae, + 0xc0d76863164f52e0, 0x41ec28f8bc544768, 0xc0e157e9e43c6805, + 0xc1d5a68f52706348); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 8.1562, 2.6836, 56.7188, 38.4688, 33.8125, + // -83.0625, 37.7812, -28.0938, -33.0625, 61.1562, 13.0859, + // -80.5000, 78.3125, -38.0625, 30.0625, -78.6250 + VLOAD_16(v2, 0x4814, 0x415e, 0x5317, 0x50cf, 0x503a, 0xd531, 0x50b9, 0xcf06, + 0xd022, 0x53a5, 0x4a8b, 0xd508, 0x54e5, 0xd0c2, 0x4f84, 0xd4ea); + // 39.8125 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x50fa); + // 56.66989136, 59.83663559, -8.21133614, -19.17305374, + // -93.35797119, -34.25491333, 46.99548721, + // -6.17113161, 55.22229004, 7.96844339, -92.84493256, + // -90.90106201, 78.59468842, -58.67407608, 39.90958405, + // -93.58789825 + VLOAD_32(v4, 0x4262adf8, 0x426f58b7, 0xc10361a2, 0xc199626a, 0xc2bab748, + 0xc2090508, 0x423bfb61, 0xc0c579e9, 0x425ce3a0, 0x40fefd7d, + 0xc2b9b09b, 0xc2b5cd58, 0x429d307b, 0xc26ab241, 0x421fa36a, + 0xc2bb2d01); + asm volatile("vfwmsac.vf v4, %[A], v2" ::[A] "f"(dscalar_16)); + // 268.05081177, 47.00394058, 2266.32666016, 1550.71020508, + // 1439.51806641, -3272.67089844, 1457.17053223, + // -1112.31127930, -1371.52307129, 2426.81469727, 613.82879639, + // -3114.00512695, 3039.22167969, -1456.68920898, + // 1156.95373535, -3036.66992188 + VCMP_U32(5, v4, 0x43860681, 0x423c0409, 0x450da53a, 0x44c1d6ba, 0x44b3f094, + 0xc54c8abc, 0x44b62575, 0xc48b09f6, 0xc4ab70bd, 0x4517ad09, + 0x4419750b, 0xc542a015, 0x453df38c, 0xc4b6160e, 0x44909e85, + 0xc53dcab8); + + VSET(16, e32, m1); + double dscalar_32; + // 580253.06250000, -300331.93750000, 485801.21875000, + // -751037.87500000, -360868.65625000, 893035.68750000, + // 541162.00000000, 417622.93750000, -933287.18750000, + // -790074.12500000, 496987.96875000, 455066.96875000, + // -928285.18750000, 300725.40625000, -645096.93750000, + // 102530.55468750 + VLOAD_32(v2, 0x490da9d1, 0xc892a57e, 0x48ed3527, 0xc9375bde, 0xc8b03495, + 0x495a06bb, 0x49041ea0, 0x48cbeade, 0xc963da73, 0xc940e3a2, + 0x48f2ab7f, 0x48de335f, 0xc962a1d3, 0x4892d6ad, 0xc91d7e8f, + 0x47c84147); + // 670995.56250000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x4923d139); + // 579132.0708449089433998, 521241.3016625398304313, + // 409779.0302067114971578, 454935.4394149139989167, + // -640831.0776052488945425, 262502.9360184965189546, + // -132061.7241549796890467, -523289.4277524493518285, + // 796635.9535234714858234, 170970.3947326899506152, + // -520724.0386287728324533, -616193.5881990450434387, + // 79952.4583538805600256, -869849.3916852036491036, + // 535808.2751473840326071, -306070.6657954099355265 + VLOAD_64(v4, 0x4121ac782445c8ae, 0x411fd06534e7065c, 0x411902cc1eee8218, + 0x411bc45dc1f5fbb4, 0xc1238e7e27bbe00c, 0x4110059bbe7ba1fc, + 0xc1001eedcb11c418, 0xc11ff065b604bcf3, 0x41284fb7e8343a7c, + 0x4104ded328699cd0, 0xc11fc850278e4d10, 0xc122ce032d286cdc, + 0x40f38507556ae0f0, 0xc12a8bb2c88af688, 0x41205a008ce01e30, + 0xc112ae5aa9c6459e); + asm volatile("vfwmsac.vf v4, %[A], v2" ::[A] "f"(dscalar_32)); + // 389346650932.4642944335937500, + // -201521918580.8290100097656250, + // 325970052259.3115844726562500, + // -503943536329.8690795898437500, + // -242140626158.0102844238281250, + // 599222720963.7006835937500000, 363117432655.3491821289062500, + // 280223661150.1425781250000000, + // -626232357986.5589599609375000, + // -530136402891.4650268554687500, + // 333477242371.1773071289062500, 305348532865.1643676757812500, + // -622875321499.4388427734375000, + // 201786282974.1514587402343750, + // -432857718253.1149902343750000, 68797853286.6418762207031250 + VCMP_U64(6, v4, 0x4256a9b79acd1db7, 0xc24775d2393a6a1d, 0x4252f9551128d3f1, + 0xc25d555807b2779f, 0xc24c305a5e770151, 0x4261708ea338766c, + 0x425522df13d3d659, 0x42504fa86f178920, 0xc26239cb6e8c51e3, + 0xc25edba5e2f2ddc3, 0x42536932b980cb59, 0x4251c60c36a04a85, + 0xc26220c864936e0b, 0x42477db329ef1363, 0xc2593215277b475c, + 0x423004abee66a452); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 8.1562, 2.6836, 56.7188, 38.4688, 33.8125, + // -83.0625, 37.7812, -28.0938, -33.0625, 61.1562, 13.0859, + // -80.5000, 78.3125, -38.0625, 30.0625, -78.6250 + VLOAD_16(v2, 0x4814, 0x415e, 0x5317, 0x50cf, 0x503a, 0xd531, 0x50b9, 0xcf06, + 0xd022, 0x53a5, 0x4a8b, 0xd508, 0x54e5, 0xd0c2, 0x4f84, 0xd4ea); + // 39.8125 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x50fa); + VLOAD_8(v0, 0xAA, 0xAA); + // 56.66989136, 59.83663559, -8.21133614, -19.17305374, + // -93.35797119, -34.25491333, 46.99548721, + // -6.17113161, 55.22229004, 7.96844339, -92.84493256, + // -90.90106201, 78.59468842, -58.67407608, 39.90958405, + // -93.58789825 + VLOAD_32(v4, 0x4262adf8, 0x426f58b7, 0xc10361a2, 0xc199626a, 0xc2bab748, + 0xc2090508, 0x423bfb61, 0xc0c579e9, 0x425ce3a0, 0x40fefd7d, + 0xc2b9b09b, 0xc2b5cd58, 0x429d307b, 0xc26ab241, 0x421fa36a, + 0xc2bb2d01); + asm volatile("vfwmsac.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // 56.66989136, 47.00394058, -8.21133614, 1550.71020508, + // -93.35797119, -3272.67089844, 46.99548721, + // -1112.31127930, 55.22229004, 2426.81469727, -92.84493256, + // -3114.00512695, 78.59468842, -1456.68920898, 39.90958405, + // -3036.66992188 + VCMP_U32(7, v4, 0x4262adf8, 0x423c0409, 0xc10361a2, 0x44c1d6ba, 0xc2bab748, + 0xc54c8abc, 0x423bfb61, 0xc48b09f6, 0x425ce3a0, 0x4517ad09, + 0xc2b9b09b, 0xc542a015, 0x429d307b, 0xc4b6160e, 0x421fa36a, + 0xc53dcab8); + + VSET(16, e32, m1); + double dscalar_32; + // 580253.06250000, -300331.93750000, 485801.21875000, + // -751037.87500000, -360868.65625000, 893035.68750000, + // 541162.00000000, 417622.93750000, -933287.18750000, + // -790074.12500000, 496987.96875000, 455066.96875000, + // -928285.18750000, 300725.40625000, -645096.93750000, + // 102530.55468750 + VLOAD_32(v2, 0x490da9d1, 0xc892a57e, 0x48ed3527, 0xc9375bde, 0xc8b03495, + 0x495a06bb, 0x49041ea0, 0x48cbeade, 0xc963da73, 0xc940e3a2, + 0x48f2ab7f, 0x48de335f, 0xc962a1d3, 0x4892d6ad, 0xc91d7e8f, + 0x47c84147); + // 670995.56250000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x4923d139); + VLOAD_8(v0, 0xAA, 0xAA); + // 579132.0708449089433998, 521241.3016625398304313, + // 409779.0302067114971578, 454935.4394149139989167, + // -640831.0776052488945425, 262502.9360184965189546, + // -132061.7241549796890467, -523289.4277524493518285, + // 796635.9535234714858234, 170970.3947326899506152, + // -520724.0386287728324533, -616193.5881990450434387, + // 79952.4583538805600256, -869849.3916852036491036, + // 535808.2751473840326071, -306070.6657954099355265 + VLOAD_64(v4, 0x4121ac782445c8ae, 0x411fd06534e7065c, 0x411902cc1eee8218, + 0x411bc45dc1f5fbb4, 0xc1238e7e27bbe00c, 0x4110059bbe7ba1fc, + 0xc1001eedcb11c418, 0xc11ff065b604bcf3, 0x41284fb7e8343a7c, + 0x4104ded328699cd0, 0xc11fc850278e4d10, 0xc122ce032d286cdc, + 0x40f38507556ae0f0, 0xc12a8bb2c88af688, 0x41205a008ce01e30, + 0xc112ae5aa9c6459e); + asm volatile("vfwmsac.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // 579132.0708449089433998, -201521918580.8290100097656250, + // 409779.0302067114971578, -503943536329.8690795898437500, + // -640831.0776052488945425, 599222720963.7006835937500000, + // -132061.7241549796890467, 280223661150.1425781250000000, + // 796635.9535234714858234, -530136402891.4650268554687500, + // -520724.0386287728324533, 305348532865.1643676757812500, + // 79952.4583538805600256, 201786282974.1514587402343750, + // 535808.2751473840326071, 68797853286.6418762207031250 + VCMP_U64(8, v4, 0x4121ac782445c8ae, 0xc24775d2393a6a1d, 0x411902cc1eee8218, + 0xc25d555807b2779f, 0xc1238e7e27bbe00c, 0x4261708ea338766c, + 0xc1001eedcb11c418, 0x42504fa86f178920, 0x41284fb7e8343a7c, + 0xc25edba5e2f2ddc3, 0xc11fc850278e4d10, 0x4251c60c36a04a85, + 0x40f38507556ae0f0, 0x42477db329ef1363, 0x41205a008ce01e30, + 0x423004abee66a452); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwmul.c b/apps/riscv-tests/isa/rv64uv/vfwmul.c new file mode 100644 index 0000000..c9f5f1c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwmul.c @@ -0,0 +1,254 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -56.5312, 95.3750, 86.3750, -33.4375, 4.7656, 58.8438, + // -80.4375, -96.4375, 74.3750, -92.7500, -57.2812, -90.0625, + // -93.2500, 40.6875, -32.2812, -36.8125 + VLOAD_16(v2, 0xd311, 0x55f6, 0x5566, 0xd02e, 0x44c4, 0x535b, 0xd507, 0xd607, + 0x54a6, 0xd5cc, 0xd329, 0xd5a1, 0xd5d4, 0x5116, 0xd009, 0xd09a); + // 96.4375, -98.8125, -49.1250, -78.8750, + // -5.9180, 32.8750, 32.8750, -74.8125, + // -10.3750, 39.5938, 43.2812, 15.0547, -31.9062, + // -11.2500, 16.3594, 28.6094 + VLOAD_16(v6, 0x5607, 0xd62d, 0xd224, 0xd4ee, 0xc5eb, 0x501c, 0x501c, 0xd4ad, + 0xc930, 0x50f3, 0x5169, 0x4b87, 0xcffa, 0xc9a0, 0x4c17, 0x4f27); + asm volatile("vfwmul.vv v4, v2, v6"); + // -5451.73242188, -9424.24218750, -4243.17187500, 2637.38281250, + // -28.20281982, 1934.48828125, -2644.38281250, 7214.73046875, + // -771.64062500, -3672.32031250, -2479.20410156, -1355.86279297, + // 2975.25781250, -457.73437500, -528.10107422, -1053.18261719 + VCMP_U32(1, v4, 0xc5aa5ddc, 0xc61340f8, 0xc5849960, 0x4524d620, 0xc1e19f60, + 0x44f1cfa0, 0xc5254620, 0x45e175d8, 0xc440e900, 0xc5658520, + 0xc51af344, 0xc4a97b9c, 0x4539f420, 0xc3e4de00, 0xc4040678, + 0xc483a5d8); + + VSET(16, e32, m1); + // -89875.40625000, 87678.49218750, -37342.58593750, + // -47507.81640625, -80717.72656250, 2230.02978516, + // -68805.99218750, 79032.60156250, -43338.95703125, + // 42250.94531250, -6447.03955078, 25544.21679688, + // 5945.30566406, -47409.30468750, -43415.17187500, + // 92669.35156250 + VLOAD_32(v2, 0xc7af89b4, 0x47ab3f3f, 0xc711de96, 0xc73993d1, 0xc79da6dd, + 0x450b607a, 0xc78662ff, 0x479a5c4d, 0xc7294af5, 0x47250af2, + 0xc5c97851, 0x46c7906f, 0x45b9ca72, 0xc739314e, 0xc729972c, + 0x47b4fead); + // 99630.39843750, 37076.73437500, -66118.01562500, + // -99829.85156250, -78879.75000000, 75633.85937500, + // -90564.15625000, -84653.48437500, 34630.80859375, + // 85817.48437500, -23627.74023438, -79522.11718750, + // 51590.63671875, 7574.55957031, -93117.57812500, + // 28056.31054688 + VLOAD_32(v6, 0x47c29733, 0x4710d4bc, 0xc7812302, 0xc7c2faed, 0xc79a0fe0, + 0x4793b8ee, 0xc7b0e214, 0xc7a556be, 0x470746cf, 0x47a79cbe, + 0xc6b8977b, 0xc79b510f, 0x474986a3, 0x45ecb47a, 0xc7b5deca, + 0x46db309f); + asm volatile("vfwmul.vv v4, v2, v6"); + // -8954322534.4196777343750000, 3250832165.2364501953125000, + // 2469017680.4935302734375000, 4742698259.8944396972656250, + // 6366994091.8183593750000000, 168665759.1725692749023438, + // 6231356627.4050292968750000, -6690385101.4866943359375000, + // -1500863125.6019744873046875, 3625869839.1844482421875000, + // 152328975.7866010665893555, -2031330201.5839996337890625, + // 306722104.6965751647949219, -359104602.5425643920898438, + // 4042715658.8806152343750000, 2599960105.6150360107421875 + VCMP_U64(2, v4, 0xc200adc0f3335b80, 0x41e8387864a79100, 0x41e265470a0fcb00, + 0x41f1aafd513e4fa0, 0x41f7b809eabd1800, 0x41a41b453e585b00, + 0x41f736af4d367b00, 0xc1f8ec72ccd7c980, 0xc1d65d56a56686c0, + 0x41eb03cc41e5e700, 0x41a228b61f92bd60, 0xc1de44e8e6656040, + 0x41b2483538b252c0, 0xc1b567805a8ae580, 0x41ee1ede415c2e00, + 0x41e35f07c533ae60); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -56.5312, 95.3750, 86.3750, -33.4375, 4.7656, 58.8438, + // -80.4375, -96.4375, 74.3750, -92.7500, -57.2812, -90.0625, + // -93.2500, 40.6875, -32.2812, -36.8125 + VLOAD_16(v2, 0xd311, 0x55f6, 0x5566, 0xd02e, 0x44c4, 0x535b, 0xd507, 0xd607, + 0x54a6, 0xd5cc, 0xd329, 0xd5a1, 0xd5d4, 0x5116, 0xd009, 0xd09a); + // 96.4375, -98.8125, -49.1250, -78.8750, + // -5.9180, 32.8750, 32.8750, -74.8125, + // -10.3750, 39.5938, 43.2812, 15.0547, -31.9062, + // -11.2500, 16.3594, 28.6094 + VLOAD_16(v6, 0x5607, 0xd62d, 0xd224, 0xd4ee, 0xc5eb, 0x501c, 0x501c, 0xd4ad, + 0xc930, 0x50f3, 0x5169, 0x4b87, 0xcffa, 0xc9a0, 0x4c17, 0x4f27); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwmul.vv v4, v2, v6, v0.t"); + // 0.00000000, -9424.24218750, 0.00000000, 2637.38281250, + // 0.00000000, 1934.48828125, 0.00000000, 7214.73046875, + // 0.00000000, -3672.32031250, 0.00000000, -1355.86279297, + // 0.00000000, -457.73437500, 0.00000000, -1053.18261719 + VCMP_U32(3, v4, 0x0, 0xc61340f8, 0x0, 0x4524d620, 0x0, 0x44f1cfa0, 0x0, + 0x45e175d8, 0x0, 0xc5658520, 0x0, 0xc4a97b9c, 0x0, 0xc3e4de00, 0x0, + 0xc483a5d8); + + VSET(16, e32, m1); + // -89875.40625000, 87678.49218750, -37342.58593750, + // -47507.81640625, -80717.72656250, 2230.02978516, + // -68805.99218750, 79032.60156250, -43338.95703125, + // 42250.94531250, -6447.03955078, 25544.21679688, + // 5945.30566406, -47409.30468750, -43415.17187500, + // 92669.35156250 + VLOAD_32(v2, 0xc7af89b4, 0x47ab3f3f, 0xc711de96, 0xc73993d1, 0xc79da6dd, + 0x450b607a, 0xc78662ff, 0x479a5c4d, 0xc7294af5, 0x47250af2, + 0xc5c97851, 0x46c7906f, 0x45b9ca72, 0xc739314e, 0xc729972c, + 0x47b4fead); + // 99630.39843750, 37076.73437500, -66118.01562500, + // -99829.85156250, -78879.75000000, 75633.85937500, + // -90564.15625000, -84653.48437500, 34630.80859375, + // 85817.48437500, -23627.74023438, -79522.11718750, + // 51590.63671875, 7574.55957031, -93117.57812500, + // 28056.31054688 + VLOAD_32(v6, 0x47c29733, 0x4710d4bc, 0xc7812302, 0xc7c2faed, 0xc79a0fe0, + 0x4793b8ee, 0xc7b0e214, 0xc7a556be, 0x470746cf, 0x47a79cbe, + 0xc6b8977b, 0xc79b510f, 0x474986a3, 0x45ecb47a, 0xc7b5deca, + 0x46db309f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwmul.vv v4, v2, v6, v0.t"); + // 0.0000000000000000, 3250832165.2364501953125000, + // 0.0000000000000000, 4742698259.8944396972656250, + // 0.0000000000000000, 168665759.1725692749023438, + // 0.0000000000000000, -6690385101.4866943359375000, + // 0.0000000000000000, 3625869839.1844482421875000, + // 0.0000000000000000, -2031330201.5839996337890625, + // 0.0000000000000000, -359104602.5425643920898438, + // 0.0000000000000000, 2599960105.6150360107421875 + VCMP_U64(4, v4, 0x0, 0x41e8387864a79100, 0x0, 0x41f1aafd513e4fa0, 0x0, + 0x41a41b453e585b00, 0x0, 0xc1f8ec72ccd7c980, 0x0, 0x41eb03cc41e5e700, + 0x0, 0xc1de44e8e6656040, 0x0, 0xc1b567805a8ae580, 0x0, + 0x41e35f07c533ae60); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -44.4062, -27.0781, -21.6562, 75.5625, -84.5000, + // -1.0713, 72.5625, -84.6250, 83.9375, -52.3438, + // -40.5625, 1.6523, 79.6875, -36.2812, 33.5938, -72.4375 + VLOAD_16(v2, 0xd18d, 0xcec5, 0xcd6a, 0x54b9, 0xd548, 0xbc49, 0x5489, 0xd54a, + 0x553f, 0xd28b, 0xd112, 0x3e9c, 0x54fb, 0xd089, 0x5033, 0xd487); + // -58.9688 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xd35f); + asm volatile("vfwmul.vf v4, v2, %[A]" ::[A] "f"(dscalar_16)); + // 2618.58105469, 1596.76318359, 1277.04199219, + // -4455.82617188, 4982.85937500, 63.17257690, -4278.91992188, + // 4990.23046875, -4949.68945312, 3086.64550781, 2391.91992188, + // -97.43664551, -4699.07226562, 2139.45996094, -1980.98144531, + // 4271.54882812 + VCMP_U32(5, v4, 0x4523a94c, 0x44c7986c, 0x449fa158, 0xc58b3e9c, 0x459bb6e0, + 0x427cb0b8, 0xc585b75c, 0x459bf1d8, 0xc59aad84, 0x4540ea54, + 0x45157eb8, 0xc2c2df90, 0xc592d894, 0x4505b75c, 0xc4f79f68, + 0x45857c64); + + VSET(16, e32, m1); + double dscalar_32; + // -187018.20312500, -714032.18750000, -891429.25000000, + // -378265.00000000, 211566.90625000, 231934.78125000, + // 947047.75000000, -241945.03125000, -489658.75000000, + // -788001.68750000, -817411.37500000, -522168.21875000, + // -668021.56250000, 744069.12500000, -620354.68750000, + // 913454.68750000 + VLOAD_32(v2, 0xc836a28d, 0xc92e5303, 0xc959a254, 0xc8b8b320, 0x484e9bba, + 0x48627fb2, 0x4967367c, 0xc86c4642, 0xc8ef1758, 0xc940621b, + 0xc9479036, 0xc8fef707, 0xc9231759, 0x4935a852, 0xc917742b, + 0x495f02eb); + // -50557.21484375 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc7457d37); + asm volatile("vfwmul.vf v4, v2, %[A]" ::[A] "f"(dscalar_32)); + // 9455119475.0827026367187500, 36099478708.7902832031250000, + // 45068180110.2529296875000000, 19124024872.8710937500000000, + // -10696233533.1087646484375000, -11725976565.3944091796875000, + // -47880096564.0400390625000000, 12232066925.2840576171875000, + // 24755782623.8720703125000000, 39839170612.1750488281250000, + // 41326042501.6000976562500000, 26399370819.9219970703125000, + // 33773309655.5700683593750000, -37618062611.2260742187500000, + // 31363405215.2648925781250000, -46181724885.9680175781250000 + VCMP_U64(6, v4, 0x42019c8d6398a960, 0x4220cf64a96994a0, 0x4224fc8bb51c8180, + 0x4211cf85d8a37c00, 0xc203ec5c91e8dec0, 0xc205d7619fab27c0, + 0xc2264bc096681480, 0x4206c8b43b6a45c0, 0x42170e3d0f7f7d00, + 0x42228d33006859a0, 0x42233e72bb0b3340, 0x42189619b90fb020, + 0x421f742f3b5e47c0, 0xc221846c2a2673c0, 0x421d359e567d0f40, + 0xc225814a65abefa0); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -44.4062, -27.0781, -21.6562, 75.5625, -84.5000, + // -1.0713, 72.5625, -84.6250, 83.9375, -52.3438, + // -40.5625, 1.6523, 79.6875, -36.2812, 33.5938, -72.4375 + VLOAD_16(v2, 0xd18d, 0xcec5, 0xcd6a, 0x54b9, 0xd548, 0xbc49, 0x5489, 0xd54a, + 0x553f, 0xd28b, 0xd112, 0x3e9c, 0x54fb, 0xd089, 0x5033, 0xd487); + // -58.9688 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xd35f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwmul.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.00000000, 1596.76318359, 0.00000000, -4455.82617188, + // 0.00000000, 63.17257690, 0.00000000, 4990.23046875, + // 0.00000000, 3086.64550781, 0.00000000, -97.43664551, + // 0.00000000, 2139.45996094, 0.00000000, 4271.54882812 + VCMP_U32(7, v4, 0x0, 0x44c7986c, 0x0, 0xc58b3e9c, 0x0, 0x427cb0b8, 0x0, + 0x459bf1d8, 0x0, 0x4540ea54, 0x0, 0xc2c2df90, 0x0, 0x4505b75c, 0x0, + 0x45857c64); + + VSET(16, e32, m1); + double dscalar_32; + // -187018.20312500, -714032.18750000, -891429.25000000, + // -378265.00000000, 211566.90625000, 231934.78125000, + // 947047.75000000, -241945.03125000, -489658.75000000, + // -788001.68750000, -817411.37500000, -522168.21875000, + // -668021.56250000, 744069.12500000, -620354.68750000, + // 913454.68750000 + VLOAD_32(v2, 0xc836a28d, 0xc92e5303, 0xc959a254, 0xc8b8b320, 0x484e9bba, + 0x48627fb2, 0x4967367c, 0xc86c4642, 0xc8ef1758, 0xc940621b, + 0xc9479036, 0xc8fef707, 0xc9231759, 0x4935a852, 0xc917742b, + 0x495f02eb); + // -50557.21484375 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc7457d37); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwmul.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.0000000000000000, 36099478708.7902832031250000, + // 0.0000000000000000, 19124024872.8710937500000000, + // 0.0000000000000000, -11725976565.3944091796875000, + // 0.0000000000000000, 12232066925.2840576171875000, + // 0.0000000000000000, 39839170612.1750488281250000, + // 0.0000000000000000, 26399370819.9219970703125000, + // 0.0000000000000000, -37618062611.2260742187500000, + // 0.0000000000000000, -46181724885.9680175781250000 + VCMP_U64(8, v4, 0x0, 0x4220cf64a96994a0, 0x0, 0x4211cf85d8a37c00, 0x0, + 0xc205d7619fab27c0, 0x0, 0x4206c8b43b6a45c0, 0x0, 0x42228d33006859a0, + 0x0, 0x42189619b90fb020, 0x0, 0xc221846c2a2673c0, 0x0, + 0xc225814a65abefa0); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwnmacc.c b/apps/riscv-tests/isa/rv64uv/vfwnmacc.c new file mode 100644 index 0000000..500af15 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwnmacc.c @@ -0,0 +1,352 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 33.9375, 31.7344, -56.0000, -62.0625, 77.6875, -7.7383, + // -75.3750, 4.1953, 79.5625, -87.3750, + // -37.2188, 90.5000, 68.0625, 69.0625, 54.0312, -64.6875 + VLOAD_16(v2, 0x503e, 0x4fef, 0xd300, 0xd3c2, 0x54db, 0xc7bd, 0xd4b6, 0x4432, + 0x54f9, 0xd576, 0xd0a7, 0x55a8, 0x5441, 0x5451, 0x52c1, 0xd40b); + // -92.3125, -75.9375, 26.1094, + // -79.6875, 3.9375, 37.2812, 50.7812, -3.9375, -55.9688, + // -31.5312, 76.0000, 69.1875, -8.2578, -52.5000, + // -98.4375, 40.3438 + VLOAD_16(v6, 0xd5c5, 0xd4bf, 0x4e87, 0xd4fb, 0x43e0, 0x50a9, 0x5259, 0xc3e0, + 0xd2ff, 0xcfe2, 0x54c0, 0x5453, 0xc821, 0xd290, 0xd627, 0x510b); + // 75.62483215, 29.19676971, 69.45310211, -70.36167145, + // -0.92180759, -77.84928131, 86.66299438, -43.34124756, + // -3.36894345, 7.33576536, -64.43717194, -80.48993683, + // -5.57641745, 89.34833527, -39.19780731, -55.64332581 + VLOAD_32(v4, 0x42973fea, 0x41e992fc, 0x428ae7fd, 0xc28cb92d, 0xbf6bfb95, + 0xc29bb2d5, 0x42ad5374, 0xc22d5d70, 0xc0579cc5, 0x40eabe97, + 0xc280dfd5, 0xc2a0fad9, 0xc0b27203, 0x42b2b259, 0xc21cca8e, + 0xc25e92c4); + asm volatile("vfwnmacc.vv v4, v2, v6"); + // 3057.23071289, 2380.63232422, 1392.67187500, + // -4875.24365234, -304.97271729, 366.34207153, + // 3740.97363281, 59.86029053, 4456.38281250, -2762.37866211, + // 2893.06225586, -6180.97900391, 567.62377930, 3536.43286133, + // 5357.89892578, 2665.37963867 + VCMP_U32(1, v4, 0x453f13b1, 0x4514ca1e, 0x44ae1580, 0xc59859f3, 0xc3987c82, + 0x43b72bc9, 0x4569cf94, 0x426f70f0, 0x458b4310, 0xc52ca60f, + 0x4534d0ff, 0xc5c127d5, 0x440de7ec, 0x455d06ed, 0x45a76f31, + 0x45269613); + + VSET(16, e32, m1); + // 24686.12304688, 45012.43359375, 5708.16113281, + // -32777.98828125, 74121.31250000, -74877.15625000, + // -60082.02734375, 46400.20312500, -45509.65234375, + // -63994.57031250, -8693.70019531, 57683.04296875, + // 70424.14843750, 90967.72656250, 16158.18359375, + // -90782.41406250 + VLOAD_32(v2, 0x46c0dc3f, 0x472fd46f, 0x45b2614a, 0xc70009fd, 0x4790c4a8, + 0xc7923e94, 0xc76ab207, 0x47354034, 0xc731c5a7, 0xc779fa92, + 0xc607d6cd, 0x4761530b, 0x47898c13, 0x47b1abdd, 0x467c78bc, + 0xc7b14f35); + // -87108.13281250, -7857.04492188, -40309.92968750, + // -77418.73437500, 28954.62109375, -28385.13085938, + // 42368.34375000, -32644.74804688, 89327.02343750, + // -91567.60156250, -25929.78515625, -88250.83593750, + // -49992.60156250, 34217.12500000, 49765.98046875, + // 8088.22802734 + VLOAD_32(v6, 0xc7aa2211, 0xc5f5885c, 0xc71d75ee, 0xc797355e, 0x46e2353e, + 0xc6ddc243, 0x47258058, 0xc6ff097f, 0x47ae7783, 0xc7b2d7cd, + 0xc6ca9392, 0xc7ac5d6b, 0xc743489a, 0x4705a920, 0x474265fb, + 0x45fcc1d3); + // -95159.7034957902651513, -25746.0480722606444033, + // -89272.3172746254567755, -57390.5516721799431252, + // 98139.9797031646012329, -66607.6782029465102823, + // 67788.7602550606534351, -90593.7788542728667380, + // -68056.0128839309472824, -37127.9738570771587547, + // 21060.8546093095501419, -76483.1707763712329324, + // 83261.7813338561973069, -99608.0446094776270911, + // 32602.1877863906847779, 52037.0826651407405734 + VLOAD_64(v4, 0xc0f73b7b4184cd41, 0xc0d92483139dacd4, 0xc0f5cb85138e8ec3, + 0xc0ec05d1a74c6a5f, 0x40f7f5bfacdd39bc, 0xc0f042fad9eb5535, + 0x40f08ccc2a0135e2, 0xc0f61e1c762fe5e5, 0xc0f09d8034c5c7e1, + 0xc0e220ff29d6512c, 0x40d49136b1eb3ed8, 0xc0f2ac32bb800116, + 0x40f453dc8057edfa, 0xc0f85180b6b86d78, 0x40dfd68c04b135a8, + 0x40e968a2a5315d80); + asm volatile("vfwnmacc.vv v4, v2, v6"); + // 2150457244.6964006423950195, 353690458.8370813727378845, + // 230184846.2258668541908264, -2537572977.5412845611572266, + // -2146252658.3886387348175049, -2125331270.8559157848358154, + // 2545508198.9366445541381836, 1514813534.1183013916015625, + // 4065309837.5555171966552734, -5859792188.5645341873168945, + // -225446839.1319110989570618, 5090653244.5816955566406250, + // 3520603131.4329605102539062, -3112554462.7102732658386230, + // -804160451.3248255252838135, 734216828.7275727987289429 + VCMP_U64(2, v4, 0x41e005abf39648ea, 0x41b514e35ad64af7, 0x41ab70af1c73a4d2, + 0xc1e2e8094e315234, 0xc1dffb4ddc98df75, 0xc1dfab7ed1b6c753, + 0x41e2f72becddf8fe, 0x41d6928e17879240, 0x41ee49f691b1c6cc, + 0xc1f5d45553c90855, 0xc1aae0176e4389da, 0x41f2f6d343c94ea0, + 0x41ea3b047f6ddad0, 0xc1e730b9fbd6ba8f, 0xc1c7f741e1a993e2, + 0x41c5e1a13e5d211b); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 33.9375, 31.7344, -56.0000, -62.0625, 77.6875, -7.7383, + // -75.3750, 4.1953, 79.5625, -87.3750, + // -37.2188, 90.5000, 68.0625, 69.0625, 54.0312, -64.6875 + VLOAD_16(v2, 0x503e, 0x4fef, 0xd300, 0xd3c2, 0x54db, 0xc7bd, 0xd4b6, 0x4432, + 0x54f9, 0xd576, 0xd0a7, 0x55a8, 0x5441, 0x5451, 0x52c1, 0xd40b); + // -92.3125, -75.9375, 26.1094, + // -79.6875, 3.9375, 37.2812, 50.7812, -3.9375, -55.9688, + // -31.5312, 76.0000, 69.1875, -8.2578, -52.5000, + // -98.4375, 40.3438 + VLOAD_16(v6, 0xd5c5, 0xd4bf, 0x4e87, 0xd4fb, 0x43e0, 0x50a9, 0x5259, 0xc3e0, + 0xd2ff, 0xcfe2, 0x54c0, 0x5453, 0xc821, 0xd290, 0xd627, 0x510b); + VLOAD_8(v0, 0xAA, 0xAA); + // 75.62483215, 29.19676971, 69.45310211, -70.36167145, + // -0.92180759, -77.84928131, 86.66299438, -43.34124756, + // -3.36894345, 7.33576536, -64.43717194, -80.48993683, + // -5.57641745, 89.34833527, -39.19780731, -55.64332581 + VLOAD_32(v4, 0x42973fea, 0x41e992fc, 0x428ae7fd, 0xc28cb92d, 0xbf6bfb95, + 0xc29bb2d5, 0x42ad5374, 0xc22d5d70, 0xc0579cc5, 0x40eabe97, + 0xc280dfd5, 0xc2a0fad9, 0xc0b27203, 0x42b2b259, 0xc21cca8e, + 0xc25e92c4); + asm volatile("vfwnmacc.vv v4, v2, v6, v0.t"); + // 75.62483215, 2380.63232422, 69.45310211, -4875.24365234, + // -0.92180759, 366.34207153, 86.66299438, 59.86029053, + // -3.36894345, -2762.37866211, -64.43717194, -6180.97900391, + // -5.57641745, 3536.43286133, -39.19780731, 2665.37963867 + VCMP_U32(3, v4, 0x42973fea, 0x4514ca1e, 0x428ae7fd, 0xc59859f3, 0xbf6bfb95, + 0x43b72bc9, 0x42ad5374, 0x426f70f0, 0xc0579cc5, 0xc52ca60f, + 0xc280dfd5, 0xc5c127d5, 0xc0b27203, 0x455d06ed, 0xc21cca8e, + 0x45269613); + + VSET(16, e32, m1); + // 24686.12304688, 45012.43359375, 5708.16113281, + // -32777.98828125, 74121.31250000, -74877.15625000, + // -60082.02734375, 46400.20312500, -45509.65234375, + // -63994.57031250, -8693.70019531, 57683.04296875, + // 70424.14843750, 90967.72656250, 16158.18359375, + // -90782.41406250 + VLOAD_32(v2, 0x46c0dc3f, 0x472fd46f, 0x45b2614a, 0xc70009fd, 0x4790c4a8, + 0xc7923e94, 0xc76ab207, 0x47354034, 0xc731c5a7, 0xc779fa92, + 0xc607d6cd, 0x4761530b, 0x47898c13, 0x47b1abdd, 0x467c78bc, + 0xc7b14f35); + // -87108.13281250, -7857.04492188, -40309.92968750, + // -77418.73437500, 28954.62109375, -28385.13085938, + // 42368.34375000, -32644.74804688, 89327.02343750, + // -91567.60156250, -25929.78515625, -88250.83593750, + // -49992.60156250, 34217.12500000, 49765.98046875, + // 8088.22802734 + VLOAD_32(v6, 0xc7aa2211, 0xc5f5885c, 0xc71d75ee, 0xc797355e, 0x46e2353e, + 0xc6ddc243, 0x47258058, 0xc6ff097f, 0x47ae7783, 0xc7b2d7cd, + 0xc6ca9392, 0xc7ac5d6b, 0xc743489a, 0x4705a920, 0x474265fb, + 0x45fcc1d3); + VLOAD_8(v0, 0xAA, 0xAA); + // -95159.7034957902651513, -25746.0480722606444033, + // -89272.3172746254567755, -57390.5516721799431252, + // 98139.9797031646012329, -66607.6782029465102823, + // 67788.7602550606534351, -90593.7788542728667380, + // -68056.0128839309472824, -37127.9738570771587547, + // 21060.8546093095501419, -76483.1707763712329324, + // 83261.7813338561973069, -99608.0446094776270911, + // 32602.1877863906847779, 52037.0826651407405734 + VLOAD_64(v4, 0xc0f73b7b4184cd41, 0xc0d92483139dacd4, 0xc0f5cb85138e8ec3, + 0xc0ec05d1a74c6a5f, 0x40f7f5bfacdd39bc, 0xc0f042fad9eb5535, + 0x40f08ccc2a0135e2, 0xc0f61e1c762fe5e5, 0xc0f09d8034c5c7e1, + 0xc0e220ff29d6512c, 0x40d49136b1eb3ed8, 0xc0f2ac32bb800116, + 0x40f453dc8057edfa, 0xc0f85180b6b86d78, 0x40dfd68c04b135a8, + 0x40e968a2a5315d80); + asm volatile("vfwnmacc.vv v4, v2, v6, v0.t"); + // -95159.7034957902651513, 353690458.8370813727378845, + // -89272.3172746254567755, -2537572977.5412845611572266, + // 98139.9797031646012329, -2125331270.8559157848358154, + // 67788.7602550606534351, 1514813534.1183013916015625, + // -68056.0128839309472824, -5859792188.5645341873168945, + // 21060.8546093095501419, 5090653244.5816955566406250, + // 83261.7813338561973069, -3112554462.7102732658386230, + // 32602.1877863906847779, 734216828.7275727987289429 + VCMP_U64(4, v4, 0xc0f73b7b4184cd41, 0x41b514e35ad64af7, 0xc0f5cb85138e8ec3, + 0xc1e2e8094e315234, 0x40f7f5bfacdd39bc, 0xc1dfab7ed1b6c753, + 0x40f08ccc2a0135e2, 0x41d6928e17879240, 0xc0f09d8034c5c7e1, + 0xc1f5d45553c90855, 0x40d49136b1eb3ed8, 0x41f2f6d343c94ea0, + 0x40f453dc8057edfa, 0xc1e730b9fbd6ba8f, 0x40dfd68c04b135a8, + 0x41c5e1a13e5d211b); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 85.2500, -7.6602, -81.8125, -37.2500, + // -48.0000, 14.9531, 25.9844, 96.1875, 46.5000, + // -77.4375, 45.5312, -68.7500, 58.8438, -70.5625, -45.9375, + // -90.5000 + VLOAD_16(v2, 0x5554, 0xc7a9, 0xd51d, 0xd0a8, 0xd200, 0x4b7a, 0x4e7f, 0x5603, + 0x51d0, 0xd4d7, 0x51b1, 0xd44c, 0x535b, 0xd469, 0xd1be, 0xd5a8); + // -47.9375 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xd1fe); + // 6.19335365, -81.26284790, + // -77.74858093, 15.38204670, 27.37081337, 48.81098938, + // -82.18785095, 3.87765026, -34.03960037, + // -92.34690857, 46.98464203, 28.09385681, 58.44809723, 57.04935455, + // -44.62148285, 83.52678680 + VLOAD_32(v4, 0x40c62ff4, 0xc2a28694, 0xc29b7f46, 0x41761cdd, 0x41daf76d, + 0x42433e74, 0xc2a4602e, 0x40782b6c, 0xc208288d, 0xc2b8b19e, + 0x423bf046, 0x41e0c038, 0x4269cada, 0x4264328a, 0xc2327c66, + 0x42a70db7); + asm volatile("vfwnmacc.vf v4, %[A], v2" ::[A] "f"(dscalar_16)); + // 4080.47851562, -285.94589233, -3844.13818359, -1801.05395508, + // -2328.37084961, 668.00445557, 1327.81384277, 4607.11083984, + // 2263.13330078, -3619.81323242, 2135.66967773, + // -3323.79687500, 2762.37426758, -3439.63916016, + // -2157.50732422, -4421.87060547 + VCMP_U32(5, v4, 0x457f07a8, 0xc38ef913, 0xc5704236, 0xc4e121ba, 0xc51185ef, + 0x44270049, 0x44a5fa0b, 0x458ff8e3, 0x450d7222, 0xc5623d03, + 0x45057ab7, 0xc54fbcc0, 0x452ca5fd, 0xc556fa3a, 0xc506d81e, + 0xc58a2ef7); + + VSET(16, e32, m1); + double dscalar_32; + // 415907.75000000, 16644.92773438, -320087.15625000, + // -560497.81250000, 51200.66406250, 175961.67187500, + // -62272.61328125, -40134.65234375, 67972.27343750, + // 832511.06250000, -279323.15625000, -48243.37500000, + // 685093.43750000, 272952.25000000, 518086.00000000, + // -349626.18750000 + VLOAD_32(v2, 0x48cb1478, 0x468209db, 0xc89c4ae5, 0xc908d71d, 0x474800aa, + 0x482bd66b, 0xc773409d, 0xc71cc6a7, 0x4784c223, 0x494b3ff1, + 0xc8886365, 0xc73c7360, 0x49274257, 0x48854708, 0x48fcf8c0, + 0xc8aab746); + // -648299.93750000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc91e46bf); + // -3761.4446916116867214, 251037.4171459318604320, + // -832277.7590174797223881, -817938.7112226528115571, + // -640813.8540152770001441, -87111.6097838475834578, + // -748981.3983645441476256, 259451.7965630525723100, + // -469164.5467169298790395, -204901.8221613015048206, + // 97767.4262132318690419, -208046.9794710964197293, + // -303699.6372622016351670, -710697.5104083393234760, + // -907884.7086961114546284, -326406.2730544115183875 + VLOAD_64(v4, 0xc0ad62e3ae9e7200, 0x410ea4eb56509b38, 0xc129662b849df069, + 0xc128f6256c256024, 0xc1238e5bb5417d8a, 0xc0f54479c1acb530, + 0xc126db6acbf67002, 0x410fabde5f5c7320, 0xc11ca2b22fd69018, + 0xc109032e93c94df0, 0x40f7de76d1c4f740, 0xc1096577d5f4f134, + 0xc112894e8c8e766c, 0xc125b05305543dea, 0xc12bb4d96ada377b, + 0xc113ec19179b935e); + asm volatile("vfwnmacc.vf v4, %[A], v2" ::[A] "f"(dscalar_32)); + // 269632972092.2103271484375000, 10790654572.4701824188232422, + // -207511651113.6687316894531250, + // -363369878873.9254760742187500, 33194028125.5312614440917969, + // 114076027990.5677947998046875, -40370582316.7976837158203125, + // -26019552057.8339157104492188, 44066889785.8108749389648438, + // 539717074688.6307373046875000, + // -181085282506.6039428710937500, + // -31275968950.3095932006835938, 444146336412.5474243164062500, + // 176955637312.9947814941406250, 335876029304.3336791992187500, + // -226662309098.3402404785156250 + VCMP_U64(6, v4, 0x424f63b0529e1aec, 0x420419629363c2ef, 0xc24828544194d599, + 0xc25526a215567b3b, 0x421eea12b1762003, 0x423a8f760c56915b, + 0xc222cc8c6659986a, 0xc2183b8b6ce755ee, 0x4224852ec0739f2b, + 0x425f6a693fc0285e, 0xc24514c310654d4e, 0xc21d20c5a6d93d06, + 0x4259da4bd0a72309, 0x424499b05f207f55, 0x42538cf15ede155b, + 0xc24a63102e752b8d); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 85.2500, -7.6602, -81.8125, -37.2500, + // -48.0000, 14.9531, 25.9844, 96.1875, 46.5000, + // -77.4375, 45.5312, -68.7500, 58.8438, -70.5625, -45.9375, + // -90.5000 + VLOAD_16(v2, 0x5554, 0xc7a9, 0xd51d, 0xd0a8, 0xd200, 0x4b7a, 0x4e7f, 0x5603, + 0x51d0, 0xd4d7, 0x51b1, 0xd44c, 0x535b, 0xd469, 0xd1be, 0xd5a8); + // -47.9375 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xd1fe); + VLOAD_8(v0, 0xAA, 0xAA); + // 6.19335365, -81.26284790, + // -77.74858093, 15.38204670, 27.37081337, 48.81098938, + // -82.18785095, 3.87765026, -34.03960037, + // -92.34690857, 46.98464203, 28.09385681, 58.44809723, 57.04935455, + // -44.62148285, 83.52678680 + VLOAD_32(v4, 0x40c62ff4, 0xc2a28694, 0xc29b7f46, 0x41761cdd, 0x41daf76d, + 0x42433e74, 0xc2a4602e, 0x40782b6c, 0xc208288d, 0xc2b8b19e, + 0x423bf046, 0x41e0c038, 0x4269cada, 0x4264328a, 0xc2327c66, + 0x42a70db7); + asm volatile("vfwnmacc.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // 6.19335365, -285.94589233, -77.74858093, + // -1801.05395508, 27.37081337, 668.00445557, -82.18785095, + // 4607.11083984, -34.03960037, -3619.81323242, 46.98464203, + // -3323.79687500, 58.44809723, -3439.63916016, -44.62148285, + // -4421.87060547 + VCMP_U32(7, v4, 0x40c62ff4, 0xc38ef913, 0xc29b7f46, 0xc4e121ba, 0x41daf76d, + 0x44270049, 0xc2a4602e, 0x458ff8e3, 0xc208288d, 0xc5623d03, + 0x423bf046, 0xc54fbcc0, 0x4269cada, 0xc556fa3a, 0xc2327c66, + 0xc58a2ef7); + + VSET(16, e32, m1); + double dscalar_32; + // 415907.75000000, 16644.92773438, -320087.15625000, + // -560497.81250000, 51200.66406250, 175961.67187500, + // -62272.61328125, -40134.65234375, 67972.27343750, + // 832511.06250000, -279323.15625000, -48243.37500000, + // 685093.43750000, 272952.25000000, 518086.00000000, + // -349626.18750000 + VLOAD_32(v2, 0x48cb1478, 0x468209db, 0xc89c4ae5, 0xc908d71d, 0x474800aa, + 0x482bd66b, 0xc773409d, 0xc71cc6a7, 0x4784c223, 0x494b3ff1, + 0xc8886365, 0xc73c7360, 0x49274257, 0x48854708, 0x48fcf8c0, + 0xc8aab746); + // -648299.93750000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc91e46bf); + VLOAD_8(v0, 0xAA, 0xAA); + // -3761.4446916116867214, 251037.4171459318604320, + // -832277.7590174797223881, -817938.7112226528115571, + // -640813.8540152770001441, -87111.6097838475834578, + // -748981.3983645441476256, 259451.7965630525723100, + // -469164.5467169298790395, -204901.8221613015048206, + // 97767.4262132318690419, -208046.9794710964197293, + // -303699.6372622016351670, -710697.5104083393234760, + // -907884.7086961114546284, -326406.2730544115183875 + VLOAD_64(v4, 0xc0ad62e3ae9e7200, 0x410ea4eb56509b38, 0xc129662b849df069, + 0xc128f6256c256024, 0xc1238e5bb5417d8a, 0xc0f54479c1acb530, + 0xc126db6acbf67002, 0x410fabde5f5c7320, 0xc11ca2b22fd69018, + 0xc109032e93c94df0, 0x40f7de76d1c4f740, 0xc1096577d5f4f134, + 0xc112894e8c8e766c, 0xc125b05305543dea, 0xc12bb4d96ada377b, + 0xc113ec19179b935e); + asm volatile("vfwnmacc.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // -3761.4446916116867214, 10790654572.4701824188232422, + // -832277.7590174797223881, -363369878873.9254760742187500, + // -640813.8540152770001441, 114076027990.5677947998046875, + // -748981.3983645441476256, -26019552057.8339157104492188, + // -469164.5467169298790395, 539717074688.6307373046875000, + // 97767.4262132318690419, -31275968950.3095932006835938, + // -303699.6372622016351670, 176955637312.9947814941406250, + // -907884.7086961114546284, -226662309098.3402404785156250 + VCMP_U64(8, v4, 0xc0ad62e3ae9e7200, 0x420419629363c2ef, 0xc129662b849df069, + 0xc25526a215567b3b, 0xc1238e5bb5417d8a, 0x423a8f760c56915b, + 0xc126db6acbf67002, 0xc2183b8b6ce755ee, 0xc11ca2b22fd69018, + 0x425f6a693fc0285e, 0x40f7de76d1c4f740, 0xc21d20c5a6d93d06, + 0xc112894e8c8e766c, 0x424499b05f207f55, 0xc12bb4d96ada377b, + 0xc24a63102e752b8d); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwnmsac.c b/apps/riscv-tests/isa/rv64uv/vfwnmsac.c new file mode 100644 index 0000000..8bc4176 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwnmsac.c @@ -0,0 +1,347 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -27.1719, 16.3438, -76.1250, 73.7500, 39.2500, 32.8438, + // -48.0312, -62.9062, -52.3125, 50.8750, -32.1562, -86.3750, + // -42.7812, 97.2500, -83.6250, 46.6250 + VLOAD_16(v2, 0xcecb, 0x4c16, 0xd4c2, 0x549c, 0x50e8, 0x501b, 0xd201, 0xd3dd, + 0xd28a, 0x525c, 0xd005, 0xd566, 0xd159, 0x5614, 0xd53a, 0x51d4); + // -18.1719, -46.5312, -72.7500, + // -78.0625, 13.7344, 6.3164, 19.1250, 23.3125, 72.4375, + // -53.2812, -16.3438, -95.0625, -96.2500, 10.4141, + // -44.4688, 42.5938 + VLOAD_16(v6, 0xcc8b, 0xd1d1, 0xd48c, 0xd4e1, 0x4ade, 0x4651, 0x4cc8, 0x4dd4, + 0x5487, 0xd2a9, 0xcc16, 0xd5f1, 0xd604, 0x4935, 0xd18f, 0x5153); + // 69.72727966, 14.41778183, + // -64.82620239, 5.66590357, 73.33881378, + // -23.97786140, 94.91672516, 17.38204765, -39.07393646, + // -50.71182251, -11.98221493, -36.07648849, + // -86.86090088, 55.96418381, 61.43484116, -88.02533722 + VLOAD_32(v4, 0x428b745e, 0x4166af3c, 0xc281a704, 0x40b54f15, 0x4292ad79, + 0xc1bfd2a9, 0x42bdd55d, 0x418b0e6f, 0xc21c4bb6, 0xc24ad8e8, + 0xc13fb727, 0xc2104e53, 0xc2adb8c8, 0x425fdb53, 0x4275bd47, + 0xc2b00cf9); + asm volatile("vfwnmsac.vv v4, v2, v6"); + // -424.03662109, 774.91290283, -5602.91992188, 5762.77539062, + // -465.73541260, -231.43232727, 1013.51440430, 1483.88403320, + // 3750.31274414, 2659.97167969, -537.53594971, -8247.09960938, + // -4204.55615234, -956.80340576, -3657.26440430, -2073.95898438 + VCMP_U32(1, v4, 0xc3d404b0, 0x4441ba6d, 0xc5af175c, 0x45b41634, 0xc3e8de22, + 0xc3676ead, 0x447d60ec, 0x44b97c4a, 0x456a6501, 0x45263f8c, + 0xc406624d, 0xc600dc66, 0xc5836473, 0xc46f336b, 0xc564943b, + 0xc5019f58); + + VSET(16, e32, m1); + // 76109.13281250, 56176.41406250, -69127.14843750, + // -80327.49218750, 42920.59375000, -22857.18164062, + // -74227.70312500, -2650.23828125, 34254.71093750, + // -45853.78125000, 16339.80859375, + // -48032.71875000, 49.54582977, -47754.19921875, + // -95663.35156250, 82512.11718750 + VLOAD_32(v2, 0x4794a691, 0x475b706a, 0xc7870393, 0xc79ce3bf, 0x4727a898, + 0xc6b2925d, 0xc790f9da, 0xc525a3d0, 0x4705ceb6, 0xc7331dc8, + 0x467f4f3c, 0xc73ba0b8, 0x42462eee, 0xc73a8a33, 0xc7bad7ad, + 0x47a1280f); + // -36622.54296875, -60900.32421875, -36611.69921875, + // -74411.05468750, -25865.60937500, -67159.76562500, + // 6145.43457031, -31624.23242188, -69962.68750000, 468.94165039, + // 10443.93554688, -6054.45410156, -26090.46093750, + // 83534.57031250, 49878.42968750, -62082.53125000 + VLOAD_32(v6, 0xc70f0e8b, 0xc76de453, 0xc70f03b3, 0xc7915587, 0xc6ca1338, + 0xc7832be2, 0x45c00b7a, 0xc6f71077, 0xc788a558, 0x43ea7888, + 0x46232fbe, 0xc5bd33a2, 0xc6cbd4ec, 0x47a32749, 0x4742d66e, + 0xc7728288); + // 69521.3925020728202071, 98263.6759213360201102, + // -97991.2678309752518544, -63510.9471883209771477, + // 65329.9928102507547010, -34993.7523106171429390, + // -15831.2510480509663466, -3510.3868967669695849, + // 47068.9415519913600292, -19802.3942476644588169, + // 25915.8242703938303748, 82619.8738822988234460, + // 36865.7501246419560630, 41236.4660055586136878, + // -5735.0030344506667461, 97965.1847665070963558 + VLOAD_64(v4, 0x40f0f91647b040e6, 0x40f7fd7ad092e40e, 0xc0f7ec74490921f9, + 0xc0ef02de4f5de1b8, 0x40efe63fc51a00c4, 0xc0e1163812edb722, + 0xc0ceeba02257b050, 0xc0ab6cc617554220, 0x40e6fb9e2131a44c, + 0xc0d356993b5a8e58, 0x40d94ef4c0d89c24, 0x40f42bbdfb6c0160, + 0x40e20038010564a4, 0x40e4228ee9847d40, 0xc0b66700c6dda260, + 0x40f7ead2f4cdb996); + asm volatile("vfwnmsac.vv v4, v2, v6"); + // 2787379508.1325840950012207, 3421260093.5289182662963867, + // -2530960357.7114648818969727, -5977316925.0209798812866211, + // 1110232642.0733766555786133, -1535117955.5847384929656982, + // 456145661.6082201600074768, -83815261.7664972990751266, + // 2396598705.6646966934204102, 21482945.4617780297994614, + // -170625991.9771288335323334, -290729271.1712532043457031, + // 1329539.2864317980129272, 3989167748.8218097686767578, + // 4771532019.5777149200439453, 5122659058.9813976287841797 + VCMP_U64(2, v4, 0x41e4c48126843e21, 0x41e97d8927b0ece6, 0xc1e2db6c7cb6c452, + 0xc1f64469e3d055ef, 0x41d08b339084b234, 0xc1d6e002a0e56c5b, + 0x41bb303afd9bb451, 0xc193fbad7710e4ab, 0x41e1db2636354532, + 0x41747cdc1763715c, 0xc1a457178ff44a3b, 0xc1b1542d372bd740, + 0x4134498349539825, 0x41edb8bbd09a4c44, 0x41f1c67ccf393e52, + 0x41f315592f2fb3ce); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -27.1719, 16.3438, -76.1250, 73.7500, 39.2500, 32.8438, + // -48.0312, -62.9062, -52.3125, 50.8750, -32.1562, -86.3750, + // -42.7812, 97.2500, -83.6250, 46.6250 + VLOAD_16(v2, 0xcecb, 0x4c16, 0xd4c2, 0x549c, 0x50e8, 0x501b, 0xd201, 0xd3dd, + 0xd28a, 0x525c, 0xd005, 0xd566, 0xd159, 0x5614, 0xd53a, 0x51d4); + // -18.1719, -46.5312, -72.7500, + // -78.0625, 13.7344, 6.3164, 19.1250, 23.3125, 72.4375, + // -53.2812, -16.3438, -95.0625, -96.2500, 10.4141, + // -44.4688, 42.5938 + VLOAD_16(v6, 0xcc8b, 0xd1d1, 0xd48c, 0xd4e1, 0x4ade, 0x4651, 0x4cc8, 0x4dd4, + 0x5487, 0xd2a9, 0xcc16, 0xd5f1, 0xd604, 0x4935, 0xd18f, 0x5153); + VLOAD_8(v0, 0xAA, 0xAA); + // 69.72727966, 14.41778183, + // -64.82620239, 5.66590357, 73.33881378, + // -23.97786140, 94.91672516, 17.38204765, -39.07393646, + // -50.71182251, -11.98221493, -36.07648849, + // -86.86090088, 55.96418381, 61.43484116, -88.02533722 + VLOAD_32(v4, 0x428b745e, 0x4166af3c, 0xc281a704, 0x40b54f15, 0x4292ad79, + 0xc1bfd2a9, 0x42bdd55d, 0x418b0e6f, 0xc21c4bb6, 0xc24ad8e8, + 0xc13fb727, 0xc2104e53, 0xc2adb8c8, 0x425fdb53, 0x4275bd47, + 0xc2b00cf9); + asm volatile("vfwnmsac.vv v4, v2, v6, v0.t"); + // 69.72727966, 774.91290283, -64.82620239, + // 5762.77539062, 73.33881378, -231.43232727, 94.91672516, + // 1483.88403320, -39.07393646, 2659.97167969, -11.98221493, + // -8247.09960938, -86.86090088, -956.80340576, 61.43484116, + // -2073.95898438 + VCMP_U32(3, v4, 0x428b745e, 0x4441ba6d, 0xc281a704, 0x45b41634, 0x4292ad79, + 0xc3676ead, 0x42bdd55d, 0x44b97c4a, 0xc21c4bb6, 0x45263f8c, + 0xc13fb727, 0xc600dc66, 0xc2adb8c8, 0xc46f336b, 0x4275bd47, + 0xc5019f58); + + VSET(16, e32, m1); + // 76109.13281250, 56176.41406250, -69127.14843750, + // -80327.49218750, 42920.59375000, -22857.18164062, + // -74227.70312500, -2650.23828125, 34254.71093750, + // -45853.78125000, 16339.80859375, + // -48032.71875000, 49.54582977, -47754.19921875, + // -95663.35156250, 82512.11718750 + VLOAD_32(v2, 0x4794a691, 0x475b706a, 0xc7870393, 0xc79ce3bf, 0x4727a898, + 0xc6b2925d, 0xc790f9da, 0xc525a3d0, 0x4705ceb6, 0xc7331dc8, + 0x467f4f3c, 0xc73ba0b8, 0x42462eee, 0xc73a8a33, 0xc7bad7ad, + 0x47a1280f); + // -36622.54296875, -60900.32421875, -36611.69921875, + // -74411.05468750, -25865.60937500, -67159.76562500, + // 6145.43457031, -31624.23242188, -69962.68750000, 468.94165039, + // 10443.93554688, -6054.45410156, -26090.46093750, + // 83534.57031250, 49878.42968750, -62082.53125000 + VLOAD_32(v6, 0xc70f0e8b, 0xc76de453, 0xc70f03b3, 0xc7915587, 0xc6ca1338, + 0xc7832be2, 0x45c00b7a, 0xc6f71077, 0xc788a558, 0x43ea7888, + 0x46232fbe, 0xc5bd33a2, 0xc6cbd4ec, 0x47a32749, 0x4742d66e, + 0xc7728288); + VLOAD_8(v0, 0xAA, 0xAA); + // 69521.3925020728202071, 98263.6759213360201102, + // -97991.2678309752518544, -63510.9471883209771477, + // 65329.9928102507547010, -34993.7523106171429390, + // -15831.2510480509663466, -3510.3868967669695849, + // 47068.9415519913600292, -19802.3942476644588169, + // 25915.8242703938303748, 82619.8738822988234460, + // 36865.7501246419560630, 41236.4660055586136878, + // -5735.0030344506667461, 97965.1847665070963558 + VLOAD_64(v4, 0x40f0f91647b040e6, 0x40f7fd7ad092e40e, 0xc0f7ec74490921f9, + 0xc0ef02de4f5de1b8, 0x40efe63fc51a00c4, 0xc0e1163812edb722, + 0xc0ceeba02257b050, 0xc0ab6cc617554220, 0x40e6fb9e2131a44c, + 0xc0d356993b5a8e58, 0x40d94ef4c0d89c24, 0x40f42bbdfb6c0160, + 0x40e20038010564a4, 0x40e4228ee9847d40, 0xc0b66700c6dda260, + 0x40f7ead2f4cdb996); + asm volatile("vfwnmsac.vv v4, v2, v6, v0.t"); + // 69521.3925020728202071, 3421260093.5289182662963867, + // -97991.2678309752518544, -5977316925.0209798812866211, + // 65329.9928102507547010, -1535117955.5847384929656982, + // -15831.2510480509663466, -83815261.7664972990751266, + // 47068.9415519913600292, 21482945.4617780297994614, + // 25915.8242703938303748, -290729271.1712532043457031, + // 36865.7501246419560630, 3989167748.8218097686767578, + // -5735.0030344506667461, 5122659058.9813976287841797 + VCMP_U64(4, v4, 0x40f0f91647b040e6, 0x41e97d8927b0ece6, 0xc0f7ec74490921f9, + 0xc1f64469e3d055ef, 0x40efe63fc51a00c4, 0xc1d6e002a0e56c5b, + 0xc0ceeba02257b050, 0xc193fbad7710e4ab, 0x40e6fb9e2131a44c, + 0x41747cdc1763715c, 0x40d94ef4c0d89c24, 0xc1b1542d372bd740, + 0x40e20038010564a4, 0x41edb8bbd09a4c44, 0xc0b66700c6dda260, + 0x41f315592f2fb3ce); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 15.1797, -57.5312, -39.9688, 95.8125, 22.3906, + // -30.2344, 61.3438, 67.1250, -80.6250, -20.6875, -34.1250, + // -7.6758, -25.1562, 64.8125, 28.0156, -51.9688 + VLOAD_16(v2, 0x4b97, 0xd331, 0xd0ff, 0x55fd, 0x4d99, 0xcf8f, 0x53ab, 0x5432, + 0xd50a, 0xcd2c, 0xd044, 0xc7ad, 0xce4a, 0x540d, 0x4f01, 0xd27f); + // -27.7344 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xceef); + // -90.47762299, -89.97399139, -34.20752716, + // -93.73470306, 81.75606537, 80.60296631, 73.45400238, + // -61.63031769, -55.39078903, 21.99703789, 29.49930191, + // -64.56553650, -17.54965782, 84.51310730, -88.96613312, + // -6.75917578 + VLOAD_32(v4, 0xc2b4f48b, 0xc2b3f2af, 0xc208d482, 0xc2bb782b, 0x42a3831b, + 0x42a134b8, 0x4292e873, 0xc2768572, 0xc25d902b, 0x41aff9ef, + 0x41ebfe92, 0xc281218e, 0xc18c65b3, 0x42a906b6, 0xc2b1eea9, + 0xc0d84b2b); + asm volatile("vfwnmsac.vf v4, %[A], v2" ::[A] "f"(dscalar_16)); + // 330.52151489, -1685.56726074, -1142.71582031, 2563.56518555, + // 702.74603271, -757.92852783, 1774.78454590, 1800.03955078, + // -2291.47485352, -551.75787354, -916.93621826, -277.44854736, + // -715.24255371, 1882.04724121, 688.02972412, -1448.07995605 + VCMP_U32(5, v4, 0x43a542c1, 0xc4d2b227, 0xc48ed6e8, 0x4520390b, 0x442fafbf, + 0xc43d7b6d, 0x44ddd91b, 0x44e10144, 0xc50f3799, 0xc409f081, + 0xc4653beb, 0xc38ab96a, 0xc432cf86, 0x44eb4183, 0x442c01e7, + 0xc4b5028f); + + VSET(16, e32, m1); + double dscalar_32; + // 467373.87500000, -160965.29687500, 883060.25000000, + // -737665.37500000, -482502.81250000, -983579.31250000, + // -407525.09375000, 564889.31250000, -121145.03125000, + // 744798.75000000, 160985.04687500, -9122.68847656, + // -708214.37500000, 763142.93750000, -340832.59375000, + // -663023.75000000 + VLOAD_32(v2, 0x48e435bc, 0xc81d3153, 0x49579744, 0xc9341816, 0xc8eb98da, + 0xc97021b5, 0xc8c6fca3, 0x4909e995, 0xc7ec9c84, 0x4935d5ec, + 0x481d3643, 0xc60e8ac1, 0xc92ce766, 0x493a506f, 0xc8a66c13, + 0xc921defc); + // 235169.78125000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x4865a872); + // -460724.6105727200629190, -944938.6498861069558188, + // -303510.4811713555827737, -748025.6652074699522927, + // 387702.0000469267833978, -894167.6638924945145845, + // 98379.0701996718998998, -950753.1128427713410929, + // -749333.7338243273552507, 898522.0366696736309677, + // -388606.5700500296661630, 47697.1169114386430010, + // -665347.3327810273040086, 976438.6193965608254075, + // -498588.0437998892739415, 793291.0511387982405722 + VLOAD_64(v4, 0xc11c1ed27139f9a2, 0xc12cd6554cbddf2f, 0xc1128659ecb82f10, + 0xc126d3f3549612d1, 0x4117a9d8000c4d34, 0xc12b49af53e9b790, + 0x40f804b11f89b0f0, 0xc12d03c239c68719, 0xc126de2b77b7d27e, + 0x412b6bb412c65e12, 0xc117b7fa47bb31ea, 0x40e74a23bdbd0eb0, + 0xc1244e06aa62465a, 0x412dcc6d3d218bc8, 0xc11e6e702cd9e0d0, + 0x412835961a2edd54); + asm volatile("vfwnmsac.vf v4, %[A], v2" ::[A] "f"(dscalar_32)); + // -109912672670.3254089355468750, 37853228716.2851715087890625, + // -207669389333.5514831542968750, 173475856848.7839965820312500, + // 113470468570.1348114013671875, 231307237594.9865112304687500, + // 95837685530.1434478759765625, -132845846804.2007293701171875, + // 28488901164.8530883789062500, -175153260590.7367553710937500, + // -37859206864.6847991943359375, 2145428350.5620102882385254, + // 166549954299.5226745605468750, -179467181235.7380371093750000, + // 80153027927.0138244628906250, 155923943542.1058349609375000 + VCMP_U64(6, v4, 0xc239974e499e534e, 0x4221a074dd589202, 0xc2482d07b40ac697, + 0x424431fbc0e8645a, 0x423a6b5df1da2283, 0x424aed7e2c6d7e46, + 0x4236505f071a24b9, 0xc23eee3ac1143363, 0x421a884888b36990, + 0xc24463f954175e4e, 0xc221a12b4da15e9e, 0x41dff828dfa3f7fa, + 0x424363934f7dc2e7, 0xc244e489ee59de78, 0x4232a97e2557038a, + 0x424226e5483b0d8c); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 15.1797, -57.5312, -39.9688, 95.8125, 22.3906, + // -30.2344, 61.3438, 67.1250, -80.6250, -20.6875, -34.1250, + // -7.6758, -25.1562, 64.8125, 28.0156, -51.9688 + VLOAD_16(v2, 0x4b97, 0xd331, 0xd0ff, 0x55fd, 0x4d99, 0xcf8f, 0x53ab, 0x5432, + 0xd50a, 0xcd2c, 0xd044, 0xc7ad, 0xce4a, 0x540d, 0x4f01, 0xd27f); + // -27.7344 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xceef); + VLOAD_8(v0, 0xAA, 0xAA); + // -90.47762299, -89.97399139, -34.20752716, + // -93.73470306, 81.75606537, 80.60296631, 73.45400238, + // -61.63031769, -55.39078903, 21.99703789, 29.49930191, + // -64.56553650, -17.54965782, 84.51310730, -88.96613312, + // -6.75917578 + VLOAD_32(v4, 0xc2b4f48b, 0xc2b3f2af, 0xc208d482, 0xc2bb782b, 0x42a3831b, + 0x42a134b8, 0x4292e873, 0xc2768572, 0xc25d902b, 0x41aff9ef, + 0x41ebfe92, 0xc281218e, 0xc18c65b3, 0x42a906b6, 0xc2b1eea9, + 0xc0d84b2b); + asm volatile("vfwnmsac.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_16)); + // -90.47762299, -1685.56726074, -34.20752716, + // 2563.56518555, 81.75606537, -757.92852783, 73.45400238, + // 1800.03955078, -55.39078903, -551.75787354, 29.49930191, + // -277.44854736, -17.54965782, 1882.04724121, -88.96613312, + // -1448.07995605 + VCMP_U32(7, v4, 0xc2b4f48b, 0xc4d2b227, 0xc208d482, 0x4520390b, 0x42a3831b, + 0xc43d7b6d, 0x4292e873, 0x44e10144, 0xc25d902b, 0xc409f081, + 0x41ebfe92, 0xc38ab96a, 0xc18c65b3, 0x44eb4183, 0xc2b1eea9, + 0xc4b5028f); + + VSET(16, e32, m1); + double dscalar_32; + // 467373.87500000, -160965.29687500, 883060.25000000, + // -737665.37500000, -482502.81250000, -983579.31250000, + // -407525.09375000, 564889.31250000, -121145.03125000, + // 744798.75000000, 160985.04687500, -9122.68847656, + // -708214.37500000, 763142.93750000, -340832.59375000, + // -663023.75000000 + VLOAD_32(v2, 0x48e435bc, 0xc81d3153, 0x49579744, 0xc9341816, 0xc8eb98da, + 0xc97021b5, 0xc8c6fca3, 0x4909e995, 0xc7ec9c84, 0x4935d5ec, + 0x481d3643, 0xc60e8ac1, 0xc92ce766, 0x493a506f, 0xc8a66c13, + 0xc921defc); + // 235169.78125000 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x4865a872); + VLOAD_8(v0, 0xAA, 0xAA); + // -460724.6105727200629190, -944938.6498861069558188, + // -303510.4811713555827737, -748025.6652074699522927, + // 387702.0000469267833978, -894167.6638924945145845, + // 98379.0701996718998998, -950753.1128427713410929, + // -749333.7338243273552507, 898522.0366696736309677, + // -388606.5700500296661630, 47697.1169114386430010, + // -665347.3327810273040086, 976438.6193965608254075, + // -498588.0437998892739415, 793291.0511387982405722 + VLOAD_64(v4, 0xc11c1ed27139f9a2, 0xc12cd6554cbddf2f, 0xc1128659ecb82f10, + 0xc126d3f3549612d1, 0x4117a9d8000c4d34, 0xc12b49af53e9b790, + 0x40f804b11f89b0f0, 0xc12d03c239c68719, 0xc126de2b77b7d27e, + 0x412b6bb412c65e12, 0xc117b7fa47bb31ea, 0x40e74a23bdbd0eb0, + 0xc1244e06aa62465a, 0x412dcc6d3d218bc8, 0xc11e6e702cd9e0d0, + 0x412835961a2edd54); + asm volatile("vfwnmsac.vf v4, %[A], v2, v0.t" ::[A] "f"(dscalar_32)); + // -460724.6105727200629190, 37853228716.2851715087890625, + // -303510.4811713555827737, 173475856848.7839965820312500, + // 387702.0000469267833978, 231307237594.9865112304687500, + // 98379.0701996718998998, -132845846804.2007293701171875, + // -749333.7338243273552507, -175153260590.7367553710937500, + // -388606.5700500296661630, 2145428350.5620102882385254, + // -665347.3327810273040086, -179467181235.7380371093750000, + // -498588.0437998892739415, 155923943542.1058349609375000 + VCMP_U64(8, v4, 0xc11c1ed27139f9a2, 0x4221a074dd589202, 0xc1128659ecb82f10, + 0x424431fbc0e8645a, 0x4117a9d8000c4d34, 0x424aed7e2c6d7e46, + 0x40f804b11f89b0f0, 0xc23eee3ac1143363, 0xc126de2b77b7d27e, + 0xc24463f954175e4e, 0xc117b7fa47bb31ea, 0x41dff828dfa3f7fa, + 0xc1244e06aa62465a, 0xc244e489ee59de78, 0xc11e6e702cd9e0d0, + 0x424226e5483b0d8c); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwredosum.c b/apps/riscv-tests/isa/rv64uv/vfwredosum.c new file mode 100644 index 0000000..b07ee99 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwredosum.c @@ -0,0 +1,268 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Xiaorui Yin +// Date: 2022/05/03 + +#include "float_macros.h" +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(1, e32, m1); + VLOAD_32(v2, 0x3F800000); + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U32(1, v4, 0x42920000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000); + VSET(16, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U64(2, v4, 0x4052400000000000); + + VSET(1, e32, m1); + VLOAD_32(v2, 0x3F800000); + VSET(2, e8, m1); + VLOAD_8(v0, 0xaa, 0x55); + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfwredosum.vs v4, v6, v2, v0.t"); + VCMP_U32(3, v4, 0x42140000); + + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000); + VSET(2, e8, m1); + VLOAD_8(v0, 0xaa, 0x55); + VSET(16, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredosum.vs v4, v6, v2, v0.t"); + VCMP_U64(4, v4, 0x4042800000000000); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v4, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U32(5, v4, 0x42920000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U64(6, v4, 0x4052400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(1, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U64(7, v4, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(3, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U64(8, v4, 0x401C000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(7, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U64(9, v4, 0x403d000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(15, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredosum.vs v4, v6, v2"); + VCMP_U64(10, v4, 0x4050400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(7, e16, m1); + VLOAD_8(v0, 0x00, 0xff); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v4, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredosum.vs v4, v6, v2, v0.t"); + VCMP_U32(11, v4, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(1, e32, m1); + VLOAD_8(v0, 0xff, 0x00); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredosum.vs v4, v6, v2, v0.t"); + VCMP_U64(12, v4, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwredusum.c b/apps/riscv-tests/isa/rv64uv/vfwredusum.c new file mode 100644 index 0000000..b07246d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwredusum.c @@ -0,0 +1,272 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Xiaorui Yin +// Date: 2022/05/03 + +#include "float_macros.h" +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + // WARNING: setting vl == 1 is mandatory here since + // these variables are initialized on the stack, which is + // immediately before the UART. + // Loading more values would load from the UART + // addr space!!!! + VSET(1, e32, m1); + VLOAD_32(v2, 0x3F800000); + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U32(1, v4, 0x42920000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000); + VSET(16, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U64(2, v4, 0x4052400000000000); + + VSET(1, e32, m1); + VLOAD_32(v2, 0x3F800000); + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + asm volatile("vfwredsum.vs v4, v6, v2, v0.t"); + VCMP_U32(3, v4, 0x42140000); + + VSET(1, e64, m1); + VLOAD_64(v2, 0x3FF0000000000000); + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000); + asm volatile("vfwredsum.vs v4, v6, v2, v0.t"); + VCMP_U64(4, v4, 0x4042800000000000); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e16, m1); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v4, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U32(5, v4, 0x42920000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U64(6, v4, 0x4052400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(1, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U64(7, v4, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(3, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U64(8, v4, 0x401C000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(7, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U64(9, v4, 0x403d000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + + VSET(15, e32, m1); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredsum.vs v4, v6, v2"); + VCMP_U64(10, v4, 0x4050400000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(7, e16, m1); + VLOAD_8(v0, 0x00, 0xff); + // 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 + VLOAD_16(v6, 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, + 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800); + VLOAD_32(v2, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_32(v4, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + asm volatile("vfwredsum.vs v4, v6, v2, v0.t"); + VCMP_U32(11, v4, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + + VSET(1, e32, m1); + VLOAD_8(v0, 0xff, 0x00); + VLOAD_32(v6, 0x3F800000, 0x40000000, 0x40400000, 0x40800000, 0x40A00000, + 0x40C00000, 0x40E00000, 0x41000000, 0x3F800000, 0x40000000, + 0x40400000, 0x40800000, 0x40A00000, 0x40C00000, 0x40E00000, + 0x41000000); + VLOAD_64(v2, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + VLOAD_64(v4, 0x3FF0000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); + asm volatile("vfwredsum.vs v4, v6, v2, v0.t"); + VCMP_U64(12, v4, 0x4000000000000000, 0x4000000000000000, 0x4008000000000000, + 0x4010000000000000, 0x4014000000000000, 0x4018000000000000, + 0x401C000000000000, 0x4020000000000000, 0x3FF0000000000000, + 0x4000000000000000, 0x4008000000000000, 0x4010000000000000, + 0x4014000000000000, 0x4018000000000000, 0x401C000000000000, + 0x4020000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vfwsub.c b/apps/riscv-tests/isa/rv64uv/vfwsub.c new file mode 100644 index 0000000..452085a --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vfwsub.c @@ -0,0 +1,519 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values +void TEST_CASE1(void) { + VSET(16, e16, m1); + // -15.5625, 95.7500, -42.4375, 30.7188, -50.7500, -90.2500, + // -95.5000, 29.5938, -41.4062, -94.0000, 34.3438, + // -69.5625, 31.5625, -75.0625, 46.2500, -63.6875 + VLOAD_16(v2, 0xcbc8, 0x55fc, 0xd14e, 0x4fae, 0xd258, 0xd5a4, 0xd5f8, 0x4f66, + 0xd12d, 0xd5e0, 0x504b, 0xd459, 0x4fe4, 0xd4b1, 0x51c8, 0xd3f6); + // 57.2500, 43.2812, -49.4062, -53.5625, -54.7812, + // -12.1406, 92.1875, 67.1875, -19.7656, -41.2812, 98.0625, + // -41.9062, 10.1719, -84.6250, -7.1016, 62.8750 + VLOAD_16(v6, 0x5328, 0x5169, 0xd22d, 0xd2b2, 0xd2d9, 0xca12, 0x55c3, 0x5433, + 0xccf1, 0xd129, 0x5621, 0xd13d, 0x4916, 0xd54a, 0xc71a, 0x53dc); + asm volatile("vfwsub.vv v4, v2, v6"); + // -72.81250000, 52.46875000, 6.96875000, 84.28125000, 4.03125000, + // -78.10937500, -187.68750000, -37.59375000, -21.64062500, + // -52.71875000, -63.71875000, + // -27.65625000, 21.39062500, 9.56250000, 53.35156250, + // -126.56250000 + VCMP_U32(1, v4, 0xc291a000, 0x4251e000, 0x40df0000, 0x42a89000, 0x40810000, + 0xc29c3800, 0xc33bb000, 0xc2166000, 0xc1ad2000, 0xc252e000, + 0xc27ee000, 0xc1dd4000, 0x41ab2000, 0x41190000, 0x42556800, + 0xc2fd2000); + + VSET(16, e32, m1); + // 74632.77343750, -65636.60937500, 16165.84765625, + // -17815.85937500, -85604.03125000, -76754.03125000, + // 21778.01171875, -70512.52343750, 85301.90625000, + // -8385.11035156, 98258.05468750, -50421.53125000, + // 69842.53906250, -65219.96093750, -65266.08984375, + // -90740.60156250 + VLOAD_32(v2, 0x4791c463, 0xc780324e, 0x467c9764, 0xc68b2fb8, 0xc7a73204, + 0xc795e904, 0x46aa2406, 0xc789b843, 0x47a69af4, 0xc6030471, + 0x47bfe907, 0xc744f588, 0x47886945, 0xc77ec3f6, 0xc77ef217, + 0xc7b13a4d); + // 5391.72216797, -90760.36718750, -22961.19531250, + // 12708.62500000, 87107.59375000, 54867.48437500, + // 55424.39453125, -71436.00781250, -61505.46484375, + // 57701.78906250, -81581.38281250, 53319.19531250, + // -86229.57031250, 44376.69531250, 46809.38671875, + // -92887.27343750 + VLOAD_32(v6, 0x45a87dc7, 0xc7b1442f, 0xc6b36264, 0x46469280, 0x47aa21cc, + 0x4756537c, 0x47588065, 0xc78b8601, 0xc7704177, 0x476165ca, + 0xc79f56b1, 0x47504732, 0xc7a86ac9, 0x472d58b2, 0x4736d963, + 0xc7b56ba3); + asm volatile("vfwsub.vv v4, v2, v6"); + // 69241.0512695312500000, 25123.7578125000000000, + // 39127.0429687500000000, -30524.4843750000000000, + // -172711.6250000000000000, -131621.5156250000000000, + // -33646.3828125000000000, 923.4843750000000000, + // 146807.3710937500000000, -66086.8994140625000000, + // 179839.4375000000000000, -103740.7265625000000000, + // 156072.1093750000000000, -109596.6562500000000000, + // -112075.4765625000000000, 2146.6718750000000000 + VCMP_U64(2, v4, 0x40f0e790d2000000, 0x40d888f080000000, 0x40e31ae160000000, + 0xc0ddcf1f00000000, 0xc105153d00000000, 0xc100112c20000000, + 0xc0e06dcc40000000, 0x408cdbe000000000, 0x4101ebbaf8000000, + 0xc0f0226e64000000, 0x4105f3fb80000000, 0xc0f953cba0000000, + 0x41030d40e0000000, 0xc0fac1ca80000000, 0xc0fb5cb7a0000000, + 0x40a0c55800000000); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE2(void) { + VSET(16, e16, m1); + // -15.5625, 95.7500, -42.4375, 30.7188, -50.7500, -90.2500, + // -95.5000, 29.5938, -41.4062, -94.0000, 34.3438, + // -69.5625, 31.5625, -75.0625, 46.2500, -63.6875 + VLOAD_16(v2, 0xcbc8, 0x55fc, 0xd14e, 0x4fae, 0xd258, 0xd5a4, 0xd5f8, 0x4f66, + 0xd12d, 0xd5e0, 0x504b, 0xd459, 0x4fe4, 0xd4b1, 0x51c8, 0xd3f6); + // 57.2500, 43.2812, -49.4062, -53.5625, -54.7812, + // -12.1406, 92.1875, 67.1875, -19.7656, -41.2812, 98.0625, + // -41.9062, 10.1719, -84.6250, -7.1016, 62.8750 + VLOAD_16(v6, 0x5328, 0x5169, 0xd22d, 0xd2b2, 0xd2d9, 0xca12, 0x55c3, 0x5433, + 0xccf1, 0xd129, 0x5621, 0xd13d, 0x4916, 0xd54a, 0xc71a, 0x53dc); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.vv v4, v2, v6, v0.t"); + // 0.00000000, 52.46875000, 0.00000000, 84.28125000, + // 0.00000000, -78.10937500, 0.00000000, -37.59375000, + // 0.00000000, -52.71875000, 0.00000000, -27.65625000, + // 0.00000000, 9.56250000, 0.00000000, -126.56250000 + VCMP_U32(3, v4, 0x0, 0x4251e000, 0x0, 0x42a89000, 0x0, 0xc29c3800, 0x0, + 0xc2166000, 0x0, 0xc252e000, 0x0, 0xc1dd4000, 0x0, 0x41190000, 0x0, + 0xc2fd2000); + + VSET(16, e32, m1); + // 74632.77343750, -65636.60937500, 16165.84765625, + // -17815.85937500, -85604.03125000, -76754.03125000, + // 21778.01171875, -70512.52343750, 85301.90625000, + // -8385.11035156, 98258.05468750, -50421.53125000, + // 69842.53906250, -65219.96093750, -65266.08984375, + // -90740.60156250 + VLOAD_32(v2, 0x4791c463, 0xc780324e, 0x467c9764, 0xc68b2fb8, 0xc7a73204, + 0xc795e904, 0x46aa2406, 0xc789b843, 0x47a69af4, 0xc6030471, + 0x47bfe907, 0xc744f588, 0x47886945, 0xc77ec3f6, 0xc77ef217, + 0xc7b13a4d); + // 5391.72216797, -90760.36718750, -22961.19531250, + // 12708.62500000, 87107.59375000, 54867.48437500, + // 55424.39453125, -71436.00781250, -61505.46484375, + // 57701.78906250, -81581.38281250, 53319.19531250, + // -86229.57031250, 44376.69531250, 46809.38671875, + // -92887.27343750 + VLOAD_32(v6, 0x45a87dc7, 0xc7b1442f, 0xc6b36264, 0x46469280, 0x47aa21cc, + 0x4756537c, 0x47588065, 0xc78b8601, 0xc7704177, 0x476165ca, + 0xc79f56b1, 0x47504732, 0xc7a86ac9, 0x472d58b2, 0x4736d963, + 0xc7b56ba3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.vv v4, v2, v6, v0.t"); + // 0.0000000000000000, 25123.7578125000000000, + // 0.0000000000000000, -30524.4843750000000000, + // 0.0000000000000000, -131621.5156250000000000, + // 0.0000000000000000, 923.4843750000000000, + // 0.0000000000000000, -66086.8994140625000000, + // 0.0000000000000000, -103740.7265625000000000, + // 0.0000000000000000, -109596.6562500000000000, + // 0.0000000000000000, 2146.6718750000000000 + VCMP_U64(4, v4, 0x0, 0x40d888f080000000, 0x0, 0xc0ddcf1f00000000, 0x0, + 0xc100112c20000000, 0x0, 0x408cdbe000000000, 0x0, 0xc0f0226e64000000, + 0x0, 0xc0f953cba0000000, 0x0, 0xc0fac1ca80000000, 0x0, + 0x40a0c55800000000); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // 36.4375 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x508e); + // 69.8125, -37.3125, -77.2500, 32.7188, + // -83.0000, 76.3125, 14.9375, 72.5000, 39.6250, + // -61.2188, 36.3438, 93.5000, -87.1875, -6.9258, 25.1094, + // -96.8750 + VLOAD_16(v2, 0x545d, 0xd0aa, 0xd4d4, 0x5017, 0xd530, 0x54c5, 0x4b78, 0x5488, + 0x50f4, 0xd3a7, 0x508b, 0x55d8, 0xd573, 0xc6ed, 0x4e47, 0xd60e); + asm volatile("vfwsub.vf v4, v2, %[A]" ::[A] "f"(dscalar_16)); + // 33.37500000, -73.75000000, -113.68750000, -3.71875000, + // -119.43750000, 39.87500000, + // -21.50000000, 36.06250000, 3.18750000, -97.65625000, + // -0.09375000, 57.06250000, -123.62500000, -43.36328125, + // -11.32812500, -133.31250000 + VCMP_U32(5, v4, 0x42058000, 0xc2938000, 0xc2e36000, 0xc06e0000, 0xc2eee000, + 0x421f8000, 0xc1ac0000, 0x42104000, 0x404c0000, 0xc2c35000, + 0xbdc00000, 0x42644000, 0xc2f74000, 0xc22d7400, 0xc1354000, + 0xc3055000); + + VSET(16, e32, m1); + double dscalar_32; + // -138614.20312500 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc8075d8d); + // 473107.93750000, 161975.07812500, -173044.89062500, + // -322046.09375000, -485607.56250000, -613808.37500000, + // -182790.53125000, 121114.44531250, -958537.81250000, + // 295217.40625000, 281159.84375000, -735195.87500000, + // -783982.56250000, 420983.65625000, 954426.12500000, + // -297052.53125000 + VLOAD_32(v2, 0x48e7027e, 0x481e2dc5, 0xc828fd39, 0xc89d3fc3, 0xc8ed1cf2, + 0xc915db06, 0xc83281a2, 0x47ec8d39, 0xc96a049d, 0x4890262d, + 0x488948fb, 0xc9337dbe, 0xc93f66e9, 0x48cd8ef5, 0x496903a2, + 0xc8910b91); + asm volatile("vfwsub.vf v4, v2, %[A]" ::[A] "f"(dscalar_32)); + // 611722.1406250000000000, 300589.2812500000000000, + // -34430.6875000000000000, -183431.8906250000000000, + // -346993.3593750000000000, -475194.1718750000000000, + // -44176.3281250000000000, 259728.6484375000000000, + // -819923.6093750000000000, 433831.6093750000000000, + // 419774.0468750000000000, -596581.6718750000000000, + // -645368.3593750000000000, 559597.8593750000000000, + // 1093040.3281250000000000, -158438.3281250000000000 + VCMP_U64(6, v4, 0x4122ab1448000000, 0x411258b520000000, 0xc0e0cfd600000000, + 0xc106643f20000000, 0xc1152dc570000000, 0xc11d00e8b0000000, + 0xc0e5920a80000000, 0x410fb48530000000, 0xc12905a738000000, + 0x411a7a9e70000000, 0x41199ef830000000, 0xc12234cb58000000, + 0xc123b1f0b8000000, 0x412113dbb8000000, 0x4130adb054000000, + 0xc1035732a0000000); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // 36.4375 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x508e); + // 69.8125, -37.3125, -77.2500, 32.7188, + // -83.0000, 76.3125, 14.9375, 72.5000, 39.6250, + // -61.2188, 36.3438, 93.5000, -87.1875, -6.9258, 25.1094, + // -96.8750 + VLOAD_16(v2, 0x545d, 0xd0aa, 0xd4d4, 0x5017, 0xd530, 0x54c5, 0x4b78, 0x5488, + 0x50f4, 0xd3a7, 0x508b, 0x55d8, 0xd573, 0xc6ed, 0x4e47, 0xd60e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.00000000, -73.75000000, 0.00000000, -3.71875000, + // 0.00000000, 39.87500000, 0.00000000, 36.06250000, + // 0.00000000, -97.65625000, 0.00000000, 57.06250000, + // 0.00000000, -43.36328125, 0.00000000, -133.31250000 + VCMP_U32(7, v4, 0x0, 0xc2938000, 0x0, 0xc06e0000, 0x0, 0x421f8000, 0x0, + 0x42104000, 0x0, 0xc2c35000, 0x0, 0x42644000, 0x0, 0xc22d7400, 0x0, + 0xc3055000); + + VSET(16, e32, m1); + double dscalar_32; + // -138614.20312500 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc8075d8d); + // 473107.93750000, 161975.07812500, -173044.89062500, + // -322046.09375000, -485607.56250000, -613808.37500000, + // -182790.53125000, 121114.44531250, -958537.81250000, + // 295217.40625000, 281159.84375000, -735195.87500000, + // -783982.56250000, 420983.65625000, 954426.12500000, + // -297052.53125000 + VLOAD_32(v2, 0x48e7027e, 0x481e2dc5, 0xc828fd39, 0xc89d3fc3, 0xc8ed1cf2, + 0xc915db06, 0xc83281a2, 0x47ec8d39, 0xc96a049d, 0x4890262d, + 0x488948fb, 0xc9337dbe, 0xc93f66e9, 0x48cd8ef5, 0x496903a2, + 0xc8910b91); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.vf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.0000000000000000, 300589.2812500000000000, + // 0.0000000000000000, -183431.8906250000000000, + // 0.0000000000000000, -475194.1718750000000000, + // 0.0000000000000000, 259728.6484375000000000, + // 0.0000000000000000, 433831.6093750000000000, + // 0.0000000000000000, -596581.6718750000000000, + // 0.0000000000000000, 559597.8593750000000000, + // 0.0000000000000000, -158438.3281250000000000 + VCMP_U64(8, v4, 0x0, 0x411258b520000000, 0x0, 0xc106643f20000000, 0x0, + 0xc11d00e8b0000000, 0x0, 0x410fb48530000000, 0x0, 0x411a7a9e70000000, + 0x0, 0xc12234cb58000000, 0x0, 0x412113dbb8000000, 0x0, + 0xc1035732a0000000); +}; +// Simple random test with similar values +void TEST_CASE5(void) { + VSET(16, e16, m1); + // -92.15529633, 27.66998672, + // -5.68499708, 78.95133209, 57.52299500, 15.45270920, 50.26883316, + // 46.63587189, 71.16806793, -80.68485260, + // -22.34193420, 40.17027283, 93.54611969, 25.86016083, 41.82838821, + // 82.50254822 + VLOAD_32(v2, 0xc2b84f83, 0x41dd5c22, 0xc0b5eb7f, 0x429de715, 0x4266178c, + 0x41773e4c, 0x42491349, 0x423a8b22, 0x428e560d, 0xc2a15ea5, + 0xc1b2bc48, 0x4220ae5c, 0x42bb179d, 0x41cee19c, 0x42275045, + 0x42a5014e); + // -72.5625, -83.4375, 28.8281, 33.5938, + // -85.7500, 67.5000, 91.0625, -91.8750, -9.2578, -64.2500, + // -58.6250, 50.3438, -70.5000, 36.6250, 5.7930, 86.6875 + VLOAD_16(v6, 0xd489, 0xd537, 0x4f35, 0x5033, 0xd55c, 0x5438, 0x55b1, 0xd5be, + 0xc8a1, 0xd404, 0xd354, 0x524b, 0xd468, 0x5094, 0x45cb, 0x556b); + asm volatile("vfwsub.wv v4, v2, v6"); + // -19.59279633, 111.10748291, -34.51312256, 45.35758209, + // 143.27299500, -52.04729080, -40.79366684, + // 138.51086426, 80.42588043, -16.43485260, 36.28306580, + // -10.17347717, 164.04611206, -10.76483917, 36.03541946, + // -4.18495178 + VCMP_U32(9, v4, 0xc19cbe0c, 0x42de3708, 0xc20a0d70, 0x42356e2a, 0x430f45e3, + 0xc250306d, 0xc2232cb7, 0x430a82c8, 0x42a0da0d, 0xc1837a94, + 0x421121dc, 0xc122c690, 0x43240bce, 0xc12c3cc8, 0x42102445, + 0xc085eb20); + + VSET(16, e32, m1); + // -79494.9435096215456724, 81629.4152202270051930, + // 60506.1876363231276628, -81020.4028176319407066, + // -6814.2587861350475578, 11974.4045779409498209, + // 97975.7066144426062237, -93357.8779376419261098, + // 95959.4397212496260181, -58528.4286213813902577, + // 28958.3763895476586185, -36387.3665319164574612, + // -90399.7993234442838002, -78772.1006454367889091, + // -62854.6154750282003079, 37858.6386504948022775 + VLOAD_64(v2, 0xc0f3686f189d8b80, 0x40f3edd6a4bdf6fa, 0x40ed8b46011de3ec, + 0xc0f3c7c671f0e6b7, 0xc0ba9e423fcee2b0, 0x40c76333c935c088, + 0x40f7eb7b4e4af21e, 0xc0f6cade0c085740, 0x40f76d7709192628, + 0xc0ec940db7442fee, 0x40dc479816c42f70, 0xc0e1c46bbaa12444, + 0xc0f611fcca076142, 0xc0f33b419c3e63b8, 0xc0eeb0d3b1f8afb4, + 0x40e27c546fd32998); + // 95822.63281250, 21789.49804688, -42409.42968750, + // 60172.89062500, -46359.57812500, -71236.33593750, + // 4124.35888672, -80527.00000000, 27430.70507812, + // 39975.67578125, -71197.53125000, -66640.12500000, + // 47459.75390625, -34899.84375000, -21371.85937500, + // 17582.65820312 + VLOAD_32(v6, 0x47bb2751, 0x46aa3aff, 0xc725a96e, 0x476b0ce4, 0xc7351794, + 0xc78b222b, 0x4580e2df, 0xc79d4780, 0x46d64d69, 0x471c27ad, + 0xc78b0ec4, 0xc7822810, 0x473963c1, 0xc70853d8, 0xc6a6f7b8, + 0x46895d51); + asm volatile("vfwsub.wv v4, v2, v6"); + // -175317.5763221215456724, 59839.9171733520051930, + // 102915.6173238231276628, -141193.2934426319552585, + // 39545.3193388649524422, 83210.7405154409498209, + // 93851.3477277238562237, -12830.8779376419261098, + // 68528.7346431246260181, -98504.1044026313902577, + // 100155.9076395476586185, 30252.7584680835425388, + // -137859.5532296942838002, -43872.2568954367889091, + // -41482.7561000282003079, 20275.9804473698022775 + VCMP_U64(10, v4, 0xc10566ac9c4ec5c0, 0x40ed37fd597bedf4, 0x40f92039e08ef1f6, + 0xc1013c4a58f8735c, 0x40e34f2a380623aa, 0x40f450abd926b811, + 0x40f6e9b5904af21e, 0xc0c90f706042ba00, 0x40f0bb0bc1192628, + 0xc0f80c81aba217f7, 0x40f873be85b10bdc, 0x40dd8b308abdb778, + 0xc100d41c6d03b0a1, 0xc0e56c08387cc770, 0xc0e4415831f8afb4, + 0x40d3ccfebfa65330); +}; + +// Simple random test with similar values (masked) +// The numbers are the same of TEST_CASE1 +void TEST_CASE6(void) { + VSET(16, e16, m1); + // -92.15529633, 27.66998672, + // -5.68499708, 78.95133209, 57.52299500, 15.45270920, 50.26883316, + // 46.63587189, 71.16806793, -80.68485260, + // -22.34193420, 40.17027283, 93.54611969, 25.86016083, 41.82838821, + // 82.50254822 + VLOAD_32(v2, 0xc2b84f83, 0x41dd5c22, 0xc0b5eb7f, 0x429de715, 0x4266178c, + 0x41773e4c, 0x42491349, 0x423a8b22, 0x428e560d, 0xc2a15ea5, + 0xc1b2bc48, 0x4220ae5c, 0x42bb179d, 0x41cee19c, 0x42275045, + 0x42a5014e); + // -72.5625, -83.4375, 28.8281, 33.5938, + // -85.7500, 67.5000, 91.0625, -91.8750, -9.2578, -64.2500, + // -58.6250, 50.3438, -70.5000, 36.6250, 5.7930, 86.6875 + VLOAD_16(v6, 0xd489, 0xd537, 0x4f35, 0x5033, 0xd55c, 0x5438, 0x55b1, 0xd5be, + 0xc8a1, 0xd404, 0xd354, 0x524b, 0xd468, 0x5094, 0x45cb, 0x556b); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.wv v4, v2, v6, v0.t"); + // 0.00000000, 111.10748291, 0.00000000, 45.35758209, + // 0.00000000, -52.04729080, 0.00000000, 138.51086426, + // 0.00000000, -16.43485260, 0.00000000, -10.17347717, + // 0.00000000, -10.76483917, 0.00000000, -4.18495178 + VCMP_U32(11, v4, 0x0, 0x42de3708, 0x0, 0x42356e2a, 0x0, 0xc250306d, 0x0, + 0x430a82c8, 0x0, 0xc1837a94, 0x0, 0xc122c690, 0x0, 0xc12c3cc8, 0x0, + 0xc085eb20); + + VSET(16, e32, m1); + // -79494.9435096215456724, 81629.4152202270051930, + // 60506.1876363231276628, -81020.4028176319407066, + // -6814.2587861350475578, 11974.4045779409498209, + // 97975.7066144426062237, -93357.8779376419261098, + // 95959.4397212496260181, -58528.4286213813902577, + // 28958.3763895476586185, -36387.3665319164574612, + // -90399.7993234442838002, -78772.1006454367889091, + // -62854.6154750282003079, 37858.6386504948022775 + VLOAD_64(v2, 0xc0f3686f189d8b80, 0x40f3edd6a4bdf6fa, 0x40ed8b46011de3ec, + 0xc0f3c7c671f0e6b7, 0xc0ba9e423fcee2b0, 0x40c76333c935c088, + 0x40f7eb7b4e4af21e, 0xc0f6cade0c085740, 0x40f76d7709192628, + 0xc0ec940db7442fee, 0x40dc479816c42f70, 0xc0e1c46bbaa12444, + 0xc0f611fcca076142, 0xc0f33b419c3e63b8, 0xc0eeb0d3b1f8afb4, + 0x40e27c546fd32998); + // 95822.63281250, 21789.49804688, -42409.42968750, + // 60172.89062500, -46359.57812500, -71236.33593750, + // 4124.35888672, -80527.00000000, 27430.70507812, + // 39975.67578125, -71197.53125000, -66640.12500000, + // 47459.75390625, -34899.84375000, -21371.85937500, + // 17582.65820312 + VLOAD_32(v6, 0x47bb2751, 0x46aa3aff, 0xc725a96e, 0x476b0ce4, 0xc7351794, + 0xc78b222b, 0x4580e2df, 0xc79d4780, 0x46d64d69, 0x471c27ad, + 0xc78b0ec4, 0xc7822810, 0x473963c1, 0xc70853d8, 0xc6a6f7b8, + 0x46895d51); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.wv v4, v2, v6, v0.t"); + // 0.0000000000000000, 59839.9171733520051930, + // 0.0000000000000000, -141193.2934426319552585, + // 0.0000000000000000, 83210.7405154409498209, + // 0.0000000000000000, -12830.8779376419261098, + // 0.0000000000000000, -98504.1044026313902577, + // 0.0000000000000000, 30252.7584680835425388, + // 0.0000000000000000, -43872.2568954367889091, + // 0.0000000000000000, 20275.9804473698022775 + VCMP_U64(12, v4, 0x0, 0x40ed37fd597bedf4, 0x0, 0xc1013c4a58f8735c, 0x0, + 0x40f450abd926b811, 0x0, 0xc0c90f706042ba00, 0x0, 0xc0f80c81aba217f7, + 0x0, 0x40dd8b308abdb778, 0x0, 0xc0e56c08387cc770, 0x0, + 0x40d3ccfebfa65330); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE7(void) { + VSET(16, e16, m1); + double dscalar_16; + // -8.76965809, 55.45920181, 71.29286957, -84.65414429, + // -81.93881226, 75.13192749, -75.44019318, -48.81898499, + // 0.10306206, -25.18898392, 49.68006516, 72.66278076, + // -24.90880966, -32.59431458, 14.58876038, -55.07221603 + VLOAD_32(v2, 0xc10c5085, 0x425dd639, 0x428e95f3, 0xc2a94eec, 0xc2a3e0ac, + 0x4296438c, 0xc296e161, 0xc24346a4, 0x3dd31233, 0xc1c9830a, + 0x4246b863, 0x42915358, 0xc1c7453e, 0xc2026094, 0x41696b90, + 0xc25c49f3); + // 34.7812 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x5059); + asm volatile("vfwsub.wf v4, v2, %[A]" ::[A] "f"(dscalar_16)); + // -43.55090714, 20.67795181, 36.51161957, -119.43539429, + // -116.72006226, 40.35067749, -110.22144318, -83.60023499, + // -34.67818832, -59.97023392, 14.89881516, 37.88153076, + // -59.69005966, -67.37556458, -20.19248962, -89.85346985 + VCMP_U32(13, v4, 0xc22e3421, 0x41a56c72, 0x42120be6, 0xc2eedeec, 0xc2e970ac, + 0x42216718, 0xc2dc7161, 0xc2a73352, 0xc20ab677, 0xc26fe185, + 0x416e618c, 0x421786b0, 0xc26ec29f, 0xc286c04a, 0xc1a18a38, + 0xc2b3b4fa); + + VSET(16, e32, m1); + double dscalar_32; + // 322189.5706008458510041, 914899.9451866354793310, + // -620811.0881863175891340, -456926.2657179111847654, + // -549945.8717311944346875, -386814.9759888321859762, + // 748677.5319772073999047, 821298.7777016961481422, + // 968861.0598710167687386, -343694.5546012039994821, + // -782815.4022130169905722, -561429.7869165195152164, + // 755371.9691831718664616, -954868.1761190977413207, + // -606267.0986005428712815, 818185.4808380266185850 + VLOAD_64(v2, 0x4113aa36484b9690, 0x412beba7e3ef80b0, 0xc122f2162d26c1cc, + 0xc11be37910185b2a, 0xc120c873be538d16, 0xc1179bfbe7699dce, + 0x4126d90b105f5108, 0x412910658e2eeaae, 0x412d913a1ea769f6, + 0xc114fa3a37e960c6, 0xc127e3becdeedd54, 0xc121222b92e6b8d8, + 0x41270d57f038c6d6, 0xc12d23e85a2c484a, 0xc1228076327bc536, + 0x4128f812f63066de); + // -83388.08593750 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc7a2de0b); + asm volatile("vfwsub.wf v4, v2, %[A]" ::[A] "f"(dscalar_32)); + // 405577.6565383458510041, 998288.0311241354793310, + // -537423.0022488175891340, -373538.1797804111847654, + // -466557.7857936944346875, -303426.8900513321859762, + // 832065.6179147073999047, 904686.8636391961481422, + // 1052249.1458085167687386, -260306.4686637039994821, + // -699427.3162755169905722, -478041.7009790195152164, + // 838760.0551206718664616, -871480.0901815977413207, + // -522879.0126630428712815, 901573.5667755266185850 + VCMP_U64(14, v4, 0x4118c126a04b9690, 0x412e77200fef80b0, 0xc120669e0126c1cc, + 0xc116cc88b8185b2a, 0xc11c79f724a71a2c, 0xc112850b8f699dce, + 0x412964833c5f5108, 0x412b9bddba2eeaae, 0x41300e592553b4fb, + 0xc10fc693bfd2c18c, 0xc1255846a1eedd54, 0xc11d2d66cdcd71b0, + 0x412998d01c38c6d6, 0xc12a98702e2c484a, 0xc11fe9fc0cf78a6c, + 0x412b838b223066de); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE8(void) { + VSET(16, e16, m1); + double dscalar_16; + // -8.76965809, 55.45920181, 71.29286957, -84.65414429, + // -81.93881226, 75.13192749, -75.44019318, -48.81898499, + // 0.10306206, -25.18898392, 49.68006516, 72.66278076, + // -24.90880966, -32.59431458, 14.58876038, -55.07221603 + VLOAD_32(v2, 0xc10c5085, 0x425dd639, 0x428e95f3, 0xc2a94eec, 0xc2a3e0ac, + 0x4296438c, 0xc296e161, 0xc24346a4, 0x3dd31233, 0xc1c9830a, + 0x4246b863, 0x42915358, 0xc1c7453e, 0xc2026094, 0x41696b90, + 0xc25c49f3); + // 34.7812 + BOX_HALF_IN_DOUBLE(dscalar_16, 0x5059); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.wf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + // 0.00000000, 20.67795181, 0.00000000, -119.43539429, + // 0.00000000, 40.35067749, 0.00000000, -83.60023499, + // 0.00000000, -59.97023392, 0.00000000, 37.88153076, + // 0.00000000, -67.37556458, 0.00000000, -89.85346985 + VCMP_U32(15, v4, 0x0, 0x41a56c72, 0x0, 0xc2eedeec, 0x0, 0x42216718, 0x0, + 0xc2a73352, 0x0, 0xc26fe185, 0x0, 0x421786b0, 0x0, 0xc286c04a, 0x0, + 0xc2b3b4fa); + + VSET(16, e32, m1); + double dscalar_32; + // 322189.5706008458510041, 914899.9451866354793310, + // -620811.0881863175891340, -456926.2657179111847654, + // -549945.8717311944346875, -386814.9759888321859762, + // 748677.5319772073999047, 821298.7777016961481422, + // 968861.0598710167687386, -343694.5546012039994821, + // -782815.4022130169905722, -561429.7869165195152164, + // 755371.9691831718664616, -954868.1761190977413207, + // -606267.0986005428712815, 818185.4808380266185850 + VLOAD_64(v2, 0x4113aa36484b9690, 0x412beba7e3ef80b0, 0xc122f2162d26c1cc, + 0xc11be37910185b2a, 0xc120c873be538d16, 0xc1179bfbe7699dce, + 0x4126d90b105f5108, 0x412910658e2eeaae, 0x412d913a1ea769f6, + 0xc114fa3a37e960c6, 0xc127e3becdeedd54, 0xc121222b92e6b8d8, + 0x41270d57f038c6d6, 0xc12d23e85a2c484a, 0xc1228076327bc536, + 0x4128f812f63066de); + // -83388.08593750 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xc7a2de0b); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vfwsub.wf v4, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + // 0.0000000000000000, 998288.0311241354793310, + // 0.0000000000000000, -373538.1797804111847654, + // 0.0000000000000000, -303426.8900513321859762, + // 0.0000000000000000, 904686.8636391961481422, + // 0.0000000000000000, -260306.4686637039994821, + // 0.0000000000000000, -478041.7009790195152164, + // 0.0000000000000000, -871480.0901815977413207, + // 0.0000000000000000, 901573.5667755266185850 + VCMP_U64(16, v4, 0x0, 0x412e77200fef80b0, 0x0, 0xc116cc88b8185b2a, 0x0, + 0xc112850b8f699dce, 0x0, 0x412b9bddba2eeaae, 0x0, 0xc10fc693bfd2c18c, + 0x0, 0xc11d2d66cdcd71b0, 0x0, 0xc12a98702e2c484a, 0x0, + 0x412b838b223066de); +}; + +int main(void) { + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vid.c b/apps/riscv-tests/isa/rv64uv/vid.c new file mode 100644 index 0000000..796e3e1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vid.c @@ -0,0 +1,42 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + __asm__ volatile("vid.v v1"); + VCMP_U8(1, v1, 0, 1, 2, 3, 4, 5, 6, 7); + VSET(10, e8, m1); + + VLOAD_8(v1, 0b00001110, 0b00000111, 0b00010000, 0b01001011, 0b00110100, + 0b01111101, 0b11001100, 0b00011000, 0b01000111, 0b00010100); + VSET(77, e8, m1); + asm volatile("vid.v v2"); + VCMP_U8(2, v2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v0, 85, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("vid.v v1, v0.t"); + VCMP_U8(3, v1, 0, 0, 2, 0, 4, 0, 6, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/viota.c b/apps/riscv-tests/isa/rv64uv/viota.c new file mode 100644 index 0000000..bd8dbec --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/viota.c @@ -0,0 +1,280 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(1, e8, m1); + VLOAD_8(v1, 0b10001001); + VSET(8, e8, m1); + asm volatile("viota.m v2, v1"); + VCMP_U8(1, v2, 0, 1, 1, 1, 2, 2, 2, 2); + + VSET(2, e8, m1); + VLOAD_8(v1, 0b01100010, 0b01001100); + VSET(16, e8, m1); + asm volatile("viota.m v2, v1"); + VCMP_U8(2, v2, 0, 0, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4, 5, 5, 5, 6); + + VSET(1, e8, m8); + VLOAD_8(v0, 0b00000001); + VSET(4, e16, m8); + asm volatile("viota.m v8, v0"); + VCMP_U16(3, v8, 0, 1, 1, 1); + + VSET(64, e8, m4); + VLOAD_8( + v0, 0b10101101, 0b10000000, 0b00000110, 0b10011100, 0b10010101, + 0b01001100, 0b01101010, 0b11000100, 0b00011110, 0b10111010, 0b00100110, + 0b11001010, 0b01101101, 0b11001010, 0b01000101, 0b00010110, 0b00001000, + 0b10111000, 0b11011100, 0b11100000, 0b00110101, 0b10011110, 0b01001111, + 0b01011101, 0b00001010, 0b01111000, 0b11010100, 0b01011101, 0b11000101, + 0b10010010, 0b01011100, 0b11010101, 0b00100010, 0b10000100, 0b11001011, + 0b01001101, 0b01010000, 0b10110011, 0b00011000, 0b10000101, 0b01110101, + 0b00001111, 0b10111100, 0b00010101, 0b10011101, 0b11011001, 0b11010101, + 0b00100001, 0b01101110, 0b10000001, 0b01100100, 0b00010001, 0b00010100, + 0b00101011, 0b11111000, 0b10010000, 0b01010000, 0b01001111, 0b00000011, + 0b10100100, 0b10001010, 0b01110011, 0b10100010, 0b01111110); + VSET(512, e8, m4); + asm volatile("viota.m v8, v0"); + VCMP_U8( + 4, v8, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7, 8, 8, 8, + 8, 8, 8, 8, 8, 9, 10, 11, 11, 11, 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, + 16, 17, 18, 18, 18, 19, 19, 19, 20, 20, 21, 21, 22, 23, 23, 23, 23, 24, + 24, 24, 24, 25, 26, 26, 27, 28, 29, 30, 30, 30, 30, 30, 31, 31, 32, 33, + 34, 34, 35, 35, 36, 37, 37, 37, 38, 38, 38, 38, 39, 39, 40, 40, 40, 41, + 42, 43, 43, 44, 45, 45, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 51, 52, + 52, 53, 53, 53, 53, 54, 54, 54, 55, 56, 56, 57, 57, 57, 57, 57, 57, 57, + 58, 58, 58, 58, 58, 58, 58, 58, 59, 60, 61, 61, 62, 62, 62, 63, 64, 65, + 65, 66, 67, 67, 67, 67, 67, 67, 68, 69, 70, 71, 71, 72, 72, 73, 74, 74, + 74, 74, 75, 76, 77, 78, 78, 78, 79, 80, 81, 82, 83, 83, 83, 84, 84, 85, + 85, 86, 87, 88, 88, 89, 89, 89, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, + 92, 93, 94, 95, 95, 95, 95, 96, 96, 97, 97, 98, 99, 100, 100, 101, 102, + 103, 103, 104, 104, 105, 105, 106, 106, 106, 106, 107, 108, 108, 109, 109, + 109, 110, 110, 110, 111, 111, 111, 112, 113, 114, 114, 115, 115, 116, 116, + 117, 117, 118, 118, 119, 120, 120, 121, 121, 121, 121, 122, 122, 122, 122, + 122, 123, 123, 123, 123, 123, 124, 125, 126, 126, 127, 127, 127, 128, 129, + 130, 130, 131, 132, 132, 132, 133, 133, 133, 133, 133, 133, 134, 134, 135, + 135, 136, 137, 137, 137, 138, 139, 139, 140, 140, 140, 140, 141, 142, 142, + 142, 142, 143, 143, 144, 144, 144, 144, 144, 145, 146, 146, 147, 147, 148, + 149, 150, 150, 151, 152, 153, 154, 154, 154, 154, 154, 154, 154, 155, 156, + 157, 158, 158, 159, 160, 160, 161, 161, 162, 162, 162, 162, 163, 163, 164, + 165, 166, 166, 166, 167, 168, 168, 168, 169, 170, 170, 171, 172, 173, 173, + 174, 174, 175, 175, 176, 177, 178, 178, 178, 178, 178, 179, 179, 179, 179, + 180, 181, 182, 182, 183, 184, 184, 185, 185, 185, 185, 185, 185, 185, 186, + 186, 186, 187, 187, 187, 188, 189, 189, 190, 190, 190, 190, 191, 191, 191, + 191, 191, 191, 192, 192, 193, 193, 193, 193, 194, 195, 195, 196, 196, 197, + 197, 197, 197, 197, 197, 198, 199, 200, 201, 202, 202, 202, 202, 202, 203, + 203, 203, 204, 204, 204, 204, 204, 205, 205, 206, 206, 207, 208, 209, 210, + 210, 210, 211, 211, 212, 213, 213, 213, 213, 213, 213, 213, 213, 213, 214, + 214, 214, 215, 215, 216, 216, 217, 217, 218, 218, 218, 218, 219, 220, 221, + 221, 221, 222, 223, 224, 224, 224, 225, 225, 225, 225, 226, 226, 227, 227, + 228, 229, 230, 231, 232, 233); + + VSET(128, e8, m8); + VLOAD_8( + v0, 0b00000001, 0b00000011, 0b00111110, 0b00000100, 0b01101000, + 0b10111011, 0b11010110, 0b10111111, 0b00110011, 0b00011100, 0b11010100, + 0b00011010, 0b10100001, 0b10110100, 0b10010111, 0b01010100, 0b00011010, + 0b01101011, 0b00101010, 0b11111111, 0b10000100, 0b11100110, 0b00100001, + 0b01101000, 0b10110100, 0b01100010, 0b11100001, 0b10011100, 0b00110111, + 0b01010011, 0b01010111, 0b10010001, 0b11001000, 0b01001011, 0b01000000, + 0b10001111, 0b00001111, 0b01110100, 0b10101100, 0b00010101, 0b00110100, + 0b10010010, 0b00001101, 0b11110011, 0b10101101, 0b10000100, 0b01111000, + 0b11010101, 0b10110110, 0b00110110, 0b01010001, 0b01001000, 0b11100011, + 0b01001110, 0b11101101, 0b01111000, 0b10111101, 0b00111011, 0b10111001, + 0b11000110, 0b00000011, 0b00001110, 0b00001111, 0b00000010, 0b01010110, + 0b00000010, 0b11011011, 0b01010100, 0b10110110, 0b10100011, 0b10100101, + 0b11110101, 0b00000110, 0b10011111, 0b01000110, 0b00100000, 0b00100011, + 0b11110100, 0b10111101, 0b10000010, 0b11110011, 0b00111111, 0b11000010, + 0b00011001, 0b10000010, 0b00110011, 0b11000110, 0b11001100, 0b10011100, + 0b11001011, 0b10101101, 0b11011110, 0b11010110, 0b11010110, 0b00100100, + 0b01111010, 0b00111001, 0b10111000, 0b01101000, 0b00001001, 0b10010100, + 0b11111101, 0b00001101, 0b10100111, 0b11000110, 0b01100111, 0b01010111, + 0b10011001, 0b01100111, 0b00001011, 0b01001011, 0b10001101, 0b11110110, + 0b10001001, 0b10010101, 0b10010010, 0b10100100, 0b01010110, 0b10110110, + 0b10111001, 0b01010000, 0b01010001, 0b01001100, 0b11001101, 0b10111100, + 0b11110010, 0b00001000, 0b10111000); + VSET(1024, e16, m8); + asm volatile("viota.m v8, v0"); + VCMP_U16( + 5, v8, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, + 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 11, 12, 12, 13, 14, 14, + 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 29, 30, 31, 32, 32, 32, 33, 34, 34, 34, 34, 34, 35, 36, 37, 37, 37, + 37, 37, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 44, 44, 45, + 45, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 50, 50, 51, 52, 53, 54, + 54, 55, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 59, 60, 60, 61, 62, + 62, 62, 62, 63, 64, 64, 65, 65, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 78, 78, 79, 79, 79, 79, 79, 80, 80, + 81, 82, 82, 82, 83, 84, 85, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, + 88, 88, 89, 90, 90, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 95, 95, 95, + 96, 97, 97, 98, 98, 98, 98, 98, 99, 100, 101, 101, 101, 102, 103, 104, + 104, 104, 105, 106, 107, 108, 108, 109, 110, 110, 110, 111, 112, 112, 112, + 113, 113, 114, 114, 115, 116, 117, 117, 118, 118, 119, 119, 120, 120, 120, + 120, 121, 121, 121, 122, 122, 122, 122, 123, 123, 123, 124, 125, 126, 127, + 127, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 130, 130, 131, + 132, 133, 134, 134, 134, 134, 135, 136, 137, 138, 139, 139, 139, 139, 139, + 139, 139, 140, 140, 141, 142, 143, 143, 143, 143, 144, 145, 145, 146, 146, + 147, 148, 148, 149, 149, 150, 150, 150, 150, 150, 150, 151, 151, 152, 153, + 153, 153, 153, 154, 154, 154, 155, 155, 155, 156, 157, 157, 158, 159, 159, + 159, 159, 159, 160, 161, 161, 161, 162, 163, 164, 165, 166, 166, 167, 168, + 168, 169, 169, 170, 170, 170, 171, 171, 171, 171, 171, 172, 172, 172, 172, + 173, 174, 175, 176, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, + 183, 183, 184, 185, 185, 186, 186, 187, 188, 188, 189, 190, 190, 190, 191, + 191, 191, 191, 192, 192, 193, 193, 193, 193, 193, 194, 194, 194, 195, 195, + 196, 197, 197, 197, 197, 198, 199, 200, 200, 201, 202, 203, 203, 203, 204, + 204, 205, 205, 206, 207, 207, 208, 209, 210, 210, 210, 210, 211, 212, 213, + 214, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, + 225, 225, 225, 226, 226, 226, 227, 228, 229, 229, 230, 230, 231, 232, 232, + 232, 232, 233, 234, 235, 236, 236, 236, 236, 236, 236, 236, 236, 237, 238, + 239, 239, 239, 239, 239, 240, 241, 242, 243, 243, 243, 243, 243, 243, 244, + 244, 244, 244, 244, 244, 244, 244, 245, 246, 246, 247, 247, 248, 248, 248, + 249, 249, 249, 249, 249, 249, 249, 250, 251, 251, 252, 253, 253, 254, 255, + 255, 255, 256, 256, 257, 257, 258, 258, 258, 259, 260, 260, 261, 262, 262, + 263, 264, 265, 265, 265, 265, 266, 266, 267, 268, 268, 269, 269, 269, 270, + 270, 271, 272, 272, 273, 273, 274, 275, 276, 277, 277, 278, 279, 279, 279, + 279, 279, 279, 280, 281, 282, 283, 284, 284, 284, 285, 285, 286, 287, 287, + 287, 287, 288, 288, 288, 288, 288, 288, 288, 289, 289, 289, 290, 291, 291, + 291, 291, 292, 292, 292, 292, 292, 293, 293, 294, 295, 296, 297, 298, 298, + 299, 300, 301, 302, 302, 303, 303, 304, 304, 304, 304, 304, 304, 305, 306, + 307, 307, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 317, 317, + 317, 318, 318, 318, 318, 318, 319, 320, 321, 321, 321, 322, 323, 323, 323, + 323, 323, 324, 324, 324, 324, 324, 324, 325, 326, 327, 327, 327, 328, 329, + 329, 329, 329, 330, 331, 331, 331, 331, 332, 333, 333, 333, 334, 335, 335, + 335, 336, 337, 337, 337, 338, 339, 340, 340, 340, 341, 342, 343, 343, 344, + 344, 344, 345, 346, 347, 347, 348, 349, 349, 350, 350, 351, 351, 352, 353, + 354, 355, 355, 356, 357, 357, 358, 359, 359, 360, 360, 361, 362, 362, 363, + 364, 364, 365, 365, 366, 367, 367, 367, 368, 368, 368, 369, 369, 369, 369, + 370, 370, 371, 372, 373, 374, 374, 375, 375, 375, 376, 377, 378, 378, 378, + 378, 378, 378, 379, 380, 381, 381, 382, 382, 382, 382, 383, 383, 384, 385, + 385, 386, 386, 386, 387, 387, 387, 387, 387, 387, 387, 388, 388, 389, 389, + 389, 390, 391, 391, 392, 393, 394, 395, 396, 397, 398, 398, 399, 400, 400, + 400, 400, 400, 401, 402, 403, 403, 403, 404, 404, 405, 405, 406, 407, 407, + 407, 407, 408, 409, 410, 411, 412, 412, 412, 413, 414, 414, 415, 416, 417, + 417, 418, 418, 419, 419, 420, 420, 420, 421, 422, 422, 422, 423, 424, 425, + 426, 426, 426, 427, 428, 428, 429, 430, 430, 431, 431, 431, 431, 431, 432, + 433, 433, 434, 434, 434, 435, 435, 436, 436, 437, 438, 438, 438, 438, 439, + 439, 440, 441, 441, 442, 443, 444, 445, 446, 446, 446, 447, 447, 447, 447, + 448, 449, 449, 450, 450, 451, 451, 451, 452, 452, 453, 453, 453, 454, 454, + 454, 455, 455, 455, 456, 456, 456, 457, 457, 458, 458, 459, 460, 460, 461, + 461, 462, 462, 462, 463, 464, 464, 465, 466, 466, 467, 468, 468, 468, 469, + 470, 471, 471, 472, 472, 472, 472, 472, 473, 473, 474, 474, 475, 475, 475, + 475, 476, 476, 477, 477, 477, 477, 478, 479, 479, 479, 480, 480, 481, 481, + 482, 483, 483, 483, 484, 485, 485, 485, 486, 487, 488, 489, 489, 490, 490, + 491, 491, 491, 492, 493, 494, 495, 495, 495, 495, 496, 496, 496, 496, 496, + 496, 496, 496, 497, 498, 499, 499); + + VSET(10, e8, m1); + VLOAD_8(v1, 0b00001110, 0b00000111, 0b00010000, 0b01001011, 0b00110100, + 0b01111101, 0b11001100, 0b00011000, 0b01000111, 0b00010100); + VSET(77, e8, m1); + asm volatile("viota.m v2, v1"); + VCMP_U8(6, v2, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 31); + + VSET(10, e8, m1); + VLOAD_8(v0, 0b00001110, 0b00000111, 0b00010000, 0b01001011, 0b00110100, + 0b01111101, 0b11001100, 0b00011000, 0b01000111, 0b00010100); + VSET(77, e32, m2); + asm volatile("viota.m v2, v0"); + VCMP_U32(7, v2, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 31); + + VSET(10, e8, m1); + VLOAD_8(v0, 0b00001110, 0b00000111, 0b00010000, 0b01001011, 0b00110100, + 0b01111101, 0b11001100, 0b00011000, 0b01000111, 0b00010100); + VSET(77, e64, m4); + asm volatile("viota.m v4, v0"); + VCMP_U64(8, v4, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 31); + + VSET(5, e16, m1); + VLOAD_16(v0, 0b0000011100001110, 0b0100101100010000, 0b0111110100110100, + 0b0001100011001100, 0b0001010001000111); + VSET(77, e8, m4); + asm volatile("viota.m v4, v0"); + VCMP_U8(9, v4, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 31); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VCLEAR(v2); + VLOAD_8(v2, 0, 1, 2, 3, 4, 5, 6, 7); + VSET(1, e8, m1); + VLOAD_8(v1, 0b10001001); + VLOAD_8(v0, 0b11000111); + VSET(16, e8, m1); + asm volatile("viota.m v2, v1, v0.t"); + VCMP_U8(10, v2, 0, 1, 1, 3, 4, 5, 1, 1); + + VSET(5, e16, m1); + VLOAD_16(v8, 0b0000011100001110, 0b0100101100010000, 0b0111110100110100, + 0b0001100011001100, 0b0001010001000111); + VSET(10, e16, m1); + VLOAD_8(v0, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, + 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b00001111); + VSET(77, e8, m4); + VCLEAR(v4); + asm volatile("viota.m v4, v8, v0.t"); + VCMP_U8(11, v4, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 0); + + VSET(5, e16, m1); + VLOAD_16(v8, 0b0000011100001110, 0b0100101100010000, 0b0111110100110100, + 0b0001100011001100, 0b0001010001000111); + VSET(10, e16, m1); + VLOAD_8(v0, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, + 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b00001011); + VSET(77, e8, m4); + VCLEAR(v4); + asm volatile("viota.m v4, v8, v0.t"); + VCMP_U8(12, v4, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, 0, + 30, 0); + + VSET(5, e16, m1); + VLOAD_16(v8, 0b0000011100001110, 0b0100101100010000, 0b0111110100110100, + 0b0001100011001100, 0b0001010001000111); + VSET(10, e16, m1); + VLOAD_8(v0, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, + 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111); + VSET(77, e8, m4); + asm volatile("viota.m v4, v8, v0.t"); + VCMP_U8(13, v4, 0, 0, 1, 2, 3, 3, 3, 3, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, + 14, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 22, 22, 23, 24, + 24, 24, 24, 25, 26, 26, 26, 26, 27, 28, 29, 29, 29, 29, 30, 30, 30, + 30, 31, 31); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vl.c b/apps/riscv-tests/isa/rv64uv/vl.c new file mode 100644 index 0000000..f40e88d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vl.c @@ -0,0 +1,79 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +static volatile uint8_t ALIGNED_I8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, + 0x88, 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89}; + +static volatile uint16_t ALIGNED_I16[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989}; + +static volatile uint32_t ALIGNED_I32[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, 0xab8b9148, + 0x90318509, 0x31897598, 0x83195999, 0x89139848}; + +static volatile uint64_t ALIGNED_I64[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989}; + +// Misaligned access wrt 128-bit +void TEST_CASE1(void) { + VSET(15, e8, m1); + asm volatile("vle8.v v1, (%0)" ::"r"(&ALIGNED_I8[1])); + VCMP_U8(1, v1, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); +} + +void TEST_CASE2(void) { + VSET(15, e16, m1); + asm volatile("vle16.v v1, (%0)" ::"r"(&ALIGNED_I16[1])); + VCMP_U16(2, v1, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); +} + +void TEST_CASE3(void) { + VSET(15, e32, m1); + asm volatile("vle32.v v1, (%0)" ::"r"(&ALIGNED_I32[1])); + VCMP_U32(3, v1, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, + 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, 0x89139848); +} + +void TEST_CASE4(void) { + VSET(15, e64, m1); + asm volatile("vle64.v v1, (%0)" ::"r"(&ALIGNED_I64[1])); + VCMP_U64(4, v1, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x1893179501093489, + 0x81937598aa819388, 0x1874754791888188, 0x3eeeeeeee33111ae, + 0x9013930148815808, 0xab8b914891484891, 0x9031850931584902, + 0x3189759837598759, 0x8319599991911111, 0x8913984898951989); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vl1r.c b/apps/riscv-tests/isa/rv64uv/vl1r.c new file mode 100644 index 0000000..c5e4209 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vl1r.c @@ -0,0 +1,439 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +uint64_t counter; + +// Vectors are statically allocated not to exceed the stack and go in the UART +// address space + +// Maximum size: (VLEN/8 Bytes * (MAX_LMUL == 8)) = VLEN +// Define VLEN before compiling me +// #define VLEN 4096 +uint8_t gold_vec_8b[VLEN]; +uint16_t gold_vec_16b[VLEN / 2]; +uint32_t gold_vec_32b[VLEN / 4]; +uint64_t gold_vec_64b[VLEN / 8]; + +uint8_t zero_vec_8b[VLEN]; +uint16_t zero_vec_16b[VLEN / 2]; +uint32_t zero_vec_32b[VLEN / 4]; +uint64_t zero_vec_64b[VLEN / 8]; + +uint8_t buf_vec_8b[VLEN]; +uint16_t buf_vec_16b[VLEN / 2]; +uint32_t buf_vec_32b[VLEN / 4]; +uint64_t buf_vec_64b[VLEN / 8]; + +//////////// +// vl1reX // +//////////// + +// 1 whole register load +void TEST_CASE1(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 8); + // Set vl and vtype to super short values + VSET(1, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 8, e8, m1); + // Check that the whole register was loaded + VSTORE(uint8_t, e8, v16, buf_vec_8b); + VMCMP(uint8_t, % hhu, 0, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + VSTORE(uint8_t, e8, v17, buf_vec_8b); + VMCMP(uint8_t, % hhu, 0, buf_vec_8b, zero_vec_8b, VLEN / 8); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_16b, VLEN / 16); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_16b, VLEN / 16); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_16b, VLEN / 16); + // Set vl and vtype to super short values + VSET(1, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re16.v v16, (%0)" ::"r"(gold_vec_16b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 16, e16, m1); + // Check that the whole register was loaded + VSTORE(uint16_t, e16, v16, buf_vec_16b); + VMCMP(uint16_t, % hu, 1, buf_vec_16b, gold_vec_16b, VLEN / 16); + // Check that the neighbour registers are okay + VSTORE(uint16_t, e16, v17, buf_vec_16b); + VMCMP(uint16_t, % hu, 1, buf_vec_16b, zero_vec_16b, VLEN / 16); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_32b, VLEN / 32); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_32b, VLEN / 32); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_32b, VLEN / 32); + // Set vl and vtype to super short values + VSET(1, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re32.v v16, (%0)" ::"r"(gold_vec_32b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 32, e32, m1); + // Check that the whole register was loaded + VSTORE(uint32_t, e32, v16, buf_vec_32b); + VMCMP(uint32_t, % u, 2, buf_vec_32b, gold_vec_32b, VLEN / 32); + // Check that the neighbour registers are okay + VSTORE(uint32_t, e32, v17, buf_vec_32b); + VMCMP(uint32_t, % u, 2, buf_vec_32b, zero_vec_32b, VLEN / 32); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_64b, VLEN / 64); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_64b, VLEN / 64); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_64b, VLEN / 64); + // Set vl and vtype to super short values + VSET(1, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re64.v v16, (%0)" ::"r"(gold_vec_64b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 64, e64, m1); + // Check that the whole register was loaded3 + VSTORE(uint64_t, e64, v16, buf_vec_64b); + VMCMP(uint64_t, % lu, 3, buf_vec_64b, gold_vec_64b, VLEN / 64); + // Check that the neighbour registers are okay + VSTORE(uint64_t, e64, v17, buf_vec_64b); + VMCMP(uint64_t, % lu, 3, buf_vec_64b, zero_vec_64b, VLEN / 64); +} + +//////////// +// vl2reX // +//////////// + +// 2 whole registers load +void TEST_CASE2(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 4); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 4); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 4); + // Set vl and vtype to super short values + VSET(1, e64, m4); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl2re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 4, e8, m2); + // Check that the whole register was loaded + VSTORE(uint8_t, e8, v16, buf_vec_8b); + VMCMP(uint8_t, % hhu, 4, buf_vec_8b, gold_vec_8b, VLEN / 4); + // Check that the neighbour registers are okay + VSTORE(uint8_t, e8, v18, buf_vec_8b); + VMCMP(uint8_t, % hhu, 4, buf_vec_8b, zero_vec_8b, VLEN / 4); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_16b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_16b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_16b, VLEN / 8); + // Set vl and vtype to super short values + VSET(1, e64, m4); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl2re16.v v16, (%0)" ::"r"(gold_vec_16b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 8, e16, m2); + // Check that the whole register was loaded + VSTORE(uint16_t, e16, v16, buf_vec_16b); + VMCMP(uint16_t, % hu, 5, buf_vec_16b, gold_vec_16b, VLEN / 8); + // Check that the neighbour registers are okay + VSTORE(uint16_t, e16, v18, buf_vec_16b); + VMCMP(uint16_t, % hu, 5, buf_vec_16b, zero_vec_16b, VLEN / 8); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_32b, VLEN / 16); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_32b, VLEN / 16); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_32b, VLEN / 16); + // Set vl and vtype to super short values + VSET(1, e64, m4); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl2re32.v v16, (%0)" ::"r"(gold_vec_32b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 16, e32, m2); + // Check that the whole register was loaded + VSTORE(uint32_t, e32, v16, buf_vec_32b); + VMCMP(uint32_t, % u, 6, buf_vec_32b, gold_vec_32b, VLEN / 16); + // Check that the neighbour registers are okay + VSTORE(uint32_t, e32, v18, buf_vec_32b); + VMCMP(uint32_t, % u, 6, buf_vec_32b, zero_vec_32b, VLEN / 16); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_64b, VLEN / 32); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_64b, VLEN / 32); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_64b, VLEN / 32); + // Set vl and vtype to super short values + VSET(1, e64, m4); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl2re64.v v16, (%0)" ::"r"(gold_vec_64b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 32, e64, m2); + // Check that the whole register was loaded3 + VSTORE(uint64_t, e64, v16, buf_vec_64b); + VMCMP(uint64_t, % lu, 7, buf_vec_64b, gold_vec_64b, VLEN / 32); + // Check that the neighbour registers are okay + VSTORE(uint64_t, e64, v18, buf_vec_64b); + VMCMP(uint64_t, % lu, 7, buf_vec_64b, zero_vec_64b, VLEN / 32); +} + +//////////// +// vl4reX // +//////////// + +// 4 whole registers load +void TEST_CASE3(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 2); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 2); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 2); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl4re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 2, e8, m4); + // Check that the whole register was loaded + VSTORE(uint8_t, e8, v16, buf_vec_8b); + VMCMP(uint8_t, % hhu, 8, buf_vec_8b, gold_vec_8b, VLEN / 2); + // Check that the neighbour registers are okay + VSTORE(uint8_t, e8, v20, buf_vec_8b); + VMCMP(uint8_t, % hhu, 8, buf_vec_8b, zero_vec_8b, VLEN / 2); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_16b, VLEN / 4); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_16b, VLEN / 4); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_16b, VLEN / 4); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl4re16.v v16, (%0)" ::"r"(gold_vec_16b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 4, e16, m4); + // Check that the whole register was loaded + VSTORE(uint16_t, e16, v16, buf_vec_16b); + VMCMP(uint16_t, % hu, 9, buf_vec_16b, gold_vec_16b, VLEN / 4); + // Check that the neighbour registers are okay + VSTORE(uint16_t, e16, v20, buf_vec_16b); + VMCMP(uint16_t, % hu, 9, buf_vec_16b, zero_vec_16b, VLEN / 4); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_32b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_32b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_32b, VLEN / 8); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl4re32.v v16, (%0)" ::"r"(gold_vec_32b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 8, e32, m4); + // Check that the whole register was loaded + VSTORE(uint32_t, e32, v16, buf_vec_32b); + VMCMP(uint32_t, % u, 10, buf_vec_32b, gold_vec_32b, VLEN / 8); + // Check that the neighbour registers are okay + VSTORE(uint32_t, e32, v20, buf_vec_32b); + VMCMP(uint32_t, % u, 10, buf_vec_32b, zero_vec_32b, VLEN / 8); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_64b, VLEN / 16); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_64b, VLEN / 16); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_64b, VLEN / 16); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl4re64.v v16, (%0)" ::"r"(gold_vec_64b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 16, e64, m4); + // Check that the whole register was loaded + VSTORE(uint64_t, e64, v16, buf_vec_64b); + VMCMP(uint64_t, % lu, 11, buf_vec_64b, gold_vec_64b, VLEN / 16); + // Check that the neighbour registers are okay + VSTORE(uint64_t, e64, v20, buf_vec_64b); + VMCMP(uint64_t, % lu, 11, buf_vec_64b, zero_vec_64b, VLEN / 16); +} + +//////////// +// vl8reX // +//////////// + +// 8 whole registers load +void TEST_CASE4(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + VCLEAR(v24); + // Load a buffer from memory - whole register load + asm volatile("vl8re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Change vtype and vl to match the whole register + VSET(VLEN, e8, m8); + // Check that the whole register was loaded + VSTORE(uint8_t, e8, v16, buf_vec_8b); + VMCMP(uint8_t, % hhu, 12, buf_vec_8b, gold_vec_8b, VLEN); + // Check that the neighbour registers are okay + VSTORE(uint8_t, e8, v24, buf_vec_8b); + VMCMP(uint8_t, % hhu, 12, buf_vec_8b, zero_vec_8b, VLEN); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_16b, VLEN / 2); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_16b, VLEN / 2); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_16b, VLEN / 2); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + VCLEAR(v24); + // Load a buffer from memory - whole register load + asm volatile("vl8re16.v v16, (%0)" ::"r"(gold_vec_16b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 2, e16, m8); + // Check that the whole register was loaded + VSTORE(uint16_t, e16, v16, buf_vec_16b); + VMCMP(uint16_t, % hu, 13, buf_vec_16b, gold_vec_16b, VLEN / 2); + // Check that the neighbour registers are okay + VSTORE(uint16_t, e16, v24, buf_vec_16b); + VMCMP(uint16_t, % hu, 13, buf_vec_16b, zero_vec_16b, VLEN / 2); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_32b, VLEN / 4); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_32b, VLEN / 4); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_32b, VLEN / 4); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + VCLEAR(v24); + // Load a buffer from memory - whole register load + asm volatile("vl8re32.v v16, (%0)" ::"r"(gold_vec_32b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 4, e32, m8); + // Check that the whole register was loaded + VSTORE(uint32_t, e32, v16, buf_vec_32b); + VMCMP(uint32_t, % u, 14, buf_vec_32b, gold_vec_32b, VLEN / 4); + // Check that the neighbour registers are okay + VSTORE(uint32_t, e32, v24, buf_vec_32b); + VMCMP(uint32_t, % u, 14, buf_vec_32b, zero_vec_32b, VLEN / 4); + + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_64b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_64b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_64b, VLEN / 8); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + VCLEAR(v24); + // Load a buffer from memory - whole register load + asm volatile("vl8re64.v v16, (%0)" ::"r"(gold_vec_64b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 8, e64, m8); + // Check that the whole register was loaded3 + VSTORE(uint64_t, e64, v16, buf_vec_64b); + VMCMP(uint64_t, % lu, 15, buf_vec_64b, gold_vec_64b, VLEN / 8); + // Check that the neighbour registers are okay + VSTORE(uint64_t, e64, v24, buf_vec_64b); + VMCMP(uint64_t, % lu, 15, buf_vec_64b, zero_vec_64b, VLEN / 8); +} + +//////////// +// Others // +//////////// + +// Check with initial vl == 0 +void TEST_CASE5(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 8); + // Set vl and vtype to super short values + VSET(0, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Change vtype and vl to match the whole register + VSET(VLEN / 8, e8, m1); + // Check that the whole register was loaded + VSTORE(uint8_t, e8, v16, buf_vec_8b); + VMCMP(uint8_t, % hhu, 16, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + VSTORE(uint8_t, e8, v17, buf_vec_8b); + VMCMP(uint8_t, % hhu, 16, buf_vec_8b, zero_vec_8b, VLEN / 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vl_nocheck.c b/apps/riscv-tests/isa/rv64uv/vl_nocheck.c new file mode 100644 index 0000000..aadc372 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vl_nocheck.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +// or add inp here +void TEST_CASE1(void) { + VSET(4, e8, m1); + volatile int8_t INP1[] = {0xff, 0x00, 0x0f, 0xf0}; // flush + __asm__ volatile("fence"); + __asm__ volatile("vle8.v v1, (%0)" ::"r"(INP1)); + // VEC_CMP_8(1,v1,0xff, 0x00, 0x0f,0xf0); + // __asm__ volatile ("fence"); +} + +void TEST_CASE2(void) { + VSET(4, e16, m1); + volatile int16_t INP1[] = {0xffff, 0x0000, 0x0f0f, 0xf0f0}; // flush + __asm__ volatile("fence"); + __asm__ volatile("vle16.v v1, (%0)" ::"r"(INP1)); + // VEC_CMP_16(2,v1,0xffff, 0x0000, 0x0f0f,0xf0f0); + // __asm__ volatile ("fence"); +} + +void TEST_CASE3(void) { + VSET(4, e32, m1); + volatile int32_t INP3[] = {0xffffffff, 0x00000000, 0x0f0f0f0f, + 0xf0f0f0f0}; // flush + __asm__ volatile("fence"); + __asm__ volatile("vle32.v v1, (%0)" ::"r"(INP3)); + // VEC_CMP_32(3,v1,0xffffffff, 0x00000000, 0x0f0f0f0f,0xf0f0f0f0); + // __asm__ volatile ("fence"); +} + +void TEST_CASE4(void) { + VSET(4, e64, m1); + volatile int64_t INP1[] = {0xffffffffffffffff, 0x0000000000000000, + 0x0f0f0f0f0f0f0f0f, 0xf0f0f0f0f0f0f0f0}; // flush + __asm__ volatile("fence"); + __asm__ volatile("vle64.v v1, (%0)" ::"r"(INP1)); + // VEC_CMP_64(4,v1,0xffffffffffffffff, 0x00000000000000000, + // 0x0f0f0f0f0f0f0f0f,0xf0f0f0f0f0f0f0f0); + // __asm__ volatile ("fence"); +} + +/* void TEST_CASE2(void) { */ +/* VSET(4,e8,m1); */ +/* volatile int8_t INP2[] = {0xff, 0x00, 0x0f, 0xf0}; */ +/* __asm__ volatile ("fence"); */ +/* VLOAD_8(v0,0x1,0x0,0x1,0x0); */ +/* VCLEAR_U8(v1); */ +/* __asm__ volatile ("vle8.v v1, (%0), v0.t"::"r" (INP2)); */ +/* VEC_CMP_8(2,v1,0xff, 0x00, 0x0f,0x00); */ +/* } */ + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vle1.c b/apps/riscv-tests/isa/rv64uv/vle1.c new file mode 100644 index 0000000..d8659e2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vle1.c @@ -0,0 +1,45 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +static volatile uint8_t ALIGNED_I8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, + 0x88, 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89}; + +// All the accesses are misaligned wrt AXI DATA WIDTH + +void TEST_CASE1(void) { + VSET(9, e8, m1); + asm volatile("vle1.v v1, (%0)" ::"r"(&ALIGNED_I8[1])); + VCMP_U8(1, v1, 0xd3, 0x40); + + VSET(9, e64, m2); + asm volatile("vle1.v v1, (%0)" ::"r"(&ALIGNED_I8[1])); + VCMP_U8(2, v1, 0xd3, 0x40); + + VSET(16, e64, m8); + asm volatile("vle1.v v1, (%0)" ::"r"(&ALIGNED_I8[1])); + VCMP_U8(3, v1, 0xd3, 0x40); + + VSET(17, e64, m8); + asm volatile("vle1.v v1, (%0)" ::"r"(&ALIGNED_I8[1])); + // The vector used by VCMP_U8 is actually 16 elements long + // Don't store more if you don't want to overflow + VSET(16, e64, m8); + VCMP_U8(4, v1, 0xd3, 0x40, 0xd1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vle16.c b/apps/riscv-tests/isa/rv64uv/vle16.c new file mode 100644 index 0000000..b7727a5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vle16.c @@ -0,0 +1,294 @@ +// TODO uncomment TEST_CASE13 and TEST_CASE 15 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved + +#include "long_array.h" +#include "vector_macros.h" + +#define AXI_DWIDTH 128 +// Exception Handler for rtl + +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +static volatile uint16_t ALIGNED_I16[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989}; + +//**********Checking functionality of vle16******// +void TEST_CASE1(void) { + VSET(15, e16, m1); + asm volatile("vle16.v v0, (%0)" ::"r"(&ALIGNED_I16[1])); + VCMP_U16(1, v0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + VSET(15, e32, m4); + asm volatile("vle16.v v1, (%0)" ::"r"(&ALIGNED_I16[1])); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vle16 with different values of masking +// register******// +void TEST_CASE3(void) { + VSET(16, e16, m1); + VCLEAR(v3); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vle16.v v3, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(3, v3, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, + 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, + 0x1989); +} + +void TEST_CASE4(void) { + VSET(16, e16, m1); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vle16.v v3, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(4, v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE5(void) { + VSET(16, e16, m1); + VCLEAR(v3); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vle16.v v3, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(5, v3, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, 0x11ae, 11, + 0x4891, 13, 0x8759, 15, 0x1989); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e16, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle16.v v4, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(6, v4, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, 0x11ae, 11, + 0x4891, 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e16, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vle16.v v4, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(7, v4, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, 0x11ae, 11, + 0x4891, 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e16, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vle16.v v4, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(8, v4, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, 0x11ae, 11, + 0x4891, 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e16, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vle16.v v4, (%0), v0.t" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(9, v4, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, 0x11ae, 11, + 0x4891, 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case cover corner case for EEW = 16.If LMUL is changed to +// mf8 it will give error because emul become less than 1/8 (EMUL = 1/16) +// But it does not support this configuration because SEW/LMUL > ELEN +void TEST_CASE10(void) { + VSET(15, e32, mf2); + asm volatile("vle16.v v5, (%0)" ::"r"(&ALIGNED_I16[1])); + VCMP_U16(10, v5, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); +} + +// This test case execute upper bound case of EMUL (8) +// If LMUL is changed to m8 it will give error because emul become greater than +// 8 (EMUL = 16) + +void TEST_CASE11(void) { + VSET(16, e8, m4); + asm volatile("vle16.v v8, (%0)" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(11, v8, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, + 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, + 0x1989); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE12(void) { + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(16, e16, m1); + asm volatile("vle16.v v6, (%0)" ::"r"(&ALIGNED_I16[0])); + VSET(16, e8, m1); + VCMP_U16(12, v6, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, + 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, + 0x1989); +} + +void TEST_CASE13(void) { + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + __asm__ volatile("vsetivli %[A], 0, e16, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle16.v v6, (%0)" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(13, v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE14(void) { + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(13, e16, m1); + asm volatile("vle16.v v6, (%0)" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(14, v6, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, + 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE15(void) { + VSET(16, e16, m1); + VLOAD_16(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + write_csr(vstart, 2); + asm volatile("vle16.v v7, (%0)" ::"r"(&ALIGNED_I16[0])); + VSET(16, e16, m1); + VCMP_U16(15, v7, 1, 2, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, 0x8188, + 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// +void TEST_CASE16(void) { + VSET(1024, e16, m4); + asm volatile("vle16.v v8, (%0)" ::"r"(&LONG_I16[0])); + LVCMP_U16(16, v8, LONG_I16); +} + +void TEST_CASE17(void) { + VSET(512, e16, m2); + asm volatile("vle16.v v10, (%0)" ::"r"(&LONG_I16[0])); + LVCMP_U16(17, v10, LONG_I16); +} + +void TEST_CASE18(void) { + VSET(300, e16, m2); + asm volatile("vle16.v v12, (%0)" ::"r"(&LONG_I16[0])); + LVCMP_U16(18, v12, LONG_I16); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vle16.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + // TEST_CASE13(); + TEST_CASE14(); + // TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vle32.c b/apps/riscv-tests/isa/rv64uv/vle32.c new file mode 100644 index 0000000..168725b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vle32.c @@ -0,0 +1,311 @@ +// TODO uncomment TEST_CASE13 and TEST_CASE 15 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved + +#include "long_array.h" +#include "vector_macros.h" +#define AXI_DWIDTH 128 +// Exception Handler for rtl + +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +static volatile uint32_t ALIGNED_I32[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, 0xab8b9148, + 0x90318509, 0x31897598, 0x83195999, 0x89139848}; + +//**********Checking functionality of vle32********// +void TEST_CASE1(void) { + VSET(15, e32, m1); + asm volatile("vle32.v v0, (%0)" ::"r"(&ALIGNED_I32[1])); + VCMP_U32(1, v0, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, + 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, 0x89139848); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + VSET(15, e64, m4); + asm volatile("vle32.v v1, (%0)" ::"r"(&ALIGNED_I32[1])); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vle32 with different values of masking +// register******// +void TEST_CASE3(void) { + VSET(16, e32, m1); + VCLEAR(v3); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vle32.v v3, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(3, v3, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); +} + +void TEST_CASE4(void) { + VSET(16, e32, m1); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vle32.v v3, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(4, v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE5(void) { + VSET(16, e32, m1); + VCLEAR(v3); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vle32.v v3, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(5, v3, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, 0x81937598, 9, + 0x3eeeeeee, 11, 0xab8b9148, 13, 0x31897598, 15, 0x89139848); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e32, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle32.v v4, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VSET(16, e32, m1); + VCMP_U32(6, v4, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, 0x81937598, 9, + 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e32, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vle32.v v4, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VSET(16, e32, m1); + VCMP_U32(7, v4, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, 0x81937598, 9, + 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e32, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vle32.v v4, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VSET(16, e32, m1); + VCMP_U32(8, v4, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, 0x81937598, 9, + 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e32, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vle32.v v4, (%0), v0.t" ::"r"(&ALIGNED_I32[0])); + VSET(16, e32, m1); + VCMP_U32(9, v4, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, 0x81937598, 9, + 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case cover corner case for EEW = 32.If LMUL is changed to +// mf8 and SEW is changed to e64 it will give error because emul become less +// than 1/8 (EMUL = 1/16) But it does not support this configuration because +// SEW/LMUL > ELEN +void TEST_CASE10(void) { + VSET(15, e32, mf2); + asm volatile("vle32.v v5, (%0)" ::"r"(&ALIGNED_I32[1])); + VCMP_U32(10, v5, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, + 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, 0x89139848); +} + +// This test case execute upper bound case of EMUL (8) +// If LMUL is changed to m8 or m4 it will give error because emul become greater +// than +// 8 +// (EMUL = 16) + +void TEST_CASE11(void) { + VSET(16, e8, m2); + asm volatile("vle32.v v8, (%0)" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(11, v8, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE12(void) { + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(16, e32, m1); + asm volatile("vle32.v v6, (%0)" ::"r"(&ALIGNED_I32[0])); + VSET(16, e32, m1); + VCMP_U32(12, v6, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); +} + +void TEST_CASE13(void) { + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + __asm__ volatile("vsetivli %[A], 0, e16, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle32.v v6, (%0)" ::"r"(&ALIGNED_I32[0])); + VSET(16, e32, m1); + VCMP_U32(13, v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE14(void) { + VSET(16, e16, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(13, e16, m1); + asm volatile("vle32.v v6, (%0)" ::"r"(&ALIGNED_I32[0])); + VSET(16, e16, m1); + VCMP_U32(14, v6, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE15(void) { + VSET(16, e32, m1); + VLOAD_32(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + write_csr(vstart, 2); + asm volatile("vle32.v v7, (%0)" ::"r"(&ALIGNED_I32[0])); + VSET(15, e32, m1); + VCMP_U32(16, v7, 1, 2, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, + 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, 0x89139848); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// + +void TEST_CASE16(void) { + VSET(1024, e32, m8); + asm volatile("vle32.v v8, (%0)" ::"r"(&LONG_I32[0])); + LVCMP_U32(16, v8, LONG_I32); +} + +void TEST_CASE17(void) { + VSET(512, e32, m4); + asm volatile("vle32.v v12, (%0)" ::"r"(&LONG_I32[0])); + LVCMP_U32(17, v12, LONG_I32); +} + +void TEST_CASE18(void) { + VSET(256, e32, m2); + asm volatile("vle32.v v14, (%0)" ::"r"(&LONG_I32[0])); + LVCMP_U32(18, v14, LONG_I32); +} + +void TEST_CASE19(void) { + VSET(200, e32, m2); + asm volatile("vle32.v v16, (%0)" ::"r"(&LONG_I32[0])); + LVCMP_U32(19, v16, LONG_I32); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vle32.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + // TEST_CASE13(); + TEST_CASE14(); + // TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + TEST_CASE19(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vle64.c b/apps/riscv-tests/isa/rv64uv/vle64.c new file mode 100644 index 0000000..13c69cd --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vle64.c @@ -0,0 +1,315 @@ +// TODO uncomment TEST_CASE12 and TEST_CASE 14 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved + +#include "long_array.h" +#include "vector_macros.h" + +#define AXI_DWIDTH 128 +// Exception Handler for rtl + +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +static volatile uint64_t ALIGNED_I64[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989}; + +//**********Checking functionality of vle64********// +void TEST_CASE1(void) { + VSET(15, e64, m1); + asm volatile("vle64.v v0, (%0)" ::"r"(&ALIGNED_I64[1])); + VCMP_U64(1, v0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x1893179501093489, + 0x81937598aa819388, 0x1874754791888188, 0x3eeeeeeee33111ae, + 0x9013930148815808, 0xab8b914891484891, 0x9031850931584902, + 0x3189759837598759, 0x8319599991911111, 0x8913984898951989); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + VSET(15, e64, m2); + asm volatile("vle64.v v1, (%0)" ::"r"(&ALIGNED_I64[1])); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vle64 with different values of masking +// register******// +void TEST_CASE3(void) { + VSET(16, e64, m1); + VCLEAR(v3); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vle64.v v3, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(3, v3, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); +} + +void TEST_CASE4(void) { + VSET(16, e64, m1); + VCLEAR(v3); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vle64.v v3, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(4, v3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +} + +void TEST_CASE5(void) { + VSET(16, e64, m1); + VCLEAR(v3); + VLOAD_64(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vle64.v v3, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(5, v3, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, 11, + 0xab8b914891484891, 13, 0x3189759837598759, 15, 0x8913984898951989); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e64, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle64.v v4, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(6, v4, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, 11, + 0xab8b914891484891, 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e64, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vle64.v v4, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(7, v4, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, 11, + 0xab8b914891484891, 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e64, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vle64.v v4, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(8, v4, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, 11, + 0xab8b914891484891, 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e64, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vle64.v v4, (%0), v0.t" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(9, v4, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, 11, + 0xab8b914891484891, 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case cover upper bound of EMUL(8). If LMUL is changed to +// m2 it will give error because emul become greater than 8 (EMUL = 16) +void TEST_CASE10(void) { + VSET(15, e8, m1); + asm volatile("vle64.v v8, (%0)" ::"r"(&ALIGNED_I64[1])); + VCMP_U64(10, v8, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x1893179501093489, + 0x81937598aa819388, 0x1874754791888188, 0x3eeeeeeee33111ae, + 0x9013930148815808, 0xab8b914891484891, 0x9031850931584902, + 0x3189759837598759, 0x8319599991911111, 0x8913984898951989); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE11(void) { + VSET(16, e64, m1); + VLOAD_64(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(16, e64, m1); + asm volatile("vle64.v v6, (%0)" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(11, v6, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); +} + +void TEST_CASE12(void) { + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + __asm__ volatile("vsetivli %[A], 0, e64, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle64.v v6, (%0)" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(12, v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE13(void) { + VSET(16, e64, m1); + VLOAD_64(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(13, e64, m1); + asm volatile("vle64.v v6, (%0)" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(13, v6, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE14(void) { + VSET(16, e64, m1); + VLOAD_64(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + write_csr(vstart, 2); + asm volatile("vle64.v v7, (%0)" ::"r"(&ALIGNED_I64[0])); + VSET(16, e64, m1); + VCMP_U64(14, v7, 1, 2, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x1893179501093489, + 0x81937598aa819388, 0x1874754791888188, 0x3eeeeeeee33111ae, + 0x9013930148815808, 0xab8b914891484891, 0x9031850931584902, + 0x3189759837598759, 0x8319599991911111, 0x8913984898951989); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// +void TEST_CASE15(void) { + VSET(512, e64, m8); + asm volatile("vle64.v v8, (%0)" ::"r"(&LONG_I64[0])); + LVCMP_U64(15, v8, LONG_I64); +} + +void TEST_CASE16(void) { + VSET(256, e64, m4); + asm volatile("vle64.v v12, (%0)" ::"r"(&LONG_I64[0])); + LVCMP_U64(16, v12, LONG_I64); +} + +void TEST_CASE17(void) { + VSET(128, e64, m2); + asm volatile("vle64.v v10, (%0)" ::"r"(&LONG_I64[0])); + LVCMP_U64(17, v10, LONG_I64); +} + +void TEST_CASE18(void) { + VSET(100, e64, m2); + asm volatile("vle64.v v14, (%0)" ::"r"(&LONG_I64[0])); + LVCMP_U64(18, v14, LONG_I64); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vle64.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + // TEST_CASE12(); + TEST_CASE13(); + // TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vle8.c b/apps/riscv-tests/isa/rv64uv/vle8.c new file mode 100644 index 0000000..afb62fb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vle8.c @@ -0,0 +1,274 @@ +// TODO uncomment TEST_CASE12 and TEST_CASE 14 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved + +#include "long_array.h" +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +// Exception Handler for rtl + +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +static volatile uint8_t ALIGNED_I8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, + 0x88, 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89}; + +//**********Checking functionality of vle8 ********// +void TEST_CASE1(void) { + VSET(15, e8, m1); + asm volatile("vle8.v v0, (%0)" ::"r"(&ALIGNED_I8[1])); + VCMP_U8(1, v0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + VSET(15, e16, m4); + asm volatile("vle8.v v1, (%0)" ::"r"(&ALIGNED_I8[1])); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vle8 with different values of masking +// register******// +void TEST_CASE3(void) { + VSET(16, e8, m1); + VCLEAR(v3); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vle8.v v3, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(3, v3, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, + 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vle8.v v3, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(4, v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VCLEAR(v3); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vle8.v v3, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(5, v3, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, 13, + 0x59, 15, 0x89); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e8, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vle8.v v4, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(6, v4, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, 13, 14, + 15, 16); +} + +void TEST_CASE7(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e8, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vle8.v v4, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(7, v4, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, 13, 14, + 15, 16); +} + +void TEST_CASE8(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e8, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vle8.v v4, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(8, v4, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, 13, 14, + 15, 16); +} + +void TEST_CASE9(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v0, 0xAA, 0xAA); + __asm__ volatile("vsetivli %[A], 12, e8, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vle8.v v4, (%0), v0.t" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(9, v4, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, 13, 14, + 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case execute lower bound case of EMUL (1/8). If LMUL is changed to +// mf4 or mf8 it will give error because emul become out of range +void TEST_CASE10(void) { + VSET(15, e32, mf2); + asm volatile("vle8.v v5, (%0)" ::"r"(&ALIGNED_I8[1])); + VCMP_U8(10, v5, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE11(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(16, e8, m1); // Setting vl=16 + asm volatile("vle8.v v6, (%0)" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(11, v6, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, + 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +void TEST_CASE12(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + __asm__ volatile("vsetivli %[A], 0, e8, m1, ta, ma" + : [A] "=r"(avl)); // Setting vl=0 + asm volatile("vle8.v v6, (%0)" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(12, v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +void TEST_CASE13(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VSET(13, e8, m1); // Setting vl =13 + asm volatile("vle8.v v6, (%0)" ::"r"(&ALIGNED_I8[0])); + VSET(16, e8, m1); + VCMP_U8(13, v6, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, + 0x08, 0x91, 0x02, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE14(void) { + uint64_t vstart; + VSET(16, e8, m1); + VLOAD_8(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + write_csr(vstart, 2); + asm volatile("vle8.v v7, (%0)" ::"r"(&ALIGNED_I8[0])); + write_csr(vstart, 0); + VSET(16, e8, m1); + VCMP_U8(14, v7, 1, 2, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// +void TEST_CASE15(void) { + VSET(1024, e8, m2); + asm volatile("vle8.v v8, (%0)" ::"r"(&LONG_I8[0])); + LVCMP_U8(15, v8, LONG_I8); +} + +void TEST_CASE16(void) { + VSET(800, e8, m2); + asm volatile("vle8.v v8, (%0)" ::"r"(&LONG_I8[0])); + LVCMP_U8(16, v8, LONG_I8); +} +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vle8.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + // TEST_CASE12(); + TEST_CASE13(); + // TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vle_vse_hazards.c b/apps/riscv-tests/isa/rv64uv/vle_vse_hazards.c new file mode 100644 index 0000000..3b1b6ce --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vle_vse_hazards.c @@ -0,0 +1,222 @@ +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +#define INIT 98 + +void reset_vec8(volatile uint8_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +void reset_vec16(volatile uint16_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +void reset_vec32(volatile uint32_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +void reset_vec64(volatile uint64_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} + +static volatile uint8_t TEST_I8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; +static volatile uint16_t TEST_I16[16] __attribute__((aligned(AXI_DWIDTH))) = { + 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32}; +static volatile uint32_t TEST_I32[16] __attribute__((aligned(AXI_DWIDTH))) = { + 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64}; +static volatile uint64_t TEST_I64[16] __attribute__((aligned(AXI_DWIDTH))) = { + 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128}; + +static volatile uint8_t ALIGNED_I8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, + 0x88, 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89}; +static volatile uint16_t ALIGNED_I16[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989}; +static volatile uint32_t ALIGNED_I32[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, 0xab8b9148, + 0x90318509, 0x31897598, 0x83195999, 0x89139848}; +static volatile uint64_t ALIGNED_I64[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989}; + +static volatile uint8_t BUFFER_O8[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; +static volatile uint16_t BUFFER_O16[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; +static volatile uint32_t BUFFER_O32[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; +static volatile uint64_t BUFFER_O64[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; + +//****** RAW Hazard****// +void TEST_CASE1(void) { + VSET(16, e8, m1); + asm volatile("vle8.v v1, (%0)" ::"r"(&ALIGNED_I8[0])); + asm volatile("vse8.v v1, (%0)" ::"r"(&BUFFER_O8[0])); + VVCMP_U8(1, BUFFER_O8, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, + 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//******WAR Hazard****// +void TEST_CASE2(void) { + reset_vec8(&BUFFER_O8[0], INIT, 16); + VSET(16, e8, m1); + VLOAD_8(v2, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + asm volatile("vse8.v v2, (%0)" ::"r"(&BUFFER_O8[0])); + asm volatile("vle8.v v2, (%0)" ::"r"(&BUFFER_O8[0])); + VCMP_U8(2, v2, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, + 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//******WAW Hazard****// +void TEST_CASE3(void) { + VSET(16, e8, m1); + asm volatile("vle8.v v3, (%0)" ::"r"(&ALIGNED_I8[0])); + asm volatile("vle8.v v3, (%0)" ::"r"(&TEST_I8[0])); + VCMP_U8(3, v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +} + +//****** RAW Hazard****// +void TEST_CASE4(void) { + VSET(16, e16, m1); + asm volatile("vle16.v v4, (%0)" ::"r"(&ALIGNED_I16[0])); + asm volatile("vse16.v v4, (%0)" ::"r"(&BUFFER_O16[0])); + VVCMP_U16(4, BUFFER_O16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, + 0x1111, 0x1989); +} + +//******WAR Hazard****// +void TEST_CASE5(void) { + reset_vec16(&BUFFER_O16[0], INIT, 16); + VSET(16, e16, m1); + VLOAD_16(v5, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + asm volatile("vse16.v v5, (%0)" ::"r"(&BUFFER_O16[0])); + asm volatile("vle16.v v5, (%0)" ::"r"(&BUFFER_O16[0])); + VCMP_U16(5, v5, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, + 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, + 0x1989); +} + +//******WAW Hazard****// +void TEST_CASE6(void) { + VSET(16, e16, m1); + asm volatile("vle16.v v6, (%0)" ::"r"(&ALIGNED_I16[0])); + asm volatile("vle16.v v6, (%0)" ::"r"(&TEST_I16[0])); + VCMP_U16(6, v6, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32); +} + +//****** RAW Hazard****// +void TEST_CASE7(void) { + VSET(16, e32, m1); + asm volatile("vle32.v v7, (%0)" ::"r"(&ALIGNED_I32[0])); + asm volatile("vse32.v v7, (%0)" ::"r"(&BUFFER_O32[0])); + VVCMP_U32(7, BUFFER_O32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, + 0x83195999, 0x89139848); +} + +//******WAR Hazard****// +void TEST_CASE8(void) { + reset_vec32(&BUFFER_O32[0], INIT, 16); + VSET(16, e32, m1); + VLOAD_32(v8, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + asm volatile("vse32.v v8, (%0)" ::"r"(&BUFFER_O32[0])); + asm volatile("vle32.v v8, (%0)" ::"r"(&BUFFER_O32[0])); + VCMP_U32(8, v8, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); +} + +//******WAW Hazard****// +void TEST_CASE9(void) { + VSET(16, e32, m1); + asm volatile("vle32.v v9, (%0)" ::"r"(&ALIGNED_I32[0])); + asm volatile("vle32.v v9, (%0)" ::"r"(&TEST_I32[0])); + VCMP_U32(9, v9, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64); +} + +//****** RAW Hazard****// +void TEST_CASE10(void) { + VSET(16, e64, m1); + asm volatile("vle64.v v10, (%0)" ::"r"(&ALIGNED_I64[0])); + asm volatile("vse64.v v10, (%0)" ::"r"(&BUFFER_O64[0])); + VVCMP_U64(10, BUFFER_O64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x3819759853987548, 0x1893179501093489, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0x9013930148815808, + 0xab8b914891484891, 0x9031850931584902, 0x3189759837598759, + 0x8319599991911111, 0x8913984898951989); +} + +//******WAR Hazard****// +void TEST_CASE11(void) { + reset_vec64(&BUFFER_O64[0], INIT, 16); + VSET(16, e64, m1); + VLOAD_64(v11, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + asm volatile("vse64.v v11, (%0)" ::"r"(&BUFFER_O64[0])); + asm volatile("vle64.v v5, (%0)" ::"r"(&BUFFER_O64[0])); + VCMP_U64(11, v11, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); +} + +//******WAW Hazard****// +void TEST_CASE12(void) { + VSET(16, e64, m1); + asm volatile("vle64.v v12, (%0)" ::"r"(&ALIGNED_I64[0])); + asm volatile("vle64.v v12, (%0)" ::"r"(&TEST_I64[0])); + VCMP_U64(12, v12, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, + 120, 128); +} +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests of vle-vse for data hazards*****\n"); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vlff.c b/apps/riscv-tests/isa/rv64uv/vlff.c new file mode 100644 index 0000000..886e36b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vlff.c @@ -0,0 +1,91 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e8, m1); + volatile int8_t INP[] = {0xff, 0x00, 0x0f, 0xf0}; + asm volatile("vle8ff.v v1, (%0)" ::"r"(INP)); + VCMP_U8(1, v1, 0xff, 0x00, 0x0f, 0xf0); +} + +void TEST_CASE2(void) { + VSET(4, e8, m1); + volatile int8_t INP[] = {0xff, 0x00, 0x0f, 0xf0}; + VLOAD_8(v0, 0x5, 0x0, 0x0, 0x0); + VCLEAR(v1); + asm volatile("vle8ff.v v1, (%0), v0.t" ::"r"(INP)); + VCMP_U8(2, v1, 0xff, 0x00, 0x0f, 0x00); +} + +void TEST_CASE3(void) { + VSET(3, e16, m1); + volatile int16_t INP[] = {0xffff, 0x0000, 0x0f0f, 0xf0f0}; + asm volatile("vle16ff.v v1, (%0)" ::"r"(INP)); + VCMP_U16(3, v1, 0xffff, 0x0000, 0x0f0f); +} + +void TEST_CASE4(void) { + VSET(3, e16, m1); + volatile int16_t INP[] = {0xffff, 0x0001, 0x0f0f, 0xf0f0}; + VLOAD_16(v0, 0x5, 0x0, 0x0, 0x0); + VCLEAR(v1); + asm volatile("vle16ff.v v1, (%0), v0.t" ::"r"(INP)); + VCMP_U16(4, v1, 0xffff, 0x0000, 0x0f0f); +} + +void TEST_CASE5(void) { + VSET(4, e32, m1); + volatile int32_t INP[] = {0xffffffff, 0x00000000, 0x0f0f0f0f, 0xf0f0f0f0}; + asm volatile("vle32ff.v v1, (%0)" ::"r"(INP)); + VCMP_U32(5, v1, 0xffffffff, 0x00000000, 0x0f0f0f0f, 0xf0f0f0f0); +} + +void TEST_CASE6(void) { + VSET(4, e32, m1); + volatile int32_t INP[] = {0xffffffff, 0x80000000, 0x0f0f0f0f, 0xf0f0f0f0}; + VLOAD_32(v0, 0x5, 0x0, 0x0, 0x0); + VCLEAR(v1); + asm volatile(" vle32ff.v v1, (%0), v0.t \n" ::"r"(INP)); + VCMP_U32(6, v1, 0xffffffff, 0x0, 0x0f0f0f0f, 0x0); +} + +void TEST_CASE7(void) { + VSET(4, e64, m1); + volatile int64_t INP[] = {0xdeadbeefffffffff, 0xdeadbeef00000000, + 0xdeadbeef0f0f0f0f, 0xdeadbeeff0f0f0f0}; + asm volatile("vle64ff.v v1,(%0)" ::"r"(INP)); + VCMP_U64(7, v1, 0xdeadbeefffffffff, 0xdeadbeef00000000, 0xdeadbeef0f0f0f0f, + 0xdeadbeeff0f0f0f0); +} + +void TEST_CASE8(void) { + VSET(4, e64, m1); + volatile int64_t INP[] = {0xdeadbeefffffffff, 0xdeadbeef00000000, + 0xdeadbeef0f0f0f0f, 0xdeadbeeff0f0f0f0}; + VLOAD_64(v0, 0x5, 0x0, 0x0, 0x0); + VCLEAR(v1); + asm volatile("vle64ff.v v1,(%0), v0.t" ::"r"(INP)); + VCMP_U64(8, v1, 0xdeadbeefffffffff, 0x0000000000000000, 0xdeadbeef0f0f0f0f, + 0x0000000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vls.c b/apps/riscv-tests/isa/rv64uv/vls.c new file mode 100644 index 0000000..0248384 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vls.c @@ -0,0 +1,190 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Positive-stride tests +void TEST_CASE1(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + uint64_t stride = 3; + asm volatile("vlse8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(1, v1, 0x9f, 0x20, 0x05, 0xaa); +} + +void TEST_CASE2(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, + 0xf9aa, 0x71f0, 0xc394, 0xbbd3}; + uint64_t stride = 4; + asm volatile("vlse16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(2, v1, 0x9fe4, 0x8f2e, 0xf9aa, 0xc394); +} + +void TEST_CASE3(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0xa11a9384, 0xa7163840, 0x99991348, 0xa9f38cd1}; + uint64_t stride = 8; + asm volatile("vlse32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(3, v1, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348); +} + +void TEST_CASE4(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = {0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1}; + uint64_t stride = 8; + asm volatile("vlse64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(4, v1, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1); +} + +// Zero-stride tests +// The implementation must perform all the memory accesses +void TEST_CASE5(void) { + VSET(16, e8, m1); + volatile uint8_t INP1[] = {0x9f}; + uint64_t stride = 0; + asm volatile("vlse8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(5, v1, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f); +} + +// The implementation can also perform fewer accesses +void TEST_CASE6(void) { + VSET(16, e8, m1); + volatile uint8_t INP1[] = {0x9f}; + asm volatile("vlse8.v v1, (%0), x0" ::"r"(INP1)); + VCMP_U8(6, v1, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f); +} + +// Different LMUL +void TEST_CASE7(void) { + VSET(8, e64, m2); + volatile uint64_t INP1[] = {0x9fa831c7a11a9384}; + asm volatile("vlse64.v v2, (%0), x0" ::"r"(INP1)); + VCMP_U64(7, v2, 0x9fa831c7a11a9384, 0x9fa831c7a11a9384, 0x9fa831c7a11a9384, + 0x9fa831c7a11a9384, 0x9fa831c7a11a9384, 0x9fa831c7a11a9384, + 0x9fa831c7a11a9384, 0x9fa831c7a11a9384); +} + +// Others +// Negative-stride test +void TEST_CASE8(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, + 0xf9aa, 0x71f0, 0xc394, 0xbbd3}; + uint64_t stride = -4; + asm volatile("vlse16.v v1, (%0), %1" ::"r"(&INP1[7]), "r"(stride)); + VCMP_U16(8, v1, 0xbbd3, 0x71f0, 0x05e0, 0x1920); +} + +// Stride greater than default Ara AXI width == 128-bit (4 lanes) +void TEST_CASE9(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = {0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x9fa831c7a11a9384, 0x9fa831c7a11a9384, + 0x9fa831c7a11a9384, 0x01015ac1309bb678}; + uint64_t stride = 40; + asm volatile("vlse64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(9, v1, 0x99991348a9f38cd1, 0x01015ac1309bb678); +} + +// Fill Ara internal Load Buffer +void TEST_CASE10(void) { + VSET(8, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989}; + uint64_t stride = 16; + asm volatile("vlse64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(10, v1, 0x9fe419208f2e05e0, 0xa11a9384a7163840, 0x9fa831c7a11a9384, + 0x1893179501093489, 0x1874754791888188, 0x9013930148815808, + 0x9031850931584902, 0x8319599991911111); +} + +// Masked stride loads +void TEST_CASE11(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + uint64_t stride = 3; + VLOAD_8(v0, 0xAA); + VCLEAR(v1); + asm volatile("vlse8.v v1, (%0), %1, v0.t" ::"r"(INP1), "r"(stride)); + VCMP_U8(11, v1, 0x00, 0x20, 0x00, 0xaa); +} + +void TEST_CASE12(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, + 0xf9aa, 0x71f0, 0xc394, 0xbbd3}; + uint64_t stride = 4; + VLOAD_8(v0, 0xAA); + VCLEAR(v1); + asm volatile("vlse16.v v1, (%0), %1, v0.t" ::"r"(INP1), "r"(stride)); + VCMP_U16(12, v1, 0, 0x8f2e, 0, 0xc394); +} + +void TEST_CASE13(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0xa11a9384, 0xa7163840, 0x99991348, 0xa9f38cd1}; + uint64_t stride = 8; + VLOAD_8(v0, 0xAA); + VCLEAR(v1); + asm volatile("vlse32.v v1, (%0), %1, v0.t" ::"r"(INP1), "r"(stride)); + VCMP_U32(13, v1, 0, 0xf9aa71f0, 0, 0x99991348); +} + +void TEST_CASE14(void) { + VSET(8, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989}; + uint64_t stride = 16; + VLOAD_8(v0, 0xAA); + VCLEAR(v1); + asm volatile("vlse64.v v1, (%0), %1, v0.t" ::"r"(INP1), "r"(stride)); + VCMP_U64(14, v1, 0, 0xa11a9384a7163840, 0, 0x1893179501093489, 0, + 0x9013930148815808, 0, 0x8319599991911111); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + + TEST_CASE11(); + TEST_CASE12(); + TEST_CASE13(); + TEST_CASE14(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vlseg.c b/apps/riscv-tests/isa/rv64uv/vlseg.c new file mode 100644 index 0000000..6bd4678 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vlseg.c @@ -0,0 +1,391 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Segment-2 +void TEST_CASE1_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e8.v v1, (%0)" ::"r"(INP1)); + VCMP_U8(1, v1, 0x9f, 0x19, 0x8f, 0x05); + VCMP_U8(2, v2, 0xe4, 0x20, 0x2e, 0xe0); +} + +// Segment-3 +void TEST_CASE2_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e8.v v1, (%0)" ::"r"(INP1)); + VCMP_U8(3, v1, 0x9f, 0x20, 0x05, 0xaa); + VCMP_U8(4, v2, 0xe4, 0x8f, 0xe0, 0x71); + VCMP_U8(5, v3, 0x19, 0x2e, 0xf9, 0xf0); +} + +// Segment-4 +void TEST_CASE3_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e8.v v1, (%0)" ::"r"(INP1)); + VCMP_U8(6, v1, 0x9f, 0x8f, 0xf9, 0xc3); + VCMP_U8(7, v2, 0xe4, 0x2e, 0xaa, 0x94); + VCMP_U8(8, v3, 0x19, 0x05, 0x71, 0xbb); + VCMP_U8(9, v4, 0x20, 0xe0, 0xf0, 0xd3); +} + +// Segment-8 +void TEST_CASE4_8(void) { + VSET(2, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e8.v v1, (%0)" ::"r"(INP1)); + VCMP_U8(10, v1, 0x9f, 0xf9); + VCMP_U8(11, v2, 0xe4, 0xaa); + VCMP_U8(12, v3, 0x19, 0x71); + VCMP_U8(13, v4, 0x20, 0xf0); + VCMP_U8(14, v5, 0x8f, 0xc3); + VCMP_U8(15, v6, 0x2e, 0x94); + VCMP_U8(16, v7, 0x05, 0xbb); + VCMP_U8(17, v8, 0xe0, 0xd3); +} + +// Segment-2 for 16-bit +void TEST_CASE1_16(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e16.v v1, (%0)" ::"r"(INP1)); + VCMP_U16(18, v1, 0x9fe4, 0x8f2e, 0xf9aa, 0xc394); + VCMP_U16(19, v2, 0x1920, 0x05e0, 0x71f0, 0xbbd3); +} + +// Segment-3 for 16-bit +void TEST_CASE2_16(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e16.v v1, (%0)" ::"r"(INP1)); + VCMP_U16(20, v1, 0x9fe4, 0x05e0, 0xc394, 0x5678); + VCMP_U16(21, v2, 0x1920, 0xf9aa, 0xbbd3, 0x9abc); + VCMP_U16(22, v3, 0x8f2e, 0x71f0, 0x1234, 0xdef0); +} + +// Segment-4 for 16-bit +void TEST_CASE3_16(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e16.v v1, (%0)" ::"r"(INP1)); + VCMP_U16(23, v1, 0x9fe4, 0xf9aa, 0x1234, 0x1357); + VCMP_U16(24, v2, 0x1920, 0x71f0, 0x5678, 0x2468); + VCMP_U16(25, v3, 0x8f2e, 0xc394, 0x9abc, 0x369b); + VCMP_U16(26, v4, 0x05e0, 0xbbd3, 0xdef0, 0x48ac); +} + +// Segment-8 for 16-bit +void TEST_CASE4_16(void) { + VSET(2, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e16.v v1, (%0)" ::"r"(INP1)); + VCMP_U16(27, v1, 0x9fe4, 0x1234); + VCMP_U16(28, v2, 0x1920, 0x5678); + VCMP_U16(29, v3, 0x8f2e, 0x9abc); + VCMP_U16(30, v4, 0x05e0, 0xdef0); + VCMP_U16(31, v5, 0xf9aa, 0x1357); + VCMP_U16(32, v6, 0x71f0, 0x2468); + VCMP_U16(33, v7, 0xc394, 0x369b); + VCMP_U16(34, v8, 0xbbd3, 0x48ac); +} + +// Segment-2 for 32-bit +void TEST_CASE1_32(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e32.v v1, (%0)" ::"r"(INP1)); + VCMP_U32(35, v1, 0x9fe41920, 0xf9aa71f0, 0x12345678, 0x13572468); + VCMP_U32(36, v2, 0x8f2e05e0, 0xc394bbd3, 0x9abcdef0, 0x369b48ac); +} + +// Segment-3 for 32-bit +void TEST_CASE2_32(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e32.v v1, (%0)" ::"r"(INP1)); + VCMP_U32(37, v1, 0x9fe41920, 0xc394bbd3, 0x13572468, 0xcafebabe); + VCMP_U32(38, v2, 0x8f2e05e0, 0x12345678, 0x369b48ac, 0x01234567); + VCMP_U32(39, v3, 0xf9aa71f0, 0x9abcdef0, 0xdeadbeef, 0x89abcdef); +} + +// Segment-4 for 32-bit +void TEST_CASE3_32(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e32.v v1, (%0)" ::"r"(INP1)); + VCMP_U32(40, v1, 0x9fe41920, 0x12345678, 0xdeadbeef, 0x55aa55aa); + VCMP_U32(41, v2, 0x8f2e05e0, 0x9abcdef0, 0xcafebabe, 0x77889900); + VCMP_U32(42, v3, 0xf9aa71f0, 0x13572468, 0x01234567, 0xabcdef12); + VCMP_U32(43, v4, 0xc394bbd3, 0x369b48ac, 0x89abcdef, 0x34567890); +} + +// Segment-8 for 32-bit +void TEST_CASE4_32(void) { + VSET(2, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e32.v v1, (%0)" ::"r"(INP1)); + VCMP_U32(44, v1, 0x9fe41920, 0xdeadbeef); + VCMP_U32(45, v2, 0x8f2e05e0, 0xcafebabe); + VCMP_U32(46, v3, 0xf9aa71f0, 0x01234567); + VCMP_U32(47, v4, 0xc394bbd3, 0x89abcdef); + VCMP_U32(48, v5, 0x12345678, 0x55aa55aa); + VCMP_U32(49, v6, 0x9abcdef0, 0x77889900); + VCMP_U32(50, v7, 0x13572468, 0xabcdef12); + VCMP_U32(51, v8, 0x369b48ac, 0x34567890); +} + +// Segment-2 for 64-bit +void TEST_CASE1_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e64.v v1, (%0)" ::"r"(INP1)); + VCMP_U64(52, v1, 0x9fe419208f2e05e0, 0x123456789abcdef0, 0xdeadbeefcafebabe, + 0x55aa55aa77889900); + VCMP_U64(53, v2, 0xf9aa71f0c394bbd3, 0x13572468369b48ac, 0x0123456789abcdef, + 0xabcdef1234567890); +} + +// Segment-3 for 64-bit +void TEST_CASE2_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e64.v v1, (%0)" ::"r"(INP1)); + VCMP_U64(54, v1, 0x9fe419208f2e05e0, 0x13572468369b48ac, 0x55aa55aa77889900, + 0x123456789abcdef0); + VCMP_U64(55, v2, 0xf9aa71f0c394bbd3, 0xdeadbeefcafebabe, 0xabcdef1234567890, + 0x1357246855aa55aa); + VCMP_U64(56, v3, 0x123456789abcdef0, 0x0123456789abcdef, 0xfeedfacecafebabe, + 0x369b48acdeadbeef); +} + +// Segment-4 for 64-bit +void TEST_CASE3_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e64.v v1, (%0)" ::"r"(INP1)); + VCMP_U64(57, v1, 0x9fe419208f2e05e0, 0xdeadbeefcafebabe, 0xfeedfacecafebabe, + 0xcafebabe12345678); + VCMP_U64(58, v2, 0xf9aa71f0c394bbd3, 0x0123456789abcdef, 0x123456789abcdef0, + 0xabcdef0987654321); + VCMP_U64(59, v3, 0x123456789abcdef0, 0x55aa55aa77889900, 0x1357246855aa55aa, + 0x012345670abcdef1); + VCMP_U64(60, v4, 0x13572468369b48ac, 0xabcdef1234567890, 0x369b48acdeadbeef, + 0x987654321fedcba0); +} + +// Segment-8 for 64-bit +void TEST_CASE4_64(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e64.v v1, (%0)" ::"r"(INP1)); + VCMP_U64(61, v1, 0x9fe419208f2e05e0, 0xfeedfacecafebabe); + VCMP_U64(62, v2, 0xf9aa71f0c394bbd3, 0x123456789abcdef0); + VCMP_U64(63, v3, 0x123456789abcdef0, 0x1357246855aa55aa); + VCMP_U64(64, v4, 0x13572468369b48ac, 0x369b48acdeadbeef); + VCMP_U64(65, v5, 0xdeadbeefcafebabe, 0xcafebabe12345678); + VCMP_U64(66, v6, 0x0123456789abcdef, 0xabcdef0987654321); + VCMP_U64(67, v7, 0x55aa55aa77889900, 0x012345670abcdef1); + VCMP_U64(68, v8, 0xabcdef1234567890, 0x987654321fedcba0); +} + +// Segment-8 for 64-bit +void TEST_CASE4_64_m(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vlseg8e64.v v1, (%0), v0.t" ::"r"(INP1)); + VCMP_U64(69, v1, 0, 0xfeedfacecafebabe); + VCMP_U64(70, v2, 0, 0x123456789abcdef0); + VCMP_U64(71, v3, 0, 0x1357246855aa55aa); + VCMP_U64(72, v4, 0, 0x369b48acdeadbeef); + VCMP_U64(73, v5, 0, 0xcafebabe12345678); + VCMP_U64(74, v6, 0, 0xabcdef0987654321); + VCMP_U64(75, v7, 0, 0x012345670abcdef1); + VCMP_U64(76, v8, 0, 0x987654321fedcba0); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xA8, 0xAA); + asm volatile("vlseg8e64.v v1, (%0), v0.t" ::"r"(INP1)); + VCMP_U64(77, v1, 0, 0); + VCMP_U64(78, v2, 0, 0); + VCMP_U64(79, v3, 0, 0); + VCMP_U64(80, v4, 0, 0); + VCMP_U64(81, v5, 0, 0); + VCMP_U64(82, v6, 0, 0); + VCMP_U64(83, v7, 0, 0); + VCMP_U64(84, v8, 0, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1_8(); + TEST_CASE2_8(); + TEST_CASE3_8(); + TEST_CASE4_8(); + + TEST_CASE1_16(); + TEST_CASE2_16(); + TEST_CASE3_16(); + TEST_CASE4_16(); + + TEST_CASE1_32(); + TEST_CASE2_32(); + TEST_CASE3_32(); + TEST_CASE4_32(); + + TEST_CASE1_64(); + TEST_CASE2_64(); + TEST_CASE3_64(); + TEST_CASE4_64(); + + // Masked + TEST_CASE4_64_m(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vlsseg.c b/apps/riscv-tests/isa/rv64uv/vlsseg.c new file mode 100644 index 0000000..c6d7a70 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vlsseg.c @@ -0,0 +1,1678 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +int stride; + +// Segment-2 +void TEST_CASE1_8(void) { + + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + VCLEAR(v1); + VCLEAR(v2); + stride = 0; + VSET(5, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(1, v1, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f); + VCMP_U8(2, v2, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4); + + VCLEAR(v1); + VCLEAR(v2); + stride = 2; + VSET(32, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(1, v1, 0x9f, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, + 0x83, 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, + 0xdf, 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97, 0x51); + VCMP_U8(2, v2, 0xe4, 0x20, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, + 0x7d, 0x45, 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, + 0x80, 0xa4, 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82, 0x2a, 0x70); + + VCLEAR(v1); + VCLEAR(v2); + stride = 3; + VSET(21, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(3, v1, 0x9f, 0x20, 0x05, 0xaa, 0xc3, 0xd3, 0x57, 0x7d, 0xb2, 0x56, + 0xf7, 0x27, 0xab, 0x38, 0xdf, 0xa4, 0xc6, 0xec, 0xf5, 0x6d, 0x97); + VCMP_U8(4, v2, 0xe4, 0x8f, 0xe0, 0x71, 0x94, 0x31, 0x6b, 0x1a, 0xda, 0x63, + 0x3e, 0x74, 0xcd, 0x5e, 0x80, 0x7b, 0xad, 0x3c, 0x18, 0xb9, 0x2a); + VCLEAR(v1); + VCLEAR(v2); + stride = 4; + VSET(16, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(5, v1, 0x9f, 0x8f, 0xf9, 0xc3, 0x31, 0x83, 0xb2, 0x63, 0x6c, 0xab, + 0x5e, 0x60, 0xc6, 0x3c, 0xe8, 0x97); + VCMP_U8(6, v2, 0xe4, 0x2e, 0xaa, 0x94, 0x4a, 0x7d, 0xda, 0x8c, 0x27, 0xcd, + 0x42, 0xa4, 0xad, 0x69, 0x6d, 0x2a); +} + +// Segment-3 +void TEST_CASE2_8(void) { + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 2; + VSET(31, e8, m1); + asm volatile("vlsseg3e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(7, v1, 0x9f, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, + 0x83, 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, + 0xdf, 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97); + VCMP_U8(8, v2, 0xe4, 0x20, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, + 0x7d, 0x45, 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, + 0x80, 0xa4, 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82, 0x2a); + VCMP_U8(9, v3, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, 0x83, + 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, 0xdf, + 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97, 0x51); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 3; + VSET(21, e8, m1); + asm volatile("vlsseg3e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(10, v1, 0x9f, 0x20, 0x05, 0xaa, 0xc3, 0xd3, 0x57, 0x7d, 0xb2, 0x56, + 0xf7, 0x27, 0xab, 0x38, 0xdf, 0xa4, 0xc6, 0xec, 0xf5, 0x6d, 0x97); + VCMP_U8(11, v2, 0xe4, 0x8f, 0xe0, 0x71, 0x94, 0x31, 0x6b, 0x1a, 0xda, 0x63, + 0x3e, 0x74, 0xcd, 0x5e, 0x80, 0x7b, 0xad, 0x3c, 0x18, 0xb9, 0x2a); + VCMP_U8(12, v3, 0x19, 0x2e, 0xf9, 0xf0, 0xbb, 0x4a, 0x83, 0x45, 0x22, 0x8c, + 0x6c, 0x9d, 0x13, 0x42, 0x60, 0x0b, 0x91, 0x69, 0xe8, 0x82, 0x51); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 4; + VSET(16, e8, m1); + asm volatile("vlsseg3e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(13, v1, 0x9f, 0x8f, 0xf9, 0xc3, 0x31, 0x83, 0xb2, 0x63, 0x6c, 0xab, + 0x5e, 0x60, 0xc6, 0x3c, 0xe8, 0x97); + VCMP_U8(14, v2, 0xe4, 0x2e, 0xaa, 0x94, 0x4a, 0x7d, 0xda, 0x8c, 0x27, 0xcd, + 0x42, 0xa4, 0xad, 0x69, 0x6d, 0x2a); + VCMP_U8(15, v3, 0x19, 0x05, 0x71, 0xbb, 0x57, 0x1a, 0x22, 0xf7, 0x74, 0x13, + 0xdf, 0x7b, 0x91, 0xf5, 0xb9, 0x51); +} + +// Segment-4 +void TEST_CASE3_8(void) { + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 2; + VSET(31, e8, m1); + asm volatile("vlsseg4e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(16, v1, 0x9f, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, + 0x83, 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, + 0xdf, 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97); + VCMP_U8(17, v2, 0xe4, 0x20, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, + 0x7d, 0x45, 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, + 0x80, 0xa4, 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82, 0x2a); + VCMP_U8(18, v3, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, 0x83, + 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, 0xdf, + 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97, 0x51); + VCMP_U8(19, v4, 0x20, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, 0x7d, + 0x45, 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, 0x80, + 0xa4, 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82, 0x2a, 0x70); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 3; + VSET(21, e8, m1); + asm volatile("vlsseg4e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(20, v1, 0x9f, 0x20, 0x05, 0xaa, 0xc3, 0xd3, 0x57, 0x7d, 0xb2, 0x56, + 0xf7, 0x27, 0xab, 0x38, 0xdf, 0xa4, 0xc6, 0xec, 0xf5, 0x6d, 0x97); + VCMP_U8(21, v2, 0xe4, 0x8f, 0xe0, 0x71, 0x94, 0x31, 0x6b, 0x1a, 0xda, 0x63, + 0x3e, 0x74, 0xcd, 0x5e, 0x80, 0x7b, 0xad, 0x3c, 0x18, 0xb9, 0x2a); + VCMP_U8(22, v3, 0x19, 0x2e, 0xf9, 0xf0, 0xbb, 0x4a, 0x83, 0x45, 0x22, 0x8c, + 0x6c, 0x9d, 0x13, 0x42, 0x60, 0x0b, 0x91, 0x69, 0xe8, 0x82, 0x51); + VCMP_U8(23, v4, 0x20, 0x05, 0xaa, 0xc3, 0xd3, 0x57, 0x7d, 0xb2, 0x56, 0xf7, + 0x27, 0xab, 0x38, 0xdf, 0xa4, 0xc6, 0xec, 0xf5, 0x6d, 0x97, 0x70); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 4; + VSET(15, e8, m1); + asm volatile("vlsseg4e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(24, v1, 0x9f, 0x8f, 0xf9, 0xc3, 0x31, 0x83, 0xb2, 0x63, 0x6c, 0xab, + 0x5e, 0x60, 0xc6, 0x3c, 0xe8); + VCMP_U8(25, v2, 0xe4, 0x2e, 0xaa, 0x94, 0x4a, 0x7d, 0xda, 0x8c, 0x27, 0xcd, + 0x42, 0xa4, 0xad, 0x69, 0x6d); + VCMP_U8(26, v3, 0x19, 0x05, 0x71, 0xbb, 0x57, 0x1a, 0x22, 0xf7, 0x74, 0x13, + 0xdf, 0x7b, 0x91, 0xf5, 0xb9); + VCMP_U8(27, v4, 0x20, 0xe0, 0xf0, 0xd3, 0x6b, 0x45, 0x56, 0x3e, 0x9d, 0x38, + 0x80, 0x0b, 0xec, 0x18, 0x82); +} + +// Segment-8 +void TEST_CASE4_8(void) { + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 2; + VSET(29, e8, m1); + asm volatile("vlsseg8e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U8(28, v1, 0x9f, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, + 0x83, 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, + 0xdf, 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8); + VCMP_U8(29, v2, 0xe4, 0x20, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, + 0x7d, 0x45, 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, + 0x80, 0xa4, 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d); + VCMP_U8(30, v3, 0x19, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, 0x83, + 0x1a, 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, 0xdf, + 0x60, 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9); + VCMP_U8(31, v4, 0x20, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, 0x7d, + 0x45, 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, 0x80, + 0xa4, 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82); + VCMP_U8(32, v5, 0x8f, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, 0x83, 0x1a, + 0xb2, 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, 0xdf, 0x60, + 0x7b, 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97); + VCMP_U8(33, v6, 0x2e, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, 0x7d, 0x45, + 0xda, 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, 0x80, 0xa4, + 0x0b, 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82, 0x2a); + VCMP_U8(34, v7, 0x05, 0xf9, 0x71, 0xc3, 0xbb, 0x31, 0x57, 0x83, 0x1a, 0xb2, + 0x22, 0x63, 0xf7, 0x6c, 0x74, 0xab, 0x13, 0x5e, 0xdf, 0x60, 0x7b, + 0xc6, 0x91, 0x3c, 0xf5, 0xe8, 0xb9, 0x97, 0x51); + VCMP_U8(35, v8, 0xe0, 0xaa, 0xf0, 0x94, 0xd3, 0x4a, 0x6b, 0x7d, 0x45, 0xda, + 0x56, 0x8c, 0x3e, 0x27, 0x9d, 0xcd, 0x38, 0x42, 0x80, 0xa4, 0x0b, + 0xad, 0xec, 0x69, 0x18, 0x6d, 0x82, 0x2a, 0x70); +} + +// Segment-2 +void TEST_CASE1_16(void) { + + VSET(-1, e16, m1); + volatile uint16_t INP1[] = { + 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1111, 0x2222, 0x3333, 0x4444, + 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, 0xbbbb, 0xcccc, + 0xdddd, 0xeeee, 0xffff, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, + 0x0606, 0x0707, 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, + 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, + 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, + 0x1e1e, 0x1f1f, 0x2020, 0x2121, 0x2222, 0x2323, 0x2424, 0x2525, + 0x2626, 0x2727, 0x2828, 0x2929, 0x2a2a, 0x2b2b, 0x2c2c, 0x2d2d}; + + VCLEAR(v1); + VCLEAR(v2); + stride = 0; + VSET(5, e16, m1); + asm volatile("vlsseg2e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(36, v1, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234); + VCMP_U16(37, v2, 0x5678, 0x5678, 0x5678, 0x5678, 0x5678); + + VSET(-1, e16, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 4; + VSET(32, e16, m1); + asm volatile("vlsseg2e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(38, v1, 0x1234, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, + 0xbbbb, 0xdddd, 0xffff, 0x0202, 0x0404, 0x0606, 0x0808, 0x0a0a, + 0x0c0c, 0x0e0e, 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, + 0x1c1c, 0x1e1e, 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, + 0x2c2c); + VCMP_U16(39, v2, 0x5678, 0xdef0, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, + 0xcccc, 0xeeee, 0x0101, 0x0303, 0x0505, 0x0707, 0x0909, 0x0b0b, + 0x0d0d, 0x0f0f, 0x1111, 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, + 0x1d1d, 0x1f1f, 0x2121, 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, + 0x2d2d); + + VSET(-1, e16, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 6; + VSET(22, e16, m1); + asm volatile("vlsseg2e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(40, v1, 0x1234, 0xdef0, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, + 0x303, 0x606, 0x909, 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, + 0x1e1e, 0x2121, 0x2424, 0x2727, 0x2a2a, 0x2d2d); + VCMP_U16(41, v2, 0x5678, 0x1111, 0x4444, 0x7777, 0xaaaa, 0xdddd, 0x101, 0x404, + 0x707, 0xa0a, 0xd0d, 0x1010, 0x1313, 0x1616, 0x1919, 0x1c1c, 0x1f1f, + 0x2222, 0x2525, 0x2828, 0x2b2b); + + VSET(-1, e16, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 8; + VSET(16, e16, m1); + asm volatile("vlsseg2e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(42, v1, 0x1234, 0x1111, 0x5555, 0x9999, 0xdddd, 0x0202, 0x0606, + 0x0a0a, 0x0e0e, 0x1212, 0x1616, 0x1a1a, 0x1e1e, 0x2222, 0x2626, + 0x2a2a); + VCMP_U16(43, v2, 0x5678, 0x2222, 0x6666, 0xaaaa, 0xeeee, 0x0303, 0x0707, + 0x0b0b, 0x0f0f, 0x1313, 0x1717, 0x1b1b, 0x1f1f, 0x2323, 0x2727, + 0x2b2b); +} + +// Segment-3 +void TEST_CASE2_16(void) { + VSET(-1, e16, m1); + volatile uint16_t INP1[] = { + 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1111, 0x2222, 0x3333, 0x4444, + 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, 0xbbbb, 0xcccc, + 0xdddd, 0xeeee, 0xffff, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, + 0x0606, 0x0707, 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, + 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, + 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, + 0x1e1e, 0x1f1f, 0x2020, 0x2121, 0x2222, 0x2323, 0x2424, 0x2525, + 0x2626, 0x2727, 0x2828, 0x2929, 0x2a2a, 0x2b2b, 0x2c2c, 0x2d2d}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 4; + VSET(31, e16, m1); + asm volatile("vlsseg3e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(44, v1, 0x1234, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, + 0xbbbb, 0xdddd, 0xffff, 0x0202, 0x0404, 0x0606, 0x0808, 0x0a0a, + 0x0c0c, 0x0e0e, 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, + 0x1c1c, 0x1e1e, 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a); + VCMP_U16(45, v2, 0x5678, 0xdef0, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, + 0xcccc, 0xeeee, 0x0101, 0x0303, 0x0505, 0x0707, 0x0909, 0x0b0b, + 0x0d0d, 0x0f0f, 0x1111, 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, + 0x1d1d, 0x1f1f, 0x2121, 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, + 0x2d2d); + VCMP_U16(46, v3, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, 0xbbbb, + 0xdddd, 0xffff, 0x0202, 0x0404, 0x0606, 0x0808, 0x0a0a, 0x0c0c, + 0x0e0e, 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, + 0x1e1e, 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 6; + VSET(21, e16, m1); + asm volatile("vlsseg3e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(47, v1, 0x1234, 0xdef0, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, + 0x303, 0x606, 0x909, 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, + 0x1e1e, 0x2121, 0x2424, 0x2727, 0x2a2a); + VCMP_U16(48, v2, 0x5678, 0x1111, 0x4444, 0x7777, 0xaaaa, 0xdddd, 0x101, 0x404, + 0x707, 0xa0a, 0xd0d, 0x1010, 0x1313, 0x1616, 0x1919, 0x1c1c, 0x1f1f, + 0x2222, 0x2525, 0x2828, 0x2b2b); + VCMP_U16(49, v3, 0x9abc, 0x2222, 0x5555, 0x8888, 0xbbbb, 0xeeee, 0x202, 0x505, + 0x808, 0xb0b, 0xe0e, 0x1111, 0x1414, 0x1717, 0x1a1a, 0x1d1d, 0x2020, + 0x2323, 0x2626, 0x2929, 0x2c2c); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 8; + VSET(16, e16, m1); + asm volatile("vlsseg3e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(50, v1, 0x1234, 0x1111, 0x5555, 0x9999, 0xdddd, 0x202, 0x606, 0xa0a, + 0xe0e, 0x1212, 0x1616, 0x1a1a, 0x1e1e, 0x2222, 0x2626, 0x2a2a); + VCMP_U16(51, v2, 0x5678, 0x2222, 0x6666, 0xaaaa, 0xeeee, 0x303, 0x707, 0xb0b, + 0xf0f, 0x1313, 0x1717, 0x1b1b, 0x1f1f, 0x2323, 0x2727, 0x2b2b); + VCMP_U16(52, v3, 0x9abc, 0x3333, 0x7777, 0xbbbb, 0xffff, 0x404, 0x808, 0xc0c, + 0x1010, 0x1414, 0x1818, 0x1c1c, 0x2020, 0x2424, 0x2828, 0x2c2c); +} + +// Segment-4 +void TEST_CASE3_16(void) { + VSET(-1, e16, m1); + volatile uint16_t INP1[] = { + 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1111, 0x2222, 0x3333, 0x4444, + 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, 0xbbbb, 0xcccc, + 0xdddd, 0xeeee, 0xffff, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, + 0x0606, 0x0707, 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, + 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, + 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, + 0x1e1e, 0x1f1f, 0x2020, 0x2121, 0x2222, 0x2323, 0x2424, 0x2525, + 0x2626, 0x2727, 0x2828, 0x2929, 0x2a2a, 0x2b2b, 0x2c2c, 0x2d2d}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 4; + VSET(32, e16, m1); + asm volatile("vlsseg4e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(53, v1, 0x1234, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, + 0xbbbb, 0xdddd, 0xffff, 0x202, 0x404, 0x606, 0x808, 0xa0a, 0xc0c, + 0xe0e, 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, + 0x1e1e, 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCMP_U16(54, v2, 0x5678, 0xdef0, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, + 0xcccc, 0xeeee, 0x101, 0x303, 0x505, 0x707, 0x909, 0xb0b, 0xd0d, + 0xf0f, 0x1111, 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, 0x1d1d, + 0x1f1f, 0x2121, 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, 0x2d2d); + VCMP_U16(55, v3, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, 0xbbbb, + 0xdddd, 0xffff, 0x202, 0x404, 0x606, 0x808, 0xa0a, 0xc0c, 0xe0e, + 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, 0x1e1e, + 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCMP_U16(56, v4, 0xdef0, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, 0xcccc, + 0xeeee, 0x101, 0x303, 0x505, 0x707, 0x909, 0xb0b, 0xd0d, 0xf0f, + 0x1111, 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, 0x1d1d, 0x1f1f, + 0x2121, 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, 0x2d2d); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 6; + VSET(22, e16, m1); + asm volatile("vlsseg4e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(57, v1, 0x1234, 0xdef0, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, + 0x303, 0x606, 0x909, 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, + 0x1e1e, 0x2121, 0x2424, 0x2727, 0x2a2a, 0x2d2d); + VCMP_U16(58, v2, 0x5678, 0x1111, 0x4444, 0x7777, 0xaaaa, 0xdddd, 0x101, 0x404, + 0x707, 0xa0a, 0xd0d, 0x1010, 0x1313, 0x1616, 0x1919, 0x1c1c, 0x1f1f, + 0x2222, 0x2525, 0x2828, 0x2b2b); + VCMP_U16(59, v3, 0x9abc, 0x2222, 0x5555, 0x8888, 0xbbbb, 0xeeee, 0x202, 0x505, + 0x808, 0xb0b, 0xe0e, 0x1111, 0x1414, 0x1717, 0x1a1a, 0x1d1d, 0x2020, + 0x2323, 0x2626, 0x2929, 0x2c2c); + VCMP_U16(60, v4, 0xdef0, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, 0x303, 0x606, + 0x909, 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, 0x1e1e, 0x2121, + 0x2424, 0x2727, 0x2a2a, 0x2d2d); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 8; + VSET(16, e16, m1); + asm volatile("vlsseg4e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(61, v1, 0x1234, 0x1111, 0x5555, 0x9999, 0xdddd, 0x202, 0x606, 0xa0a, + 0xe0e, 0x1212, 0x1616, 0x1a1a, 0x1e1e, 0x2222, 0x2626, 0x2a2a); + VCMP_U16(62, v2, 0x5678, 0x2222, 0x6666, 0xaaaa, 0xeeee, 0x303, 0x707, 0xb0b, + 0xf0f, 0x1313, 0x1717, 0x1b1b, 0x1f1f, 0x2323, 0x2727, 0x2b2b); + VCMP_U16(63, v3, 0x9abc, 0x3333, 0x7777, 0xbbbb, 0xffff, 0x404, 0x808, 0xc0c, + 0x1010, 0x1414, 0x1818, 0x1c1c, 0x2020, 0x2424, 0x2828, 0x2c2c); + VCMP_U16(64, v4, 0xdef0, 0x4444, 0x8888, 0xcccc, 0x101, 0x505, 0x909, 0xd0d, + 0x1111, 0x1515, 0x1919, 0x1d1d, 0x2121, 0x2525, 0x2929, 0x2d2d); +} + +// Segment-8 +void TEST_CASE4_16(void) { + VSET(-1, e16, m1); + volatile uint16_t INP1[] = { + 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1111, 0x2222, 0x3333, 0x4444, + 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, 0xbbbb, 0xcccc, + 0xdddd, 0xeeee, 0xffff, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, + 0x0606, 0x0707, 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, + 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, + 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, + 0x1e1e, 0x1f1f, 0x2020, 0x2121, 0x2222, 0x2323, 0x2424, 0x2525, + 0x2626, 0x2727, 0x2828, 0x2929, 0x2a2a, 0x2b2b, 0x2c2c, 0x2d2d}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 4; + VSET(32, e16, m1); + asm volatile("vlsseg8e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(65, v1, 0x1234, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, + 0xbbbb, 0xdddd, 0xffff, 0x202, 0x404, 0x606, 0x808, 0xa0a, 0xc0c, + 0xe0e, 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, + 0x1e1e, 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCMP_U16(66, v2, 0x5678, 0xdef0, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, + 0xcccc, 0xeeee, 0x101, 0x303, 0x505, 0x707, 0x909, 0xb0b, 0xd0d, + 0xf0f, 0x1111, 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, 0x1d1d, + 0x1f1f, 0x2121, 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, 0x2d2d); + VCMP_U16(67, v3, 0x9abc, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, 0xbbbb, + 0xdddd, 0xffff, 0x202, 0x404, 0x606, 0x808, 0xa0a, 0xc0c, 0xe0e, + 0x1010, 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, 0x1e1e, + 0x2020, 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCMP_U16(68, v4, 0xdef0, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, 0xcccc, + 0xeeee, 0x101, 0x303, 0x505, 0x707, 0x909, 0xb0b, 0xd0d, 0xf0f, + 0x1111, 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, 0x1d1d, 0x1f1f, + 0x2121, 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, 0x2d2d); + VCMP_U16(69, v5, 0x1111, 0x3333, 0x5555, 0x7777, 0x9999, 0xbbbb, 0xdddd, + 0xffff, 0x202, 0x404, 0x606, 0x808, 0xa0a, 0xc0c, 0xe0e, 0x1010, + 0x1212, 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, 0x1e1e, 0x2020, + 0x2222, 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCMP_U16(70, v6, 0x2222, 0x4444, 0x6666, 0x8888, 0xaaaa, 0xcccc, 0xeeee, + 0x101, 0x303, 0x505, 0x707, 0x909, 0xb0b, 0xd0d, 0xf0f, 0x1111, + 0x1313, 0x1515, 0x1717, 0x1919, 0x1b1b, 0x1d1d, 0x1f1f, 0x2121, + 0x2323, 0x2525, 0x2727, 0x2929, 0x2b2b, 0x2d2d); + VCMP_U16(71, v7, 0x3333, 0x5555, 0x7777, 0x9999, 0xbbbb, 0xdddd, 0xffff, + 0x202, 0x404, 0x606, 0x808, 0xa0a, 0xc0c, 0xe0e, 0x1010, 0x1212, + 0x1414, 0x1616, 0x1818, 0x1a1a, 0x1c1c, 0x1e1e, 0x2020, 0x2222, + 0x2424, 0x2626, 0x2828, 0x2a2a, 0x2c2c); + VCMP_U16(72, v8, 0x4444, 0x6666, 0x8888, 0xaaaa, 0xcccc, 0xeeee, 0x101, 0x303, + 0x505, 0x707, 0x909, 0xb0b, 0xd0d, 0xf0f, 0x1111, 0x1313, 0x1515, + 0x1717, 0x1919, 0x1b1b, 0x1d1d, 0x1f1f, 0x2121, 0x2323, 0x2525, + 0x2727, 0x2929, 0x2b2b, 0x2d2d); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 6; + VSET(22, e16, m1); + asm volatile("vlsseg8e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(73, v1, 0x1234, 0xdef0, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, + 0x303, 0x606, 0x909, 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, + 0x1e1e, 0x2121, 0x2424, 0x2727, 0x2a2a, 0x2d2d); + VCMP_U16(74, v2, 0x5678, 0x1111, 0x4444, 0x7777, 0xaaaa, 0xdddd, 0x101, 0x404, + 0x707, 0xa0a, 0xd0d, 0x1010, 0x1313, 0x1616, 0x1919, 0x1c1c, 0x1f1f, + 0x2222, 0x2525, 0x2828, 0x2b2b); + VCMP_U16(75, v3, 0x9abc, 0x2222, 0x5555, 0x8888, 0xbbbb, 0xeeee, 0x202, 0x505, + 0x808, 0xb0b, 0xe0e, 0x1111, 0x1414, 0x1717, 0x1a1a, 0x1d1d, 0x2020, + 0x2323, 0x2626, 0x2929, 0x2c2c); + VCMP_U16(76, v4, 0xdef0, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, 0x303, 0x606, + 0x909, 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, 0x1e1e, 0x2121, + 0x2424, 0x2727, 0x2a2a, 0x2d2d); + VCMP_U16(77, v5, 0x1111, 0x4444, 0x7777, 0xaaaa, 0xdddd, 0x101, 0x404, 0x707, + 0xa0a, 0xd0d, 0x1010, 0x1313, 0x1616, 0x1919, 0x1c1c, 0x1f1f, 0x2222, + 0x2525, 0x2828, 0x2b2b); + VCMP_U16(78, v6, 0x2222, 0x5555, 0x8888, 0xbbbb, 0xeeee, 0x202, 0x505, 0x808, + 0xb0b, 0xe0e, 0x1111, 0x1414, 0x1717, 0x1a1a, 0x1d1d, 0x2020, 0x2323, + 0x2626, 0x2929, 0x2c2c); + VCMP_U16(79, v7, 0x3333, 0x6666, 0x9999, 0xcccc, 0xffff, 0x303, 0x606, 0x909, + 0xc0c, 0xf0f, 0x1212, 0x1515, 0x1818, 0x1b1b, 0x1e1e, 0x2121, 0x2424, + 0x2727, 0x2a2a, 0x2d2d); + VCMP_U16(80, v8, 0x4444, 0x7777, 0xaaaa, 0xdddd, 0x101, 0x404, 0x707, 0xa0a, + 0xd0d, 0x1010, 0x1313, 0x1616, 0x1919, 0x1c1c, 0x1f1f, 0x2222, + 0x2525, 0x2828, 0x2b2b); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 8; + VSET(16, e16, m1); + asm volatile("vlsseg8e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U16(81, v1, 0x1234, 0x1111, 0x5555, 0x9999, 0xdddd, 0x202, 0x606, 0xa0a, + 0xe0e, 0x1212, 0x1616, 0x1a1a, 0x1e1e, 0x2222, 0x2626, 0x2a2a); + VCMP_U16(82, v2, 0x5678, 0x2222, 0x6666, 0xaaaa, 0xeeee, 0x303, 0x707, 0xb0b, + 0xf0f, 0x1313, 0x1717, 0x1b1b, 0x1f1f, 0x2323, 0x2727, 0x2b2b); + VCMP_U16(83, v3, 0x9abc, 0x3333, 0x7777, 0xbbbb, 0xffff, 0x404, 0x808, 0xc0c, + 0x1010, 0x1414, 0x1818, 0x1c1c, 0x2020, 0x2424, 0x2828, 0x2c2c); + VCMP_U16(84, v4, 0xdef0, 0x4444, 0x8888, 0xcccc, 0x101, 0x505, 0x909, 0xd0d, + 0x1111, 0x1515, 0x1919, 0x1d1d, 0x2121, 0x2525, 0x2929, 0x2d2d); + VCMP_U16(85, v5, 0x1111, 0x5555, 0x9999, 0xdddd, 0x202, 0x606, 0xa0a, 0xe0e, + 0x1212, 0x1616, 0x1a1a, 0x1e1e, 0x2222, 0x2626, 0x2a2a); + VCMP_U16(86, v6, 0x2222, 0x6666, 0xaaaa, 0xeeee, 0x303, 0x707, 0xb0b, 0xf0f, + 0x1313, 0x1717, 0x1b1b, 0x1f1f, 0x2323, 0x2727, 0x2b2b); + VCMP_U16(87, v7, 0x3333, 0x7777, 0xbbbb, 0xffff, 0x404, 0x808, 0xc0c, 0x1010, + 0x1414, 0x1818, 0x1c1c, 0x2020, 0x2424, 0x2828, 0x2c2c); + VCMP_U16(88, v8, 0x4444, 0x8888, 0xcccc, 0x101, 0x505, 0x909, 0xd0d, 0x1111, + 0x1515, 0x1919, 0x1d1d, 0x2121, 0x2525, 0x2929, 0x2d2d); +} + +// Segment-2 +void TEST_CASE1_32(void) { + + VSET(-1, e32, m1); + volatile uint32_t INP1[] = { + 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, 0x82f92af6, 0x9af29daa, + 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, 0x53a0be4e, 0x26439a12, + 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, 0xb11d757e, 0x67dd4037, + 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, 0xcefce71b, 0x64d90d0c, + 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, 0xa2cd798c, 0x2a4339cc, + 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, 0x4b32bcdd, 0xbf3b8546, + 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, 0x60914005, 0x93265d9d, + 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, 0xddcd4d07, 0x3266d631, + 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, 0x687f8a39, 0xb9272633, + 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, 0x2a143e76, 0x17a38eec, + 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a}; + + VCLEAR(v1); + VCLEAR(v2); + stride = 0; + VSET(5, e32, m1); + asm volatile("vlsseg2e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(89, v1, 0xe19afa6b, 0xe19afa6b, 0xe19afa6b, 0xe19afa6b, 0xe19afa6b); + VCMP_U32(90, v2, 0x8c10145c, 0x8c10145c, 0x8c10145c, 0x8c10145c, 0x8c10145c); + + VSET(-1, e32, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 8; + VSET(32, e32, m1); + asm volatile("vlsseg2e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(91, v1, 0xe19afa6b, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, + 0x53a0be4e, 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, + 0x2e572002, 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, + 0xcf9238fb, 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, + 0x60914005, 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, + 0x9db64ef5, 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, + 0x9a73626c, 0x582140dd); + VCMP_U32(92, v2, 0x8c10145c, 0x11ffa54e, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, + 0x26439a12, 0x35659121, 0xa87678a2, 0x67dd4037, 0xb7600abf, + 0xaadc6195, 0x64d90d0c, 0xcc6da682, 0x8533b185, 0x2a4339cc, + 0x7e70281b, 0x4f2ea60f, 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, + 0x93265d9d, 0x788529c3, 0x4edd7f48, 0x3266d631, 0x7bfd8a81, + 0xa06a42d4, 0xb9272633, 0xf542d689, 0xf547c96e, 0x17a38eec, + 0xca064493, 0x97df3c7a); + + VSET(-1, e32, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 12; + VSET(22, e32, m1); + asm volatile("vlsseg2e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(93, v1, 0xe19afa6b, 0x11ffa54e, 0x956eb527, 0xcf7a1d98, 0x785cc853, + 0xa87678a2, 0xd29ad01e, 0xaadc6195, 0x6c3b54b0, 0x8533b185, + 0xcf9238fb, 0x4f2ea60f, 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, + 0x4edd7f48, 0x3b2f25a6, 0xa06a42d4, 0xb009319e, 0xf547c96e, + 0x9a73626c, 0x97df3c7a); + VCMP_U32(94, v2, 0x8c10145c, 0x82f92af6, 0x575c2e05, 0x53a0be4e, 0x35659121, + 0xb11d757e, 0xb7600abf, 0xcefce71b, 0xcc6da682, 0xa2cd798c, + 0x7e70281b, 0x4b32bcdd, 0x18cbcecd, 0x60914005, 0x788529c3, + 0xddcd4d07, 0x7bfd8a81, 0x687f8a39, 0xf542d689, 0x2a143e76, + 0xca064493); + + VSET(-1, e32, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 16; + VSET(16, e32, m1); + asm volatile("vlsseg2e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(95, v1, 0xe19afa6b, 0x82f92af6, 0x68fb4cc5, 0x785cc853, 0xb11d757e, + 0x2e572002, 0x6c3b54b0, 0xa2cd798c, 0xdf162ee9, 0x52b26ff5, + 0x60914005, 0xdda63ceb, 0x3b2f25a6, 0x687f8a39, 0x45ef05c9, + 0x9a73626c); + VCMP_U32(96, v2, 0x8c10145c, 0x9af29daa, 0xcf7a1d98, 0x35659121, 0x67dd4037, + 0xaadc6195, 0xcc6da682, 0x2a4339cc, 0x4f2ea60f, 0x18cbcecd, + 0x93265d9d, 0x4edd7f48, 0x7bfd8a81, 0xb9272633, 0xf547c96e, + 0xca064493); +} + +// Segment-3 +void TEST_CASE2_32(void) { + VSET(-1, e32, m1); + volatile uint32_t INP1[] = { + 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, 0x82f92af6, 0x9af29daa, + 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, 0x53a0be4e, 0x26439a12, + 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, 0xb11d757e, 0x67dd4037, + 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, 0xcefce71b, 0x64d90d0c, + 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, 0xa2cd798c, 0x2a4339cc, + 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, 0x4b32bcdd, 0xbf3b8546, + 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, 0x60914005, 0x93265d9d, + 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, 0xddcd4d07, 0x3266d631, + 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, 0x687f8a39, 0xb9272633, + 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, 0x2a143e76, 0x17a38eec, + 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 8; + VSET(32, e32, m1); + asm volatile("vlsseg3e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(97, v1, 0xe19afa6b, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, + 0x53a0be4e, 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, + 0x2e572002, 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, + 0xcf9238fb, 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, + 0x60914005, 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, + 0x9db64ef5, 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, + 0x9a73626c, 0x582140dd); + VCMP_U32(98, v2, 0x8c10145c, 0x11ffa54e, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, + 0x26439a12, 0x35659121, 0xa87678a2, 0x67dd4037, 0xb7600abf, + 0xaadc6195, 0x64d90d0c, 0xcc6da682, 0x8533b185, 0x2a4339cc, + 0x7e70281b, 0x4f2ea60f, 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, + 0x93265d9d, 0x788529c3, 0x4edd7f48, 0x3266d631, 0x7bfd8a81, + 0xa06a42d4, 0xb9272633, 0xf542d689, 0xf547c96e, 0x17a38eec, + 0xca064493, 0x97df3c7a); + VCMP_U32(99, v3, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, 0x53a0be4e, + 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, 0x2e572002, + 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, 0xcf9238fb, + 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, 0x60914005, + 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, 0x9db64ef5, + 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, 0x9a73626c, + 0x582140dd); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 12; + VSET(22, e32, m1); + asm volatile("vlsseg3e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(100, v1, 0xe19afa6b, 0x11ffa54e, 0x956eb527, 0xcf7a1d98, 0x785cc853, + 0xa87678a2, 0xd29ad01e, 0xaadc6195, 0x6c3b54b0, 0x8533b185, + 0xcf9238fb, 0x4f2ea60f, 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, + 0x4edd7f48, 0x3b2f25a6, 0xa06a42d4, 0xb009319e, 0xf547c96e, + 0x9a73626c, 0x97df3c7a); + VCMP_U32(101, v2, 0x8c10145c, 0x82f92af6, 0x575c2e05, 0x53a0be4e, 0x35659121, + 0xb11d757e, 0xb7600abf, 0xcefce71b, 0xcc6da682, 0xa2cd798c, + 0x7e70281b, 0x4b32bcdd, 0x18cbcecd, 0x60914005, 0x788529c3, + 0xddcd4d07, 0x7bfd8a81, 0x687f8a39, 0xf542d689, 0x2a143e76, + 0xca064493); + VCMP_U32(102, v3, 0xbca44cc5, 0x9af29daa, 0x68fb4cc5, 0x26439a12, 0xf7a96b8c, + 0x67dd4037, 0x2e572002, 0x64d90d0c, 0xd8b7ae76, 0x2a4339cc, + 0xdf162ee9, 0xbf3b8546, 0xc364c8f8, 0x93265d9d, 0xdda63ceb, + 0x3266d631, 0x9db64ef5, 0xb9272633, 0x45ef05c9, 0x17a38eec, + 0x582140dd); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 16; + VSET(16, e32, m1); + asm volatile("vlsseg3e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(103, v1, 0xe19afa6b, 0x82f92af6, 0x68fb4cc5, 0x785cc853, 0xb11d757e, + 0x2e572002, 0x6c3b54b0, 0xa2cd798c, 0xdf162ee9, 0x52b26ff5, + 0x60914005, 0xdda63ceb, 0x3b2f25a6, 0x687f8a39, 0x45ef05c9, + 0x9a73626c); + VCMP_U32(104, v2, 0x8c10145c, 0x9af29daa, 0xcf7a1d98, 0x35659121, 0x67dd4037, + 0xaadc6195, 0xcc6da682, 0x2a4339cc, 0x4f2ea60f, 0x18cbcecd, + 0x93265d9d, 0x4edd7f48, 0x7bfd8a81, 0xb9272633, 0xf547c96e, + 0xca064493); + VCMP_U32(105, v3, 0xbca44cc5, 0x956eb527, 0x53a0be4e, 0xf7a96b8c, 0xd29ad01e, + 0xcefce71b, 0xd8b7ae76, 0xcf9238fb, 0x4b32bcdd, 0xc364c8f8, + 0xcff3c77d, 0xddcd4d07, 0x9db64ef5, 0xb009319e, 0x2a143e76, + 0x582140dd); +} + +// Segment-4 +void TEST_CASE3_32(void) { + VSET(-1, e32, m1); + volatile uint32_t INP1[] = { + 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, 0x82f92af6, 0x9af29daa, + 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, 0x53a0be4e, 0x26439a12, + 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, 0xb11d757e, 0x67dd4037, + 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, 0xcefce71b, 0x64d90d0c, + 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, 0xa2cd798c, 0x2a4339cc, + 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, 0x4b32bcdd, 0xbf3b8546, + 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, 0x60914005, 0x93265d9d, + 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, 0xddcd4d07, 0x3266d631, + 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, 0x687f8a39, 0xb9272633, + 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, 0x2a143e76, 0x17a38eec, + 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 8; + VSET(32, e32, m1); + asm volatile("vlsseg4e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(106, v1, 0xe19afa6b, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, + 0x53a0be4e, 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, + 0x2e572002, 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, + 0xcf9238fb, 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, + 0x60914005, 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, + 0x9db64ef5, 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, + 0x9a73626c, 0x582140dd); + VCMP_U32(107, v2, 0x8c10145c, 0x11ffa54e, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, + 0x26439a12, 0x35659121, 0xa87678a2, 0x67dd4037, 0xb7600abf, + 0xaadc6195, 0x64d90d0c, 0xcc6da682, 0x8533b185, 0x2a4339cc, + 0x7e70281b, 0x4f2ea60f, 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, + 0x93265d9d, 0x788529c3, 0x4edd7f48, 0x3266d631, 0x7bfd8a81, + 0xa06a42d4, 0xb9272633, 0xf542d689, 0xf547c96e, 0x17a38eec, + 0xca064493, 0x97df3c7a); + VCMP_U32(108, v3, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, 0x53a0be4e, + 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, 0x2e572002, + 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, 0xcf9238fb, + 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, 0x60914005, + 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, 0x9db64ef5, + 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, 0x9a73626c, + 0x582140dd); + VCMP_U32(109, v4, 0x11ffa54e, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, 0x26439a12, + 0x35659121, 0xa87678a2, 0x67dd4037, 0xb7600abf, 0xaadc6195, + 0x64d90d0c, 0xcc6da682, 0x8533b185, 0x2a4339cc, 0x7e70281b, + 0x4f2ea60f, 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, 0x93265d9d, + 0x788529c3, 0x4edd7f48, 0x3266d631, 0x7bfd8a81, 0xa06a42d4, + 0xb9272633, 0xf542d689, 0xf547c96e, 0x17a38eec, 0xca064493, + 0x97df3c7a); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 12; + VSET(22, e32, m1); + asm volatile("vlsseg4e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(110, v1, 0xe19afa6b, 0x11ffa54e, 0x956eb527, 0xcf7a1d98, 0x785cc853, + 0xa87678a2, 0xd29ad01e, 0xaadc6195, 0x6c3b54b0, 0x8533b185, + 0xcf9238fb, 0x4f2ea60f, 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, + 0x4edd7f48, 0x3b2f25a6, 0xa06a42d4, 0xb009319e, 0xf547c96e, + 0x9a73626c, 0x97df3c7a); + VCMP_U32(111, v2, 0x8c10145c, 0x82f92af6, 0x575c2e05, 0x53a0be4e, 0x35659121, + 0xb11d757e, 0xb7600abf, 0xcefce71b, 0xcc6da682, 0xa2cd798c, + 0x7e70281b, 0x4b32bcdd, 0x18cbcecd, 0x60914005, 0x788529c3, + 0xddcd4d07, 0x7bfd8a81, 0x687f8a39, 0xf542d689, 0x2a143e76, + 0xca064493); + VCMP_U32(112, v3, 0xbca44cc5, 0x9af29daa, 0x68fb4cc5, 0x26439a12, 0xf7a96b8c, + 0x67dd4037, 0x2e572002, 0x64d90d0c, 0xd8b7ae76, 0x2a4339cc, + 0xdf162ee9, 0xbf3b8546, 0xc364c8f8, 0x93265d9d, 0xdda63ceb, + 0x3266d631, 0x9db64ef5, 0xb9272633, 0x45ef05c9, 0x17a38eec, + 0x582140dd); + VCMP_U32(113, v4, 0x11ffa54e, 0x956eb527, 0xcf7a1d98, 0x785cc853, 0xa87678a2, + 0xd29ad01e, 0xaadc6195, 0x6c3b54b0, 0x8533b185, 0xcf9238fb, + 0x4f2ea60f, 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, 0x4edd7f48, + 0x3b2f25a6, 0xa06a42d4, 0xb009319e, 0xf547c96e, 0x9a73626c, + 0x97df3c7a); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 16; + VSET(16, e32, m1); + asm volatile("vlsseg4e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(114, v1, 0xe19afa6b, 0x82f92af6, 0x68fb4cc5, 0x785cc853, 0xb11d757e, + 0x2e572002, 0x6c3b54b0, 0xa2cd798c, 0xdf162ee9, 0x52b26ff5, + 0x60914005, 0xdda63ceb, 0x3b2f25a6, 0x687f8a39, 0x45ef05c9, + 0x9a73626c); + VCMP_U32(115, v2, 0x8c10145c, 0x9af29daa, 0xcf7a1d98, 0x35659121, 0x67dd4037, + 0xaadc6195, 0xcc6da682, 0x2a4339cc, 0x4f2ea60f, 0x18cbcecd, + 0x93265d9d, 0x4edd7f48, 0x7bfd8a81, 0xb9272633, 0xf547c96e, + 0xca064493); + VCMP_U32(116, v3, 0xbca44cc5, 0x956eb527, 0x53a0be4e, 0xf7a96b8c, 0xd29ad01e, + 0xcefce71b, 0xd8b7ae76, 0xcf9238fb, 0x4b32bcdd, 0xc364c8f8, + 0xcff3c77d, 0xddcd4d07, 0x9db64ef5, 0xb009319e, 0x2a143e76, + 0x582140dd); + VCMP_U32(117, v4, 0x11ffa54e, 0x575c2e05, 0x26439a12, 0xa87678a2, 0xb7600abf, + 0x64d90d0c, 0x8533b185, 0x7e70281b, 0xbf3b8546, 0x5bf0c67b, + 0x788529c3, 0x3266d631, 0xa06a42d4, 0xf542d689, 0x17a38eec, + 0x97df3c7a); +} + +// Segment-8 +void TEST_CASE4_32(void) { + VSET(-1, e32, m1); + volatile uint32_t INP1[] = { + 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, 0x82f92af6, 0x9af29daa, + 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, 0x53a0be4e, 0x26439a12, + 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, 0xb11d757e, 0x67dd4037, + 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, 0xcefce71b, 0x64d90d0c, + 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, 0xa2cd798c, 0x2a4339cc, + 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, 0x4b32bcdd, 0xbf3b8546, + 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, 0x60914005, 0x93265d9d, + 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, 0xddcd4d07, 0x3266d631, + 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, 0x687f8a39, 0xb9272633, + 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, 0x2a143e76, 0x17a38eec, + 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 8; + VSET(32, e32, m1); + asm volatile("vlsseg8e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(118, v1, 0xe19afa6b, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, + 0x53a0be4e, 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, + 0x2e572002, 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, + 0xcf9238fb, 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, + 0x60914005, 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, + 0x9db64ef5, 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, + 0x9a73626c, 0x582140dd); + VCMP_U32(119, v2, 0x8c10145c, 0x11ffa54e, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, + 0x26439a12, 0x35659121, 0xa87678a2, 0x67dd4037, 0xb7600abf, + 0xaadc6195, 0x64d90d0c, 0xcc6da682, 0x8533b185, 0x2a4339cc, + 0x7e70281b, 0x4f2ea60f, 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, + 0x93265d9d, 0x788529c3, 0x4edd7f48, 0x3266d631, 0x7bfd8a81, + 0xa06a42d4, 0xb9272633, 0xf542d689, 0xf547c96e, 0x17a38eec, + 0xca064493, 0x97df3c7a); + VCMP_U32(120, v3, 0xbca44cc5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, 0x53a0be4e, + 0x785cc853, 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, 0x2e572002, + 0xcefce71b, 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, 0xcf9238fb, + 0xdf162ee9, 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, 0x60914005, + 0xcff3c77d, 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, 0x9db64ef5, + 0x687f8a39, 0xb009319e, 0x45ef05c9, 0x2a143e76, 0x9a73626c, + 0x582140dd); + VCMP_U32(121, v4, 0x11ffa54e, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, 0x26439a12, + 0x35659121, 0xa87678a2, 0x67dd4037, 0xb7600abf, 0xaadc6195, + 0x64d90d0c, 0xcc6da682, 0x8533b185, 0x2a4339cc, 0x7e70281b, + 0x4f2ea60f, 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, 0x93265d9d, + 0x788529c3, 0x4edd7f48, 0x3266d631, 0x7bfd8a81, 0xa06a42d4, + 0xb9272633, 0xf542d689, 0xf547c96e, 0x17a38eec, 0xca064493, + 0x97df3c7a); + VCMP_U32(122, v5, 0x82f92af6, 0x956eb527, 0x68fb4cc5, 0x53a0be4e, 0x785cc853, + 0xf7a96b8c, 0xb11d757e, 0xd29ad01e, 0x2e572002, 0xcefce71b, + 0x6c3b54b0, 0xd8b7ae76, 0xa2cd798c, 0xcf9238fb, 0xdf162ee9, + 0x4b32bcdd, 0x52b26ff5, 0xc364c8f8, 0x60914005, 0xcff3c77d, + 0xdda63ceb, 0xddcd4d07, 0x3b2f25a6, 0x9db64ef5, 0x687f8a39, + 0xb009319e, 0x45ef05c9, 0x2a143e76, 0x9a73626c, 0x582140dd); + VCMP_U32(123, v6, 0x9af29daa, 0x575c2e05, 0xcf7a1d98, 0x26439a12, 0x35659121, + 0xa87678a2, 0x67dd4037, 0xb7600abf, 0xaadc6195, 0x64d90d0c, + 0xcc6da682, 0x8533b185, 0x2a4339cc, 0x7e70281b, 0x4f2ea60f, + 0xbf3b8546, 0x18cbcecd, 0x5bf0c67b, 0x93265d9d, 0x788529c3, + 0x4edd7f48, 0x3266d631, 0x7bfd8a81, 0xa06a42d4, 0xb9272633, + 0xf542d689, 0xf547c96e, 0x17a38eec, 0xca064493, 0x97df3c7a); + VCMP_U32(124, v7, 0x956eb527, 0x68fb4cc5, 0x53a0be4e, 0x785cc853, 0xf7a96b8c, + 0xb11d757e, 0xd29ad01e, 0x2e572002, 0xcefce71b, 0x6c3b54b0, + 0xd8b7ae76, 0xa2cd798c, 0xcf9238fb, 0xdf162ee9, 0x4b32bcdd, + 0x52b26ff5, 0xc364c8f8, 0x60914005, 0xcff3c77d, 0xdda63ceb, + 0xddcd4d07, 0x3b2f25a6, 0x9db64ef5, 0x687f8a39, 0xb009319e, + 0x45ef05c9, 0x2a143e76, 0x9a73626c, 0x582140dd); + VCMP_U32(125, v8, 0x575c2e05, 0xcf7a1d98, 0x26439a12, 0x35659121, 0xa87678a2, + 0x67dd4037, 0xb7600abf, 0xaadc6195, 0x64d90d0c, 0xcc6da682, + 0x8533b185, 0x2a4339cc, 0x7e70281b, 0x4f2ea60f, 0xbf3b8546, + 0x18cbcecd, 0x5bf0c67b, 0x93265d9d, 0x788529c3, 0x4edd7f48, + 0x3266d631, 0x7bfd8a81, 0xa06a42d4, 0xb9272633, 0xf542d689, + 0xf547c96e, 0x17a38eec, 0xca064493, 0x97df3c7a); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 12; + VSET(22, e32, m1); + asm volatile("vlsseg8e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(126, v1, 0xe19afa6b, 0x11ffa54e, 0x956eb527, 0xcf7a1d98, 0x785cc853, + 0xa87678a2, 0xd29ad01e, 0xaadc6195, 0x6c3b54b0, 0x8533b185, + 0xcf9238fb, 0x4f2ea60f, 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, + 0x4edd7f48, 0x3b2f25a6, 0xa06a42d4, 0xb009319e, 0xf547c96e, + 0x9a73626c, 0x97df3c7a); + VCMP_U32(127, v2, 0x8c10145c, 0x82f92af6, 0x575c2e05, 0x53a0be4e, 0x35659121, + 0xb11d757e, 0xb7600abf, 0xcefce71b, 0xcc6da682, 0xa2cd798c, + 0x7e70281b, 0x4b32bcdd, 0x18cbcecd, 0x60914005, 0x788529c3, + 0xddcd4d07, 0x7bfd8a81, 0x687f8a39, 0xf542d689, 0x2a143e76, + 0xca064493); + VCMP_U32(128, v3, 0xbca44cc5, 0x9af29daa, 0x68fb4cc5, 0x26439a12, 0xf7a96b8c, + 0x67dd4037, 0x2e572002, 0x64d90d0c, 0xd8b7ae76, 0x2a4339cc, + 0xdf162ee9, 0xbf3b8546, 0xc364c8f8, 0x93265d9d, 0xdda63ceb, + 0x3266d631, 0x9db64ef5, 0xb9272633, 0x45ef05c9, 0x17a38eec, + 0x582140dd); + VCMP_U32(129, v4, 0x11ffa54e, 0x956eb527, 0xcf7a1d98, 0x785cc853, 0xa87678a2, + 0xd29ad01e, 0xaadc6195, 0x6c3b54b0, 0x8533b185, 0xcf9238fb, + 0x4f2ea60f, 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, 0x4edd7f48, + 0x3b2f25a6, 0xa06a42d4, 0xb009319e, 0xf547c96e, 0x9a73626c, + 0x97df3c7a); + VCMP_U32(130, v5, 0x82f92af6, 0x575c2e05, 0x53a0be4e, 0x35659121, 0xb11d757e, + 0xb7600abf, 0xcefce71b, 0xcc6da682, 0xa2cd798c, 0x7e70281b, + 0x4b32bcdd, 0x18cbcecd, 0x60914005, 0x788529c3, 0xddcd4d07, + 0x7bfd8a81, 0x687f8a39, 0xf542d689, 0x2a143e76, 0xca064493); + VCMP_U32(131, v6, 0x9af29daa, 0x68fb4cc5, 0x26439a12, 0xf7a96b8c, 0x67dd4037, + 0x2e572002, 0x64d90d0c, 0xd8b7ae76, 0x2a4339cc, 0xdf162ee9, + 0xbf3b8546, 0xc364c8f8, 0x93265d9d, 0xdda63ceb, 0x3266d631, + 0x9db64ef5, 0xb9272633, 0x45ef05c9, 0x17a38eec, 0x582140dd); + VCMP_U32(132, v7, 0x956eb527, 0xcf7a1d98, 0x785cc853, 0xa87678a2, 0xd29ad01e, + 0xaadc6195, 0x6c3b54b0, 0x8533b185, 0xcf9238fb, 0x4f2ea60f, + 0x52b26ff5, 0x5bf0c67b, 0xcff3c77d, 0x4edd7f48, 0x3b2f25a6, + 0xa06a42d4, 0xb009319e, 0xf547c96e, 0x9a73626c, 0x97df3c7a); + VCMP_U32(133, v8, 0x575c2e05, 0x53a0be4e, 0x35659121, 0xb11d757e, 0xb7600abf, + 0xcefce71b, 0xcc6da682, 0xa2cd798c, 0x7e70281b, 0x4b32bcdd, + 0x18cbcecd, 0x60914005, 0x788529c3, 0xddcd4d07, 0x7bfd8a81, + 0x687f8a39, 0xf542d689, 0x2a143e76, 0xca064493); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 16; + VSET(16, e32, m1); + asm volatile("vlsseg8e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U32(134, v1, 0xe19afa6b, 0x82f92af6, 0x68fb4cc5, 0x785cc853, 0xb11d757e, + 0x2e572002, 0x6c3b54b0, 0xa2cd798c, 0xdf162ee9, 0x52b26ff5, + 0x60914005, 0xdda63ceb, 0x3b2f25a6, 0x687f8a39, 0x45ef05c9, + 0x9a73626c); + VCMP_U32(135, v2, 0x8c10145c, 0x9af29daa, 0xcf7a1d98, 0x35659121, 0x67dd4037, + 0xaadc6195, 0xcc6da682, 0x2a4339cc, 0x4f2ea60f, 0x18cbcecd, + 0x93265d9d, 0x4edd7f48, 0x7bfd8a81, 0xb9272633, 0xf547c96e, + 0xca064493); + VCMP_U32(136, v3, 0xbca44cc5, 0x956eb527, 0x53a0be4e, 0xf7a96b8c, 0xd29ad01e, + 0xcefce71b, 0xd8b7ae76, 0xcf9238fb, 0x4b32bcdd, 0xc364c8f8, + 0xcff3c77d, 0xddcd4d07, 0x9db64ef5, 0xb009319e, 0x2a143e76, + 0x582140dd); + VCMP_U32(137, v4, 0x11ffa54e, 0x575c2e05, 0x26439a12, 0xa87678a2, 0xb7600abf, + 0x64d90d0c, 0x8533b185, 0x7e70281b, 0xbf3b8546, 0x5bf0c67b, + 0x788529c3, 0x3266d631, 0xa06a42d4, 0xf542d689, 0x17a38eec, + 0x97df3c7a); + VCMP_U32(138, v5, 0x82f92af6, 0x68fb4cc5, 0x785cc853, 0xb11d757e, 0x2e572002, + 0x6c3b54b0, 0xa2cd798c, 0xdf162ee9, 0x52b26ff5, 0x60914005, + 0xdda63ceb, 0x3b2f25a6, 0x687f8a39, 0x45ef05c9, 0x9a73626c); + VCMP_U32(139, v6, 0x9af29daa, 0xcf7a1d98, 0x35659121, 0x67dd4037, 0xaadc6195, + 0xcc6da682, 0x2a4339cc, 0x4f2ea60f, 0x18cbcecd, 0x93265d9d, + 0x4edd7f48, 0x7bfd8a81, 0xb9272633, 0xf547c96e, 0xca064493); + VCMP_U32(140, v7, 0x956eb527, 0x53a0be4e, 0xf7a96b8c, 0xd29ad01e, 0xcefce71b, + 0xd8b7ae76, 0xcf9238fb, 0x4b32bcdd, 0xc364c8f8, 0xcff3c77d, + 0xddcd4d07, 0x9db64ef5, 0xb009319e, 0x2a143e76, 0x582140dd); + VCMP_U32(141, v8, 0x575c2e05, 0x26439a12, 0xa87678a2, 0xb7600abf, 0x64d90d0c, + 0x8533b185, 0x7e70281b, 0xbf3b8546, 0x5bf0c67b, 0x788529c3, + 0x3266d631, 0xa06a42d4, 0xf542d689, 0x17a38eec, 0x97df3c7a); +} + +// Segment-2 +void TEST_CASE1_64(void) { + + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + stride = 0; + VSET(5, e64, m1); + asm volatile("vlsseg2e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(143, v1, 0xfa3a99086b4b64aa, 0xfa3a99086b4b64aa, 0xfa3a99086b4b64aa, + 0xfa3a99086b4b64aa, 0xfa3a99086b4b64aa); + VCMP_U64(144, v2, 0x57bb4a671118fdc0, 0x57bb4a671118fdc0, 0x57bb4a671118fdc0, + 0x57bb4a671118fdc0, 0x57bb4a671118fdc0); + + VSET(-1, e64, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 16; + VSET(32, e64, m1); + asm volatile("vlsseg2e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(145, v1, 0xfa3a99086b4b64aa, 0xbb8df43b65bac0d2, 0x511e175802d24608, + 0xbf1d53ca3e3c6bf7, 0x52edd3cfec205090, 0xfc8e3370b171c315, + 0x9f79ec1cdf33c0bc, 0x52b80462b7e072f9, 0x3216edfad69d8286, + 0x45efda30062c904b, 0xde9483fe82609c40, 0xc4bae94e8d757c0f, + 0x693f603446fb64e6, 0xd77ba2e13e47d589, 0xac730ac471f57a8e, + 0x90c7d0d2a8aa883c, 0x3adf5823d1051252, 0xa96c56ed56947466, + 0xada6b728b9b84f27, 0x2d52c2213e1497ab, 0x5428920ecca684b1, + 0x6f8c8820840f716e, 0x8aac4c04213d26aa, 0x89f5805801f25a66, + 0xb6715b7275106bc1, 0x8ec585926ed7af58, 0x14041ab000c9c396, + 0xdb402f4b0fd38776, 0x76c882042e57f707, 0x5142eb4c19644e7d, + 0x34affa8555d23fd9, 0xf96089370f7fa0a7); + VCMP_U64(146, v2, 0x57bb4a671118fdc0, 0xa41351c301c72b5b, 0x64d7a5514d544e52, + 0xd31ac04eea8ecc07, 0x891a1820b423c29c, 0xa30da5c56e052f67, + 0x5d2c78d9927dfa33, 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, + 0x2b707d3fbaef7019, 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, + 0x42cb1e2132c3d7d5, 0x45887508688c93b2, 0x708ca6623c11c1ff, + 0xdb0427f14bb4d5ba, 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, + 0x9ef5b07ca6742028, 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, + 0x4a2bb5a96b1f24f5, 0xecd584f402152e19, 0xbad7cab9c4062ffc, + 0x53112b0cc2123035, 0xce4722d4b56cd330, 0x928220385ce8c56d, + 0x180002d7d73b1ae2, 0xd13e73308658ad1f, 0x23def41d77db2d38, + 0xa311951efe71188d, 0xb0899dfea0b44c26); + + VSET(-1, e64, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 24; + VSET(22, e64, m1); + asm volatile("vlsseg2e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(149, v1, 0xfa3a99086b4b64aa, 0xa41351c301c72b5b, 0xbf1d53ca3e3c6bf7, + 0x891a1820b423c29c, 0x9f79ec1cdf33c0bc, 0x3e0efee7a99a28e7, + 0x45efda30062c904b, 0x9d5e63fed3019ea6, 0x693f603446fb64e6, + 0x45887508688c93b2, 0x90c7d0d2a8aa883c, 0xc31b51ef18e6dc16, + 0xada6b728b9b84f27, 0x201b60e0fbbc4acd, 0x6f8c8820840f716e, + 0xecd584f402152e19, 0xb6715b7275106bc1, 0xce4722d4b56cd330, + 0xdb402f4b0fd38776, 0xd13e73308658ad1f, 0x34affa8555d23fd9, + 0xb0899dfea0b44c26); + VCMP_U64(150, v2, 0x57bb4a671118fdc0, 0x511e175802d24608, 0xd31ac04eea8ecc07, + 0xfc8e3370b171c315, 0x5d2c78d9927dfa33, 0x3216edfad69d8286, + 0x2b707d3fbaef7019, 0xc4bae94e8d757c0f, 0x42cb1e2132c3d7d5, + 0xac730ac471f57a8e, 0xdb0427f14bb4d5ba, 0xa96c56ed56947466, + 0x9ef5b07ca6742028, 0x5428920ecca684b1, 0x4a2bb5a96b1f24f5, + 0x89f5805801f25a66, 0x53112b0cc2123035, 0x14041ab000c9c396, + 0x180002d7d73b1ae2, 0x5142eb4c19644e7d, 0xa311951efe71188d); + + VSET(-1, e64, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 32; + VSET(16, e64, m1); + asm volatile("vlsseg2e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(151, v1, 0xfa3a99086b4b64aa, 0x511e175802d24608, 0x52edd3cfec205090, + 0x9f79ec1cdf33c0bc, 0x3216edfad69d8286, 0xde9483fe82609c40, + 0x693f603446fb64e6, 0xac730ac471f57a8e, 0x3adf5823d1051252, + 0xada6b728b9b84f27, 0x5428920ecca684b1, 0x8aac4c04213d26aa, + 0xb6715b7275106bc1, 0x14041ab000c9c396, 0x76c882042e57f707, + 0x34affa8555d23fd9); + VCMP_U64(152, v2, 0x57bb4a671118fdc0, 0x64d7a5514d544e52, 0x891a1820b423c29c, + 0x5d2c78d9927dfa33, 0x7409095aa2433e2e, 0x9d5e63fed3019ea6, + 0x42cb1e2132c3d7d5, 0x708ca6623c11c1ff, 0xc31b51ef18e6dc16, + 0x9ef5b07ca6742028, 0xc826aff176ba9a29, 0xecd584f402152e19, + 0x53112b0cc2123035, 0x928220385ce8c56d, 0xd13e73308658ad1f, + 0xa311951efe71188d); +} + +// Segment-3 +void TEST_CASE2_64(void) { + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 16; + VSET(32, e64, m1); + asm volatile("vlsseg3e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(153, v1, 0xfa3a99086b4b64aa, 0xbb8df43b65bac0d2, 0x511e175802d24608, + 0xbf1d53ca3e3c6bf7, 0x52edd3cfec205090, 0xfc8e3370b171c315, + 0x9f79ec1cdf33c0bc, 0x52b80462b7e072f9, 0x3216edfad69d8286, + 0x45efda30062c904b, 0xde9483fe82609c40, 0xc4bae94e8d757c0f, + 0x693f603446fb64e6, 0xd77ba2e13e47d589, 0xac730ac471f57a8e, + 0x90c7d0d2a8aa883c, 0x3adf5823d1051252, 0xa96c56ed56947466, + 0xada6b728b9b84f27, 0x2d52c2213e1497ab, 0x5428920ecca684b1, + 0x6f8c8820840f716e, 0x8aac4c04213d26aa, 0x89f5805801f25a66, + 0xb6715b7275106bc1, 0x8ec585926ed7af58, 0x14041ab000c9c396, + 0xdb402f4b0fd38776, 0x76c882042e57f707, 0x5142eb4c19644e7d, + 0x34affa8555d23fd9, 0xf96089370f7fa0a7); + VCMP_U64(154, v2, 0x57bb4a671118fdc0, 0xa41351c301c72b5b, 0x64d7a5514d544e52, + 0xd31ac04eea8ecc07, 0x891a1820b423c29c, 0xa30da5c56e052f67, + 0x5d2c78d9927dfa33, 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, + 0x2b707d3fbaef7019, 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, + 0x42cb1e2132c3d7d5, 0x45887508688c93b2, 0x708ca6623c11c1ff, + 0xdb0427f14bb4d5ba, 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, + 0x9ef5b07ca6742028, 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, + 0x4a2bb5a96b1f24f5, 0xecd584f402152e19, 0xbad7cab9c4062ffc, + 0x53112b0cc2123035, 0xce4722d4b56cd330, 0x928220385ce8c56d, + 0x180002d7d73b1ae2, 0xd13e73308658ad1f, 0x23def41d77db2d38, + 0xa311951efe71188d, 0xb0899dfea0b44c26); + VCMP_U64(155, v3, 0xbb8df43b65bac0d2, 0x511e175802d24608, 0xbf1d53ca3e3c6bf7, + 0x52edd3cfec205090, 0xfc8e3370b171c315, 0x9f79ec1cdf33c0bc, + 0x52b80462b7e072f9, 0x3216edfad69d8286, 0x45efda30062c904b, + 0xde9483fe82609c40, 0xc4bae94e8d757c0f, 0x693f603446fb64e6, + 0xd77ba2e13e47d589, 0xac730ac471f57a8e, 0x90c7d0d2a8aa883c, + 0x3adf5823d1051252, 0xa96c56ed56947466, 0xada6b728b9b84f27, + 0x2d52c2213e1497ab, 0x5428920ecca684b1, 0x6f8c8820840f716e, + 0x8aac4c04213d26aa, 0x89f5805801f25a66, 0xb6715b7275106bc1, + 0x8ec585926ed7af58, 0x14041ab000c9c396, 0xdb402f4b0fd38776, + 0x76c882042e57f707, 0x5142eb4c19644e7d, 0x34affa8555d23fd9, + 0xf96089370f7fa0a7); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 24; + VSET(22, e64, m1); + asm volatile("vlsseg3e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(156, v1, 0xfa3a99086b4b64aa, 0xa41351c301c72b5b, 0xbf1d53ca3e3c6bf7, + 0x891a1820b423c29c, 0x9f79ec1cdf33c0bc, 0x3e0efee7a99a28e7, + 0x45efda30062c904b, 0x9d5e63fed3019ea6, 0x693f603446fb64e6, + 0x45887508688c93b2, 0x90c7d0d2a8aa883c, 0xc31b51ef18e6dc16, + 0xada6b728b9b84f27, 0x201b60e0fbbc4acd, 0x6f8c8820840f716e, + 0xecd584f402152e19, 0xb6715b7275106bc1, 0xce4722d4b56cd330, + 0xdb402f4b0fd38776, 0xd13e73308658ad1f, 0x34affa8555d23fd9, + 0xb0899dfea0b44c26); + VCMP_U64(157, v2, 0x57bb4a671118fdc0, 0x511e175802d24608, 0xd31ac04eea8ecc07, + 0xfc8e3370b171c315, 0x5d2c78d9927dfa33, 0x3216edfad69d8286, + 0x2b707d3fbaef7019, 0xc4bae94e8d757c0f, 0x42cb1e2132c3d7d5, + 0xac730ac471f57a8e, 0xdb0427f14bb4d5ba, 0xa96c56ed56947466, + 0x9ef5b07ca6742028, 0x5428920ecca684b1, 0x4a2bb5a96b1f24f5, + 0x89f5805801f25a66, 0x53112b0cc2123035, 0x14041ab000c9c396, + 0x180002d7d73b1ae2, 0x5142eb4c19644e7d, 0xa311951efe71188d); + VCMP_U64(158, v3, 0xbb8df43b65bac0d2, 0x64d7a5514d544e52, 0x52edd3cfec205090, + 0xa30da5c56e052f67, 0x52b80462b7e072f9, 0x7409095aa2433e2e, + 0xde9483fe82609c40, 0x7c917722900ef4d8, 0xd77ba2e13e47d589, + 0x708ca6623c11c1ff, 0x3adf5823d1051252, 0x5e0f5c76fdd72450, + 0x2d52c2213e1497ab, 0xc826aff176ba9a29, 0x8aac4c04213d26aa, + 0xbad7cab9c4062ffc, 0x8ec585926ed7af58, 0x928220385ce8c56d, + 0x76c882042e57f707, 0x23def41d77db2d38, 0xf96089370f7fa0a7); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 32; + VSET(16, e64, m1); + asm volatile("vlsseg3e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(159, v1, 0xfa3a99086b4b64aa, 0x511e175802d24608, 0x52edd3cfec205090, + 0x9f79ec1cdf33c0bc, 0x3216edfad69d8286, 0xde9483fe82609c40, + 0x693f603446fb64e6, 0xac730ac471f57a8e, 0x3adf5823d1051252, + 0xada6b728b9b84f27, 0x5428920ecca684b1, 0x8aac4c04213d26aa, + 0xb6715b7275106bc1, 0x14041ab000c9c396, 0x76c882042e57f707, + 0x34affa8555d23fd9); + VCMP_U64(160, v2, 0x57bb4a671118fdc0, 0x64d7a5514d544e52, 0x891a1820b423c29c, + 0x5d2c78d9927dfa33, 0x7409095aa2433e2e, 0x9d5e63fed3019ea6, + 0x42cb1e2132c3d7d5, 0x708ca6623c11c1ff, 0xc31b51ef18e6dc16, + 0x9ef5b07ca6742028, 0xc826aff176ba9a29, 0xecd584f402152e19, + 0x53112b0cc2123035, 0x928220385ce8c56d, 0xd13e73308658ad1f, + 0xa311951efe71188d); + VCMP_U64(161, v3, 0xbb8df43b65bac0d2, 0xbf1d53ca3e3c6bf7, 0xfc8e3370b171c315, + 0x52b80462b7e072f9, 0x45efda30062c904b, 0xc4bae94e8d757c0f, + 0xd77ba2e13e47d589, 0x90c7d0d2a8aa883c, 0xa96c56ed56947466, + 0x2d52c2213e1497ab, 0x6f8c8820840f716e, 0x89f5805801f25a66, + 0x8ec585926ed7af58, 0xdb402f4b0fd38776, 0x5142eb4c19644e7d, + 0xf96089370f7fa0a7); +} + +// Segment-4 +void TEST_CASE3_64(void) { + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 16; + VSET(32, e64, m1); + asm volatile("vlsseg4e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(162, v1, 0xfa3a99086b4b64aa, 0xbb8df43b65bac0d2, 0x511e175802d24608, + 0xbf1d53ca3e3c6bf7, 0x52edd3cfec205090, 0xfc8e3370b171c315, + 0x9f79ec1cdf33c0bc, 0x52b80462b7e072f9, 0x3216edfad69d8286, + 0x45efda30062c904b, 0xde9483fe82609c40, 0xc4bae94e8d757c0f, + 0x693f603446fb64e6, 0xd77ba2e13e47d589, 0xac730ac471f57a8e, + 0x90c7d0d2a8aa883c, 0x3adf5823d1051252, 0xa96c56ed56947466, + 0xada6b728b9b84f27, 0x2d52c2213e1497ab, 0x5428920ecca684b1, + 0x6f8c8820840f716e, 0x8aac4c04213d26aa, 0x89f5805801f25a66, + 0xb6715b7275106bc1, 0x8ec585926ed7af58, 0x14041ab000c9c396, + 0xdb402f4b0fd38776, 0x76c882042e57f707, 0x5142eb4c19644e7d, + 0x34affa8555d23fd9, 0xf96089370f7fa0a7); + VCMP_U64(163, v2, 0x57bb4a671118fdc0, 0xa41351c301c72b5b, 0x64d7a5514d544e52, + 0xd31ac04eea8ecc07, 0x891a1820b423c29c, 0xa30da5c56e052f67, + 0x5d2c78d9927dfa33, 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, + 0x2b707d3fbaef7019, 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, + 0x42cb1e2132c3d7d5, 0x45887508688c93b2, 0x708ca6623c11c1ff, + 0xdb0427f14bb4d5ba, 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, + 0x9ef5b07ca6742028, 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, + 0x4a2bb5a96b1f24f5, 0xecd584f402152e19, 0xbad7cab9c4062ffc, + 0x53112b0cc2123035, 0xce4722d4b56cd330, 0x928220385ce8c56d, + 0x180002d7d73b1ae2, 0xd13e73308658ad1f, 0x23def41d77db2d38, + 0xa311951efe71188d, 0xb0899dfea0b44c26); + VCMP_U64(164, v3, 0xbb8df43b65bac0d2, 0x511e175802d24608, 0xbf1d53ca3e3c6bf7, + 0x52edd3cfec205090, 0xfc8e3370b171c315, 0x9f79ec1cdf33c0bc, + 0x52b80462b7e072f9, 0x3216edfad69d8286, 0x45efda30062c904b, + 0xde9483fe82609c40, 0xc4bae94e8d757c0f, 0x693f603446fb64e6, + 0xd77ba2e13e47d589, 0xac730ac471f57a8e, 0x90c7d0d2a8aa883c, + 0x3adf5823d1051252, 0xa96c56ed56947466, 0xada6b728b9b84f27, + 0x2d52c2213e1497ab, 0x5428920ecca684b1, 0x6f8c8820840f716e, + 0x8aac4c04213d26aa, 0x89f5805801f25a66, 0xb6715b7275106bc1, + 0x8ec585926ed7af58, 0x14041ab000c9c396, 0xdb402f4b0fd38776, + 0x76c882042e57f707, 0x5142eb4c19644e7d, 0x34affa8555d23fd9, + 0xf96089370f7fa0a7); + VCMP_U64(165, v4, 0xa41351c301c72b5b, 0x64d7a5514d544e52, 0xd31ac04eea8ecc07, + 0x891a1820b423c29c, 0xa30da5c56e052f67, 0x5d2c78d9927dfa33, + 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, 0x2b707d3fbaef7019, + 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, 0x42cb1e2132c3d7d5, + 0x45887508688c93b2, 0x708ca6623c11c1ff, 0xdb0427f14bb4d5ba, + 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, 0x9ef5b07ca6742028, + 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, 0x4a2bb5a96b1f24f5, + 0xecd584f402152e19, 0xbad7cab9c4062ffc, 0x53112b0cc2123035, + 0xce4722d4b56cd330, 0x928220385ce8c56d, 0x180002d7d73b1ae2, + 0xd13e73308658ad1f, 0x23def41d77db2d38, 0xa311951efe71188d, + 0xb0899dfea0b44c26); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 24; + VSET(22, e64, m1); + asm volatile("vlsseg4e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(166, v1, 0xfa3a99086b4b64aa, 0xa41351c301c72b5b, 0xbf1d53ca3e3c6bf7, + 0x891a1820b423c29c, 0x9f79ec1cdf33c0bc, 0x3e0efee7a99a28e7, + 0x45efda30062c904b, 0x9d5e63fed3019ea6, 0x693f603446fb64e6, + 0x45887508688c93b2, 0x90c7d0d2a8aa883c, 0xc31b51ef18e6dc16, + 0xada6b728b9b84f27, 0x201b60e0fbbc4acd, 0x6f8c8820840f716e, + 0xecd584f402152e19, 0xb6715b7275106bc1, 0xce4722d4b56cd330, + 0xdb402f4b0fd38776, 0xd13e73308658ad1f, 0x34affa8555d23fd9, + 0xb0899dfea0b44c26); + VCMP_U64(167, v2, 0x57bb4a671118fdc0, 0x511e175802d24608, 0xd31ac04eea8ecc07, + 0xfc8e3370b171c315, 0x5d2c78d9927dfa33, 0x3216edfad69d8286, + 0x2b707d3fbaef7019, 0xc4bae94e8d757c0f, 0x42cb1e2132c3d7d5, + 0xac730ac471f57a8e, 0xdb0427f14bb4d5ba, 0xa96c56ed56947466, + 0x9ef5b07ca6742028, 0x5428920ecca684b1, 0x4a2bb5a96b1f24f5, + 0x89f5805801f25a66, 0x53112b0cc2123035, 0x14041ab000c9c396, + 0x180002d7d73b1ae2, 0x5142eb4c19644e7d, 0xa311951efe71188d); + VCMP_U64(168, v3, 0xbb8df43b65bac0d2, 0x64d7a5514d544e52, 0x52edd3cfec205090, + 0xa30da5c56e052f67, 0x52b80462b7e072f9, 0x7409095aa2433e2e, + 0xde9483fe82609c40, 0x7c917722900ef4d8, 0xd77ba2e13e47d589, + 0x708ca6623c11c1ff, 0x3adf5823d1051252, 0x5e0f5c76fdd72450, + 0x2d52c2213e1497ab, 0xc826aff176ba9a29, 0x8aac4c04213d26aa, + 0xbad7cab9c4062ffc, 0x8ec585926ed7af58, 0x928220385ce8c56d, + 0x76c882042e57f707, 0x23def41d77db2d38, 0xf96089370f7fa0a7); + VCMP_U64(169, v4, 0xa41351c301c72b5b, 0xbf1d53ca3e3c6bf7, 0x891a1820b423c29c, + 0x9f79ec1cdf33c0bc, 0x3e0efee7a99a28e7, 0x45efda30062c904b, + 0x9d5e63fed3019ea6, 0x693f603446fb64e6, 0x45887508688c93b2, + 0x90c7d0d2a8aa883c, 0xc31b51ef18e6dc16, 0xada6b728b9b84f27, + 0x201b60e0fbbc4acd, 0x6f8c8820840f716e, 0xecd584f402152e19, + 0xb6715b7275106bc1, 0xce4722d4b56cd330, 0xdb402f4b0fd38776, + 0xd13e73308658ad1f, 0x34affa8555d23fd9, 0xb0899dfea0b44c26); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 32; + VSET(16, e64, m1); + asm volatile("vlsseg4e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(170, v1, 0xfa3a99086b4b64aa, 0x511e175802d24608, 0x52edd3cfec205090, + 0x9f79ec1cdf33c0bc, 0x3216edfad69d8286, 0xde9483fe82609c40, + 0x693f603446fb64e6, 0xac730ac471f57a8e, 0x3adf5823d1051252, + 0xada6b728b9b84f27, 0x5428920ecca684b1, 0x8aac4c04213d26aa, + 0xb6715b7275106bc1, 0x14041ab000c9c396, 0x76c882042e57f707, + 0x34affa8555d23fd9); + VCMP_U64(171, v2, 0x57bb4a671118fdc0, 0x64d7a5514d544e52, 0x891a1820b423c29c, + 0x5d2c78d9927dfa33, 0x7409095aa2433e2e, 0x9d5e63fed3019ea6, + 0x42cb1e2132c3d7d5, 0x708ca6623c11c1ff, 0xc31b51ef18e6dc16, + 0x9ef5b07ca6742028, 0xc826aff176ba9a29, 0xecd584f402152e19, + 0x53112b0cc2123035, 0x928220385ce8c56d, 0xd13e73308658ad1f, + 0xa311951efe71188d); + VCMP_U64(172, v3, 0xbb8df43b65bac0d2, 0xbf1d53ca3e3c6bf7, 0xfc8e3370b171c315, + 0x52b80462b7e072f9, 0x45efda30062c904b, 0xc4bae94e8d757c0f, + 0xd77ba2e13e47d589, 0x90c7d0d2a8aa883c, 0xa96c56ed56947466, + 0x2d52c2213e1497ab, 0x6f8c8820840f716e, 0x89f5805801f25a66, + 0x8ec585926ed7af58, 0xdb402f4b0fd38776, 0x5142eb4c19644e7d, + 0xf96089370f7fa0a7); + VCMP_U64(173, v4, 0xa41351c301c72b5b, 0xd31ac04eea8ecc07, 0xa30da5c56e052f67, + 0x3e0efee7a99a28e7, 0x2b707d3fbaef7019, 0x7c917722900ef4d8, + 0x45887508688c93b2, 0xdb0427f14bb4d5ba, 0x5e0f5c76fdd72450, + 0x201b60e0fbbc4acd, 0x4a2bb5a96b1f24f5, 0xbad7cab9c4062ffc, + 0xce4722d4b56cd330, 0x180002d7d73b1ae2, 0x23def41d77db2d38, + 0xb0899dfea0b44c26); +} + +// Segment-8 +void TEST_CASE4_64(void) { + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 16; + VSET(32, e64, m1); + asm volatile("vlsseg8e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(174, v1, 0xfa3a99086b4b64aa, 0xbb8df43b65bac0d2, 0x511e175802d24608, + 0xbf1d53ca3e3c6bf7, 0x52edd3cfec205090, 0xfc8e3370b171c315, + 0x9f79ec1cdf33c0bc, 0x52b80462b7e072f9, 0x3216edfad69d8286, + 0x45efda30062c904b, 0xde9483fe82609c40, 0xc4bae94e8d757c0f, + 0x693f603446fb64e6, 0xd77ba2e13e47d589, 0xac730ac471f57a8e, + 0x90c7d0d2a8aa883c, 0x3adf5823d1051252, 0xa96c56ed56947466, + 0xada6b728b9b84f27, 0x2d52c2213e1497ab, 0x5428920ecca684b1, + 0x6f8c8820840f716e, 0x8aac4c04213d26aa, 0x89f5805801f25a66, + 0xb6715b7275106bc1, 0x8ec585926ed7af58, 0x14041ab000c9c396, + 0xdb402f4b0fd38776, 0x76c882042e57f707, 0x5142eb4c19644e7d, + 0x34affa8555d23fd9, 0xf96089370f7fa0a7); + VCMP_U64(175, v2, 0x57bb4a671118fdc0, 0xa41351c301c72b5b, 0x64d7a5514d544e52, + 0xd31ac04eea8ecc07, 0x891a1820b423c29c, 0xa30da5c56e052f67, + 0x5d2c78d9927dfa33, 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, + 0x2b707d3fbaef7019, 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, + 0x42cb1e2132c3d7d5, 0x45887508688c93b2, 0x708ca6623c11c1ff, + 0xdb0427f14bb4d5ba, 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, + 0x9ef5b07ca6742028, 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, + 0x4a2bb5a96b1f24f5, 0xecd584f402152e19, 0xbad7cab9c4062ffc, + 0x53112b0cc2123035, 0xce4722d4b56cd330, 0x928220385ce8c56d, + 0x180002d7d73b1ae2, 0xd13e73308658ad1f, 0x23def41d77db2d38, + 0xa311951efe71188d, 0xb0899dfea0b44c26); + VCMP_U64(176, v3, 0xbb8df43b65bac0d2, 0x511e175802d24608, 0xbf1d53ca3e3c6bf7, + 0x52edd3cfec205090, 0xfc8e3370b171c315, 0x9f79ec1cdf33c0bc, + 0x52b80462b7e072f9, 0x3216edfad69d8286, 0x45efda30062c904b, + 0xde9483fe82609c40, 0xc4bae94e8d757c0f, 0x693f603446fb64e6, + 0xd77ba2e13e47d589, 0xac730ac471f57a8e, 0x90c7d0d2a8aa883c, + 0x3adf5823d1051252, 0xa96c56ed56947466, 0xada6b728b9b84f27, + 0x2d52c2213e1497ab, 0x5428920ecca684b1, 0x6f8c8820840f716e, + 0x8aac4c04213d26aa, 0x89f5805801f25a66, 0xb6715b7275106bc1, + 0x8ec585926ed7af58, 0x14041ab000c9c396, 0xdb402f4b0fd38776, + 0x76c882042e57f707, 0x5142eb4c19644e7d, 0x34affa8555d23fd9, + 0xf96089370f7fa0a7); + VCMP_U64(177, v4, 0xa41351c301c72b5b, 0x64d7a5514d544e52, 0xd31ac04eea8ecc07, + 0x891a1820b423c29c, 0xa30da5c56e052f67, 0x5d2c78d9927dfa33, + 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, 0x2b707d3fbaef7019, + 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, 0x42cb1e2132c3d7d5, + 0x45887508688c93b2, 0x708ca6623c11c1ff, 0xdb0427f14bb4d5ba, + 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, 0x9ef5b07ca6742028, + 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, 0x4a2bb5a96b1f24f5, + 0xecd584f402152e19, 0xbad7cab9c4062ffc, 0x53112b0cc2123035, + 0xce4722d4b56cd330, 0x928220385ce8c56d, 0x180002d7d73b1ae2, + 0xd13e73308658ad1f, 0x23def41d77db2d38, 0xa311951efe71188d, + 0xb0899dfea0b44c26); + VCMP_U64(178, v5, 0x511e175802d24608, 0xbf1d53ca3e3c6bf7, 0x52edd3cfec205090, + 0xfc8e3370b171c315, 0x9f79ec1cdf33c0bc, 0x52b80462b7e072f9, + 0x3216edfad69d8286, 0x45efda30062c904b, 0xde9483fe82609c40, + 0xc4bae94e8d757c0f, 0x693f603446fb64e6, 0xd77ba2e13e47d589, + 0xac730ac471f57a8e, 0x90c7d0d2a8aa883c, 0x3adf5823d1051252, + 0xa96c56ed56947466, 0xada6b728b9b84f27, 0x2d52c2213e1497ab, + 0x5428920ecca684b1, 0x6f8c8820840f716e, 0x8aac4c04213d26aa, + 0x89f5805801f25a66, 0xb6715b7275106bc1, 0x8ec585926ed7af58, + 0x14041ab000c9c396, 0xdb402f4b0fd38776, 0x76c882042e57f707, + 0x5142eb4c19644e7d, 0x34affa8555d23fd9, 0xf96089370f7fa0a7); + VCMP_U64(179, v6, 0x64d7a5514d544e52, 0xd31ac04eea8ecc07, 0x891a1820b423c29c, + 0xa30da5c56e052f67, 0x5d2c78d9927dfa33, 0x3e0efee7a99a28e7, + 0x7409095aa2433e2e, 0x2b707d3fbaef7019, 0x9d5e63fed3019ea6, + 0x7c917722900ef4d8, 0x42cb1e2132c3d7d5, 0x45887508688c93b2, + 0x708ca6623c11c1ff, 0xdb0427f14bb4d5ba, 0xc31b51ef18e6dc16, + 0x5e0f5c76fdd72450, 0x9ef5b07ca6742028, 0x201b60e0fbbc4acd, + 0xc826aff176ba9a29, 0x4a2bb5a96b1f24f5, 0xecd584f402152e19, + 0xbad7cab9c4062ffc, 0x53112b0cc2123035, 0xce4722d4b56cd330, + 0x928220385ce8c56d, 0x180002d7d73b1ae2, 0xd13e73308658ad1f, + 0x23def41d77db2d38, 0xa311951efe71188d, 0xb0899dfea0b44c26); + VCMP_U64(180, v7, 0xbf1d53ca3e3c6bf7, 0x52edd3cfec205090, 0xfc8e3370b171c315, + 0x9f79ec1cdf33c0bc, 0x52b80462b7e072f9, 0x3216edfad69d8286, + 0x45efda30062c904b, 0xde9483fe82609c40, 0xc4bae94e8d757c0f, + 0x693f603446fb64e6, 0xd77ba2e13e47d589, 0xac730ac471f57a8e, + 0x90c7d0d2a8aa883c, 0x3adf5823d1051252, 0xa96c56ed56947466, + 0xada6b728b9b84f27, 0x2d52c2213e1497ab, 0x5428920ecca684b1, + 0x6f8c8820840f716e, 0x8aac4c04213d26aa, 0x89f5805801f25a66, + 0xb6715b7275106bc1, 0x8ec585926ed7af58, 0x14041ab000c9c396, + 0xdb402f4b0fd38776, 0x76c882042e57f707, 0x5142eb4c19644e7d, + 0x34affa8555d23fd9, 0xf96089370f7fa0a7); + VCMP_U64(181, v8, 0xd31ac04eea8ecc07, 0x891a1820b423c29c, 0xa30da5c56e052f67, + 0x5d2c78d9927dfa33, 0x3e0efee7a99a28e7, 0x7409095aa2433e2e, + 0x2b707d3fbaef7019, 0x9d5e63fed3019ea6, 0x7c917722900ef4d8, + 0x42cb1e2132c3d7d5, 0x45887508688c93b2, 0x708ca6623c11c1ff, + 0xdb0427f14bb4d5ba, 0xc31b51ef18e6dc16, 0x5e0f5c76fdd72450, + 0x9ef5b07ca6742028, 0x201b60e0fbbc4acd, 0xc826aff176ba9a29, + 0x4a2bb5a96b1f24f5, 0xecd584f402152e19, 0xbad7cab9c4062ffc, + 0x53112b0cc2123035, 0xce4722d4b56cd330, 0x928220385ce8c56d, + 0x180002d7d73b1ae2, 0xd13e73308658ad1f, 0x23def41d77db2d38, + 0xa311951efe71188d, 0xb0899dfea0b44c26); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 24; + VSET(22, e64, m1); + asm volatile("vlsseg8e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(182, v1, 0xfa3a99086b4b64aa, 0xa41351c301c72b5b, 0xbf1d53ca3e3c6bf7, + 0x891a1820b423c29c, 0x9f79ec1cdf33c0bc, 0x3e0efee7a99a28e7, + 0x45efda30062c904b, 0x9d5e63fed3019ea6, 0x693f603446fb64e6, + 0x45887508688c93b2, 0x90c7d0d2a8aa883c, 0xc31b51ef18e6dc16, + 0xada6b728b9b84f27, 0x201b60e0fbbc4acd, 0x6f8c8820840f716e, + 0xecd584f402152e19, 0xb6715b7275106bc1, 0xce4722d4b56cd330, + 0xdb402f4b0fd38776, 0xd13e73308658ad1f, 0x34affa8555d23fd9, + 0xb0899dfea0b44c26); + VCMP_U64(183, v2, 0x57bb4a671118fdc0, 0x511e175802d24608, 0xd31ac04eea8ecc07, + 0xfc8e3370b171c315, 0x5d2c78d9927dfa33, 0x3216edfad69d8286, + 0x2b707d3fbaef7019, 0xc4bae94e8d757c0f, 0x42cb1e2132c3d7d5, + 0xac730ac471f57a8e, 0xdb0427f14bb4d5ba, 0xa96c56ed56947466, + 0x9ef5b07ca6742028, 0x5428920ecca684b1, 0x4a2bb5a96b1f24f5, + 0x89f5805801f25a66, 0x53112b0cc2123035, 0x14041ab000c9c396, + 0x180002d7d73b1ae2, 0x5142eb4c19644e7d, 0xa311951efe71188d); + VCMP_U64(184, v3, 0xbb8df43b65bac0d2, 0x64d7a5514d544e52, 0x52edd3cfec205090, + 0xa30da5c56e052f67, 0x52b80462b7e072f9, 0x7409095aa2433e2e, + 0xde9483fe82609c40, 0x7c917722900ef4d8, 0xd77ba2e13e47d589, + 0x708ca6623c11c1ff, 0x3adf5823d1051252, 0x5e0f5c76fdd72450, + 0x2d52c2213e1497ab, 0xc826aff176ba9a29, 0x8aac4c04213d26aa, + 0xbad7cab9c4062ffc, 0x8ec585926ed7af58, 0x928220385ce8c56d, + 0x76c882042e57f707, 0x23def41d77db2d38, 0xf96089370f7fa0a7); + VCMP_U64(185, v4, 0xa41351c301c72b5b, 0xbf1d53ca3e3c6bf7, 0x891a1820b423c29c, + 0x9f79ec1cdf33c0bc, 0x3e0efee7a99a28e7, 0x45efda30062c904b, + 0x9d5e63fed3019ea6, 0x693f603446fb64e6, 0x45887508688c93b2, + 0x90c7d0d2a8aa883c, 0xc31b51ef18e6dc16, 0xada6b728b9b84f27, + 0x201b60e0fbbc4acd, 0x6f8c8820840f716e, 0xecd584f402152e19, + 0xb6715b7275106bc1, 0xce4722d4b56cd330, 0xdb402f4b0fd38776, + 0xd13e73308658ad1f, 0x34affa8555d23fd9, 0xb0899dfea0b44c26); + VCMP_U64(186, v5, 0x511e175802d24608, 0xd31ac04eea8ecc07, 0xfc8e3370b171c315, + 0x5d2c78d9927dfa33, 0x3216edfad69d8286, 0x2b707d3fbaef7019, + 0xc4bae94e8d757c0f, 0x42cb1e2132c3d7d5, 0xac730ac471f57a8e, + 0xdb0427f14bb4d5ba, 0xa96c56ed56947466, 0x9ef5b07ca6742028, + 0x5428920ecca684b1, 0x4a2bb5a96b1f24f5, 0x89f5805801f25a66, + 0x53112b0cc2123035, 0x14041ab000c9c396, 0x180002d7d73b1ae2, + 0x5142eb4c19644e7d, 0xa311951efe71188d); + VCMP_U64(187, v6, 0x64d7a5514d544e52, 0x52edd3cfec205090, 0xa30da5c56e052f67, + 0x52b80462b7e072f9, 0x7409095aa2433e2e, 0xde9483fe82609c40, + 0x7c917722900ef4d8, 0xd77ba2e13e47d589, 0x708ca6623c11c1ff, + 0x3adf5823d1051252, 0x5e0f5c76fdd72450, 0x2d52c2213e1497ab, + 0xc826aff176ba9a29, 0x8aac4c04213d26aa, 0xbad7cab9c4062ffc, + 0x8ec585926ed7af58, 0x928220385ce8c56d, 0x76c882042e57f707, + 0x23def41d77db2d38, 0xf96089370f7fa0a7); + VCMP_U64(188, v7, 0xbf1d53ca3e3c6bf7, 0x891a1820b423c29c, 0x9f79ec1cdf33c0bc, + 0x3e0efee7a99a28e7, 0x45efda30062c904b, 0x9d5e63fed3019ea6, + 0x693f603446fb64e6, 0x45887508688c93b2, 0x90c7d0d2a8aa883c, + 0xc31b51ef18e6dc16, 0xada6b728b9b84f27, 0x201b60e0fbbc4acd, + 0x6f8c8820840f716e, 0xecd584f402152e19, 0xb6715b7275106bc1, + 0xce4722d4b56cd330, 0xdb402f4b0fd38776, 0xd13e73308658ad1f, + 0x34affa8555d23fd9, 0xb0899dfea0b44c26); + VCMP_U64(189, v8, 0xd31ac04eea8ecc07, 0xfc8e3370b171c315, 0x5d2c78d9927dfa33, + 0x3216edfad69d8286, 0x2b707d3fbaef7019, 0xc4bae94e8d757c0f, + 0x42cb1e2132c3d7d5, 0xac730ac471f57a8e, 0xdb0427f14bb4d5ba, + 0xa96c56ed56947466, 0x9ef5b07ca6742028, 0x5428920ecca684b1, + 0x4a2bb5a96b1f24f5, 0x89f5805801f25a66, 0x53112b0cc2123035, + 0x14041ab000c9c396, 0x180002d7d73b1ae2, 0x5142eb4c19644e7d, + 0xa311951efe71188d); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 32; + VSET(16, e64, m1); + asm volatile("vlsseg8e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + VCMP_U64(190, v1, 0xfa3a99086b4b64aa, 0x511e175802d24608, 0x52edd3cfec205090, + 0x9f79ec1cdf33c0bc, 0x3216edfad69d8286, 0xde9483fe82609c40, + 0x693f603446fb64e6, 0xac730ac471f57a8e, 0x3adf5823d1051252, + 0xada6b728b9b84f27, 0x5428920ecca684b1, 0x8aac4c04213d26aa, + 0xb6715b7275106bc1, 0x14041ab000c9c396, 0x76c882042e57f707, + 0x34affa8555d23fd9); + VCMP_U64(191, v2, 0x57bb4a671118fdc0, 0x64d7a5514d544e52, 0x891a1820b423c29c, + 0x5d2c78d9927dfa33, 0x7409095aa2433e2e, 0x9d5e63fed3019ea6, + 0x42cb1e2132c3d7d5, 0x708ca6623c11c1ff, 0xc31b51ef18e6dc16, + 0x9ef5b07ca6742028, 0xc826aff176ba9a29, 0xecd584f402152e19, + 0x53112b0cc2123035, 0x928220385ce8c56d, 0xd13e73308658ad1f, + 0xa311951efe71188d); + VCMP_U64(192, v3, 0xbb8df43b65bac0d2, 0xbf1d53ca3e3c6bf7, 0xfc8e3370b171c315, + 0x52b80462b7e072f9, 0x45efda30062c904b, 0xc4bae94e8d757c0f, + 0xd77ba2e13e47d589, 0x90c7d0d2a8aa883c, 0xa96c56ed56947466, + 0x2d52c2213e1497ab, 0x6f8c8820840f716e, 0x89f5805801f25a66, + 0x8ec585926ed7af58, 0xdb402f4b0fd38776, 0x5142eb4c19644e7d, + 0xf96089370f7fa0a7); + VCMP_U64(193, v4, 0xa41351c301c72b5b, 0xd31ac04eea8ecc07, 0xa30da5c56e052f67, + 0x3e0efee7a99a28e7, 0x2b707d3fbaef7019, 0x7c917722900ef4d8, + 0x45887508688c93b2, 0xdb0427f14bb4d5ba, 0x5e0f5c76fdd72450, + 0x201b60e0fbbc4acd, 0x4a2bb5a96b1f24f5, 0xbad7cab9c4062ffc, + 0xce4722d4b56cd330, 0x180002d7d73b1ae2, 0x23def41d77db2d38, + 0xb0899dfea0b44c26); + VCMP_U64(194, v5, 0x511e175802d24608, 0x52edd3cfec205090, 0x9f79ec1cdf33c0bc, + 0x3216edfad69d8286, 0xde9483fe82609c40, 0x693f603446fb64e6, + 0xac730ac471f57a8e, 0x3adf5823d1051252, 0xada6b728b9b84f27, + 0x5428920ecca684b1, 0x8aac4c04213d26aa, 0xb6715b7275106bc1, + 0x14041ab000c9c396, 0x76c882042e57f707, 0x34affa8555d23fd9); + VCMP_U64(195, v6, 0x64d7a5514d544e52, 0x891a1820b423c29c, 0x5d2c78d9927dfa33, + 0x7409095aa2433e2e, 0x9d5e63fed3019ea6, 0x42cb1e2132c3d7d5, + 0x708ca6623c11c1ff, 0xc31b51ef18e6dc16, 0x9ef5b07ca6742028, + 0xc826aff176ba9a29, 0xecd584f402152e19, 0x53112b0cc2123035, + 0x928220385ce8c56d, 0xd13e73308658ad1f, 0xa311951efe71188d); + VCMP_U64(196, v7, 0xbf1d53ca3e3c6bf7, 0xfc8e3370b171c315, 0x52b80462b7e072f9, + 0x45efda30062c904b, 0xc4bae94e8d757c0f, 0xd77ba2e13e47d589, + 0x90c7d0d2a8aa883c, 0xa96c56ed56947466, 0x2d52c2213e1497ab, + 0x6f8c8820840f716e, 0x89f5805801f25a66, 0x8ec585926ed7af58, + 0xdb402f4b0fd38776, 0x5142eb4c19644e7d, 0xf96089370f7fa0a7); + VCMP_U64(197, v8, 0xd31ac04eea8ecc07, 0xa30da5c56e052f67, 0x3e0efee7a99a28e7, + 0x2b707d3fbaef7019, 0x7c917722900ef4d8, 0x45887508688c93b2, + 0xdb0427f14bb4d5ba, 0x5e0f5c76fdd72450, 0x201b60e0fbbc4acd, + 0x4a2bb5a96b1f24f5, 0xbad7cab9c4062ffc, 0xce4722d4b56cd330, + 0x180002d7d73b1ae2, 0x23def41d77db2d38, 0xb0899dfea0b44c26); +} + +// Segment-4 +void TEST_CASE3_32_m(void) { + VSET(-1, e32, m1); + volatile uint32_t INP1[] = { + 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, 0x82f92af6, 0x9af29daa, + 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, 0x53a0be4e, 0x26439a12, + 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, 0xb11d757e, 0x67dd4037, + 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, 0xcefce71b, 0x64d90d0c, + 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, 0xa2cd798c, 0x2a4339cc, + 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, 0x4b32bcdd, 0xbf3b8546, + 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, 0x60914005, 0x93265d9d, + 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, 0xddcd4d07, 0x3266d631, + 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, 0x687f8a39, 0xb9272633, + 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, 0x2a143e76, 0x17a38eec, + 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + stride = 16; + VSET(2, e32, m1); + VLOAD_8(v0, 0x0F, 0xAA); + VSET(16, e32, m1); + asm volatile("vlsseg4e32.v v1, (%0), %1, v0.t" ::"r"(INP1), "r"(stride)); + VCMP_U32(198, v1, 0xe19afa6b, 0x82f92af6, 0x68fb4cc5, 0x785cc853, 0, 0, 0, 0, + 0, 0x52b26ff5, 0, 0xdda63ceb, 0, 0x687f8a39, 0, 0x9a73626c); + VCMP_U32(199, v2, 0x8c10145c, 0x9af29daa, 0xcf7a1d98, 0x35659121, 0, 0, 0, 0, + 0, 0x18cbcecd, 0, 0x4edd7f48, 0, 0xb9272633, 0, 0xca064493); + VCMP_U32(200, v3, 0xbca44cc5, 0x956eb527, 0x53a0be4e, 0xf7a96b8c, 0, 0, 0, 0, + 0, 0xc364c8f8, 0, 0xddcd4d07, 0, 0xb009319e, 0, 0x582140dd); + VCMP_U32(201, v4, 0x11ffa54e, 0x575c2e05, 0x26439a12, 0xa87678a2, 0, 0, 0, 0, + 0, 0x5bf0c67b, 0, 0x3266d631, 0, 0xf542d689, 0, 0x97df3c7a); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1_8(); + TEST_CASE2_8(); + TEST_CASE3_8(); + TEST_CASE4_8(); + + TEST_CASE1_16(); + TEST_CASE2_16(); + TEST_CASE3_16(); + TEST_CASE4_16(); + + TEST_CASE1_32(); + TEST_CASE2_32(); + TEST_CASE3_32(); + TEST_CASE4_32(); + + TEST_CASE1_64(); + TEST_CASE2_64(); + TEST_CASE3_64(); + TEST_CASE4_64(); + + // TEST_CASE3_32_m(); // Todo: fix masked mem ops + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vluxei.c b/apps/riscv-tests/isa/rv64uv/vluxei.c new file mode 100644 index 0000000..dea1f33 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vluxei.c @@ -0,0 +1,206 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +static volatile uint8_t ALIGNED_I8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, + 0x88, 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89}; + +static volatile uint16_t ALIGNED_I16[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989}; + +static volatile uint32_t ALIGNED_I32[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, 0x90139301, 0xab8b9148, + 0x90318509, 0x31897598, 0x83195999, 0x89139848}; + +static volatile uint64_t ALIGNED_I64[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989}; + +// EEW destination == EEW indexes +void TEST_CASE1(void) { + VSET(2, e8, m1); + VLOAD_8(v2, 1, 15); + asm volatile("vluxei8.v v1, (%0), v2" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(1, v1, 0xd3, 0x89); + + VSET(2, e16, m1); + VLOAD_16(v2, 2, 30); + asm volatile("vluxei16.v v1, (%0), v2" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(2, v1, 0xbbd3, 0x1989); + + VSET(2, e32, m1); + VLOAD_32(v2, 4, 60); + asm volatile("vluxei32.v v1, (%0), v2" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(3, v1, 0xf9aa71f0, 0x89139848); + + VSET(2, e64, m1); + VLOAD_64(v2, 8, 120); + asm volatile("vluxei64.v v1, (%0), v2" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(4, v1, 0xf9aa71f0c394bbd3, 0x8913984898951989); +} + +// EEW Destination > EEW indexes +void TEST_CASE2(void) { + VSET(2, e16, m1); + VLOAD_8(v2, 2, 30); + asm volatile("vluxei8.v v1, (%0), v2" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(5, v1, 0xbbd3, 0x1989); + + VSET(2, e32, m1); + VLOAD_16(v2, 4, 60); + asm volatile("vluxei16.v v1, (%0), v2" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(6, v1, 0xf9aa71f0, 0x89139848); + + VSET(2, e64, m1); + VLOAD_32(v2, 8, 120); + asm volatile("vluxei32.v v1, (%0), v2" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(7, v1, 0xf9aa71f0c394bbd3, 0x8913984898951989); +} + +// EEW Destination < EEW indexes +void TEST_CASE3(void) { + VSET(2, e8, m1); + VLOAD_16(v2, 1, 15); + asm volatile("vluxei16.v v1, (%0), v2" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(8, v1, 0xd3, 0x89); + + VSET(2, e16, m1); + VLOAD_32(v2, 2, 30); + asm volatile("vluxei32.v v1, (%0), v2" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(9, v1, 0xbbd3, 0x1989); + + VSET(2, e32, m1); + VLOAD_64(v2, 4, 60); + asm volatile("vluxei64.v v1, (%0), v2" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(10, v1, 0xf9aa71f0, 0x89139848); +} + +// Naive, masked +void TEST_CASE4(void) { + VSET(2, e8, m1); + VLOAD_8(v1, 99, 99); + VLOAD_8(v2, 1, 15); + VLOAD_8(v0, 0xAA); + asm volatile("vluxei8.v v1, (%0), v2, v0.t" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(11, v1, 99, 0x89); + + VSET(2, e16, m1); + VLOAD_16(v1, 999, 999); + VLOAD_16(v2, 2, 30); + VLOAD_8(v0, 0xAA); + asm volatile("vluxei16.v v1, (%0), v2, v0.t" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(12, v1, 999, 0x1989); + + VSET(2, e32, m1); + VLOAD_32(v1, 999, 999); + VLOAD_32(v2, 4, 60); + VLOAD_8(v0, 0xAA); + asm volatile("vluxei32.v v1, (%0), v2, v0.t" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(13, v1, 999, 0x89139848); + + VSET(2, e64, m1); + VLOAD_64(v1, 999, 999); + VLOAD_64(v2, 8, 120); + VLOAD_8(v0, 0xAA); + asm volatile("vluxei64.v v1, (%0), v2, v0.t" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(14, v1, 999, 0x8913984898951989); +} + +// EEW destination == EEW indexes, many elements +void TEST_CASE5(void) { + VSET(12, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 13, 15); + asm volatile("vluxei8.v v1, (%0), v2" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(15, v1, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x88, 0x88, 0xae, 0x91, 0x02, + 0x59, 0x89); + + VSET(12, e16, m1); + VLOAD_16(v2, 2, 4, 6, 8, 10, 14, 16, 18, 22, 24, 26, 30); + asm volatile("vluxei16.v v1, (%0), v2" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(16, v1, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x9388, 0x8188, + 0x11ae, 0x4891, 0x4902, 0x8759, 0x1989); + + VSET(12, e32, m1); + VLOAD_32(v2, 4, 8, 12, 16, 20, 28, 32, 36, 44, 48, 52, 60); + asm volatile("vluxei32.v v1, (%0), v2" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(17, v1, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x81937598, 0x18747547, 0x3eeeeeee, 0xab8b9148, 0x90318509, + 0x31897598, 0x89139848); + + VSET(12, e64, m1); + VLOAD_64(v2, 8, 16, 24, 32, 40, 56, 64, 72, 88, 96, 104, 120); + asm volatile("vluxei64.v v1, (%0), v2" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(18, v1, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8913984898951989); +} + +// Test vstart +void TEST_CASE6(void) { + VSET(-1, e8, m1); + VCLEAR(v1); + VSET(5, e8, m1); + VLOAD_8(v2, 1, 15, 1, 3, 10); + // Modify vstart val + asm volatile("csrs vstart, %0" ::"r"(1)); + asm volatile("vluxei8.v v1, (%0), v2" ::"r"(&ALIGNED_I8[0])); + VCMP_U8(19, v1, 0, 0x89, 0xd3, 0xd1, 0x08); + + VSET(-1, e16, m1); + VCLEAR(v1); + VSET(16, e16, m1); + VLOAD_16(v2, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30); + asm volatile("csrs vstart, %0" ::"r"(5)); + asm volatile("vluxei16.v v1, (%0), v2" ::"r"(&ALIGNED_I16[0])); + VCMP_U16(20, v1, 0, 0, 0, 0, 0, 0x7548, 0x3489, 0x9388, 0x8188, 0x11ae, + 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + + VSET(-1, e32, m1); + VCLEAR(v1); + VSET(3, e32, m1); + VLOAD_32(v2, 4, 60, 4); + asm volatile("csrs vstart, %0" ::"r"(2)); + asm volatile("vluxei32.v v1, (%0), v2" ::"r"(&ALIGNED_I32[0])); + VCMP_U32(21, v1, 0, 0, 0xf9aa71f0); + + VSET(-1, e64, m1); + VCLEAR(v1); + VSET(8, e64, m1); + VLOAD_64(v2, 8, 120, 8, 8, 8, 8, 120, 0); + asm volatile("csrs vstart, %0" ::"r"(3)); + asm volatile("vluxei64.v v1, (%0), v2" ::"r"(&ALIGNED_I64[0])); + VCMP_U64(22, v1, 0, 0, 0, 0xf9aa71f0c394bbd3, 0xf9aa71f0c394bbd3, + 0xf9aa71f0c394bbd3, 0x8913984898951989, 0x9fe419208f2e05e0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vluxseg.c b/apps/riscv-tests/isa/rv64uv/vluxseg.c new file mode 100644 index 0000000..2537b5d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vluxseg.c @@ -0,0 +1,145 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Segment-2 +void TEST_CASE1_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VLOAD_8(v24, 1, 1, 0, 2); + asm volatile("vluxseg2ei8.v v1, (%0), v24" ::"r"(INP1)); + VCMP_U8(1, v1, 0xe4, 0xe4, 0x9f, 0x19); + VCMP_U8(2, v2, 0x19, 0x19, 0xe4, 0x20); +} + +// Segment-3 +void TEST_CASE2_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VLOAD_16(v24, 0, 1, 0, 3); + asm volatile("vluxseg3ei16.v v1, (%0), v24" ::"r"(INP1)); + VCMP_U8(3, v1, 0x9f, 0xe4, 0x9f, 0x20); + VCMP_U8(4, v2, 0xe4, 0x19, 0xe4, 0x8f); + VCMP_U8(5, v3, 0x19, 0x20, 0x19, 0x2e); +} + +// Segment-4 +void TEST_CASE3_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VLOAD_64(v24, 1, 1, 0, 5); + asm volatile("vluxseg4ei64.v v1, (%0), v24" ::"r"(INP1)); + VCMP_U8(6, v1, 0xe4, 0xe4, 0x9f, 0x2e); + VCMP_U8(7, v2, 0x19, 0x19, 0xe4, 0x05); + VCMP_U8(8, v3, 0x20, 0x20, 0x19, 0xe0); + VCMP_U8(9, v4, 0x8f, 0x8f, 0x20, 0xf9); +} + +// Segment-4 for 64-bit +void TEST_CASE3_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VLOAD_8(v24, 8, 8, 0, 40); + asm volatile("vluxseg4ei8.v v1, (%0), v24" ::"r"(INP1)); + VCMP_U64(10, v1, 0xf9aa71f0c394bbd3, 0xf9aa71f0c394bbd3, 0x9fe419208f2e05e0, + 0x0123456789abcdef); + VCMP_U64(11, v2, 0x123456789abcdef0, 0x123456789abcdef0, 0xf9aa71f0c394bbd3, + 0x55aa55aa77889900); + VCMP_U64(12, v3, 0x13572468369b48ac, 0x13572468369b48ac, 0x123456789abcdef0, + 0xabcdef1234567890); + VCMP_U64(13, v4, 0xdeadbeefcafebabe, 0xdeadbeefcafebabe, 0x13572468369b48ac, + 0xfeedfacecafebabe); +} + +// Segment-8 for 64-bit +void TEST_CASE4_64_m(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_8(v24, 8, 32); + asm volatile("vluxseg8ei8.v v1, (%0), v24, v0.t" ::"r"(INP1)); + VCMP_U64(14, v1, 0, 0xdeadbeefcafebabe); + VCMP_U64(15, v2, 0, 0x0123456789abcdef); + VCMP_U64(16, v3, 0, 0x55aa55aa77889900); + VCMP_U64(17, v4, 0, 0xabcdef1234567890); + VCMP_U64(18, v5, 0, 0xfeedfacecafebabe); + VCMP_U64(19, v6, 0, 0x123456789abcdef0); + VCMP_U64(20, v7, 0, 0x1357246855aa55aa); + VCMP_U64(21, v8, 0, 0x369b48acdeadbeef); + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xA1, 0xAA); + VLOAD_32(v24, 8, 32); + asm volatile("vluxseg8ei32.v v1, (%0), v24, v0.t" ::"r"(INP1)); + VCMP_U64(22, v1, 0xf9aa71f0c394bbd3, 0); + VCMP_U64(23, v2, 0x123456789abcdef0, 0); + VCMP_U64(24, v3, 0x13572468369b48ac, 0); + VCMP_U64(25, v4, 0xdeadbeefcafebabe, 0); + VCMP_U64(26, v5, 0x0123456789abcdef, 0); + VCMP_U64(27, v6, 0x55aa55aa77889900, 0); + VCMP_U64(28, v7, 0xabcdef1234567890, 0); + VCMP_U64(29, v8, 0xfeedfacecafebabe, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1_8(); + TEST_CASE2_8(); + TEST_CASE3_8(); + + TEST_CASE3_64(); + + // Masked + TEST_CASE4_64_m(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vlx.c b/apps/riscv-tests/isa/rv64uv/vlx.c new file mode 100644 index 0000000..a56f5b1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vlx.c @@ -0,0 +1,101 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e8, m1); + VLOAD_U8(v2, 0, 1, 2, 3); + volatile uint8_t INP[] = {0xff, 0x00, 0x0f, 0xf0}; + MEMBARRIER; + __asm__ volatile("vlxei8.v v1, (%0), v2" ::"r"(INP)); + VEC_CMP_U8(1, v1, 0xff, 0x00, 0x0f, 0xf0); +} + +// void TEST_CASE2(void) { +// VSET(4,e8,m1); +// VLOAD_8(v2,0,1,2,3); +// volatile int8_t INP[] = {0xff, 0x00, 0x0f, 0xf0}; +// VLOAD_8(v0,0x5,0x0,0x0,0x0); +// CLEAR(v1); +// __asm__ volatile ("vlxei8.v v1, (%0), v2, v0.t"::"r" (INP)); +// VEC_CMP_8(2,v1,0xff, 0x00, 0x0f,0x00); +// } + +void TEST_CASE3(void) { + VSET(3, e16, m1); + VLOAD_U16(v2, 0, 2, 4); + volatile uint16_t INP[] = {0xffff, 0x0000, 0x0f0f, 0xf0f0}; + MEMBARRIER; + __asm__ volatile("vlxei16.v v1, (%0), v2" ::"r"(INP)); + VEC_CMP_U16(3, v1, 0xffff, 0x0000, 0x0f0f); +} + +// void TEST_CASE4(void) { +// VSET(3,e16,m1); +// VLOAD_16(v2,0,2,4); +// volatile int16_t INP[] = {0xffff, 0x0000, 0x0f0f, 0xf0f0}; +// VLOAD_16(v0,0x5,0x0,0x0,0x0); +// CLEAR(v1); +// __asm__ volatile ("vlxei16.v v1, (%0), v2, v0.t"::"r" (INP)); +// VEC_CMP_16(4,v1,0xffff, 0x0000, 0x0f0f); +// } + +void TEST_CASE5(void) { + VSET(4, e32, m1); + VLOAD_U32(v2, 0, 4, 8, 12); + volatile uint32_t INP[] = {0xffffffff, 0x00000000, 0x0f0f0f0f, 0xf0f0f0f0}; + MEMBARRIER; + __asm__ volatile("vlxei32.v v1, (%0), v2" ::"r"(INP)); + VEC_CMP_U32(5, v1, 0xffffffff, 0x00000000, 0x0f0f0f0f, 0xf0f0f0f0); +} + +// void TEST_CASE6(void) { +// VSET(4,e32,m1); +// VLOAD_32(v2,0,4,8,12); +// volatile int32_t INP[] = {0xffffffff, 0x80000000, 0x0f0f0f0f, 0xf0f0f0f0}; +// VLOAD_32(v0,0x5,0x0,0x0,0x0); +// CLEAR(v1); +// __asm__ volatile (" vlxei32.v v1, (%0), v2, v0.t \n" :: "r" (INP)); +// VEC_CMP_32(6,v1,0xffffffff, 0x0, 0x0f0f0f0f, 0x0); +// } + +void TEST_CASE7(void) { + VSET(4, e64, m1); + VLOAD_U64(v2, 0, 8, 16, 24); + volatile uint64_t INP[] = {0xdeadbeefffffffff, 0xdeadbeef00000000, + 0xdeadbeef0f0f0f0f, 0xdeadbeeff0f0f0f0}; + MEMBARRIER; + __asm__ volatile("vlxei64.v v1,(%0), v2" ::"r"(INP)); + VEC_CMP_U64(7, v1, 0xdeadbeefffffffff, 0xdeadbeef00000000, 0xdeadbeef0f0f0f0f, + 0xdeadbeeff0f0f0f0); +} + +// void TEST_CASE8(void) { +// VSET(4,e64,m1); +// VLOAD_64(v2,0,8,16,24); +// volatile int64_t INP[] = +// {0xdeadbeefffffffff,0xdeadbeef00000000,0xdeadbeef0f0f0f0f,0xdeadbeeff0f0f0f0}; +// VLOAD_64(v0,0x5,0x0,0x0,0x0); +// CLEAR(v1); +// __asm__ volatile ("vlxei64.v v1,(%0), v2, v0.t"::"r" (INP)); +// VEC_CMP_64(8,v1,0xdeadbeefffffffff,0x0000000000000000,0xdeadbeef0f0f0f0f,0x0000000000000000); +// } + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE3(); + TEST_CASE5(); + TEST_CASE7(); + // TEST_CASE2(); + // TEST_CASE4(); + // TEST_CASE6(); + // TEST_CASE8(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmacc.c b/apps/riscv-tests/isa/rv64uv/vmacc.c new file mode 100644 index 0000000..8804dd5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmacc.c @@ -0,0 +1,292 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v3, 0x21, 0x75, 0x7f, 0x3a, 0x50, 0x6d, 0x3f, 0x3e, 0x74, 0x11, 0x29, + 0xea, 0x14, 0xce, 0xb0, 0x37); + VLOAD_8(v2, 0xfe, 0xa7, 0x06, 0xaa, 0x35, 0x3c, 0x2c, 0x58, 0xa1, 0xc4, 0x40, + 0x42, 0x52, 0x40, 0xa8, 0x53); + VLOAD_8(v1, 0x30, 0xef, 0xb4, 0x12, 0x6d, 0x3b, 0x2c, 0x5e, 0xf0, 0x25, 0xd7, + 0x70, 0xc2, 0x62, 0xe0, 0x99); + asm volatile("vmacc.vv v1, v2, v3"); + VCMP_U8(1, v1, 0xee, 0x42, 0xae, 0x96, 0xfd, 0xc7, 0x00, 0xae, 0xe4, 0x29, + 0x17, 0xc4, 0x2a, 0xe2, 0x60, 0x6e); + + VSET(16, e16, m1); + VLOAD_16(v3, 0x1c20, 0x11e4, 0xde38, 0x642f, 0x3eb5, 0xa0af, 0x48e1, 0x5fc4, + 0x3d2a, 0x67d5, 0x3f07, 0x2889, 0x8812, 0x0bd9, 0x56f4, 0xe068); + VLOAD_16(v2, 0x02cc, 0xd99c, 0xdba2, 0xf282, 0x0f99, 0xa219, 0x2dcc, 0x17cc, + 0xe8fb, 0x1e83, 0xed20, 0xbfee, 0xee87, 0x6b0f, 0xf6cf, 0x4cd1); + VLOAD_16(v1, 0xe3f0, 0x42db, 0x2fde, 0x1983, 0x910c, 0x853b, 0x82aa, 0x9ac2, + 0x4631, 0x1f8b, 0x68c3, 0x6fbc, 0x3b5c, 0xf98b, 0x2db1, 0x8e75); + asm volatile("vmacc.vv v1, v2, v3"); + VCMP_U16(2, v1, 0x8d70, 0x6dcb, 0xb74e, 0x6761, 0xa639, 0xf452, 0x22f6, + 0x86f2, 0x4e5f, 0x378a, 0xc4a3, 0x561a, 0xb8da, 0x5e42, 0xf4fd, + 0xa35d); + + VSET(16, e32, m1); + VLOAD_32(v3, 0x0401c584, 0x69049955, 0x4a71aa0c, 0xc651666f, 0x273fcd5d, + 0x23ca1d7d, 0x599c994e, 0xb2d8adc5, 0x4710afae, 0x69c61cad, + 0x96ee5026, 0x2c197996, 0xd95da451, 0x3a654fb9, 0xbe990e4b, + 0xc41fd55a); + VLOAD_32(v2, 0x39d5b56a, 0xc578a540, 0x51283b5c, 0x07b4ba9d, 0xe5aba5e4, + 0x28720dc8, 0x600fb42b, 0xf2937fa7, 0x4032d36f, 0xc676e3b3, + 0xf1cd5f96, 0x1c14bcbf, 0x7dea81ed, 0x40270562, 0x9577b3be, + 0xea615f0a); + VLOAD_32(v1, 0xa055bbb6, 0x71f9a668, 0x0be640c9, 0x2336ca55, 0xca121638, + 0xbf234fb5, 0xe7c83142, 0xb7048f12, 0x8eb340e3, 0xef253e93, + 0xffef4a03, 0xdf346833, 0xd0922181, 0xf159ee1d, 0xf86a7c06, + 0xfcb24a2d); + asm volatile("vmacc.vv v1, v2, v3"); + VCMP_U32(3, v1, 0x448bd85e, 0xf2cbc4a8, 0x5cd02119, 0xf69b4268, 0x3c60ee0c, + 0xa233b25d, 0x4c72c95c, 0xe2b1a595, 0xefb7d755, 0x95d6b28a, + 0xd3be5a47, 0x6338471d, 0xfb1a117e, 0xabe00fef, 0xbede88b0, + 0x913705b1); + + VSET(16, e64, m1); + VLOAD_64(v3, 0x9cffef345b95f00b, 0x85d366e07e4bbc6b, 0xadfda1d2464c6433, + 0x610bf2c1435b3cf6, 0x8a0c6e4bc950e81f, 0x4296e7147ef94d7a, + 0x27d7ec90ba159756, 0x2a6c87932c3aef86, 0xbfd90c33e58a8fe3, + 0x1114f7672cf625c1, 0x1a7b72dd8ac39fab, 0xdb80f952e5fd2e5b, + 0x6b01c18a3daf288b, 0x69b4b0e4335f26d5, 0x0c059f365ec6d3d5, + 0xc22568276f1dcdd0); + VLOAD_64(v2, 0x6dc8e88769e54465, 0xce8cda83d16c3859, 0x1465ee5b6eb0d2b8, + 0x4827a9b40add2507, 0xd24c4005695a64d6, 0xb97c8e41e912f84a, + 0xc8c22e3b3b2e2fa1, 0x26712aa325bd00b6, 0xdf7ad19151df27b5, + 0x68ba6d050ffcba1e, 0x94448979a2b854e6, 0x84bf5d544f97f739, + 0x6d4bfa429e9d6ef0, 0xdb6c54b9a91ab935, 0x1a0051ca72162c5e, + 0xe04b73fdf1b61f9c); + VLOAD_64(v1, 0x32a4c1edbbfe5591, 0xf6baf4e747f4a120, 0x3a29727ae38b9b92, + 0xf173f78d09c997e4, 0xaab9d34e4aeaa57a, 0xa8fe3bf12b7c95e8, + 0xc4bd99b066821092, 0x9c2f1daf5fe2db9d, 0xa8b041a876aabcae, + 0xb9a2e6f9ded9a60a, 0x8bdf55954f50101d, 0x704f0e648c11d63f, + 0x0c8ca4d0a6d1a982, 0xa74d01c12ae6aea5, 0x3f2cd5d2e2f5b538, + 0x79803b24efa2caa3); + asm volatile("vmacc.vv v1, v2, v3"); + VCMP_U64(4, v1, 0xf7c2044aeebff5e8, 0xad447a1b99a48a53, 0x78676efbe1b5763a, + 0x813582af4d75d09e, 0x483adf8d811ecb64, 0x36d90fe4df2f2b2c, + 0xf833b173685307a8, 0x955c2ac405b724e1, 0xdcf9681f074b0d2d, + 0x10277404741c4ca8, 0x25d9bca0245d9fbf, 0x58439c4175d7f582, + 0x27ae9e3365b265d2, 0xabfe86591f4ba5be, 0xd964de90eaae196e, + 0xfb655e2263986563); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v3, 0x21, 0x75, 0x7f, 0x3a, 0x50, 0x6d, 0x3f, 0x3e, 0x74, 0x11, 0x29, + 0xea, 0x14, 0xce, 0xb0, 0x37); + VLOAD_8(v2, 0xfe, 0xa7, 0x06, 0xaa, 0x35, 0x3c, 0x2c, 0x58, 0xa1, 0xc4, 0x40, + 0x42, 0x52, 0x40, 0xa8, 0x53); + VLOAD_8(v1, 0x30, 0xef, 0xb4, 0x12, 0x6d, 0x3b, 0x2c, 0x5e, 0xf0, 0x25, 0xd7, + 0x70, 0xc2, 0x62, 0xe0, 0x99); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0x30, 0x42, 0xb4, 0x96, 0x6d, 0xc7, 0x2c, 0xae, 0xf0, 0x29, + 0xd7, 0xc4, 0xc2, 0xe2, 0xe0, 0x6e); + + VSET(16, e16, m1); + VLOAD_16(v3, 0x1c20, 0x11e4, 0xde38, 0x642f, 0x3eb5, 0xa0af, 0x48e1, 0x5fc4, + 0x3d2a, 0x67d5, 0x3f07, 0x2889, 0x8812, 0x0bd9, 0x56f4, 0xe068); + VLOAD_16(v2, 0x02cc, 0xd99c, 0xdba2, 0xf282, 0x0f99, 0xa219, 0x2dcc, 0x17cc, + 0xe8fb, 0x1e83, 0xed20, 0xbfee, 0xee87, 0x6b0f, 0xf6cf, 0x4cd1); + VLOAD_16(v1, 0xe3f0, 0x42db, 0x2fde, 0x1983, 0x910c, 0x853b, 0x82aa, 0x9ac2, + 0x4631, 0x1f8b, 0x68c3, 0x6fbc, 0x3b5c, 0xf98b, 0x2db1, 0x8e75); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0xe3f0, 0x6dcb, 0x2fde, 0x6761, 0x910c, 0xf452, 0x82aa, + 0x86f2, 0x4631, 0x378a, 0x68c3, 0x561a, 0x3b5c, 0x5e42, 0x2db1, + 0xa35d); + + VSET(16, e32, m1); + VLOAD_32(v3, 0x0401c584, 0x69049955, 0x4a71aa0c, 0xc651666f, 0x273fcd5d, + 0x23ca1d7d, 0x599c994e, 0xb2d8adc5, 0x4710afae, 0x69c61cad, + 0x96ee5026, 0x2c197996, 0xd95da451, 0x3a654fb9, 0xbe990e4b, + 0xc41fd55a); + VLOAD_32(v2, 0x39d5b56a, 0xc578a540, 0x51283b5c, 0x07b4ba9d, 0xe5aba5e4, + 0x28720dc8, 0x600fb42b, 0xf2937fa7, 0x4032d36f, 0xc676e3b3, + 0xf1cd5f96, 0x1c14bcbf, 0x7dea81ed, 0x40270562, 0x9577b3be, + 0xea615f0a); + VLOAD_32(v1, 0xa055bbb6, 0x71f9a668, 0x0be640c9, 0x2336ca55, 0xca121638, + 0xbf234fb5, 0xe7c83142, 0xb7048f12, 0x8eb340e3, 0xef253e93, + 0xffef4a03, 0xdf346833, 0xd0922181, 0xf159ee1d, 0xf86a7c06, + 0xfcb24a2d); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0xa055bbb6, 0xf2cbc4a8, 0x0be640c9, 0xf69b4268, 0xca121638, + 0xa233b25d, 0xe7c83142, 0xe2b1a595, 0x8eb340e3, 0x95d6b28a, + 0xffef4a03, 0x6338471d, 0xd0922181, 0xabe00fef, 0xf86a7c06, + 0x913705b1); + + VSET(16, e64, m1); + VLOAD_64(v3, 0x9cffef345b95f00b, 0x85d366e07e4bbc6b, 0xadfda1d2464c6433, + 0x610bf2c1435b3cf6, 0x8a0c6e4bc950e81f, 0x4296e7147ef94d7a, + 0x27d7ec90ba159756, 0x2a6c87932c3aef86, 0xbfd90c33e58a8fe3, + 0x1114f7672cf625c1, 0x1a7b72dd8ac39fab, 0xdb80f952e5fd2e5b, + 0x6b01c18a3daf288b, 0x69b4b0e4335f26d5, 0x0c059f365ec6d3d5, + 0xc22568276f1dcdd0); + VLOAD_64(v2, 0x6dc8e88769e54465, 0xce8cda83d16c3859, 0x1465ee5b6eb0d2b8, + 0x4827a9b40add2507, 0xd24c4005695a64d6, 0xb97c8e41e912f84a, + 0xc8c22e3b3b2e2fa1, 0x26712aa325bd00b6, 0xdf7ad19151df27b5, + 0x68ba6d050ffcba1e, 0x94448979a2b854e6, 0x84bf5d544f97f739, + 0x6d4bfa429e9d6ef0, 0xdb6c54b9a91ab935, 0x1a0051ca72162c5e, + 0xe04b73fdf1b61f9c); + VLOAD_64(v1, 0x32a4c1edbbfe5591, 0xf6baf4e747f4a120, 0x3a29727ae38b9b92, + 0xf173f78d09c997e4, 0xaab9d34e4aeaa57a, 0xa8fe3bf12b7c95e8, + 0xc4bd99b066821092, 0x9c2f1daf5fe2db9d, 0xa8b041a876aabcae, + 0xb9a2e6f9ded9a60a, 0x8bdf55954f50101d, 0x704f0e648c11d63f, + 0x0c8ca4d0a6d1a982, 0xa74d01c12ae6aea5, 0x3f2cd5d2e2f5b538, + 0x79803b24efa2caa3); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0x32a4c1edbbfe5591, 0xad447a1b99a48a53, 0x3a29727ae38b9b92, + 0x813582af4d75d09e, 0xaab9d34e4aeaa57a, 0x36d90fe4df2f2b2c, + 0xc4bd99b066821092, 0x955c2ac405b724e1, 0xa8b041a876aabcae, + 0x10277404741c4ca8, 0x8bdf55954f50101d, 0x58439c4175d7f582, + 0x0c8ca4d0a6d1a982, 0xabfe86591f4ba5be, 0x3f2cd5d2e2f5b538, + 0xfb655e2263986563); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v2, 0x60, 0xe3, 0xa0, 0xb7, 0x35, 0x23, 0xa3, 0xf4, 0x5f, 0x6e, 0x07, + 0x01, 0xe7, 0x51, 0x53, 0x29); + VLOAD_8(v1, 0xfb, 0x1b, 0xc0, 0x36, 0xa7, 0xe0, 0xc8, 0x47, 0x57, 0xe0, 0x51, + 0xaa, 0xd2, 0x93, 0x83, 0xa8); + asm volatile("vmacc.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0xdb, 0x8a, 0xe0, 0xc9, 0xb0, 0x8f, 0xf7, 0x0b, 0x32, 0x06, + 0x74, 0xaf, 0x55, 0x28, 0x22, 0x75); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v2, 0x992e, 0x9a07, 0x90c3, 0xf1ce, 0xd53c, 0x8f07, 0x2d2f, 0x5ab1, + 0x0a79, 0x0523, 0x6f34, 0xe5fd, 0xc95a, 0xca1c, 0x36bf, 0x16a1); + VLOAD_16(v1, 0x0a9f, 0x7ee0, 0x494e, 0xb6d0, 0x394c, 0xc8e7, 0xc117, 0x8108, + 0xb1af, 0x9f16, 0x22ab, 0xa244, 0xf1c9, 0xe363, 0x9bed, 0xa06f); + asm volatile("vmacc.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0x145d, 0xb5af, 0x54f9, 0x342e, 0x78a8, 0x4cb6, 0xa9ce, + 0x8131, 0x7b60, 0x9c21, 0xd43f, 0x9759, 0x0e53, 0x109f, 0x71b4, + 0xcd08); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v2, 0x709e784e, 0x8e13e48a, 0xad5df7fd, 0x738c8997, 0x0a0030d0, + 0x7569b952, 0x507fd5c7, 0x5d09af12, 0x0bf1c209, 0x7be6ed49, + 0x842ba667, 0x53360ec0, 0xd85d7415, 0xf20de61f, 0x153e7e16, + 0xec5512e4); + VLOAD_32(v1, 0xb2436fad, 0x6b162382, 0xd94eebe7, 0x9c43d906, 0xb80f178d, + 0x5cf91d42, 0x7764b8a3, 0x6269f72c, 0xb0dff3a6, 0x838d6893, + 0xa98a861e, 0x758b63de, 0xde488617, 0x371696ab, 0xc3ba8192, + 0x7ca33236); + asm volatile("vmacc.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0x8e0d1d47, 0xf29d4830, 0xb5213626, 0xb21bb5a3, 0xbc2f367d, + 0x18eb9d88, 0x91c53550, 0x69a6ceb2, 0xc09822e9, 0x66c98b96, + 0xf6b125ab, 0xef3fae1e, 0x4c40925e, 0x6b652c20, 0x998385c4, + 0x75d88d82); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v2, 0x2a47beb4fd7729c5, 0x401c187818b15d1e, 0xbbaf5fe50c41f22a, + 0x31eaddea171055a9, 0x609cbc4a78316c29, 0xd7bb8f31d8b59d88, + 0x97860fd5fba018c0, 0x724cecf178bd2125, 0x866d16f96d3d8b67, + 0x56153b0315164a5a, 0x6962bde49e3edf3f, 0x9b3f792bfbf5f343, + 0x64cf433b239e7764, 0x583c3a4ae481fef0, 0x217e2df75fcf0d8d, + 0x935ac02069fe54ce); + VLOAD_64(v1, 0x0dc8fa1b817237e5, 0xc817934370de904d, 0xb015bdbf0f39ec01, + 0x3c7e70a75643cce5, 0x80c45834a5026c02, 0xcdf1fcd83b8133a0, + 0x9d31b9b802ae2db1, 0xba7e57975c5febf5, 0x8732f75adf268ddb, + 0x5ff488a4187bd3f3, 0x6a259fe666091333, 0x5afc4de057de51c4, + 0x8a479b7e3558e399, 0xbc21e79022996c26, 0xe2c7432cd7e3e81d, + 0xdab377ddbdfb2df7); + asm volatile("vmacc.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0x093861b79ac45352, 0xfd3c909decf66b5b, 0x04eb13132ce4267b, + 0xb258e6b065bbf956, 0x62775181e33422f3, 0xdc0ae0e371686968, + 0xf8db06270cad2c71, 0x6c3cc52cd1fb49c2, 0x41c19c0ac1b5a2fa, + 0x8867d35049c7b01d, 0x6d71fe0f35a1feea, 0xace16ac43ec0279f, + 0x82faf4a574c9dc1d, 0xa875c9d17e310a96, 0x1f75616001b61192, + 0x16ce205f44fb8635); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v2, 0x60, 0xe3, 0xa0, 0xb7, 0x35, 0x23, 0xa3, 0xf4, 0x5f, 0x6e, 0x07, + 0x01, 0xe7, 0x51, 0x53, 0x29); + VLOAD_8(v1, 0xfb, 0x1b, 0xc0, 0x36, 0xa7, 0xe0, 0xc8, 0x47, 0x57, 0xe0, 0x51, + 0xaa, 0xd2, 0x93, 0x83, 0xa8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0xfb, 0x8a, 0xc0, 0xc9, 0xa7, 0x8f, 0xc8, 0x0b, 0x57, 0x06, + 0x51, 0xaf, 0xd2, 0x28, 0x83, 0x75); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v2, 0x992e, 0x9a07, 0x90c3, 0xf1ce, 0xd53c, 0x8f07, 0x2d2f, 0x5ab1, + 0x0a79, 0x0523, 0x6f34, 0xe5fd, 0xc95a, 0xca1c, 0x36bf, 0x16a1); + VLOAD_16(v1, 0x0a9f, 0x7ee0, 0x494e, 0xb6d0, 0x394c, 0xc8e7, 0xc117, 0x8108, + 0xb1af, 0x9f16, 0x22ab, 0xa244, 0xf1c9, 0xe363, 0x9bed, 0xa06f); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0x0a9f, 0xb5af, 0x494e, 0x342e, 0x394c, 0x4cb6, 0xc117, + 0x8131, 0xb1af, 0x9c21, 0x22ab, 0x9759, 0xf1c9, 0x109f, 0x9bed, + 0xcd08); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v2, 0x709e784e, 0x8e13e48a, 0xad5df7fd, 0x738c8997, 0x0a0030d0, + 0x7569b952, 0x507fd5c7, 0x5d09af12, 0x0bf1c209, 0x7be6ed49, + 0x842ba667, 0x53360ec0, 0xd85d7415, 0xf20de61f, 0x153e7e16, + 0xec5512e4); + VLOAD_32(v1, 0xb2436fad, 0x6b162382, 0xd94eebe7, 0x9c43d906, 0xb80f178d, + 0x5cf91d42, 0x7764b8a3, 0x6269f72c, 0xb0dff3a6, 0x838d6893, + 0xa98a861e, 0x758b63de, 0xde488617, 0x371696ab, 0xc3ba8192, + 0x7ca33236); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0xb2436fad, 0xf29d4830, 0xd94eebe7, 0xb21bb5a3, 0xb80f178d, + 0x18eb9d88, 0x7764b8a3, 0x69a6ceb2, 0xb0dff3a6, 0x66c98b96, + 0xa98a861e, 0xef3fae1e, 0xde488617, 0x6b652c20, 0xc3ba8192, + 0x75d88d82); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v2, 0x2a47beb4fd7729c5, 0x401c187818b15d1e, 0xbbaf5fe50c41f22a, + 0x31eaddea171055a9, 0x609cbc4a78316c29, 0xd7bb8f31d8b59d88, + 0x97860fd5fba018c0, 0x724cecf178bd2125, 0x866d16f96d3d8b67, + 0x56153b0315164a5a, 0x6962bde49e3edf3f, 0x9b3f792bfbf5f343, + 0x64cf433b239e7764, 0x583c3a4ae481fef0, 0x217e2df75fcf0d8d, + 0x935ac02069fe54ce); + VLOAD_64(v1, 0x0dc8fa1b817237e5, 0xc817934370de904d, 0xb015bdbf0f39ec01, + 0x3c7e70a75643cce5, 0x80c45834a5026c02, 0xcdf1fcd83b8133a0, + 0x9d31b9b802ae2db1, 0xba7e57975c5febf5, 0x8732f75adf268ddb, + 0x5ff488a4187bd3f3, 0x6a259fe666091333, 0x5afc4de057de51c4, + 0x8a479b7e3558e399, 0xbc21e79022996c26, 0xe2c7432cd7e3e81d, + 0xdab377ddbdfb2df7); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmacc.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0x0dc8fa1b817237e5, 0xfd3c909decf66b5b, 0xb015bdbf0f39ec01, + 0xb258e6b065bbf956, 0x80c45834a5026c02, 0xdc0ae0e371686968, + 0x9d31b9b802ae2db1, 0x6c3cc52cd1fb49c2, 0x8732f75adf268ddb, + 0x8867d35049c7b01d, 0x6a259fe666091333, 0xace16ac43ec0279f, + 0x8a479b7e3558e399, 0xa875c9d17e310a96, 0xe2c7432cd7e3e81d, + 0x16ce205f44fb8635); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmadc.c b/apps/riscv-tests/isa/rv64uv/vmadc.c new file mode 100644 index 0000000..524ae9e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmadc.c @@ -0,0 +1,238 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, + 8, 0x81); + VLOAD_8(v2, 4, 8, 12, 0x80, 4, 8, 12, 0x80, 4, 8, 12, 0x80, 4, 8, 12, 0x80); + VLOAD_8(v0, 0xDD, 0xDD); + asm volatile("vmadc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(1, v3, 0xAA, 0xAA); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, + 0x8001, 16, 0xffff, 8, 0x8001); + VLOAD_16(v2, 4, 8, 12, 0x8000, 4, 8, 12, 0x8000, 4, 8, 12, 0x8000, 4, 8, 12, + 0x8000); + VLOAD_8(v0, 0xDD, 0xDD); + asm volatile("vmadc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(2, v3, 0xAA, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001, 16, + 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001); + VLOAD_32(v2, 4, 8, 12, 0x80000000, 4, 8, 12, 0x80000000, 4, 8, 12, 0x80000000, + 4, 8, 12, 0x80000000); + VLOAD_8(v0, 0xDD, 0xDD); + asm volatile("vmadc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(3, v3, 0xAA, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xffffffffffffffff, 8, 0x8000000000000001, 16, + 0xffffffffffffffff, 8, 0x8000000000000001, 16, 0xffffffffffffffff, 8, + 0x8000000000000001, 16, 0xffffffffffffffff, 8, 0x8000000000000001); + VLOAD_64(v2, 4, 8, 12, 0x8000000000000000, 4, 8, 12, 0x8000000000000000, 4, 8, + 12, 0x8000000000000000, 4, 8, 12, 0x8000000000000000); + VLOAD_8(v0, 0xDD, 0xDD); + asm volatile("vmadc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(4, v3, 0xAA, 0xAA); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, + 8, 0x81); + VLOAD_8(v2, 4, 8, 12, 0x80, 4, 8, 12, 0x80, 4, 8, 12, 0x80, 4, 8, 12, 0x80); + asm volatile("vmadc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(5, v3, 0xAA, 0xAA); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, + 0x8001, 16, 0xffff, 8, 0x8001); + VLOAD_16(v2, 4, 8, 12, 0x8000, 4, 8, 12, 0x8000, 4, 8, 12, 0x8000, 4, 8, 12, + 0x8000); + asm volatile("vmadc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(6, v3, 0xAA, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001, 16, + 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001); + VLOAD_32(v2, 4, 8, 12, 0x80000000, 4, 8, 12, 0x80000000, 4, 8, 12, 0x80000000, + 4, 8, 12, 0x80000000); + asm volatile("vmadc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(7, v3, 0xAA, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xffffffffffffffff, 8, 0x8000000000000001, 16, + 0xffffffffffffffff, 8, 0x8000000000000001, 16, 0xffffffffffffffff, 8, + 0x8000000000000001, 16, 0xffffffffffffffff, 8, 0x8000000000000001); + VLOAD_64(v2, 4, 8, 12, 0x8000000000000000, 4, 8, 12, 0x8000000000000000, 4, 8, + 12, 0x8000000000000000, 4, 8, 12, 0x8000000000000000); + asm volatile("vmadc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(8, v3, 0xAA, 0xAA); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 0x8000000080008080; + + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, + 8, 0x81); + VLOAD_8(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v3, 0xAA, 0xAA); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, + 0x8001, 16, 0xffff, 8, 0x8001); + VLOAD_16(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v3, 0xAA, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001, 16, + 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001); + VLOAD_32(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v3, 0xAA, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xffffffffffffffff, 8, 0x8000000000000001, 16, + 0xffffffffffffffff, 8, 0x8000000000000001, 16, 0xffffffffffffffff, 8, + 0x8000000000000001, 16, 0xffffffffffffffff, 8, 0x8000000000000001); + VLOAD_64(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v3, 0xAA, 0xAA); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 0x8000000080008080; + + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, + 8, 0x81); + asm volatile("vmadc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v3, 0xAA, 0xAA); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, + 0x8001, 16, 0xffff, 8, 0x8001); + asm volatile("vmadc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v3, 0xAA, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001, 16, + 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001); + asm volatile("vmadc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(15, v3, 0xAA, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xffffffffffffffff, 8, 0x8000000000000001, 16, + 0xffffffffffffffff, 8, 0x8000000000000001, 16, 0xffffffffffffffff, 8, + 0x8000000000000001, 16, 0xffffffffffffffff, 8, 0x8000000000000001); + asm volatile("vmadc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(16, v3, 0xAA, 0xAA); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, + 8, 0x81); + VLOAD_8(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vim v3, v1, 10, v0"); + VSET(2, e8, m1); + VCMP_U8(17, v3, 0x22, 0x22); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, + 0x8001, 16, 0xffff, 8, 0x8001); + VLOAD_16(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vim v3, v1, 10, v0"); + VSET(2, e8, m1); + VCMP_U8(18, v3, 0x22, 0x22); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001, 16, + 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001); + VLOAD_32(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vim v3, v1, 10, v0"); + VSET(2, e8, m1); + VCMP_U8(19, v3, 0x22, 0x22); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xffffffffffffffff, 8, 0x8000000000000001, 16, + 0xffffffffffffffff, 8, 0x8000000000000001, 16, 0xffffffffffffffff, 8, + 0x8000000000000001, 16, 0xffffffffffffffff, 8, 0x8000000000000001); + VLOAD_64(v0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1); + asm volatile("vmadc.vim v3, v1, 10, v0"); + VSET(2, e8, m1); + VCMP_U8(20, v3, 0x22, 0x22); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, 8, 0x81, 16, 0xff, + 8, 0x81); + asm volatile("vmadc.vi v3, v1, 10"); + VSET(2, e8, m1); + VCMP_U8(21, v3, 0x22, 0x22); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, 0x8001, 16, 0xffff, 8, + 0x8001, 16, 0xffff, 8, 0x8001); + asm volatile("vmadc.vi v3, v1, 10"); + VSET(2, e8, m1); + VCMP_U8(22, v3, 0x22, 0x22); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001, 16, + 0xffffffff, 8, 0x80000001, 16, 0xffffffff, 8, 0x80000001); + asm volatile("vmadc.vi v3, v1, 10"); + VSET(2, e8, m1); + VCMP_U8(23, v3, 0x22, 0x22); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xffffffffffffffff, 8, 0x8000000000000001, 16, + 0xffffffffffffffff, 8, 0x8000000000000001, 16, 0xffffffffffffffff, 8, + 0x8000000000000001, 16, 0xffffffffffffffff, 8, 0x8000000000000001); + asm volatile("vmadc.vi v3, v1, 10"); + VSET(2, e8, m1); + VCMP_U8(24, v3, 0x22, 0x22); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmadd.c b/apps/riscv-tests/isa/rv64uv/vmadd.c new file mode 100644 index 0000000..797fc77 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmadd.c @@ -0,0 +1,292 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v1, 0x21, 0x75, 0x7f, 0x3a, 0x50, 0x6d, 0x3f, 0x3e, 0x74, 0x11, 0x29, + 0xea, 0x14, 0xce, 0xb0, 0x37); + VLOAD_8(v2, 0xfe, 0xa7, 0x06, 0xaa, 0x35, 0x3c, 0x2c, 0x58, 0xa1, 0xc4, 0x40, + 0x42, 0x52, 0x40, 0xa8, 0x53); + VLOAD_8(v3, 0x30, 0xef, 0xb4, 0x12, 0x6d, 0x3b, 0x2c, 0x5e, 0xf0, 0x25, 0xd7, + 0x70, 0xc2, 0x62, 0xe0, 0x99); + asm volatile("vmadd.vv v1, v2, v3"); + VCMP_U8(1, v1, 0xee, 0x42, 0xae, 0x96, 0xfd, 0xc7, 0x00, 0xae, 0xe4, 0x29, + 0x17, 0xc4, 0x2a, 0xe2, 0x60, 0x6e); + + VSET(16, e16, m1); + VLOAD_16(v1, 0x1c20, 0x11e4, 0xde38, 0x642f, 0x3eb5, 0xa0af, 0x48e1, 0x5fc4, + 0x3d2a, 0x67d5, 0x3f07, 0x2889, 0x8812, 0x0bd9, 0x56f4, 0xe068); + VLOAD_16(v2, 0x02cc, 0xd99c, 0xdba2, 0xf282, 0x0f99, 0xa219, 0x2dcc, 0x17cc, + 0xe8fb, 0x1e83, 0xed20, 0xbfee, 0xee87, 0x6b0f, 0xf6cf, 0x4cd1); + VLOAD_16(v3, 0xe3f0, 0x42db, 0x2fde, 0x1983, 0x910c, 0x853b, 0x82aa, 0x9ac2, + 0x4631, 0x1f8b, 0x68c3, 0x6fbc, 0x3b5c, 0xf98b, 0x2db1, 0x8e75); + asm volatile("vmadd.vv v1, v2, v3"); + VCMP_U16(2, v1, 0x8d70, 0x6dcb, 0xb74e, 0x6761, 0xa639, 0xf452, 0x22f6, + 0x86f2, 0x4e5f, 0x378a, 0xc4a3, 0x561a, 0xb8da, 0x5e42, 0xf4fd, + 0xa35d); + + VSET(16, e32, m1); + VLOAD_32(v1, 0x0401c584, 0x69049955, 0x4a71aa0c, 0xc651666f, 0x273fcd5d, + 0x23ca1d7d, 0x599c994e, 0xb2d8adc5, 0x4710afae, 0x69c61cad, + 0x96ee5026, 0x2c197996, 0xd95da451, 0x3a654fb9, 0xbe990e4b, + 0xc41fd55a); + VLOAD_32(v2, 0x39d5b56a, 0xc578a540, 0x51283b5c, 0x07b4ba9d, 0xe5aba5e4, + 0x28720dc8, 0x600fb42b, 0xf2937fa7, 0x4032d36f, 0xc676e3b3, + 0xf1cd5f96, 0x1c14bcbf, 0x7dea81ed, 0x40270562, 0x9577b3be, + 0xea615f0a); + VLOAD_32(v3, 0xa055bbb6, 0x71f9a668, 0x0be640c9, 0x2336ca55, 0xca121638, + 0xbf234fb5, 0xe7c83142, 0xb7048f12, 0x8eb340e3, 0xef253e93, + 0xffef4a03, 0xdf346833, 0xd0922181, 0xf159ee1d, 0xf86a7c06, + 0xfcb24a2d); + asm volatile("vmadd.vv v1, v2, v3"); + VCMP_U32(3, v1, 0x448bd85e, 0xf2cbc4a8, 0x5cd02119, 0xf69b4268, 0x3c60ee0c, + 0xa233b25d, 0x4c72c95c, 0xe2b1a595, 0xefb7d755, 0x95d6b28a, + 0xd3be5a47, 0x6338471d, 0xfb1a117e, 0xabe00fef, 0xbede88b0, + 0x913705b1); + + VSET(16, e64, m1); + VLOAD_64(v1, 0x9cffef345b95f00b, 0x85d366e07e4bbc6b, 0xadfda1d2464c6433, + 0x610bf2c1435b3cf6, 0x8a0c6e4bc950e81f, 0x4296e7147ef94d7a, + 0x27d7ec90ba159756, 0x2a6c87932c3aef86, 0xbfd90c33e58a8fe3, + 0x1114f7672cf625c1, 0x1a7b72dd8ac39fab, 0xdb80f952e5fd2e5b, + 0x6b01c18a3daf288b, 0x69b4b0e4335f26d5, 0x0c059f365ec6d3d5, + 0xc22568276f1dcdd0); + VLOAD_64(v2, 0x6dc8e88769e54465, 0xce8cda83d16c3859, 0x1465ee5b6eb0d2b8, + 0x4827a9b40add2507, 0xd24c4005695a64d6, 0xb97c8e41e912f84a, + 0xc8c22e3b3b2e2fa1, 0x26712aa325bd00b6, 0xdf7ad19151df27b5, + 0x68ba6d050ffcba1e, 0x94448979a2b854e6, 0x84bf5d544f97f739, + 0x6d4bfa429e9d6ef0, 0xdb6c54b9a91ab935, 0x1a0051ca72162c5e, + 0xe04b73fdf1b61f9c); + VLOAD_64(v3, 0x32a4c1edbbfe5591, 0xf6baf4e747f4a120, 0x3a29727ae38b9b92, + 0xf173f78d09c997e4, 0xaab9d34e4aeaa57a, 0xa8fe3bf12b7c95e8, + 0xc4bd99b066821092, 0x9c2f1daf5fe2db9d, 0xa8b041a876aabcae, + 0xb9a2e6f9ded9a60a, 0x8bdf55954f50101d, 0x704f0e648c11d63f, + 0x0c8ca4d0a6d1a982, 0xa74d01c12ae6aea5, 0x3f2cd5d2e2f5b538, + 0x79803b24efa2caa3); + asm volatile("vmadd.vv v1, v2, v3"); + VCMP_U64(4, v1, 0xf7c2044aeebff5e8, 0xad447a1b99a48a53, 0x78676efbe1b5763a, + 0x813582af4d75d09e, 0x483adf8d811ecb64, 0x36d90fe4df2f2b2c, + 0xf833b173685307a8, 0x955c2ac405b724e1, 0xdcf9681f074b0d2d, + 0x10277404741c4ca8, 0x25d9bca0245d9fbf, 0x58439c4175d7f582, + 0x27ae9e3365b265d2, 0xabfe86591f4ba5be, 0xd964de90eaae196e, + 0xfb655e2263986563); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v1, 0x21, 0x75, 0x7f, 0x3a, 0x50, 0x6d, 0x3f, 0x3e, 0x74, 0x11, 0x29, + 0xea, 0x14, 0xce, 0xb0, 0x37); + VLOAD_8(v2, 0xfe, 0xa7, 0x06, 0xaa, 0x35, 0x3c, 0x2c, 0x58, 0xa1, 0xc4, 0x40, + 0x42, 0x52, 0x40, 0xa8, 0x53); + VLOAD_8(v3, 0x30, 0xef, 0xb4, 0x12, 0x6d, 0x3b, 0x2c, 0x5e, 0xf0, 0x25, 0xd7, + 0x70, 0xc2, 0x62, 0xe0, 0x99); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0x21, 0x42, 0x7f, 0x96, 0x50, 0xc7, 0x3f, 0xae, 0x74, 0x29, + 0x29, 0xc4, 0x14, 0xe2, 0xb0, 0x6e); + + VSET(16, e16, m1); + VLOAD_16(v1, 0x1c20, 0x11e4, 0xde38, 0x642f, 0x3eb5, 0xa0af, 0x48e1, 0x5fc4, + 0x3d2a, 0x67d5, 0x3f07, 0x2889, 0x8812, 0x0bd9, 0x56f4, 0xe068); + VLOAD_16(v2, 0x02cc, 0xd99c, 0xdba2, 0xf282, 0x0f99, 0xa219, 0x2dcc, 0x17cc, + 0xe8fb, 0x1e83, 0xed20, 0xbfee, 0xee87, 0x6b0f, 0xf6cf, 0x4cd1); + VLOAD_16(v3, 0xe3f0, 0x42db, 0x2fde, 0x1983, 0x910c, 0x853b, 0x82aa, 0x9ac2, + 0x4631, 0x1f8b, 0x68c3, 0x6fbc, 0x3b5c, 0xf98b, 0x2db1, 0x8e75); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0x1c20, 0x6dcb, 0xde38, 0x6761, 0x3eb5, 0xf452, 0x48e1, + 0x86f2, 0x3d2a, 0x378a, 0x3f07, 0x561a, 0x8812, 0x5e42, 0x56f4, + 0xa35d); + + VSET(16, e32, m1); + VLOAD_32(v1, 0x0401c584, 0x69049955, 0x4a71aa0c, 0xc651666f, 0x273fcd5d, + 0x23ca1d7d, 0x599c994e, 0xb2d8adc5, 0x4710afae, 0x69c61cad, + 0x96ee5026, 0x2c197996, 0xd95da451, 0x3a654fb9, 0xbe990e4b, + 0xc41fd55a); + VLOAD_32(v2, 0x39d5b56a, 0xc578a540, 0x51283b5c, 0x07b4ba9d, 0xe5aba5e4, + 0x28720dc8, 0x600fb42b, 0xf2937fa7, 0x4032d36f, 0xc676e3b3, + 0xf1cd5f96, 0x1c14bcbf, 0x7dea81ed, 0x40270562, 0x9577b3be, + 0xea615f0a); + VLOAD_32(v3, 0xa055bbb6, 0x71f9a668, 0x0be640c9, 0x2336ca55, 0xca121638, + 0xbf234fb5, 0xe7c83142, 0xb7048f12, 0x8eb340e3, 0xef253e93, + 0xffef4a03, 0xdf346833, 0xd0922181, 0xf159ee1d, 0xf86a7c06, + 0xfcb24a2d); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0x0401c584, 0xf2cbc4a8, 0x4a71aa0c, 0xf69b4268, 0x273fcd5d, + 0xa233b25d, 0x599c994e, 0xe2b1a595, 0x4710afae, 0x95d6b28a, + 0x96ee5026, 0x6338471d, 0xd95da451, 0xabe00fef, 0xbe990e4b, + 0x913705b1); + + VSET(16, e64, m1); + VLOAD_64(v1, 0x9cffef345b95f00b, 0x85d366e07e4bbc6b, 0xadfda1d2464c6433, + 0x610bf2c1435b3cf6, 0x8a0c6e4bc950e81f, 0x4296e7147ef94d7a, + 0x27d7ec90ba159756, 0x2a6c87932c3aef86, 0xbfd90c33e58a8fe3, + 0x1114f7672cf625c1, 0x1a7b72dd8ac39fab, 0xdb80f952e5fd2e5b, + 0x6b01c18a3daf288b, 0x69b4b0e4335f26d5, 0x0c059f365ec6d3d5, + 0xc22568276f1dcdd0); + VLOAD_64(v2, 0x6dc8e88769e54465, 0xce8cda83d16c3859, 0x1465ee5b6eb0d2b8, + 0x4827a9b40add2507, 0xd24c4005695a64d6, 0xb97c8e41e912f84a, + 0xc8c22e3b3b2e2fa1, 0x26712aa325bd00b6, 0xdf7ad19151df27b5, + 0x68ba6d050ffcba1e, 0x94448979a2b854e6, 0x84bf5d544f97f739, + 0x6d4bfa429e9d6ef0, 0xdb6c54b9a91ab935, 0x1a0051ca72162c5e, + 0xe04b73fdf1b61f9c); + VLOAD_64(v3, 0x32a4c1edbbfe5591, 0xf6baf4e747f4a120, 0x3a29727ae38b9b92, + 0xf173f78d09c997e4, 0xaab9d34e4aeaa57a, 0xa8fe3bf12b7c95e8, + 0xc4bd99b066821092, 0x9c2f1daf5fe2db9d, 0xa8b041a876aabcae, + 0xb9a2e6f9ded9a60a, 0x8bdf55954f50101d, 0x704f0e648c11d63f, + 0x0c8ca4d0a6d1a982, 0xa74d01c12ae6aea5, 0x3f2cd5d2e2f5b538, + 0x79803b24efa2caa3); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0x9cffef345b95f00b, 0xad447a1b99a48a53, 0xadfda1d2464c6433, + 0x813582af4d75d09e, 0x8a0c6e4bc950e81f, 0x36d90fe4df2f2b2c, + 0x27d7ec90ba159756, 0x955c2ac405b724e1, 0xbfd90c33e58a8fe3, + 0x10277404741c4ca8, 0x1a7b72dd8ac39fab, 0x58439c4175d7f582, + 0x6b01c18a3daf288b, 0xabfe86591f4ba5be, 0x0c059f365ec6d3d5, + 0xfb655e2263986563); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v1, 0x60, 0xe3, 0xa0, 0xb7, 0x35, 0x23, 0xa3, 0xf4, 0x5f, 0x6e, 0x07, + 0x01, 0xe7, 0x51, 0x53, 0x29); + VLOAD_8(v2, 0xfb, 0x1b, 0xc0, 0x36, 0xa7, 0xe0, 0xc8, 0x47, 0x57, 0xe0, 0x51, + 0xaa, 0xd2, 0x93, 0x83, 0xa8); + asm volatile("vmadd.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0xdb, 0x8a, 0xe0, 0xc9, 0xb0, 0x8f, 0xf7, 0x0b, 0x32, 0x06, + 0x74, 0xaf, 0x55, 0x28, 0x22, 0x75); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v1, 0x992e, 0x9a07, 0x90c3, 0xf1ce, 0xd53c, 0x8f07, 0x2d2f, 0x5ab1, + 0x0a79, 0x0523, 0x6f34, 0xe5fd, 0xc95a, 0xca1c, 0x36bf, 0x16a1); + VLOAD_16(v2, 0x0a9f, 0x7ee0, 0x494e, 0xb6d0, 0x394c, 0xc8e7, 0xc117, 0x8108, + 0xb1af, 0x9f16, 0x22ab, 0xa244, 0xf1c9, 0xe363, 0x9bed, 0xa06f); + asm volatile("vmadd.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0x145d, 0xb5af, 0x54f9, 0x342e, 0x78a8, 0x4cb6, 0xa9ce, + 0x8131, 0x7b60, 0x9c21, 0xd43f, 0x9759, 0x0e53, 0x109f, 0x71b4, + 0xcd08); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v1, 0x709e784e, 0x8e13e48a, 0xad5df7fd, 0x738c8997, 0x0a0030d0, + 0x7569b952, 0x507fd5c7, 0x5d09af12, 0x0bf1c209, 0x7be6ed49, + 0x842ba667, 0x53360ec0, 0xd85d7415, 0xf20de61f, 0x153e7e16, + 0xec5512e4); + VLOAD_32(v2, 0xb2436fad, 0x6b162382, 0xd94eebe7, 0x9c43d906, 0xb80f178d, + 0x5cf91d42, 0x7764b8a3, 0x6269f72c, 0xb0dff3a6, 0x838d6893, + 0xa98a861e, 0x758b63de, 0xde488617, 0x371696ab, 0xc3ba8192, + 0x7ca33236); + asm volatile("vmadd.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0x8e0d1d47, 0xf29d4830, 0xb5213626, 0xb21bb5a3, 0xbc2f367d, + 0x18eb9d88, 0x91c53550, 0x69a6ceb2, 0xc09822e9, 0x66c98b96, + 0xf6b125ab, 0xef3fae1e, 0x4c40925e, 0x6b652c20, 0x998385c4, + 0x75d88d82); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v1, 0x2a47beb4fd7729c5, 0x401c187818b15d1e, 0xbbaf5fe50c41f22a, + 0x31eaddea171055a9, 0x609cbc4a78316c29, 0xd7bb8f31d8b59d88, + 0x97860fd5fba018c0, 0x724cecf178bd2125, 0x866d16f96d3d8b67, + 0x56153b0315164a5a, 0x6962bde49e3edf3f, 0x9b3f792bfbf5f343, + 0x64cf433b239e7764, 0x583c3a4ae481fef0, 0x217e2df75fcf0d8d, + 0x935ac02069fe54ce); + VLOAD_64(v2, 0x0dc8fa1b817237e5, 0xc817934370de904d, 0xb015bdbf0f39ec01, + 0x3c7e70a75643cce5, 0x80c45834a5026c02, 0xcdf1fcd83b8133a0, + 0x9d31b9b802ae2db1, 0xba7e57975c5febf5, 0x8732f75adf268ddb, + 0x5ff488a4187bd3f3, 0x6a259fe666091333, 0x5afc4de057de51c4, + 0x8a479b7e3558e399, 0xbc21e79022996c26, 0xe2c7432cd7e3e81d, + 0xdab377ddbdfb2df7); + asm volatile("vmadd.vx v1, %[A], v2" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0x093861b79ac45352, 0xfd3c909decf66b5b, 0x04eb13132ce4267b, + 0xb258e6b065bbf956, 0x62775181e33422f3, 0xdc0ae0e371686968, + 0xf8db06270cad2c71, 0x6c3cc52cd1fb49c2, 0x41c19c0ac1b5a2fa, + 0x8867d35049c7b01d, 0x6d71fe0f35a1feea, 0xace16ac43ec0279f, + 0x82faf4a574c9dc1d, 0xa875c9d17e310a96, 0x1f75616001b61192, + 0x16ce205f44fb8635); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v1, 0x60, 0xe3, 0xa0, 0xb7, 0x35, 0x23, 0xa3, 0xf4, 0x5f, 0x6e, 0x07, + 0x01, 0xe7, 0x51, 0x53, 0x29); + VLOAD_8(v2, 0xfb, 0x1b, 0xc0, 0x36, 0xa7, 0xe0, 0xc8, 0x47, 0x57, 0xe0, 0x51, + 0xaa, 0xd2, 0x93, 0x83, 0xa8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0x60, 0x8a, 0xa0, 0xc9, 0x35, 0x8f, 0xa3, 0x0b, 0x5f, 0x06, + 0x07, 0xaf, 0xe7, 0x28, 0x53, 0x75); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v1, 0x992e, 0x9a07, 0x90c3, 0xf1ce, 0xd53c, 0x8f07, 0x2d2f, 0x5ab1, + 0x0a79, 0x0523, 0x6f34, 0xe5fd, 0xc95a, 0xca1c, 0x36bf, 0x16a1); + VLOAD_16(v2, 0x0a9f, 0x7ee0, 0x494e, 0xb6d0, 0x394c, 0xc8e7, 0xc117, 0x8108, + 0xb1af, 0x9f16, 0x22ab, 0xa244, 0xf1c9, 0xe363, 0x9bed, 0xa06f); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0x992e, 0xb5af, 0x90c3, 0x342e, 0xd53c, 0x4cb6, 0x2d2f, + 0x8131, 0x0a79, 0x9c21, 0x6f34, 0x9759, 0xc95a, 0x109f, 0x36bf, + 0xcd08); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v1, 0x709e784e, 0x8e13e48a, 0xad5df7fd, 0x738c8997, 0x0a0030d0, + 0x7569b952, 0x507fd5c7, 0x5d09af12, 0x0bf1c209, 0x7be6ed49, + 0x842ba667, 0x53360ec0, 0xd85d7415, 0xf20de61f, 0x153e7e16, + 0xec5512e4); + VLOAD_32(v2, 0xb2436fad, 0x6b162382, 0xd94eebe7, 0x9c43d906, 0xb80f178d, + 0x5cf91d42, 0x7764b8a3, 0x6269f72c, 0xb0dff3a6, 0x838d6893, + 0xa98a861e, 0x758b63de, 0xde488617, 0x371696ab, 0xc3ba8192, + 0x7ca33236); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0x709e784e, 0xf29d4830, 0xad5df7fd, 0xb21bb5a3, 0x0a0030d0, + 0x18eb9d88, 0x507fd5c7, 0x69a6ceb2, 0x0bf1c209, 0x66c98b96, + 0x842ba667, 0xef3fae1e, 0xd85d7415, 0x6b652c20, 0x153e7e16, + 0x75d88d82); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v1, 0x2a47beb4fd7729c5, 0x401c187818b15d1e, 0xbbaf5fe50c41f22a, + 0x31eaddea171055a9, 0x609cbc4a78316c29, 0xd7bb8f31d8b59d88, + 0x97860fd5fba018c0, 0x724cecf178bd2125, 0x866d16f96d3d8b67, + 0x56153b0315164a5a, 0x6962bde49e3edf3f, 0x9b3f792bfbf5f343, + 0x64cf433b239e7764, 0x583c3a4ae481fef0, 0x217e2df75fcf0d8d, + 0x935ac02069fe54ce); + VLOAD_64(v2, 0x0dc8fa1b817237e5, 0xc817934370de904d, 0xb015bdbf0f39ec01, + 0x3c7e70a75643cce5, 0x80c45834a5026c02, 0xcdf1fcd83b8133a0, + 0x9d31b9b802ae2db1, 0xba7e57975c5febf5, 0x8732f75adf268ddb, + 0x5ff488a4187bd3f3, 0x6a259fe666091333, 0x5afc4de057de51c4, + 0x8a479b7e3558e399, 0xbc21e79022996c26, 0xe2c7432cd7e3e81d, + 0xdab377ddbdfb2df7); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vmadd.vx v1, %[A], v2, v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0x2a47beb4fd7729c5, 0xfd3c909decf66b5b, 0xbbaf5fe50c41f22a, + 0xb258e6b065bbf956, 0x609cbc4a78316c29, 0xdc0ae0e371686968, + 0x97860fd5fba018c0, 0x6c3cc52cd1fb49c2, 0x866d16f96d3d8b67, + 0x8867d35049c7b01d, 0x6962bde49e3edf3f, 0xace16ac43ec0279f, + 0x64cf433b239e7764, 0xa875c9d17e310a96, 0x217e2df75fcf0d8d, + 0x16ce205f44fb8635); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmand.c b/apps/riscv-tests/isa/rv64uv/vmand.c new file mode 100644 index 0000000..82332f4 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmand.c @@ -0,0 +1,79 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0x84, 0x21); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0xCD, 0xEF); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0x00, 0x00); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0x0D, 0xE0); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0x84, 0x21); +} + +void TEST_CASE6() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF, 0xCD, 0xEF, 0xCD, 0xEF, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21); + asm volatile("vmand.mm v1, v2, v3"); + VSET(13, e8, m1); + VCLEAR(v2); + VCMP_U8(6, v2, 0, 0, 0, 0, 0, 0, 0, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmandnot.c b/apps/riscv-tests/isa/rv64uv/vmandnot.c new file mode 100644 index 0000000..5902eed --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmandnot.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmandnot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0x49, 0xCE); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmandnot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0x00, 0x00); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmandnot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0xCD, 0xEF); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmandnot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0xC0, 0x0F); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmandnot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0x49, 0xCE); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmax.c b/apps/riscv-tests/isa/rv64uv/vmax.c new file mode 100644 index 0000000..eae2406 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmax.c @@ -0,0 +1,181 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmax.vv v1, v2, v3"); + VCMP_I16(1, v1, 12345, 7000, 2560, 19901, 12345, 7000, 2560, 19901, 12345, + 7000, 2560, 19901, 12345, 7000, 2560, 19901); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmax.vv v1, v2, v3"); + VCMP_I32(2, v1, 12345, 7000, 2560, 19901, 12345, 7000, 2560, 19901, 12345, + 7000, 2560, 19901, 12345, 7000, 2560, 19901); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmax.vv v1, v2, v3"); + VCMP_I64(3, v1, 12345, 7000, 2560, 19901, 12345, 7000, 2560, 19901, 12345, + 7000, 2560, 19901, 12345, 7000, 2560, 19901); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vmax.vv v1, v2, v3, v0.t"); + VCMP_I16(4, v1, 0xbeef, 0xbeef, 2560, 19901, 0xbeef, 0xbeef, 2560, 19901, + 0xbeef, 0xbeef, 2560, 19901, 0xbeef, 0xbeef, 2560, 19901); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vmax.vv v1, v2, v3, v0.t"); + VCMP_I32(5, v1, 0xdeadbeef, 0xdeadbeef, 2560, 19901, 0xdeadbeef, 0xdeadbeef, + 2560, 19901, 0xdeadbeef, 0xdeadbeef, 2560, 19901, 0xdeadbeef, + 0xdeadbeef, 2560, 19901); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vmax.vv v1, v2, v3, v0.t"); + VCMP_I64(6, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + asm volatile("vmax.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(7, v1, 123, 40, 40, 99, 123, 40, 40, 99, 123, 40, 40, 99, 123, 40, 40, + 99); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + asm volatile("vmax.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(8, v1, 12345, 40, 40, 199, 12345, 40, 40, 199, 12345, 40, 40, 199, + 12345, 40, 40, 199); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + asm volatile("vmax.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(9, v1, 12345, 40, 40, 199, 12345, 40, 40, 199, 12345, 40, 40, 199, + 12345, 40, 40, 199); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + asm volatile("vmax.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(10, v1, 12345, 40, 40, 199, 12345, 40, 40, 199, 12345, 40, 40, 199, + 12345, 40, 40, 199); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef, 0xef, 0xef, 0xef, 0xef); + asm volatile("vmax.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(11, v1, 0xef, 0xef, 40, 99, 0xef, 0xef, 40, 99, 0xef, 0xef, 40, 99, + 0xef, 0xef, 40, 99); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vmax.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(12, v1, 0xbeef, 0xbeef, 40, 199, 0xbeef, 0xbeef, 40, 199, 0xbeef, + 0xbeef, 40, 199, 0xbeef, 0xbeef, 40, 199); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vmax.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(13, v1, 0xdeadbeef, 0xdeadbeef, 40, 199, 0xdeadbeef, 0xdeadbeef, 40, + 199, 0xdeadbeef, 0xdeadbeef, 40, 199, 0xdeadbeef, 0xdeadbeef, 40, + 199); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vmax.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(14, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 40, 199, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 40, 199, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 40, 199, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 40, 199); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmaxu.c b/apps/riscv-tests/isa/rv64uv/vmaxu.c new file mode 100644 index 0000000..b166eb6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmaxu.c @@ -0,0 +1,181 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmaxu.vv v1, v2, v3"); + VCMP_U16(1, v1, 12345, 7000, 2560, 19901, 12345, 7000, 2560, 19901, 12345, + 7000, 2560, 19901, 12345, 7000, 2560, 19901); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmaxu.vv v1, v2, v3"); + VCMP_U32(2, v1, 12345, 7000, 2560, 19901, 12345, 7000, 2560, 19901, 12345, + 7000, 2560, 19901, 12345, 7000, 2560, 19901); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmaxu.vv v1, v2, v3"); + VCMP_U64(3, v1, 12345, 7000, 2560, 19901, 12345, 7000, 2560, 19901, 12345, + 7000, 2560, 19901, 12345, 7000, 2560, 19901); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vmaxu.vv v1, v2, v3, v0.t"); + VCMP_U16(4, v1, 0xbeef, 0xbeef, 2560, 19901, 0xbeef, 0xbeef, 2560, 19901, + 0xbeef, 0xbeef, 2560, 19901, 0xbeef, 0xbeef, 2560, 19901); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vmaxu.vv v1, v2, v3, v0.t"); + VCMP_U32(5, v1, 0xdeadbeef, 0xdeadbeef, 2560, 19901, 0xdeadbeef, 0xdeadbeef, + 2560, 19901, 0xdeadbeef, 0xdeadbeef, 2560, 19901, 0xdeadbeef, + 0xdeadbeef, 2560, 19901); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vmaxu.vv v1, v2, v3, v0.t"); + VCMP_U64(6, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 2560, 19901); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + asm volatile("vmaxu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(7, v1, 123, 40, 40, 199, 123, 40, 40, 199, 123, 40, 40, 199, 123, 40, + 40, 199); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + asm volatile("vmaxu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(8, v1, 12345, 40, 40, 199, 12345, 40, 40, 199, 12345, 40, 40, 199, + 12345, 40, 40, 199); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + asm volatile("vmaxu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(9, v1, 12345, 40, 40, 199, 12345, 40, 40, 199, 12345, 40, 40, 199, + 12345, 40, 40, 199); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + asm volatile("vmaxu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(10, v1, 12345, 40, 40, 199, 12345, 40, 40, 199, 12345, 40, 40, 199, + 12345, 40, 40, 199); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef, 0xef, 0xef, 0xef, 0xef); + asm volatile("vmaxu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(11, v1, 0xef, 0xef, 40, 199, 0xef, 0xef, 40, 199, 0xef, 0xef, 40, 199, + 0xef, 0xef, 40, 199); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vmaxu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(12, v1, 0xbeef, 0xbeef, 40, 199, 0xbeef, 0xbeef, 40, 199, 0xbeef, + 0xbeef, 40, 199, 0xbeef, 0xbeef, 40, 199); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vmaxu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(13, v1, 0xdeadbeef, 0xdeadbeef, 40, 199, 0xdeadbeef, 0xdeadbeef, 40, + 199, 0xdeadbeef, 0xdeadbeef, 40, 199, 0xdeadbeef, 0xdeadbeef, 40, + 199); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vmaxu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(14, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 40, 199, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 40, 199, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 40, 199, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 40, 199); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmerge.c b/apps/riscv-tests/isa/rv64uv/vmerge.c new file mode 100644 index 0000000..2be295e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmerge.c @@ -0,0 +1,113 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vvm v3, v1, v2, v0"); + VCMP_U8(1, v3, 1, 7, 3, 5, 5, 3, 7, 1, 8, 2, 6, 4, 4, 6, 2, 8); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vvm v3, v1, v2, v0"); + VCMP_U16(2, v3, 1, 7, 3, 5, 5, 3, 7, 1, 8, 2, 6, 4, 4, 6, 2, 8); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vvm v3, v1, v2, v0"); + VCMP_U32(3, v3, 1, 7, 3, 5, 5, 3, 7, 1, 8, 2, 6, 4, 4, 6, 2, 8); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vvm v3, v1, v2, v0"); + VCMP_U64(4, v3, 1, 7, 3, 5, 5, 3, 7, 1, 8, 2, 6, 4, 4, 6, 2, 8); +} + +void TEST_CASE2() { + const uint64_t scalar = 0x00000000deadbeef; + + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U8(5, v3, 1, 0xef, 3, 0xef, 5, 0xef, 7, 0xef, 0xef, 2, 0xef, 4, 0xef, 6, + 0xef, 8); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U16(6, v3, 1, 0xbeef, 3, 0xbeef, 5, 0xbeef, 7, 0xbeef, 0xbeef, 2, 0xbeef, + 4, 0xbeef, 6, 0xbeef, 8); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U32(7, v3, 1, 0xdeadbeef, 3, 0xdeadbeef, 5, 0xdeadbeef, 7, 0xdeadbeef, + 0xdeadbeef, 2, 0xdeadbeef, 4, 0xdeadbeef, 6, 0xdeadbeef, 8); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U64(8, v3, 1, 0x00000000deadbeef, 3, 0x00000000deadbeef, 5, + 0x00000000deadbeef, 7, 0x00000000deadbeef, 0x00000000deadbeef, 2, + 0x00000000deadbeef, 4, 0x00000000deadbeef, 6, 0x00000000deadbeef, 8); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vim v3, v1, -1, v0"); + VCMP_U8(9, v3, 1, 0xff, 3, 0xff, 5, 0xff, 7, 0xff, 0xff, 2, 0xff, 4, 0xff, 6, + 0xff, 8); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vim v3, v1, -1, v0"); + VCMP_U16(10, v3, 1, 0xffff, 3, 0xffff, 5, 0xffff, 7, 0xffff, 0xffff, 2, + 0xffff, 4, 0xffff, 6, 0xffff, 8); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vim v3, v1, -1, v0"); + VCMP_U32(11, v3, 1, 0xffffffff, 3, 0xffffffff, 5, 0xffffffff, 7, 0xffffffff, + 0xffffffff, 2, 0xffffffff, 4, 0xffffffff, 6, 0xffffffff, 8); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0x55); + asm volatile("vmerge.vim v3, v1, -1, v0"); + VCMP_U64(12, v3, 1, 0xffffffffffffffff, 3, 0xffffffffffffffff, 5, + 0xffffffffffffffff, 7, 0xffffffffffffffff, 0xffffffffffffffff, 2, + 0xffffffffffffffff, 4, 0xffffffffffffffff, 6, 0xffffffffffffffff, 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmfeq.c b/apps/riscv-tests/isa/rv64uv/vmfeq.c new file mode 100644 index 0000000..e169790 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmfeq.c @@ -0,0 +1,503 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// This instruction writes a mask to a register, with a layout of elements as +// described in section "Mask Register Layout" +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.0590, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x2b8c, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3041, 0xbb98); + asm volatile("vmfeq.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(1, v1, 0x0); + + VSET(16, e32, m1); + // +0, sNaN, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0xffffffff, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5b88a4); + // -0, sNaN, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, -0.00670803 + VLOAD_32(v3, 0x80000000, 0xffffffff, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0xbbdbcefe); + asm volatile("vmfeq.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(2, v1, 0x1); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, 0.4329957213663693 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0x3fdbb633afa4e520); + // -0.3562510538138417, -0.0135629748736219, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0xbfd6ccd13852f170, 0xbf8bc6e7ac263f80, 0x3fed8915c5665532, + 0x3fef0d4f6aafa2f6, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + asm volatile("vmfeq.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(3, v1, 0x4); +}; + +// Simple random test with similar values + 1 subnormal (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.7285, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x39d4, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3507, 0xbb98); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(4, v1, 0x0002); + + VSET(16, e32, m1); + // 0x00000000, 0.09933749, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0x3dcb7174, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5d88a4); + // 0x00000000, -0.64782482, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, 0.85755372 + VLOAD_32(v3, 0x00000000, 0xbf25d7d9, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0x3f5d88a4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(5, v1, 0x8000); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, -0.7793965434104730 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0xbfe8f0d105120796); + // 0.8643613633211786, 0.4842301798024149, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(6, v1, 0x800a); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.0651, 0.5806, 0.2563, -0.4783, 0.7393, -0.2649, -0.4590, + // 0.5469, -0.9082, 0.6235, -0.8276, -0.7939, -0.0236, -0.1166, + // 0.4026, 0.0022 + VLOAD_16(v2, 0xac2a, 0x38a5, 0x341a, 0xb7a7, 0x39ea, 0xb43d, 0xb758, 0x3860, + 0xbb44, 0x38fd, 0xba9f, 0xba5a, 0xa60b, 0xaf76, 0x3671, 0x1896); + asm volatile("vmfeq.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(7, v1, 0x0020); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // -0.15601152, -0.92020410, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0xbe1fc17c, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0xbf4b1daf); + asm volatile("vmfeq.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(8, v1, 0x7ffe); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, 0.4585094341291300, + // 0.8417440789882031, -0.1215927835809432, 0.9442717441528423, + // -0.3993868853091622, 0.5719771249018739, + // 0.0497853851400327, 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + asm volatile("vmfeq.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(9, v1, 0x0008); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.2649, 0.5806, -0.2649, -0.4783, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, + VLOAD_16(v2, 0xb43d, 0x7653, 0xad3d, 0x033d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, + 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(10, v1, 0xaaa0); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // 0.80517912, 0.80517912, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0x3f4e2038, 0x3f4e2038, 0xbe967703, 0x3f7c66bb, 0x3f61b2e8, + 0xbee4905c, 0x3f61c543, 0x3e1b4092, 0xbf4cad78, 0xbd16465d, + 0xbec4f07b, 0xbf0c2627, 0x3dcbe820, 0x3e5dbf70, 0xbec04b31, + 0xbf4b1daf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(11, v1, 0x0002); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, -0.3394093097660049, + // 0.8417440789882031, -0.1215927835809432, + // 0.9442717441528423, -0.3993868853091622, + // 0.5719771249018739, 0.0497853851400327, + // 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(12, v1, 0x0008); +}; + +// Check if only the correct destination bits are written +void TEST_CASE5(void) { + // Fill 64-bits with 1 + VSET(1, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff); + // Perform vmfeq.vv on 16 different elements, and then check that the last (64 + // - 16 = 48) bits were not overwritten with zeroes + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.0590, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x33ca, 0x2b8c, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3041, 0xbb98); + asm volatile("vmfeq.vv v1, v2, v3"); + VSET(1, e64, m1); + VCMP_U64(13, v1, 0xffffffffffff0001); + + // Fill 64-bits with 1 + VSET(1, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff); + // Perform vmfeq.vv on 16 different elements, and then check that the last (64 + // - 16 = 48) bits were not overwritten with zeroes + VSET(16, e32, m1); + // -0.72077256, sNaN, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x70000000, 0xffffffff, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5b88a4); + // 0.79994357, sNaN, -0.34645590, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, -0.00670803 + VLOAD_32(v3, 0x80000000, 0xffffffff, 0xbeb162ab, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0xbbdbcefe); + asm volatile("vmfeq.vv v1, v2, v3"); + VSET(1, e64, m1); + VCMP_U64(14, v1, 0xffffffffffff0004); + + // Fill 64-bits with 1 + VSET(1, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff); + // Perform vmfeq.vv on 16 different elements, and then check that the last (64 + // - 16 = 48) bits were not overwritten with zeroes + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, 0.4329957213663693 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0xbf3180f63f75db3c, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0x3fdbb633afa4e520); + // 0.8643613633211786, -0.0135629748736219, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0xbf8bc6e7ac263f80, 0x3fed8915c5665532, + 0x3fef0d4f6aafa2f6, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + asm volatile("vmfeq.vv v1, v2, v3"); + VSET(1, e64, m1); + VCMP_U64(15, v1, 0xffffffffffff0001); +}; + +// Write to v0 during a masked operation, WAR dependency should be respected +void TEST_CASE6(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, 0.7241, 0.0027, -0.7114, 0.8701, + // 0.8701, -0.5786, -0.4229, 0.6968, 0.6968, 0.7217, -0.2842, + // 0.1659, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3af6, 0x3af6, + 0xb8a1, 0xb6c4, 0x3993, 0x3993, 0x39c6, 0xb48c, 0x314f, 0x314f); + // 0.2434, 0.7285, -0.2678, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.2622, -0.5786, -0.4229, 0.5981, 0.5981, 0.7217, -0.2842, + // 0.1328, 0.1328 + VLOAD_16(v3, 0x33ca, 0x39d4, 0xb449, 0x39cb, 0x1975, 0xb9b1, 0x3432, 0x3432, + 0xb8a1, 0xb6c4, 0x38c9, 0x38c9, 0x39c6, 0xb48c, 0x3040, 0x3040); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(16, v0, 0x2222); + + VSET(16, e32, m1); + // 0x00000000, 0.09933749, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0x3dcb7174, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5d88a4); + // 0x00000000, 0.09933749, 0.39402914, -0.81853813, + // 0.96037650, -0.81018746, -0.44735566, -0.25510681, + // -0.30920035, -0.31596854, 0.19188073, -0.29310879, + // 0.22002794, 0.48599416, -0.80913633, -0.30138883 + VLOAD_32(v3, 0x00000000, 0x3dcb7174, 0x3ec9be30, 0xbf518bb7, 0x3f75db3c, + 0xbf4f6872, 0xbee50bcd, 0xbe829d5c, 0xbe9e4f82, 0xbea1c6a1, + 0x3e447c62, 0xbe96125b, 0x3e614f01, 0x3ef8d43a, 0xbf4f238f, + 0xbe9a4fa3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(17, v0, 0x2222); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.8792039527057112, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, -0.7793965434104730 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfec227053ec5198, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0xbfe8f0d105120796); + // 0.8643613633211786, 0.4842301798024149, -0.8792039527057112, + // 0.9703747829163081, -0.1308855743137316, -0.3798019472030296, + // -0.8792039527057112, -0.1745056251010144, + // -0.3736408604742532, 0.4947226024634424, + // -0.9079294226891812, -0.9490909352855985, 0.6283940115157876, + // 0.1053912590957002, -0.5927175227484118, -0.3032110323317654 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0xbfec227053ec5198, + 0x9fee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0xbfec227053ec5198, 0xbfc6563348637140, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfe2f78abcff0ede, + 0xbfd367cf3ee9af68); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(18, v0, 0x2222); +}; + +// Test sNaN/qNaN behaviour +void TEST_CASE7(void) { + CLEAR_FFLAGS; + // First, give only qNaN (no exception is generated) + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, qNaNh, qNaNh, 0x39cb, qNaNh, 0x1975, 0xb9b1, 0x3af6, 0x3af6, + 0xb8a1, 0xb6c4, 0x3993, 0x3993, qNaNh, 0xb48c, qNaNh, qNaNh); + VLOAD_16(v3, 0x33ca, qNaNh, qNaNh, 0x39cb, 0x1975, 0xb9b1, 0x3432, 0x3432, + 0xb8a1, 0xb6c4, 0x38c9, 0x38c9, 0x39c6, qNaNh, qNaNh, 0x3040); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(19, v0, 0x0330); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3f75db3c, qNaNf, qNaNf, qNaNf, 0x3f75db3c, 0xbf4f6872, + 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, 0xbf6bd1a2, + 0x3f036ba4, qNaNf, qNaNf, 0x3f3110b0, qNaNf); + VLOAD_32(v3, 0x3f75db3c, 0x3dcb7174, qNaNf, 0xbf518bb7, 0x3f75db3c, + 0xbf4f6872, 0xbee50bcd, 0xbe829d5c, 0xbe9e4f82, 0xbea1c6a1, + 0x3e447c62, 0xbe96125b, qNaNf, 0x3ef8d43a, qNaNf, qNaNf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(20, v0, 0x0331); + + VSET(16, e64, m1); + VLOAD_64(v2, qNaNd, qNaNd, 0x3fed8915c5665532, 0xbfec227053ec5198, + 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, 0x3fc41b3c98507fe0, + 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, 0x3fdfa988fd8b0a24, + 0xbfd367cf3ee9af68, 0x3feccb416af162fc, qNaNd, qNaNd, + 0xbfd2cb447b63f610, qNaNd); + VLOAD_64(v3, qNaNd, 0x3fdefda0947f3460, qNaNd, 0x9fee55c27d3d743e, + 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, 0xbfec227053ec5198, + 0xbfc6563348637140, 0xbfd7e9bb5b0beaf8, 0x3fdfa988fd8b0a24, + 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, qNaNd, 0x3fbafaebeb19acf0, + qNaNd, qNaNd); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(21, v0, 0x0330); + CHECK_FFLAGS(0); + + // Give sNaN (Invalid operation) + VSET(16, e32, m1); + VLOAD_32(v2, 0x3f75db3c, sNaNf, sNaNf, qNaNf, 0x3f75db3c, 0xbf4f6872, + 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, 0xbf6bd1a2, + 0x3f036ba4, qNaNf, qNaNf, 0x3f3110b0, qNaNf); + VLOAD_32(v3, 0x3f75db3c, 0x3dcb7174, qNaNf, 0xbf518bb7, 0x3f75db3c, + 0xbf4f6872, 0xbee50bcd, 0xbe829d5c, 0xbe9e4f82, 0xbea1c6a1, + 0x3e447c62, 0xbe96125b, qNaNf, 0x3ef8d43a, qNaNf, qNaNf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfeq.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(22, v0, 0x0331); + CHECK_FFLAGS(NV); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + // TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmfge.c b/apps/riscv-tests/isa/rv64uv/vmfge.c new file mode 100644 index 0000000..8a82ae7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmfge.c @@ -0,0 +1,134 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values (vector-scalar) +void TEST_CASE1(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.0651, 0.5806, 0.2563, -0.4783, 0.7393, -0.2649, -0.4590, + // 0.5469, -0.9082, 0.6235, -0.8276, -0.7939, -0.0236, -0.1166, + // 0.4026, 0.0022 + VLOAD_16(v2, 0xac2a, 0x38a5, 0x341a, 0xb7a7, 0x39ea, 0xb43d, 0xb758, 0x3860, + 0xbb44, 0x38fd, 0xba9f, 0xba5a, 0xa60b, 0xaf76, 0x3671, 0x1896); + asm volatile("vmfge.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(1, v1, 0xf2b7); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // -0.15601152, -0.92020410, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0xbe1fc17c, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0xbf4b1daf); + asm volatile("vmfge.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(2, v1, 0x7ffe); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, 0.4585094341291300, + // 0.8417440789882031, -0.1215927835809432, 0.9442717441528423, + // -0.3993868853091622, 0.5719771249018739, + // 0.0497853851400327, 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + asm volatile("vmfge.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(3, v1, 0x4f7b); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.2649, 0.5806, -0.2649, -0.4783, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, + VLOAD_16(v2, 0xb43d, 0x7653, 0xad3d, 0x033d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, + 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfge.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(4, v1, 0xaaaa); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // 0.80517912, 0.80517912, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0x3f4e2038, 0x3f4e2038, 0xbe967703, 0x3f7c66bb, 0x3f61b2e8, + 0xbee4905c, 0x3f61c543, 0x3e1b4092, 0xbf4cad78, 0xbd16465d, + 0xbec4f07b, 0xbf0c2627, 0x3dcbe820, 0x3e5dbf70, 0xbec04b31, + 0xbf4b1daf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfge.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(5, v1, 0x000a); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, -0.3394093097660049, + // 0.8417440789882031, -0.1215927835809432, + // 0.9442717441528423, -0.3993868853091622, + // 0.5719771249018739, 0.0497853851400327, + // 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfge.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(6, v1, 0x0a2a); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmfgt.c b/apps/riscv-tests/isa/rv64uv/vmfgt.c new file mode 100644 index 0000000..83b053b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmfgt.c @@ -0,0 +1,134 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// Simple random test with similar values (vector-scalar) +void TEST_CASE1(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.0651, 0.5806, 0.2563, -0.4783, 0.7393, -0.2649, -0.4590, + // 0.5469, -0.9082, 0.6235, -0.8276, -0.7939, -0.0236, -0.1166, + // 0.4026, 0.0022 + VLOAD_16(v2, 0xac2a, 0x38a5, 0x341a, 0xb7a7, 0x39ea, 0xb43d, 0xb758, 0x3860, + 0xbb44, 0x38fd, 0xba9f, 0xba5a, 0xa60b, 0xaf76, 0x3671, 0x1896); + asm volatile("vmfgt.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(1, v1, 0xf297); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // -0.15601152, -0.92020410, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0xbe1fc17c, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0xbf4b1daf); + asm volatile("vmfgt.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(2, v1, 0x0000); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, 0.4585094341291300, + // 0.8417440789882031, -0.1215927835809432, 0.9442717441528423, + // -0.3993868853091622, 0.5719771249018739, + // 0.0497853851400327, 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + asm volatile("vmfgt.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(3, v1, 0x4f73); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.2649, 0.5806, -0.2649, -0.4783, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, + VLOAD_16(v2, 0xb43d, 0x7653, 0xad3d, 0x033d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, + 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfgt.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(4, v1, 0x000a); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // 0.80517912, 0.80517912, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0x3f4e2038, 0x3f4e2038, 0xbe967703, 0x3f7c66bb, 0x3f61b2e8, + 0xbee4905c, 0x3f61c543, 0x3e1b4092, 0xbf4cad78, 0xbd16465d, + 0xbec4f07b, 0xbf0c2627, 0x3dcbe820, 0x3e5dbf70, 0xbec04b31, + 0xbf4b1daf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfgt.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(5, v1, 0x0008); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, -0.3394093097660049, + // 0.8417440789882031, -0.1215927835809432, + // 0.9442717441528423, -0.3993868853091622, + // 0.5719771249018739, 0.0497853851400327, + // 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfgt.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(6, v1, 0x0a22); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmfle.c b/apps/riscv-tests/isa/rv64uv/vmfle.c new file mode 100644 index 0000000..43b41c7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmfle.c @@ -0,0 +1,273 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// This instruction writes a mask to a register, with a layout of elements as +// described in section "Mask Register Layout" +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.0590, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x2b8c, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3041, 0xbb98); + asm volatile("vmfle.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(1, v1, 0x6325); + + VSET(16, e32, m1); + // +0, sNaN, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0xffffffff, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5b88a4); + // -0, sNaN, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, -0.00670803 + VLOAD_32(v3, 0x80000000, 0xffffffff, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0xbbdbcefe); + asm volatile("vmfle.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(2, v1, 0x0665); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0x3fdbb633afa4e520); + // -0.3562510538138417, -0.0135629748736219, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0xbfd6ccd13852f170, 0xbf8bc6e7ac263f80, 0x3fed8915c5665532, + 0x3fef0d4f6aafa2f6, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + asm volatile("vmfle.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(3, v1, 0x31bc); +}; + +// Simple random test with similar values + 1 subnormal (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.7285, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x39d4, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3507, 0xbb98); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfle.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(4, v1, 0x2222); + + VSET(16, e32, m1); + // 0x00000000, 0.09933749, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0x3dcb7174, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5d88a4); + // 0x00000000, -0.64782482, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, 0.85755372 + VLOAD_32(v3, 0x00000000, 0xbf25d7d9, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0x3f5d88a4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfle.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(5, v1, 0x8220); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, -0.7793965434104730 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0xbfe8f0d105120796); + // 0.8643613633211786, 0.4842301798024149, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfle.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(6, v1, 0xa0aa); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.0651, 0.5806, 0.2563, -0.4783, 0.7393, -0.2649, -0.4590, + // 0.5469, -0.9082, 0.6235, -0.8276, -0.7939, -0.0236, -0.1166, + // 0.4026, 0.0022 + VLOAD_16(v2, 0xac2a, 0x38a5, 0x341a, 0xb7a7, 0x39ea, 0xb43d, 0xb758, 0x3860, + 0xbb44, 0x38fd, 0xba9f, 0xba5a, 0xa60b, 0xaf76, 0x3671, 0x1896); + asm volatile("vmfle.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(7, v1, 0x0d68); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // -0.15601152, -0.92020410, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0xbe1fc17c, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0xbf4b1daf); + asm volatile("vmfle.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(8, v1, 0xffff); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, 0.4585094341291300, + // 0.8417440789882031, -0.1215927835809432, 0.9442717441528423, + // -0.3993868853091622, 0.5719771249018739, + // 0.0497853851400327, 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + asm volatile("vmfle.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(9, v1, 0xb08c); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.2649, 0.5806, -0.2649, -0.4783, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, + VLOAD_16(v2, 0xb43d, 0x7653, 0xad3d, 0x033d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, + 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfle.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(10, v1, 0xaaa0); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // 0.80517912, 0.80517912, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0x3f4e2038, 0x3f4e2038, 0xbe967703, 0x3f7c66bb, 0x3f61b2e8, + 0xbee4905c, 0x3f61c543, 0x3e1b4092, 0xbf4cad78, 0xbd16465d, + 0xbec4f07b, 0xbf0c2627, 0x3dcbe820, 0x3e5dbf70, 0xbec04b31, + 0xbf4b1daf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfle.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(11, v1, 0xaaa2); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, -0.3394093097660049, + // 0.8417440789882031, -0.1215927835809432, + // 0.9442717441528423, -0.3993868853091622, + // 0.5719771249018739, 0.0497853851400327, + // 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfle.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(12, v1, 0xa088); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmflt.c b/apps/riscv-tests/isa/rv64uv/vmflt.c new file mode 100644 index 0000000..912863d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmflt.c @@ -0,0 +1,279 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// This instruction writes a mask to a register, with a layout of elements as +// described in section "Mask Register Layout" +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.0590, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x2b8c, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3041, 0xbb98); + asm volatile("vmflt.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(1, v1, 0x6325); + + VSET(16, e32, m1); + // +0, sNaN, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0xffffffff, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5b88a4); + // -0, sNaN, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, -0.00670803 + VLOAD_32(v3, 0x80000000, 0xffffffff, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0xbbdbcefe); + asm volatile("vmflt.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(2, v1, 0x0664); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, 0.4329957213663693 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0x3fdbb633afa4e520); + // -0.3562510538138417, -0.0135629748736219, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0xbfd6ccd13852f170, 0xbf8bc6e7ac263f80, 0x3fed8915c5665532, + 0x3fef0d4f6aafa2f6, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + asm volatile("vmflt.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(3, v1, 0x31b8); +}; + +// Simple random test with similar values + 1 subnormal (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.7285, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x39d4, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3507, 0xbb98); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmflt.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(4, v1, 0x2220); + + VSET(16, e32, m1); + // 0x00000000, 0.09933749, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0x3dcb7174, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5d88a4); + // 0x00000000, -0.64782482, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, 0.85755372 + VLOAD_32(v3, 0x00000000, 0xbf25d7d9, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0x3f5d88a4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmflt.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(5, v1, 0x0220); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, -0.7793965434104730 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0xbfe8f0d105120796); + // 0.8643613633211786, 0.4842301798024149, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmflt.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(6, v1, 0x20a0); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.0651, 0.5806, 0.2563, -0.4783, 0.7393, -0.2649, -0.4590, + // 0.5469, -0.9082, 0.6235, -0.8276, -0.7939, -0.0236, -0.1166, + // 0.4026, 0.0022 + VLOAD_16(v2, 0xac2a, 0x38a5, 0x341a, 0xb7a7, 0x39ea, 0xb43d, 0xb758, 0x3860, + 0xbb44, 0x38fd, 0xba9f, 0xba5a, 0xa60b, 0xaf76, 0x3671, 0x1896); + asm volatile("vmflt.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(7, v1, 0x0d48); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // -0.15601152, -0.92020410, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0xbe1fc17c, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0xbf4b1daf); + asm volatile("vmflt.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(8, v1, 0x8001); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, 0.4585094341291300, + // 0.8417440789882031, -0.1215927835809432, 0.9442717441528423, + // -0.3993868853091622, 0.5719771249018739, + // 0.0497853851400327, 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + asm volatile("vmflt.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(9, v1, 0xb084); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.2649, 0.5806, -0.2649, -0.4783, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, + VLOAD_16(v2, 0xb43d, 0x7653, 0xad3d, 0x033d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, + 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmflt.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(10, v1, 0x0000); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // 0.80517912, 0.80517912, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0x3f4e2038, 0x3f4e2038, 0xbe967703, 0x3f7c66bb, 0x3f61b2e8, + 0xbee4905c, 0x3f61c543, 0x3e1b4092, 0xbf4cad78, 0xbd16465d, + 0xbec4f07b, 0xbf0c2627, 0x3dcbe820, 0x3e5dbf70, 0xbec04b31, + 0xbf4b1daf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmflt.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(11, v1, 0xaaa0); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, -0.3394093097660049, + // 0.8417440789882031, -0.1215927835809432, + // 0.9442717441528423, -0.3993868853091622, + // 0.5719771249018739, 0.0497853851400327, + // 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmflt.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(12, v1, 0xa080); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmfne.c b/apps/riscv-tests/isa/rv64uv/vmfne.c new file mode 100644 index 0000000..bc19a2e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmfne.c @@ -0,0 +1,503 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot +// Matteo Perotti + +#include "float_macros.h" +#include "vector_macros.h" + +// This instruction writes a mask to a register, with a layout of elements as +// described in section "Mask Register Layout" +void TEST_CASE1(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.0590, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x2b8c, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3041, 0xbb98); + asm volatile("vmfne.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(1, v1, 0xffff); + + VSET(16, e32, m1); + // +0, sNaN, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0xffffffff, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5b88a4); + // -0, sNaN, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, -0.00670803 + VLOAD_32(v3, 0x80000000, 0xffffffff, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0xbbdbcefe); + asm volatile("vmfne.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(2, v1, 0xfffe); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, 0.4329957213663693 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0x3fdbb633afa4e520); + // -0.3562510538138417, -0.0135629748736219, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0xbfd6ccd13852f170, 0xbf8bc6e7ac263f80, 0x3fed8915c5665532, + 0x3fef0d4f6aafa2f6, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + asm volatile("vmfne.vv v1, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(3, v1, 0xfffb); +}; + +// Simple random test with similar values + 1 subnormal (masked) +void TEST_CASE2(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.7285, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x39db, 0x39d4, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3507, 0xbb98); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(4, v1, 0xaaa8); + + VSET(16, e32, m1); + // 0x00000000, 0.09933749, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0x3dcb7174, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5d88a4); + // 0x00000000, -0.64782482, 0.39402914, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, 0.85755372 + VLOAD_32(v3, 0x00000000, 0xbf25d7d9, 0x3ec9be30, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0x3f5d88a4); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(5, v1, 0x2aaa); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, -0.7793965434104730 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0xbfe8f0d105120796); + // 0.8643613633211786, 0.4842301798024149, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfee55c27d3d743e, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v1, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(6, v1, 0x2aa0); +}; + +// Simple random test with similar values (vector-scalar) +void TEST_CASE3(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.0651, 0.5806, 0.2563, -0.4783, 0.7393, -0.2649, -0.4590, + // 0.5469, -0.9082, 0.6235, -0.8276, -0.7939, -0.0236, -0.1166, + // 0.4026, 0.0022 + VLOAD_16(v2, 0xac2a, 0x38a5, 0x341a, 0xb7a7, 0x39ea, 0xb43d, 0xb758, 0x3860, + 0xbb44, 0x38fd, 0xba9f, 0xba5a, 0xa60b, 0xaf76, 0x3671, 0x1896); + asm volatile("vmfne.vf v1, v2, %[A]" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(7, v1, 0xffdf); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // -0.15601152, -0.92020410, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0xbe1fc17c, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, 0x3f4e2038, + 0xbf4b1daf); + asm volatile("vmfne.vf v1, v2, %[A]" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(8, v1, 0x8001); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, 0.4585094341291300, + // 0.8417440789882031, -0.1215927835809432, 0.9442717441528423, + // -0.3993868853091622, 0.5719771249018739, + // 0.0497853851400327, 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + asm volatile("vmfne.vf v1, v2, %[A]" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(9, v1, 0xfff7); +}; + +// Simple random test with similar values (vector-scalar) (masked) +void TEST_CASE4(void) { + VSET(16, e16, m1); + double dscalar_16; + // -0.2649 + BOX_HALF_IN_DOUBLE(dscalar_16, 0xb43d); + // -0.2649, 0.5806, -0.2649, -0.4783, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, -0.2649, + // -0.2649, -0.2649, -0.2649, -0.2649, + VLOAD_16(v2, 0xb43d, 0x7653, 0xad3d, 0x033d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, + 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d, 0xb43d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16)); + VSET(1, e16, m1); + VCMP_U16(10, v1, 0x000a); + + VSET(16, e32, m1); + double dscalar_32; + // 0.80517912 + BOX_FLOAT_IN_DOUBLE(dscalar_32, 0x3f4e2038); + // 0.80517912, 0.80517912, -0.29387674, 0.98594254, + // 0.88163614, -0.44641387, 0.88191622, 0.15161350, + // -0.79952192, -0.03668820, -0.38464722, -0.54745716, + // 0.09956384, 0.21655059, -0.37557366, -0.79342169 + VLOAD_32(v2, 0x3f4e2038, 0x3f4e2038, 0xbe967703, 0x3f7c66bb, 0x3f61b2e8, + 0xbee4905c, 0x3f61c543, 0x3e1b4092, 0xbf4cad78, 0xbd16465d, + 0xbec4f07b, 0xbf0c2627, 0x3dcbe820, 0x3e5dbf70, 0xbec04b31, + 0xbf4b1daf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32)); + VSET(1, e16, m1); + VCMP_U16(11, v1, 0xaaa8); + + VSET(16, e64, m1); + double dscalar_64; + // -0.3394093097660049 + BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfd5b8e1d359c984); + // 0.8852775142880511, -0.1502080091211320, + // -0.7804423569145378, -0.3394093097660049, + // 0.8417440789882031, -0.1215927835809432, + // 0.9442717441528423, -0.3993868853091622, + // 0.5719771249018739, 0.0497853851400327, + // 0.6627817945481365, 0.2150621318612425, + // -0.8506676370622683, -0.4531982633526939, + // 0.5943189287417812, -0.5034380636605356 + VLOAD_64(v2, 0x3fec543182780b14, 0xbfc33a041b62e250, 0xbfe8f9623feb8e20, + 0xbfd5b8e1d359c984, 0x3feaef91475b6422, 0xbfbf20b464e8e5d0, + 0x3fee377960758bfa, 0xbfd98f8e02b6aa78, 0x3fe24da2f8b06fde, + 0x3fa97d7851fd8b80, 0x3fe535822a7efd70, 0x3fcb8727eb79dda0, + 0xbfeb38ab561e5658, 0xbfdd013349ed0b50, 0x3fe304a9214adedc, + 0xbfe01c2a245f7960); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64)); + VSET(1, e16, m1); + VCMP_U16(12, v1, 0xaaa2); +}; + +// Check if only the correct destination bits are written +void TEST_CASE5(void) { + // Fill 64-bits with 1 + VSET(1, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff); + // Perform vmfne.vv on 16 different elements, and then check that the last (64 + // - 16 = 48) bits were not overwritten with zeroes + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.8701, -0.5786, -0.4229, 0.5981, 0.6968, 0.7217, -0.2842, + // 0.1328, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3432, 0x3af6, + 0xb8a1, 0xb6c4, 0x38c9, 0x3993, 0x39c6, 0xb48c, 0x3040, 0x314f); + // 0.7319, 0.0590, 0.7593, -0.6606, -0.4758, 0.8530, 0.0453, + // 0.0987, 0.1777, 0.3047, 0.2330, -0.3467, -0.4153, 0.7080, + // 0.3142, -0.9492 + VLOAD_16(v3, 0x33ca, 0x2b8c, 0x3a13, 0xb949, 0xb79d, 0x3ad3, 0x29cc, 0x2e51, + 0x31b0, 0x34e0, 0x3375, 0xb58c, 0xb6a5, 0x39aa, 0x3041, 0xbb98); + asm volatile("vmfne.vv v1, v2, v3"); + VSET(1, e64, m1); + VCMP_U64(13, v1, 0xfffffffffffffffe); + + // Fill 64-bits with 1 + VSET(1, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff); + // Perform vmfne.vv on 16 different elements, and then check that the last (64 + // - 16 = 48) bits were not overwritten with zeroes + VSET(16, e32, m1); + // -0.72077256, sNaN, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x70000000, 0xffffffff, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5b88a4); + // 0.79994357, sNaN, -0.34645590, -0.81853813, + // 0.24656086, -0.71423489, -0.44735566, -0.25510681, + // -0.94378990, -0.30138883, 0.19188073, -0.29310879, + // -0.22981364, -0.58626360, -0.80913633, -0.00670803 + VLOAD_32(v3, 0x80000000, 0xffffffff, 0xbeb162ab, 0xbf518bb7, 0x3e7c7a73, + 0xbf36d819, 0xbee50bcd, 0xbe829d5c, 0xbf719c37, 0xbe9a4fa3, + 0x3e447c62, 0xbe96125b, 0xbe6b5444, 0xbf16155f, 0xbf4f238f, + 0xbbdbcefe); + asm volatile("vmfne.vv v1, v2, v3"); + VSET(1, e64, m1); + VCMP_U64(14, v1, 0xfffffffffffffffb); + + // Fill 64-bits with 1 + VSET(1, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff); + // Perform vmfne.vv on 16 different elements, and then check that the last (64 + // - 16 = 48) bits were not overwritten with zeroes + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.9479687162489723, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, 0.4329957213663693 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0xbf3180f63f75db3c, + 0xbfee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0x3fdbb633afa4e520); + // 0.8643613633211786, -0.0135629748736219, 0.6176167733891369, + // 0.9703747829163081, -0.0909539316920625, -0.1057326828885887, + // -0.8792039527057112, -0.1745056251010144, 0.3110320594479206, + // 0.3238986651420683, -0.9079294226891812, -0.9490909352855985, + // 0.6962970677624296, 0.7585780695949504, -0.5927175227484118, + // -0.7793965434104730 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0xbf8bc6e7ac263f80, 0x3fed8915c5665532, + 0x3fef0d4f6aafa2f6, 0xbfb748c1c20f5de0, 0xbfbb114c0f1ff4b0, + 0xbfec227053ec5198, 0xbfc6563348637140, 0x3fd3e7f302d586b4, + 0x3fd4bac177803510, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe64810c9cae3fe, 0x3fe84645840bf0a2, 0xbfe2f78abcff0ede, + 0xbfe8f0d105120796); + asm volatile("vmfne.vv v1, v2, v3"); + VSET(1, e64, m1); + VCMP_U64(15, v1, 0xfffffffffffffffe); +}; + +// Write to v0 during a masked operation, WAR dependency should be respected +void TEST_CASE6(void) { + VSET(16, e16, m1); + // 0.2434, 0.7285, 0.7241, 0.7241, 0.0027, -0.7114, 0.8701, + // 0.8701, -0.5786, -0.4229, 0.6968, 0.6968, 0.7217, -0.2842, + // 0.1659, 0.1659 + VLOAD_16(v2, 0x33ca, 0x39d4, 0x39cb, 0xb449, 0x1975, 0xb9b1, 0x3af6, 0x3af6, + 0xb8a1, 0xb6c4, 0x3993, 0x3993, 0x39c6, 0xb48c, 0x314f, 0x314f); + // 0.2434, 0.7285, -0.2678, -0.2678, 0.0027, -0.7114, 0.2622, + // 0.2622, -0.5786, -0.4229, 0.5981, 0.5981, 0.7217, -0.2842, + // 0.1328, 0.1328 + VLOAD_16(v3, 0x33ca, 0x39d4, 0xb449, 0x39cb, 0x1975, 0xb9b1, 0x3432, 0x3432, + 0xb8a1, 0xb6c4, 0x38c9, 0x38c9, 0x39c6, 0xb48c, 0x3040, 0x3040); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(16, v0, 0x8888); + + VSET(16, e32, m1); + // 0x00000000, 0.09933749, -0.34645590, -0.06222415, + // 0.96037650, -0.81018746, -0.69337404, 0.70466602, + // -0.30920035, -0.31596854, -0.92116749, 0.51336122, + // 0.22002794, 0.48599416, 0.69166088, 0.85755372 + VLOAD_32(v2, 0x00000000, 0x3dcb7174, 0xbeb162ab, 0xbd7edebf, 0x3f75db3c, + 0xbf4f6872, 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, + 0xbf6bd1a2, 0x3f036ba4, 0x3e614f01, 0x3ef8d43a, 0x3f3110b0, + 0x3f5d88a4); + // 0x00000000, 0.09933749, 0.39402914, -0.81853813, + // 0.96037650, -0.81018746, -0.44735566, -0.25510681, + // -0.30920035, -0.31596854, 0.19188073, -0.29310879, + // 0.22002794, 0.48599416, -0.80913633, -0.30138883 + VLOAD_32(v3, 0x00000000, 0x3dcb7174, 0x3ec9be30, 0xbf518bb7, 0x3f75db3c, + 0xbf4f6872, 0xbee50bcd, 0xbe829d5c, 0xbe9e4f82, 0xbea1c6a1, + 0x3e447c62, 0xbe96125b, 0x3e614f01, 0x3ef8d43a, 0xbf4f238f, + 0xbe9a4fa3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(17, v0, 0x8888); + + VSET(16, e64, m1); + // 0.8643613633211786, 0.4842301798024149, 0.9229840140784857, + // -0.8792039527057112, -0.1308855743137316, + // -0.3798019472030296, 0.1570811980936915, + // -0.7665403705017886, -0.3736408604742532, 0.4947226024634424, + // -0.3032110323317654, 0.8998114670494881, 0.6283940115157876, + // 0.1053912590957002, -0.2936564640984622, -0.7793965434104730 + VLOAD_64(v2, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0x3fed8915c5665532, + 0xbfec227053ec5198, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0x3fc41b3c98507fe0, 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfd367cf3ee9af68, 0x3feccb416af162fc, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfd2cb447b63f610, + 0xbfe8f0d105120796); + // 0.8643613633211786, 0.4842301798024149, -0.8792039527057112, + // 0.9703747829163081, -0.1308855743137316, -0.3798019472030296, + // -0.8792039527057112, -0.1745056251010144, + // -0.3736408604742532, 0.4947226024634424, + // -0.9079294226891812, -0.9490909352855985, 0.6283940115157876, + // 0.1053912590957002, -0.5927175227484118, -0.3032110323317654 + VLOAD_64(v3, 0x3feba8d9296c7e74, 0x3fdefda0947f3460, 0xbfec227053ec5198, + 0x9fee55c27d3d743e, 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, + 0xbfec227053ec5198, 0xbfc6563348637140, 0xbfd7e9bb5b0beaf8, + 0x3fdfa988fd8b0a24, 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, + 0x3fe41bcdc20ecd40, 0x3fbafaebeb19acf0, 0xbfe2f78abcff0ede, + 0xbfd367cf3ee9af68); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3, v0.t"); + VSET(1, e16, m1); + VCMP_U16(18, v0, 0x8888); +}; + +// Test sNaN/qNaN behaviour +void TEST_CASE7(void) { + CLEAR_FFLAGS; + // First, give only qNaN (no exception is generated) + VSET(16, e16, m1); + CHECK_FFLAGS(0); + VLOAD_16(v2, qNaNh, qNaNh, 0x39cb, qNaNh, 0x1975, 0xb9b1, 0x3af6, 0x3af6, + 0xb8a1, 0xb6c4, 0x3993, 0x3993, qNaNh, 0xb48c, qNaNh, qNaNh); + VLOAD_16(v3, 0x33ca, qNaNh, qNaNh, 0x39cb, 0x1975, 0xb9b1, 0x3432, 0x3432, + 0xb8a1, 0xb6c4, 0x38c9, 0x38c9, 0x39c6, qNaNh, qNaNh, 0x3040); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(19, v0, 0xfccf); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x3f75db3c, qNaNf, qNaNf, qNaNf, 0x3f75db3c, 0xbf4f6872, + 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, 0xbf6bd1a2, + 0x3f036ba4, qNaNf, qNaNf, 0x3f3110b0, qNaNf); + VLOAD_32(v3, 0x3f75db3c, 0x3dcb7174, qNaNf, 0xbf518bb7, 0x3f75db3c, + 0xbf4f6872, 0xbee50bcd, 0xbe829d5c, 0xbe9e4f82, 0xbea1c6a1, + 0x3e447c62, 0xbe96125b, qNaNf, 0x3ef8d43a, qNaNf, qNaNf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(20, v0, 0xfcce); + + VSET(16, e64, m1); + VLOAD_64(v2, qNaNd, qNaNd, 0x3fed8915c5665532, 0xbfec227053ec5198, + 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, 0x3fc41b3c98507fe0, + 0xbfe8877fabcbce12, 0xbfd7e9bb5b0beaf8, 0x3fdfa988fd8b0a24, + 0xbfd367cf3ee9af68, 0x3feccb416af162fc, qNaNd, qNaNd, + 0xbfd2cb447b63f610, qNaNd); + VLOAD_64(v3, qNaNd, 0x3fdefda0947f3460, qNaNd, 0x9fee55c27d3d743e, + 0xbfc0c0dbc6990b38, 0xbfd84eacd38c6ca4, 0xbfec227053ec5198, + 0xbfc6563348637140, 0xbfd7e9bb5b0beaf8, 0x3fdfa988fd8b0a24, + 0xbfed0dc20130d694, 0xbfee5ef3f3ff6a12, qNaNd, 0x3fbafaebeb19acf0, + qNaNd, qNaNd); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(21, v0, 0xfccf); + CHECK_FFLAGS(0); + + // Give sNaN (Invalid operation) + VSET(16, e32, m1); + VLOAD_32(v2, 0x3f75db3c, sNaNf, sNaNf, qNaNf, 0x3f75db3c, 0xbf4f6872, + 0xbf3180f6, 0x3f3464fe, 0xbe9e4f82, 0xbea1c6a1, 0xbf6bd1a2, + 0x3f036ba4, qNaNf, qNaNf, 0x3f3110b0, qNaNf); + VLOAD_32(v3, 0x3f75db3c, 0x3dcb7174, qNaNf, 0xbf518bb7, 0x3f75db3c, + 0xbf4f6872, 0xbee50bcd, 0xbe829d5c, 0xbe9e4f82, 0xbea1c6a1, + 0x3e447c62, 0xbe96125b, qNaNf, 0x3ef8d43a, qNaNf, qNaNf); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmfne.vv v0, v2, v3"); + VSET(1, e16, m1); + VCMP_U16(22, v0, 0xfcce); + CHECK_FFLAGS(NV); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + // TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmin.c b/apps/riscv-tests/isa/rv64uv/vmin.c new file mode 100644 index 0000000..65ec23e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmin.c @@ -0,0 +1,181 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmin.vv v1, v2, v3"); + VCMP_I16(1, v1, 50, -80, 400, -19900, 50, -80, 400, -19900, 50, -80, 400, + -19900, 50, -80, 400, -19900); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmin.vv v1, v2, v3"); + VCMP_I32(2, v1, 50, -80, 400, -19900, 50, -80, 400, -19900, 50, -80, 400, + -19900, 50, -80, 400, -19900); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vmin.vv v1, v2, v3"); + VCMP_I64(3, v1, 50, -80, 400, -19900, 50, -80, 400, -19900, 50, -80, 400, + -19900, 50, -80, 400, -19900); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vmin.vv v1, v2, v3, v0.t"); + VCMP_I16(4, v1, 0xbeef, 0xbeef, 400, -19900, 0xbeef, 0xbeef, 400, -19900, + 0xbeef, 0xbeef, 400, -19900, 0xbeef, 0xbeef, 400, -19900); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vmin.vv v1, v2, v3, v0.t"); + VCMP_I32(5, v1, 0xdeadbeef, 0xdeadbeef, 400, -19900, 0xdeadbeef, 0xdeadbeef, + 400, -19900, 0xdeadbeef, 0xdeadbeef, 400, -19900, 0xdeadbeef, + 0xdeadbeef, 400, -19900); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vmin.vv v1, v2, v3, v0.t"); + VCMP_I64(6, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, -19900, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, -19900, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, -19900, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, -19900); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + asm volatile("vmin.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(7, v1, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, -25, + 40); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + asm volatile("vmin.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(8, v1, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, + -25, 40); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + asm volatile("vmin.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(9, v1, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, + -25, 40); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + asm volatile("vmin.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(10, v1, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, -25, 40, 40, -8, + -25, 40); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef, 0xef, 0xef, 0xef, 0xef); + asm volatile("vmin.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(11, v1, 0xef, 0xef, -25, 40, 0xef, 0xef, -25, 40, 0xef, 0xef, -25, 40, + 0xef, 0xef, -25, 40); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vmin.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(12, v1, 0xbeef, 0xbeef, -25, 40, 0xbeef, 0xbeef, -25, 40, 0xbeef, + 0xbeef, -25, 40, 0xbeef, 0xbeef, -25, 40); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vmin.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(13, v1, 0xdeadbeef, 0xdeadbeef, -25, 40, 0xdeadbeef, 0xdeadbeef, -25, + 40, 0xdeadbeef, 0xdeadbeef, -25, 40, 0xdeadbeef, 0xdeadbeef, -25, + 40); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vmin.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(14, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, -25, 40, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, -25, 40, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, -25, 40, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + -25, 40); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vminu.c b/apps/riscv-tests/isa/rv64uv/vminu.c new file mode 100644 index 0000000..f6d8058 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vminu.c @@ -0,0 +1,176 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vminu.vv v1, v2, v3"); + VCMP_U16(1, v1, 50, 80, 400, 19900, 50, 80, 400, 19900, 50, 80, 400, 19900, + 50, 80, 400, 19900); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vminu.vv v1, v2, v3"); + VCMP_U32(2, v1, 50, 80, 400, 19900, 50, 80, 400, 19900, 50, 80, 400, 19900, + 50, 80, 400, 19900); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + asm volatile("vminu.vv v1, v2, v3"); + VCMP_U64(3, v1, 50, 80, 400, 19900, 50, 80, 400, 19900, 50, 80, 400, 19900, + 50, 80, 400, 19900); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vminu.vv v1, v2, v3, v0.t"); + VCMP_U16(4, v1, 0xbeef, 0xbeef, 400, 19900, 0xbeef, 0xbeef, 400, 19900, + 0xbeef, 0xbeef, 400, 19900, 0xbeef, 0xbeef, 400, 19900); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vminu.vv v1, v2, v3, v0.t"); + VCMP_U32(5, v1, 0xdeadbeef, 0xdeadbeef, 400, 19900, 0xdeadbeef, 0xdeadbeef, + 400, 19900, 0xdeadbeef, 0xdeadbeef, 400, 19900, 0xdeadbeef, + 0xdeadbeef, 400, 19900); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vminu.vv v1, v2, v3, v0.t"); + VCMP_U64(6, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, 19900, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, 19900, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, 19900, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 400, 19900); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + asm volatile("vminu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(7, v1, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + asm volatile("vminu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(8, v1, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + asm volatile("vminu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(9, v1, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + asm volatile("vminu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(10, v1, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40, 40, 8, 25, 40); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef, 0xef, 0xef, 0xef, 0xef); + asm volatile("vminu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(11, v1, 0xef, 0xef, 25, 40, 0xef, 0xef, 25, 40, 0xef, 0xef, 25, 40, + 0xef, 0xef, 25, 40); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vminu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(12, v1, 0xbeef, 0xbeef, 25, 40, 0xbeef, 0xbeef, 25, 40, 0xbeef, + 0xbeef, 25, 40, 0xbeef, 0xbeef, 25, 40); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef); + asm volatile("vminu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(13, v1, 0xdeadbeef, 0xdeadbeef, 25, 40, 0xdeadbeef, 0xdeadbeef, 25, + 40, 0xdeadbeef, 0xdeadbeef, 25, 40, 0xdeadbeef, 0xdeadbeef, 25, 40); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef); + asm volatile("vminu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(14, v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 25, 40, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 25, 40, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 25, 40, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 25, 40); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmnand.c b/apps/riscv-tests/isa/rv64uv/vmnand.c new file mode 100644 index 0000000..543fb28 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmnand.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmnand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0x7B, 0xDE); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmnand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0x32, 0x10); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmnand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0xFF, 0xFF); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmnand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0xF2, 0x1F); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmnand.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0x7B, 0xDE); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmnor.c b/apps/riscv-tests/isa/rv64uv/vmnor.c new file mode 100644 index 0000000..61a2f81 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmnor.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0x32, 0x10); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0x00, 0x00); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0x32, 0x10); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0x30, 0x00); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0x32, 0x10); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmor.c b/apps/riscv-tests/isa/rv64uv/vmor.c new file mode 100644 index 0000000..2ba46e4 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmor.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0xCD, 0xEF); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0xFF, 0xFF); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0xCD, 0xEF); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0xCF, 0xFF); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0xCD, 0xEF); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmornot.c b/apps/riscv-tests/isa/rv64uv/vmornot.c new file mode 100644 index 0000000..51ca143 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmornot.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmornot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0xFF, 0xFF); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmornot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0xCD, 0xEF); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmornot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0xFF, 0xFF); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmornot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0xFD, 0xEF); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmornot.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0xFF, 0xFF); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsbc.c b/apps/riscv-tests/isa/rv64uv/vmsbc.c new file mode 100644 index 0000000..19b9a41 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsbc.c @@ -0,0 +1,168 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xef, 10, 0xff, 16, 0xef, 10, 0xff, 16, 0xef, 10, 0xff, 16, + 0xef, 10, 0xff); + VLOAD_8(v2, 4, 0xef, 12, 0x80, 4, 0xef, 12, 0x80, 4, 0xef, 12, 0x80, 4, 0xef, + 12, 0x80); + VLOAD_8(v0, 0x99, 0x99); + asm volatile("vmsbc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(1, v3, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xbeef, 10, 0xffff, 16, 0xbeef, 10, 0xffff, 16, 0xbeef, 10, + 0xffff, 16, 0xbeef, 10, 0xffff); + VLOAD_16(v2, 4, 0xbeef, 12, 0x8000, 4, 0xbeef, 12, 0x8000, 4, 0xbeef, 12, + 0x8000, 4, 0xbeef, 12, 0x8000); + VLOAD_8(v0, 0x99, 0x99); + asm volatile("vmsbc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(2, v3, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xdeadbeef, 10, 0xffffffff, 16, 0xdeadbeef, 10, 0xffffffff, + 16, 0xdeadbeef, 10, 0xffffffff, 16, 0xdeadbeef, 10, 0xffffffff); + VLOAD_32(v2, 4, 0xdeadbeef, 12, 0x80000000, 4, 0xdeadbeef, 12, 0x80000000, 4, + 0xdeadbeef, 12, 0x80000000, 4, 0xdeadbeef, 12, 0x80000000); + VLOAD_8(v0, 0x99, 0x99); + asm volatile("vmsbc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(3, v3, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xdeadbeefdeadbeef, 10, 0xffffffffffffffff, 16, + 0xdeadbeefdeadbeef, 10, 0xffffffffffffffff, 16, 0xdeadbeefdeadbeef, + 10, 0xffffffffffffffff, 16, 0xdeadbeefdeadbeef, 10, + 0xffffffffffffffff); + VLOAD_64(v2, 4, 0xdeadbeefdeadbeef, 12, 0x8000000000000000, 4, + 0xdeadbeefdeadbeef, 12, 0x8000000000000000, 4, 0xdeadbeefdeadbeef, + 12, 0x8000000000000000, 4, 0xdeadbeefdeadbeef, 12, + 0x8000000000000000); + VLOAD_8(v0, 0x99, 0x99); + asm volatile("vmsbc.vvm v3, v1, v2, v0"); + VSET(2, e8, m1); + VCMP_U8(4, v3, 0x44, 0x44); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 16, 0xef, 10, 0xff, 16, 0xef, 10, 0xff, 16, 0xef, 10, 0xff, 16, + 0xef, 10, 0xff); + VLOAD_8(v2, 4, 0xef, 12, 0x80, 4, 0xef, 12, 0x80, 4, 0xef, 12, 0x80, 4, 0xef, + 12, 0x80); + asm volatile("vmsbc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(5, v3, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v1, 16, 0xbeef, 10, 0xffff, 16, 0xbeef, 10, 0xffff, 16, 0xbeef, 10, + 0xffff, 16, 0xbeef, 10, 0xffff); + VLOAD_16(v2, 4, 0xbeef, 12, 0x8000, 4, 0xbeef, 12, 0x8000, 4, 0xbeef, 12, + 0x8000, 4, 0xbeef, 12, 0x8000); + asm volatile("vmsbc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(6, v3, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v1, 16, 0xdeadbeef, 10, 0xffffffff, 16, 0xdeadbeef, 10, 0xffffffff, + 16, 0xdeadbeef, 10, 0xffffffff, 16, 0xdeadbeef, 10, 0xffffffff); + VLOAD_32(v2, 4, 0xdeadbeef, 12, 0x80000000, 4, 0xdeadbeef, 12, 0x80000000, 4, + 0xdeadbeef, 12, 0x80000000, 4, 0xdeadbeef, 12, 0x80000000); + asm volatile("vmsbc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(7, v3, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v1, 16, 0xdeadbeefdeadbeef, 10, 0xffffffffffffffff, 16, + 0xdeadbeefdeadbeef, 10, 0xffffffffffffffff, 16, 0xdeadbeefdeadbeef, + 10, 0xffffffffffffffff, 16, 0xdeadbeefdeadbeef, 10, + 0xffffffffffffffff); + VLOAD_64(v2, 4, 0xdeadbeefdeadbeef, 12, 0x8000000000000000, 4, + 0xdeadbeefdeadbeef, 12, 0x8000000000000000, 4, 0xdeadbeefdeadbeef, + 12, 0x8000000000000000, 4, 0xdeadbeefdeadbeef, 12, + 0x8000000000000000); + asm volatile("vmsbc.vv v3, v1, v2"); + VSET(2, e8, m1); + VCMP_U8(8, v3, 0x44, 0x44); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 20; + + VSET(16, e8, m1); + VLOAD_8(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + VLOAD_8(v0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0); + asm volatile("vmsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v3, 0x22, 0x22); + + VSET(16, e16, m1); + VLOAD_16(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + VLOAD_16(v0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0); + asm volatile("vmsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v3, 0x22, 0x22); + + VSET(16, e32, m1); + VLOAD_32(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + VLOAD_32(v0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0); + asm volatile("vmsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v3, 0x22, 0x22); + + VSET(16, e64, m1); + VLOAD_64(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + VLOAD_64(v0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0); + asm volatile("vmsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v3, 0x22, 0x22); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 20; + + VSET(16, e8, m1); + VLOAD_8(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + asm volatile("vmsbc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v3, 0x22, 0x22); + + VSET(16, e16, m1); + VLOAD_16(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + asm volatile("vmsbc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v3, 0x22, 0x22); + + VSET(16, e32, m1); + VLOAD_32(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + asm volatile("vmsbc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(15, v3, 0x22, 0x22); + + VSET(16, e64, m1); + VLOAD_64(v1, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25, 20, 10, 30, 25); + asm volatile("vmsbc.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(16, v3, 0x22, 0x22); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsbf.c b/apps/riscv-tests/isa/rv64uv/vmsbf.c new file mode 100644 index 0000000..eb92f3d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsbf.c @@ -0,0 +1,160 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsbf.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v2, 7, 0); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v3, 4, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsbf.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v2, 3, 0); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsbf.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v2, 0xff, 0xff); + + VSET(16, e8, m1); + VLOAD_8(v3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsbf.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(4, v2, 0, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + VSET(16, e32, m1); + asm volatile("vmsbf.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(5, v2, 0x07, 0x00); + + VSET(8, e64, m2); + VLOAD_64(v4, 0, 0, 0, 0, 0, 1, 0, 0); + VSET(512, e8, m2); + asm volatile("vmsbf.m v2, v4"); + VSET(16, e32, m2); + VCMP_U32(6, v2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0, 0, 0, + 0, 0, 0); + + VSET(16, e64, m2); + VLOAD_64(v4, 0, 0, 0, 0, 0, 1, 0, 0, 1685, 0, 0, 1, 0, 0, 0, 0); + VSET(1024, e8, m2); + asm volatile("vmsbf.m v2, v4"); + VSET(32, e32, m2); + VCMP_U32(7, v2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 3, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + VSET(2, e8, m1); + asm volatile("vmsbf.m v2, v3, v0.t"); + VCMP_U8(8, v2, 3, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 5, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + VSET(16, e8, m1); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(9, v2, 5, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x18, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 0xf7, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(10, v2, 0x07, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x18, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 0xef, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(11, v2, 0x07, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 0xf7, 0xff, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(12, v2, 0xf7, 0xff); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x38, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 0xf7, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(13, v2, 0x7, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 5, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + VSET(16, e8, m1); + asm volatile("vmsbf.m v2, v3, v0.t"); + VCMP_U8(14, v2, 5, 0); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 11, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(15, v2, 3, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 11, 0, 0, 0, 0, 0, 0, 0); + VCLEAR_AT_ONE(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(16, v2, 0xf7, 0xff); + + VSET(8, e8, m1); + VLOAD_8(v3, 0x94, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 0xC3, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsbf.m v2, v3, v0.t"); + VSET(1, e8, m1); + VCMP_U8(17, v2, 0x43); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmseq.c b/apps/riscv-tests/isa/rv64uv/vmseq.c new file mode 100644 index 0000000..b881857 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmseq.c @@ -0,0 +1,365 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, + 0x0f, 0xf2, 0x01, 0xf0, 0x0f); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0xcc, 0xcc); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_16(v3, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, + 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0xcc, 0xcc); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_32(v3, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, + 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0xcc, 0xcc); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_64(v3, 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, 0x0100000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, + 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0xcc, 0xcc); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, + 0x0f, 0xf2, 0x01, 0xf0, 0x0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_16(v3, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, + 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_32(v3, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, + 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_64(v3, 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, 0x0100000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, + 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 0x00000000ffffffff; + + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0x11, 0x11); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0x11, 0x11); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0x11, 0x11); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0x00, 0x00); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 0x00000000ffffffff; + + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x10, 0x10); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x10, 0x10); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(15, v1, 0x10, 0x10); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(16, v1, 0x00, 0x00); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, + 0x0f, 0x0f, 0x00, 0xf0, 0x0f); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(17, v1, 0x99, 0x99); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f, + 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(18, v1, 0x11, 0x11); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x0000000f, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(19, v1, 0x11, 0x11); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(20, v1, 0x11, 0x11); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, + 0x0f, 0x0f, 0x00, 0xf0, 0x0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(21, v1, 0x10, 0x10); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f, + 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(22, v1, 0x10, 0x10); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x0000000f, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(23, v1, 0x10, 0x10); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmseq.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(24, v1, 0x10, 0x10); +}; + +void TEST_CASE7(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, + 0x0f, 0xf2, 0x01, 0xf0, 0x0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR_AT_ONE(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(25, v1, 0xdd, 0xdd); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_16(v3, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, + 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR_AT_ONE(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(26, v1, 0xdd, 0xdd); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_32(v3, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, + 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR_AT_ONE(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(27, v1, 0xdd, 0xdd); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_64(v3, 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, 0x0100000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, + 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR_AT_ONE(v1); + asm volatile("vmseq.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(28, v1, 0xdd, 0xdd); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsgt.c b/apps/riscv-tests/isa/rv64uv/vmsgt.c new file mode 100644 index 0000000..8fb6978 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsgt.c @@ -0,0 +1,168 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0x99, 0x99); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0x99, 0x99); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0x99, 0x99); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x99, 0x99); +}; + +void TEST_CASE2(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0x99, 0x99); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0x99, 0x99); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0x99, 0x99); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0x99, 0x99); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0x88, 0x88); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x88, 0x88); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0x88, 0x88); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0x88, 0x88); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(15, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0x88, 0x88); + VCLEAR(v1); + asm volatile("vmsgt.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(16, v1, 0x88, 0x88); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsgtu.c b/apps/riscv-tests/isa/rv64uv/vmsgtu.c new file mode 100644 index 0000000..09fb63d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsgtu.c @@ -0,0 +1,168 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0x99, 0x99); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0x99, 0x99); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0x99, 0x99); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x99, 0x99); +}; + +void TEST_CASE2(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0xDD, 0xDD); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0xDD, 0xDD); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0xDD, 0xDD); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0xDD, 0xDD); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0xCC, 0xCC); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0xCC, 0xCC); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(15, v1, 0xCC, 0xCC); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsgtu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(16, v1, 0xCC, 0xCC); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsif.c b/apps/riscv-tests/isa/rv64uv/vmsif.c new file mode 100644 index 0000000..24a5f3f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsif.c @@ -0,0 +1,75 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsif.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v2, 15, 0); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsif.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v2, 0xff, 0xff); + + VSET(16, e8, m1); + VLOAD_8(v3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsif.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v2, 1, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + VSET(16, e32, m1); + asm volatile("vmsif.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(4, v2, 0x0F, 0x00); + + VSET(8, e64, m2); + VLOAD_64(v4, 0, 0, 0, 0, 0, 1, 0, 0); + VSET(512, e8, m2); + asm volatile("vmsif.m v2, v4"); + VSET(16, e32, m2); + VCMP_U32(5, v2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 1, 0, 0, + 0, 0, 0); + + VSET(16, e64, m2); + VLOAD_64(v4, 0, 0, 0, 0, 0, 1, 0, 0, 1685, 0, 0, 1, 0, 0, 0, 0); + VSET(1024, e8, m4); + asm volatile("vmsif.m v0, v4"); + VSET(32, e32, m2); + VCMP_U32(6, v0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 11, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsif.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(7, v2, 11, 0, 0, 0, 0, 0, 0, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsle.c b/apps/riscv-tests/isa/rv64uv/vmsle.c new file mode 100644 index 0000000..00fe0b2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsle.c @@ -0,0 +1,237 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 50, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsle.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0xAB, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v2, 50, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsle.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0xAB, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v2, 50, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsle.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0xAB, 0xAA); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x66, 0x66); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x66, 0x66); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0x66, 0x66); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0x66, 0x66); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x44, 0x44); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(15, v1, 0x66, 0x66); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(16, v1, 0x66, 0x66); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(17, v1, 0x66, 0x66); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(18, v1, 0x66, 0x66); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(19, v1, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(20, v1, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(21, v1, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsle.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(22, v1, 0x44, 0x44); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsleu.c b/apps/riscv-tests/isa/rv64uv/vmsleu.c new file mode 100644 index 0000000..0ca9b9d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsleu.c @@ -0,0 +1,237 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 50, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsleu.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0xAB, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v2, 50, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsleu.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0xAB, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v2, 50, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsleu.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0xAB, 0xAA); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x66, 0x66); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x66, 0x66); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0x66, 0x66); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0x66, 0x66); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x44, 0x44); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(15, v1, 0x22, 0x22); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(16, v1, 0x22, 0x22); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(17, v1, 0x22, 0x22); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(18, v1, 0x22, 0x22); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(19, v1, 0x00, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(20, v1, 0x00, 0x00); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(21, v1, 0x00, 0x00); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsleu.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(22, v1, 0x00, 0x00); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmslt.c b/apps/riscv-tests/isa/rv64uv/vmslt.c new file mode 100644 index 0000000..839604e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmslt.c @@ -0,0 +1,163 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmslt.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0xAA, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmslt.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0xAA, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmslt.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0xAA, 0xAA); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -80, 2560, -19900, 12345, -80, 2560, -19900, 12345, -80, + 2560, -19900, 12345, -80, 2560, -19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x66, 0x66); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x66, 0x66); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0x66, 0x66); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0x66, 0x66); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, -25, 99, 123, -8, + -25, 99); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, -8, -25, 199, 12345, -8, -25, 199, 12345, -8, -25, 199, + 12345, -8, -25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmslt.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x44, 0x44); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsltu.c b/apps/riscv-tests/isa/rv64uv/vmsltu.c new file mode 100644 index 0000000..4b70a26 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsltu.c @@ -0,0 +1,163 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsltu.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0xAA, 0xAA); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsltu.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0xAA, 0xAA); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VCLEAR(v1); + asm volatile("vmsltu.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0xAA, 0xAA); +}; + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_16(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x88, 0x88); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_32(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x88, 0x88); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 80, 2560, 19900, 12345, 80, 2560, 19900, 12345, 80, 2560, + 19900, 12345, 80, 2560, 19900); + VLOAD_64(v3, 50, 7000, 400, 19901, 50, 7000, 400, 19901, 50, 7000, 400, 19901, + 50, 7000, 400, 19901); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x88, 0x88); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x66, 0x66); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x66, 0x66); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0x66, 0x66); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0x66, 0x66); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 40; + + VSET(16, e8, m1); + VLOAD_8(v2, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, 199, 123, 8, 25, + 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0x44, 0x44); + + VSET(16, e16, m1); + VLOAD_16(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0x44, 0x44); + + VSET(16, e32, m1); + VLOAD_32(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x44, 0x44); + + VSET(16, e64, m1); + VLOAD_64(v2, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, 8, 25, 199, 12345, + 8, 25, 199); + VLOAD_8(v0, 0xCC, 0xCC); + VCLEAR(v1); + asm volatile("vmsltu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x44, 0x44); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsne.c b/apps/riscv-tests/isa/rv64uv/vmsne.c new file mode 100644 index 0000000..814e19d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsne.c @@ -0,0 +1,306 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, + 0x0f, 0xf2, 0x01, 0xf0, 0x0f); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v1, 0x33, 0x33); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_16(v3, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, + 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(2, v1, 0x33, 0x33); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_32(v3, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, + 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(3, v1, 0x33, 0x33); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_64(v3, 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, 0x0100000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, + 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3"); + VSET(2, e8, m1); + VCMP_U8(4, v1, 0x33, 0x33); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, 0x0f, 0xf2, 0x01, 0xf0, + 0x0f, 0xf2, 0x01, 0xf0, 0x0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(5, v1, 0x22, 0x22); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_16(v3, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, + 0xf2ff, 0x0100, 0xf0f0, 0x0f0f, 0xf2ff, 0x0100, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(6, v1, 0x22, 0x22); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_32(v3, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, + 0x01000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xfff2ffff, 0x01000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(7, v1, 0x22, 0x22); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_64(v3, 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, 0x0100000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xfff2ffffffffffff, + 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xfff2ffffffffffff, 0x0100000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0xaa, 0xaa); + VCLEAR(v1); + asm volatile("vmsne.vv v1, v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(8, v1, 0x22, 0x22); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 0x00000000ffffffff; + + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(9, v1, 0xee, 0xee); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(10, v1, 0xee, 0xee); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(11, v1, 0xee, 0xee); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(12, v1, 0xff, 0xff); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 0x00000000ffffffff; + + VSET(16, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, 0x0f, 0xff, 0x00, 0xf0, + 0x0f, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(13, v1, 0x00, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f, + 0xffff, 0x0000, 0xf0f0, 0x0f0f, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(14, v1, 0x00, 0x00); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0xffffffff, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(15, v1, 0x00, 0x00); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0xffffffffffffffff, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0xffffffffffffffff, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(2, e8, m1); + VCMP_U8(16, v1, 0x10, 0x10); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, + 0x0f, 0x0f, 0x00, 0xf0, 0x0f); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(17, v1, 0x66, 0x66); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f, + 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(18, v1, 0xee, 0xee); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x0000000f, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(19, v1, 0xee, 0xee); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15"); + VSET(2, e8, m1); + VCMP_U8(20, v1, 0xee, 0xee); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, 0x0f, 0x0f, 0x00, 0xf0, + 0x0f, 0x0f, 0x00, 0xf0, 0x0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(21, v1, 0x00, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f, + 0x000f, 0x0000, 0xf0f0, 0x0f0f, 0x000f, 0x0000, 0xf0f0, 0x0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(22, v1, 0x00, 0x00); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x0000000f, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, + 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0xf0f0f0f0, + 0x0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(23, v1, 0x00, 0x00); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, 0x0000000000000000, + 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, 0x000000000000000f, + 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, 0x0f0f0f0f0f0f0f0f, + 0x000000000000000f, 0x0000000000000000, 0xf0f0f0f0f0f0f0f0, + 0x0f0f0f0f0f0f0f0f); + VLOAD_8(v0, 0x10, 0x10); + VCLEAR(v1); + asm volatile("vmsne.vi v1, v2, 15, v0.t"); + VSET(2, e8, m1); + VCMP_U8(24, v1, 0x00, 0x00); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmsof.c b/apps/riscv-tests/isa/rv64uv/vmsof.c new file mode 100644 index 0000000..24db475 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmsof.c @@ -0,0 +1,43 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v3, 8, 0, 0, 0, 0, 0, 0, 0); + asm volatile("vmsof.m v2, v3"); + VSET(2, e8, m1); + VCMP_U8(1, v2, 8, 0); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v3, 0, 0, 0, 1, 0, 0, 0, 0); + VLOAD_8(v0, 3, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsof.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(2, v2, 0, 0); + + VSET(16, e8, m1); + VLOAD_8(v3, 0x38, 0, 0, 0, 0, 0, 0, 0); + VLOAD_8(v0, 0xf7, 0, 0, 0, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vmsof.m v2, v3, v0.t"); + VSET(2, e8, m1); + VCMP_U8(3, v2, 0x10, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmul.c b/apps/riscv-tests/isa/rv64uv/vmul.c new file mode 100644 index 0000000..58ef107 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmul.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xb3, 0x5d, 0x3d, 0xa4, 0xbf, 0xc7, 0x6b, 0x95, 0xf9, 0x64, 0x52, + 0x57, 0xbc, 0x1f, 0xd5, 0x13); + VLOAD_8(v3, 0x46, 0x37, 0xf5, 0x2b, 0x55, 0x05, 0xcb, 0x76, 0x31, 0x30, 0x78, + 0xb3, 0x6a, 0xae, 0x5a, 0xe1); + asm volatile("vmul.vv v1, v2, v3"); + VCMP_I8(1, v1, 0xf2, 0xfb, 0x61, 0x8c, 0x6b, 0xe3, 0xd9, 0xae, 0xa9, 0xc0, + 0x70, 0xd5, 0xd8, 0x12, 0xe2, 0xb3); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8132, 0x94b5, 0x245c, 0xd15d, 0xbfca, 0x18b6, 0xd5ba, 0x9299, + 0xccbd, 0x9ad4, 0xce46, 0xfbba, 0x10cc, 0xc463, 0x5298, 0x7b3e); + VLOAD_16(v3, 0xede6, 0x010b, 0xa570, 0x21c5, 0xfe5a, 0x5386, 0x16c9, 0x45fb, + 0x1439, 0x436f, 0x6f56, 0x90f7, 0x77c0, 0x0751, 0x64c3, 0x36e8); + asm volatile("vmul.vv v1, v2, v3"); + VCMP_I16(2, v1, 0x5cec, 0x18c7, 0x3440, 0x1991, 0xd904, 0xf144, 0xcb0a, + 0xf903, 0x5a15, 0x9dec, 0xa584, 0x8076, 0x6d00, 0xd853, 0x49c8, + 0xc430); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x9c2bdc58, 0xe3995899, 0xbbbc0eda, 0x0729ff92, 0xa757a2c5, + 0xd5f3a23e, 0x9a295390, 0xb2367b2e, 0xfee5b6a2, 0x07cb59c1, + 0x6bf5cf9a, 0x7d75506b, 0x013c1e90, 0x600f9ca8, 0x6d4d0522, + 0x0a225ff0); + VLOAD_32(v3, 0xc51e02f8, 0xae06b334, 0x397b1ec7, 0xc46f34fe, 0x4f9db2ab, + 0x957c2534, 0x70f8e127, 0xa79ebcec, 0x0a542044, 0x20e6ac3e, + 0xd61caed7, 0x6f4e7820, 0x27c56901, 0x0aaf1d61, 0xa95c6f5c, + 0x5b7aedf3); + asm volatile("vmul.vv v1, v2, v3"); + VCMP_I32(3, v1, 0x2c862540, 0x85aefa14, 0xa5ab1776, 0x3be33adc, 0x5487b397, + 0x57f7ea98, 0xc23d4af0, 0x55135668, 0xad00c308, 0x46f368be, + 0x2f640656, 0x91f63560, 0x1e952e90, 0xd18163a8, 0xf71f9638, + 0x79d240d0); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x077de9270ce00632, 0x2dadf4e020f3d47a, 0xb54ca84f9fe0573b, + 0x7be639dfdb02db6f, 0x61bb44569da93eff, 0xcd7f973ce822182b, + 0x5434a22e7432397c, 0xcaadfd89d8dd1ad5, 0x5474c56d9089d672, + 0x700e415c07b99bf9, 0xb89d409d4323a9c8, 0x68ccc7411db0ab09, + 0xdf4fe3fa4e113e98, 0xa98a2e2575b04c41, 0x26ddf248ccb4a7aa, + 0xdda1822d4972ee47); + VLOAD_64(v3, 0xcd2888c8bb07b736, 0xf20013627ac47d4f, 0xc05dbcd989ef329c, + 0xc272db2ebcf7cfad, 0x8869302db041176d, 0xd3d90968a9ee01c2, + 0x9cdb9f91a3381f51, 0x99ad38b70907ee8d, 0xf7d629b266c67cf1, + 0x706f9b996cdd60f2, 0x4caa2335622bd6a0, 0x94171c9dfbbb186f, + 0x7b6e42290f54ecc6, 0xa545b8670143bfbc, 0x9f430bf94b2805c9, + 0xb45030fc2b4cef12); + asm volatile("vmul.vv v1, v2, v3"); + VCMP_I64(4, v1, 0x90d27e278d0d0c8c, 0x5ea9d3e60b6623a6, 0x6823b3e240d3adf4, + 0xc0dcea378c760b03, 0x17692726a477bb93, 0x784c7f2ee6e87b96, + 0xd1aae9975ffa343c, 0xfdcd46ca398ccd51, 0x405f01791dce1952, + 0x16063fbe99e7d162, 0xc9d244cddacf4d00, 0x22024848323600e7, + 0xb6dfea3bb8ea8990, 0x566db9e82c5f7ebc, 0x5fc0f2db41adf67a, + 0xdaab68ca209d09fe); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xb3, 0x5d, 0x3d, 0xa4, 0xbf, 0xc7, 0x6b, 0x95, 0xf9, 0x64, 0x52, + 0x57, 0xbc, 0x1f, 0xd5, 0x13); + VLOAD_8(v3, 0x46, 0x37, 0xf5, 0x2b, 0x55, 0x05, 0xcb, 0x76, 0x31, 0x30, 0x78, + 0xb3, 0x6a, 0xae, 0x5a, 0xe1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0xfb, 0, 0x8c, 0, 0xe3, 0, 0xae, 0, 0xc0, 0, 0xd5, 0, 0x12, + 0, 0xb3); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8132, 0x94b5, 0x245c, 0xd15d, 0xbfca, 0x18b6, 0xd5ba, 0x9299, + 0xccbd, 0x9ad4, 0xce46, 0xfbba, 0x10cc, 0xc463, 0x5298, 0x7b3e); + VLOAD_16(v3, 0xede6, 0x010b, 0xa570, 0x21c5, 0xfe5a, 0x5386, 0x16c9, 0x45fb, + 0x1439, 0x436f, 0x6f56, 0x90f7, 0x77c0, 0x0751, 0x64c3, 0x36e8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0x18c7, 0, 0x1991, 0, 0xf144, 0, 0xf903, 0, 0x9dec, 0, + 0x8076, 0, 0xd853, 0, 0xc430); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x9c2bdc58, 0xe3995899, 0xbbbc0eda, 0x0729ff92, 0xa757a2c5, + 0xd5f3a23e, 0x9a295390, 0xb2367b2e, 0xfee5b6a2, 0x07cb59c1, + 0x6bf5cf9a, 0x7d75506b, 0x013c1e90, 0x600f9ca8, 0x6d4d0522, + 0x0a225ff0); + VLOAD_32(v3, 0xc51e02f8, 0xae06b334, 0x397b1ec7, 0xc46f34fe, 0x4f9db2ab, + 0x957c2534, 0x70f8e127, 0xa79ebcec, 0x0a542044, 0x20e6ac3e, + 0xd61caed7, 0x6f4e7820, 0x27c56901, 0x0aaf1d61, 0xa95c6f5c, + 0x5b7aedf3); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0x85aefa14, 0, 0x3be33adc, 0, 0x57f7ea98, 0, 0x55135668, 0, + 0x46f368be, 0, 0x91f63560, 0, 0xd18163a8, 0, 0x79d240d0); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x077de9270ce00632, 0x2dadf4e020f3d47a, 0xb54ca84f9fe0573b, + 0x7be639dfdb02db6f, 0x61bb44569da93eff, 0xcd7f973ce822182b, + 0x5434a22e7432397c, 0xcaadfd89d8dd1ad5, 0x5474c56d9089d672, + 0x700e415c07b99bf9, 0xb89d409d4323a9c8, 0x68ccc7411db0ab09, + 0xdf4fe3fa4e113e98, 0xa98a2e2575b04c41, 0x26ddf248ccb4a7aa, + 0xdda1822d4972ee47); + VLOAD_64(v3, 0xcd2888c8bb07b736, 0xf20013627ac47d4f, 0xc05dbcd989ef329c, + 0xc272db2ebcf7cfad, 0x8869302db041176d, 0xd3d90968a9ee01c2, + 0x9cdb9f91a3381f51, 0x99ad38b70907ee8d, 0xf7d629b266c67cf1, + 0x706f9b996cdd60f2, 0x4caa2335622bd6a0, 0x94171c9dfbbb186f, + 0x7b6e42290f54ecc6, 0xa545b8670143bfbc, 0x9f430bf94b2805c9, + 0xb45030fc2b4cef12); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0x5ea9d3e60b6623a6, 0, 0xc0dcea378c760b03, 0, + 0x784c7f2ee6e87b96, 0, 0xfdcd46ca398ccd51, 0, 0x16063fbe99e7d162, 0, + 0x22024848323600e7, 0, 0x566db9e82c5f7ebc, 0, 0xdaab68ca209d09fe); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x80, 0xb2, 0xb6, 0xd7, 0x4f, 0xbe, 0xee, 0x53, 0xab, 0x57, 0xe4, + 0x28, 0x6a, 0x91, 0x14, 0x4f); + int64_t scalar = 5; + asm volatile("vmul.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0x80, 0x7a, 0x8e, 0x33, 0x8b, 0xb6, 0xa6, 0x9f, 0x57, 0xb3, + 0x74, 0xc8, 0x12, 0xd5, 0x64, 0x8b); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xbab0, 0x83a5, 0x06b6, 0x22ba, 0x91b8, 0x7720, 0xc2c7, 0x3494, + 0xd281, 0x6d38, 0x378d, 0xa91d, 0xd731, 0xa4c7, 0x4d8f, 0x2422); + scalar = -5383; + asm volatile("vmul.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0x7530, 0xdd7d, 0xe306, 0xcaea, 0xebf8, 0x1e20, 0x598f, + 0x6bf4, 0xa979, 0x6b78, 0xea25, 0xff35, 0x18a9, 0x2b8f, 0x2617, + 0x3912); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x8bb4a8bc, 0x9799b344, 0xcd8c1672, 0xeb2d7c0f, 0x55474d7d, + 0x3dae9eaf, 0xc19a3519, 0x6922f03c, 0x42edfa01, 0x1f60b344, + 0x82f31d5e, 0x0faa2e5c, 0x74e95cfa, 0x9fcdae3b, 0xe6c4e0a0, + 0x45549cbc); + scalar = 6474219; + asm volatile("vmul.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0xaf4a8094, 0x77dff36c, 0x44dc1ca6, 0x16e6a8c5, 0xee2546bf, + 0x78e111a5, 0x1fd15ef3, 0xe8a9a314, 0xfe2147eb, 0x5a8cf36c, + 0x5536c34a, 0xbed6ca74, 0x23eca37e, 0xe2314329, 0x6857d2e0, + 0x13b37c94); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xc238e0a3df21299c, 0xb642655c3ab064d5, 0xd19f84bab77e5602, + 0x4e6e3c114a19f160, 0xfd403cbcc59407a1, 0xef3e81a68ae0e48c, + 0xd93a7b1ab54d024e, 0x5f7460aa9f4c4920, 0x4c91150cd4b54f60, + 0x18f2a6528629633f, 0x201b8bdb3c140400, 0x6be03c1074d46ada, + 0xcd0e6874555602d4, 0xb70264bd366ff52f, 0xc0b1fa64cec9368d, + 0x13e86249a0235941); + scalar = -598189234597999223; + asm volatile("vmul.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0x61ead1213f09307c, 0x7d03f4c84c5e86fd, 0x4aa0acc4e01fa112, + 0x77bc957fdeec0c60, 0x762b14c112e60229, 0xbac65562e2366aec, + 0xcc243dd1e80ab1be, 0xa871135122a1c220, 0x3d0db00992575a60, + 0x8b07763affcd8fb7, 0xc8377fc475ea2400, 0xd8827c839711c0aa, + 0x5a5779ec4f334774, 0x243fd844e74ed927, 0x49204b7602871a75, + 0x33ae5ea6d335d0c9); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x80, 0xb2, 0xb6, 0xd7, 0x4f, 0xbe, 0xee, 0x53, 0xab, 0x57, 0xe4, + 0x28, 0x6a, 0x91, 0x14, 0x4f); + int64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0x7a, 0, 0x33, 0, 0xb6, 0, 0x9f, 0, 0xb3, 0, 0xc8, 0, 0xd5, + 0, 0x8b); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xbab0, 0x83a5, 0x06b6, 0x22ba, 0x91b8, 0x7720, 0xc2c7, 0x3494, + 0xd281, 0x6d38, 0x378d, 0xa91d, 0xd731, 0xa4c7, 0x4d8f, 0x2422); + scalar = -5383; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0xdd7d, 0, 0xcaea, 0, 0x1e20, 0, 0x6bf4, 0, 0x6b78, 0, + 0xff35, 0, 0x2b8f, 0, 0x3912); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x8bb4a8bc, 0x9799b344, 0xcd8c1672, 0xeb2d7c0f, 0x55474d7d, + 0x3dae9eaf, 0xc19a3519, 0x6922f03c, 0x42edfa01, 0x1f60b344, + 0x82f31d5e, 0x0faa2e5c, 0x74e95cfa, 0x9fcdae3b, 0xe6c4e0a0, + 0x45549cbc); + scalar = 6474219; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0x77dff36c, 0, 0x16e6a8c5, 0, 0x78e111a5, 0, 0xe8a9a314, + 0, 0x5a8cf36c, 0, 0xbed6ca74, 0, 0xe2314329, 0, 0x13b37c94); + + VSET(16, e64, m1); + VLOAD_64(v2, 0xc238e0a3df21299c, 0xb642655c3ab064d5, 0xd19f84bab77e5602, + 0x4e6e3c114a19f160, 0xfd403cbcc59407a1, 0xef3e81a68ae0e48c, + 0xd93a7b1ab54d024e, 0x5f7460aa9f4c4920, 0x4c91150cd4b54f60, + 0x18f2a6528629633f, 0x201b8bdb3c140400, 0x6be03c1074d46ada, + 0xcd0e6874555602d4, 0xb70264bd366ff52f, 0xc0b1fa64cec9368d, + 0x13e86249a0235941); + scalar = -598189234597999223; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmul.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0x7d03f4c84c5e86fd, 0, 0x77bc957fdeec0c60, 0, + 0xbac65562e2366aec, 0, 0xa871135122a1c220, 0, 0x8b07763affcd8fb7, 0, + 0xd8827c839711c0aa, 0, 0x243fd844e74ed927, 0, 0x33ae5ea6d335d0c9); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmulh.c b/apps/riscv-tests/isa/rv64uv/vmulh.c new file mode 100644 index 0000000..035111b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmulh.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xc2, 0xf6, 0xad, 0x0f, 0xc6, 0xeb, 0xca, 0xf3, 0xf3, 0xd9, 0xf4, + 0xf6, 0x27, 0x57, 0x4f, 0xef); + VLOAD_8(v3, 0xf9, 0x0c, 0xa8, 0x05, 0x23, 0xff, 0x48, 0x74, 0xd4, 0x6b, 0x5b, + 0x07, 0x8b, 0x2e, 0x9e, 0x5f); + asm volatile("vmulh.vv v1, v2, v3"); + VCMP_I8(1, v1, 0x01, 0xff, 0x1c, 0x00, 0xf8, 0x00, 0xf0, 0xfa, 0x02, 0xef, + 0xfb, 0xff, 0xee, 0x0f, 0xe1, 0xf9); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x911a, 0x9f44, 0x3d2a, 0xa2a8, 0x5aae, 0x0231, 0x56fa, 0xb8b8, + 0x55df, 0x8a78, 0x413c, 0xeb32, 0x6bc4, 0x3e47, 0x3d79, 0x2c8f); + VLOAD_16(v3, 0x89fd, 0x6bb7, 0x4a94, 0x770c, 0x7c87, 0x8b01, 0xbb6a, 0x900d, + 0xb589, 0x709e, 0xc75d, 0xafa5, 0x4fd5, 0x2d77, 0x8dbf, 0x3a0a); + asm volatile("vmulh.vv v1, v2, v3"); + VCMP_I16(2, v1, 0x331f, 0xd74c, 0x11d1, 0xd497, 0x2c1c, 0xfeff, 0xe8b2, + 0x1f2b, 0xe705, 0xcc4b, 0xf191, 0x0687, 0x219b, 0x0b0f, 0xe490, + 0x0a1a); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xc66253f4, 0x710c314c, 0xa6fe579b, 0xa7947b70, 0xbf94259f, + 0x211088fe, 0x64bfd390, 0x1d49c8d8, 0x7a12a08a, 0x190ee9ae, + 0x361172f8, 0x52457515, 0x05d4b17b, 0x7bb6d43b, 0x96270cc7, + 0x62d35f88); + VLOAD_32(v3, 0xd14a266e, 0xe4f43ca5, 0x1c067312, 0xa1909d51, 0x35b8d1aa, + 0xdcd3e2ea, 0x05cec46d, 0xbe70ebd4, 0xe15e49c5, 0x81be068b, + 0x49fd9ad8, 0x6c2a5abd, 0x26216dd6, 0x9e3188ac, 0x14af13c4, + 0xd98c6d7f); + asm volatile("vmulh.vv v1, v2, v3"); + VCMP_I32(3, v1, 0x0a83425c, 0xf40e8502, 0xf6419389, 0x209df360, 0xf27b2982, + 0xfb750aac, 0x02491ecb, 0xf87fe57b, 0xf164b493, 0xf3a433c8, + 0x0fa089bb, 0x22c2e9f3, 0x00de5543, 0xd0bbf2cc, 0xf772a985, + 0xf128024f); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x9def74822cdf1a42, 0x29307e854b225449, 0x071cdf51785d150e, + 0xe8ced2e9009d363f, 0xa88c741be4e81893, 0x4a7655ec12afe587, + 0x50c5efa017138cb9, 0x88e076b6ef49619d, 0x5745683769adf333, + 0x5b3b01f4b1c4fd42, 0x8a3d55e48864d144, 0x2eac97fae4174cac, + 0xdb8804ccf6f55686, 0xf7bea87bac575241, 0x250ed7ddade1432d, + 0x06ae542295f32453); + VLOAD_64(v3, 0xc5c41e47b5f3de5f, 0xa03833fb95a7e7e2, 0x74f0573dba05b058, + 0x687968e9ba2a98ad, 0x29f4aaf3e5e4f2b6, 0x2c40a650d53f6f08, + 0x491da2c816388b78, 0x2822d8207421ec15, 0x5dd8d394b292512a, + 0x4169844eea56920d, 0x97183b6e1e85fd70, 0x224077bf8899614c, + 0x3a9c0520417d4f32, 0xee47b09a33f49fca, 0x3f9f1140fbd02e0a, + 0x6106ad88eabfc3e2); + asm volatile("vmulh.vv v1, v2, v3"); + VCMP_I64(4, v1, 0x164eafe1cab0639c, 0xf096db86d4d06824, 0x033fc2aecddc0dd7, + 0xf68905ef31703000, 0xf1aaea11162383ae, 0x0cdf24ba4cf3be38, + 0x1711cb1d2f008de9, 0xed52dbcaa3de5ca2, 0x1ffe218cf60b6bf9, + 0x174f95d97aff7bf9, 0x3041b22ecc97909a, 0x063ead2a7756c9da, + 0xf7a6973e6c9e5ce6, 0x0092485623082173, 0x0935add704f8cec8, + 0x02883a7e75391040); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xc2, 0xf6, 0xad, 0x0f, 0xc6, 0xeb, 0xca, 0xf3, 0xf3, 0xd9, 0xf4, + 0xf6, 0x27, 0x57, 0x4f, 0xef); + VLOAD_8(v3, 0xf9, 0x0c, 0xa8, 0x05, 0x23, 0xff, 0x48, 0x74, 0xd4, 0x6b, 0x5b, + 0x07, 0x8b, 0x2e, 0x9e, 0x5f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0xff, 0, 0x00, 0, 0x00, 0, 0xfa, 0, 0xef, 0, 0xff, 0, 0x0f, + 0, 0xf9); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x911a, 0x9f44, 0x3d2a, 0xa2a8, 0x5aae, 0x0231, 0x56fa, 0xb8b8, + 0x55df, 0x8a78, 0x413c, 0xeb32, 0x6bc4, 0x3e47, 0x3d79, 0x2c8f); + VLOAD_16(v3, 0x89fd, 0x6bb7, 0x4a94, 0x770c, 0x7c87, 0x8b01, 0xbb6a, 0x900d, + 0xb589, 0x709e, 0xc75d, 0xafa5, 0x4fd5, 0x2d77, 0x8dbf, 0x3a0a); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0xd74c, 0, 0xd497, 0, 0xfeff, 0, 0x1f2b, 0, 0xcc4b, 0, + 0x0687, 0, 0x0b0f, 0, 0x0a1a); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xc66253f4, 0x710c314c, 0xa6fe579b, 0xa7947b70, 0xbf94259f, + 0x211088fe, 0x64bfd390, 0x1d49c8d8, 0x7a12a08a, 0x190ee9ae, + 0x361172f8, 0x52457515, 0x05d4b17b, 0x7bb6d43b, 0x96270cc7, + 0x62d35f88); + VLOAD_32(v3, 0xd14a266e, 0xe4f43ca5, 0x1c067312, 0xa1909d51, 0x35b8d1aa, + 0xdcd3e2ea, 0x05cec46d, 0xbe70ebd4, 0xe15e49c5, 0x81be068b, + 0x49fd9ad8, 0x6c2a5abd, 0x26216dd6, 0x9e3188ac, 0x14af13c4, + 0xd98c6d7f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0xf40e8502, 0, 0x209df360, 0, 0xfb750aac, 0, 0xf87fe57b, 0, + 0xf3a433c8, 0, 0x22c2e9f3, 0, 0xd0bbf2cc, 0, 0xf128024f); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x9def74822cdf1a42, 0x29307e854b225449, 0x071cdf51785d150e, + 0xe8ced2e9009d363f, 0xa88c741be4e81893, 0x4a7655ec12afe587, + 0x50c5efa017138cb9, 0x88e076b6ef49619d, 0x5745683769adf333, + 0x5b3b01f4b1c4fd42, 0x8a3d55e48864d144, 0x2eac97fae4174cac, + 0xdb8804ccf6f55686, 0xf7bea87bac575241, 0x250ed7ddade1432d, + 0x06ae542295f32453); + VLOAD_64(v3, 0xc5c41e47b5f3de5f, 0xa03833fb95a7e7e2, 0x74f0573dba05b058, + 0x687968e9ba2a98ad, 0x29f4aaf3e5e4f2b6, 0x2c40a650d53f6f08, + 0x491da2c816388b78, 0x2822d8207421ec15, 0x5dd8d394b292512a, + 0x4169844eea56920d, 0x97183b6e1e85fd70, 0x224077bf8899614c, + 0x3a9c0520417d4f32, 0xee47b09a33f49fca, 0x3f9f1140fbd02e0a, + 0x6106ad88eabfc3e2); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0xf096db86d4d06824, 0, 0xf68905ef31703000, 0, + 0x0cdf24ba4cf3be38, 0, 0xed52dbcaa3de5ca2, 0, 0x174f95d97aff7bf9, 0, + 0x063ead2a7756c9da, 0, 0x0092485623082173, 0, 0x02883a7e75391040); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x92, 0xce, 0xdd, 0x64, 0x60, 0x29, 0xa6, 0xd5, 0x07, 0x8c, 0x71, + 0x94, 0x95, 0xf6, 0xd4, 0xbd); + int64_t scalar = 5; + asm volatile("vmulh.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0xfd, 0xff, 0xff, 0x01, 0x01, 0x00, 0xfe, 0xff, 0x00, 0xfd, + 0x02, 0xfd, 0xfd, 0xff, 0xff, 0xfe); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x3b9b, 0x7758, 0x030f, 0x9f60, 0x13e2, 0x8f0d, 0xfc9d, 0x3922, + 0x3a43, 0x58b5, 0xb9e9, 0xa4e8, 0x4bac, 0x5636, 0x9f4a, 0xbd52); + scalar = -5383; + asm volatile("vmulh.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0xfb1a, 0xf632, 0xffbf, 0x07ef, 0xfe5d, 0x0947, 0x0047, + 0xfb4e, 0xfb36, 0xf8b6, 0x05c1, 0x077b, 0xf9c8, 0xf8eb, 0x07f1, + 0x057a); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x7efca225, 0xdbc0a9ca, 0x0cf02cf8, 0xc19bdc84, 0x7fa3ca90, + 0x3d878c29, 0x15809928, 0x7b0b7421, 0x48b872f5, 0xafbfeab4, + 0xe79dc9ba, 0xe60a8fc0, 0x1fd7e866, 0xed7df17c, 0x0684a7ee, + 0xb2b01a61); + scalar = 6474219; + asm volatile("vmulh.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0x003100de, 0xfff20329, 0x0004fe25, 0xffe7ec74, 0x00314160, + 0x0017be6b, 0x00084c30, 0x002f7b6f, 0x001c0ff7, 0xffe1082b, + 0xfff6972b, 0xfff5fb91, 0x000c49c4, 0xfff8db9d, 0x000283ec, + 0xffe22a6f); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x42e9b386e7453715, 0xd6aae3fda4b2f3e8, 0xfcbec1ad7996a0b2, + 0x4fcb68f516b589c9, 0x414b0eeb29c35e62, 0x038c6221829f4241, + 0xf2c2c11f26e326b0, 0xed9ad0ce4d50a009, 0xc57105a57d435897, + 0x90c1615935c1abd0, 0xf5b41f9a0a988065, 0xb09790bdcbecee7b, + 0x1d9da4f87df33b54, 0xe347aadb53bdc879, 0x7a39a7269cbae2a7, + 0x422ed2952e246f26); + scalar = -598189234597999223; + asm volatile("vmulh.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0xfdd4850b300f6008, 0x01571f899f226d57, 0x001b0534decdc9a2, + 0xfd6994f8de6e51aa, 0xfde1f73873e6758a, 0xffe28b043b9b8971, + 0x006de7f819baba3d, 0x0098b57f65f599e1, 0x01e62040839e971b, + 0x039b807e6f36fd81, 0x005579d7e0c206af, 0x0293356120e5cee9, + 0xff0a24a69d9af87b, 0x00ee6bb505683322, 0xfc095797a6198143, + 0xfdda946cdb2f169c); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x92, 0xce, 0xdd, 0x64, 0x60, 0x29, 0xa6, 0xd5, 0x07, 0x8c, 0x71, + 0x94, 0x95, 0xf6, 0xd4, 0xbd); + int64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0xff, 0, 0x01, 0, 0x00, 0, 0xff, 0, 0xfd, 0, 0xfd, 0, 0xff, + 0, 0xfe); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x3b9b, 0x7758, 0x030f, 0x9f60, 0x13e2, 0x8f0d, 0xfc9d, 0x3922, + 0x3a43, 0x58b5, 0xb9e9, 0xa4e8, 0x4bac, 0x5636, 0x9f4a, 0xbd52); + scalar = -5383; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0xf632, 0, 0x07ef, 0, 0x0947, 0, 0xfb4e, 0, 0xf8b6, 0, + 0x077b, 0, 0xf8eb, 0, 0x057a); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x7efca225, 0xdbc0a9ca, 0x0cf02cf8, 0xc19bdc84, 0x7fa3ca90, + 0x3d878c29, 0x15809928, 0x7b0b7421, 0x48b872f5, 0xafbfeab4, + 0xe79dc9ba, 0xe60a8fc0, 0x1fd7e866, 0xed7df17c, 0x0684a7ee, + 0xb2b01a61); + scalar = 6474219; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0xfff20329, 0, 0xffe7ec74, 0, 0x0017be6b, 0, 0x002f7b6f, + 0, 0xffe1082b, 0, 0xfff5fb91, 0, 0xfff8db9d, 0, 0xffe22a6f); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x42e9b386e7453715, 0xd6aae3fda4b2f3e8, 0xfcbec1ad7996a0b2, + 0x4fcb68f516b589c9, 0x414b0eeb29c35e62, 0x038c6221829f4241, + 0xf2c2c11f26e326b0, 0xed9ad0ce4d50a009, 0xc57105a57d435897, + 0x90c1615935c1abd0, 0xf5b41f9a0a988065, 0xb09790bdcbecee7b, + 0x1d9da4f87df33b54, 0xe347aadb53bdc879, 0x7a39a7269cbae2a7, + 0x422ed2952e246f26); + scalar = -598189234597999223; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulh.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0x01571f899f226d57, 0, 0xfd6994f8de6e51aa, 0, + 0xffe28b043b9b8971, 0, 0x0098b57f65f599e1, 0, 0x039b807e6f36fd81, 0, + 0x0293356120e5cee9, 0, 0x00ee6bb505683322, 0, 0xfdda946cdb2f169c); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmulhsu.c b/apps/riscv-tests/isa/rv64uv/vmulhsu.c new file mode 100644 index 0000000..efb53b5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmulhsu.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x53, 0x4f, 0xde, 0xea, 0x47, 0x3c, 0x41, 0xf8, 0xd6, 0xd0, 0x93, + 0x35, 0xfc, 0x70, 0x33, 0xe4); + VLOAD_8(v3, 0xaa, 0x24, 0xaa, 0xde, 0x92, 0x00, 0x7f, 0xe5, 0xb3, 0xf8, 0xa0, + 0xa8, 0xbb, 0xc6, 0x65, 0x81); + asm volatile("vmulhsu.vv v1, v2, v3"); + VCMP_I8(1, v1, 0x37, 0x0b, 0xe9, 0xec, 0x28, 0x00, 0x20, 0xf8, 0xe2, 0xd1, + 0xbb, 0x22, 0xfd, 0x56, 0x14, 0xf1); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0f50, 0x47f9, 0xa4ca, 0xf94d, 0x720c, 0x444c, 0x3681, 0x96bd, + 0x5d37, 0xd64e, 0xe792, 0xdb64, 0xfaa6, 0xafe6, 0xf4e8, 0xe5ea); + VLOAD_16(v3, 0x7784, 0xa42e, 0x499b, 0x0c01, 0x9d2b, 0x600d, 0x2bbd, 0xcb41, + 0xdda1, 0xb5d7, 0xafbc, 0xc74f, 0xab45, 0x986f, 0xf0f2, 0xcf3c); + asm volatile("vmulhsu.vv v1, v2, v3"); + VCMP_I16(2, v1, 0x0726, 0x2e28, 0xe5c6, 0xffaf, 0x4604, 0x199f, 0x094f, + 0xac6d, 0x50b3, 0xe262, 0xef3a, 0xe37f, 0xfc6b, 0xd04d, 0xf58f, + 0xeae2); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xeded4bf3, 0xc9e27167, 0x4175509c, 0x80a3ae04, 0x9f1b2c07, + 0x87ea397b, 0x862e2800, 0x3cd09f37, 0x9a313d78, 0x596661ee, + 0x31f99717, 0x64e65802, 0xbd567027, 0xf7c459be, 0x57b6d9cd, + 0x94bc3eb4); + VLOAD_32(v3, 0xa147b233, 0x19880f3d, 0x8dd8815e, 0xbc318dca, 0x2c436b94, + 0x29ba4191, 0x637f89b7, 0xe39d7818, 0xf48ff2d6, 0xb1dc7c7e, + 0xfa5da298, 0x5c1aae36, 0x83e04069, 0xecf36c08, 0x40d2e3a3, + 0xe7468a97); + asm volatile("vmulhsu.vv v1, v2, v3"); + VCMP_I32(3, v1, 0xf49d2cff, 0xfa9a5a26, 0x2444f976, 0xa25f8c94, 0xef3f26f6, + 0xec6d24a0, 0xd0a728d5, 0x361265a6, 0x9ebdaf85, 0x3e1cc92b, + 0x30e004f5, 0x244d4baf, 0xdda8d640, 0xf8612ea2, 0x1635f870, + 0x9f184dfb); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x2b1f761d24dcff24, 0x1174fcea60fbf146, 0xaa5068c22e71489d, + 0x422ad458a7cbf321, 0x01e0f752e5d8bb37, 0xe7762162abff4c4c, + 0x36279dbbf009199d, 0x188dda33d835d9e4, 0xa0f5a67450e87d77, + 0xb43066649033e7ac, 0xb47ff6241cc77c2c, 0xfce0bafc1d36b615, + 0x045b90f3b63e0f7f, 0x514e5121be1f02e5, 0x06c9e97573723e47, + 0x406879d908a80b41); + VLOAD_64(v3, 0xd50adee8d491db29, 0xc7d423514dd58616, 0x5b22f7a3971e17f9, + 0xb9ad8b0339e659cd, 0x5af15755f3954b0f, 0x6b2fb3e49bd48e69, + 0x084244757fba5561, 0xf2d5b41ee89411fa, 0x8585111aaee16c07, + 0xcd1a427644b0ad59, 0x2356738fd6b04f3a, 0x89d936a76f0a518a, + 0x5f2df66443ff24b3, 0x6cbfcf273c43ae6b, 0xabb59d9f05a03eef, + 0xb84832df19fc19b6); + asm volatile("vmulhsu.vv v1, v2, v3"); + VCMP_I64(4, v1, 0x23e3020d5d8e40d8, 0x0da067e42d62fa2a, 0xe17ee107c3fdd97f, + 0x2ffdce53a7ef7aa4, 0x00aadc600f6180bd, 0xf5b9cd660e9f294b, + 0x01bf419feafa3fe5, 0x174a979243e0945b, 0xce6e38c0508aba17, + 0xc342fb3a620dde75, 0xf593ff8eafcca075, 0xfe519de4c807844e, + 0x019ec3149daf2fc0, 0x2289f5738e0e6d23, 0x048dafe18fe3288b, + 0x2e5d41c2cc9b604f); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x53, 0x4f, 0xde, 0xea, 0x47, 0x3c, 0x41, 0xf8, 0xd6, 0xd0, 0x93, + 0x35, 0xfc, 0x70, 0x33, 0xe4); + VLOAD_8(v3, 0xaa, 0x24, 0xaa, 0xde, 0x92, 0x00, 0x7f, 0xe5, 0xb3, 0xf8, 0xa0, + 0xa8, 0xbb, 0xc6, 0x65, 0x81); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0x0b, 0, 0xec, 0, 0x00, 0, 0xf8, 0, 0xd1, 0, 0x22, 0, 0x56, + 0, 0xf1); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0f50, 0x47f9, 0xa4ca, 0xf94d, 0x720c, 0x444c, 0x3681, 0x96bd, + 0x5d37, 0xd64e, 0xe792, 0xdb64, 0xfaa6, 0xafe6, 0xf4e8, 0xe5ea); + VLOAD_16(v3, 0x7784, 0xa42e, 0x499b, 0x0c01, 0x9d2b, 0x600d, 0x2bbd, 0xcb41, + 0xdda1, 0xb5d7, 0xafbc, 0xc74f, 0xab45, 0x986f, 0xf0f2, 0xcf3c); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0x2e28, 0, 0xffaf, 0, 0x199f, 0, 0xac6d, 0, 0xe262, 0, + 0xe37f, 0, 0xd04d, 0, 0xeae2); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xeded4bf3, 0xc9e27167, 0x4175509c, 0x80a3ae04, 0x9f1b2c07, + 0x87ea397b, 0x862e2800, 0x3cd09f37, 0x9a313d78, 0x596661ee, + 0x31f99717, 0x64e65802, 0xbd567027, 0xf7c459be, 0x57b6d9cd, + 0x94bc3eb4); + VLOAD_32(v3, 0xa147b233, 0x19880f3d, 0x8dd8815e, 0xbc318dca, 0x2c436b94, + 0x29ba4191, 0x637f89b7, 0xe39d7818, 0xf48ff2d6, 0xb1dc7c7e, + 0xfa5da298, 0x5c1aae36, 0x83e04069, 0xecf36c08, 0x40d2e3a3, + 0xe7468a97); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0xfa9a5a26, 0, 0xa25f8c94, 0, 0xec6d24a0, 0, 0x361265a6, 0, + 0x3e1cc92b, 0, 0x244d4baf, 0, 0xf8612ea2, 0, 0x9f184dfb); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x2b1f761d24dcff24, 0x1174fcea60fbf146, 0xaa5068c22e71489d, + 0x422ad458a7cbf321, 0x01e0f752e5d8bb37, 0xe7762162abff4c4c, + 0x36279dbbf009199d, 0x188dda33d835d9e4, 0xa0f5a67450e87d77, + 0xb43066649033e7ac, 0xb47ff6241cc77c2c, 0xfce0bafc1d36b615, + 0x045b90f3b63e0f7f, 0x514e5121be1f02e5, 0x06c9e97573723e47, + 0x406879d908a80b41); + VLOAD_64(v3, 0xd50adee8d491db29, 0xc7d423514dd58616, 0x5b22f7a3971e17f9, + 0xb9ad8b0339e659cd, 0x5af15755f3954b0f, 0x6b2fb3e49bd48e69, + 0x084244757fba5561, 0xf2d5b41ee89411fa, 0x8585111aaee16c07, + 0xcd1a427644b0ad59, 0x2356738fd6b04f3a, 0x89d936a76f0a518a, + 0x5f2df66443ff24b3, 0x6cbfcf273c43ae6b, 0xabb59d9f05a03eef, + 0xb84832df19fc19b6); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0x0da067e42d62fa2a, 0, 0x2ffdce53a7ef7aa4, 0, + 0xf5b9cd660e9f294b, 0, 0x174a979243e0945b, 0, 0xc342fb3a620dde75, 0, + 0xfe519de4c807844e, 0, 0x2289f5738e0e6d23, 0, 0x2e5d41c2cc9b604f); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x21, 0x87, 0xa0, 0xa8, 0x6a, 0x6f, 0x6a, 0x6b, 0x74, 0x99, 0x37, + 0xa4, 0xdc, 0x4f, 0xc3, 0x55); + uint64_t scalar = 5; + asm volatile("vmulhsu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0x00, 0xfd, 0xfe, 0xfe, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfd, + 0x01, 0xfe, 0xff, 0x01, 0xfe, 0x01); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x62b8, 0xc1e3, 0xb151, 0x08ce, 0x06c4, 0x1d2f, 0x7448, 0xfcd5, + 0x398c, 0xb933, 0x436d, 0x748f, 0x58d9, 0x1cd6, 0x86db, 0x20f2); + scalar = 816; + asm volatile("vmulhsu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0x013a, 0xff3a, 0xff05, 0x001c, 0x0015, 0x005d, 0x0172, + 0xfff5, 0x00b7, 0xff1e, 0x00d6, 0x0173, 0x011b, 0x005b, 0xfe7d, + 0x0069); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xa7cac3f7, 0xb3894e05, 0xbac8e70b, 0x05479577, 0x19d8bf63, + 0xb952c1ad, 0x9eaa74c0, 0x9e38d5c8, 0x51c77b3b, 0xa5f44521, + 0x65042faa, 0x8e7e5345, 0x76ae481c, 0x0ab27b6f, 0xa388cf2b, + 0x58218f7f); + scalar = 7389998; + asm volatile("vmulhsu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0xffd92575, 0xffde51c5, 0xffe1831f, 0x00025357, 0x000b6288, + 0xffe0de52, 0xffd5205d, 0xffd4ee51, 0x0024059f, 0xffd85637, + 0x002c7ed9, 0xffce00ba, 0x003446bb, 0x0004b63d, 0xffd7455b, + 0x0026d1e0); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x43c5f863d4be9b51, 0x70b017b4c5d0d11e, 0x9e008a07f48796fe, + 0x6f0fa9a63860308a, 0x07b5d372a7be167c, 0x234be9472899553e, + 0x25655d82cb668037, 0x959d6233470780ee, 0xf3d683308326232a, + 0x7b6dddfcd86d6737, 0x02b8177716c29a3e, 0x11220f42ce0594b4, + 0x8382e0c79caa1e6c, 0x0d1593d36c1dc00e, 0x9f8eb889cc8e98c6, + 0x37411f40369680d2); + scalar = 321156886679781445; + asm volatile("vmulhsu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0x012e0fe6705cf26d, 0x01f63e6c65840868, 0xfe4b3a837bcf749f, + 0x01eefe6ad67c584e, 0x00225d3cec11ae29, 0x009d50942207fb0e, + 0x00a6abfb9cc735df, 0xfe25d8c13270b026, 0xffc9cb59c445c91a, + 0x02261e05ece3e474, 0x000c1e7198242fc2, 0x004c5c6f8fd9129e, + 0xfdd529022c30504c, 0x003a50e3baabab1e, 0xfe522930314d6d7d, + 0x00f6440fa9591c62); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x21, 0x87, 0xa0, 0xa8, 0x6a, 0x6f, 0x6a, 0x6b, 0x74, 0x99, 0x37, + 0xa4, 0xdc, 0x4f, 0xc3, 0x55); + uint64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0xfd, 0, 0xfe, 0, 0x02, 0, 0x02, 0, 0xfd, 0, 0xfe, 0, 0x01, + 0, 0x01); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x62b8, 0xc1e3, 0xb151, 0x08ce, 0x06c4, 0x1d2f, 0x7448, 0xfcd5, + 0x398c, 0xb933, 0x436d, 0x748f, 0x58d9, 0x1cd6, 0x86db, 0x20f2); + scalar = 816; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0xff3a, 0, 0x001c, 0, 0x005d, 0, 0xfff5, 0, 0xff1e, 0, + 0x0173, 0, 0x005b, 0, 0x0069); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xa7cac3f7, 0xb3894e05, 0xbac8e70b, 0x05479577, 0x19d8bf63, + 0xb952c1ad, 0x9eaa74c0, 0x9e38d5c8, 0x51c77b3b, 0xa5f44521, + 0x65042faa, 0x8e7e5345, 0x76ae481c, 0x0ab27b6f, 0xa388cf2b, + 0x58218f7f); + scalar = 7389998; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0xffde51c5, 0, 0x00025357, 0, 0xffe0de52, 0, 0xffd4ee51, + 0, 0xffd85637, 0, 0xffce00ba, 0, 0x0004b63d, 0, 0x0026d1e0); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x43c5f863d4be9b51, 0x70b017b4c5d0d11e, 0x9e008a07f48796fe, + 0x6f0fa9a63860308a, 0x07b5d372a7be167c, 0x234be9472899553e, + 0x25655d82cb668037, 0x959d6233470780ee, 0xf3d683308326232a, + 0x7b6dddfcd86d6737, 0x02b8177716c29a3e, 0x11220f42ce0594b4, + 0x8382e0c79caa1e6c, 0x0d1593d36c1dc00e, 0x9f8eb889cc8e98c6, + 0x37411f40369680d2); + scalar = 321156886679781445; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhsu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0x01f63e6c65840868, 0, 0x01eefe6ad67c584e, 0, + 0x009d50942207fb0e, 0, 0xfe25d8c13270b026, 0, 0x02261e05ece3e474, 0, + 0x004c5c6f8fd9129e, 0, 0x003a50e3baabab1e, 0, 0x00f6440fa9591c62); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmulhu.c b/apps/riscv-tests/isa/rv64uv/vmulhu.c new file mode 100644 index 0000000..b72691e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmulhu.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x3b, 0xb2, 0xd1, 0x3e, 0x39, 0x2c, 0x08, 0xc5, 0xbf, 0x54, 0x6c, + 0xde, 0x87, 0xcb, 0x7a, 0x83); + VLOAD_8(v3, 0x55, 0xde, 0xf4, 0x14, 0x3c, 0xed, 0x47, 0x1b, 0xca, 0x0b, 0xc4, + 0xe3, 0xd8, 0x8f, 0xa0, 0x0d); + asm volatile("vmulhu.vv v1, v2, v3"); + VCMP_U8(1, v1, 0x13, 0x9a, 0xc7, 0x04, 0x0d, 0x28, 0x02, 0x14, 0x96, 0x03, + 0x52, 0xc4, 0x71, 0x71, 0x4c, 0x06); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xe6e1, 0x02a1, 0x2911, 0xe3c3, 0xe141, 0x69e6, 0x4133, 0xf783, + 0x91ef, 0x1897, 0xf0bb, 0x0e07, 0xb8eb, 0x3f5a, 0x9f5d, 0xa626); + VLOAD_16(v3, 0x4fcb, 0x8a38, 0xbaa0, 0x8a97, 0xe409, 0x558e, 0x582b, 0x62b1, + 0xf7bb, 0x181f, 0x2b5a, 0xdf85, 0x44f3, 0x27fe, 0x8412, 0xcda0); + asm volatile("vmulhu.vv v1, v2, v3"); + VCMP_U16(2, v1, 0x47f6, 0x016b, 0x1df0, 0x7b4d, 0xc8a5, 0x2364, 0x1674, + 0x5f6b, 0x8d38, 0x0251, 0x28c4, 0x0c3f, 0x31cd, 0x09e5, 0x5237, + 0x8574); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xf129e694, 0x8dfc72a3, 0xc9911598, 0xd20083ec, 0xe7f36604, + 0x1ab510aa, 0xc290b86c, 0xa7e9a02e, 0x5c3f3bb3, 0x70a3dfae, + 0x16baad22, 0x21758cfb, 0x09033e60, 0x8b31075e, 0x6439b7bf, + 0xead33cf0); + VLOAD_32(v3, 0x3f2ef56d, 0x12649032, 0x6c0a880b, 0x7cb2477a, 0x41525037, + 0x02a39cfa, 0xf7595181, 0x0c230035, 0x86cf9ea9, 0x0f66ddd3, + 0x13351370, 0xbe489ce5, 0x4127f488, 0xe6b5e1b3, 0xc6918270, + 0xccc8626a); + asm volatile("vmulhu.vv v1, v2, v3"); + VCMP_U32(3, v1, 0x3b858c79, 0x0a3386a5, 0x55117fe4, 0x664a7ee4, 0x3b2f618b, + 0x00467bcb, 0xbbfd8432, 0x07f5e895, 0x3093e98c, 0x06c6dd00, + 0x01b49139, 0x18debc33, 0x024b3af0, 0x7d70f100, 0x4dbd9bdf, + 0xbbd823dc); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x4aee1e4f9775ff4b, 0x045a804c3d3e7dc0, 0x1a2f38060efcd306, + 0x34e09e5173ee6301, 0xd1f03c2e38769683, 0x1b1f454816d4ed10, + 0xed4a4f231da4abb3, 0xc87b025e6da277dc, 0x8da43ddf6feb6aae, + 0x7dcf10ced634db74, 0x736fd9583bc2de91, 0xa66de0036d350cbc, + 0x40bf5ec7afca9ec2, 0x5bb552a7b134ba79, 0x6ae5d02d7c121603, + 0x8a7621ad8d6f104a); + VLOAD_64(v3, 0x8f2c0088bea2739e, 0x4ed8c54dad60d3cb, 0x51e715e5cf56b2e6, + 0xa1b1262536ea3c57, 0x67f334468e5cde4f, 0x8ae5618164bd63fd, + 0x2f8be93c1d7807c3, 0x0444a9f4ccff2a2c, 0x6cac5e35bf847d59, + 0x1d92c5117b87a392, 0x124597d21d757a4e, 0x4ec5a9fb5b8a6591, + 0xb5b4189dd6080734, 0xf75ddacea0effff6, 0x5c3cb19fbc1c7580, + 0xff93a562f06d3641); + asm volatile("vmulhu.vv v1, v2, v3"); + VCMP_U64(4, v1, 0x29e7e403b1955330, 0x015742ce71e2c757, 0x08609392d9402e03, + 0x2165dabfb788d03d, 0x553f1a1e61409141, 0x0eb728a66479b5fb, + 0x2c125410c5448322, 0x0357b1cf05241ad9, 0x3c20a893e10635bb, + 0x0e8895d7f39e953c, 0x083d3ee38137c9b0, 0x3335fb506009220b, + 0x2df4dacbb013b6b0, 0x589d920140d7dd8c, 0x2683eed8bb77fa43, + 0x8a3b86d4dd8169cf); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x3b, 0xb2, 0xd1, 0x3e, 0x39, 0x2c, 0x08, 0xc5, 0xbf, 0x54, 0x6c, + 0xde, 0x87, 0xcb, 0x7a, 0x83); + VLOAD_8(v3, 0x55, 0xde, 0xf4, 0x14, 0x3c, 0xed, 0x47, 0x1b, 0xca, 0x0b, 0xc4, + 0xe3, 0xd8, 0x8f, 0xa0, 0x0d); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0, 0x9a, 0, 0x04, 0, 0x28, 0, 0x14, 0, 0x03, 0, 0xc4, 0, 0x71, + 0, 0x06); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xe6e1, 0x02a1, 0x2911, 0xe3c3, 0xe141, 0x69e6, 0x4133, 0xf783, + 0x91ef, 0x1897, 0xf0bb, 0x0e07, 0xb8eb, 0x3f5a, 0x9f5d, 0xa626); + VLOAD_16(v3, 0x4fcb, 0x8a38, 0xbaa0, 0x8a97, 0xe409, 0x558e, 0x582b, 0x62b1, + 0xf7bb, 0x181f, 0x2b5a, 0xdf85, 0x44f3, 0x27fe, 0x8412, 0xcda0); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0, 0x016b, 0, 0x7b4d, 0, 0x2364, 0, 0x5f6b, 0, 0x0251, 0, + 0x0c3f, 0, 0x09e5, 0, 0x8574); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xf129e694, 0x8dfc72a3, 0xc9911598, 0xd20083ec, 0xe7f36604, + 0x1ab510aa, 0xc290b86c, 0xa7e9a02e, 0x5c3f3bb3, 0x70a3dfae, + 0x16baad22, 0x21758cfb, 0x09033e60, 0x8b31075e, 0x6439b7bf, + 0xead33cf0); + VLOAD_32(v3, 0x3f2ef56d, 0x12649032, 0x6c0a880b, 0x7cb2477a, 0x41525037, + 0x02a39cfa, 0xf7595181, 0x0c230035, 0x86cf9ea9, 0x0f66ddd3, + 0x13351370, 0xbe489ce5, 0x4127f488, 0xe6b5e1b3, 0xc6918270, + 0xccc8626a); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0, 0x0a3386a5, 0, 0x664a7ee4, 0, 0x00467bcb, 0, 0x07f5e895, 0, + 0x06c6dd00, 0, 0x18debc33, 0, 0x7d70f100, 0, 0xbbd823dc); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x4aee1e4f9775ff4b, 0x045a804c3d3e7dc0, 0x1a2f38060efcd306, + 0x34e09e5173ee6301, 0xd1f03c2e38769683, 0x1b1f454816d4ed10, + 0xed4a4f231da4abb3, 0xc87b025e6da277dc, 0x8da43ddf6feb6aae, + 0x7dcf10ced634db74, 0x736fd9583bc2de91, 0xa66de0036d350cbc, + 0x40bf5ec7afca9ec2, 0x5bb552a7b134ba79, 0x6ae5d02d7c121603, + 0x8a7621ad8d6f104a); + VLOAD_64(v3, 0x8f2c0088bea2739e, 0x4ed8c54dad60d3cb, 0x51e715e5cf56b2e6, + 0xa1b1262536ea3c57, 0x67f334468e5cde4f, 0x8ae5618164bd63fd, + 0x2f8be93c1d7807c3, 0x0444a9f4ccff2a2c, 0x6cac5e35bf847d59, + 0x1d92c5117b87a392, 0x124597d21d757a4e, 0x4ec5a9fb5b8a6591, + 0xb5b4189dd6080734, 0xf75ddacea0effff6, 0x5c3cb19fbc1c7580, + 0xff93a562f06d3641); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0, 0x015742ce71e2c757, 0, 0x2165dabfb788d03d, 0, + 0x0eb728a66479b5fb, 0, 0x0357b1cf05241ad9, 0, 0x0e8895d7f39e953c, 0, + 0x3335fb506009220b, 0, 0x589d920140d7dd8c, 0, 0x8a3b86d4dd8169cf); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x5c, 0x3c, 0x86, 0x65, 0x41, 0x38, 0x20, 0x9e, 0x88, 0x28, 0x19, + 0xc2, 0x5f, 0xa3, 0x7c, 0xca); + uint64_t scalar = 5; + asm volatile("vmulhu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x03, 0x01, 0x03, 0x02, 0x03); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x4e7f, 0xfe41, 0x1346, 0x6c1a, 0x38ce, 0x5fa7, 0x5e39, 0xf7a2, + 0x61aa, 0x0a3a, 0xfe0a, 0x30f1, 0x5852, 0xbb6b, 0x42f7, 0x58d9); + scalar = 816; + asm volatile("vmulhu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0x00fa, 0x032a, 0x003d, 0x0158, 0x00b5, 0x0130, 0x012c, + 0x0315, 0x0137, 0x0020, 0x0329, 0x009c, 0x0119, 0x0255, 0x00d5, + 0x011b); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x15c6221c, 0x0d704417, 0x3d90ffd1, 0x4e168273, 0xc3bd5e20, + 0xd75f62df, 0x3002ed42, 0x74269b1d, 0xc77bc0dd, 0x36f2552d, + 0x71b5888c, 0x02eb291b, 0x790cb3b1, 0xa3cf03c4, 0x8f90730a, + 0xf41b555a); + scalar = 7389998; + asm volatile("vmulhu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0x00099748, 0x0005eb5c, 0x001b1e60, 0x00226562, 0x00563815, + 0x005eddef, 0x001525e2, 0x00332972, 0x0057de3b, 0x001833e9, + 0x0032161d, 0x0001491b, 0x003551d9, 0x00482775, 0x003f3ca7, + 0x006b8612); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x96304201a90be11f, 0x11654d4226322e4b, 0xe16e5cf2c1183b63, + 0x447b5f4710764817, 0xb62589a3d309672c, 0x5ddec2e6716fd0d3, + 0xf31034a096a6d0fa, 0x9cb4dca46ce577f7, 0x30cf2e2dc6773d82, + 0x6129247d49c42f4b, 0x3d9ee22336a4e216, 0x3c9b9d533797be90, + 0x0c0c54042a20ddc8, 0xf309bda968a3a583, 0x550697570a1e9645, + 0x5beaf5933973231f); + scalar = 321156886679781445; + asm volatile("vmulhu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0x029d61da2f470da8, 0x004d882170361dd2, 0x03ecbc09716942cd, + 0x013138661b0ea1a1, 0x032bd162449d3f20, 0x01a25fd52874e6a2, + 0x043b51fe85cf352c, 0x02ba6ebb77802a7c, 0x00d98a5bba81dc57, + 0x01b10a47f99f8c44, 0x0112a3d22e03b6e9, 0x010e20461059ad6b, + 0x0035b2b00a44dfe2, 0x043b352e6dc32a00, 0x017af48bc4f5ad70, + 0x0199ac3dc8053978); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x5c, 0x3c, 0x86, 0x65, 0x41, 0x38, 0x20, 0x9e, 0x88, 0x28, 0x19, + 0xc2, 0x5f, 0xa3, 0x7c, 0xca); + uint64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0, 0x01, 0, 0x01, 0, 0x01, 0, 0x03, 0, 0x00, 0, 0x03, 0, 0x03, + 0, 0x03); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x4e7f, 0xfe41, 0x1346, 0x6c1a, 0x38ce, 0x5fa7, 0x5e39, 0xf7a2, + 0x61aa, 0x0a3a, 0xfe0a, 0x30f1, 0x5852, 0xbb6b, 0x42f7, 0x58d9); + scalar = 816; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0, 0x032a, 0, 0x0158, 0, 0x0130, 0, 0x0315, 0, 0x0020, 0, + 0x009c, 0, 0x0255, 0, 0x011b); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x15c6221c, 0x0d704417, 0x3d90ffd1, 0x4e168273, 0xc3bd5e20, + 0xd75f62df, 0x3002ed42, 0x74269b1d, 0xc77bc0dd, 0x36f2552d, + 0x71b5888c, 0x02eb291b, 0x790cb3b1, 0xa3cf03c4, 0x8f90730a, + 0xf41b555a); + scalar = 7389998; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0, 0x0005eb5c, 0, 0x00226562, 0, 0x005eddef, 0, 0x00332972, + 0, 0x001833e9, 0, 0x0001491b, 0, 0x00482775, 0, 0x006b8612); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x96304201a90be11f, 0x11654d4226322e4b, 0xe16e5cf2c1183b63, + 0x447b5f4710764817, 0xb62589a3d309672c, 0x5ddec2e6716fd0d3, + 0xf31034a096a6d0fa, 0x9cb4dca46ce577f7, 0x30cf2e2dc6773d82, + 0x6129247d49c42f4b, 0x3d9ee22336a4e216, 0x3c9b9d533797be90, + 0x0c0c54042a20ddc8, 0xf309bda968a3a583, 0x550697570a1e9645, + 0x5beaf5933973231f); + scalar = 321156886679781445; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vmulhu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0, 0x004d882170361dd2, 0, 0x013138661b0ea1a1, 0, + 0x01a25fd52874e6a2, 0, 0x02ba6ebb77802a7c, 0, 0x01b10a47f99f8c44, 0, + 0x010e20461059ad6b, 0, 0x043b352e6dc32a00, 0, 0x0199ac3dc8053978); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmv.c b/apps/riscv-tests/isa/rv64uv/vmv.c new file mode 100644 index 0000000..a913ec7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmv.c @@ -0,0 +1,104 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.v v3, v1"); + VCMP_U8(1, v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vmv.v.v v3, v1"); + VCMP_U16(2, v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vmv.v.v v3, v1"); + VCMP_U32(3, v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vmv.v.v v3, v1"); + VCMP_U64(4, v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +void TEST_CASE2() { + const uint64_t scalar = 0x00000000deadbeef; + + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.x v3, %[A]" ::[A] "r"(scalar)); + VCMP_U8(5, v3, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef, 0xef, 0xef, 0xef, 0xef, 0xef); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.x v3, %[A]" ::[A] "r"(scalar)); + VCMP_U16(6, v3, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.x v3, %[A]" ::[A] "r"(scalar)); + VCMP_U32(7, v3, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.x v3, %[A]" ::[A] "r"(scalar)); + VCMP_U64(8, v3, 0x00000000deadbeef, 0x00000000deadbeef, 0x00000000deadbeef, + 0x00000000deadbeef, 0x00000000deadbeef, 0x00000000deadbeef, + 0x00000000deadbeef, 0x00000000deadbeef, 0x00000000deadbeef, + 0x00000000deadbeef, 0x00000000deadbeef, 0x00000000deadbeef, + 0x00000000deadbeef, 0x00000000deadbeef, 0x00000000deadbeef, + 0x00000000deadbeef); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.i v3, -9"); + VCMP_U8(9, v3, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.i v3, -10"); + VCMP_U16(10, v3, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.i v3, -11"); + VCMP_U32(11, v3, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.v.i v3, -12"); + VCMP_U64(12, v3, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, + -12, -12, -12, -12); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmvnrr.c b/apps/riscv-tests/isa/rv64uv/vmvnrr.c new file mode 100644 index 0000000..10c9e32 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmvnrr.c @@ -0,0 +1,146 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// +// For simplicity, this test depends on vl1r and vs1r + +#include "vector_macros.h" + +uint64_t counter; + +// Maximum size: (VLEN/8 Bytes * (MAX_LMUL == 8)) = VLEN +// Define VLEN before compiling me +// #define VLEN VLEN +uint8_t gold_vec_8b[VLEN]; +uint8_t buf_vec_8b[VLEN]; + +/////////// +// vmv1r // +/////////// + +// 1 whole register load +void TEST_CASE1(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 8); + // Set vl and vtype to super short values + VSET(1, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Move the content to another register + asm volatile("vmv1r.v v1, v16"); + // Check that the whole register was loaded + asm volatile("vs1r.v v1, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 0, buf_vec_8b, gold_vec_8b, VLEN / 8); +} + +/////////// +// vmv2r // +/////////// + +// 2 whole registers load +void TEST_CASE2(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 4); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 4); + // Set vl and vtype to super short values + VSET(1, e64, m4); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl2re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Move the content to another register + asm volatile("vmv2r.v v2, v16"); + // Check that the whole register was loaded + asm volatile("vs2r.v v2, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 1, buf_vec_8b, gold_vec_8b, VLEN / 4); +} + +/////////// +// vmv4r // +/////////// + +// 4 whole registers load +void TEST_CASE3(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 2); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 2); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl4re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Move the content to another register + asm volatile("vmv4r.v v4, v16"); + // Check that the whole register was loaded + asm volatile("vs4r.v v4, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 2, buf_vec_8b, gold_vec_8b, VLEN / 2); +} + +/////////// +// vmv8r // +/////////// + +// 8 whole registers load +void TEST_CASE4(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + VCLEAR(v24); + // Load a buffer from memory - whole register load + asm volatile("vl8re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Move the content to another register + asm volatile("vmv8r.v v8, v16"); + // Check that the whole register was loaded + asm volatile("vs8r.v v8, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 3, buf_vec_8b, gold_vec_8b, VLEN); +} + +//////////// +// Others // +//////////// + +// Check with initial vl == 0 +void TEST_CASE5(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 8); + // Set vl and vtype to super short values + VSET(0, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Move the content to another register + asm volatile("vmv1r.v v1, v16"); + // Check that the whole register was loaded + asm volatile("vs1r.v v1, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 4, buf_vec_8b, gold_vec_8b, VLEN / 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmvsx.c b/apps/riscv-tests/isa/rv64uv/vmvsx.c new file mode 100644 index 0000000..9ad5cc0 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmvsx.c @@ -0,0 +1,75 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +int8_t scalar_8b; +int16_t scalar_16b; +int32_t scalar_32b; +int64_t scalar_64b; + +void TEST_CASE1() { + scalar_8b = 55 << 0; + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_8b)); + VCMP_I8(1, v1, scalar_8b); + + scalar_16b = 55 << 8; + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_16b)); + VCMP_I16(2, v1, scalar_16b); + + scalar_32b = 55 << 16; + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_32b)); + VCMP_I32(3, v1, scalar_32b); + + scalar_64b = 55 << 32; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_64b)); + VCMP_I64(4, v1, scalar_64b); +} + +// Check special cases +void TEST_CASE2() { + scalar_64b = 55 << 32; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET(16, e64, m8); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_64b)); + VSET(1, e64, m1); + VCMP_I64(5, v1, scalar_64b); + + scalar_64b = 55 << 32; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET_ZERO(e64, m1); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_64b)); + VSET(1, e64, m1); + VCMP_I64(6, v1, 1); + + scalar_64b = 55 << 32; + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET_ZERO(e64, m8); + asm volatile("vmv.s.x v1, %0" ::"r"(scalar_64b)); + VSET(1, e64, m1); + VCMP_I64(7, v1, 1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmvxs.c b/apps/riscv-tests/isa/rv64uv/vmvxs.c new file mode 100644 index 0000000..5d96ca5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmvxs.c @@ -0,0 +1,72 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +int8_t scalar_8b; +int16_t scalar_16b; +int32_t scalar_32b; +int64_t scalar_64b; + +void TEST_CASE1() { + scalar_8b = 0; + VSET(16, e8, m1); + VLOAD_8(v1, 55 << 0, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_8b)); + XCMP(1, scalar_8b, 55 << 0); + + scalar_16b = 0; + VSET(16, e16, m1); + VLOAD_16(v1, 55 << 8, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_16b)); + XCMP(2, scalar_16b, 55 << 8); + + scalar_32b = 0; + VSET(16, e32, m1); + VLOAD_32(v1, 55 << 16, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_32b)); + XCMP(3, scalar_32b, 55 << 16); + + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 55 << 30, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_64b)); + XCMP(4, scalar_64b, 55 << 30); +} + +// Check special cases +void TEST_CASE2() { + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 55 << 30, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET(16, e64, m8); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_64b)); + XCMP(5, scalar_64b, 55 << 30); + + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 55 << 30, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET_ZERO(e64, m1); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_64b)); + XCMP(6, scalar_64b, 55 << 30); + + scalar_64b = 0; + VSET(16, e64, m1); + VLOAD_64(v1, 55 << 30, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VSET_ZERO(e64, m8); + asm volatile("vmv.x.s %0, v1" : "=r"(scalar_64b)); + XCMP(7, scalar_64b, 55 << 30); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmxnor.c b/apps/riscv-tests/isa/rv64uv/vmxnor.c new file mode 100644 index 0000000..74820c1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmxnor.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmxnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0xB6, 0x31); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmxnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0xCD, 0xEF); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmxnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0x32, 0x10); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmxnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0x3D, 0xE0); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmxnor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0xB6, 0x31); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vmxor.c b/apps/riscv-tests/isa/rv64uv/vmxor.c new file mode 100644 index 0000000..444814a --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vmxor.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + asm volatile("vmxor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(1, v1, 0x49, 0xCE); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0xFF, 0xFF); + asm volatile("vmxor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(2, v1, 0x32, 0x10); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x00, 0x00); + asm volatile("vmxor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(3, v1, 0xCD, 0xEF); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x0F, 0xF0); + asm volatile("vmxor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(4, v1, 0xC2, 0x1F); +} + +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v1, 0xFF, 0xFF); + VLOAD_8(v2, 0xCD, 0xEF); + VLOAD_8(v3, 0x84, 0x21); + VSET(16, e8, m1); + asm volatile("vmxor.mm v1, v2, v3"); + VSET(16, e8, m1); + VCMP_U8(5, v1, 0x49, 0xCE); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vnclip.c b/apps/riscv-tests/isa/rv64uv/vnclip.c new file mode 100644 index 0000000..f66136e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vnclip.c @@ -0,0 +1,78 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Muhammad Ijaz + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + VLOAD_8(v4, 7, 7, 7, 7); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclip.wv v1, v2, v4"); + VCMP_I8(1, v1, 6, 0xff, 0xff, 0); +} + +void TEST_CASE2() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + VLOAD_8(v4, 7, 7, 7, 7); + VLOAD_8(v0, 0x5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclip.wv v1, v2, v4, v0.t"); + VCMP_I8(2, v1, 6, 0, 0xff, 0); +} + +void TEST_CASE3() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + int8_t scalar = 7; + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclip.wx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(3, v1, 6, 0xff, 0xff, 0); +} + +void TEST_CASE4() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + int8_t scalar = 7; + VLOAD_8(v0, 0x5, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclip.wx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(4, v1, 6, 0, 0xff, 0); +} + +void TEST_CASE5() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclip.wi v1, v2, 7"); + VCMP_I8(5, v1, 6, 0xff, 0xff, 0); +} + +void TEST_CASE6() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + VLOAD_8(v0, 0x5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclip.wi v1, v2, 7, v0.t"); + VCMP_I8(6, v1, 6, 0, 0xff, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vnclipu.c b/apps/riscv-tests/isa/rv64uv/vnclipu.c new file mode 100644 index 0000000..e98ac08 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vnclipu.c @@ -0,0 +1,78 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Muhammad Ijaz + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + VLOAD_8(v4, 7, 7, 7, 7); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclipu.wv v1, v2, v4"); + VCMP_U8(1, v1, 6, 0xff, 0xff, 0); +} + +void TEST_CASE2() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + VLOAD_8(v4, 7, 7, 7, 7); + VLOAD_8(v0, 0x5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclipu.wv v1, v2, v4, v0.t"); + VCMP_U8(2, v1, 6, 0, 0xff, 0); +} + +void TEST_CASE3() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + int8_t scalar = 7; + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclipu.wx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(3, v1, 6, 0xff, 0xff, 0); +} + +void TEST_CASE4() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + int8_t scalar = 7; + VLOAD_8(v0, 0x5, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclipu.wx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(4, v1, 6, 0, 0xff, 0); +} + +void TEST_CASE5() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclipu.wi v1, v2, 7"); + VCMP_U8(5, v1, 6, 0xff, 0xff, 0); +} + +void TEST_CASE6() { + VSET(4, e8, m1); + VLOAD_16(v2, 800, 65535, -50, 25); + VLOAD_8(v0, 0x5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vnclipu.wi v1, v2, 7, v0.t"); + VCMP_U8(6, v1, 6, 0, 0xff, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vnmsac.c b/apps/riscv-tests/isa/rv64uv/vnmsac.c new file mode 100644 index 0000000..34909b6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vnmsac.c @@ -0,0 +1,292 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v3, 0x41, 0x5b, 0xd0, 0x04, 0xc4, 0x7a, 0x91, 0xd1, 0x7b, 0x09, 0x85, + 0x59, 0x2b, 0xe3, 0x33, 0xb9); + VLOAD_8(v2, 0xc5, 0x4d, 0xad, 0x35, 0x81, 0x18, 0x48, 0x50, 0xe7, 0x95, 0x7b, + 0x18, 0xe6, 0x44, 0x57, 0xaf); + VLOAD_8(v1, 0x53, 0x13, 0x2c, 0xd8, 0x4a, 0xc3, 0xa3, 0xd7, 0x7e, 0x1f, 0x4c, + 0x4e, 0x2e, 0x7d, 0x13, 0x5a); + asm volatile("vnmsac.vv v1, v2, v3"); + VCMP_U8(1, v1, 0x4e, 0xb4, 0x9c, 0x04, 0x86, 0x53, 0xdb, 0x87, 0x81, 0xe2, + 0x65, 0xf6, 0x8c, 0x31, 0xbe, 0xe3); + + VSET(16, e16, m1); + VLOAD_16(v3, 0x9904, 0x5982, 0xa6cb, 0x73a1, 0x227e, 0xc8f6, 0x3eeb, 0xb010, + 0x14a1, 0xef2d, 0x3376, 0x371a, 0x4fc8, 0xbcca, 0xccd7, 0x9097); + VLOAD_16(v2, 0xb2dd, 0x9ca4, 0x72fe, 0xecab, 0x9909, 0xe1b0, 0x1769, 0x6759, + 0x9500, 0x3aae, 0x0637, 0xeadc, 0x7523, 0xa53c, 0xecc7, 0xaccc); + VLOAD_16(v1, 0xb917, 0x6a27, 0x0f0c, 0x04a2, 0xe0b6, 0x9fb1, 0x5c69, 0x21e2, + 0x3588, 0x8d19, 0x65d9, 0x6458, 0xfbff, 0xf949, 0x34a4, 0x0710); + asm volatile("vnmsac.vv v1, v2, v3"); + VCMP_U16(2, v1, 0xd8a3, 0xdadf, 0x2ba2, 0x5c17, 0x5c48, 0x4091, 0x7106, + 0x7c52, 0x8088, 0xca83, 0x937f, 0x4600, 0xaba7, 0x87f1, 0xc583, + 0x5abc); + + VSET(16, e32, m1); + VLOAD_32(v3, 0xe6f4ff60, 0xbf6a38db, 0x30f2ea92, 0x1763619e, 0x815c1c28, + 0x5f1b57db, 0xdb2cdc06, 0xab577f4a, 0x214746ac, 0xd3a08c15, + 0x35887ce9, 0x9d5a0f65, 0x76adea2b, 0x91b7f299, 0x6e2977fe, + 0xdcbcb1d7); + VLOAD_32(v2, 0x885c8baa, 0xbe200324, 0x9eaa49d7, 0x4e208dde, 0x802bbe9f, + 0x7633680e, 0xf1a79717, 0xe62e371e, 0x0fc25b48, 0x11067f38, + 0xc654ccb4, 0x6702a66c, 0x7a0b229d, 0x25c2b688, 0x82b68b3d, + 0x4224aa5e); + VLOAD_32(v1, 0x3a582428, 0x61c55f94, 0xb445799b, 0xcca5a657, 0x51a7fe9e, + 0x0840b4f8, 0xfb0a701b, 0x1b5361d7, 0xd10c9064, 0xa899d63d, + 0xbb1779fd, 0x1b35390c, 0xd04c0f6c, 0xd8c9db62, 0x90a09dc8, + 0x463438b4); + asm volatile("vnmsac.vv v1, v2, v3"); + VCMP_U32(3, v1, 0x0e7d6e68, 0x92cacfc8, 0x726ad6fd, 0x6ff2f953, 0xe1d4d1c6, + 0x466feefe, 0xa6512191, 0xdf6d912b, 0x7c898c04, 0x0a7ec6a5, + 0x2121fa29, 0x91713c70, 0x60b0bd0d, 0xb3a6341a, 0x82041c42, + 0x7a9625c2); + + VSET(16, e64, m1); + VLOAD_64(v3, 0xb8d79a755b98580a, 0xceefb8be6deb3a3d, 0x670688aed7c97cdd, + 0x0ced1db5e1b7da8f, 0x58993c2ae4a62e89, 0x864439a0768dce1b, + 0x7882d6539128d119, 0xfe6469348911945b, 0x6da189493780c328, + 0xf8c4931b61dc54dc, 0xd5ac914ccbf735f0, 0xba0a5bf3b2b528d1, + 0x74d814e6ebcebe81, 0xfc44af3a74cfee8c, 0xea0cb63d1bf7d5dc, + 0xbe98c841d80bd077); + VLOAD_64(v2, 0x5517b401c8fbd5ec, 0x021c52c329edd200, 0xff61d899305d1423, + 0xd886035fdcfe3186, 0x694b857cb1cc3bc3, 0x52376b9a996e1925, + 0x5785c45d41ec230d, 0x950f08c23f6da73d, 0xe5dc4e9a35834719, + 0x9a08d0e965e96a19, 0xb80c2107151bdcf6, 0xd0612e4d4bc314b7, + 0xdfb23a142b750482, 0xedc5e4b79881bdaf, 0x72c493d9df55bf13, + 0xfd4b1328b8f7773a); + VLOAD_64(v1, 0xc265b2d19ad92bbb, 0x81a4ef527fc2e042, 0xe490f5981f64a313, + 0xf12edb410132b013, 0xc475df4b52276fe9, 0x069e283bf74ca195, + 0x8dd5189f3a66f166, 0x297726422e620380, 0x7b74d167bd1b22fd, + 0x08e88e9642656a52, 0x0ab0c3f0f7ddeb66, 0x00b155918c8646c0, + 0x84d4df4b2a3768c7, 0xc31234734867ae09, 0x79320b8da693a84e, + 0x30727b2d1bccd396); + asm volatile("vnmsac.vv v1, v2, v3"); + VCMP_U64(4, v1, 0x231a763b4759b083, 0x68b16397da83d642, 0x7081592414ce4cdc, + 0x084dc189ec3eea39, 0x72cb55f70cac6a8e, 0xc713321c491334ae, + 0xa21580bb2ab1e821, 0x3d84da5e7dab4cd1, 0x735a758175effc15, + 0x91e8df24708208d6, 0x5133f0cd25a5d6c6, 0x2f1a889653a2c559, + 0x5f9f0ac7744ba745, 0xba1bbac1969a4055, 0x275025160493a4fa, + 0x21c02801006747a0); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v3, 0x41, 0x5b, 0xd0, 0x04, 0xc4, 0x7a, 0x91, 0xd1, 0x7b, 0x09, 0x85, + 0x59, 0x2b, 0xe3, 0x33, 0xb9); + VLOAD_8(v2, 0xc5, 0x4d, 0xad, 0x35, 0x81, 0x18, 0x48, 0x50, 0xe7, 0x95, 0x7b, + 0x18, 0xe6, 0x44, 0x57, 0xaf); + VLOAD_8(v1, 0x53, 0x13, 0x2c, 0xd8, 0x4a, 0xc3, 0xa3, 0xd7, 0x7e, 0x1f, 0x4c, + 0x4e, 0x2e, 0x7d, 0x13, 0x5a); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0x53, 0xb4, 0x2c, 0x04, 0x4a, 0x53, 0xa3, 0x87, 0x7e, 0xe2, + 0x4c, 0xf6, 0x2e, 0x31, 0x13, 0xe3); + + VSET(16, e16, m1); + VLOAD_16(v3, 0x9904, 0x5982, 0xa6cb, 0x73a1, 0x227e, 0xc8f6, 0x3eeb, 0xb010, + 0x14a1, 0xef2d, 0x3376, 0x371a, 0x4fc8, 0xbcca, 0xccd7, 0x9097); + VLOAD_16(v2, 0xb2dd, 0x9ca4, 0x72fe, 0xecab, 0x9909, 0xe1b0, 0x1769, 0x6759, + 0x9500, 0x3aae, 0x0637, 0xeadc, 0x7523, 0xa53c, 0xecc7, 0xaccc); + VLOAD_16(v1, 0xb917, 0x6a27, 0x0f0c, 0x04a2, 0xe0b6, 0x9fb1, 0x5c69, 0x21e2, + 0x3588, 0x8d19, 0x65d9, 0x6458, 0xfbff, 0xf949, 0x34a4, 0x0710); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0xb917, 0xdadf, 0x0f0c, 0x5c17, 0xe0b6, 0x4091, 0x5c69, + 0x7c52, 0x3588, 0xca83, 0x65d9, 0x4600, 0xfbff, 0x87f1, 0x34a4, + 0x5abc); + + VSET(16, e32, m1); + VLOAD_32(v3, 0xe6f4ff60, 0xbf6a38db, 0x30f2ea92, 0x1763619e, 0x815c1c28, + 0x5f1b57db, 0xdb2cdc06, 0xab577f4a, 0x214746ac, 0xd3a08c15, + 0x35887ce9, 0x9d5a0f65, 0x76adea2b, 0x91b7f299, 0x6e2977fe, + 0xdcbcb1d7); + VLOAD_32(v2, 0x885c8baa, 0xbe200324, 0x9eaa49d7, 0x4e208dde, 0x802bbe9f, + 0x7633680e, 0xf1a79717, 0xe62e371e, 0x0fc25b48, 0x11067f38, + 0xc654ccb4, 0x6702a66c, 0x7a0b229d, 0x25c2b688, 0x82b68b3d, + 0x4224aa5e); + VLOAD_32(v1, 0x3a582428, 0x61c55f94, 0xb445799b, 0xcca5a657, 0x51a7fe9e, + 0x0840b4f8, 0xfb0a701b, 0x1b5361d7, 0xd10c9064, 0xa899d63d, + 0xbb1779fd, 0x1b35390c, 0xd04c0f6c, 0xd8c9db62, 0x90a09dc8, + 0x463438b4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0x3a582428, 0x92cacfc8, 0xb445799b, 0x6ff2f953, 0x51a7fe9e, + 0x466feefe, 0xfb0a701b, 0xdf6d912b, 0xd10c9064, 0x0a7ec6a5, + 0xbb1779fd, 0x91713c70, 0xd04c0f6c, 0xb3a6341a, 0x90a09dc8, + 0x7a9625c2); + + VSET(16, e64, m1); + VLOAD_64(v3, 0xb8d79a755b98580a, 0xceefb8be6deb3a3d, 0x670688aed7c97cdd, + 0x0ced1db5e1b7da8f, 0x58993c2ae4a62e89, 0x864439a0768dce1b, + 0x7882d6539128d119, 0xfe6469348911945b, 0x6da189493780c328, + 0xf8c4931b61dc54dc, 0xd5ac914ccbf735f0, 0xba0a5bf3b2b528d1, + 0x74d814e6ebcebe81, 0xfc44af3a74cfee8c, 0xea0cb63d1bf7d5dc, + 0xbe98c841d80bd077); + VLOAD_64(v2, 0x5517b401c8fbd5ec, 0x021c52c329edd200, 0xff61d899305d1423, + 0xd886035fdcfe3186, 0x694b857cb1cc3bc3, 0x52376b9a996e1925, + 0x5785c45d41ec230d, 0x950f08c23f6da73d, 0xe5dc4e9a35834719, + 0x9a08d0e965e96a19, 0xb80c2107151bdcf6, 0xd0612e4d4bc314b7, + 0xdfb23a142b750482, 0xedc5e4b79881bdaf, 0x72c493d9df55bf13, + 0xfd4b1328b8f7773a); + VLOAD_64(v1, 0xc265b2d19ad92bbb, 0x81a4ef527fc2e042, 0xe490f5981f64a313, + 0xf12edb410132b013, 0xc475df4b52276fe9, 0x069e283bf74ca195, + 0x8dd5189f3a66f166, 0x297726422e620380, 0x7b74d167bd1b22fd, + 0x08e88e9642656a52, 0x0ab0c3f0f7ddeb66, 0x00b155918c8646c0, + 0x84d4df4b2a3768c7, 0xc31234734867ae09, 0x79320b8da693a84e, + 0x30727b2d1bccd396); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0xc265b2d19ad92bbb, 0x68b16397da83d642, 0xe490f5981f64a313, + 0x084dc189ec3eea39, 0xc475df4b52276fe9, 0xc713321c491334ae, + 0x8dd5189f3a66f166, 0x3d84da5e7dab4cd1, 0x7b74d167bd1b22fd, + 0x91e8df24708208d6, 0x0ab0c3f0f7ddeb66, 0x2f1a889653a2c559, + 0x84d4df4b2a3768c7, 0xba1bbac1969a4055, 0x79320b8da693a84e, + 0x21c02801006747a0); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v3, 0x5e, 0xf5, 0xa9, 0x0b, 0x14, 0x3c, 0x84, 0x22, 0xd7, 0xb6, 0x5c, + 0x90, 0xa2, 0x67, 0x3d, 0xf5); + VLOAD_8(v1, 0xfa, 0xd9, 0x2a, 0xe2, 0xe7, 0x1f, 0x8c, 0xbd, 0x40, 0x5d, 0x50, + 0x1f, 0xe0, 0xdd, 0x1f, 0xd7); + asm volatile("vnmsac.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0x24, 0x10, 0xdd, 0xab, 0x83, 0xf3, 0xf8, 0x13, 0x0d, 0xcf, + 0x84, 0x4f, 0xb6, 0xda, 0xee, 0x0e); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v3, 0xfe80, 0x3910, 0x5313, 0xefef, 0xecfc, 0x7983, 0xcc0d, 0x731f, + 0xf384, 0xfde3, 0x9cd1, 0xf20b, 0xa41b, 0x949a, 0x5886, 0xa1a9); + VLOAD_16(v1, 0xe886, 0xf1f9, 0x1857, 0xd0bb, 0x522e, 0x2de0, 0xa6c2, 0xd624, + 0xd024, 0x40a2, 0xdd99, 0xd517, 0xf00a, 0xae8d, 0x79a5, 0x519d); + asm volatile("vnmsac.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0x5e06, 0xd169, 0xecdc, 0xfb44, 0x7912, 0x3f75, 0x4c1d, + 0x86fd, 0x4cc0, 0xd0d7, 0x4c50, 0x5a64, 0xa3c7, 0x60c3, 0xe34f, + 0x9a3c); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v3, 0x48da7aac, 0x54e98600, 0xf49f26e5, 0x338e8406, 0x40ca82f5, + 0x75d0b8f6, 0x38c88af2, 0x96bb5c03, 0x6f61c0a9, 0x3626dd69, + 0x31aba619, 0x7d974a55, 0xbc63c280, 0x502334bf, 0x9451b955, + 0x6a8bae19); + VLOAD_32(v1, 0xcbd8537e, 0x36928a6c, 0x60cf8444, 0xa19ea650, 0x8f2a8694, + 0x050956bf, 0x1ef799f5, 0x43c0f327, 0x4bfd5a25, 0x7be439e4, + 0xed89a52a, 0x2bbf028d, 0x872392b9, 0x0ad55495, 0x865c7264, + 0xfcce4b64); + asm volatile("vnmsac.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0x6b20ab9a, 0x9dfe886c, 0xf983030d, 0xddd6bece, 0xf2a7f2ad, + 0x2f0a66ed, 0x59240bcf, 0x915f2166, 0x8c4ace02, 0x802d8981, + 0xf9fc8b37, 0xa3f70986, 0xced98739, 0xa4fbf240, 0x4249945d, + 0xdd51d971); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v3, 0x93adc14539897782, 0xa8d5d41c19b1455a, 0x55e01165195d2d9b, + 0xe81a26a17fef30f2, 0x33a71ede19aec0aa, 0x49598be14c5bc1cd, + 0x1c27bde3f488bfc6, 0x4188f9b8611e5d90, 0xd53289cca28a3b6b, + 0x3b435e1078e3bee9, 0x5e3f4c08c869abf4, 0x3c004920e9c39fb6, + 0x4b42a451b264b153, 0x110a6db11a7c2801, 0x7c0f358ac41d49fa, + 0x6e8c6ae4d14bd1a5); + VLOAD_64(v1, 0x3b0c6a3a651beecc, 0xb612caa033bc9bca, 0xda94340ac428ca78, + 0xf774b16ef94a22ea, 0x87df3c47c8113e43, 0x38487d57a064f677, + 0x358706b57ce6d6c7, 0xda111b3ac946811c, 0xe9ffed5b39f1ea1d, + 0x3c7e5a675c779870, 0x5d2ea63ac910e42e, 0xb3e832dbe2332203, + 0x05d366b426005f47, 0x00b3b58815a860d8, 0x023bbf8109263e1d, + 0x5fbc2f647d6c1153); + asm volatile("vnmsac.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0x60dd7609c833e03a, 0x79abe3a30a816ca0, 0x983ca4c97f204385, + 0x59a9303f04932768, 0x59c29659b4d00149, 0x59a15b1bb66f16c2, + 0x37b0445a8ebaa7d1, 0x65e0c3ab56fa1f0c, 0x94a740971b1d6eda, + 0xa1c7ff743113d8bf, 0xe8198a4799a97a9a, 0x5ccf06fd8751eb9d, + 0xa36557d05e8802dc, 0x10aae67f31dc2b4f, 0xe878939fd1287553, + 0x594538a8571dbf06); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v3, 0x5e, 0xf5, 0xa9, 0x0b, 0x14, 0x3c, 0x84, 0x22, 0xd7, 0xb6, 0x5c, + 0x90, 0xa2, 0x67, 0x3d, 0xf5); + VLOAD_8(v1, 0xfa, 0xd9, 0x2a, 0xe2, 0xe7, 0x1f, 0x8c, 0xbd, 0x40, 0x5d, 0x50, + 0x1f, 0xe0, 0xdd, 0x1f, 0xd7); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0xfa, 0x10, 0x2a, 0xab, 0xe7, 0xf3, 0x8c, 0x13, 0x40, 0xcf, + 0x50, 0x4f, 0xe0, 0xda, 0x1f, 0x0e); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v3, 0xfe80, 0x3910, 0x5313, 0xefef, 0xecfc, 0x7983, 0xcc0d, 0x731f, + 0xf384, 0xfde3, 0x9cd1, 0xf20b, 0xa41b, 0x949a, 0x5886, 0xa1a9); + VLOAD_16(v1, 0xe886, 0xf1f9, 0x1857, 0xd0bb, 0x522e, 0x2de0, 0xa6c2, 0xd624, + 0xd024, 0x40a2, 0xdd99, 0xd517, 0xf00a, 0xae8d, 0x79a5, 0x519d); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0xe886, 0xd169, 0x1857, 0xfb44, 0x522e, 0x3f75, 0xa6c2, + 0x86fd, 0xd024, 0xd0d7, 0xdd99, 0x5a64, 0xf00a, 0x60c3, 0x79a5, + 0x9a3c); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v3, 0x48da7aac, 0x54e98600, 0xf49f26e5, 0x338e8406, 0x40ca82f5, + 0x75d0b8f6, 0x38c88af2, 0x96bb5c03, 0x6f61c0a9, 0x3626dd69, + 0x31aba619, 0x7d974a55, 0xbc63c280, 0x502334bf, 0x9451b955, + 0x6a8bae19); + VLOAD_32(v1, 0xcbd8537e, 0x36928a6c, 0x60cf8444, 0xa19ea650, 0x8f2a8694, + 0x050956bf, 0x1ef799f5, 0x43c0f327, 0x4bfd5a25, 0x7be439e4, + 0xed89a52a, 0x2bbf028d, 0x872392b9, 0x0ad55495, 0x865c7264, + 0xfcce4b64); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0xcbd8537e, 0x9dfe886c, 0x60cf8444, 0xddd6bece, 0x8f2a8694, + 0x2f0a66ed, 0x1ef799f5, 0x915f2166, 0x4bfd5a25, 0x802d8981, + 0xed89a52a, 0xa3f70986, 0x872392b9, 0xa4fbf240, 0x865c7264, + 0xdd51d971); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v3, 0x93adc14539897782, 0xa8d5d41c19b1455a, 0x55e01165195d2d9b, + 0xe81a26a17fef30f2, 0x33a71ede19aec0aa, 0x49598be14c5bc1cd, + 0x1c27bde3f488bfc6, 0x4188f9b8611e5d90, 0xd53289cca28a3b6b, + 0x3b435e1078e3bee9, 0x5e3f4c08c869abf4, 0x3c004920e9c39fb6, + 0x4b42a451b264b153, 0x110a6db11a7c2801, 0x7c0f358ac41d49fa, + 0x6e8c6ae4d14bd1a5); + VLOAD_64(v1, 0x3b0c6a3a651beecc, 0xb612caa033bc9bca, 0xda94340ac428ca78, + 0xf774b16ef94a22ea, 0x87df3c47c8113e43, 0x38487d57a064f677, + 0x358706b57ce6d6c7, 0xda111b3ac946811c, 0xe9ffed5b39f1ea1d, + 0x3c7e5a675c779870, 0x5d2ea63ac910e42e, 0xb3e832dbe2332203, + 0x05d366b426005f47, 0x00b3b58815a860d8, 0x023bbf8109263e1d, + 0x5fbc2f647d6c1153); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsac.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0x3b0c6a3a651beecc, 0x79abe3a30a816ca0, 0xda94340ac428ca78, + 0x59a9303f04932768, 0x87df3c47c8113e43, 0x59a15b1bb66f16c2, + 0x358706b57ce6d6c7, 0x65e0c3ab56fa1f0c, 0xe9ffed5b39f1ea1d, + 0xa1c7ff743113d8bf, 0x5d2ea63ac910e42e, 0x5ccf06fd8751eb9d, + 0x05d366b426005f47, 0x10aae67f31dc2b4f, 0x023bbf8109263e1d, + 0x594538a8571dbf06); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vnmsub.c b/apps/riscv-tests/isa/rv64uv/vnmsub.c new file mode 100644 index 0000000..48a8b48 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vnmsub.c @@ -0,0 +1,292 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v1, 0x41, 0x5b, 0xd0, 0x04, 0xc4, 0x7a, 0x91, 0xd1, 0x7b, 0x09, 0x85, + 0x59, 0x2b, 0xe3, 0x33, 0xb9); + VLOAD_8(v2, 0xc5, 0x4d, 0xad, 0x35, 0x81, 0x18, 0x48, 0x50, 0xe7, 0x95, 0x7b, + 0x18, 0xe6, 0x44, 0x57, 0xaf); + VLOAD_8(v3, 0x53, 0x13, 0x2c, 0xd8, 0x4a, 0xc3, 0xa3, 0xd7, 0x7e, 0x1f, 0x4c, + 0x4e, 0x2e, 0x7d, 0x13, 0x5a); + asm volatile("vnmsub.vv v1, v2, v3"); + VCMP_U8(1, v1, 0x4e, 0xb4, 0x9c, 0x04, 0x86, 0x53, 0xdb, 0x87, 0x81, 0xe2, + 0x65, 0xf6, 0x8c, 0x31, 0xbe, 0xe3); + + VSET(16, e16, m1); + VLOAD_16(v1, 0x9904, 0x5982, 0xa6cb, 0x73a1, 0x227e, 0xc8f6, 0x3eeb, 0xb010, + 0x14a1, 0xef2d, 0x3376, 0x371a, 0x4fc8, 0xbcca, 0xccd7, 0x9097); + VLOAD_16(v2, 0xb2dd, 0x9ca4, 0x72fe, 0xecab, 0x9909, 0xe1b0, 0x1769, 0x6759, + 0x9500, 0x3aae, 0x0637, 0xeadc, 0x7523, 0xa53c, 0xecc7, 0xaccc); + VLOAD_16(v3, 0xb917, 0x6a27, 0x0f0c, 0x04a2, 0xe0b6, 0x9fb1, 0x5c69, 0x21e2, + 0x3588, 0x8d19, 0x65d9, 0x6458, 0xfbff, 0xf949, 0x34a4, 0x0710); + asm volatile("vnmsub.vv v1, v2, v3"); + VCMP_U16(2, v1, 0xd8a3, 0xdadf, 0x2ba2, 0x5c17, 0x5c48, 0x4091, 0x7106, + 0x7c52, 0x8088, 0xca83, 0x937f, 0x4600, 0xaba7, 0x87f1, 0xc583, + 0x5abc); + + VSET(16, e32, m1); + VLOAD_32(v1, 0xe6f4ff60, 0xbf6a38db, 0x30f2ea92, 0x1763619e, 0x815c1c28, + 0x5f1b57db, 0xdb2cdc06, 0xab577f4a, 0x214746ac, 0xd3a08c15, + 0x35887ce9, 0x9d5a0f65, 0x76adea2b, 0x91b7f299, 0x6e2977fe, + 0xdcbcb1d7); + VLOAD_32(v2, 0x885c8baa, 0xbe200324, 0x9eaa49d7, 0x4e208dde, 0x802bbe9f, + 0x7633680e, 0xf1a79717, 0xe62e371e, 0x0fc25b48, 0x11067f38, + 0xc654ccb4, 0x6702a66c, 0x7a0b229d, 0x25c2b688, 0x82b68b3d, + 0x4224aa5e); + VLOAD_32(v3, 0x3a582428, 0x61c55f94, 0xb445799b, 0xcca5a657, 0x51a7fe9e, + 0x0840b4f8, 0xfb0a701b, 0x1b5361d7, 0xd10c9064, 0xa899d63d, + 0xbb1779fd, 0x1b35390c, 0xd04c0f6c, 0xd8c9db62, 0x90a09dc8, + 0x463438b4); + asm volatile("vnmsub.vv v1, v2, v3"); + VCMP_U32(3, v1, 0x0e7d6e68, 0x92cacfc8, 0x726ad6fd, 0x6ff2f953, 0xe1d4d1c6, + 0x466feefe, 0xa6512191, 0xdf6d912b, 0x7c898c04, 0x0a7ec6a5, + 0x2121fa29, 0x91713c70, 0x60b0bd0d, 0xb3a6341a, 0x82041c42, + 0x7a9625c2); + + VSET(16, e64, m1); + VLOAD_64(v1, 0xb8d79a755b98580a, 0xceefb8be6deb3a3d, 0x670688aed7c97cdd, + 0x0ced1db5e1b7da8f, 0x58993c2ae4a62e89, 0x864439a0768dce1b, + 0x7882d6539128d119, 0xfe6469348911945b, 0x6da189493780c328, + 0xf8c4931b61dc54dc, 0xd5ac914ccbf735f0, 0xba0a5bf3b2b528d1, + 0x74d814e6ebcebe81, 0xfc44af3a74cfee8c, 0xea0cb63d1bf7d5dc, + 0xbe98c841d80bd077); + VLOAD_64(v2, 0x5517b401c8fbd5ec, 0x021c52c329edd200, 0xff61d899305d1423, + 0xd886035fdcfe3186, 0x694b857cb1cc3bc3, 0x52376b9a996e1925, + 0x5785c45d41ec230d, 0x950f08c23f6da73d, 0xe5dc4e9a35834719, + 0x9a08d0e965e96a19, 0xb80c2107151bdcf6, 0xd0612e4d4bc314b7, + 0xdfb23a142b750482, 0xedc5e4b79881bdaf, 0x72c493d9df55bf13, + 0xfd4b1328b8f7773a); + VLOAD_64(v3, 0xc265b2d19ad92bbb, 0x81a4ef527fc2e042, 0xe490f5981f64a313, + 0xf12edb410132b013, 0xc475df4b52276fe9, 0x069e283bf74ca195, + 0x8dd5189f3a66f166, 0x297726422e620380, 0x7b74d167bd1b22fd, + 0x08e88e9642656a52, 0x0ab0c3f0f7ddeb66, 0x00b155918c8646c0, + 0x84d4df4b2a3768c7, 0xc31234734867ae09, 0x79320b8da693a84e, + 0x30727b2d1bccd396); + asm volatile("vnmsub.vv v1, v2, v3"); + VCMP_U64(4, v1, 0x231a763b4759b083, 0x68b16397da83d642, 0x7081592414ce4cdc, + 0x084dc189ec3eea39, 0x72cb55f70cac6a8e, 0xc713321c491334ae, + 0xa21580bb2ab1e821, 0x3d84da5e7dab4cd1, 0x735a758175effc15, + 0x91e8df24708208d6, 0x5133f0cd25a5d6c6, 0x2f1a889653a2c559, + 0x5f9f0ac7744ba745, 0xba1bbac1969a4055, 0x275025160493a4fa, + 0x21c02801006747a0); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v1, 0x41, 0x5b, 0xd0, 0x04, 0xc4, 0x7a, 0x91, 0xd1, 0x7b, 0x09, 0x85, + 0x59, 0x2b, 0xe3, 0x33, 0xb9); + VLOAD_8(v2, 0xc5, 0x4d, 0xad, 0x35, 0x81, 0x18, 0x48, 0x50, 0xe7, 0x95, 0x7b, + 0x18, 0xe6, 0x44, 0x57, 0xaf); + VLOAD_8(v3, 0x53, 0x13, 0x2c, 0xd8, 0x4a, 0xc3, 0xa3, 0xd7, 0x7e, 0x1f, 0x4c, + 0x4e, 0x2e, 0x7d, 0x13, 0x5a); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0x41, 0xb4, 0xd0, 0x04, 0xc4, 0x53, 0x91, 0x87, 0x7b, 0xe2, + 0x85, 0xf6, 0x2b, 0x31, 0x33, 0xe3); + + VSET(16, e16, m1); + VLOAD_16(v1, 0x9904, 0x5982, 0xa6cb, 0x73a1, 0x227e, 0xc8f6, 0x3eeb, 0xb010, + 0x14a1, 0xef2d, 0x3376, 0x371a, 0x4fc8, 0xbcca, 0xccd7, 0x9097); + VLOAD_16(v2, 0xb2dd, 0x9ca4, 0x72fe, 0xecab, 0x9909, 0xe1b0, 0x1769, 0x6759, + 0x9500, 0x3aae, 0x0637, 0xeadc, 0x7523, 0xa53c, 0xecc7, 0xaccc); + VLOAD_16(v3, 0xb917, 0x6a27, 0x0f0c, 0x04a2, 0xe0b6, 0x9fb1, 0x5c69, 0x21e2, + 0x3588, 0x8d19, 0x65d9, 0x6458, 0xfbff, 0xf949, 0x34a4, 0x0710); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0x9904, 0xdadf, 0xa6cb, 0x5c17, 0x227e, 0x4091, 0x3eeb, + 0x7c52, 0x14a1, 0xca83, 0x3376, 0x4600, 0x4fc8, 0x87f1, 0xccd7, + 0x5abc); + + VSET(16, e32, m1); + VLOAD_32(v1, 0xe6f4ff60, 0xbf6a38db, 0x30f2ea92, 0x1763619e, 0x815c1c28, + 0x5f1b57db, 0xdb2cdc06, 0xab577f4a, 0x214746ac, 0xd3a08c15, + 0x35887ce9, 0x9d5a0f65, 0x76adea2b, 0x91b7f299, 0x6e2977fe, + 0xdcbcb1d7); + VLOAD_32(v2, 0x885c8baa, 0xbe200324, 0x9eaa49d7, 0x4e208dde, 0x802bbe9f, + 0x7633680e, 0xf1a79717, 0xe62e371e, 0x0fc25b48, 0x11067f38, + 0xc654ccb4, 0x6702a66c, 0x7a0b229d, 0x25c2b688, 0x82b68b3d, + 0x4224aa5e); + VLOAD_32(v3, 0x3a582428, 0x61c55f94, 0xb445799b, 0xcca5a657, 0x51a7fe9e, + 0x0840b4f8, 0xfb0a701b, 0x1b5361d7, 0xd10c9064, 0xa899d63d, + 0xbb1779fd, 0x1b35390c, 0xd04c0f6c, 0xd8c9db62, 0x90a09dc8, + 0x463438b4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0xe6f4ff60, 0x92cacfc8, 0x30f2ea92, 0x6ff2f953, 0x815c1c28, + 0x466feefe, 0xdb2cdc06, 0xdf6d912b, 0x214746ac, 0x0a7ec6a5, + 0x35887ce9, 0x91713c70, 0x76adea2b, 0xb3a6341a, 0x6e2977fe, + 0x7a9625c2); + + VSET(16, e64, m1); + VLOAD_64(v1, 0xb8d79a755b98580a, 0xceefb8be6deb3a3d, 0x670688aed7c97cdd, + 0x0ced1db5e1b7da8f, 0x58993c2ae4a62e89, 0x864439a0768dce1b, + 0x7882d6539128d119, 0xfe6469348911945b, 0x6da189493780c328, + 0xf8c4931b61dc54dc, 0xd5ac914ccbf735f0, 0xba0a5bf3b2b528d1, + 0x74d814e6ebcebe81, 0xfc44af3a74cfee8c, 0xea0cb63d1bf7d5dc, + 0xbe98c841d80bd077); + VLOAD_64(v2, 0x5517b401c8fbd5ec, 0x021c52c329edd200, 0xff61d899305d1423, + 0xd886035fdcfe3186, 0x694b857cb1cc3bc3, 0x52376b9a996e1925, + 0x5785c45d41ec230d, 0x950f08c23f6da73d, 0xe5dc4e9a35834719, + 0x9a08d0e965e96a19, 0xb80c2107151bdcf6, 0xd0612e4d4bc314b7, + 0xdfb23a142b750482, 0xedc5e4b79881bdaf, 0x72c493d9df55bf13, + 0xfd4b1328b8f7773a); + VLOAD_64(v3, 0xc265b2d19ad92bbb, 0x81a4ef527fc2e042, 0xe490f5981f64a313, + 0xf12edb410132b013, 0xc475df4b52276fe9, 0x069e283bf74ca195, + 0x8dd5189f3a66f166, 0x297726422e620380, 0x7b74d167bd1b22fd, + 0x08e88e9642656a52, 0x0ab0c3f0f7ddeb66, 0x00b155918c8646c0, + 0x84d4df4b2a3768c7, 0xc31234734867ae09, 0x79320b8da693a84e, + 0x30727b2d1bccd396); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0xb8d79a755b98580a, 0x68b16397da83d642, 0x670688aed7c97cdd, + 0x084dc189ec3eea39, 0x58993c2ae4a62e89, 0xc713321c491334ae, + 0x7882d6539128d119, 0x3d84da5e7dab4cd1, 0x6da189493780c328, + 0x91e8df24708208d6, 0xd5ac914ccbf735f0, 0x2f1a889653a2c559, + 0x74d814e6ebcebe81, 0xba1bbac1969a4055, 0xea0cb63d1bf7d5dc, + 0x21c02801006747a0); +} + +void TEST_CASE3() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v1, 0x5e, 0xf5, 0xa9, 0x0b, 0x14, 0x3c, 0x84, 0x22, 0xd7, 0xb6, 0x5c, + 0x90, 0xa2, 0x67, 0x3d, 0xf5); + VLOAD_8(v3, 0xfa, 0xd9, 0x2a, 0xe2, 0xe7, 0x1f, 0x8c, 0xbd, 0x40, 0x5d, 0x50, + 0x1f, 0xe0, 0xdd, 0x1f, 0xd7); + asm volatile("vnmsub.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0x24, 0x10, 0xdd, 0xab, 0x83, 0xf3, 0xf8, 0x13, 0x0d, 0xcf, + 0x84, 0x4f, 0xb6, 0xda, 0xee, 0x0e); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v1, 0xfe80, 0x3910, 0x5313, 0xefef, 0xecfc, 0x7983, 0xcc0d, 0x731f, + 0xf384, 0xfde3, 0x9cd1, 0xf20b, 0xa41b, 0x949a, 0x5886, 0xa1a9); + VLOAD_16(v3, 0xe886, 0xf1f9, 0x1857, 0xd0bb, 0x522e, 0x2de0, 0xa6c2, 0xd624, + 0xd024, 0x40a2, 0xdd99, 0xd517, 0xf00a, 0xae8d, 0x79a5, 0x519d); + asm volatile("vnmsub.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0x5e06, 0xd169, 0xecdc, 0xfb44, 0x7912, 0x3f75, 0x4c1d, + 0x86fd, 0x4cc0, 0xd0d7, 0x4c50, 0x5a64, 0xa3c7, 0x60c3, 0xe34f, + 0x9a3c); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v1, 0x48da7aac, 0x54e98600, 0xf49f26e5, 0x338e8406, 0x40ca82f5, + 0x75d0b8f6, 0x38c88af2, 0x96bb5c03, 0x6f61c0a9, 0x3626dd69, + 0x31aba619, 0x7d974a55, 0xbc63c280, 0x502334bf, 0x9451b955, + 0x6a8bae19); + VLOAD_32(v3, 0xcbd8537e, 0x36928a6c, 0x60cf8444, 0xa19ea650, 0x8f2a8694, + 0x050956bf, 0x1ef799f5, 0x43c0f327, 0x4bfd5a25, 0x7be439e4, + 0xed89a52a, 0x2bbf028d, 0x872392b9, 0x0ad55495, 0x865c7264, + 0xfcce4b64); + asm volatile("vnmsub.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0x6b20ab9a, 0x9dfe886c, 0xf983030d, 0xddd6bece, 0xf2a7f2ad, + 0x2f0a66ed, 0x59240bcf, 0x915f2166, 0x8c4ace02, 0x802d8981, + 0xf9fc8b37, 0xa3f70986, 0xced98739, 0xa4fbf240, 0x4249945d, + 0xdd51d971); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v1, 0x93adc14539897782, 0xa8d5d41c19b1455a, 0x55e01165195d2d9b, + 0xe81a26a17fef30f2, 0x33a71ede19aec0aa, 0x49598be14c5bc1cd, + 0x1c27bde3f488bfc6, 0x4188f9b8611e5d90, 0xd53289cca28a3b6b, + 0x3b435e1078e3bee9, 0x5e3f4c08c869abf4, 0x3c004920e9c39fb6, + 0x4b42a451b264b153, 0x110a6db11a7c2801, 0x7c0f358ac41d49fa, + 0x6e8c6ae4d14bd1a5); + VLOAD_64(v3, 0x3b0c6a3a651beecc, 0xb612caa033bc9bca, 0xda94340ac428ca78, + 0xf774b16ef94a22ea, 0x87df3c47c8113e43, 0x38487d57a064f677, + 0x358706b57ce6d6c7, 0xda111b3ac946811c, 0xe9ffed5b39f1ea1d, + 0x3c7e5a675c779870, 0x5d2ea63ac910e42e, 0xb3e832dbe2332203, + 0x05d366b426005f47, 0x00b3b58815a860d8, 0x023bbf8109263e1d, + 0x5fbc2f647d6c1153); + asm volatile("vnmsub.vx v1, %[A], v3" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0x60dd7609c833e03a, 0x79abe3a30a816ca0, 0x983ca4c97f204385, + 0x59a9303f04932768, 0x59c29659b4d00149, 0x59a15b1bb66f16c2, + 0x37b0445a8ebaa7d1, 0x65e0c3ab56fa1f0c, 0x94a740971b1d6eda, + 0xa1c7ff743113d8bf, 0xe8198a4799a97a9a, 0x5ccf06fd8751eb9d, + 0xa36557d05e8802dc, 0x10aae67f31dc2b4f, 0xe878939fd1287553, + 0x594538a8571dbf06); +} + +void TEST_CASE4() { + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v1, 0x5e, 0xf5, 0xa9, 0x0b, 0x14, 0x3c, 0x84, 0x22, 0xd7, 0xb6, 0x5c, + 0x90, 0xa2, 0x67, 0x3d, 0xf5); + VLOAD_8(v3, 0xfa, 0xd9, 0x2a, 0xe2, 0xe7, 0x1f, 0x8c, 0xbd, 0x40, 0x5d, 0x50, + 0x1f, 0xe0, 0xdd, 0x1f, 0xd7); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0x5e, 0x10, 0xa9, 0xab, 0x14, 0xf3, 0x84, 0x13, 0xd7, 0xcf, + 0x5c, 0x4f, 0xa2, 0xda, 0x3d, 0x0e); + + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v1, 0xfe80, 0x3910, 0x5313, 0xefef, 0xecfc, 0x7983, 0xcc0d, 0x731f, + 0xf384, 0xfde3, 0x9cd1, 0xf20b, 0xa41b, 0x949a, 0x5886, 0xa1a9); + VLOAD_16(v3, 0xe886, 0xf1f9, 0x1857, 0xd0bb, 0x522e, 0x2de0, 0xa6c2, 0xd624, + 0xd024, 0x40a2, 0xdd99, 0xd517, 0xf00a, 0xae8d, 0x79a5, 0x519d); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0xfe80, 0xd169, 0x5313, 0xfb44, 0xecfc, 0x3f75, 0xcc0d, + 0x86fd, 0xf384, 0xd0d7, 0x9cd1, 0x5a64, 0xa41b, 0x60c3, 0x5886, + 0x9a3c); + + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v1, 0x48da7aac, 0x54e98600, 0xf49f26e5, 0x338e8406, 0x40ca82f5, + 0x75d0b8f6, 0x38c88af2, 0x96bb5c03, 0x6f61c0a9, 0x3626dd69, + 0x31aba619, 0x7d974a55, 0xbc63c280, 0x502334bf, 0x9451b955, + 0x6a8bae19); + VLOAD_32(v3, 0xcbd8537e, 0x36928a6c, 0x60cf8444, 0xa19ea650, 0x8f2a8694, + 0x050956bf, 0x1ef799f5, 0x43c0f327, 0x4bfd5a25, 0x7be439e4, + 0xed89a52a, 0x2bbf028d, 0x872392b9, 0x0ad55495, 0x865c7264, + 0xfcce4b64); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0x48da7aac, 0x9dfe886c, 0xf49f26e5, 0xddd6bece, 0x40ca82f5, + 0x2f0a66ed, 0x38c88af2, 0x915f2166, 0x6f61c0a9, 0x802d8981, + 0x31aba619, 0xa3f70986, 0xbc63c280, 0xa4fbf240, 0x9451b955, + 0xdd51d971); + + VSET(16, e64, m1); + scalar = -598189234597999223; + VLOAD_64(v1, 0x93adc14539897782, 0xa8d5d41c19b1455a, 0x55e01165195d2d9b, + 0xe81a26a17fef30f2, 0x33a71ede19aec0aa, 0x49598be14c5bc1cd, + 0x1c27bde3f488bfc6, 0x4188f9b8611e5d90, 0xd53289cca28a3b6b, + 0x3b435e1078e3bee9, 0x5e3f4c08c869abf4, 0x3c004920e9c39fb6, + 0x4b42a451b264b153, 0x110a6db11a7c2801, 0x7c0f358ac41d49fa, + 0x6e8c6ae4d14bd1a5); + VLOAD_64(v3, 0x3b0c6a3a651beecc, 0xb612caa033bc9bca, 0xda94340ac428ca78, + 0xf774b16ef94a22ea, 0x87df3c47c8113e43, 0x38487d57a064f677, + 0x358706b57ce6d6c7, 0xda111b3ac946811c, 0xe9ffed5b39f1ea1d, + 0x3c7e5a675c779870, 0x5d2ea63ac910e42e, 0xb3e832dbe2332203, + 0x05d366b426005f47, 0x00b3b58815a860d8, 0x023bbf8109263e1d, + 0x5fbc2f647d6c1153); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vnmsub.vx v1, %[A], v3, v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0x93adc14539897782, 0x79abe3a30a816ca0, 0x55e01165195d2d9b, + 0x59a9303f04932768, 0x33a71ede19aec0aa, 0x59a15b1bb66f16c2, + 0x1c27bde3f488bfc6, 0x65e0c3ab56fa1f0c, 0xd53289cca28a3b6b, + 0xa1c7ff743113d8bf, 0x5e3f4c08c869abf4, 0x5ccf06fd8751eb9d, + 0x4b42a451b264b153, 0x10aae67f31dc2b4f, 0x7c0f358ac41d49fa, + 0x594538a8571dbf06); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vnsra.c b/apps/riscv-tests/isa/rv64uv/vnsra.c new file mode 100644 index 0000000..ed3986b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vnsra.c @@ -0,0 +1,242 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, + 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vnsra.wv v4, v2, v3"); + VCMP_U8(1, v4, 0x00, 0x80, 0xC0, 0xE0, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x80, + 0xC0, 0xE0, 0xFE, 0xFF, 0xFF, 0x00); + + VSET(16, e16, m1); + VLOAD_32(v2, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vnsra.wv v4, v2, v3"); + VCMP_U16(2, v4, 0x0000, 0x8000, 0xC000, 0xE000, 0xFE00, 0xFFFE, 0xFFFF, + 0x0000, 0x0000, 0x8000, 0xC000, 0xE000, 0xFE00, 0xFFFE, 0xFFFF, + 0x0000); + + VSET(16, e32, m1); + VLOAD_64(v2, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vnsra.wv v4, v2, v3"); + VCMP_U32(3, v4, 0x00000000, 0x80000000, 0xC0000000, 0xE0000000, 0xFE000000, + 0xFFFE0000, 0xFFFFFFFE, 0xFFFFFFFF, 0x00000000, 0x80000000, + 0xC0000000, 0xE0000000, 0xFE000000, 0xFFFE0000, 0xFFFFFFFE, + 0xFFFFFFFF); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, + 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wv v4, v2, v3, v0.t"); + VCMP_U8(4, v4, 0x00, 0x80, 0x00, 0xE0, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x80, + 0x00, 0xE0, 0x00, 0xFF, 0x00, 0x00); + + VSET(16, e16, m1); + VLOAD_32(v2, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wv v4, v2, v3, v0.t"); + VCMP_U16(5, v4, 0x0000, 0x8000, 0x0000, 0xE000, 0x0000, 0xFFFE, 0x0000, + 0x0000, 0x0000, 0x8000, 0x0000, 0xE000, 0x0000, 0xFFFE, 0x0000, + 0x0000); + + VSET(16, e32, m1); + VLOAD_64(v2, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wv v4, v2, v3, v0.t"); + VCMP_U32(6, v4, 0x00000000, 0x80000000, 0x00000000, 0xE0000000, 0x00000000, + 0xFFFE0000, 0x00000000, 0xFFFFFFFF, 0x00000000, 0x80000000, + 0x00000000, 0xE0000000, 0x00000000, 0xFFFE0000, 0x00000000, + 0xFFFFFFFF); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vnsra.wx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(7, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vnsra.wx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(8, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vnsra.wx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(9, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0xFFFFFFFF); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(10, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF9, + 0x00, 0xFB, 0x00, 0xFD, 0x00, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(11, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0xFFF9, 0x0000, 0xFFFB, 0x0000, 0xFFFD, 0x0000, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(12, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0xFFFFFFF9, + 0x00000000, 0xFFFFFFFB, 0x00000000, 0xFFFFFFFD, 0x00000000, + 0xFFFFFFFF); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vnsra.wi v4, v2, 2"); + VCMP_U8(13, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vnsra.wi v4, v2, 2"); + VCMP_U16(14, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vnsra.wi v4, v2, 2"); + VCMP_U32(15, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0xFFFFFFFF); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wi v4, v2, 2, v0.t"); + VCMP_U8(16, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF9, + 0x00, 0xFB, 0x00, 0xFD, 0x00, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wi v4, v2, 2, v0.t"); + VCMP_U16(17, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0xFFF9, 0x0000, 0xFFFB, 0x0000, 0xFFFD, 0x0000, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsra.wi v4, v2, 2, v0.t"); + VCMP_U32(18, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0xFFFFFFF9, + 0x00000000, 0xFFFFFFFB, 0x00000000, 0xFFFFFFFD, 0x00000000, + 0xFFFFFFFF); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vnsrl.c b/apps/riscv-tests/isa/rv64uv/vnsrl.c new file mode 100644 index 0000000..604322f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vnsrl.c @@ -0,0 +1,242 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, + 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vnsrl.wv v4, v2, v3"); + VCMP_U8(1, v4, 0x00, 0x80, 0xC0, 0xE0, 0xFE, 0x01, 0x01, 0x00, 0x00, 0x80, + 0xC0, 0xE0, 0xFE, 0x01, 0x01, 0x00); + + VSET(16, e16, m1); + VLOAD_32(v2, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vnsrl.wv v4, v2, v3"); + VCMP_U16(2, v4, 0x0000, 0x8000, 0xC000, 0xE000, 0xFE00, 0xFFFE, 0x0001, + 0x0000, 0x0000, 0x8000, 0xC000, 0xE000, 0xFE00, 0xFFFE, 0x0001, + 0x0000); + + VSET(16, e32, m1); + VLOAD_64(v2, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vnsrl.wv v4, v2, v3"); + VCMP_U32(3, v4, 0x00000000, 0x80000000, 0xC0000000, 0xE0000000, 0xFE000000, + 0xFFFE0000, 0xFFFFFFFE, 0xFFFFFFFF, 0x00000000, 0x80000000, + 0xC0000000, 0xE0000000, 0xFE000000, 0xFFFE0000, 0xFFFFFFFE, + 0xFFFFFFFF); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, + 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wv v4, v2, v3, v0.t"); + VCMP_U8(4, v4, 0x00, 0x80, 0x00, 0xE0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, + 0x00, 0xE0, 0x00, 0x01, 0x00, 0x00); + + VSET(16, e16, m1); + VLOAD_32(v2, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, + 0xFFFF0000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wv v4, v2, v3, v0.t"); + VCMP_U16(5, v4, 0x0000, 0x8000, 0x0000, 0xE000, 0x0000, 0xFFFE, 0x0000, + 0x0000, 0x0000, 0x8000, 0x0000, 0xE000, 0x0000, 0xFFFE, 0x0000, + 0x0000); + + VSET(16, e32, m1); + VLOAD_64(v2, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF00000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wv v4, v2, v3, v0.t"); + VCMP_U32(6, v4, 0x00000000, 0x80000000, 0x00000000, 0xE0000000, 0x00000000, + 0xFFFE0000, 0x00000000, 0xFFFFFFFF, 0x00000000, 0x80000000, + 0x00000000, 0xE0000000, 0x00000000, 0xFFFE0000, 0x00000000, + 0xFFFFFFFF); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vnsrl.wx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(7, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vnsrl.wx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(8, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vnsrl.wx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(9, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0xFFFFFFFF); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(10, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF9, + 0x00, 0xFB, 0x00, 0xFD, 0x00, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(11, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0xFFF9, 0x0000, 0xFFFB, 0x0000, 0xFFFD, 0x0000, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(12, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0xFFFFFFF9, + 0x00000000, 0xFFFFFFFB, 0x00000000, 0xFFFFFFFD, 0x00000000, + 0xFFFFFFFF); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vnsrl.wi v4, v2, 2"); + VCMP_U8(13, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vnsrl.wi v4, v2, 2"); + VCMP_U16(14, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vnsrl.wi v4, v2, 2"); + VCMP_U32(15, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0xFFFFFFFF); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wi v4, v2, 2, v0.t"); + VCMP_U8(16, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF9, + 0x00, 0xFB, 0x00, 0xFD, 0x00, 0xFF); + + VSET(16, e16, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wi v4, v2, 2, v0.t"); + VCMP_U16(17, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0xFFF9, 0x0000, 0xFFFB, 0x0000, 0xFFFD, 0x0000, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vnsrl.wi v4, v2, 2, v0.t"); + VCMP_U32(18, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0xFFFFFFF9, + 0x00000000, 0xFFFFFFFB, 0x00000000, 0xFFFFFFFD, 0x00000000, + 0xFFFFFFFF); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vor.c b/apps/riscv-tests/isa/rv64uv/vor.c new file mode 100644 index 0000000..54e3eb2 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vor.c @@ -0,0 +1,309 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v3, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, + 0xf0); + asm volatile("vor.vv v1, v2, v3"); + VCMP_U8(1, v1, 0xff, 0x03, 0xf0, 0xff, 0x03, 0xf0, 0xff, 0x03, 0xf0, 0xff, + 0x03, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_16(v3, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, + 0xf0f0, 0xff00, 0x0003, 0xf0f0); + asm volatile("vor.vv v1, v2, v3"); + VCMP_U16(2, v1, 0xffff, 0x0003, 0xf0f0, 0xffff, 0x0003, 0xf0f0, 0xffff, + 0x0003, 0xf0f0, 0xffff, 0x0003, 0xf0f0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_32(v3, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, 0x00000003, + 0xf0f0f0f0, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, + 0x00000003, 0xf0f0f0f0); + asm volatile("vor.vv v1, v2, v3"); + VCMP_U32(3, v1, 0xffffffff, 0x00000003, 0xf0f0f0f0, 0xffffffff, 0x00000003, + 0xf0f0f0f0, 0xffffffff, 0x00000003, 0xf0f0f0f0, 0xffffffff, + 0x00000003, 0xf0f0f0f0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v3, 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); + asm volatile("vor.vv v1, v2, v3"); + VCMP_U64(4, v1, 0xffffffffffffffff, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); +} + +void TEST_CASE2() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v3, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vor.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0xff, 0xef, 0xf0, 0xff, 0xef, 0xf0, 0xff, 0xef, 0xf0, 0xff, + 0xef, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_16(v3, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, + 0xf0f0, 0xff00, 0x0003, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vor.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0xffff, 0xbeef, 0xf0f0, 0xffff, 0xbeef, 0xf0f0, 0xffff, + 0xbeef, 0xf0f0, 0xffff, 0xbeef, 0xf0f0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_32(v3, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, 0x00000003, + 0xf0f0f0f0, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, + 0x00000003, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vor.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0xffffffff, 0xdeadbeef, 0xf0f0f0f0, 0xffffffff, 0xdeadbeef, + 0xf0f0f0f0, 0xffffffff, 0xdeadbeef, 0xf0f0f0f0, 0xffffffff, + 0xdeadbeef, 0xf0f0f0f0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v3, 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vor.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0f0); +} + +void TEST_CASE3() { + const uint64_t scalar = 0x0ff00ff00ff00ff0; + + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + asm volatile("vor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0xff, 0xf1, 0xf0, 0xff, 0xf1, 0xf0, 0xff, 0xf1, 0xf0, 0xff, + 0xf1, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + asm volatile("vor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0xffff, 0x0ff1, 0xfff0, 0xffff, 0x0ff1, 0xfff0, 0xffff, + 0x0ff1, 0xfff0, 0xffff, 0x0ff1, 0xfff0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + asm volatile("vor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0xffffffff, 0x0ff00ff1, 0xfff0fff0, 0xffffffff, 0x0ff00ff1, + 0xfff0fff0, 0xffffffff, 0x0ff00ff1, 0xfff0fff0, 0xffffffff, + 0x0ff00ff1, 0xfff0fff0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + asm volatile("vor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0xffffffffffffffff, 0x0ff00ff00ff00ff1, 0xfff0fff0fff0fff0, + 0xffffffffffffffff, 0x0ff00ff00ff00ff1, 0xfff0fff0fff0fff0, + 0xffffffffffffffff, 0x0ff00ff00ff00ff1, 0xfff0fff0fff0fff0, + 0xffffffffffffffff, 0x0ff00ff00ff00ff1, 0xfff0fff0fff0fff0); +} + +void TEST_CASE4() { + const uint64_t scalar = 0x0ff00ff00ff00ff0; + + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0xff, 0xef, 0xf0, 0xff, 0xef, 0xf0, 0xff, 0xef, 0xf0, 0xff, + 0xef, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0xffff, 0xbeef, 0xfff0, 0xffff, 0xbeef, 0xfff0, 0xffff, + 0xbeef, 0xfff0, 0xffff, 0xbeef, 0xfff0); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0xffffffff, 0xdeadbeef, 0xfff0fff0, 0xffffffff, 0xdeadbeef, + 0xfff0fff0, 0xffffffff, 0xdeadbeef, 0xfff0fff0, 0xffffffff, + 0xdeadbeef, 0xfff0fff0); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xfff0fff0fff0fff0, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xfff0fff0fff0fff0, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xfff0fff0fff0fff0, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xfff0fff0fff0fff0); +} + +void TEST_CASE5() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + asm volatile("vor.vi v1, v2, 15"); + VCMP_U8(17, v1, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, + 0x0f, 0xff); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + asm volatile("vor.vi v1, v2, 15"); + VCMP_U16(18, v1, 0xffff, 0x000f, 0xf0ff, 0xffff, 0x000f, 0xf0ff, 0xffff, + 0x000f, 0xf0ff, 0xffff, 0x000f, 0xf0ff); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + asm volatile("vor.vi v1, v2, 15"); + VCMP_U32(19, v1, 0xffffffff, 0x0000000f, 0xf0f0f0ff, 0xffffffff, 0x0000000f, + 0xf0f0f0ff, 0xffffffff, 0x0000000f, 0xf0f0f0ff, 0xffffffff, + 0x0000000f, 0xf0f0f0ff); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + asm volatile("vor.vi v1, v2, 15"); + VCMP_U64(20, v1, 0xffffffffffffffff, 0x000000000000000f, 0xf0f0f0f0f0f0f0ff, + 0xffffffffffffffff, 0x000000000000000f, 0xf0f0f0f0f0f0f0ff, + 0xffffffffffffffff, 0x000000000000000f, 0xf0f0f0f0f0f0f0ff, + 0xffffffffffffffff, 0x000000000000000f, 0xf0f0f0f0f0f0f0ff); +} + +void TEST_CASE6() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vor.vi v1, v2, 15, v0.t"); + VCMP_U8(21, v1, 0xff, 0xef, 0xff, 0xff, 0xef, 0xff, 0xff, 0xef, 0xff, 0xff, + 0xef, 0xff); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vor.vi v1, v2, 15, v0.t"); + VCMP_U16(22, v1, 0xffff, 0xbeef, 0xf0ff, 0xffff, 0xbeef, 0xf0ff, 0xffff, + 0xbeef, 0xf0ff, 0xffff, 0xbeef, 0xf0ff); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vor.vi v1, v2, 15, v0.t"); + VCMP_U32(23, v1, 0xffffffff, 0xdeadbeef, 0xf0f0f0ff, 0xffffffff, 0xdeadbeef, + 0xf0f0f0ff, 0xffffffff, 0xdeadbeef, 0xf0f0f0ff, 0xffffffff, + 0xdeadbeef, 0xf0f0f0ff); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vor.vi v1, v2, 15, v0.t"); + VCMP_U64(24, v1, 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff, + 0xffffffffffffffff, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vpopc_m.c b/apps/riscv-tests/isa/rv64uv/vpopc_m.c new file mode 100644 index 0000000..d66b9b8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vpopc_m.c @@ -0,0 +1,29 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e32, m1); + VLOAD_U32(v2, 7, 0, 0, 0); + VLOAD_U32(v0, 5, 0, 0, 0); + volatile uint32_t scalar = 1337; + volatile uint32_t OUP[] = {0, 0, 0, 0}; + __asm__ volatile("vpopc.m %[A], v2, v0.t \n" + "sw %[A], (%1) \n" + : + : [A] "r"(scalar), "r"(OUP)); + XCMP(1, OUP[0], 2); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredand.c b/apps/riscv-tests/isa/rv64uv/vredand.c new file mode 100644 index 0000000..9e2842d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredand.c @@ -0,0 +1,93 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(12, e8, m1); + VLOAD_8(v1, 0xff, 0xf1, 0xf0, 0xff, 0xf1, 0xf0, 0xff, 0xf1, 0xf0, 0xff, 0xf1, + 0xf0); + VLOAD_8(v2, 0xf0); + asm volatile("vredand.vs v3, v1, v2"); + VCMP_U8(1, v3, 0xf0); + + VSET(12, e16, m1); + VLOAD_16(v1, 0xffff, 0x0301, 0xf1f0, 0xffff, 0x0101, 0xf7f0, 0xffff, 0x0701, + 0xfff0, 0xffff, 0x0101, 0xf1f0); + VLOAD_16(v2, 0xefff); + asm volatile("vredand.vs v3, v1, v2"); + VCMP_U16(2, v3, 0x0100); + + VSET(12, e32, m1); + VLOAD_32(v1, 0xffffffff, 0x100ff001, 0xf0f0f0f0, 0xffffffff, 0x100ff001, + 0xf0f0f0f0, 0xffffffff, 0x100ff001, 0xf0f0f0f0, 0xffffffff, + 0x100ff001, 0xf0f0f0f0); + VLOAD_32(v2, 0x00f010f0); + asm volatile("vredand.vs v3, v1, v2"); + VCMP_U32(3, v3, 0x00001000); + + VSET(12, e64, m1); + VLOAD_64(v1, 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v2, 0xfffffffffffffff7); + asm volatile("vredand.vs v3, v1, v2"); + VCMP_U64(4, v3, 0x1000000000000000); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(12, e8, m1); + VLOAD_8(v0, 0xf7, 0xff); + VLOAD_8(v1, 0xff, 0xf1, 0xff, 0x00, 0xf1, 0xf0, 0xff, 0xf1, 0xf0, 0xff, 0xf1, + 0xf0); + VLOAD_8(v2, 0xf0); + VLOAD_8(v3, 1); + asm volatile("vredand.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 0xf0); + + VSET(12, e16, m1); + VLOAD_8(v0, 0x00, 0x08); + VLOAD_16(v1, 0xffff, 0x0301, 0xf1f0, 0xffff, 0x0101, 0xf7f0, 0xffff, 0x9701, + 0xfff0, 0xffff, 0x0101, 0xf1f0); + VLOAD_16(v2, 0xefff); + VLOAD_16(v3, 1); + asm volatile("vredand.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 0xe1f0); + + VSET(12, e32, m1); + VLOAD_8(v0, 0xfe, 0xff); + VLOAD_32(v1, 0x00000000, 0x100ff001, 0xf0f0f0f0, 0xffffffff, 0x100ff001, + 0xf0f0f0f0, 0xffffffff, 0x100ff001, 0xf0f0f0f0, 0xffffffff, + 0x100ff001, 0xf0f0f0f0); + VLOAD_32(v2, 0x00f010f0); + VLOAD_32(v3, 1); + asm volatile("vredand.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 0x00001000); + + VSET(12, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x1000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v2, 0xfffffffffffffff7); + VLOAD_64(v3, 1); + asm volatile("vredand.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 0x1000000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredmax.c b/apps/riscv-tests/isa/rv64uv/vredmax.c new file mode 100644 index 0000000..4179d00 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredmax.c @@ -0,0 +1,79 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, -7, 8, 1, 9, 3, 4, 5, -6, 7, 8); + VLOAD_8(v2, -1); + asm volatile("vredmax.vs v3, v1, v2"); + VCMP_U8(1, v3, 9); + + VSET(16, e16, m1); + VLOAD_16(v1, -1, 2, -3, 4, 5, 6, 7, 8, 1, 2, 3, -4, 5, 6, 7, 8); + VLOAD_16(v2, 9); + asm volatile("vredmax.vs v3, v1, v2"); + VCMP_U16(2, v3, 9); + + VSET(16, e32, m1); + VLOAD_32(v1, 9, 2, 3, -4, 5, 6, 7, 8, 1, 2, 3, 4, -5, 6, 7, 8); + VLOAD_32(v2, 1); + asm volatile("vredmax.vs v3, v1, v2"); + VCMP_U32(3, v3, 9); + + VSET(16, e64, m1); + VLOAD_64(v1, -1, 2, 3, -4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, -8); + VLOAD_64(v2, -1); + asm volatile("vredmax.vs v3, v1, v2"); + VCMP_U64(4, v3, 9); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0x03, 0x00); + VLOAD_8(v1, -1, 2, 3, -4, 5, 6, 7, 9, 1, -2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + VLOAD_8(v3, 1); + asm volatile("vredmax.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 2); + + VSET(16, e16, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, -7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 9); + VLOAD_16(v3, 1); + asm volatile("vredmax.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 9); + + VSET(16, e32, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_32(v1, -1, 2, 3, 4, 5, 6, 7, -8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + VLOAD_32(v3, 1); + asm volatile("vredmax.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 8); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 1, -2, 3, 4, 5, 6, -7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 4); + VLOAD_64(v3, 1); + asm volatile("vredmax.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredmaxu.c b/apps/riscv-tests/isa/rv64uv/vredmaxu.c new file mode 100644 index 0000000..3a5253b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredmaxu.c @@ -0,0 +1,106 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 9, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U8(1, v3, 9); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 9); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U16(2, v3, 9); + + VSET(16, e32, m1); + VLOAD_32(v1, 9, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U32(3, v3, 9); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U64(4, v3, 9); +} +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0x03, 0x00); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + VLOAD_8(v3, 1); + asm volatile("vredmaxu.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 2); + + VSET(16, e16, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 9); + VLOAD_16(v3, 1); + asm volatile("vredmaxu.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 9); + + VSET(16, e32, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + VLOAD_32(v3, 1); + asm volatile("vredmaxu.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 8); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 4); + VLOAD_64(v3, 1); + asm volatile("vredmaxu.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 8); +} + +// Naive test with negative values +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 9, -3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U8(9, v3, -3); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, -9); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U16(10, v3, -9); + + VSET(16, e32, m1); + VLOAD_32(v1, 9, 2, 3, 4, -5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U32(11, v3, -5); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, -4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, -1); + asm volatile("vredmaxu.vs v3, v1, v2"); + VCMP_U64(12, v3, -1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredmin.c b/apps/riscv-tests/isa/rv64uv/vredmin.c new file mode 100644 index 0000000..0183cc1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredmin.c @@ -0,0 +1,78 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 0, 1, 9, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + asm volatile("vredmin.vs v3, v1, v2"); + VCMP_U8(1, v3, 0); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, -3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 0); + asm volatile("vredmin.vs v3, v1, v2"); + VCMP_U16(2, v3, -3); + + VSET(16, e32, m1); + VLOAD_32(v1, 9, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, -1); + asm volatile("vredmin.vs v3, v1, v2"); + VCMP_U32(3, v3, -1); + + VSET(16, e64, m1); + VLOAD_64(v1, -1, 2, 3, 4, 5, -6, 7, -9, -1, -2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, -1); + asm volatile("vredmin.vs v3, v1, v2"); + VCMP_U64(4, v3, -9); +} +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0x03, 0x00); + VLOAD_8(v1, 1, -2, 3, 4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + VLOAD_8(v3, 1); + asm volatile("vredmin.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, -2); + + VSET(16, e16, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_16(v1, -1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 3); + VLOAD_16(v3, 1); + asm volatile("vredmin.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 3); + + VSET(16, e32, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 8); + VLOAD_32(v3, 1); + asm volatile("vredmin.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 7); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 4); + VLOAD_64(v3, 1); + asm volatile("vredmin.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredminu.c b/apps/riscv-tests/isa/rv64uv/vredminu.c new file mode 100644 index 0000000..72a11b6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredminu.c @@ -0,0 +1,78 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 0, 1, 9, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + asm volatile("vredminu.vs v3, v1, v2"); + VCMP_U8(1, v3, 0); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, -3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 0); + asm volatile("vredminu.vs v3, v1, v2"); + VCMP_U16(2, v3, 0); + + VSET(16, e32, m1); + VLOAD_32(v1, 9, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, -1); + asm volatile("vredminu.vs v3, v1, v2"); + VCMP_U32(3, v3, 1); + + VSET(16, e64, m1); + VLOAD_64(v1, -1, 2, 3, 4, 5, -6, 7, -9, -1, -2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, -1); + asm volatile("vredminu.vs v3, v1, v2"); + VCMP_U64(4, v3, 2); +} +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0x03, 0x00); + VLOAD_8(v1, 1, -2, 3, 4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + VLOAD_8(v3, 1); + asm volatile("vredminu.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 1); + + VSET(16, e16, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_16(v1, -1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 3); + VLOAD_16(v3, 1); + asm volatile("vredminu.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 3); + + VSET(16, e32, m1); + VLOAD_8(v0, 0x00, 0xc0); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 8); + VLOAD_32(v3, 1); + asm volatile("vredminu.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 7); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 4); + VLOAD_64(v3, 1); + asm volatile("vredminu.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredor.c b/apps/riscv-tests/isa/rv64uv/vredor.c new file mode 100644 index 0000000..e67eb10 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredor.c @@ -0,0 +1,93 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(12, e8, m1); + VLOAD_8(v1, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, + 0x00); + VLOAD_8(v2, 0x10); + asm volatile("vredor.vs v3, v1, v2"); + VCMP_U8(1, v3, 0x11); + + VSET(12, e16, m1); + VLOAD_16(v1, 0x0000, 0x0301, 0x0100, 0x0000, 0x0101, 0x0700, 0x0000, 0x0701, + 0x0000, 0x0000, 0x0101, 0x0100); + VLOAD_16(v2, 0xe000); + asm volatile("vredor.vs v3, v1, v2"); + VCMP_U16(2, v3, 0xe701); + + VSET(12, e32, m1); + VLOAD_32(v1, 0x00000000, 0x10000001, 0x00000000, 0x00000000, 0x10000001, + 0x00000000, 0x00000000, 0x10000001, 0x00000000, 0x00000000, + 0x10000001, 0x00000000); + VLOAD_32(v2, 0x00001000); + asm volatile("vredor.vs v3, v1, v2"); + VCMP_U32(3, v3, 0x10001001); + + VSET(12, e64, m1); + VLOAD_64(v1, 0x0000000000000000, 0x1000000000000001, 0x0000000000000000, + 0x0000000000000000, 0x1000000000000001, 0x0000000000000000, + 0x0000000000000000, 0x1000000000000001, 0x0000000000000000, + 0x0000000000000000, 0x1000000000000001, 0x0000000000000000); + VLOAD_64(v2, 0x0000000000000007); + asm volatile("vredor.vs v3, v1, v2"); + VCMP_U64(4, v3, 0x1000000000000007); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(12, e8, m1); + VLOAD_8(v0, 0x07, 0x00); + VLOAD_8(v1, 0x00, 0x01, 0x00, 0xff, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, + 0x00); + VLOAD_8(v2, 0x00); + VLOAD_8(v3, 1); + asm volatile("vredor.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 0x01); + + VSET(12, e16, m1); + VLOAD_8(v0, 0x00, 0x08); + VLOAD_16(v1, 0x0f00, 0x0301, 0x0100, 0x0000, 0x0101, 0x0700, 0x0000, 0x9701, + 0x0000, 0x0000, 0x0101, 0x0100); + VLOAD_16(v2, 0xe000); + VLOAD_16(v3, 1); + asm volatile("vredor.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 0xe100); + + VSET(12, e32, m1); + VLOAD_8(v0, 0x0e, 0x00); + VLOAD_32(v1, 0xf0000fff, 0x10000001, 0x00000000, 0x00000000, 0x10000001, + 0x00000000, 0x00000000, 0x10000001, 0x00000000, 0x00000000, + 0x10000001, 0x00000000); + VLOAD_32(v2, 0x00001000); + VLOAD_32(v3, 1); + asm volatile("vredor.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 0x10001001); + + VSET(12, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 0x0000000000000000, 0x1000000000000001, 0x0000f00000000000, + 0x0000000000000000, 0x1000000000000001, 0x0000000000000000, + 0x0000000000000000, 0x1000000000000001, 0x0000000000000000, + 0x0000000000000000, 0x1000000000000001, 0x0000000000000000); + VLOAD_64(v2, 0x0000000000000007); + VLOAD_64(v3, 1); + asm volatile("vredor.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 0x1000000000000007); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredsum.c b/apps/riscv-tests/isa/rv64uv/vredsum.c new file mode 100644 index 0000000..09a1a9b --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredsum.c @@ -0,0 +1,178 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U8(1, v3, 73); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U16(2, v3, 73); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U32(3, v3, 73); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U64(4, v3, 73); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1); + VLOAD_8(v3, 1); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 37); + + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1); + VLOAD_16(v3, 1); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 37); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + VLOAD_32(v3, 1); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 37); + + VSET(16, e64, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + VLOAD_64(v3, 1); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U64(8, v3, 37); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U8(9, v3, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U16(10, v3, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U32(11, v3, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U64(12, v3, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(15, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U8(13, v3, 65, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(1, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U16(14, v3, 2, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(3, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U32(15, v3, 7, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(7, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U64(16, v3, 29, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(15, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2"); + VCMP_U64(17, v3, 65, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(15, e8, m1); + VLOAD_8(v0, 0x00, 0x40); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 100, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U8(18, v3, 107, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(1, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U16(19, v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(3, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vredsum.vs v3, v1, v2, v0.t"); + VCMP_U32(20, v3, 3, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vredxor.c b/apps/riscv-tests/isa/rv64uv/vredxor.c new file mode 100644 index 0000000..0d06f85 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vredxor.c @@ -0,0 +1,44 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(4, e8, m1); + VLOAD_8(v1, 0x00, 0x01, 0x01, 0x00); + VLOAD_8(v2, 0x11); + asm volatile("vredxor.vs v3, v1, v2"); + VCMP_U8(1, v3, 0x11); + + VSET(4, e16, m1); + VLOAD_16(v1, 0x8000, 0x0301, 0x0101, 0x0001); + VLOAD_16(v2, 0xe001); + asm volatile("vredxor.vs v3, v1, v2"); + VCMP_U16(2, v3, 0x6200); + + VSET(4, e32, m1); + VLOAD_32(v1, 0x00000001, 0x10000001, 0x00000000, 0x00000000); + VLOAD_32(v2, 0x00001000); + asm volatile("vredxor.vs v3, v1, v2"); + VCMP_U32(3, v3, 0x10001000); + + VSET(4, e64, m1); + VLOAD_64(v1, 0x0000000000000000, 0x1000000000000001, 0x0000000000000000, + 0x0000000000000000); + VLOAD_64(v2, 0x0000000000000007); + asm volatile("vredxor.vs v3, v1, v2"); + VCMP_U64(4, v3, 0x1000000000000006); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vrem.c b/apps/riscv-tests/isa/rv64uv/vrem.c new file mode 100644 index 0000000..f77ebd5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vrem.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x9b, 0x28, 0xec, 0x86, 0x26, 0x85, 0xf7, 0x33, 0x46, 0x37, 0x2c, + 0x0c, 0x8e, 0xae, 0xa1, 0x93); + VLOAD_8(v3, 0x84, 0x5e, 0x3b, 0xdf, 0x10, 0xfc, 0x05, 0xcf, 0x42, 0xbe, 0x23, + 0xdb, 0x37, 0x78, 0xe2, 0x85); + asm volatile("vrem.vv v1, v2, v3"); + VCMP_I8(1, v1, 0x9b, 0x28, 0xec, 0xe9, 0x06, 0xfd, 0xfc, 0x02, 0x04, 0x37, + 0x09, 0x0c, 0xfc, 0xae, 0xfb, 0x93); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xb58f, 0xa184, 0xdcf9, 0xd084, 0xbbc6, 0xcf0e, 0xbbd4, 0xa20c, + 0xe04c, 0xd954, 0xda74, 0xa394, 0x207a, 0x8975, 0xddd3, 0x897d); + VLOAD_16(v3, 0x4534, 0xafd7, 0xf703, 0x92c2, 0x97e3, 0xd85a, 0x1540, 0x8c5c, + 0x4a71, 0x43a7, 0xe65d, 0x2bdc, 0x497b, 0x6aa0, 0x6071, 0xf431); + asm volatile("vrem.vv v1, v2, v3"); + VCMP_I16(2, v1, 0xfac3, 0xf1ad, 0xf7f0, 0xd084, 0xbbc6, 0xf6b4, 0xfb94, + 0xa20c, 0xe04c, 0xd954, 0xf417, 0xfb4c, 0x207a, 0xf415, 0xddd3, + 0xff93); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x620db972, 0x60b1f870, 0x7d1badcf, 0x90a85eb6, 0xca41954b, + 0x10dc3772, 0xf7749e82, 0x027ed4d3, 0xdcb6a562, 0xa979baf0, + 0xb480c184, 0x979555c6, 0x3f894108, 0x803bd362, 0x9038beec, + 0x22d7ca24); + VLOAD_32(v3, 0xb9b52c0c, 0x30b52d8c, 0x832f89ea, 0x95181d9c, 0x85a6a24f, + 0x2f2c64a7, 0xebe4120c, 0x83852646, 0xfb1857b5, 0x25400571, + 0xab2d7393, 0xddb87ac8, 0x01149cdf, 0x62b2c8dc, 0xaed39563, + 0x41ec046e); + asm volatile("vrem.vv v1, v2, v3"); + VCMP_I32(3, v1, 0x1bc2e57e, 0x2ffccae4, 0x004b37b9, 0xfb90411a, 0xca41954b, + 0x10dc3772, 0xf7749e82, 0x027ed4d3, 0xff0c3f6f, 0xf3f9c5d2, + 0xb480c184, 0xfe6be56e, 0x00ddb682, 0xe2ee9c3e, 0xe1652989, + 0x22d7ca24); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x9fc0a4e82116b913, 0xbd1a679edd2667e1, 0x559913931b91caf2, + 0xecfe6fb53a8b043d, 0xd8a48a111d080e66, 0x7baccec6b5a29e3e, + 0x8746dc00d1d7ff0b, 0x467babd497d4931b, 0x6f7f3e669faa900c, + 0x36e81d34c3ee3445, 0x99bcc4a480c648c5, 0xc8ae527a2cc4d908, + 0xce3b4c1da847fe6a, 0x3709710bc016c1fc, 0x81471426bbe09e45, + 0x0f0389282729456f); + VLOAD_64(v3, 0xf2473f877dd9c3df, 0xd2471da7c8ff8466, 0x7e93451b38765d03, + 0xf7e905f27777369f, 0x73cbef014fd0f311, 0x4c3e4fc36800b443, + 0x4c283e06a5067444, 0xdc8295e57f30e905, 0x08207a363067024e, + 0x42aba773f21efc47, 0x5f00e9093d50b50f, 0x5ff0dcd41bf799fa, + 0xe8c1d1110518742a, 0x34fe1a3555bf07f0, 0xd1bce4800f79700f, + 0xff00f7d87b2c7068); + asm volatile("vrem.vv v1, v2, v3"); + VCMP_I64(4, v1, 0xffcde833b0225dfa, 0xead349f71426e37b, 0x559913931b91caf2, + 0xfd2c63d04b9c96ff, 0xd8a48a111d080e66, 0x2f6e7f034da1e9fb, + 0xd36f1a0776de734f, 0x22fe41ba17057c20, 0x05d909a62a6f7216, + 0x36e81d34c3ee3445, 0xf8bdadadbe16fdd4, 0xc8ae527a2cc4d908, + 0xfcb7a9fb9e171616, 0x020b56d66a57ba0c, 0xddcd4b269cedbe27, + 0x00120ed75ec3db87); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x9b, 0x28, 0xec, 0x86, 0x26, 0x85, 0xf7, 0x33, 0x46, 0x37, 0x2c, + 0x0c, 0x8e, 0xae, 0xa1, 0x93); + VLOAD_8(v3, 0x84, 0x5e, 0x3b, 0xdf, 0x10, 0xfc, 0x05, 0xcf, 0x42, 0xbe, 0x23, + 0xdb, 0x37, 0x78, 0xe2, 0x85); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0x28, 0, 0xe9, 0, 0xfd, 0, 0x02, 0, 0x37, 0, 0x0c, 0, 0xae, + 0, 0x93); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xb58f, 0xa184, 0xdcf9, 0xd084, 0xbbc6, 0xcf0e, 0xbbd4, 0xa20c, + 0xe04c, 0xd954, 0xda74, 0xa394, 0x207a, 0x8975, 0xddd3, 0x897d); + VLOAD_16(v3, 0x4534, 0xafd7, 0xf703, 0x92c2, 0x97e3, 0xd85a, 0x1540, 0x8c5c, + 0x4a71, 0x43a7, 0xe65d, 0x2bdc, 0x497b, 0x6aa0, 0x6071, 0xf431); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0xf1ad, 0, 0xd084, 0, 0xf6b4, 0, 0xa20c, 0, 0xd954, 0, + 0xfb4c, 0, 0xf415, 0, 0xff93); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x620db972, 0x60b1f870, 0x7d1badcf, 0x90a85eb6, 0xca41954b, + 0x10dc3772, 0xf7749e82, 0x027ed4d3, 0xdcb6a562, 0xa979baf0, + 0xb480c184, 0x979555c6, 0x3f894108, 0x803bd362, 0x9038beec, + 0x22d7ca24); + VLOAD_32(v3, 0xb9b52c0c, 0x30b52d8c, 0x832f89ea, 0x95181d9c, 0x85a6a24f, + 0x2f2c64a7, 0xebe4120c, 0x83852646, 0xfb1857b5, 0x25400571, + 0xab2d7393, 0xddb87ac8, 0x01149cdf, 0x62b2c8dc, 0xaed39563, + 0x41ec046e); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0x2ffccae4, 0, 0xfb90411a, 0, 0x10dc3772, 0, 0x027ed4d3, 0, + 0xf3f9c5d2, 0, 0xfe6be56e, 0, 0xe2ee9c3e, 0, 0x22d7ca24); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x9fc0a4e82116b913, 0xbd1a679edd2667e1, 0x559913931b91caf2, + 0xecfe6fb53a8b043d, 0xd8a48a111d080e66, 0x7baccec6b5a29e3e, + 0x8746dc00d1d7ff0b, 0x467babd497d4931b, 0x6f7f3e669faa900c, + 0x36e81d34c3ee3445, 0x99bcc4a480c648c5, 0xc8ae527a2cc4d908, + 0xce3b4c1da847fe6a, 0x3709710bc016c1fc, 0x81471426bbe09e45, + 0x0f0389282729456f); + VLOAD_64(v3, 0xf2473f877dd9c3df, 0xd2471da7c8ff8466, 0x7e93451b38765d03, + 0xf7e905f27777369f, 0x73cbef014fd0f311, 0x4c3e4fc36800b443, + 0x4c283e06a5067444, 0xdc8295e57f30e905, 0x08207a363067024e, + 0x42aba773f21efc47, 0x5f00e9093d50b50f, 0x5ff0dcd41bf799fa, + 0xe8c1d1110518742a, 0x34fe1a3555bf07f0, 0xd1bce4800f79700f, + 0xff00f7d87b2c7068); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0xead349f71426e37b, 0, 0xfd2c63d04b9c96ff, 0, + 0x2f6e7f034da1e9fb, 0, 0x22fe41ba17057c20, 0, 0x36e81d34c3ee3445, 0, + 0xc8ae527a2cc4d908, 0, 0x020b56d66a57ba0c, 0, 0x00120ed75ec3db87); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x5b, 0x3b, 0xc4, 0x95, 0x41, 0x71, 0x9b, 0x67, 0x84, 0x2e, 0x0a, + 0x2a, 0xb2, 0x57, 0xe5, 0x6c); + int64_t scalar = 5; + asm volatile("vrem.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0x01, 0x04, 0x00, 0xfe, 0x00, 0x03, 0xff, 0x03, 0xfc, 0x01, + 0x00, 0x02, 0xfd, 0x02, 0xfe, 0x03); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xc670, 0x8f3b, 0x200f, 0x52ea, 0xfdce, 0xcf06, 0x57f1, 0x1936, + 0xb6ec, 0x69e8, 0x0abf, 0x441e, 0xa420, 0x396c, 0xe7c9, 0xa464); + scalar = -538; + asm volatile("vrem.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0xff2e, 0xfe9d, 0x0089, 0x00f4, 0xffe8, 0xff5c, 0x01c7, + 0x0218, 0xfe60, 0x00d4, 0x003d, 0x00de, 0xfe7e, 0x00ae, 0xfee7, + 0xfec2); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xf937dbf9, 0x6d855b59, 0x3bd09126, 0xaed11886, 0x6eb6f4bd, + 0x5c639253, 0xca0f2abf, 0x57fec97b, 0x39496099, 0x8bfcdd58, + 0x0f19f6e2, 0x2070c8d4, 0x8c689324, 0x2eecd9d7, 0xe2907e94, + 0xb6cc2d44); + scalar = 649; + asm volatile("vrem.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0xfffffee4, 0x00000116, 0x00000160, 0xffffffef, 0x00000217, + 0x00000275, 0xfffffea6, 0x000000a9, 0x000000e4, 0xfffffe09, + 0x00000272, 0x0000023c, 0xffffff79, 0x000000ce, 0xffffffb3, + 0xfffffe0e); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x94236504e03e6525, 0x8d219d7afe5b2fb0, 0xc65a0b252860ab73, + 0x2ca68636bacbc0bb, 0x275575f3e3fea940, 0x8f546251aaad354a, + 0xb1462969035e0fa7, 0x5c9cdc19273ce111, 0x25a8487741ee75db, + 0x38819f95e162663e, 0x698d19ce0e74ff8d, 0xb525257a9b5cd972, + 0xb308a4fe0dcbb2f3, 0xf2fa735abc2db4d0, 0xc73c476461ac3f28, + 0xb2830c2607bfffcc); + scalar = -59223; + asm volatile("vrem.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0xffffffffffff299e, 0xffffffffffff1f8a, 0xffffffffffff57aa, + 0x000000000000cc8c, 0x000000000000416e, 0xffffffffffffcecd, + 0xffffffffffff7e24, 0x000000000000397b, 0x000000000000bb50, + 0x0000000000006b00, 0x0000000000004f3f, 0xffffffffffff9a21, + 0xffffffffffffae24, 0xffffffffffffca84, 0xffffffffffffa7fb, + 0xffffffffffff84dd); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x5b, 0x3b, 0xc4, 0x95, 0x41, 0x71, 0x9b, 0x67, 0x84, 0x2e, 0x0a, + 0x2a, 0xb2, 0x57, 0xe5, 0x6c); + int64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0x04, 0, 0xfe, 0, 0x03, 0, 0x03, 0, 0x01, 0, 0x02, 0, 0x02, + 0, 0x03); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xc670, 0x8f3b, 0x200f, 0x52ea, 0xfdce, 0xcf06, 0x57f1, 0x1936, + 0xb6ec, 0x69e8, 0x0abf, 0x441e, 0xa420, 0x396c, 0xe7c9, 0xa464); + scalar = -538; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0xfe9d, 0, 0x00f4, 0, 0xff5c, 0, 0x0218, 0, 0x00d4, 0, + 0x00de, 0, 0x00ae, 0, 0xfec2); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xf937dbf9, 0x6d855b59, 0x3bd09126, 0xaed11886, 0x6eb6f4bd, + 0x5c639253, 0xca0f2abf, 0x57fec97b, 0x39496099, 0x8bfcdd58, + 0x0f19f6e2, 0x2070c8d4, 0x8c689324, 0x2eecd9d7, 0xe2907e94, + 0xb6cc2d44); + scalar = 649; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0x00000116, 0, 0xffffffef, 0, 0x00000275, 0, 0x000000a9, + 0, 0xfffffe09, 0, 0x0000023c, 0, 0x000000ce, 0, 0xfffffe0e); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x94236504e03e6525, 0x8d219d7afe5b2fb0, 0xc65a0b252860ab73, + 0x2ca68636bacbc0bb, 0x275575f3e3fea940, 0x8f546251aaad354a, + 0xb1462969035e0fa7, 0x5c9cdc19273ce111, 0x25a8487741ee75db, + 0x38819f95e162663e, 0x698d19ce0e74ff8d, 0xb525257a9b5cd972, + 0xb308a4fe0dcbb2f3, 0xf2fa735abc2db4d0, 0xc73c476461ac3f28, + 0xb2830c2607bfffcc); + scalar = -59223; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vrem.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0xffffffffffff1f8a, 0, 0x000000000000cc8c, 0, + 0xffffffffffffcecd, 0, 0x000000000000397b, 0, 0x0000000000006b00, 0, + 0xffffffffffff9a21, 0, 0xffffffffffffca84, 0, 0xffffffffffff84dd); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vremu.c b/apps/riscv-tests/isa/rv64uv/vremu.c new file mode 100644 index 0000000..b8d8681 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vremu.c @@ -0,0 +1,232 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x11, 0xd2, 0x6a, 0xcc, 0x14, 0xe4, 0x2c, 0x7f, 0xd2, 0x6b, 0x34, + 0x5c, 0x75, 0xdd, 0x0c, 0x42); + VLOAD_8(v3, 0x77, 0xb2, 0xd1, 0x95, 0x6f, 0xbe, 0x0d, 0x5a, 0x93, 0x02, 0xaf, + 0xfd, 0x94, 0xe0, 0xb7, 0xe6); + asm volatile("vremu.vv v1, v2, v3"); + VCMP_I8(1, v1, 0x11, 0x20, 0x6a, 0x37, 0x14, 0x26, 0x05, 0x25, 0x3f, 0x01, + 0x34, 0x5c, 0x75, 0xdd, 0x0c, 0x42); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xf77a, 0x54d7, 0xe527, 0xe28f, 0x53ed, 0x9301, 0xde4f, 0xcb17, + 0xae43, 0x9e4a, 0xa0c2, 0xdf31, 0xb66f, 0x286d, 0x1d15, 0x0480); + VLOAD_16(v3, 0x5bfa, 0x0571, 0x8a43, 0x6350, 0xb962, 0x71fc, 0x0b54, 0x1e8b, + 0x6c25, 0x9c0d, 0x5950, 0x1887, 0xbc18, 0x628e, 0x6561, 0x407f); + asm volatile("vremu.vv v1, v2, v3"); + VCMP_I16(2, v1, 0x3f86, 0x0338, 0x5ae4, 0x1bef, 0x53ed, 0x2105, 0x0713, + 0x13d5, 0x421e, 0x023d, 0x4772, 0x0272, 0xb66f, 0x286d, 0x1d15, + 0x0480); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x647d8841, 0xf9e0aabf, 0xea4aa122, 0xd6178d3e, 0x64a7afe5, + 0xe0350cba, 0xc72768ec, 0x9f977a31, 0x5e1c2ac4, 0xcd44b950, + 0x39dc32f4, 0x1dc82ea3, 0xd1cf125f, 0xc677269c, 0x6405ec5b, + 0x653a05ee); + VLOAD_32(v3, 0x89828d99, 0x5c7c7db0, 0x2911efb6, 0x1f6982ff, 0x564e4bd4, + 0xc4576bff, 0x8e998104, 0x4a23ba44, 0x994b4630, 0x017ee935, + 0xa38c7dae, 0x893dfb15, 0x4969125f, 0x9a951d27, 0x09b6017f, + 0x5a0a7906); + asm volatile("vremu.vv v1, v2, v3"); + VCMP_I32(3, v1, 0x647d8841, 0x40e7af5f, 0x1cf0f294, 0x199e7b44, 0x0e596411, + 0x1bdda0bb, 0x388de7e8, 0x0b5005a9, 0x5e1c2ac4, 0x0059ebf3, + 0x39dc32f4, 0x1dc82ea3, 0x3efceda1, 0x2be20975, 0x02e9dd65, + 0x0b2f8ce8); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x09ab27501ccac4a6, 0x97eb5bf189b39a0e, 0x26f588069b0858c4, + 0x9a251c274a394df3, 0x54b3587602f8d9d2, 0xc3cc623deda95ca7, + 0x118c4335397980bf, 0xc3e2d283cb39133d, 0x71837e24114813fc, + 0x85a1f65867438a09, 0x80f01e0588afc9a0, 0x60e89a1e5a43d9f5, + 0x93a87cf6308ad888, 0xca3976f49ac6a681, 0xcfc7c8f225b47766, + 0xeaa4ce2cf507b527); + VLOAD_64(v3, 0x9fed81c550326301, 0x445bb7ac18d0eaa1, 0x040f8ff58f5adf72, + 0xafc4ff6b8eb4d201, 0xfba36cabfc3fb4a0, 0x9c3ed271bf173d29, + 0xe8b7e325c9ff594b, 0x05169e56693600d7, 0x08e72c4bb62ad267, + 0xbd9677ee996d5fa5, 0x900295e8502a9817, 0x39e0bfa9927679a8, + 0xdd0ca7797d532524, 0x6f8f78c47ddee88a, 0x2f40f7661cca9eee, + 0x8e4a3b2358129e92); + asm volatile("vremu.vv v1, v2, v3"); + VCMP_I64(4, v1, 0x09ab27501ccac4a6, 0x0f33ec995811c4cc, 0x0269786490d67dc2, + 0x9a251c274a394df3, 0x54b3587602f8d9d2, 0x278d8fcc2e921f7e, + 0x118c4335397980bf, 0x028751b02d34f353, 0x06ad6a9787463728, + 0x85a1f65867438a09, 0x80f01e0588afc9a0, 0x2707da74c7cd604d, + 0x93a87cf6308ad888, 0x5aa9fe301ce7bdf7, 0x12c3eb59b289fbae, + 0x5c5a93099cf51695); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x11, 0xd2, 0x6a, 0xcc, 0x14, 0xe4, 0x2c, 0x7f, 0xd2, 0x6b, 0x34, + 0x5c, 0x75, 0xdd, 0x0c, 0x42); + VLOAD_8(v3, 0x77, 0xb2, 0xd1, 0x95, 0x6f, 0xbe, 0x0d, 0x5a, 0x93, 0x02, 0xaf, + 0xfd, 0x94, 0xe0, 0xb7, 0xe6); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vv v1, v2, v3, v0.t"); + VCMP_I8(5, v1, 0, 0x20, 0, 0x37, 0, 0x26, 0, 0x25, 0, 0x01, 0, 0x5c, 0, 0xdd, + 0, 0x42); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xf77a, 0x54d7, 0xe527, 0xe28f, 0x53ed, 0x9301, 0xde4f, 0xcb17, + 0xae43, 0x9e4a, 0xa0c2, 0xdf31, 0xb66f, 0x286d, 0x1d15, 0x0480); + VLOAD_16(v3, 0x5bfa, 0x0571, 0x8a43, 0x6350, 0xb962, 0x71fc, 0x0b54, 0x1e8b, + 0x6c25, 0x9c0d, 0x5950, 0x1887, 0xbc18, 0x628e, 0x6561, 0x407f); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vv v1, v2, v3, v0.t"); + VCMP_I16(6, v1, 0, 0x0338, 0, 0x1bef, 0, 0x2105, 0, 0x13d5, 0, 0x023d, 0, + 0x0272, 0, 0x286d, 0, 0x0480); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x647d8841, 0xf9e0aabf, 0xea4aa122, 0xd6178d3e, 0x64a7afe5, + 0xe0350cba, 0xc72768ec, 0x9f977a31, 0x5e1c2ac4, 0xcd44b950, + 0x39dc32f4, 0x1dc82ea3, 0xd1cf125f, 0xc677269c, 0x6405ec5b, + 0x653a05ee); + VLOAD_32(v3, 0x89828d99, 0x5c7c7db0, 0x2911efb6, 0x1f6982ff, 0x564e4bd4, + 0xc4576bff, 0x8e998104, 0x4a23ba44, 0x994b4630, 0x017ee935, + 0xa38c7dae, 0x893dfb15, 0x4969125f, 0x9a951d27, 0x09b6017f, + 0x5a0a7906); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vv v1, v2, v3, v0.t"); + VCMP_I32(7, v1, 0, 0x40e7af5f, 0, 0x199e7b44, 0, 0x1bdda0bb, 0, 0x0b5005a9, 0, + 0x0059ebf3, 0, 0x1dc82ea3, 0, 0x2be20975, 0, 0x0b2f8ce8); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x09ab27501ccac4a6, 0x97eb5bf189b39a0e, 0x26f588069b0858c4, + 0x9a251c274a394df3, 0x54b3587602f8d9d2, 0xc3cc623deda95ca7, + 0x118c4335397980bf, 0xc3e2d283cb39133d, 0x71837e24114813fc, + 0x85a1f65867438a09, 0x80f01e0588afc9a0, 0x60e89a1e5a43d9f5, + 0x93a87cf6308ad888, 0xca3976f49ac6a681, 0xcfc7c8f225b47766, + 0xeaa4ce2cf507b527); + VLOAD_64(v3, 0x9fed81c550326301, 0x445bb7ac18d0eaa1, 0x040f8ff58f5adf72, + 0xafc4ff6b8eb4d201, 0xfba36cabfc3fb4a0, 0x9c3ed271bf173d29, + 0xe8b7e325c9ff594b, 0x05169e56693600d7, 0x08e72c4bb62ad267, + 0xbd9677ee996d5fa5, 0x900295e8502a9817, 0x39e0bfa9927679a8, + 0xdd0ca7797d532524, 0x6f8f78c47ddee88a, 0x2f40f7661cca9eee, + 0x8e4a3b2358129e92); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vv v1, v2, v3, v0.t"); + VCMP_I64(8, v1, 0, 0x0f33ec995811c4cc, 0, 0x9a251c274a394df3, 0, + 0x278d8fcc2e921f7e, 0, 0x028751b02d34f353, 0, 0x85a1f65867438a09, 0, + 0x2707da74c7cd604d, 0, 0x5aa9fe301ce7bdf7, 0, 0x5c5a93099cf51695); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x98, 0x1a, 0xbe, 0x48, 0x7c, 0xd9, 0x5e, 0x58, 0x2e, 0x46, 0x0c, + 0x24, 0xc5, 0x2b, 0x37, 0xbe); + uint64_t scalar = 5; + asm volatile("vremu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(9, v1, 0x02, 0x01, 0x00, 0x02, 0x04, 0x02, 0x04, 0x03, 0x01, 0x00, + 0x02, 0x01, 0x02, 0x03, 0x00, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xf11f, 0xb8cd, 0xb686, 0xc226, 0xc35a, 0xd724, 0x03f1, 0xcf10, + 0xbae0, 0x9f01, 0x1d0f, 0xf53c, 0x5461, 0x341e, 0x9ae7, 0x032b); + scalar = 538; + asm volatile("vremu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I16(10, v1, 0x018b, 0x01f7, 0x01ca, 0x00ce, 0x0202, 0x00c8, 0x01d7, + 0x011c, 0x01f0, 0x0163, 0x01bd, 0x0174, 0x0051, 0x01ae, 0x017d, + 0x0111); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x9c36da54, 0x1b1dea93, 0x80be8651, 0x03a23fcf, 0x26973d17, + 0x521f01df, 0x09e8f77a, 0x5b231aa2, 0xd4bea1df, 0x529b4f34, + 0x800a5d88, 0xe7b02512, 0xf7954032, 0x48652b8c, 0x8b14b883, + 0x121a9b8b); + scalar = 649; + asm volatile("vremu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I32(11, v1, 0x00000039, 0x00000141, 0x0000020b, 0x0000015f, 0x0000008a, + 0x00000199, 0x00000214, 0x0000006c, 0x0000025d, 0x000001a6, + 0x000000d2, 0x00000168, 0x000001e6, 0x00000266, 0x00000188, + 0x00000159); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x1882c5f4b911b949, 0x6ca37133428ed155, 0xbacb9408aa8251bf, + 0x62d79deed97681f5, 0x56258335e007492c, 0x2428afa90a14fa61, + 0xd62824119c3084c6, 0xef97986ae9ea2da7, 0xfc28c84e37024f10, + 0x1f475f820dec67e1, 0x9c180cfef468c050, 0x4be017933813e27e, + 0xafd2b5edb83df693, 0xddd4766a628d4c30, 0xa1f4d0f48a6ac917, + 0x827a07db9e6a8897); + scalar = 9223; + asm volatile("vremu.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I64(12, v1, 0x000000000000167d, 0x00000000000015f2, 0x00000000000019be, + 0x00000000000003fd, 0x00000000000010ce, 0x0000000000001863, + 0x0000000000000750, 0x0000000000000062, 0x0000000000002237, + 0x00000000000002bc, 0x0000000000000061, 0x0000000000001b82, + 0x0000000000001109, 0x0000000000000fb7, 0x00000000000011e8, + 0x0000000000000545); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x98, 0x1a, 0xbe, 0x48, 0x7c, 0xd9, 0x5e, 0x58, 0x2e, 0x46, 0x0c, + 0x24, 0xc5, 0x2b, 0x37, 0xbe); + uint64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(13, v1, 0, 0x01, 0, 0x02, 0, 0x02, 0, 0x03, 0, 0x00, 0, 0x01, 0, 0x03, + 0, 0x00); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xf11f, 0xb8cd, 0xb686, 0xc226, 0xc35a, 0xd724, 0x03f1, 0xcf10, + 0xbae0, 0x9f01, 0x1d0f, 0xf53c, 0x5461, 0x341e, 0x9ae7, 0x032b); + scalar = 538; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I16(14, v1, 0, 0x01f7, 0, 0x00ce, 0, 0x00c8, 0, 0x011c, 0, 0x0163, 0, + 0x0174, 0, 0x01ae, 0, 0x0111); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x9c36da54, 0x1b1dea93, 0x80be8651, 0x03a23fcf, 0x26973d17, + 0x521f01df, 0x09e8f77a, 0x5b231aa2, 0xd4bea1df, 0x529b4f34, + 0x800a5d88, 0xe7b02512, 0xf7954032, 0x48652b8c, 0x8b14b883, + 0x121a9b8b); + scalar = 649; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I32(15, v1, 0, 0x00000141, 0, 0x0000015f, 0, 0x00000199, 0, 0x0000006c, + 0, 0x000001a6, 0, 0x00000168, 0, 0x00000266, 0, 0x00000159); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x1882c5f4b911b949, 0x6ca37133428ed155, 0xbacb9408aa8251bf, + 0x62d79deed97681f5, 0x56258335e007492c, 0x2428afa90a14fa61, + 0xd62824119c3084c6, 0xef97986ae9ea2da7, 0xfc28c84e37024f10, + 0x1f475f820dec67e1, 0x9c180cfef468c050, 0x4be017933813e27e, + 0xafd2b5edb83df693, 0xddd4766a628d4c30, 0xa1f4d0f48a6ac917, + 0x827a07db9e6a8897); + scalar = 9223; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v1); + asm volatile("vremu.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I64(16, v1, 0, 0x00000000000015f2, 0, 0x00000000000003fd, 0, + 0x0000000000001863, 0, 0x0000000000000062, 0, 0x00000000000002bc, 0, + 0x0000000000001b82, 0, 0x0000000000000fb7, 0, 0x0000000000000545); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vrgather.c b/apps/riscv-tests/isa/rv64uv/vrgather.c new file mode 100644 index 0000000..60fe8a9 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vrgather.c @@ -0,0 +1,340 @@ +// Copyright 2024 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(5, e8, m1); + VLOAD_8(v4, 10, 20, 30, 40, 50); + VLOAD_8(v6, 1, 0, 4, 3, 2); + asm volatile("vrgather.vv v2, v4, v6"); + VCMP_U8(1, v2, 20, 10, 50, 40, 30); + + VSET(2, e8, m1); + VLOAD_8(v4, 10, 20); + VLOAD_8(v6, 1, 1); + asm volatile("vrgather.vv v2, v4, v6"); + VCMP_U8(2, v2, 20, 20); + + VSET(256, e32, m4); + VLOAD_32( + v24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 351); + VLOAD_32(v28, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, + 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, + 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, + 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, + 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, + 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 255); + asm volatile("vrgather.vv v4, v24, v28"); + VCMP_U32( + 3, v4, 351, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, + 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, + 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, + 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, + 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, + 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, + 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, + 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, + 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, + 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, + 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, + 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, + 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, + 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 351); + + VSET(256, e16, m4); + VLOAD_32(v24, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, + 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, + 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, + 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, + 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, + 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 467); + VSET(256, e32, m4); + VLOAD_16( + v28, 0, 255, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255); + asm volatile("vrgatherei16.vv v4, v24, v28"); + VCMP_U32( + 4, v4, 255, 467, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, + 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, + 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, + 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, + 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, + 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, + 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, + 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, + 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, + 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, + 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, + 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, + 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, + 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 467); +} + +void TEST_CASE2() { + VSET(5, e8, m1); + VLOAD_8(v4, 10, 20, 30, 40, 50); + VLOAD_8(v6, 1, 0, 4, 3, 2); + VLOAD_8(v0, 26, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vrgather.vv v2, v4, v6, v0.t"); + VCMP_U8(5, v2, 0, 10, 0, 40, 30); + + VSET(1, e64, m4); + VLOAD_64(v0, -1); + VSET(64, e32, m4); + VLOAD_32(v24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63); + VLOAD_32(v12, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, + 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, + 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, + 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + VCLEAR_AT_ONE(v4); + asm volatile("vrgather.vv v4, v24, v12, v0.t"); + VCMP_U32(6, v4, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, + 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, + 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + + VSET(1, e64, m4); + VLOAD_64(v0, 0xf1ffffffffffffff); + VSET(64, e32, m4); + VLOAD_32(v24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63); + VLOAD_32(v16, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, + 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, + 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, + 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + VCLEAR_AT_ONE(v28); + asm volatile("vrgather.vv v28, v24, v16, v0.t"); + VCMP_U32(7, v28, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, + 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, + 14, 13, 12, 11, 10, 9, 8, 7, 0xffffffff, 0xffffffff, 0xffffffff, 3, + 2, 1, 0); + + VSET(4, e64, m4); + VLOAD_64(v0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff); + VSET(255, e32, m4); + VLOAD_32(v24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254); + VLOAD_32(v28, 253, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, + 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, + 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, + 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, + 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, + 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 254); + VCLEAR_AT_ONE(v4); + asm volatile("vrgather.vv v4, v24, v28, v0.t"); + VCMP_U32(8, v4, 253, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, + 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, + 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, + 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, + 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, + 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, + 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, + 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, + 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, + 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, + 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, + 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, + 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, + 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, + 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, + 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, + 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 254); + + VSET(4, e64, m4); + VLOAD_64(v0, -1, -1, -1, 0xf1ffffffffffffff); + VSET(255, e32, m4); + VLOAD_32(v24, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254); + VLOAD_32(v28, 0, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, + 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, + 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, + 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, + 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, + 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1); + VCLEAR_AT_ONE(v4); + asm volatile("vrgather.vv v4, v24, v28, v0.t"); + VCMP_U32(9, v4, 3, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, + 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, + 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, + 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, + 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, + 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, + 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, + 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 0xffffffff, 0xffffffff, + 0xffffffff, 3, 2, 1); +} + +void TEST_CASE3() { + VSET(5, e8, m1); + VLOAD_8(v4, 10, 20, 30, 40, 50); + uint64_t scalar = 3; + asm volatile("vrgather.vx v2, v4, %[A]" ::[A] "r"(scalar)); + VCMP_U8(10, v2, 40, 40, 40, 40, 40); +} + +void TEST_CASE4() { + VSET(5, e8, m1); + VLOAD_8(v4, 10, 20, 30, 40, 50); + uint64_t scalar = 3; + VLOAD_8(v0, 7, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vrgather.vx v2, v4, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(11, v2, 40, 40, 40, 0, 0); +} + +void TEST_CASE5() { + VSET(5, e8, m1); + VLOAD_8(v4, 10, 20, 30, 40, 50); + asm volatile("vrgather.vi v2, v4, 3"); + VCMP_U8(12, v2, 40, 40, 40, 40, 40); +} + +void TEST_CASE6() { + VSET(5, e8, m1); + VLOAD_8(v4, 10, 20, 30, 40, 50); + VLOAD_8(v0, 7, 0, 0, 0, 0); + VCLEAR(v2); + asm volatile("vrgather.vi v2, v4, 3, v0.t"); + VCMP_U8(13, v2, 40, 40, 40, 0, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vrsub.c b/apps/riscv-tests/isa/rv64uv/vrsub.c new file mode 100644 index 0000000..d181c37 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vrsub.c @@ -0,0 +1,136 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vi v3, v1, 10"); + VCMP_U8(1, v3, 5, 0, -5, -10, -15, -20, -25, -30, 5, 0, -5, -10, -15, -20, + -25, -30); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vi v3, v1, 10"); + VCMP_U16(2, v3, 5, 0, -5, -10, -15, -20, -25, -30, 5, 0, -5, -10, -15, -20, + -25, -30); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vi v3, v1, 10"); + VCMP_U32(3, v3, 5, 0, -5, -10, -15, -20, -25, -30, 5, 0, -5, -10, -15, -20, + -25, -30); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vi v3, v1, 10"); + VCMP_U64(4, v3, 5, 0, -5, -10, -15, -20, -25, -30, 5, 0, -5, -10, -15, -20, + -25, -30); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vi v3, v1, 10, v0.t"); + VCMP_U8(5, v3, 5, 0, 0, 0, -15, -20, 0, 0, 5, 0, 0, 0, -15, -20, 0, 0); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vi v3, v1, 10, v0.t"); + VCMP_U16(6, v3, 5, 0, 0, 0, -15, -20, 0, 0, 5, 0, 0, 0, -15, -20, 0, 0); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vi v3, v1, 10, v0.t"); + VCMP_U32(7, v3, 5, 0, 0, 0, -15, -20, 0, 0, 5, 0, 0, 0, -15, -20, 0, 0); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vi v3, v1, 10, v0.t"); + VCMP_U64(8, v3, 5, 0, 0, 0, -15, -20, 0, 0, 5, 0, 0, 0, -15, -20, 0, 0); +} + +void TEST_CASE3(void) { + const uint64_t scalar = 25; + + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v3, 20, 15, 10, 5, 0, -5, -10, -15, 20, 15, 10, 5, 0, -5, -10, + -15); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v3, 20, 15, 10, 5, 0, -5, -10, -15, 20, 15, 10, 5, 0, -5, -10, + -15); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v3, 20, 15, 10, 5, 0, -5, -10, -15, 20, 15, 10, 5, 0, -5, -10, + -15); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vrsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v3, 20, 15, 10, 5, 0, -5, -10, -15, 20, 15, 10, 5, 0, -5, -10, + -15); +} + +void TEST_CASE4(void) { + const uint64_t scalar = 25; + + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v3, 20, 15, 0, 0, 0, -5, 0, 0, 20, 15, 0, 0, 0, -5, 0, 0); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v3, 20, 15, 0, 0, 0, -5, 0, 0, 20, 15, 0, 0, 0, -5, 0, 0); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v3, 20, 15, 0, 0, 0, -5, 0, 0, 20, 15, 0, 0, 0, -5, 0, 0); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0x33, 0x33); + VCLEAR(v3); + asm volatile("vrsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v3, 20, 15, 0, 0, 0, -5, 0, 0, 20, 15, 0, 0, 0, -5, 0, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vs.c b/apps/riscv-tests/isa/rv64uv/vs.c new file mode 100644 index 0000000..5db3a5c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vs.c @@ -0,0 +1,93 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +static volatile uint8_t ALIGNED_O8[16] __attribute__((aligned(AXI_DWIDTH))) = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static volatile uint16_t ALIGNED_O16[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; + +static volatile uint32_t ALIGNED_O32[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + +static volatile uint64_t ALIGNED_O64[16] + __attribute__((aligned(AXI_DWIDTH))) = { + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000}; + +// Misaligned access wrt 128-bit +void TEST_CASE1(void) { + VSET(15, e8, m1); + VLOAD_8(v1, 0xe4, 0x19, 0x20, 0x9f, 0xe4, 0x19, 0x20, 0x9f, 0xe4, 0x19, 0x20, + 0x9f, 0xe4, 0x19, 0x20); + asm volatile("vse8.v v1, (%0)" ::"r"(&ALIGNED_O8[1])); + VVCMP_U8(1, ALIGNED_O8, 0x00, 0xe4, 0x19, 0x20, 0x9f, 0xe4, 0x19, 0x20, 0x9f, + 0xe4, 0x19, 0x20, 0x9f, 0xe4, 0x19, 0x20); +} + +void TEST_CASE2(void) { + VSET(15, e16, m1); + VLOAD_16(v1, 0xe478, 0x1549, 0x3240, 0x2f11, 0xe448, 0x1546, 0x3220, 0x9f11, + 0xe478, 0x1549, 0x3240, 0x2f11, 0xe448, 0x1546, 0x3220); + asm volatile("vse16.v v1, (%0)" ::"r"(&ALIGNED_O16[1])); + VVCMP_U16(2, ALIGNED_O16, 0x0000, 0xe478, 0x1549, 0x3240, 0x2f11, 0xe448, + 0x1546, 0x3220, 0x9f11, 0xe478, 0x1549, 0x3240, 0x2f11, 0xe448, + 0x1546, 0x3220); +} + +void TEST_CASE3(void) { + VSET(15, e32, m1); + VLOAD_32(v1, 0xe1356784, 0x13241139, 0x20862497, 0x9f872456, 0xe1356784, + 0x13241139, 0x20862497, 0x9f872456, 0xe1356784, 0x13241139, + 0x20862497, 0x9f872456, 0xe1356784, 0x13241139, 0x20862497); + asm volatile("vse32.v v1, (%0)" ::"r"(&ALIGNED_O32[1])); + VVCMP_U32(3, ALIGNED_O32, 0x00000000, 0xe1356784, 0x13241139, 0x20862497, + 0x9f872456, 0xe1356784, 0x13241139, 0x20862497, 0x9f872456, + 0xe1356784, 0x13241139, 0x20862497, 0x9f872456, 0xe1356784, + 0x13241139, 0x20862497); +} + +void TEST_CASE4(void) { + VSET(15, e64, m1); + VLOAD_64(v1, 0xe135578794246784, 0x1315345345241139, 0x2086252110062497, + 0x1100229933847136, 0xaaffaaffaaffaaff, 0xaf87245315434136, + 0xa135578794246784, 0x2315345345241139, 0x1086252110062497, + 0x1100229933847134, 0xaaffaaffaaffaaf4, 0x9315345345241139, + 0x9086252110062497, 0x9100229933847134, 0x9affaaffaaffaaf4); + asm volatile("vse64.v v1, (%0)" ::"r"(&ALIGNED_O64[1])); + VVCMP_U64(4, ALIGNED_O64, 0x0000000000000000, 0xe135578794246784, + 0x1315345345241139, 0x2086252110062497, 0x1100229933847136, + 0xaaffaaffaaffaaff, 0xaf87245315434136, 0xa135578794246784, + 0x2315345345241139, 0x1086252110062497, 0x1100229933847134, + 0xaaffaaffaaffaaf4, 0x9315345345241139, 0x9086252110062497, + 0x9100229933847134, 0x9affaaffaaffaaf4); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vs1r.c b/apps/riscv-tests/isa/rv64uv/vs1r.c new file mode 100644 index 0000000..ffcbd3f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vs1r.c @@ -0,0 +1,162 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// +// For simplicity, this test depends on vl1r + +#include "vector_macros.h" + +uint64_t counter; + +// Maximum size: (VLEN/8 Bytes * (MAX_LMUL == 8)) = VLEN +// Define VLEN before compiling me +// #define VLEN 4096 +uint8_t gold_vec_8b[VLEN]; +uint8_t zero_vec_8b[VLEN]; +uint8_t buf_vec_8b[VLEN]; + +////////// +// vs1r // +////////// + +// 1 whole register load +void TEST_CASE1(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 8); + // Set vl and vtype to super short values + VSET(1, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Check that the whole register was loaded + asm volatile("vs1r.v v16, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 0, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + asm volatile("vs1r.v v17, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 0, buf_vec_8b, zero_vec_8b, VLEN / 8); +} + +////////// +// vs2r // +////////// + +// 2 whole registers load +void TEST_CASE2(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 4); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 4); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 4); + // Set vl and vtype to super short values + VSET(1, e64, m4); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl2re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Check that the whole register was loaded + asm volatile("vs2r.v v16, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 1, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + asm volatile("vs2r.v v18, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 1, buf_vec_8b, zero_vec_8b, VLEN / 8); +} + +////////// +// vs4r // +////////// + +// 4 whole registers load +void TEST_CASE3(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 2); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 2); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 2); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl4re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Check that the whole register was loaded + asm volatile("vs4r.v v16, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 2, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + asm volatile("vs4r.v v20, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 2, buf_vec_8b, zero_vec_8b, VLEN / 8); +} + +////////// +// vs8r // +////////// + +// 8 whole registers load +void TEST_CASE4(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN); + // Set vl and vtype to super short values + VSET(1, e64, m8); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + VCLEAR(v24); + // Load a buffer from memory - whole register load + asm volatile("vl8re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Check that the whole register was loaded + asm volatile("vs8r.v v16, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 3, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + asm volatile("vs8r.v v24, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 3, buf_vec_8b, zero_vec_8b, VLEN / 8); +} + +//////////// +// Others // +//////////// + +// Check with initial vl == 0 +void TEST_CASE5(void) { + // Initialize a golden vector + INIT_MEM_CNT(gold_vec_8b, VLEN / 8); + // Initialize a zero golden vector + INIT_MEM_ZEROES(zero_vec_8b, VLEN / 8); + // Reserve space for a buffer in memory + INIT_MEM_ZEROES(buf_vec_8b, VLEN / 8); + // Set vl and vtype to super short values + VSET(0, e64, m2); + // Initialize register + neighbours to pattern value + VCLEAR(v16); + // Load a buffer from memory - whole register load + asm volatile("vl1re8.v v16, (%0)" ::"r"(gold_vec_8b)); + // Check that the whole register was loaded + asm volatile("vs1r.v v16, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 4, buf_vec_8b, gold_vec_8b, VLEN / 8); + // Check that the neighbour registers are okay + asm volatile("vs1r.v v17, (%0)" ::"r"(buf_vec_8b)); + VMCMP(uint8_t, % hhu, 4, buf_vec_8b, zero_vec_8b, VLEN / 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsadd.c b/apps/riscv-tests/isa/rv64uv/vsadd.c new file mode 100644 index 0000000..cd224c7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsadd.c @@ -0,0 +1,99 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + uint64_t vxsat; + VSET(4, e8, m1); + VLOAD_8(v1, -80, 2, 100, 4); + VLOAD_8(v2, -90, 2, 50, 4); + __asm__ volatile("vsadd.vv v3, v1, v2" ::); + VCMP_U8(1, v3, 0x80, 4, 127, 8); + read_vxsat(vxsat); + check_vxsat(1, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE2(void) { + uint64_t vxsat; + VSET(4, e8, m1); + VLOAD_8(v1, -80, 2, 100, 4); + VLOAD_8(v2, -90, 2, 50, 4); + VLOAD_8(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsadd.vv v3, v1, v2, v0.t" ::); + VCMP_U8(2, v3, 0, 4, 0, 8); + read_vxsat(vxsat); + check_vxsat(2, vxsat, 0); + reset_vxsat; +} + +void TEST_CASE3(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 0x7FFFFFFB, 3, 4); + __asm__ volatile("vsadd.vi v3, v1, 5" ::); + VCMP_U32(3, v3, 6, 0x7FFFFFFF, 8, 9); + read_vxsat(vxsat); + check_vxsat(3, vxsat, 1); + reset_vxsat; +} + +// Dont use VCLEAR here, it results in a glitch where are values are off by 1 +void TEST_CASE4(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 2, 0xFFFFFFFD, 0x7FFFFFFC); + VLOAD_32(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsadd.vi v3, v1, 5, v0.t" ::); + VCMP_U32(4, v3, 0, 7, 0, 0x7FFFFFFF); + read_vxsat(vxsat); + check_vxsat(4, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE5(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 0x7FFFFFFD, 2, 3, 4); + const uint32_t scalar = 5; + __asm__ volatile("vsadd.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(5, v3, 0x7FFFFFFF, 7, 8, 9); + read_vxsat(vxsat); + check_vxsat(5, vxsat, 1); + reset_vxsat; +} + +// Dont use VCLEAR here, it results in a glitch where are values are off by 1 +void TEST_CASE6(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 0x7ffffffC, 3, 4); + const uint32_t scalar = 5; + VLOAD_32(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsadd.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(6, v3, 0, 0x7FFFFFFF, 0, 9); + read_vxsat(vxsat); + check_vxsat(6, vxsat, 1); + reset_vxsat; +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsaddu.c b/apps/riscv-tests/isa/rv64uv/vsaddu.c new file mode 100644 index 0000000..bdfa154 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsaddu.c @@ -0,0 +1,113 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + uint64_t vxsat; + VSET(4, e8, m1); + VLOAD_8(v1, 133, 2, 220, 4); + VLOAD_8(v2, 133, 2, 50, 4); + __asm__ volatile("vsaddu.vv v3, v1, v2" ::); + VCMP_U8(1, v3, 255, 4, 255, 8); + read_vxsat(vxsat); + check_vxsat(1, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE2(void) { + uint64_t vxsat; + VSET(4, e8, m1); + VLOAD_8(v1, 1, 2, 3, 154); + VLOAD_8(v2, 1, 2, 3, 124); + VLOAD_8(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsaddu.vv v3, v1, v2, v0.t" ::); + VCMP_U8(2, v3, 0, 4, 0, 255); + read_vxsat(vxsat); + check_vxsat(2, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE3(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 0xFFFFFFFB, 3, 4); + __asm__ volatile("vsaddu.vi v3, v1, 5" ::); + VCMP_U32(3, v3, 6, 0xFFFFFFFF, 8, 9); + read_vxsat(vxsat); + check_vxsat(3, vxsat, 1); + reset_vxsat; +} + +// Dont use VCLEAR here, it results in a glitch where are values are off by 1 +void TEST_CASE4(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 2, 0xFFFFFFFD, 0xFFFFFFFC); + VLOAD_32(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsaddu.vi v3, v1, 5, v0.t" ::); + VCMP_U32(4, v3, 0, 7, 0, 0xFFFFFFFF); + read_vxsat(vxsat); + check_vxsat(4, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE5(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 0xFFFFFFFD, 2, 3, 4); + const uint32_t scalar = 5; + __asm__ volatile("vsaddu.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(5, v3, 0xFFFFFFFF, 7, 8, 9); + read_vxsat(vxsat); + check_vxsat(5, vxsat, 1); + reset_vxsat; +} + +// Dont use VCLEAR here, it results in a glitch where are values are off by 1 +void TEST_CASE6(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 0xfffffffC, 3, 4); + const uint32_t scalar = 5; + VLOAD_32(v0, 0xA, 0x0, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsaddu.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(6, v3, 0, 0xFFFFFFFF, 0, 9); + read_vxsat(vxsat); + check_vxsat(6, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE7(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 1, 0x0000FFFF, 3, 4); + VLOAD_32(v2, 0xA, 0xFFFF0000, 0x0, 0x0); + VCLEAR(v3); + __asm__ volatile("vsaddu.vv v3, v1, v2" ::); + VCMP_U32(7, v3, 0xB, 0xFFFFFFFF, 3, 4); + read_vxsat(vxsat); + check_vxsat(7, vxsat, 0); + reset_vxsat; +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsbc.c b/apps/riscv-tests/isa/rv64uv/vsbc.c new file mode 100644 index 0000000..763c32c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsbc.c @@ -0,0 +1,76 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vvm v3, v1, v2, v0"); + VCMP_U8(1, v3, -7, -6, -3, -2, 1, 2, 5, 6, 0, -1, 0, -1, 0, -1, 0, -1); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vvm v3, v1, v2, v0"); + VCMP_U16(2, v3, -7, -6, -3, -2, 1, 2, 5, 6, 0, -1, 0, -1, 0, -1, 0, -1); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vvm v3, v1, v2, v0"); + VCMP_U32(3, v3, -7, -6, -3, -2, 1, 2, 5, 6, 0, -1, 0, -1, 0, -1, 0, -1); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vvm v3, v1, v2, v0"); + VCMP_U64(4, v3, -7, -6, -3, -2, 1, 2, 5, 6, 0, -1, 0, -1, 0, -1, 0, -1); +}; + +void TEST_CASE2(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U8(5, v3, -4, -4, -2, -2, 0, 0, 2, 2, -4, -4, -2, -2, 0, 0, 2, 2); + + VSET(16, e16, m1); + VLOAD_16(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U16(6, v3, -4, -4, -2, -2, 0, 0, 2, 2, -4, -4, -2, -2, 0, 0, 2, 2); + + VSET(16, e32, m1); + VLOAD_32(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U32(7, v3, -4, -4, -2, -2, 0, 0, 2, 2, -4, -4, -2, -2, 0, 0, 2, 2); + + VSET(16, e64, m1); + VLOAD_64(v1, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsbc.vxm v3, v1, %[A], v0" ::[A] "r"(scalar)); + VCMP_U64(8, v3, -4, -4, -2, -2, 0, 0, 2, 2, -4, -4, -2, -2, 0, 0, 2, 2); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vse1.c b/apps/riscv-tests/isa/rv64uv/vse1.c new file mode 100644 index 0000000..517caf5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vse1.c @@ -0,0 +1,57 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti +// +// For simplicity, this test depends on vle1 + +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +static volatile uint8_t ALIGNED_I8_GOLD[16] + __attribute__((aligned(AXI_DWIDTH))) = {0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, + 0x89, 0x88, 0x88, 0xae, 0x08, 0x91, + 0x02, 0x59, 0x11, 0x89}; + +static volatile uint8_t ALIGNED_I8_BUF[16] + __attribute__((aligned(AXI_DWIDTH))) = {0x00, 0x00, 0x00, 0x0, 0x00, 0x00, + 0x00, 0x0, 0x00, 0x00, 0x00, 0x0, + 0x00, 0x00, 0x00, 0x0}; + +void TEST_CASE1(void) { + VSET(32, e8, m1); + asm volatile("vle1.v v0, (%0)" ::"r"(ALIGNED_I8_GOLD)); + asm volatile("vse1.v v0, (%0)" ::"r"(ALIGNED_I8_BUF)); + VMCMP(uint8_t, % hhu, 1, ALIGNED_I8_BUF, ALIGNED_I8_GOLD, 4); + + VSET(29, e8, m1); + asm volatile("vle1.v v0, (%0)" ::"r"(ALIGNED_I8_GOLD)); + asm volatile("vse1.v v0, (%0)" ::"r"(ALIGNED_I8_BUF)); + VMCMP(uint8_t, % hhu, 2, ALIGNED_I8_BUF, ALIGNED_I8_GOLD, 4); + + VSET(29, e64, m1); + asm volatile("vle1.v v0, (%0)" ::"r"(ALIGNED_I8_GOLD)); + asm volatile("vse1.v v0, (%0)" ::"r"(ALIGNED_I8_BUF)); + VMCMP(uint8_t, % hhu, 3, ALIGNED_I8_BUF, ALIGNED_I8_GOLD, 4); + + VSET(29, e64, m8); + asm volatile("vle1.v v0, (%0)" ::"r"(ALIGNED_I8_GOLD)); + asm volatile("vse1.v v0, (%0)" ::"r"(ALIGNED_I8_BUF)); + VMCMP(uint8_t, % hhu, 4, ALIGNED_I8_BUF, ALIGNED_I8_GOLD, 4); + + VSET(29, e64, m8); + asm volatile("vle1.v v1, (%0)" ::"r"(ALIGNED_I8_GOLD)); + asm volatile("vse1.v v1, (%0)" ::"r"(ALIGNED_I8_BUF)); + VMCMP(uint8_t, % hhu, 5, ALIGNED_I8_BUF, ALIGNED_I8_GOLD, 4); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vse16.c b/apps/riscv-tests/isa/rv64uv/vse16.c new file mode 100644 index 0000000..23a998e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vse16.c @@ -0,0 +1,360 @@ +// TODO uncomment TEST_CASE13 and TEST_CASE 15 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved +#include "long_array.h" +#include "vector_macros.h" + +#define AXI_DWIDTH 128 +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +void reset_vec16(volatile uint16_t *vec) { + for (uint64_t i = 0; i < 1024; ++i) + vec[i] = 0; +} + +static volatile uint16_t ALIGNED_I16[1024] __attribute__((aligned(AXI_DWIDTH))); + +//**********Checking functionality of vse16 ********// +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_16(v0, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + asm volatile("vse16.v v0, (%0)" ::"r"(ALIGNED_I16)); + VVCMP_U16(1, ALIGNED_I16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, + 0x1111, 0x1989); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + reset_vec16(ALIGNED_I16); + VSET(16, e16, m2); + VLOAD_16(v1, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VSET(16, e16, m2); + asm volatile("vse16.v v1, (%0)" ::"r"(ALIGNED_I16)); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vse16 with different values of masking +// register******// +void TEST_CASE3(void) { + reset_vec16(ALIGNED_I16); + VSET(16, e16, m1); + VLOAD_16(v3, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vse16.v v3, (%0), v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v3); + VVCMP_U16(3, ALIGNED_I16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, + 0x1111, 0x1989); +} + +void TEST_CASE4(void) { + VSET(16, e16, m1); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v3, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v3); + VLOAD_16(v3, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vse16.v v3, (%0), v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v3); + VVCMP_U16(4, ALIGNED_I16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE5(void) { + VSET(16, e16, m1); + VLOAD_16(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v3, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v3); + VLOAD_16(v3, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vse16.v v3, (%0), v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v3); + VVCMP_U16(5, ALIGNED_I16, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, + 0x11ae, 11, 0x4891, 13, 0x8759, 15, 0x1989); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v4, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_16(v4, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + __asm__ volatile("vsetivli %[A], 12, e16, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vse16.v v4, (%0),v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VVCMP_U16(6, ALIGNED_I16, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, + 0x11ae, 11, 0x4891, 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + reset_vec16(ALIGNED_I16); + uint64_t avl; + VSET(16, e16, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v4, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_16(v4, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + __asm__ volatile("vsetivli %[A], 12, e16, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vse16.v v4, (%0), v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VVCMP_U16(7, ALIGNED_I16, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, + 0x11ae, 11, 0x4891, 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + reset_vec16(ALIGNED_I16); + uint64_t avl; + VSET(16, e8, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v4, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_16(v4, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + __asm__ volatile("vsetivli %[A], 12, e16, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse16.v v4, (%0), v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VVCMP_U16(8, ALIGNED_I16, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, + 0x11ae, 11, 0x4891, 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v4, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_16(v4, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + __asm__ volatile("vsetivli %[A], 12, e16, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vse16.v v4, (%0), v0.t" ::"r"(ALIGNED_I16)); + VCLEAR(v4); + VVCMP_U16(9, ALIGNED_I16, 1, 0xbbd3, 3, 0x8cd1, 5, 0x7548, 7, 0x9388, 9, + 0x11ae, 11, 0x4891, 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case cover corner case for EEW = 16.If LMUL is changed to +// mf8 it will give error because emul become less than 1/8 (EMUL = 1/16) +// But it does not support this configuration because SEW/LMUL > ELEN +void TEST_CASE10(void) { + VSET(16, e16, m1); + VLOAD_16(v5, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VSET(16, e32, mf2); + asm volatile("vse16.v v5, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v5); + VVCMP_U16(10, ALIGNED_I16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, + 0x1111, 0x1989); +} + +// This test case execute upper bound case of EMUL (8) +// If LMUL is changed to m8 it will give error because emul become greater than +// 8 (EMUL = 16) +void TEST_CASE11(void) { + reset_vec16(ALIGNED_I16); + VSET(16, e16, m1); + VLOAD_16(v8, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VSET(16, e8, m4); + asm volatile("vse16.v v8, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v8); + VVCMP_U16(11, ALIGNED_I16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, + 0x1111, 0x1989); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE12(void) { + reset_vec16(ALIGNED_I16); + VSET(16, e16, m1); + VLOAD_16(v6, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + asm volatile("vse16.v v6, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v6); + VVCMP_U16(12, ALIGNED_I16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, + 0x1111, 0x1989); +} + +void TEST_CASE13(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v6, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v6); + VLOAD_16(v6, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + __asm__ volatile("vsetivli %[A], 0, e8, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse16.v v6, (%0)" ::"r"(ALIGNED_I16)); + VSET(16, e16, m1); + VVCMP_U16(13, ALIGNED_I16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE14(void) { + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v6, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v6); + VLOAD_16(v6, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VSET(13, e8, m1); + asm volatile("vse16.v v6, (%0)" ::"r"(ALIGNED_I16)); + VVCMP_U16(14, ALIGNED_I16, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, + 0x3489, 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE15(void) { + VSET(16, e16, m1); + VLOAD_16(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse16.v v7, (%0)" ::"r"(ALIGNED_I16)); + VCLEAR(v7); + VLOAD_16(v7, 0x05e0, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, 0x9388, + 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 0x8759, 0x1111, 0x1989); + VSET(13, e16, m1); + write_csr(vstart, 2); + asm volatile("vse16.v v7, (%0)" ::"r"(ALIGNED_I16)); + VVCMP_U16(15, ALIGNED_I16, 1, 2, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x3489, + 0x9388, 0x8188, 0x11ae, 0x5808, 0x4891, 0x4902, 14, 15, 16); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// +void TEST_CASE16(void) { + reset_vec16(ALIGNED_I16); + VSET(1024, e16, m4); + asm volatile("vle16.v v8, (%0)" ::"r"(&LONG_I16[0])); + asm volatile("vse16.v v8, (%0)" ::"r"(ALIGNED_I16)); + LVVCMP_U16(16, ALIGNED_I16, LONG_I16); +} + +void TEST_CASE17(void) { + reset_vec16(ALIGNED_I16); + VSET(512, e16, m2); + asm volatile("vle16.v v10, (%0)" ::"r"(&LONG_I16[0])); + asm volatile("vse16.v v10, (%0)" ::"r"(ALIGNED_I16)); + LVVCMP_U16(17, ALIGNED_I16, LONG_I16); +} + +void TEST_CASE18(void) { + reset_vec16(ALIGNED_I16); + VSET(300, e16, m2); + asm volatile("vle16.v v10, (%0)" ::"r"(&LONG_I16[0])); + asm volatile("vse16.v v10, (%0)" ::"r"(ALIGNED_I16)); + LVVCMP_U16(18, ALIGNED_I16, LONG_I16); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vse16.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + // TEST_CASE13(); + TEST_CASE14(); + // TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vse32.c b/apps/riscv-tests/isa/rv64uv/vse32.c new file mode 100644 index 0000000..ac7c0ad --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vse32.c @@ -0,0 +1,412 @@ +// TODO uncomment TEST_CASE13 and TEST_CASE 15 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved +#include "long_array.h" +#include "vector_macros.h" +#define AXI_DWIDTH 128 +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +void reset_vec32(volatile uint32_t *vec) { + for (uint64_t i = 0; i < 1024; ++i) + vec[i] = 0; +} + +static volatile uint32_t ALIGNED_I32[1024] __attribute__((aligned(AXI_DWIDTH))); + +//**********Checking functionality of vse32********// +void TEST_CASE1(void) { + VSET(16, e32, m1); + VLOAD_32(v0, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + asm volatile("vse32.v v0, (%0)" ::"r"(ALIGNED_I32)); + VVCMP_U32(1, ALIGNED_I32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, + 0x83195999, 0x89139848); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + reset_vec32(ALIGNED_I32); + VSET(16, e32, m1); + VLOAD_32(v1, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VSET(16, e64, m4); + asm volatile("vse32.v v1, (%0)" ::"r"(ALIGNED_I32)); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vse16 with different values of masking +// register******// +void TEST_CASE3(void) { + reset_vec32(ALIGNED_I32); + VSET(16, e32, m1); + VLOAD_32(v3, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vse32.v v3, (%0), v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v3); + VVCMP_U32(3, ALIGNED_I32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, + 0x83195999, 0x89139848); +} + +void TEST_CASE4(void) { + VSET(16, e32, m1); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v3, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v3); + VLOAD_32(v3, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vse32.v v3, (%0), v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v3); + VVCMP_U32(4, ALIGNED_I32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE5(void) { + VSET(16, e32, m1); + VLOAD_32(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v3, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v3); + VLOAD_32(v3, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vse32.v v3, (%0), v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v3); + VVCMP_U32(5, ALIGNED_I32, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, + 0x81937598, 9, 0x3eeeeeee, 11, 0xab8b9148, 13, 0x31897598, 15, + 0x89139848); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + reset_vec32(ALIGNED_I32); + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v4, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_32(v4, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + __asm__ volatile("vsetivli %[A], 12, e32, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vse32.v v4, (%0),v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VVCMP_U32(6, ALIGNED_I32, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, + 0x81937598, 9, 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + reset_vec32(ALIGNED_I32); + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v4, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_32(v4, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + __asm__ volatile("vsetivli %[A], 12, e32, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vse32.v v4, (%0), v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VVCMP_U32(7, ALIGNED_I32, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, + 0x81937598, 9, 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + reset_vec32(ALIGNED_I32); + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v4, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_32(v4, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + __asm__ volatile("vsetivli %[A], 12, e32, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse32.v v4, (%0), v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VVCMP_U32(8, ALIGNED_I32, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, + 0x81937598, 9, 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + reset_vec32(ALIGNED_I32); + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v4, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_32(v4, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + __asm__ volatile("vsetivli %[A], 12, e16, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vse32.v v4, (%0), v0.t" ::"r"(ALIGNED_I32)); + VCLEAR(v4); + VVCMP_U32(9, ALIGNED_I32, 1, 0xf9aa71f0, 3, 0x99991348, 5, 0x38197598, 7, + 0x81937598, 9, 0x3eeeeeee, 11, 0xab8b9148, 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case cover corner case for EEW = 32.If LMUL is changed to +// mf8 and SEW is changed to e64 it will give error because emul become less +// than 1/8 (EMUL = 1/16) But it does not support this configuration because +// SEW/LMUL > ELEN +void TEST_CASE10(void) { + reset_vec32(ALIGNED_I32); + VSET(16, e32, m1); + VLOAD_32(v5, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VSET(16, e32, mf2); + asm volatile("vse32.v v5, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v5); + VVCMP_U32(10, ALIGNED_I32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, + 0x83195999, 0x89139848); +} + +// This test case execute upper bound case of EMUL (8) +// If LMUL is changed to m8 it will give error because emul become greater than +// 8 (EMUL = 16) +void TEST_CASE11(void) { + reset_vec32(ALIGNED_I32); + VSET(16, e32, m1); + VLOAD_32(v8, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VSET(16, e8, m2); + asm volatile("vse32.v v8, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v8); + VVCMP_U32(11, ALIGNED_I32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, + 0x83195999, 0x89139848); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE12(void) { + reset_vec32(ALIGNED_I32); + VSET(16, e32, m1); + VLOAD_32(v6, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + asm volatile("vse32.v v6, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v6); + VVCMP_U32(12, ALIGNED_I32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, + 0x83195999, 0x89139848); +} + +void TEST_CASE13(void) { + uint64_t avl; + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v6, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v6); + VLOAD_32(v6, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + __asm__ volatile("vsetivli %[A], 0, e32, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse32.v v6, (%0)" ::"r"(ALIGNED_I32)); + VSET(16, e32, m1); + VVCMP_U32(13, ALIGNED_I32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE14(void) { + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v6, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v6); + VLOAD_32(v6, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VSET(13, e32, m1); + asm volatile("vse32.v v6, (%0)" ::"r"(ALIGNED_I32)); + VSET(16, e32, m1); + VVCMP_U32(14, ALIGNED_I32, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, + 0x9fa831c7, 0x38197598, 0x18931795, 0x81937598, 0x18747547, + 0x3eeeeeee, 0x90139301, 0xab8b9148, 0x90318509, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE15(void) { + reset_vec32(ALIGNED_I32); + VSET(16, e32, m1); + VLOAD_32(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse32.v v7, (%0)" ::"r"(ALIGNED_I32)); + VCLEAR(v7); + VLOAD_32(v7, 0x9fe41920, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 0x31897598, 0x83195999, + 0x89139848); + VSET(13, e32, m1); + write_csr(vstart, 2); + asm volatile("vse32.v v7, (%0)" ::"r"(ALIGNED_I32)); + VVCMP_U32(15, ALIGNED_I32, 1, 2, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, 0x18931795, 0x81937598, 0x18747547, 0x3eeeeeee, + 0x90139301, 0xab8b9148, 0x90318509, 14, 15, 16); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// +void TEST_CASE16(void) { + reset_vec32(ALIGNED_I32); + VSET(1024, e32, m8); + asm volatile("vle32.v v8, (%0)" ::"r"(&LONG_I32[0])); + asm volatile("vse32.v v8, (%0)" ::"r"(ALIGNED_I32)); + LVVCMP_U32(16, ALIGNED_I32, LONG_I32); +} + +void TEST_CASE17(void) { + reset_vec32(ALIGNED_I32); + VSET(512, e32, m4); + asm volatile("vle32.v v12, (%0)" ::"r"(&LONG_I32[0])); + asm volatile("vse32.v v12, (%0)" ::"r"(ALIGNED_I32)); + LVVCMP_U32(17, ALIGNED_I32, LONG_I32); +} + +void TEST_CASE18(void) { + reset_vec32(ALIGNED_I32); + VSET(256, e32, m2); + asm volatile("vle32.v v10, (%0)" ::"r"(&LONG_I32[0])); + asm volatile("vse32.v v10, (%0)" ::"r"(ALIGNED_I32)); + LVVCMP_U32(18, ALIGNED_I32, LONG_I32); +} + +void TEST_CASE19(void) { + reset_vec32(ALIGNED_I32); + VSET(200, e32, m2); + asm volatile("vle32.v v8, (%0)" ::"r"(&LONG_I32[0])); + asm volatile("vse32.v v8, (%0)" ::"r"(ALIGNED_I32)); + LVVCMP_U32(19, ALIGNED_I32, LONG_I32); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vse32.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + // TEST_CASE13(); + TEST_CASE14(); + // TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + TEST_CASE19(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vse64.c b/apps/riscv-tests/isa/rv64uv/vse64.c new file mode 100644 index 0000000..f4a5b09 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vse64.c @@ -0,0 +1,436 @@ +// TODO uncomment TEST_CASE12 and TEST_CASE 14 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved +#include "long_array.h" +#include "vector_macros.h" + +#define AXI_DWIDTH 128 +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +void reset_vec64(volatile uint64_t *vec) { + for (uint64_t i = 0; i < 1024; ++i) + vec[i] = 0; +} + +static volatile uint64_t ALIGNED_I64[1024] __attribute__((aligned(AXI_DWIDTH))); + +//**********Checking functionality of vse64 with different destination +// registers********// +void TEST_CASE1(void) { + VSET(16, e64, m1); + VLOAD_64(v0, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + asm volatile("vse64.v v0, (%0)" ::"r"(ALIGNED_I64)); + VVCMP_U64(1, ALIGNED_I64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x3819759853987548, 0x1893179501093489, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0x9013930148815808, + 0xab8b914891484891, 0x9031850931584902, 0x3189759837598759, + 0x8319599991911111, 0x8913984898951989); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + reset_vec64(ALIGNED_I64); + VSET(16, e64, m1); + VLOAD_64(v1, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VSET(16, e64, m2); + asm volatile("vse64.v v1, (%0)" ::"r"(ALIGNED_I64)); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vse16 with different values of masking +// register******// +void TEST_CASE3(void) { + reset_vec64(ALIGNED_I64); + VSET(16, e64, m1); + VLOAD_64(v3, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vse64.v v3, (%0), v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v3); + VVCMP_U64(3, ALIGNED_I64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x3819759853987548, 0x1893179501093489, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0x9013930148815808, + 0xab8b914891484891, 0x9031850931584902, 0x3189759837598759, + 0x8319599991911111, 0x8913984898951989); +} + +void TEST_CASE4(void) { + VSET(16, e64, m1); + VLOAD_64(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v3, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v3); + VLOAD_64(v3, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vse64.v v3, (%0), v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v3); + VVCMP_U64(4, ALIGNED_I64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE5(void) { + VSET(16, e64, m1); + VLOAD_64(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v3, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v3); + VLOAD_64(v3, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vse64.v v3, (%0), v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v3); + VVCMP_U64(5, ALIGNED_I64, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, + 11, 0xab8b914891484891, 13, 0x3189759837598759, 15, + 0x8913984898951989); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + reset_vec64(ALIGNED_I64); + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v4, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_64(v4, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + __asm__ volatile("vsetivli %[A], 12, e64, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vse64.v v4, (%0),v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VVCMP_U64(6, ALIGNED_I64, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, + 11, 0xab8b914891484891, 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + reset_vec64(ALIGNED_I64); + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v4, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_64(v4, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + __asm__ volatile("vsetivli %[A], 12, e64, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vse64.v v4, (%0), v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VVCMP_U64(7, ALIGNED_I64, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, + 11, 0xab8b914891484891, 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + reset_vec64(ALIGNED_I64); + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v4, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_64(v4, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + __asm__ volatile("vsetivli %[A], 12, e64, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse64.v v4, (%0), v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VVCMP_U64(8, ALIGNED_I64, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, + 11, 0xab8b914891484891, 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + reset_vec64(ALIGNED_I64); + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v4, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_64(v4, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + __asm__ volatile("vsetivli %[A], 12, e16, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vse64.v v4, (%0), v0.t" ::"r"(ALIGNED_I64)); + VCLEAR(v4); + VVCMP_U64(9, ALIGNED_I64, 1, 0xf9aa71f0c394bbd3, 3, 0x99991348a9f38cd1, 5, + 0x3819759853987548, 7, 0x81937598aa819388, 9, 0x3eeeeeeee33111ae, + 11, 0xab8b914891484891, 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case cover upper bound of EMUL(8). If LMUL is changed to +// m2 it will give error because emul become greater than 8 (EMUL = 16) +void TEST_CASE10(void) { + VSET(16, e64, m1); + VLOAD_64(v8, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VSET(16, e8, m1); + asm volatile("vse64.v v8, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v8); + VVCMP_U64(10, ALIGNED_I64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x3819759853987548, 0x1893179501093489, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0x9013930148815808, + 0xab8b914891484891, 0x9031850931584902, 0x3189759837598759, + 0x8319599991911111, 0x8913984898951989); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE11(void) { + reset_vec64(ALIGNED_I64); + VSET(16, e64, m1); + VLOAD_64(v6, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + asm volatile("vse64.v v6, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v6); + VVCMP_U64(11, ALIGNED_I64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x3819759853987548, 0x1893179501093489, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0x9013930148815808, + 0xab8b914891484891, 0x9031850931584902, 0x3189759837598759, + 0x8319599991911111, 0x8913984898951989); +} + +void TEST_CASE12(void) { + uint64_t avl; + VSET(16, e64, m1); + VLOAD_64(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v6, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v6); + VLOAD_64(v6, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + __asm__ volatile("vsetivli %[A], 0, e64, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse64.v v6, (%0)" ::"r"(ALIGNED_I64)); + VSET(16, e64, m1); + VVCMP_U64(12, ALIGNED_I64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE13(void) { + VSET(16, e64, m1); + VLOAD_64(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v6, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v6); + VLOAD_64(v6, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VSET(13, e64, m1); + asm volatile("vse64.v v6, (%0)" ::"r"(ALIGNED_I64)); + VSET(16, e64, m1); + VVCMP_U64(13, ALIGNED_I64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0xa11a9384a7163840, 0x99991348a9f38cd1, 0x9fa831c7a11a9384, + 0x3819759853987548, 0x1893179501093489, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0x9013930148815808, + 0xab8b914891484891, 0x9031850931584902, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE14(void) { + reset_vec64(ALIGNED_I64); + VSET(16, e64, m1); + VLOAD_64(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse64.v v7, (%0)" ::"r"(ALIGNED_I64)); + VCLEAR(v7); + VLOAD_64(v7, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, + 0x1893179501093489, 0x81937598aa819388, 0x1874754791888188, + 0x3eeeeeeee33111ae, 0x9013930148815808, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8319599991911111, + 0x8913984898951989); + VSET(13, e64, m1); + write_csr(vstart, 2); + asm volatile("vse64.v v7, (%0)" ::"r"(ALIGNED_I64)); + VVCMP_U64(14, ALIGNED_I64, 1, 2, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x1893179501093489, + 0x81937598aa819388, 0x1874754791888188, 0x3eeeeeeee33111ae, + 0x9013930148815808, 0xab8b914891484891, 0x9031850931584902, 14, 15, + 16); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// +void TEST_CASE15(void) { + reset_vec64(ALIGNED_I64); + VSET(512, e64, m8); + asm volatile("vle64.v v8, (%0)" ::"r"(&LONG_I64[0])); + asm volatile("vse64.v v8, (%0)" ::"r"(ALIGNED_I64)); + LVVCMP_U64(15, ALIGNED_I64, LONG_I64); +} + +void TEST_CASE16(void) { + reset_vec64(ALIGNED_I64); + VSET(256, e64, m4); + asm volatile("vle64.v v8, (%0)" ::"r"(&LONG_I64[0])); + asm volatile("vse64.v v8, (%0)" ::"r"(ALIGNED_I64)); + LVVCMP_U64(16, ALIGNED_I64, LONG_I64); +} + +void TEST_CASE17(void) { + reset_vec64(ALIGNED_I64); + VSET(128, e64, m2); + asm volatile("vle64.v v8, (%0)" ::"r"(&LONG_I64[0])); + asm volatile("vse64.v v8, (%0)" ::"r"(ALIGNED_I64)); + LVVCMP_U64(17, ALIGNED_I64, LONG_I64); +} + +void TEST_CASE18(void) { + reset_vec64(ALIGNED_I64); + VSET(100, e64, m2); + asm volatile("vle64.v v8, (%0)" ::"r"(&LONG_I64[0])); + asm volatile("vse64.v v8, (%0)" ::"r"(ALIGNED_I64)); + LVVCMP_U64(18, ALIGNED_I64, LONG_I64); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vse64.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + // TEST_CASE12(); + TEST_CASE13(); + // TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vse8.c b/apps/riscv-tests/isa/rv64uv/vse8.c new file mode 100644 index 0000000..3542d2f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vse8.c @@ -0,0 +1,333 @@ +// TODO uncomment TEST_CASE12 and TEST_CASE 14 after issue of vl=0 and +// non-zero vstart is resolved +// TODO uncomment TEST_CASE2 after issue of exception is resolved +#include "long_array.h" +#include "vector_macros.h" + +#define AXI_DWIDTH 128 +void mtvec_handler(void) { + asm volatile("csrr t0, mcause"); // Read mcause + + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +// Exception Handler for spike +void handle_trap(void) { + // Read mepc + asm volatile("csrr t1, mepc"); + + // Increment return address by 4 + asm volatile("addi t1, t1, 4"); + asm volatile("csrw mepc, t1"); + + asm volatile("ld ra, 8(sp)"); + asm volatile("ld sp, 16(sp)"); + asm volatile("ld gp, 24(sp)"); + asm volatile("ld tp, 32(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t0, 40(sp)"); + asm volatile("ld t1, 48(sp)"); + asm volatile("ld t2, 56(sp)"); + asm volatile("ld s0, 64(sp)"); + asm volatile("ld s1, 72(sp)"); + asm volatile("ld a0, 80(sp)"); + asm volatile("ld a1, 88(sp)"); + asm volatile("ld a2, 96(sp)"); + asm volatile("ld a3, 104(sp)"); + asm volatile("ld a4, 112(sp)"); + asm volatile("ld a5, 120(sp)"); + asm volatile("ld a6, 128(sp)"); + asm volatile("ld a7, 136(sp)"); + asm volatile("ld s2, 144(sp)"); + asm volatile("ld s3, 152(sp)"); + asm volatile("ld s4, 160(sp)"); + asm volatile("ld s5, 168(sp)"); + asm volatile("ld s6, 176(sp)"); + asm volatile("ld s7, 184(sp)"); + asm volatile("ld s8, 192(sp)"); + asm volatile("ld s9, 200(sp)"); + asm volatile("ld s10, 208(sp)"); + asm volatile("ld s11, 216(sp)"); + asm volatile("ld t3, 224(sp)"); + asm volatile("ld t4, 232(sp)"); + asm volatile("ld t5, 240(sp)"); + asm volatile("ld t6, 248(sp)"); + + // Read mcause + asm volatile("csrr t3, mcause"); + + asm volatile("addi sp, sp, 272"); + + // Filter with mcause and handle here + + asm volatile("mret"); +} + +void reset_vec8(volatile uint8_t *vec) { + for (uint64_t i = 0; i < 1024; ++i) + vec[i] = 0; +} + +static volatile uint8_t ALIGNED_I8[1024] __attribute__((aligned(AXI_DWIDTH))); + +//**********Checking functionality of vse8 ********// +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + asm volatile("vse8.v v0, (%0)" ::"r"(ALIGNED_I8)); + VVCMP_U8(1, ALIGNED_I8, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, + 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//******Checking functionality of with illegal destination register +// specifier for EMUL********// +// In this test case EMUL=2 and register is v1 which will cause illegal +// instruction exception and set mcause = 2 +void TEST_CASE2(void) { + uint8_t mcause; + reset_vec8(ALIGNED_I8); + VSET(16, e8, m1); + VLOAD_8(v1, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VSET(16, e16, m4); + asm volatile("vse8.v v1, (%0)" ::"r"(ALIGNED_I8)); + asm volatile("addi %[A], t3, 0" : [A] "=r"(mcause)); + XCMP(2, mcause, 2); +} + +//*******Checking functionality of vse8 with different values of masking +// register******// +void TEST_CASE3(void) { + reset_vec8(ALIGNED_I8); + VSET(16, e8, m1); + VLOAD_8(v3, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VLOAD_8(v0, 0xFF, 0xFF); + asm volatile("vse8.v v3, (%0), v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v3); + VVCMP_U8(3, ALIGNED_I8, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, + 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v3, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v3); + VLOAD_8(v3, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VLOAD_8(v0, 0x00, 0x00); + asm volatile("vse8.v v3, (%0), v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v3); + VVCMP_U8(4, ALIGNED_I8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v3, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v3); + VLOAD_8(v3, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vse8.v v3, (%0), v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v3); + VVCMP_U8(5, ALIGNED_I8, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, + 13, 0x59, 15, 0x89); +} + +//******Checking functionality with different combinations of vta and vma*****// +// **** It uses undisturbed policy for tail agnostic and mask agnostic****// +void TEST_CASE6(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v4, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_8(v4, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + __asm__ volatile("vsetivli %[A], 12, e8, m1, ta, ma" : [A] "=r"(avl)); + asm volatile("vse8.v v4, (%0),v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VVCMP_U8(6, ALIGNED_I8, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, + 13, 14, 15, 16); +} + +void TEST_CASE7(void) { + reset_vec8(ALIGNED_I8); + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v4, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_8(v4, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + __asm__ volatile("vsetivli %[A], 12, e8, m1, ta, mu" : [A] "=r"(avl)); + asm volatile("vse8.v v4, (%0), v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VVCMP_U8(7, ALIGNED_I8, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, + 13, 14, 15, 16); +} + +void TEST_CASE8(void) { + reset_vec8(ALIGNED_I8); + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v4, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_8(v4, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + __asm__ volatile("vsetivli %[A], 12, e8, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse8.v v4, (%0), v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VVCMP_U8(8, ALIGNED_I8, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, + 13, 14, 15, 16); +} + +void TEST_CASE9(void) { + reset_vec8(ALIGNED_I8); + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v4, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_8(v4, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + __asm__ volatile("vsetivli %[A], 12, e8, m1, tu, mu" : [A] "=r"(avl)); + asm volatile("vse8.v v4, (%0), v0.t" ::"r"(ALIGNED_I8)); + VCLEAR(v4); + VVCMP_U8(9, ALIGNED_I8, 1, 0xd3, 3, 0xd1, 5, 0x48, 7, 0x88, 9, 0xae, 11, 0x91, + 13, 14, 15, 16); +} + +//*******Checking functionality if encoded EEW is not supported for given SEW +// and LMUL values because EMUL become out of range*****// +// This test case execute lower bound case of EMUL (1/8). If LMUL is changed to +// mf4 or mf8 it will give error because emul become out of range +void TEST_CASE10(void) { + reset_vec8(ALIGNED_I8); + VSET(16, e8, m1); + VLOAD_8(v5, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VSET(16, e32, mf2); + asm volatile("vse8.v v5, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v5); + VVCMP_U8(10, ALIGNED_I8, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, + 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +//******Checking functionality with different values of vl******// +void TEST_CASE11(void) { + reset_vec8(ALIGNED_I8); + VSET(16, e8, m1); + VLOAD_8(v6, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + asm volatile("vse8.v v6, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v6); + VVCMP_U8(11, ALIGNED_I8, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, + 0xae, 0x08, 0x91, 0x02, 0x59, 0x11, 0x89); +} + +void TEST_CASE12(void) { + uint64_t avl; + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v6, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v6); + VLOAD_8(v6, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + __asm__ volatile("vsetivli %[A], 0, e8, m1, tu, ma" : [A] "=r"(avl)); + asm volatile("vse8.v v6, (%0)" ::"r"(ALIGNED_I8)); + VSET(16, e8, m1); + VVCMP_U8(12, ALIGNED_I8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16); +} + +void TEST_CASE13(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v6, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v6); + VLOAD_8(v6, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VSET(13, e8, m1); + asm volatile("vse8.v v6, (%0)" ::"r"(ALIGNED_I8)); + VVCMP_U8(13, ALIGNED_I8, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, + 0xae, 0x08, 0x91, 0x02, 14, 15, 16); +} + +//******Checking functionality with different vstart value*****// +void TEST_CASE14(void) { + reset_vec8(ALIGNED_I8); + VSET(16, e8, m1); + VLOAD_8(v7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + asm volatile("vse8.v v7, (%0)" ::"r"(ALIGNED_I8)); + VCLEAR(v7); + VLOAD_8(v7, 0xe0, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, 0x08, + 0x91, 0x02, 0x59, 0x11, 0x89); + VSET(13, e8, m1); + write_csr(vstart, 2); + asm volatile("vse8.v v7, (%0)" ::"r"(ALIGNED_I8)); + write_csr(vstart, 0); + VVCMP_U8(14, ALIGNED_I8, 1, 2, 0x40, 0xd1, 0x84, 0x48, 0x89, 0x88, 0x88, 0xae, + 0x08, 0x91, 0x02, 14, 15, 16); +} + +//****Checking functionality with different values of EMUL and +// large number of elements *******// + +void TEST_CASE15(void) { + reset_vec8(ALIGNED_I8); + VSET(1024, e8, m2); + asm volatile("vle8.v v8, (%0)" ::"r"(&LONG_I8[0])); + asm volatile("vse8.v v8, (%0)" ::"r"(ALIGNED_I8)); + LVVCMP_U8(15, ALIGNED_I8, LONG_I8); +} + +void TEST_CASE16(void) { + reset_vec8(ALIGNED_I8); + VSET(800, e8, m2); + asm volatile("vle8.v v8, (%0)" ::"r"(&LONG_I8[0])); + asm volatile("vse8.v v8, (%0)" ::"r"(ALIGNED_I8)); + LVVCMP_U8(16, ALIGNED_I8, LONG_I8); +} +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("*****Running tests for vse8.v*****\n"); + TEST_CASE1(); + // TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + // TEST_CASE12(); + TEST_CASE13(); + // TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsetivli.c b/apps/riscv-tests/isa/rv64uv/vsetivli.c new file mode 100644 index 0000000..4fb9d45 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsetivli.c @@ -0,0 +1,466 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +//***********LMUL = 1**********// +void TEST_CASE1(void) { + uint64_t avl, vtype, + vl; // Declaring avl,vtype and vl variables to pass for comparison + uint64_t vlmul = 0; // Setting value of vlmul + uint64_t vsew = 0; // Setting value of vsew + uint64_t vta = 1; // Setting value of vta + uint64_t vma = 1; // Setting value of vma + uint64_t golden_vtype; // Declaring variable to use as a reference value + vtype(golden_vtype, vlmul, vsew, vta, + vma); // Setting up reference variable golden_vtype by assigning + // different fields of configurations + __asm__ volatile("vsetivli %[A], 30, e8, m1, ta, ma" + : [A] "=r"(avl)); // Executing vsetivli instruction + read_vtype(vtype); // Reading vtype CSR + read_vl(vl); // Reading vl CSR + check_vtype_vl( + 1, vtype, golden_vtype, avl, vl, vsew, + vlmul); // Passsing actual values and reference values for comparison +} + +void TEST_CASE2(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 20, e16, m1,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(2, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE3(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],10, e32, m1,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(3, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE4(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],16, e64, m1,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(4, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 2**********// +void TEST_CASE5(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],30, e8, m2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(5, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE6(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],20, e16, m2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(6, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE7(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],10, e32, m2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(7, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE8(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],16, e64, m2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(8, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +/////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 4**********// + +void TEST_CASE9(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],30, e8, m4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(9, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE10(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],20, e16, m4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(10, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE11(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],10, e32, m4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(11, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE12(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],10, e64, m4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(12, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 8**********// + +void TEST_CASE13(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 30, e8, m8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(13, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE14(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 20, e16, m8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(14, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE15(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],10, e32, m8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(15, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE16(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 10, e64, m8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(16, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/8**********// + +void TEST_CASE17(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 10, e8, mf8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(17, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE18(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 10, e16,mf8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(18, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE19(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 5, e32, mf8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(19, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE20(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],7, e64, mf8,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(20, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +/////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/4**********// + +void TEST_CASE21(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 10, e8, mf4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(21, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE22(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 10, e16, mf4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(22, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE23(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],5, e32, mf4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(23, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE24(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],15, e64, mf4,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(24, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/2**********// + +void TEST_CASE25(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A],20, e8, mf2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(25, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE26(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 20, e16, mf2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(26, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE27(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 20, e32, mf2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(27, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE28(void) { + uint64_t avl, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetivli %[A], 30, e64, mf2,ta,ma" : [A] "=r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(28, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("************* Running Test for vsetivli *************\n"); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + TEST_CASE13(); + TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + TEST_CASE19(); + TEST_CASE20(); + TEST_CASE21(); + TEST_CASE22(); + TEST_CASE23(); + TEST_CASE24(); + TEST_CASE25(); + TEST_CASE26(); + TEST_CASE27(); + TEST_CASE28(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsetvl.c b/apps/riscv-tests/isa/rv64uv/vsetvl.c new file mode 100644 index 0000000..6486aad --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsetvl.c @@ -0,0 +1,497 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include + +#include "vector_macros.h" + +//***********LMUL = 1**********// +void TEST_CASE1(void) { + uint64_t avl = 250, vtype, vl; // Setting avl and declaring vtype and vl + // variables to pass for comparison + uint64_t vlmul = 0; // Setting value of vlmul + uint64_t vsew = 0; // Setting value of vsew + uint64_t vta = 1; // Setting value of vta + uint64_t vma = 1; // Setting value of vma + uint64_t golden_vtype; // Declaring variable to use as a reference value + vtype(golden_vtype, vlmul, vsew, vta, + vma); // Setting up reference variable golden_vtype by assigning + // different fields of configurations + __asm__ volatile("vsetvl t0, %[A], %[B]" ::[A] "r"(avl), + [B] "r"(golden_vtype)); // Executing vsetvl instruction + read_vtype(vtype); // Reading vtype CSR + read_vl(vl); // Reading vl CSR + check_vtype_vl( + 1, vtype, golden_vtype, avl, vl, vsew, + vlmul); // Passsing actual values and reference values for comparison +} + +void TEST_CASE2(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(2, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE3(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(3, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE4(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(4, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 2**********// +void TEST_CASE5(void) { + uint64_t avl = 350, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(5, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE6(void) { + uint64_t avl = 250, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(6, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE7(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(7, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE8(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(8, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +/////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 4**********// + +void TEST_CASE9(void) { + uint64_t avl = 350, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(9, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE10(void) { + uint64_t avl = 250, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(10, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE11(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(11, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE12(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(12, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 8**********// + +void TEST_CASE13(void) { + uint64_t avl = 350, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(13, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE14(void) { + uint64_t avl = 250, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(14, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE15(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(15, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE16(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(16, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/8**********// + +void TEST_CASE17(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(17, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE18(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(18, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE19(void) { + uint64_t avl = 15, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(19, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE20(void) { + uint64_t avl = 7, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(20, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +/////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/4**********// + +void TEST_CASE21(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(21, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE22(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(22, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE23(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(23, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE24(void) { + uint64_t avl = 15, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(24, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/2**********// + +void TEST_CASE25(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(25, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE26(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(26, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE27(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(27, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +void TEST_CASE28(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile( + "vsetvl t0, %[A], %[B]" ::[A] "r"(avl), [B] "r"(golden_vtype)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(28, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("************* Running Test for vsetvl *************\n"); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + TEST_CASE13(); + TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + TEST_CASE19(); + TEST_CASE20(); + TEST_CASE21(); + TEST_CASE22(); + TEST_CASE23(); + TEST_CASE24(); + TEST_CASE25(); + TEST_CASE26(); + TEST_CASE27(); + TEST_CASE28(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsetvli.c b/apps/riscv-tests/isa/rv64uv/vsetvli.c new file mode 100644 index 0000000..f8eb762 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsetvli.c @@ -0,0 +1,498 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include + +#include "vector_macros.h" + +//***********LMUL = 1**********// + +//****** SEW = 8 +void TEST_CASE1(void) { + uint64_t avl = 250, vtype, vl; // Setting avl and declaring vtype and vl + // variables to pass for comparison + uint64_t vlmul = 0; // Setting value of vlmul + uint64_t vsew = 0; // Setting value of vsew + uint64_t vta = 1; // Setting value of vta + uint64_t vma = 1; // Setting value of vma + uint64_t golden_vtype; // Declaring variable to use as a reference value + vtype(golden_vtype, vlmul, vsew, vta, + vma); // Setting up reference variable golden_vtype by assigning + // different fields of configurations + __asm__ volatile("vsetvli t0, %[A], e8, m1,ta,ma" ::[A] "r"( + avl)); // Executing vsetvli instruction + read_vtype(vtype); // Reading vtype CSR + read_vl(vl); // Reading vl CSR + check_vtype_vl( + 1, vtype, golden_vtype, avl, vl, vsew, + vlmul); // Passsing actual values and reference values for comparison +} + +//****** SEW = 16 +void TEST_CASE2(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16, m1,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(2, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE3(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, m1,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(3, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE4(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 0; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, m1,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(4, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 2**********// +//****** SEW = 8 +void TEST_CASE5(void) { + uint64_t avl = 350, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e8, m2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(5, vtype, golden_vtype, avl, vl, vsew, vlmul); +} +//****** SEW = 16 +void TEST_CASE6(void) { + uint64_t avl = 250, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16, m2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(6, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE7(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, m2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(7, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE8(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 1; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, m2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(8, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +/////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 4**********// + +//****** SEW = 8 +void TEST_CASE9(void) { + uint64_t avl = 350, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e8, m4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(9, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 16 +void TEST_CASE10(void) { + uint64_t avl = 250, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16, m4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(10, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE11(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, m4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(11, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE12(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 2; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, m4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(12, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 8**********// + +//****** SEW = 8 +void TEST_CASE13(void) { + uint64_t avl = 350, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e8, m8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(13, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 16 +void TEST_CASE14(void) { + uint64_t avl = 250, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16, m8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(14, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE15(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, m8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(15, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE16(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 3; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, m8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(16, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/8**********// + +//****** SEW = 8 +void TEST_CASE17(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e8, mf8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(17, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 16 +void TEST_CASE18(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16,mf8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(18, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE19(void) { + uint64_t avl = 15, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, mf8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(19, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE20(void) { + uint64_t avl = 7, vtype, vl; + uint64_t vlmul = 5; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, mf8,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(20, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +/////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/4**********// + +//****** SEW = 8 +void TEST_CASE21(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e8, mf4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(21, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 16 +void TEST_CASE22(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16, mf4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(22, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE23(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, mf4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(23, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE24(void) { + uint64_t avl = 15, vtype, vl; + uint64_t vlmul = 6; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, mf4,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(24, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +///////////////////////////////////////////////////////////////////////////////// + +//***********LMUL = 1/2**********// + +//****** SEW = 8 +void TEST_CASE25(void) { + uint64_t avl = 120, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 0; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e8, mf2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(25, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 16 +void TEST_CASE26(void) { + uint64_t avl = 60, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 1; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e16, mf2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(26, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 32 +void TEST_CASE27(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 2; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e32, mf2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(27, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +//****** SEW = 64 +void TEST_CASE28(void) { + uint64_t avl = 30, vtype, vl; + uint64_t vlmul = 7; + uint64_t vsew = 3; + uint64_t vta = 1; + uint64_t vma = 1; + uint64_t golden_vtype; + vtype(golden_vtype, vlmul, vsew, vta, vma); + __asm__ volatile("vsetvli t0, %[A], e64, mf2,ta,ma" ::[A] "r"(avl)); + read_vtype(vtype); + read_vl(vl); + check_vtype_vl(28, vtype, golden_vtype, avl, vl, vsew, vlmul); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + printf("************* Running Test for vsetvli *************\n"); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + TEST_CASE9(); + TEST_CASE10(); + TEST_CASE11(); + TEST_CASE12(); + TEST_CASE13(); + TEST_CASE14(); + TEST_CASE15(); + TEST_CASE16(); + TEST_CASE17(); + TEST_CASE18(); + TEST_CASE19(); + TEST_CASE20(); + TEST_CASE21(); + TEST_CASE22(); + TEST_CASE23(); + TEST_CASE24(); + TEST_CASE25(); + TEST_CASE26(); + TEST_CASE27(); + TEST_CASE28(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsext.c b/apps/riscv-tests/isa/rv64uv/vsext.c new file mode 100644 index 0000000..81d74e6 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsext.c @@ -0,0 +1,106 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vsext.vf2 v2, v1"); + VCMP_U16(1, v2, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + + VSET(16, e32, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vsext.vf2 v2, v1"); + VCMP_U32(2, v2, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + + VSET(16, e64, m1); + VLOAD_32(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vsext.vf2 v2, v1"); + VCMP_U64(3, v2, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); +} + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vsext.vf2 v2, v1, v0.t"); + VCMP_U16(4, v2, 0, 2, 0, -4, 0, 6, 0, -8, 0, -2, 0, 4, 0, -6, 0, 8); + + VSET(16, e32, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vsext.vf2 v2, v1, v0.t"); + VCMP_U32(5, v2, 0, 2, 0, -4, 0, 6, 0, -8, 0, -2, 0, 4, 0, -6, 0, 8); + + VSET(16, e64, m1); + VLOAD_32(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vsext.vf2 v2, v1, v0.t"); + VCMP_U64(6, v2, 0, 2, 0, -4, 0, 6, 0, -8, 0, -2, 0, 4, 0, -6, 0, 8); +} + +void TEST_CASE3(void) { + VSET(16, e32, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vsext.vf4 v2, v1"); + VCMP_U32(7, v2, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + + VSET(16, e64, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vsext.vf4 v2, v1"); + VCMP_U64(8, v2, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); +} + +void TEST_CASE4(void) { + VSET(16, e32, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vsext.vf4 v2, v1, v0.t"); + VCMP_U32(9, v2, 0, 2, 0, -4, 0, 6, 0, -8, 0, -2, 0, 4, 0, -6, 0, 8); + + VSET(16, e64, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vsext.vf4 v2, v1, v0.t"); + VCMP_U64(10, v2, 0, 2, 0, -4, 0, 6, 0, -8, 0, -2, 0, 4, 0, -6, 0, 8); +} + +void TEST_CASE5(void) { + VSET(16, e64, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vsext.vf8 v2, v1"); + VCMP_U64(11, v2, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); +} + +void TEST_CASE6(void) { + VSET(16, e64, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vsext.vf8 v2, v1, v0.t"); + VCMP_U64(12, v2, 0, 2, 0, -4, 0, 6, 0, -8, 0, -2, 0, 4, 0, -6, 0, 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vslide1down.c b/apps/riscv-tests/isa/rv64uv/vslide1down.c new file mode 100644 index 0000000..8d339da --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vslide1down.c @@ -0,0 +1,102 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + uint64_t scalar = 99; + + VSET(32, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1down.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(1, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 99); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1down.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(2, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 99); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1down.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(3, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 99); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1down.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(4, v1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 99); +} + +void TEST_CASE2() { + uint64_t scalar = 99; + + VSET(32, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslide1down.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(5, v1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 99); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vslide1down.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(6, v1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1, 16, -1); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslide1down.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(7, v1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 99); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vslide1down.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(8, v1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1, 16, -1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vslide1up.c b/apps/riscv-tests/isa/rv64uv/vslide1up.c new file mode 100644 index 0000000..f1a3fb8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vslide1up.c @@ -0,0 +1,78 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + uint64_t scalar = 99; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1up.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(1, v1, 99, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1up.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(2, v1, 99, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1up.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(3, v1, 99, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslide1up.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(4, v1, 99, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); +} + +void TEST_CASE2() { + uint64_t scalar = 99; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslide1up.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(5, v1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vslide1up.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(6, v1, 99, -1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslide1up.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(7, v1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0x55, 0x55); + asm volatile("vslide1up.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(8, v1, 99, -1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vslidedown.c b/apps/riscv-tests/isa/rv64uv/vslidedown.c new file mode 100644 index 0000000..e46e680 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vslidedown.c @@ -0,0 +1,181 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(32, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e8, m1); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 3"); + VCMP_U8(1, v1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 4"); + VCMP_U16(2, v1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 5"); + VCMP_U32(3, v1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 6"); + VCMP_U64(4, v1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22); +} + +void TEST_CASE2() { + VSET(32, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e8, m1); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslidedown.vi v1, v2, 3, v0.t"); + VCMP_U8(5, v1, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 17, -1, 19); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 4, v0.t"); + VCMP_U16(6, v1, -1, 6, -1, 8, -1, 10, -1, 12, -1, 14, -1, 16, -1, 18, -1, 20); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 5, v0.t"); + VCMP_U32(7, v1, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 17, -1, 19, -1, 21); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 6, v0.t"); + VCMP_U64(8, v1, -1, 8, -1, 10, -1, 12, -1, 14, -1, 16, -1, 18, -1, 20, -1, + 22); +} + +void TEST_CASE3() { + uint64_t scalar = 3; + + VSET(32, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e8, m1); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); +} + +void TEST_CASE4() { + uint64_t scalar = 3; + + VSET(32, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e8, m1); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslidedown.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 17, -1, 19); + + VSET(32, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e16, m1); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslidedown.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 17, -1, 19); + + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e32, m1); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslidedown.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 17, -1, 19); + + VSET(32, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(16, e64, m1); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslidedown.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13, -1, 15, -1, 17, -1, 19); +} + +// Corner case: NrLanes divides vl, but the stride requires the operand +// requester to request an additional 64-bit packet per lane, and not only an +// additional 32-bit element per lane. Otherwise, it gets stuck +void TEST_CASE5() { + VSET(32, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); + VSET(12, e32, m1); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslidedown.vi v1, v2, 7"); + VCMP_U32(17, v1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vslideup.c b/apps/riscv-tests/isa/rv64uv/vslideup.c new file mode 100644 index 0000000..862a1a9 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vslideup.c @@ -0,0 +1,166 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 3"); + VCMP_U8(1, v1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 4"); + VCMP_U16(2, v1, -1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 5"); + VCMP_U32(3, v1, -1, -1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 6"); + VCMP_U64(4, v1, -1, -1, -1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); +} + +void TEST_CASE2() { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslideup.vi v1, v2, 3, v0.t"); + VCMP_U8(5, v1, -1, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 4, v0.t"); + VCMP_U16(6, v1, -1, -1, -1, -1, -1, 2, -1, 4, -1, 6, -1, 8, -1, 10, -1, 12); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 5, v0.t"); + VCMP_U32(7, v1, -1, -1, -1, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 6, v0.t"); + VCMP_U64(8, v1, -1, -1, -1, -1, -1, -1, -1, 2, -1, 4, -1, 6, -1, 8, -1, 10); +} + +void TEST_CASE3() { + uint64_t scalar = 3; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v1, -1, -1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); +} + +void TEST_CASE4() { + uint64_t scalar = 3; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslideup.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, -1, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslideup.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, -1, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslideup.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, -1, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vslideup.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, -1, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, 11, -1, 13); +} + +// Stress the masked VSLIDEUP to enforce that the used mask bit indices should +// follow the output vector element indices and not the input ones +void TEST_CASE5() { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_8(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + VLOAD_8(v0, 0xAA, 0x80); + asm volatile("vslideup.vi v1, v2, 3, v0.t"); + VCMP_U8(17, v1, -1, -1, -1, 1, -1, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_16(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 4, v0.t"); + VCMP_U16(18, v1, -1, -1, -1, -1, -1, 2, -1, 4, -1, -1, -1, -1, -1, -1, -1, + 12); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_32(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 5, v0.t"); + VCMP_U32(19, v1, -1, -1, -1, -1, -1, 1, -1, 3, -1, -1, -1, -1, -1, -1, -1, + 11); + + VSET(16, e64, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + VLOAD_64(v1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1); + asm volatile("vslideup.vi v1, v2, 6, v0.t"); + VCMP_U64(20, v1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, + 10); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsll.c b/apps/riscv-tests/isa/rv64uv/vsll.c new file mode 100644 index 0000000..b8710fb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsll.c @@ -0,0 +1,316 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsll.vv v4, v2, v3"); + VCMP_U8(1, v4, 0x01, 0x02, 0x04, 0x08, 0x80, 0x80, 0x80, 0x01, 0x01, 0x02, + 0x04, 0x08, 0x80, 0x80, 0x80, 0x01); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsll.vv v4, v2, v3"); + VCMP_U16(2, v4, 0x0001, 0x0002, 0x0004, 0x0008, 0x0080, 0x8000, 0x8000, + 0x0001, 0x0001, 0x0002, 0x0004, 0x0008, 0x0080, 0x8000, 0x8000, + 0x0001); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsll.vv v4, v2, v3"); + VCMP_U32(3, v4, 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000080, + 0x00008000, 0x80000000, 0x00000001, 0x00000001, 0x00000002, + 0x00000004, 0x00000008, 0x00000080, 0x00008000, 0x80000000, + 0x00000001); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001); + VLOAD_64(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsll.vv v4, v2, v3"); + VCMP_U64(4, v4, 0x000000000000001, 0x0000000000000002, 0x0000000000000004, + 0x0000000000000008, 0x0000000000000080, 0x0000000000008000, + 0x0000000080000000, 0x0000000100000000, 0x0000000000000001, + 0x0000000000000002, 0x0000000000000004, 0x0000000000000008, + 0x0000000000000080, 0x0000000000008000, 0x0000000080000000, + 0x0000000100000000); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsll.vv v4, v2, v3, v0.t"); + VCMP_U8(5, v4, 0x00, 0x02, 0x00, 0x08, 0x00, 0x80, 0x00, 0x01, 0x00, 0x02, + 0x00, 0x08, 0x00, 0x80, 0x00, 0x01); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsll.vv v4, v2, v3, v0.t"); + VCMP_U16(6, v4, 0x0000, 0x0002, 0x0000, 0x0008, 0x0000, 0x8000, 0x0000, + 0x0001, 0x0000, 0x0002, 0x0000, 0x0008, 0x0000, 0x8000, 0x0000, + 0x0001); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsll.vv v4, v2, v3, v0.t"); + VCMP_U32(7, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000008, 0x00000000, + 0x00008000, 0x00000000, 0x00000001, 0x00000000, 0x00000002, + 0x00000000, 0x00000008, 0x00000000, 0x00008000, 0x00000000, + 0x00000001); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001, 0x0000000000000001, 0x0000000000000001, + 0x0000000000000001); + VLOAD_64(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsll.vv v4, v2, v3, v0.t"); + VCMP_U64(8, v4, 0x000000000000000, 0x0000000000000002, 0x0000000000000000, + 0x0000000000000008, 0x0000000000000000, 0x0000000000008000, + 0x0000000000000000, 0x0000000100000000, 0x0000000000000000, + 0x0000000000000002, 0x0000000000000000, 0x0000000000000008, + 0x0000000000000000, 0x0000000000008000, 0x0000000000000000, + 0x0000000100000000); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_8(v2, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, 0xFA, + 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + asm volatile("vsll.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v4, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, + 0xE8, 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, 0x00FF); + asm volatile("vsll.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v4, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, + 0x0020, 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, + 0x03FC); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0x000000FF); + asm volatile("vsll.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v4, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0x000003FC); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFFA, 0xFFFFFFFFFFFFFFFB, + 0xFFFFFFFFFFFFFFFC, 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, + 0x00000000000000FF); + asm volatile("vsll.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v4, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0x00000000000003FC); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_8(v2, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, 0xFA, + 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v4, 0x00, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x20, 0x00, 0xE4, + 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFC); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, 0x00FF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v4, 0x0000, 0x0008, 0x0000, 0x0010, 0x0000, 0x0018, 0x0000, + 0x0020, 0x0000, 0xFFE4, 0x0000, 0xFFEC, 0x0000, 0xFFF4, 0x0000, + 0x03FC); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0x000000FF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v4, 0x00000000, 0x00000008, 0x00000000, 0x00000010, 0x00000000, + 0x00000018, 0x00000000, 0x00000020, 0x00000000, 0xFFFFFFE4, + 0x00000000, 0xFFFFFFEC, 0x00000000, 0xFFFFFFF4, 0x00000000, + 0x000003FC); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFFA, 0xFFFFFFFFFFFFFFFB, + 0xFFFFFFFFFFFFFFFC, 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, + 0x00000000000000FF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v4, 0x0000000000000000, 0x0000000000000008, 0x0000000000000000, + 0x0000000000000010, 0x0000000000000000, 0x0000000000000018, + 0x0000000000000000, 0x0000000000000020, 0x0000000000000000, + 0xFFFFFFFFFFFFFFE4, 0x0000000000000000, 0xFFFFFFFFFFFFFFEC, + 0x0000000000000000, 0xFFFFFFFFFFFFFFF4, 0x0000000000000000, + 0x00000000000003FC); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, 0xFA, + 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + asm volatile("vsll.vi v4, v2, 2"); + VCMP_U8(17, v4, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, + 0xE8, 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, 0x00FF); + asm volatile("vsll.vi v4, v2, 2"); + VCMP_U16(18, v4, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, + 0x0020, 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, + 0x03FC); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0x000000FF); + asm volatile("vsll.vi v4, v2, 2"); + VCMP_U32(19, v4, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0x000003FC); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFFA, 0xFFFFFFFFFFFFFFFB, + 0xFFFFFFFFFFFFFFFC, 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, + 0x00000000000000FF); + asm volatile("vsll.vi v4, v2, 2"); + VCMP_U64(20, v4, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0x00000000000003FC); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, 0xFA, + 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vi v4, v2, 2, v0.t"); + VCMP_U8(21, v4, 0x00, 0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x20, 0x00, 0xE4, + 0x00, 0xEC, 0x00, 0xF4, 0x00, 0xFC); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, 0x00FF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vi v4, v2, 2, v0.t"); + VCMP_U16(22, v4, 0x0000, 0x0008, 0x0000, 0x0010, 0x0000, 0x0018, 0x0000, + 0x0020, 0x0000, 0xFFE4, 0x0000, 0xFFEC, 0x0000, 0xFFF4, 0x0000, + 0x03FC); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0x000000FF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vi v4, v2, 2, v0.t"); + VCMP_U32(23, v4, 0x00000000, 0x00000008, 0x00000000, 0x00000010, 0x00000000, + 0x00000018, 0x00000000, 0x00000020, 0x00000000, 0xFFFFFFE4, + 0x00000000, 0xFFFFFFEC, 0x00000000, 0xFFFFFFF4, 0x00000000, + 0x000003FC); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFFA, 0xFFFFFFFFFFFFFFFB, + 0xFFFFFFFFFFFFFFFC, 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, + 0x00000000000000FF); + VCLEAR(v4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsll.vi v4, v2, 2, v0.t"); + VCMP_U64(24, v4, 0x0000000000000000, 0x0000000000000008, 0x0000000000000000, + 0x0000000000000010, 0x0000000000000000, 0x0000000000000018, + 0x0000000000000000, 0x0000000000000020, 0x0000000000000000, + 0xFFFFFFFFFFFFFFE4, 0x0000000000000000, 0xFFFFFFFFFFFFFFEC, + 0x0000000000000000, 0xFFFFFFFFFFFFFFF4, 0x0000000000000000, + 0x00000000000003FC); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsmul.c b/apps/riscv-tests/isa/rv64uv/vsmul.c new file mode 100644 index 0000000..0b97f2d --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsmul.c @@ -0,0 +1,59 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(3, e8, m1); + VLOAD_8(v2, 127, 127, -50); + VLOAD_8(v3, 127, 10, 127); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vsmul.vv v1, v2, v3"); + VCMP_I8(1, v1, 126, 9, -50); +} + +void TEST_CASE2() { + VSET(3, e8, m1); + VLOAD_8(v2, 127, 127, -50); + VLOAD_8(v3, 127, 10, 127); + VLOAD_8(v0, 5, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vsmul.vv v1, v2, v3, v0.t"); + VCMP_I8(2, v1, 126, 0, -50); +} + +void TEST_CASE3() { + VSET(3, e8, m1); + VLOAD_8(v2, 127, 63, -50); + int8_t scalar = 55; + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vsmul.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(3, v1, 54, 27, -22); +} + +void TEST_CASE4() { + VSET(3, e8, m1); + VLOAD_8(v2, 127, 127, -50); + int8_t scalar = 55; + VLOAD_8(v0, 5, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vsmul.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(4, v1, 54, 0, -22); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} \ No newline at end of file diff --git a/apps/riscv-tests/isa/rv64uv/vsra.c b/apps/riscv-tests/isa/rv64uv/vsra.c new file mode 100644 index 0000000..e6e432c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsra.c @@ -0,0 +1,316 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsra.vv v4, v2, v3"); + VCMP_U8(1, v4, 0x80, 0xC0, 0xE0, 0xF0, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0xC0, + 0xE0, 0xF0, 0xFF, 0xFF, 0xFF, 0x80); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsra.vv v4, v2, v3"); + VCMP_U16(2, v4, 0x8000, 0xC000, 0xE000, 0xF000, 0xFF00, 0xFFFF, 0xFFFF, + 0x8000, 0x8000, 0xC000, 0xE000, 0xF000, 0xFF00, 0xFFFF, 0xFFFF, + 0x8000); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsra.vv v4, v2, v3"); + VCMP_U32(3, v4, 0x80000000, 0xC0000000, 0xE0000000, 0xF0000000, 0xFF000000, + 0xFFFF0000, 0xFFFFFFFF, 0x80000000, 0x80000000, 0xC0000000, + 0xE0000000, 0xF0000000, 0xFF000000, 0xFFFF0000, 0xFFFFFFFF, + 0x80000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000); + VLOAD_64(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsra.vv v4, v2, v3"); + VCMP_U64(4, v4, 0x8000000000000000, 0xC000000000000000, 0xE000000000000000, + 0xF000000000000000, 0xFF00000000000000, 0xFFFF000000000000, + 0xFFFFFFFF00000000, 0xFFFFFFFF80000000, 0x8000000000000000, + 0xC000000000000000, 0xE000000000000000, 0xF000000000000000, + 0xFF00000000000000, 0xFFFF000000000000, 0xFFFFFFFF00000000, + 0xFFFFFFFF80000000); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vv v4, v2, v3, v0.t"); + VCMP_U8(5, v4, 0x00, 0xC0, 0x00, 0xF0, 0x00, 0xFF, 0x00, 0x80, 0x00, 0xC0, + 0x00, 0xF0, 0x00, 0xFF, 0x00, 0x80); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vv v4, v2, v3, v0.t"); + VCMP_U16(6, v4, 0x0000, 0xC000, 0x0000, 0xF000, 0x0000, 0xFFFF, 0x0000, + 0x8000, 0x0000, 0xC000, 0x0000, 0xF000, 0x0000, 0xFFFF, 0x0000, + 0x8000); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vv v4, v2, v3, v0.t"); + VCMP_U32(7, v4, 0x00000000, 0xC0000000, 0x00000000, 0xF0000000, 0x00000000, + 0xFFFF0000, 0x00000000, 0x80000000, 0x00000000, 0xC0000000, + 0x00000000, 0xF0000000, 0x00000000, 0xFFFF0000, 0x00000000, + 0x80000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000); + VLOAD_64(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vv v4, v2, v3, v0.t"); + VCMP_U64(8, v4, 0x0000000000000000, 0xC000000000000000, 0x0000000000000000, + 0xF000000000000000, 0x0000000000000000, 0xFFFF000000000000, + 0x0000000000000000, 0xFFFFFFFF80000000, 0x0000000000000000, + 0xC000000000000000, 0x0000000000000000, 0xF000000000000000, + 0x0000000000000000, 0xFFFF000000000000, 0x0000000000000000, + 0xFFFFFFFF80000000); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + asm volatile("vsra.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vsra.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vsra.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0xFFFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vsra.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v4, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFFA, 0xFFFFFFFFFFFFFFFB, + 0xFFFFFFFFFFFFFFFC, 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, + 0xFFFFFFFFFFFFFFFF); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF9, + 0x00, 0xFB, 0x00, 0xFD, 0x00, 0xFF); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0xFFF9, 0x0000, 0xFFFB, 0x0000, 0xFFFD, 0x0000, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0xFFFFFFF9, + 0x00000000, 0xFFFFFFFB, 0x00000000, 0xFFFFFFFD, 0x00000000, + 0xFFFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v4, 0x0000000000000000, 0x0000000000000002, 0x0000000000000000, + 0x0000000000000004, 0x0000000000000000, 0x0000000000000006, + 0x0000000000000000, 0x0000000000000008, 0x0000000000000000, + 0xFFFFFFFFFFFFFFF9, 0x0000000000000000, 0xFFFFFFFFFFFFFFFB, + 0x0000000000000000, 0xFFFFFFFFFFFFFFFD, 0x0000000000000000, + 0xFFFFFFFFFFFFFFFF); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + asm volatile("vsra.vi v4, v2, 2"); + VCMP_U8(17, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF8, 0xF9, + 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vsra.vi v4, v2, 2"); + VCMP_U16(18, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vsra.vi v4, v2, 2"); + VCMP_U32(19, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0xFFFFFFF8, 0xFFFFFFF9, + 0xFFFFFFFA, 0xFFFFFFFB, 0xFFFFFFFC, 0xFFFFFFFD, 0xFFFFFFFE, + 0xFFFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vsra.vi v4, v2, 2"); + VCMP_U64(20, v4, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFF9, 0xFFFFFFFFFFFFFFFA, 0xFFFFFFFFFFFFFFFB, + 0xFFFFFFFFFFFFFFFC, 0xFFFFFFFFFFFFFFFD, 0xFFFFFFFFFFFFFFFE, + 0xFFFFFFFFFFFFFFFF); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vi v4, v2, 2, v0.t"); + VCMP_U8(21, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0xF9, + 0x00, 0xFB, 0x00, 0xFD, 0x00, 0xFF); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vi v4, v2, 2, v0.t"); + VCMP_U16(22, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0xFFF9, 0x0000, 0xFFFB, 0x0000, 0xFFFD, 0x0000, + 0xFFFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vi v4, v2, 2, v0.t"); + VCMP_U32(23, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0xFFFFFFF9, + 0x00000000, 0xFFFFFFFB, 0x00000000, 0xFFFFFFFD, 0x00000000, + 0xFFFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsra.vi v4, v2, 2, v0.t"); + VCMP_U64(24, v4, 0x0000000000000000, 0x0000000000000002, 0x0000000000000000, + 0x0000000000000004, 0x0000000000000000, 0x0000000000000006, + 0x0000000000000000, 0x0000000000000008, 0x0000000000000000, + 0xFFFFFFFFFFFFFFF9, 0x0000000000000000, 0xFFFFFFFFFFFFFFFB, + 0x0000000000000000, 0xFFFFFFFFFFFFFFFD, 0x0000000000000000, + 0xFFFFFFFFFFFFFFFF); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsrl.c b/apps/riscv-tests/isa/rv64uv/vsrl.c new file mode 100644 index 0000000..e479481 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsrl.c @@ -0,0 +1,316 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsrl.vv v4, v2, v3"); + VCMP_U8(1, v4, 0x80, 0x40, 0x20, 0x10, 0x01, 0x01, 0x01, 0x80, 0x80, 0x40, + 0x20, 0x10, 0x01, 0x01, 0x01, 0x80); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsrl.vv v4, v2, v3"); + VCMP_U16(2, v4, 0x8000, 0x4000, 0x2000, 0x1000, 0x0100, 0x0001, 0x0001, + 0x8000, 0x8000, 0x4000, 0x2000, 0x1000, 0x0100, 0x0001, 0x0001, + 0x8000); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsrl.vv v4, v2, v3"); + VCMP_U32(3, v4, 0x80000000, 0x40000000, 0x20000000, 0x10000000, 0x01000000, + 0x00010000, 0x00000001, 0x80000000, 0x80000000, 0x40000000, + 0x20000000, 0x10000000, 0x01000000, 0x00010000, 0x00000001, + 0x80000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000); + VLOAD_64(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + asm volatile("vsrl.vv v4, v2, v3"); + VCMP_U64(4, v4, 0x8000000000000000, 0x4000000000000000, 0x2000000000000000, + 0x1000000000000000, 0x0100000000000000, 0x0001000000000000, + 0x0000000100000000, 0x0000000080000000, 0x8000000000000000, + 0x4000000000000000, 0x2000000000000000, 0x1000000000000000, + 0x0100000000000000, 0x0001000000000000, 0x0000000100000000, + 0x0000000080000000); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80); + VLOAD_8(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vv v4, v2, v3, v0.t"); + VCMP_U8(5, v4, 0x00, 0x40, 0x00, 0x10, 0x00, 0x01, 0x00, 0x80, 0x00, 0x40, + 0x00, 0x10, 0x00, 0x01, 0x00, 0x80); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000); + VLOAD_16(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vv v4, v2, v3, v0.t"); + VCMP_U16(6, v4, 0x0000, 0x4000, 0x0000, 0x1000, 0x0000, 0x0001, 0x0000, + 0x8000, 0x0000, 0x4000, 0x0000, 0x1000, 0x0000, 0x0001, 0x0000, + 0x8000); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, + 0x80000000); + VLOAD_32(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vv v4, v2, v3, v0.t"); + VCMP_U32(7, v4, 0x00000000, 0x40000000, 0x00000000, 0x10000000, 0x00000000, + 0x00010000, 0x00000000, 0x80000000, 0x00000000, 0x40000000, + 0x00000000, 0x10000000, 0x00000000, 0x00010000, 0x00000000, + 0x80000000); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000, 0x8000000000000000, 0x8000000000000000, + 0x8000000000000000); + VLOAD_64(v3, 0, 1, 2, 3, 7, 15, 31, 32, 0, 1, 2, 3, 7, 15, 31, 32); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vv v4, v2, v3, v0.t"); + VCMP_U64(8, v4, 0x0000000000000000, 0x4000000000000000, 0x0000000000000000, + 0x1000000000000000, 0x0000000000000000, 0x0001000000000000, + 0x0000000000000000, 0x0000000080000000, 0x0000000000000000, + 0x4000000000000000, 0x0000000000000000, 0x1000000000000000, + 0x0000000000000000, 0x0001000000000000, 0x0000000000000000, + 0x0000000080000000); +}; + +void TEST_CASE3(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + asm volatile("vsrl.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x38, 0x39, + 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vsrl.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x3FF8, 0x3FF9, 0x3FFA, 0x3FFB, 0x3FFC, 0x3FFD, 0x3FFE, + 0x3FFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vsrl.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0x3FFFFFF8, 0x3FFFFFF9, + 0x3FFFFFFA, 0x3FFFFFFB, 0x3FFFFFFC, 0x3FFFFFFD, 0x3FFFFFFE, + 0x3FFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vsrl.vx v4, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v4, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0x3FFFFFFFFFFFFFF8, + 0x3FFFFFFFFFFFFFF9, 0x3FFFFFFFFFFFFFFA, 0x3FFFFFFFFFFFFFFB, + 0x3FFFFFFFFFFFFFFC, 0x3FFFFFFFFFFFFFFD, 0x3FFFFFFFFFFFFFFE, + 0x3FFFFFFFFFFFFFFF); +}; + +void TEST_CASE4(void) { + const uint64_t scalar = 2; + + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0x39, + 0x00, 0x3B, 0x00, 0x3D, 0x00, 0x3F); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0x3FF9, 0x0000, 0x3FFB, 0x0000, 0x3FFD, 0x0000, + 0x3FFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0x3FFFFFF9, + 0x00000000, 0x3FFFFFFB, 0x00000000, 0x3FFFFFFD, 0x00000000, + 0x3FFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vx v4, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v4, 0x0000000000000000, 0x0000000000000002, 0x0000000000000000, + 0x0000000000000004, 0x0000000000000000, 0x0000000000000006, + 0x0000000000000000, 0x0000000000000008, 0x0000000000000000, + 0x3FFFFFFFFFFFFFF9, 0x0000000000000000, 0x3FFFFFFFFFFFFFFB, + 0x0000000000000000, 0x3FFFFFFFFFFFFFFD, 0x0000000000000000, + 0x3FFFFFFFFFFFFFFF); +}; + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + asm volatile("vsrl.vi v4, v2, 2"); + VCMP_U8(17, v4, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x38, 0x39, + 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + asm volatile("vsrl.vi v4, v2, 2"); + VCMP_U16(18, v4, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x3FF8, 0x3FF9, 0x3FFA, 0x3FFB, 0x3FFC, 0x3FFD, 0x3FFE, + 0x3FFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + asm volatile("vsrl.vi v4, v2, 2"); + VCMP_U32(19, v4, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, + 0x00000006, 0x00000007, 0x00000008, 0x3FFFFFF8, 0x3FFFFFF9, + 0x3FFFFFFA, 0x3FFFFFFB, 0x3FFFFFFC, 0x3FFFFFFD, 0x3FFFFFFE, + 0x3FFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + asm volatile("vsrl.vi v4, v2, 2"); + VCMP_U64(20, v4, 0x0000000000000001, 0x0000000000000002, 0x0000000000000003, + 0x0000000000000004, 0x0000000000000005, 0x0000000000000006, + 0x0000000000000007, 0x0000000000000008, 0x3FFFFFFFFFFFFFF8, + 0x3FFFFFFFFFFFFFF9, 0x3FFFFFFFFFFFFFFA, 0x3FFFFFFFFFFFFFFB, + 0x3FFFFFFFFFFFFFFC, 0x3FFFFFFFFFFFFFFD, 0x3FFFFFFFFFFFFFFE, + 0x3FFFFFFFFFFFFFFF); +}; + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0xE0, 0xE4, 0xE8, + 0xEC, 0xF0, 0xF4, 0xF8, 0xFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vi v4, v2, 2, v0.t"); + VCMP_U8(21, v4, 0x00, 0x02, 0x00, 0x04, 0x00, 0x06, 0x00, 0x08, 0x00, 0x39, + 0x00, 0x3B, 0x00, 0x3D, 0x00, 0x3F); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, + 0xFFE0, 0xFFE4, 0xFFE8, 0xFFEC, 0xFFF0, 0xFFF4, 0xFFF8, 0xFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vi v4, v2, 2, v0.t"); + VCMP_U16(22, v4, 0x0000, 0x0002, 0x0000, 0x0004, 0x0000, 0x0006, 0x0000, + 0x0008, 0x0000, 0x3FF9, 0x0000, 0x3FFB, 0x0000, 0x3FFD, 0x0000, + 0x3FFF); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x00000004, 0x00000008, 0x0000000C, 0x00000010, 0x00000014, + 0x00000018, 0x0000001C, 0x00000020, 0xFFFFFFE0, 0xFFFFFFE4, + 0xFFFFFFE8, 0xFFFFFFEC, 0xFFFFFFF0, 0xFFFFFFF4, 0xFFFFFFF8, + 0xFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vi v4, v2, 2, v0.t"); + VCMP_U32(23, v4, 0x00000000, 0x00000002, 0x00000000, 0x00000004, 0x00000000, + 0x00000006, 0x00000000, 0x00000008, 0x00000000, 0x3FFFFFF9, + 0x00000000, 0x3FFFFFFB, 0x00000000, 0x3FFFFFFD, 0x00000000, + 0x3FFFFFFF); + + VSET(16, e64, m1); + VLOAD_64(v2, 0x0000000000000004, 0x0000000000000008, 0x000000000000000C, + 0x0000000000000010, 0x0000000000000014, 0x0000000000000018, + 0x000000000000001C, 0x0000000000000020, 0xFFFFFFFFFFFFFFE0, + 0xFFFFFFFFFFFFFFE4, 0xFFFFFFFFFFFFFFE8, 0xFFFFFFFFFFFFFFEC, + 0xFFFFFFFFFFFFFFF0, 0xFFFFFFFFFFFFFFF4, 0xFFFFFFFFFFFFFFF8, + 0xFFFFFFFFFFFFFFFC); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v4); + asm volatile("vsrl.vi v4, v2, 2, v0.t"); + VCMP_U64(24, v4, 0x0000000000000000, 0x0000000000000002, 0x0000000000000000, + 0x0000000000000004, 0x0000000000000000, 0x0000000000000006, + 0x0000000000000000, 0x0000000000000008, 0x0000000000000000, + 0x3FFFFFFFFFFFFFF9, 0x0000000000000000, 0x3FFFFFFFFFFFFFFB, + 0x0000000000000000, 0x3FFFFFFFFFFFFFFD, 0x0000000000000000, + 0x3FFFFFFFFFFFFFFF); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vss.c b/apps/riscv-tests/isa/rv64uv/vss.c new file mode 100644 index 0000000..5f34498 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vss.c @@ -0,0 +1,146 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Positive-stride tests +void TEST_CASE1(void) { + VSET(4, e8, m1); + volatile uint8_t OUT1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + uint64_t stride = 3; + VLOAD_8(v1, 0x9f, 0xe4, 0x19, 0x20); + asm volatile("vsse8.v v1, (%0), %1" ::"r"(OUT1), "r"(stride)); + VVCMP_U8(1, OUT1, 0x9f, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x19, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); +} + +void TEST_CASE2(void) { + VSET(8, e16, m1); + volatile uint16_t OUT1[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + uint64_t stride = 4; + VLOAD_16(v1, 0x9f11, 0xe478, 0x1549, 0x3240, 0x2f11, 0xe448, 0x1546, 0x3220); + asm volatile("vsse16.v v1, (%0), %1" ::"r"(OUT1), "r"(stride)); + VVCMP_U16(2, OUT1, 0x9f11, 0x0000, 0xe478, 0x0000, 0x1549, 0x0000, 0x3240, + 0x0000, 0x2f11, 0x0000, 0xe448, 0x0000, 0x1546, 0x0000, 0x3220, + 0x0000); +} + +void TEST_CASE3(void) { + VSET(4, e32, m1); + volatile uint32_t OUT1[] = {0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + uint64_t stride = 8; + VLOAD_32(v1, 0x9f872456, 0xe1356784, 0x13241139, 0x20862497); + asm volatile("vsse32.v v1, (%0), %1" ::"r"(OUT1), "r"(stride)); + VVCMP_U32(3, OUT1, 0x9f872456, 0x00000000, 0xe1356784, 0x00000000, 0x13241139, + 0x00000000, 0x20862497, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000); +} + +void TEST_CASE4(void) { + VSET(16, e64, m1); + volatile uint64_t OUT1[] = { + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000}; + uint64_t stride = 16; + VLOAD_64(v1, 0x9f87245315434136, 0xe135578794246784, 0x1315345345241139, + 0x2086252110062497, 0x1100229933847136, 0xaaffaaffaaffaaff, + 0xaf87245315434136, 0xa135578794246784, 0x2315345345241139, + 0x1086252110062497, 0x1100229933847134, 0xaaffaaffaaffaaf4, + 0x9315345345241139, 0x9086252110062497, 0x9100229933847134, + 0x9affaaffaaffaaf4); + asm volatile("vsse64.v v1, (%0), %1" ::"r"(OUT1), "r"(stride)); + VVCMP_U64(4, OUT1, 0x9f87245315434136, 0x0000000000000000, 0xe135578794246784, + 0x0000000000000000, 0x1315345345241139, 0x0000000000000000, + 0x2086252110062497, 0x0000000000000000, 0x1100229933847136, + 0x0000000000000000, 0xaaffaaffaaffaaff, 0x0000000000000000, + 0xaf87245315434136, 0x0000000000000000, 0xa135578794246784, + 0x0000000000000000, 0x2315345345241139, 0x0000000000000000, + 0x1086252110062497, 0x0000000000000000, 0x1100229933847134, + 0x0000000000000000, 0xaaffaaffaaffaaf4, 0x0000000000000000, + 0x9315345345241139, 0x0000000000000000, 0x9086252110062497, + 0x0000000000000000, 0x9100229933847134, 0x0000000000000000, + 0x9affaaffaaffaaf4, 0x0000000000000000); +} + +// Masked strided store +void TEST_CASE5(void) { + VSET(4, e8, m1); + volatile uint8_t OUT1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + uint64_t stride = 3; + VLOAD_8(v0, 0xAA); + VLOAD_8(v1, 0x9f, 0xe4, 0x19, 0x20); + asm volatile("vsse8.v v1, (%0), %1, v0.t" ::"r"(OUT1), "r"(stride)); + VVCMP_U8(5, OUT1, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); +} + +void TEST_CASE6(void) { + VSET(16, e64, m1); + volatile uint64_t OUT1[] = { + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000}; + uint64_t stride = 16; + VLOAD_64(v1, 0x9f87245315434136, 0xe135578794246784, 0x1315345345241139, + 0x2086252110062497, 0x1100229933847136, 0xaaffaaffaaffaaff, + 0xaf87245315434136, 0xa135578794246784, 0x2315345345241139, + 0x1086252110062497, 0x1100229933847134, 0xaaffaaffaaffaaf4, + 0x9315345345241139, 0x9086252110062497, 0x9100229933847134, + 0x9affaaffaaffaaf4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vsse64.v v1, (%0), %1, v0.t" ::"r"(OUT1), "r"(stride)); + VVCMP_U64(6, OUT1, 0x0000000000000000, 0x0000000000000000, 0xe135578794246784, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x2086252110062497, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0xaaffaaffaaffaaff, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0xa135578794246784, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x1086252110062497, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0xaaffaaffaaffaaf4, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x9086252110062497, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x9affaaffaaffaaf4, 0x0000000000000000); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsseg.c b/apps/riscv-tests/isa/rv64uv/vsseg.c new file mode 100644 index 0000000..259f59e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsseg.c @@ -0,0 +1,407 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH_MAX 512 +#define MEM_VEC_SIZE 16 + +#define MEM_VCLEAR(vec) \ + { \ + for (int i = 0; i < MEM_VEC_SIZE; ++i) \ + vec[i] = 0; \ + } + +static volatile uint8_t ALIGNED_O8[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static volatile uint16_t ALIGNED_O16[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; + +static volatile uint32_t ALIGNED_O32[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + +static volatile uint64_t ALIGNED_O64[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000}; + +// Segment-2 +void TEST_CASE1_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e8.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg2e8.v v1, (%0)" ::"r"(ALIGNED_O8)); + VVCMP_U8(1, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0); +} + +// Segment-3 +void TEST_CASE2_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e8.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg3e8.v v1, (%0)" ::"r"(ALIGNED_O8)); + VVCMP_U8(2, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, + 0xaa, 0x71, 0xf0); +} + +// Segment-4 +void TEST_CASE3_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e8.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg4e8.v v1, (%0)" ::"r"(ALIGNED_O8)); + VVCMP_U8(3, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, + 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3); +} + +// Segment-8 +void TEST_CASE4_8(void) { + VSET(2, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e8.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg8e8.v v1, (%0)" ::"r"(ALIGNED_O8)); + VVCMP_U8(4, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, + 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3); +} + +// Segment-2 for 16-bit +void TEST_CASE1_16(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e16.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg2e16.v v1, (%0)" ::"r"(ALIGNED_O16)); + VVCMP_U16(5, ALIGNED_O16, 0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3); +} + +// Segment-3 for 16-bit +void TEST_CASE2_16(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e16.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg3e16.v v1, (%0)" ::"r"(ALIGNED_O16)); + VVCMP_U16(6, ALIGNED_O16, 0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0); +} + +// Segment-4 for 16-bit +void TEST_CASE3_16(void) { + VSET(4, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e16.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg4e16.v v1, (%0)" ::"r"(ALIGNED_O16)); + VVCMP_U16(7, ALIGNED_O16, 0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1357, 0x2468, + 0x369b, 0x48ac); +} + +// Segment-8 for 16-bit +void TEST_CASE4_16(void) { + VSET(2, e16, m1); + volatile uint16_t INP1[] = {0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, + 0x1357, 0x2468, 0x369b, 0x48ac}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e16.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg8e16.v v1, (%0)" ::"r"(ALIGNED_O16)); + VVCMP_U16(8, ALIGNED_O16, 0x9fe4, 0x1920, 0x8f2e, 0x05e0, 0xf9aa, 0x71f0, + 0xc394, 0xbbd3, 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1357, 0x2468, + 0x369b, 0x48ac); +} + +// Segment-2 for 32-bit +void TEST_CASE1_32(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e32.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg2e32.v v1, (%0)" ::"r"(ALIGNED_O32)); + VVCMP_U32(9, ALIGNED_O32, 0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac); +} + +// Segment-3 for 32-bit +void TEST_CASE2_32(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e32.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg3e32.v v1, (%0)" ::"r"(ALIGNED_O32)); + VVCMP_U32(10, ALIGNED_O32, 0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, 0xdeadbeef, + 0xcafebabe, 0x01234567, 0x89abcdef); +} + +// Segment-4 for 32-bit +void TEST_CASE3_32(void) { + VSET(4, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e32.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg4e32.v v1, (%0)" ::"r"(ALIGNED_O32)); + VVCMP_U32(11, ALIGNED_O32, 0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, 0xdeadbeef, + 0xcafebabe, 0x01234567, 0x89abcdef, 0x55aa55aa, 0x77889900, + 0xabcdef12, 0x34567890); +} + +// Segment-8 for 32-bit +void TEST_CASE4_32(void) { + VSET(2, e32, m1); + volatile uint32_t INP1[] = {0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, + 0xdeadbeef, 0xcafebabe, 0x01234567, 0x89abcdef, + 0x55aa55aa, 0x77889900, 0xabcdef12, 0x34567890}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e32.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg8e32.v v1, (%0)" ::"r"(ALIGNED_O32)); + VVCMP_U32(12, ALIGNED_O32, 0x9fe41920, 0x8f2e05e0, 0xf9aa71f0, 0xc394bbd3, + 0x12345678, 0x9abcdef0, 0x13572468, 0x369b48ac, 0xdeadbeef, + 0xcafebabe, 0x01234567, 0x89abcdef, 0x55aa55aa, 0x77889900, + 0xabcdef12, 0x34567890); +} + +// Segment-2 for 64-bit +void TEST_CASE1_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + asm volatile("vlseg2e64.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg2e64.v v1, (%0)" ::"r"(ALIGNED_O64)); + VVCMP_U64(13, ALIGNED_O64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0x123456789abcdef0, 0x13572468369b48ac); +} + +// Segment-3 for 64-bit +void TEST_CASE2_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + asm volatile("vlseg3e64.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg3e64.v v1, (%0)" ::"r"(ALIGNED_O64)); + VVCMP_U64(14, ALIGNED_O64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0x123456789abcdef0, 0x13572468369b48ac, 0xdeadbeefcafebabe, + 0x0123456789abcdef, 0x55aa55aa77889900, 0xabcdef1234567890); +} + +// Segment-4 for 64-bit +void TEST_CASE3_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + asm volatile("vlseg4e64.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg4e64.v v1, (%0)" ::"r"(ALIGNED_O64)); + VVCMP_U64(15, ALIGNED_O64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0x123456789abcdef0, 0x13572468369b48ac, 0xdeadbeefcafebabe, + 0x0123456789abcdef, 0x55aa55aa77889900, 0xabcdef1234567890, + 0xfeedfacecafebabe, 0x123456789abcdef0, 0x1357246855aa55aa, + 0x369b48acdeadbeef, 0xcafebabe12345678, 0xabcdef0987654321, + 0x012345670abcdef1, 0x987654321fedcba0); +} + +// Segment-8 for 64-bit +void TEST_CASE4_64(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + asm volatile("vlseg8e64.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg8e64.v v1, (%0)" ::"r"(ALIGNED_O64)); + VVCMP_U64(16, ALIGNED_O64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0x123456789abcdef0, 0x13572468369b48ac, 0xdeadbeefcafebabe, + 0x0123456789abcdef, 0x55aa55aa77889900, 0xabcdef1234567890, + 0xfeedfacecafebabe, 0x123456789abcdef0, 0x1357246855aa55aa, + 0x369b48acdeadbeef, 0xcafebabe12345678, 0xabcdef0987654321, + 0x012345670abcdef1, 0x987654321fedcba0); +} + +// Segment-8 for 64-bit +void TEST_CASE4_64_m(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + + VCLEAR(v0); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vlseg8e64.v v1, (%0)" ::"r"(INP1)); + asm volatile("vsseg8e64.v v1, (%0), v0.t" ::"r"(ALIGNED_O64)); + VVCMP_U64(17, ALIGNED_O64, 0, 0, 0, 0, 0, 0, 0, 0, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1_8(); + MEM_VCLEAR(ALIGNED_O8); + TEST_CASE2_8(); + MEM_VCLEAR(ALIGNED_O8); + TEST_CASE3_8(); + MEM_VCLEAR(ALIGNED_O8); + TEST_CASE4_8(); + MEM_VCLEAR(ALIGNED_O8); + + TEST_CASE1_16(); + MEM_VCLEAR(ALIGNED_O16); + TEST_CASE2_16(); + MEM_VCLEAR(ALIGNED_O16); + TEST_CASE3_16(); + MEM_VCLEAR(ALIGNED_O16); + TEST_CASE4_16(); + MEM_VCLEAR(ALIGNED_O16); + + TEST_CASE1_32(); + MEM_VCLEAR(ALIGNED_O32); + TEST_CASE2_32(); + MEM_VCLEAR(ALIGNED_O32); + TEST_CASE3_32(); + MEM_VCLEAR(ALIGNED_O32); + TEST_CASE4_32(); + MEM_VCLEAR(ALIGNED_O32); + + TEST_CASE1_64(); + MEM_VCLEAR(ALIGNED_O64); + TEST_CASE2_64(); + MEM_VCLEAR(ALIGNED_O64); + TEST_CASE3_64(); + MEM_VCLEAR(ALIGNED_O64); + TEST_CASE4_64(); + MEM_VCLEAR(ALIGNED_O64); + + TEST_CASE4_64_m(); + MEM_VCLEAR(ALIGNED_O64); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vssra.c b/apps/riscv-tests/isa/rv64uv/vssra.c new file mode 100644 index 0000000..a21d6aa --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vssra.c @@ -0,0 +1,79 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 1, 2, 3, 4); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssra.vv v1, v2, v3"); + VCMP_I8(1, v1, 0xff, 0, 0xfe, 0); +} + +void TEST_CASE2() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 1, 2, 3, 4); + VLOAD_8(v0, 5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssra.vv v1, v2, v3, v0.t"); + VCMP_I8(2, v1, 0xff, 0, 0xfe, 0); +} + +void TEST_CASE3() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssra.vi v1, v2, 2"); + VCMP_I8(3, v1, 0xff, 0, 0xfc, 3); +} + +void TEST_CASE4() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v0, 5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssra.vi v1, v2, 2, v0.t"); + VCMP_I8(4, v1, 0xff, 0, 0xfc, 0); +} + +void TEST_CASE5() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + uint64_t scalar = 2; + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssra.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_I8(5, v1, 0xff, 0, 0xfc, 3); +} + +void TEST_CASE6() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + uint64_t scalar = 2; + VLOAD_8(v0, 5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssra.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_I8(6, v1, 0xff, 0, 0xfc, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vssrl.c b/apps/riscv-tests/isa/rv64uv/vssrl.c new file mode 100644 index 0000000..de73e9f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vssrl.c @@ -0,0 +1,79 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 1, 2, 3, 4); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssrl.vv v1, v2, v3"); + VCMP_U8(1, v1, 0x7f, 0, 0x1e, 0x00); +} + +void TEST_CASE2() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v3, 1, 2, 3, 4); + VLOAD_8(v0, 5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssrl.vv v1, v2, v3, v0.t"); + VCMP_U8(2, v1, 0x7f, 0, 0x1e, 0); +} + +void TEST_CASE3() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssrl.vi v1, v2, 5"); + VCMP_U8(3, v1, 7, 0, 7, 0); +} + +void TEST_CASE4() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + VLOAD_8(v0, 5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssrl.vi v1, v2, 5, v0.t"); + VCMP_U8(4, v1, 7, 0, 7, 0); +} + +void TEST_CASE5() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + uint64_t scalar = 5; + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssrl.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(5, v1, 7, 0, 7, 0); +} + +void TEST_CASE6() { + VSET(4, e8, m1); + VLOAD_8(v2, 0xff, 0x00, 0xf0, 0x0f); + uint64_t scalar = 5; + VLOAD_8(v0, 5, 0, 0, 0); + VCLEAR(v1); + __asm__ volatile("csrw vxrm, 2"); + __asm__ volatile("vssrl.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(6, v1, 7, 0, 7, 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + EXIT_CHECK(); +} \ No newline at end of file diff --git a/apps/riscv-tests/isa/rv64uv/vssseg.c b/apps/riscv-tests/isa/rv64uv/vssseg.c new file mode 100644 index 0000000..9352474 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vssseg.c @@ -0,0 +1,425 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH_MAX 512 +#define MEM_VEC_SIZE 64 + +#define MEM_VCLEAR(vec) \ + { \ + for (int i = 0; i < MEM_VEC_SIZE; ++i) \ + vec[i] = 0; \ + } + +static volatile uint8_t ALIGNED_O8[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static volatile uint16_t ALIGNED_O16[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; + +static volatile uint32_t ALIGNED_O32[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + +static volatile uint64_t ALIGNED_O64[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000}; + +int stride; + +// Segment-2 +void TEST_CASE1_8(void) { + + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + VCLEAR(v1); + VCLEAR(v2); + stride = 0; + VSET(5, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg2e8.v v1, (%0), %1" ::"r"(ALIGNED_O8), "r"(stride)); + VVCMP_U8(1, ALIGNED_O8, 0x9f, 0xe4, 0, 0, 0, 0, 0, 0); + + MEM_VCLEAR(ALIGNED_O8); + VCLEAR(v1); + VCLEAR(v2); + stride = 2; + VSET(32, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg2e8.v v1, (%0), %1" ::"r"(ALIGNED_O8), "r"(stride)); + VVCMP_U8(2, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, + 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, + 0x83, 0x7d, 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, + 0x3e, 0x6c, 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, + 0xdf, 0x80, 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, + 0x69, 0xf5, 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70); + + MEM_VCLEAR(ALIGNED_O8); + VCLEAR(v1); + VCLEAR(v2); + stride = 3; + VSET(22, e8, m1); + asm volatile("vlsseg2e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg2e8.v v1, (%0), %1" ::"r"(ALIGNED_O8), "r"(stride)); + VVCMP_U8(3, ALIGNED_O8, 0x9f, 0xe4, 0, 0x20, 0x8f, 0, 0x05, 0xe0, 0, 0xaa, + 0x71, 0, 0xc3, 0x94, 0, 0xd3, 0x31, 0, 0x57, 0x6b, 0, 0x7d, 0x1a, 0, + 0xb2, 0xda, 0, 0x56, 0x63, 0, 0xf7, 0x3e, 0, 0x27, 0x74, 0, 0xab, + 0xcd, 0, 0x38, 0x5e, 0, 0xdf, 0x80, 0, 0xa4, 0x7b, 0, 0xc6, 0xad, 0, + 0xec, 0x3c, 0, 0xf5, 0x18, 0, 0x6d, 0xb9, 0, 0x97, 0x2a, 0, 0x70); +} + +// Segment-3 +void TEST_CASE2_8(void) { + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 3; + VSET(22, e8, m1); + asm volatile("vlsseg3e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg3e8.v v1, (%0), %1" ::"r"(ALIGNED_O8), "r"(stride)); + VVCMP_U8(4, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, + 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, + 0x83, 0x7d, 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, + 0x3e, 0x6c, 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, + 0xdf, 0x80, 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, + 0x69, 0xf5, 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70); +} + +// Segment-8 +void TEST_CASE4_16(void) { + VSET(-1, e16, m1); + volatile uint16_t INP1[] = { + 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1111, 0x2222, 0x3333, 0x4444, + 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, 0xbbbb, 0xcccc, + 0xdddd, 0xeeee, 0xffff, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, + 0x0606, 0x0707, 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, + 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, + 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, + 0x1e1e, 0x1f1f, 0x2020, 0x2121, 0x2222, 0x2323, 0x2424, 0x2525, + 0x2626, 0x2727, 0x2828, 0x2929, 0x2a2a, 0x2b2b, 0x2c2c, 0x2d2d}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 16; + VSET(8, e16, m1); + asm volatile("vlsseg8e16.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg8e16.v v1, (%0), %1" ::"r"(ALIGNED_O16), "r"(stride)); + VVCMP_U16(5, ALIGNED_O16, 0x1234, 0x5678, 0x9abc, 0xdef0, 0x1111, 0x2222, + 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888, 0x9999, 0xaaaa, + 0xbbbb, 0xcccc, 0xdddd, 0xeeee, 0xffff, 0x0101, 0x0202, 0x0303, + 0x0404, 0x0505, 0x0606, 0x0707, 0x0808, 0x0909, 0x0a0a, 0x0b0b, + 0x0c0c, 0x0d0d, 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, + 0x1414, 0x1515, 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, + 0x1c1c, 0x1d1d, 0x1e1e, 0x1f1f, 0x2020, 0x2121, 0x2222, 0x2323, + 0x2424, 0x2525, 0x2626, 0x2727, 0x2828, 0x2929, 0x2a2a, 0x2b2b, + 0x2c2c, 0x2d2d); +} + +// Segment-3 +void TEST_CASE2_32(void) { + VSET(-1, e32, m1); + volatile uint32_t INP1[] = { + 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, 0x82f92af6, 0x9af29daa, + 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, 0x53a0be4e, 0x26439a12, + 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, 0xb11d757e, 0x67dd4037, + 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, 0xcefce71b, 0x64d90d0c, + 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, 0xa2cd798c, 0x2a4339cc, + 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, 0x4b32bcdd, 0xbf3b8546, + 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, 0x60914005, 0x93265d9d, + 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, 0xddcd4d07, 0x3266d631, + 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, 0x687f8a39, 0xb9272633, + 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, 0x2a143e76, 0x17a38eec, + 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 12; + VSET(22, e32, m1); + asm volatile("vlsseg3e32.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg3e32.v v1, (%0), %1" ::"r"(ALIGNED_O32), "r"(stride)); + VVCMP_U32( + 6, ALIGNED_O32, 0xe19afa6b, 0x8c10145c, 0xbca44cc5, 0x11ffa54e, + 0x82f92af6, 0x9af29daa, 0x956eb527, 0x575c2e05, 0x68fb4cc5, 0xcf7a1d98, + 0x53a0be4e, 0x26439a12, 0x785cc853, 0x35659121, 0xf7a96b8c, 0xa87678a2, + 0xb11d757e, 0x67dd4037, 0xd29ad01e, 0xb7600abf, 0x2e572002, 0xaadc6195, + 0xcefce71b, 0x64d90d0c, 0x6c3b54b0, 0xcc6da682, 0xd8b7ae76, 0x8533b185, + 0xa2cd798c, 0x2a4339cc, 0xcf9238fb, 0x7e70281b, 0xdf162ee9, 0x4f2ea60f, + 0x4b32bcdd, 0xbf3b8546, 0x52b26ff5, 0x18cbcecd, 0xc364c8f8, 0x5bf0c67b, + 0x60914005, 0x93265d9d, 0xcff3c77d, 0x788529c3, 0xdda63ceb, 0x4edd7f48, + 0xddcd4d07, 0x3266d631, 0x3b2f25a6, 0x7bfd8a81, 0x9db64ef5, 0xa06a42d4, + 0x687f8a39, 0xb9272633, 0xb009319e, 0xf542d689, 0x45ef05c9, 0xf547c96e, + 0x2a143e76, 0x17a38eec, 0x9a73626c, 0xca064493, 0x582140dd, 0x97df3c7a); +} + +// Segment-2 +void TEST_CASE1_64(void) { + + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + stride = 0; + VSET(5, e64, m1); + asm volatile("vlsseg2e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg2e64.v v1, (%0), %1" ::"r"(ALIGNED_O64), "r"(stride)); + VVCMP_U64(7, ALIGNED_O64, 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0, 0, 0, 0); + + VSET(-1, e64, m1); + VCLEAR(v1); + VCLEAR(v2); + stride = 16; + VSET(32, e64, m1); + asm volatile("vlsseg2e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg2e64.v v1, (%0), %1" ::"r"(ALIGNED_O64), "r"(stride)); + VVCMP_U64(8, ALIGNED_O64, 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, + 0xbb8df43b65bac0d2, 0xa41351c301c72b5b, 0x511e175802d24608, + 0x64d7a5514d544e52, 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, + 0x52edd3cfec205090, 0x891a1820b423c29c, 0xfc8e3370b171c315, + 0xa30da5c56e052f67, 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, + 0x52b80462b7e072f9, 0x3e0efee7a99a28e7, 0x3216edfad69d8286, + 0x7409095aa2433e2e, 0x45efda30062c904b, 0x2b707d3fbaef7019, + 0xde9483fe82609c40, 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, + 0x7c917722900ef4d8, 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, + 0xd77ba2e13e47d589, 0x45887508688c93b2, 0xac730ac471f57a8e, + 0x708ca6623c11c1ff, 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, + 0x3adf5823d1051252, 0xc31b51ef18e6dc16, 0xa96c56ed56947466, + 0x5e0f5c76fdd72450, 0xada6b728b9b84f27, 0x9ef5b07ca6742028, + 0x2d52c2213e1497ab, 0x201b60e0fbbc4acd, 0x5428920ecca684b1, + 0xc826aff176ba9a29, 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, + 0x8aac4c04213d26aa, 0xecd584f402152e19, 0x89f5805801f25a66, + 0xbad7cab9c4062ffc, 0xb6715b7275106bc1, 0x53112b0cc2123035, + 0x8ec585926ed7af58, 0xce4722d4b56cd330, 0x14041ab000c9c396, + 0x928220385ce8c56d, 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, + 0x76c882042e57f707, 0xd13e73308658ad1f, 0x5142eb4c19644e7d, + 0x23def41d77db2d38, 0x34affa8555d23fd9, 0xa311951efe71188d, + 0xf96089370f7fa0a7, 0xb0899dfea0b44c26); +} + +// Segment-8 +void TEST_CASE4_64(void) { + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 64; + VSET(8, e64, m1); + asm volatile("vlsseg8e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg8e64.v v1, (%0), %1" ::"r"(ALIGNED_O64), "r"(stride)); + VVCMP_U64(9, ALIGNED_O64, 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, + 0xbb8df43b65bac0d2, 0xa41351c301c72b5b, 0x511e175802d24608, + 0x64d7a5514d544e52, 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, + 0x52edd3cfec205090, 0x891a1820b423c29c, 0xfc8e3370b171c315, + 0xa30da5c56e052f67, 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, + 0x52b80462b7e072f9, 0x3e0efee7a99a28e7, 0x3216edfad69d8286, + 0x7409095aa2433e2e, 0x45efda30062c904b, 0x2b707d3fbaef7019, + 0xde9483fe82609c40, 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, + 0x7c917722900ef4d8, 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, + 0xd77ba2e13e47d589, 0x45887508688c93b2, 0xac730ac471f57a8e, + 0x708ca6623c11c1ff, 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, + 0x3adf5823d1051252, 0xc31b51ef18e6dc16, 0xa96c56ed56947466, + 0x5e0f5c76fdd72450, 0xada6b728b9b84f27, 0x9ef5b07ca6742028, + 0x2d52c2213e1497ab, 0x201b60e0fbbc4acd, 0x5428920ecca684b1, + 0xc826aff176ba9a29, 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, + 0x8aac4c04213d26aa, 0xecd584f402152e19, 0x89f5805801f25a66, + 0xbad7cab9c4062ffc, 0xb6715b7275106bc1, 0x53112b0cc2123035, + 0x8ec585926ed7af58, 0xce4722d4b56cd330, 0x14041ab000c9c396, + 0x928220385ce8c56d, 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, + 0x76c882042e57f707, 0xd13e73308658ad1f, 0x5142eb4c19644e7d, + 0x23def41d77db2d38, 0x34affa8555d23fd9, 0xa311951efe71188d, + 0xf96089370f7fa0a7, 0xb0899dfea0b44c26); +} + +// Segment-3 +void TEST_CASE2_8_m(void) { + VSET(-1, e8, m1); + volatile uint8_t INP1[] = { + 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9, 0xaa, 0x71, + 0xf0, 0xc3, 0x94, 0xbb, 0xd3, 0x31, 0x4a, 0x57, 0x6b, 0x83, 0x7d, + 0x1a, 0x45, 0xb2, 0xda, 0x22, 0x56, 0x63, 0x8c, 0xf7, 0x3e, 0x6c, + 0x27, 0x74, 0x9d, 0xab, 0xcd, 0x13, 0x38, 0x5e, 0x42, 0xdf, 0x80, + 0x60, 0xa4, 0x7b, 0x0b, 0xc6, 0xad, 0x91, 0xec, 0x3c, 0x69, 0xf5, + 0x18, 0xe8, 0x6d, 0xb9, 0x82, 0x97, 0x2a, 0x51, 0x70}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + stride = 3; + VSET(8, e8, m1); + VLOAD_8(v0, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA); + VSET(22, e8, m1); + asm volatile("vlsseg3e8.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg3e8.v v1, (%0), %1, v0.t" ::"r"(ALIGNED_O8), "r"(stride)); + VVCMP_U8(10, ALIGNED_O8, 0, 0, 0, 0x20, 0x8f, 0x2e, 0, 0, 0, 0xaa, 0x71, 0xf0, + 0, 0, 0, 0xd3, 0x31, 0x4a, 0, 0, 0, 0x7d, 0x1a, 0x45, 0, 0, 0, 0x56, + 0x63, 0x8c, 0, 0, 0, 0x27, 0x74, 0x9d); +} + +// Segment-8 +void TEST_CASE4_64_m(void) { + VSET(-1, e64, m1); + volatile uint64_t INP1[] = { + 0xfa3a99086b4b64aa, 0x57bb4a671118fdc0, 0xbb8df43b65bac0d2, + 0xa41351c301c72b5b, 0x511e175802d24608, 0x64d7a5514d544e52, + 0xbf1d53ca3e3c6bf7, 0xd31ac04eea8ecc07, 0x52edd3cfec205090, + 0x891a1820b423c29c, 0xfc8e3370b171c315, 0xa30da5c56e052f67, + 0x9f79ec1cdf33c0bc, 0x5d2c78d9927dfa33, 0x52b80462b7e072f9, + 0x3e0efee7a99a28e7, 0x3216edfad69d8286, 0x7409095aa2433e2e, + 0x45efda30062c904b, 0x2b707d3fbaef7019, 0xde9483fe82609c40, + 0x9d5e63fed3019ea6, 0xc4bae94e8d757c0f, 0x7c917722900ef4d8, + 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, 0xd77ba2e13e47d589, + 0x45887508688c93b2, 0xac730ac471f57a8e, 0x708ca6623c11c1ff, + 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0x3adf5823d1051252, + 0xc31b51ef18e6dc16, 0xa96c56ed56947466, 0x5e0f5c76fdd72450, + 0xada6b728b9b84f27, 0x9ef5b07ca6742028, 0x2d52c2213e1497ab, + 0x201b60e0fbbc4acd, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, + 0xb6715b7275106bc1, 0x53112b0cc2123035, 0x8ec585926ed7af58, + 0xce4722d4b56cd330, 0x14041ab000c9c396, 0x928220385ce8c56d, + 0xdb402f4b0fd38776, 0x180002d7d73b1ae2, 0x76c882042e57f707, + 0xd13e73308658ad1f, 0x5142eb4c19644e7d, 0x23def41d77db2d38, + 0x34affa8555d23fd9, 0xa311951efe71188d, 0xf96089370f7fa0a7, + 0xb0899dfea0b44c26}; + + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + stride = 64; + VSET(8, e8, m1); + VLOAD_8(v0, 0xA8, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA); + VSET(8, e64, m1); + asm volatile("vlsseg8e64.v v1, (%0), %1" ::"r"(INP1), "r"(stride)); + asm volatile("vssseg8e64.v v1, (%0), %1, v0.t" ::"r"(ALIGNED_O64), + "r"(stride)); + VVCMP_U64(11, ALIGNED_O64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x693f603446fb64e6, 0x42cb1e2132c3d7d5, + 0xd77ba2e13e47d589, 0x45887508688c93b2, 0xac730ac471f57a8e, + 0x708ca6623c11c1ff, 0x90c7d0d2a8aa883c, 0xdb0427f14bb4d5ba, 0, 0, 0, + 0, 0, 0, 0, 0, 0x5428920ecca684b1, 0xc826aff176ba9a29, + 0x6f8c8820840f716e, 0x4a2bb5a96b1f24f5, 0x8aac4c04213d26aa, + 0xecd584f402152e19, 0x89f5805801f25a66, 0xbad7cab9c4062ffc, 0, 0, 0, + 0, 0, 0, 0, 0, 0x76c882042e57f707, 0xd13e73308658ad1f, + 0x5142eb4c19644e7d, 0x23def41d77db2d38, 0x34affa8555d23fd9, + 0xa311951efe71188d, 0xf96089370f7fa0a7, 0xb0899dfea0b44c26); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1_8(); + MEM_VCLEAR(ALIGNED_O8); + TEST_CASE2_8(); + MEM_VCLEAR(ALIGNED_O8); + + TEST_CASE4_16(); + MEM_VCLEAR(ALIGNED_O16); + + TEST_CASE2_32(); + MEM_VCLEAR(ALIGNED_O32); + + TEST_CASE1_64(); + MEM_VCLEAR(ALIGNED_O64); + TEST_CASE4_64(); + MEM_VCLEAR(ALIGNED_O64); + + // Masked // Todo: fix masked + // TEST_CASE2_8_m(); + // TEST_CASE4_64_m(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vssub.c b/apps/riscv-tests/isa/rv64uv/vssub.c new file mode 100644 index 0000000..bf36c49 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vssub.c @@ -0,0 +1,68 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 0xfffffff0, 0x7FFFFFFC, 15, 20); + VLOAD_32(v2, 0x7ffffff0, -500, 3, 25); + __asm__ volatile("vssub.vv v3, v1, v2" ::); + VCMP_U32(1, v3, 0x80000000, 0x7fffffff, 12, -5); + read_vxsat(vxsat); + check_vxsat(1, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE2(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 0xfffffff0, 0x7FFFFFFC, 15, 20); + VLOAD_32(v2, 0x7ffffff0, -500, 3, 25); + VLOAD_32(v0, 10, 0, 0, 0); + VCLEAR(v3); + __asm__ volatile("vssub.vv v3, v1, v2, v0.t" ::); + VCMP_U32(1, v3, 0, 0x7fffffff, 0, -5); + read_vxsat(vxsat); + check_vxsat(2, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE3(void) { + uint64_t vxsat; + VSET(4, e32, m1); + VLOAD_32(v1, 5, -2147483645, 15, 20); + const int64_t scalar = 5; + __asm__ volatile("vssub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(3, v3, 0, 0x80000000, 10, 15); + read_vxsat(vxsat); + check_vxsat(3, vxsat, 1); + reset_vxsat; +} + +void TEST_CASE4(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, -2147483645, 15, 20); + const int64_t scalar = 5; + VLOAD_32(v0, 10, 0, 0, 0); + VCLEAR(v3); + __asm__ volatile("vssub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(4, v3, 0, 0x80000000, 0, 15); + reset_vxsat; +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vssubu.c b/apps/riscv-tests/isa/rv64uv/vssubu.c new file mode 100644 index 0000000..b05e514 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vssubu.c @@ -0,0 +1,55 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20); + VLOAD_32(v2, 1, 2, 3, 25); + __asm__ volatile("vssubu.vv v3, v1, v2" ::); + VCMP_U32(1, v3, 4, 8, 12, 0); +} + +void TEST_CASE2(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20); + VLOAD_32(v2, 1, 2, 3, 120); + VLOAD_32(v0, 10, 0, 0, 0); + VCLEAR(v3); + __asm__ volatile("vssubu.vv v3, v1, v2, v0.t" ::); + VCMP_U32(2, v3, 0, 8, 0, 0); +} + +void TEST_CASE3(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, 1, 15, 20); + const uint64_t scalar = 5; + __asm__ volatile("vssubu.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(3, v3, 0, 0, 10, 15); +} + +void TEST_CASE4(void) { + VSET(4, e32, m1); + VLOAD_32(v1, 5, 1, 15, 20); + const uint64_t scalar = 5; + VLOAD_32(v0, 10, 0, 0, 0); + VCLEAR(v3); + __asm__ volatile("vssubu.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(4, v3, 0, 0, 0, 15); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + enable_fp(); + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsub.c b/apps/riscv-tests/isa/rv64uv/vsub.c new file mode 100644 index 0000000..4a1258f --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsub.c @@ -0,0 +1,136 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vsub.vv v3, v1, v2"); + VCMP_U8(1, v3, 4, 8, 12, 16, 20, 24, 28, 32, 4, 8, 12, 16, 20, 24, 28, 32); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vsub.vv v3, v1, v2"); + VCMP_U16(2, v3, 4, 8, 12, 16, 20, 24, 28, 32, 4, 8, 12, 16, 20, 24, 28, 32); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vsub.vv v3, v1, v2"); + VCMP_U32(3, v3, 4, 8, 12, 16, 20, 24, 28, 32, 4, 8, 12, 16, 20, 24, 28, 32); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vsub.vv v3, v1, v2"); + VCMP_U64(4, v3, 4, 8, 12, 16, 20, 24, 28, 32, 4, 8, 12, 16, 20, 24, 28, 32); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vv v3, v1, v2, v0.t"); + VCMP_U8(5, v3, 0, 8, 0, 16, 0, 24, 0, 32, 0, 8, 0, 16, 0, 24, 0, 32); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vv v3, v1, v2, v0.t"); + VCMP_U16(6, v3, 0, 8, 0, 16, 0, 24, 0, 32, 0, 8, 0, 16, 0, 24, 0, 32); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vv v3, v1, v2, v0.t"); + VCMP_U32(7, v3, 0, 8, 0, 16, 0, 24, 0, 32, 0, 8, 0, 16, 0, 24, 0, 32); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vv v3, v1, v2, v0.t"); + VCMP_U32(8, v3, 0, 8, 0, 16, 0, 24, 0, 32, 0, 8, 0, 16, 0, 24, 0, 32); +} + +void TEST_CASE3(void) { + const uint64_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v3, 0, 5, 10, 15, 20, 25, 30, 35, 0, 5, 10, 15, 20, 25, 30, 35); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v3, 0, 5, 10, 15, 20, 25, 30, 35, 0, 5, 10, 15, 20, 25, 30, 35); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v3, 0, 5, 10, 15, 20, 25, 30, 35, 0, 5, 10, 15, 20, 25, 30, 35); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + asm volatile("vsub.vx v3, v1, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v3, 0, 5, 10, 15, 20, 25, 30, 35, 0, 5, 10, 15, 20, 25, 30, 35); +} + +void TEST_CASE4(void) { + const uint64_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v3, 0, 5, 0, 15, 0, 25, 0, 35, 0, 5, 0, 15, 0, 25, 0, 35); + + VSET(16, e16, m1); + VLOAD_16(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v3, 0, 5, 0, 15, 0, 25, 0, 35, 0, 5, 0, 15, 0, 25, 0, 35); + + VSET(16, e32, m1); + VLOAD_32(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v3, 0, 5, 0, 15, 0, 25, 0, 35, 0, 5, 0, 15, 0, 25, 0, 35); + + VSET(16, e64, m1); + VLOAD_64(v1, 5, 10, 15, 20, 25, 30, 35, 40, 5, 10, 15, 20, 25, 30, 35, 40); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v3); + asm volatile("vsub.vx v3, v1, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v3, 0, 5, 0, 15, 0, 25, 0, 35, 0, 5, 0, 15, 0, 25, 0, 35); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsux.c b/apps/riscv-tests/isa/rv64uv/vsux.c new file mode 100644 index 0000000..5f21ec8 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsux.c @@ -0,0 +1,104 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e8, m1); + VLOAD_U8(v2, 0, 1, 2, 3); + volatile uint8_t OUP[] = {0xef, 0xef, 0xef, 0xef}; + VLOAD_U8(v1, 0xff, 0x00, 0xf0, 0x0f); + __asm__ volatile("vsuxei8.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U8_RAW(1, OUP, 0xff, 0x00, 0xf0, 0x0f); +} + +// void TEST_CASE2(void) { +// VSET(4,e8,m1); +// VLOAD_U8(v2,0,1,2,3); +// volatile uint8_t OUP[] = {0xef, 0xef, 0xef, 0xef}; +// VLOAD_U8(v1,0xff,0x00,0xf0,0x0f); +// VLOAD_U8(v0,0x12,0x0,0x0,0x0); +// __asm__ volatile("vsuxei8.v v1, (%0), v2, v0.t"::"r"(OUP)); +// VEC_EQUAL_U8_RAW(2,OUP,0xef,0x00,0xef,0xef); +// } + +void TEST_CASE3(void) { + VSET(4, e16, m1); + VLOAD_U16(v2, 0, 2, 4, 6); + volatile uint16_t OUP[] = {0xdead, 0xbeef, 0xdead, 0xbeef}; + VLOAD_U16(v1, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + __asm__ volatile("vsuxei16.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U16_RAW(3, OUP, 0xffff, 0x0000, 0xf0f0, 0x0f0f); +} + +// void TEST_CASE4(void) { +// VSET(4,e16,m1); +// VLOAD_U16(v2,0,2,4,6); +// volatile uint16_t OUP[] = {0xdead, 0xbeef, 0xdead, 0xbeef}; +// VLOAD_U16(v1,0xffff,0x0000,0xf0f0,0x0f0f); +// VLOAD_U16(v0,0x12,0x0,0x0,0x0); +// __asm__ volatile("vsuxei16.v v1, (%0), v2, v0.t"::"r"(OUP)); +// MEMBARRIER; +// VEC_EQUAL_U16_RAW(4,OUP,0xdead,0x0000,0xdead,0xbeef); +// } + +void TEST_CASE5(void) { + VSET(4, e32, m1); + VLOAD_U32(v2, 0, 4, 8, 12); + volatile uint32_t OUP[] = {0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef}; + VLOAD_U32(v1, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f); + __asm__ volatile("vsuxei32.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U32_RAW(5, OUP, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f); +} + +// void TEST_CASE6(void) { +// VSET(4,e32,m1); +// VLOAD_U32(v2,0,4,8,12); +// volatile uint32_t OUP[] = {0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef}; +// VLOAD_U32(v1,0xffffffff,0x00000000,0xf0f0f0f0,0x0f0f0f0f); +// VLOAD_U32(v0,0x12,0x0,0x0,0x0); +// __asm__ volatile("vsuxei32.v v1, (%0), v2, v0.t"::"r"(OUP)); +// MEMBARRIER; +// VEC_EQUAL_U32_RAW(6,OUP,0xdeadbeef,0x00000000,0xdeadbeef,0xdeadbeef); +// } + +void TEST_CASE7(void) { + VSET(4, e64, m1); + VLOAD_U64(v2, 0, 8, 16, 24); + volatile uint64_t OUP[] = {0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef}; + VLOAD_U64(v1, 0xdeadbeef00000000, 0xdeadbeefffffffff, 0xdeadbeeff0f0f0f0, + 0xdeadbeef0f0f0f0f); + __asm__ volatile("vsuxei64.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U64_RAW(7, OUP, 0xdeadbeef00000000, 0xdeadbeefffffffff, + 0xdeadbeeff0f0f0f0, 0xdeadbeef0f0f0f0f); +} + +// void TEST_CASE8(void) { +// VSET(4,e64,m1); +// VLOAD_U64(v2,0,8,16,24); +// volatile uint64_t OUP[] = +// {0xdeadbeefdeadbeef,0xdeadbeefdeadbeef,0xdeadbeefdeadbeef,0xdeadbeefdeadbeef}; +// VLOAD_U64(v1,0xdeadbeef00000000,0xdeadbeefffffffff,0xdeadbeeff0f0f0f0,0xdeadbeef0f0f0f0f); +// VLOAD_U64(v0,0x6,0x0,0x0,0x0); +// __asm__ volatile("vsuxei64.v v1, (%0), v2, v0.t"::"r"(OUP)); +// VEC_EQUAL_U64_RAW(8,OUP,0xdeadbeefdeadbeef,0xdeadbeefffffffff,0xdeadbeeff0f0f0f0,0xdeadbeefdeadbeef); +// } + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE3(); + TEST_CASE5(); + TEST_CASE7(); + // TEST_CASE2(); + // TEST_CASE4(); + // TEST_CASE6(); + // TEST_CASE8(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsuxei.c b/apps/riscv-tests/isa/rv64uv/vsuxei.c new file mode 100644 index 0000000..8709d66 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsuxei.c @@ -0,0 +1,141 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH 128 + +#define INIT 98 + +void reset_vec8(volatile uint8_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +void reset_vec16(volatile uint16_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +void reset_vec32(volatile uint32_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +void reset_vec64(volatile uint64_t *vec, int rst_val, uint64_t len) { + for (uint64_t i = 0; i < len; ++i) + vec[i] = rst_val; +} +static volatile uint8_t BUFFER_O8[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; +static volatile uint16_t BUFFER_O16[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; +static volatile uint32_t BUFFER_O32[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; +static volatile uint64_t BUFFER_O64[16] __attribute__((aligned(AXI_DWIDTH))) = { + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT, + INIT, INIT, INIT, INIT, INIT, INIT, INIT, INIT}; + +// Naive test +void TEST_CASE1(void) { + VSET(12, e8, m1); + VLOAD_8(v1, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x88, 0x88, 0xae, 0x91, 0x02, 0x59, + 0x89); + VLOAD_8(v2, 1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 13, 15); + asm volatile("vsuxei8.v v1, (%0), v2" ::"r"(&BUFFER_O8[0])); + VVCMP_U8(1, BUFFER_O8, INIT, 0xd3, 0x40, 0xd1, 0x84, 0x48, INIT, 0x88, 0x88, + 0xae, INIT, 0x91, 0x02, 0x59, INIT, 0x89); + + VSET(12, e16, m1); + VLOAD_16(v1, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x9388, 0x8188, 0x11ae, + 0x4891, 0x4902, 0x8759, 0x1989); + VLOAD_16(v2, 2, 4, 6, 8, 10, 14, 16, 18, 22, 24, 26, 30); + asm volatile("vsuxei16.v v1, (%0), v2" ::"r"(&BUFFER_O16[0])); + VVCMP_U16(2, BUFFER_O16, INIT, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, INIT, + 0x9388, 0x8188, 0x11ae, INIT, 0x4891, 0x4902, 0x8759, INIT, 0x1989); + + VSET(12, e32, m1); + VLOAD_32(v1, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x81937598, 0x18747547, 0x3eeeeeee, 0xab8b9148, 0x90318509, + 0x31897598, 0x89139848); + VLOAD_32(v2, 4, 8, 12, 16, 20, 28, 32, 36, 44, 48, 52, 60); + asm volatile("vsuxei32.v v1, (%0), v2" ::"r"(&BUFFER_O32[0])); + VVCMP_U32(3, BUFFER_O32, INIT, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, + 0x38197598, INIT, 0x81937598, 0x18747547, 0x3eeeeeee, INIT, + 0xab8b9148, 0x90318509, 0x31897598, INIT, 0x89139848); + + VSET(12, e64, m1); + VLOAD_64(v1, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8913984898951989); + VLOAD_64(v2, 8, 16, 24, 32, 40, 56, 64, 72, 88, 96, 104, 120); + asm volatile("vsuxei64.v v1, (%0), v2" ::"r"(&BUFFER_O64[0])); + VVCMP_U64(4, BUFFER_O64, INIT, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, + 0x99991348a9f38cd1, 0x9fa831c7a11a9384, 0x3819759853987548, INIT, + 0x81937598aa819388, 0x1874754791888188, 0x3eeeeeeee33111ae, INIT, + 0xab8b914891484891, 0x9031850931584902, 0x3189759837598759, INIT, + 0x8913984898951989); +} + +// Naive test, masked +void TEST_CASE2(void) { + reset_vec8(&BUFFER_O8[0], INIT, 16); + VSET(12, e8, m1); + VLOAD_8(v0, 0xAA, 0x0A); + VLOAD_8(v1, 0xd3, 0x40, 0xd1, 0x84, 0x48, 0x88, 0x88, 0xae, 0x91, 0x02, 0x59, + 0x89); + VLOAD_8(v2, 1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 13, 15); + asm volatile("vsuxei8.v v1, (%0), v2, v0.t" ::"r"(&BUFFER_O8[0])); + VVCMP_U8(5, BUFFER_O8, INIT, INIT, 0x40, INIT, 0x84, INIT, INIT, 0x88, INIT, + 0xae, INIT, INIT, 0x02, INIT, INIT, 0x89); + + reset_vec16(&BUFFER_O16[0], INIT, 16); + VSET(12, e16, m1); + VLOAD_8(v0, 0xAA, 0x0A); + VLOAD_16(v1, 0xbbd3, 0x3840, 0x8cd1, 0x9384, 0x7548, 0x9388, 0x8188, 0x11ae, + 0x4891, 0x4902, 0x8759, 0x1989); + VLOAD_16(v2, 2, 4, 6, 8, 10, 14, 16, 18, 22, 24, 26, 30); + asm volatile("vsuxei16.v v1, (%0), v2, v0.t" ::"r"(&BUFFER_O16[0])); + VVCMP_U16(6, BUFFER_O16, INIT, INIT, 0x3840, INIT, 0x9384, INIT, INIT, 0x9388, + INIT, 0x11ae, INIT, INIT, 0x4902, INIT, INIT, 0x1989); + + reset_vec32(&BUFFER_O32[0], INIT, 16); + VSET(12, e32, m1); + VLOAD_8(v0, 0xAA, 0x0A); + VLOAD_32(v1, 0xf9aa71f0, 0xa11a9384, 0x99991348, 0x9fa831c7, 0x38197598, + 0x81937598, 0x18747547, 0x3eeeeeee, 0xab8b9148, 0x90318509, + 0x31897598, 0x89139848); + VLOAD_32(v2, 4, 8, 12, 16, 20, 28, 32, 36, 44, 48, 52, 60); + asm volatile("vsuxei32.v v1, (%0), v2, v0.t" ::"r"(&BUFFER_O32[0])); + VVCMP_U32(7, BUFFER_O32, INIT, INIT, 0xa11a9384, INIT, 0x9fa831c7, INIT, INIT, + 0x81937598, INIT, 0x3eeeeeee, INIT, INIT, 0x90318509, INIT, INIT, + 0x89139848); + + reset_vec64(&BUFFER_O64[0], INIT, 16); + VSET(12, e64, m1); + VLOAD_8(v0, 0xAA, 0x0A); + VLOAD_64(v1, 0xf9aa71f0c394bbd3, 0xa11a9384a7163840, 0x99991348a9f38cd1, + 0x9fa831c7a11a9384, 0x3819759853987548, 0x81937598aa819388, + 0x1874754791888188, 0x3eeeeeeee33111ae, 0xab8b914891484891, + 0x9031850931584902, 0x3189759837598759, 0x8913984898951989); + VLOAD_64(v2, 8, 16, 24, 32, 40, 56, 64, 72, 88, 96, 104, 120); + asm volatile("vsuxei64.v v1, (%0), v2, v0.t" ::"r"(&BUFFER_O64[0])); + VVCMP_U64(8, BUFFER_O64, INIT, INIT, 0xa11a9384a7163840, INIT, + 0x9fa831c7a11a9384, INIT, INIT, 0x81937598aa819388, INIT, + 0x3eeeeeeee33111ae, INIT, INIT, 0x9031850931584902, INIT, INIT, + 0x8913984898951989); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsuxseg.c b/apps/riscv-tests/isa/rv64uv/vsuxseg.c new file mode 100644 index 0000000..c2aaff3 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsuxseg.c @@ -0,0 +1,196 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +#define AXI_DWIDTH_MAX 512 +#define MEM_VEC_SIZE 64 + +#define MEM_VCLEAR(vec) \ + { \ + for (int i = 0; i < MEM_VEC_SIZE; ++i) \ + vec[i] = 0; \ + } + +static volatile uint8_t ALIGNED_O8[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static volatile uint16_t ALIGNED_O16[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; + +static volatile uint32_t ALIGNED_O32[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + +static volatile uint64_t ALIGNED_O64[MEM_VEC_SIZE] + __attribute__((aligned(AXI_DWIDTH_MAX))) = { + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, + 0x0000000000000000}; + +// Segment-2 +void TEST_CASE1_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + + MEM_VCLEAR(ALIGNED_O8); + VCLEAR(v1); + VCLEAR(v2); + VLOAD_8(v24, 1, 1, 0, 2); + asm volatile("vluxseg2ei8.v v1, (%0), v24" ::"r"(INP1)); + asm volatile("vsuxseg2ei8.v v1, (%0), v24" ::"r"(ALIGNED_O8)); + VVCMP_U8(1, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0, 0, 0, 0); +} + +// Segment-3 +void TEST_CASE2_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + + MEM_VCLEAR(ALIGNED_O8); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VLOAD_16(v24, 0, 1, 0, 3); + asm volatile("vluxseg3ei16.v v1, (%0), v24" ::"r"(INP1)); + VLOAD_16(v24, 3, 2, 1, 0); + asm volatile("vsuxseg3ei16.v v1, (%0), v24" ::"r"(ALIGNED_O8)); + VVCMP_U8(2, ALIGNED_O8, 0x20, 0x8f, 0x2e, 0x19, 0x20, 0x19); +} + +// Segment-4 +void TEST_CASE3_8(void) { + VSET(4, e8, m1); + volatile uint8_t INP1[] = {0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, + 0xf9, 0xaa, 0x71, 0xf0, 0xc3, 0x94, 0xbb, 0xd3}; + + MEM_VCLEAR(ALIGNED_O8); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VLOAD_64(v24, 1, 1, 0, 5); + asm volatile("vluxseg4ei64.v v1, (%0), v24" ::"r"(INP1)); + asm volatile("vsuxseg4ei64.v v1, (%0), v24" ::"r"(ALIGNED_O8)); + VVCMP_U8(3, ALIGNED_O8, 0x9f, 0xe4, 0x19, 0x20, 0x8f, 0x2e, 0x05, 0xe0, 0xf9); +} + +// Segment-4 for 64-bit +void TEST_CASE3_64(void) { + VSET(4, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + + MEM_VCLEAR(ALIGNED_O64); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VLOAD_8(v24, 8, 8, 0, 40); + asm volatile("vluxseg4ei8.v v1, (%0), v24" ::"r"(INP1)); + asm volatile("vsuxseg4ei8.v v1, (%0), v24" ::"r"(ALIGNED_O64)); + VVCMP_U64(4, ALIGNED_O64, 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, + 0x123456789abcdef0, 0x13572468369b48ac, 0xdeadbeefcafebabe, + 0x0123456789abcdef, 0x55aa55aa77889900, 0xabcdef1234567890, + 0xfeedfacecafebabe, 0); +} + +// Segment-8 for 64-bit +void TEST_CASE4_64_m(void) { + VSET(2, e64, m1); + volatile uint64_t INP1[] = { + 0x9fe419208f2e05e0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef, + 0xcafebabe12345678, 0xabcdef0987654321, 0x012345670abcdef1, + 0x987654321fedcba0}; + + MEM_VCLEAR(ALIGNED_O64); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xAF, 0xAA); + VLOAD_8(v24, 8, 32); + asm volatile("vluxseg8ei8.v v1, (%0), v24" ::"r"(INP1)); + asm volatile("vsuxseg8ei8.v v1, (%0), v24, v0.t" ::"r"(ALIGNED_O64)); + VVCMP_U64(5, ALIGNED_O64, 0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef); + + MEM_VCLEAR(ALIGNED_O64); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xAA, 0xAA); + VLOAD_8(v24, 8, 32); + asm volatile("vluxseg8ei8.v v1, (%0), v24" ::"r"(INP1)); + asm volatile("vsuxseg8ei8.v v1, (%0), v24, v0.t" ::"r"(ALIGNED_O64)); + VVCMP_U64(6, ALIGNED_O64, 0, 0, 0, 0, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, + 0x123456789abcdef0, 0x1357246855aa55aa, 0x369b48acdeadbeef); + + MEM_VCLEAR(ALIGNED_O64); + VCLEAR(v1); + VCLEAR(v2); + VCLEAR(v3); + VCLEAR(v4); + VCLEAR(v5); + VCLEAR(v6); + VCLEAR(v7); + VCLEAR(v8); + VLOAD_8(v0, 0xA1, 0xAA); + VLOAD_32(v24, 8, 32); + asm volatile("vluxseg8ei32.v v1, (%0), v24" ::"r"(INP1)); + asm volatile("vsuxseg8ei32.v v1, (%0), v24, v0.t" ::"r"(ALIGNED_O64)); + VVCMP_U64(7, ALIGNED_O64, 0, 0xf9aa71f0c394bbd3, 0x123456789abcdef0, + 0x13572468369b48ac, 0xdeadbeefcafebabe, 0x0123456789abcdef, + 0x55aa55aa77889900, 0xabcdef1234567890, 0xfeedfacecafebabe, 0, 0, + 0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1_8(); + TEST_CASE2_8(); + TEST_CASE3_8(); + + TEST_CASE3_64(); + + // Masked + TEST_CASE4_64_m(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vsx.c b/apps/riscv-tests/isa/rv64uv/vsx.c new file mode 100644 index 0000000..fc91e81 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vsx.c @@ -0,0 +1,102 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(4, e8, m1); + VLOAD_U8(v2, 0, 1, 2, 3); + volatile uint8_t OUP[] = {0xef, 0xef, 0xef, 0xef}; + VLOAD_U8(v1, 0xff, 0x00, 0xf0, 0x0f); + __asm__ volatile("vsxei8.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U8_RAW(1, OUP, 0xff, 0x00, 0xf0, 0x0f); +} + +// void TEST_CASE2(void) { +// VSET(4,e8,m1); +// VLOAD_8(v2,0,1,2,3); +// volatile int8_t OUP[] = {0xef, 0xef, 0xef, 0xef}; +// VLOAD_8(v1,0xff,0x00,0xf0,0x0f); +// VLOAD_8(v0,12,0,0,0); +// __asm__ volatile("vsxei8.v v1, (%0), v2, v0.t"::"r"(OUP)); +// VEC_EQUAL_8_RAW(2,OUP,0xef,0xef,0xf0,0x0f); +// } + +void TEST_CASE3(void) { + VSET(4, e16, m1); + VLOAD_U16(v2, 0, 2, 4, 6); + volatile uint16_t OUP[] = {0xdead, 0xbeef, 0xdead, 0xbeef}; + VLOAD_U16(v1, 0xffff, 0x0000, 0xf0f0, 0x0f0f); + __asm__ volatile("vsxei16.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U16_RAW(3, OUP, 0xffff, 0x0000, 0xf0f0, 0x0f0f); +} + +// void TEST_CASE4(void) { +// VSET(4,e16,m1); +// VLOAD_16(v2,0,2,4,6); +// volatile int16_t OUP[] = {0xdead, 0xbeef, 0xdead, 0xbeef}; +// VLOAD_16(v1,0xffff,0x0000,0xf0f0,0x0f0f); +// VLOAD_16(v0,12,0,0,0); +// __asm__ volatile("vsxei16.v v1, (%0), v2, v0.t"::"r"(OUP)); +// VEC_EQUAL_16_RAW(4,OUP,0xdead,0xbeef,0xf0f0,0x0f0f); +// } + +void TEST_CASE5(void) { + VSET(4, e32, m1); + VLOAD_U32(v2, 0, 4, 8, 12); + volatile uint32_t OUP[] = {0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef}; + VLOAD_U32(v1, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f); + __asm__ volatile("vsxei32.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U32_RAW(5, OUP, 0xffffffff, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f); +} + +// void TEST_CASE6(void) { +// VSET(4,e32,m1); +// VLOAD_U32(v2,0,4,8,12); +// volatile int32_t OUP[] = {0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef}; +// VLOAD_32(v1,0xffffffff,0x00000000,0xf0f0f0f0,0x0f0f0f0f); +// VLOAD_32(v0,12,0,0,0); +// __asm__ volatile("vsxei32.v v1, (%0), v2, v0.t"::"r"(OUP)); +// VEC_EQUAL_32_RAW(6,OUP,0xdeadbeef,0xdeadbeef,0xf0f0f0f0,0x0f0f0f0f); +// } + +void TEST_CASE7(void) { + VSET(4, e64, m1); + VLOAD_U64(v2, 0, 8, 16, 24); + volatile uint64_t OUP[] = {0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef}; + VLOAD_U64(v1, 0xdeadbeef00000000, 0xdeadbeefffffffff, 0xdeadbeeff0f0f0f0, + 0xdeadbeef0f0f0f0f); + __asm__ volatile("vsxei64.v v1, (%0), v2" ::"r"(OUP)); + VEC_EQUAL_U64_RAW(7, OUP, 0xdeadbeef00000000, 0xdeadbeefffffffff, + 0xdeadbeeff0f0f0f0, 0xdeadbeef0f0f0f0f); +} + +// void TEST_CASE8(void) { +// VSET(4,e64,m1); +// VLOAD_64(v2,0,8,16,24); +// volatile int64_t OUP[] = +// {0xdeadbeefdeadbeef,0xdeadbeefdeadbeef,0xdeadbeefdeadbeef,0xdeadbeefdeadbeef}; +// VLOAD_64(v1,0xdeadbeef00000000,0xdeadbeefffffffff,0xdeadbeeff0f0f0f0,0xdeadbeef0f0f0f0f); +// VLOAD_64(v0,6,0,0,0); +// __asm__ volatile("vsxei64.v v1, (%0), v2, v0.t"::"r"(OUP)); +// VEC_EQUAL_64_RAW(8,OUP,0xdeadbeefdeadbeef,0xdeadbeefffffffff,0xdeadbeeff0f0f0f0,0xdeadbeefdeadbeef); +// } + +int main(void) { + INIT_CHECK(); + enable_vec(); + TEST_CASE1(); + TEST_CASE3(); + TEST_CASE5(); + TEST_CASE7(); + // TEST_CASE2(); + // TEST_CASE4(); + // TEST_CASE6(); + // TEST_CASE8(); + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwadd.c b/apps/riscv-tests/isa/rv64uv/vwadd.c new file mode 100644 index 0000000..ccd5fdb --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwadd.c @@ -0,0 +1,228 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwadd.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(1, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwadd.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(2, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwadd.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(3, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(4, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(5, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(6, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); +} + +void TEST_CASE3(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwadd.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(7, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwadd.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(8, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwadd.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(9, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); +} + +void TEST_CASE4(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(10, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(11, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(12, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); +} + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwadd.wv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(13, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwadd.wv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(14, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwadd.wv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(15, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); +} + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.wv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(16, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.wv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(17, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.wv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(18, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); +} + +void TEST_CASE7(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwadd.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(19, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwadd.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(20, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwadd.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(21, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); +} + +void TEST_CASE8(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(22, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(23, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwadd.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(24, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwaddu.c b/apps/riscv-tests/isa/rv64uv/vwaddu.c new file mode 100644 index 0000000..b913556 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwaddu.c @@ -0,0 +1,231 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwaddu.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(1, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwaddu.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(2, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwaddu.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(3, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(4, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(5, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(6, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); +} + +void TEST_CASE3(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwaddu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(7, v6, 6, 259, 8, 257, 10, 255, 12, 253, 14, 251, 16, 249, 18, 247, + 20, 245); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwaddu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(8, v6, 6, 65539, 8, 65537, 10, 65535, 12, 65533, 14, 65531, 16, + 65529, 18, 65527, 20, 65525); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwaddu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(9, v6, 6, 4294967299, 8, 4294967297, 10, 4294967295, 12, 4294967293, + 14, 4294967291, 16, 4294967289, 18, 4294967287, 20, 4294967285); +} + +void TEST_CASE4(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(10, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(11, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(12, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); +} + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwaddu.wv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(13, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwaddu.wv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(14, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwaddu.wv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(15, v6, 2, 4, 6, 8, 10, 12, 14, 16, 2, 4, 6, 8, 10, 12, 14, 16); +} + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.wv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(16, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.wv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(17, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.wv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(18, v6, 0, 4, 0, 8, 0, 12, 0, 16, 0, 4, 0, 8, 0, 12, 0, 16); +} + +void TEST_CASE7(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwaddu.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(19, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwaddu.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(20, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwaddu.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(21, v6, 6, 3, 8, 1, 10, -1, 12, -3, 14, -5, 16, -7, 18, -9, 20, -11); +} + +void TEST_CASE8(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(22, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(23, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwaddu.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(24, v6, 0, 7, 0, 9, 0, 11, 0, 13, 0, 7, 0, 9, 0, 11, 0, 13); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmacc.c b/apps/riscv-tests/isa/rv64uv/vwmacc.c new file mode 100644 index 0000000..fa228a1 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmacc.c @@ -0,0 +1,248 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x460f, 0x1c3e, 0xa322, 0xa7de, 0xd343, 0xa068, 0xf7a8, 0x3a62, + 0x3f7f, 0x0ae0, 0x0e38, 0x57fe, 0xdc97, 0x61e5, 0xe3f4, 0xb1bd); + VSET(16, e8, m1); + VLOAD_8(v2, 0x19, 0x87, 0x46, 0xf5, 0x3d, 0x66, 0xd7, 0xcf, 0x9f, 0x73, 0x35, + 0x92, 0xb4, 0xc4, 0xdb, 0x1a); + VLOAD_8(v4, 0xd0, 0x62, 0xb7, 0xd9, 0x39, 0xdf, 0x3e, 0x3d, 0xa2, 0xbb, 0xf1, + 0xba, 0xe2, 0xd7, 0x51, 0x5d); + asm volatile("vwmacc.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_I16(1, v6, 0x415f, 0xedec, 0x8f2c, 0xa98b, 0xe0d8, 0x9342, 0xedba, + 0x2eb5, 0x631d, 0xebe1, 0x0b1d, 0x7612, 0xe57f, 0x6b81, 0xd83f, + 0xbb2f); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x1d5e4130, 0x9a736c84, 0xe2c407c1, 0x62baf7c8, 0xc157159f, + 0x6cea275d, 0x0c385a3e, 0xf8f640d1, 0x484e89df, 0xb7720e91, + 0x17a7a4cf, 0x9cba6dac, 0x177e67d2, 0x491950da, 0x5b48691f, + 0x03289e10); + VSET(16, e16, m1); + VLOAD_16(v2, 0x6930, 0x239f, 0x2214, 0x555e, 0x9868, 0x02e7, 0x784f, 0x8c32, + 0xe8d1, 0xe941, 0xaaaf, 0x4833, 0xc773, 0x6156, 0xdad9, 0x02a5); + VLOAD_16(v4, 0xe798, 0x1fe5, 0xca4f, 0xb93c, 0xafe4, 0x5641, 0x4848, 0x82a3, + 0x6065, 0x1385, 0x5a53, 0x3318, 0xd488, 0xb1cf, 0x5142, 0x0277); + asm volatile("vwmacc.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_I32(2, v6, 0x135705b0, 0x9ee38abf, 0xdb9e53ed, 0x4b21e7d0, 0xe1c1ea3f, + 0x6de47e04, 0x2e306876, 0x31abe8a7, 0x3f93c454, 0xb5b61056, + 0xf98d818c, 0xab235b74, 0x211898ea, 0x2b5e7b64, 0x4f7d7e11, + 0x032f22c3); + + VSET(16, e64, m1); + VLOAD_64(v6, 0x37abc1433be408eb, 0xb3af312be2d38e09, 0x3a99dc46913b03d2, + 0xb2cca27c11815d4d, 0x456749124aaf479a, 0xc11d5ef0eaa5ee72, + 0x1e6a624541e03978, 0x36ce0e391abb8a91, 0x552a61c1f7116723, + 0x621ae1e17b7074c2, 0x4c3f1888b5df72b9, 0xde3961024df8c2cf, + 0x37cd59f214853904, 0xe76372440eb37d3d, 0x0f0ff8cee2000142, + 0x061e905b827b9818); + VSET(16, e32, m1); + VLOAD_32(v2, 0xb5c0475b, 0xda0c4af7, 0xa939123e, 0xb7261aa3, 0x510b75c1, + 0x7d5e66d9, 0x3b263bb7, 0xc35c07a0, 0x03b0bb28, 0xba423d88, + 0xb4ddeabb, 0x97b1e0ce, 0x01d07d01, 0x16174f78, 0x40c6b24f, + 0x7fab39a9); + VLOAD_32(v4, 0x376ce1ba, 0x9cc53665, 0x9292669b, 0xcaec0663, 0x174f60ba, + 0x5fc79836, 0x6597295d, 0x737b18f1, 0x8cb86656, 0x044f320e, + 0x2a881643, 0x2e1a8f59, 0xfdc331d1, 0xca03d155, 0x0a51ebfe, + 0xcac2c353); + asm volatile("vwmacc.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_I64(3, v6, 0x27987c3defb2dc09, 0xc2652748b5903b7c, 0x5fb1b6348769c35c, + 0xc1e76e2cf6217c56, 0x4cc871cf26ba35d4, 0xf0052607e34f7838, + 0x35e364f04a4539f3, 0x1b733cf52ef5b831, 0x5380f57403c23693, + 0x60ee57a5b80c6232, 0x3fc390677f77f3aa, 0xcb708510404efc6d, + 0x37c94aa4ac6b77d5, 0xe2badbd70ab9d815, 0x11ac765b0dd270a4, + 0xeb91935c5ffd04e3); +} + +void TEST_CASE2() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x460f, 0x1c3e, 0xa322, 0xa7de, 0xd343, 0xa068, 0xf7a8, 0x3a62, + 0x3f7f, 0x0ae0, 0x0e38, 0x57fe, 0xdc97, 0x61e5, 0xe3f4, 0xb1bd); + VSET(16, e8, m1); + VLOAD_8(v2, 0x19, 0x87, 0x46, 0xf5, 0x3d, 0x66, 0xd7, 0xcf, 0x9f, 0x73, 0x35, + 0x92, 0xb4, 0xc4, 0xdb, 0x1a); + VLOAD_8(v4, 0xd0, 0x62, 0xb7, 0xd9, 0x39, 0xdf, 0x3e, 0x3d, 0xa2, 0xbb, 0xf1, + 0xba, 0xe2, 0xd7, 0x51, 0x5d); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmacc.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_I16(4, v6, 0x460f, 0xedec, 0xa322, 0xa98b, 0xd343, 0x9342, 0xf7a8, + 0x2eb5, 0x3f7f, 0xebe1, 0x0e38, 0x7612, 0xdc97, 0x6b81, 0xe3f4, + 0xbb2f); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x1d5e4130, 0x9a736c84, 0xe2c407c1, 0x62baf7c8, 0xc157159f, + 0x6cea275d, 0x0c385a3e, 0xf8f640d1, 0x484e89df, 0xb7720e91, + 0x17a7a4cf, 0x9cba6dac, 0x177e67d2, 0x491950da, 0x5b48691f, + 0x03289e10); + VSET(16, e16, m1); + VLOAD_16(v2, 0x6930, 0x239f, 0x2214, 0x555e, 0x9868, 0x02e7, 0x784f, 0x8c32, + 0xe8d1, 0xe941, 0xaaaf, 0x4833, 0xc773, 0x6156, 0xdad9, 0x02a5); + VLOAD_16(v4, 0xe798, 0x1fe5, 0xca4f, 0xb93c, 0xafe4, 0x5641, 0x4848, 0x82a3, + 0x6065, 0x1385, 0x5a53, 0x3318, 0xd488, 0xb1cf, 0x5142, 0x0277); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmacc.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_I32(5, v6, 0x1d5e4130, 0x9ee38abf, 0xe2c407c1, 0x4b21e7d0, 0xc157159f, + 0x6de47e04, 0x0c385a3e, 0x31abe8a7, 0x484e89df, 0xb5b61056, + 0x17a7a4cf, 0xab235b74, 0x177e67d2, 0x2b5e7b64, 0x5b48691f, + 0x032f22c3); + + VSET(16, e64, m1); + VLOAD_64(v6, 0x37abc1433be408eb, 0xb3af312be2d38e09, 0x3a99dc46913b03d2, + 0xb2cca27c11815d4d, 0x456749124aaf479a, 0xc11d5ef0eaa5ee72, + 0x1e6a624541e03978, 0x36ce0e391abb8a91, 0x552a61c1f7116723, + 0x621ae1e17b7074c2, 0x4c3f1888b5df72b9, 0xde3961024df8c2cf, + 0x37cd59f214853904, 0xe76372440eb37d3d, 0x0f0ff8cee2000142, + 0x061e905b827b9818); + VSET(16, e32, m1); + VLOAD_32(v2, 0xb5c0475b, 0xda0c4af7, 0xa939123e, 0xb7261aa3, 0x510b75c1, + 0x7d5e66d9, 0x3b263bb7, 0xc35c07a0, 0x03b0bb28, 0xba423d88, + 0xb4ddeabb, 0x97b1e0ce, 0x01d07d01, 0x16174f78, 0x40c6b24f, + 0x7fab39a9); + VLOAD_32(v4, 0x376ce1ba, 0x9cc53665, 0x9292669b, 0xcaec0663, 0x174f60ba, + 0x5fc79836, 0x6597295d, 0x737b18f1, 0x8cb86656, 0x044f320e, + 0x2a881643, 0x2e1a8f59, 0xfdc331d1, 0xca03d155, 0x0a51ebfe, + 0xcac2c353); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmacc.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_I64(6, v6, 0x37abc1433be408eb, 0xc2652748b5903b7c, 0x3a99dc46913b03d2, + 0xc1e76e2cf6217c56, 0x456749124aaf479a, 0xf0052607e34f7838, + 0x1e6a624541e03978, 0x1b733cf52ef5b831, 0x552a61c1f7116723, + 0x60ee57a5b80c6232, 0x4c3f1888b5df72b9, 0xcb708510404efc6d, + 0x37cd59f214853904, 0xe2badbd70ab9d815, 0x0f0ff8cee2000142, + 0xeb91935c5ffd04e3); +} + +void TEST_CASE3() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x17db, 0x9069, 0x8e1f, 0x3584, 0xbb3d, 0x39b2, 0x82cf, 0x015b, + 0xd556, 0xd603, 0x85d1, 0x66a6, 0x4e3e, 0xb965, 0xaa7b, 0x9d27); + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v4, 0x50, 0x56, 0x94, 0x1e, 0x09, 0x8f, 0xe1, 0x9e, 0x86, 0x97, 0x71, + 0x5e, 0x55, 0x09, 0xdd, 0x23); + asm volatile("vwmacc.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(7, v6, 0x196b, 0x9217, 0x8c03, 0x361a, 0xbb6a, 0x377d, 0x8234, + 0xff71, 0xd2f4, 0xd3f6, 0x8806, 0x687c, 0x4fe7, 0xb992, 0xa9cc, + 0x9dd6); + + VSET(16, e32, m1); + VLOAD_32(v6, 0xc9b9ade8, 0xfc9c14a8, 0xe1ace4f7, 0x43ea8b48, 0x3ab3025c, + 0xe545695b, 0x538304ce, 0xf430c148, 0xd126fac1, 0xbf51d251, + 0x85ebc0a4, 0x2167faaf, 0x0a2e18cc, 0x0ae19395, 0x03cc9899, + 0x05524f83); + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v4, 0x4324, 0xd762, 0xc34b, 0x6f67, 0x5134, 0x4d9d, 0xfa05, 0xacb7, + 0xb7d2, 0xb079, 0x5bb2, 0x7949, 0x51df, 0xbadd, 0xee81, 0x3b49); + asm volatile("vwmacc.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(8, v6, 0xc435e3ec, 0xfff226fa, 0xe6a966ea, 0x3ac40c77, 0x340785f0, + 0xdee56910, 0x5400c5ab, 0xfb080547, 0xd714ba03, 0xc5da1202, + 0x7e63a4c6, 0x1771acb0, 0x037490b3, 0x108f568a, 0x053c7e12, + 0x0073b384); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xc3afd90f697a742a, 0x585e39767c2959ab, 0xfd5f5c31e16d95ba, + 0x2c39235d58ff74a1, 0x4a793d202092aeac, 0x6d31f07b7bdfb6ea, + 0x902b8e28be41b10d, 0x89114b9383c4b511, 0x1f9a7e912f5a51f0, + 0x5494b9380432890c, 0xfd260f5f1fc1eb45, 0x80381e728c1baa95, + 0xa6be6d48744a823b, 0xd37b8ae766a82bf8, 0x7992c128f1c1f6ab, + 0xbeca06f79871e7e8); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x56545434, 0x99cd1438, 0xa1d42f8a, 0x3500b207, 0x642cd563, + 0x7405746d, 0xe92c3246, 0xdab496dc, 0xcbe26107, 0x6bb989c7, + 0xc8542e0c, 0x5849a179, 0x04aac7de, 0x7b5ce579, 0x0ce6e7ea, + 0x77402b10); + asm volatile("vwmacc.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(9, v6, 0xc3d1296f1ae893e6, 0x5836c95c6dbae113, 0xfd3b05253b5c9368, + 0x2c4d976fb318600e, 0x4a9fe54cf92b4b8d, 0x6d5eb614d7052bf9, + 0x9022bf12bc18cd4f, 0x8902e74ad235ed05, 0x1f86621f3b05e25d, + 0x54be4b3652df41b9, 0xfd1093afbdc79c49, 0x805a304537cce5a8, + 0xa6c03a5756f94905, 0xd3ab25c46d6cd30b, 0x7997bbbadd639479, + 0xbef80b96ee48ff98); +} + +void TEST_CASE4() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x17db, 0x9069, 0x8e1f, 0x3584, 0xbb3d, 0x39b2, 0x82cf, 0x015b, + 0xd556, 0xd603, 0x85d1, 0x66a6, 0x4e3e, 0xb965, 0xaa7b, 0x9d27); + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v4, 0x50, 0x56, 0x94, 0x1e, 0x09, 0x8f, 0xe1, 0x9e, 0x86, 0x97, 0x71, + 0x5e, 0x55, 0x09, 0xdd, 0x23); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmacc.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(10, v6, 0x17db, 0x9217, 0x8e1f, 0x361a, 0xbb3d, 0x377d, 0x82cf, + 0xff71, 0xd556, 0xd3f6, 0x85d1, 0x687c, 0x4e3e, 0xb992, 0xaa7b, + 0x9dd6); + + VSET(16, e32, m1); + VLOAD_32(v6, 0xc9b9ade8, 0xfc9c14a8, 0xe1ace4f7, 0x43ea8b48, 0x3ab3025c, + 0xe545695b, 0x538304ce, 0xf430c148, 0xd126fac1, 0xbf51d251, + 0x85ebc0a4, 0x2167faaf, 0x0a2e18cc, 0x0ae19395, 0x03cc9899, + 0x05524f83); + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v4, 0x4324, 0xd762, 0xc34b, 0x6f67, 0x5134, 0x4d9d, 0xfa05, 0xacb7, + 0xb7d2, 0xb079, 0x5bb2, 0x7949, 0x51df, 0xbadd, 0xee81, 0x3b49); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmacc.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(11, v6, 0xc9b9ade8, 0xfff226fa, 0xe1ace4f7, 0x3ac40c77, 0x3ab3025c, + 0xdee56910, 0x538304ce, 0xfb080547, 0xd126fac1, 0xc5da1202, + 0x85ebc0a4, 0x1771acb0, 0x0a2e18cc, 0x108f568a, 0x03cc9899, + 0x0073b384); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xc3afd90f697a742a, 0x585e39767c2959ab, 0xfd5f5c31e16d95ba, + 0x2c39235d58ff74a1, 0x4a793d202092aeac, 0x6d31f07b7bdfb6ea, + 0x902b8e28be41b10d, 0x89114b9383c4b511, 0x1f9a7e912f5a51f0, + 0x5494b9380432890c, 0xfd260f5f1fc1eb45, 0x80381e728c1baa95, + 0xa6be6d48744a823b, 0xd37b8ae766a82bf8, 0x7992c128f1c1f6ab, + 0xbeca06f79871e7e8); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x56545434, 0x99cd1438, 0xa1d42f8a, 0x3500b207, 0x642cd563, + 0x7405746d, 0xe92c3246, 0xdab496dc, 0xcbe26107, 0x6bb989c7, + 0xc8542e0c, 0x5849a179, 0x04aac7de, 0x7b5ce579, 0x0ce6e7ea, + 0x77402b10); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmacc.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(12, v6, 0xc3afd90f697a742a, 0x5836c95c6dbae113, 0xfd5f5c31e16d95ba, + 0x2c4d976fb318600e, 0x4a793d202092aeac, 0x6d5eb614d7052bf9, + 0x902b8e28be41b10d, 0x8902e74ad235ed05, 0x1f9a7e912f5a51f0, + 0x54be4b3652df41b9, 0xfd260f5f1fc1eb45, 0x805a304537cce5a8, + 0xa6be6d48744a823b, 0xd3ab25c46d6cd30b, 0x7992c128f1c1f6ab, + 0xbef80b96ee48ff98); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmaccsu.c b/apps/riscv-tests/isa/rv64uv/vwmaccsu.c new file mode 100644 index 0000000..e87bc9e --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmaccsu.c @@ -0,0 +1,248 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x30dc, 0x7235, 0xd5f6, 0xa008, 0x6e79, 0xa159, 0xa05c, 0x5914, + 0xd06f, 0x69c5, 0x9475, 0x5625, 0xa5bd, 0x7be7, 0x823c, 0x5fb2); + VSET(16, e8, m1); + VLOAD_8(v2, 0xb6, 0xbb, 0xb6, 0x57, 0xf9, 0x7c, 0xbf, 0x62, 0x1a, 0xeb, 0xa4, + 0x34, 0xde, 0x96, 0x80, 0xe6); + VLOAD_8(v4, 0x26, 0xea, 0xe8, 0x85, 0x2e, 0xf1, 0x46, 0x8f, 0x68, 0x29, 0xbb, + 0x9b, 0xec, 0x5c, 0x8e, 0x77); + asm volatile("vwmaccsu.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_I16(1, v6, 0x25e0, 0x3323, 0x92e6, 0xcd3b, 0x6d37, 0x1615, 0x8e96, + 0x8fd2, 0xdaff, 0x6668, 0x5141, 0x75a1, 0x8665, 0x55cf, 0x3b3c, + 0x539c); + + VSET(16, e32, m1); + VLOAD_32(v6, 0xdbc5b23d, 0x86bd7dad, 0xb744b5c2, 0xc32f4a47, 0x237edfc4, + 0x5d6e851a, 0xbd3110cd, 0x18c61b57, 0x7ade2943, 0x7e4f5ed6, + 0x90e5ba77, 0xce45b744, 0x82d1976e, 0xa88bb4e1, 0x989fbb9a, + 0xab29da17); + VSET(16, e16, m1); + VLOAD_16(v2, 0x23fb, 0xcee7, 0xa704, 0xc00f, 0xed9f, 0x2cf0, 0x4b53, 0xc0ba, + 0x775b, 0x557c, 0x57b7, 0xbb06, 0xf9ba, 0x178f, 0xec73, 0x8240); + VLOAD_16(v4, 0xad9d, 0x104d, 0xdc56, 0x96af, 0x8c68, 0x1d25, 0x2d70, 0x467a, + 0xc27c, 0x96e2, 0x1c85, 0xe8b6, 0xf7e0, 0xd069, 0x0bca, 0x4f36); + asm volatile("vwmaccsu.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_I32(2, v6, 0xf42c622c, 0x839d2928, 0x6aae411a, 0x9d8c5e88, 0x196a5c5c, + 0x628c33ca, 0xca8f9c1d, 0x075acffb, 0xd58aef57, 0xb0b17e4e, + 0x9aab508a, 0x8f921d88, 0x7cbe902e, 0xbbb98e88, 0x97b93f58, + 0x84411397); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xf8e162af4fefb46a, 0x8e859cff3b076a9d, 0xa7279ec622e749eb, + 0x67bbdace6d6bf1a9, 0xf2090d8d3b00e5b8, 0x9259e92430c5a337, + 0x7cc51e4cc8fd46c6, 0xe5c6946a8e9787fd, 0x0d36e747a75534cc, + 0x9c1a70c0989504f9, 0xa7b0f15e7b51c000, 0x4566f8ffa299d104, + 0xf385b581a4c1c25b, 0xb067f1a7621f9cdd, 0x54ffc96dc442d7b5, + 0x3fc18a6aa65ab8d5); + VSET(16, e32, m1); + VLOAD_32(v2, 0x189138d0, 0xe2f3f48f, 0x58448029, 0x44298d07, 0x6f6b15cf, + 0x13e9cf30, 0x23b6edb8, 0xd532420a, 0xdab302ee, 0xa5e6854e, + 0x538f91b0, 0xc5d4db0e, 0xbc6d31b3, 0x754d418c, 0x96198b07, + 0xf54f785a); + VLOAD_32(v4, 0x52d1517d, 0xa592227e, 0xbb122792, 0x531a3046, 0x88193da7, + 0x13db3502, 0x64efb3f9, 0x55c57a21, 0x31cd5a79, 0x5c0b4048, + 0x899cfb88, 0xfab9de9d, 0x6fa41232, 0x9462cda3, 0x0f8de6ea, + 0x8064029f); + asm volatile("vwmaccsu.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_I64(3, v6, 0x00d3fd4343a241fa, 0x7bbc44d6fa22c6ff, 0xe7a7ead9df60a04d, + 0x7ddc4c9a72efd193, 0x2d44ed6d874572c1, 0x93e550a88e8e3197, + 0x8ada040c3cea26be, 0xd76f3f99213ccf47, 0x05f53f01db8f434a, + 0x7bb552f0a51802e9, 0xd49c03ec9aaeb580, 0x0c6e9b2885384c9a, + 0xd60dbf3493400d51, 0xf465e158f7657501, 0x4e90951ee65f361b, + 0x3a651986a4cf2cbb); +} + +void TEST_CASE2() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x30dc, 0x7235, 0xd5f6, 0xa008, 0x6e79, 0xa159, 0xa05c, 0x5914, + 0xd06f, 0x69c5, 0x9475, 0x5625, 0xa5bd, 0x7be7, 0x823c, 0x5fb2); + VSET(16, e8, m1); + VLOAD_8(v2, 0xb6, 0xbb, 0xb6, 0x57, 0xf9, 0x7c, 0xbf, 0x62, 0x1a, 0xeb, 0xa4, + 0x34, 0xde, 0x96, 0x80, 0xe6); + VLOAD_8(v4, 0x26, 0xea, 0xe8, 0x85, 0x2e, 0xf1, 0x46, 0x8f, 0x68, 0x29, 0xbb, + 0x9b, 0xec, 0x5c, 0x8e, 0x77); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccsu.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_I16(4, v6, 0x30dc, 0x3323, 0xd5f6, 0xcd3b, 0x6e79, 0x1615, 0xa05c, + 0x8fd2, 0xd06f, 0x6668, 0x9475, 0x75a1, 0xa5bd, 0x55cf, 0x823c, + 0x539c); + + VSET(16, e32, m1); + VLOAD_32(v6, 0xdbc5b23d, 0x86bd7dad, 0xb744b5c2, 0xc32f4a47, 0x237edfc4, + 0x5d6e851a, 0xbd3110cd, 0x18c61b57, 0x7ade2943, 0x7e4f5ed6, + 0x90e5ba77, 0xce45b744, 0x82d1976e, 0xa88bb4e1, 0x989fbb9a, + 0xab29da17); + VSET(16, e16, m1); + VLOAD_16(v2, 0x23fb, 0xcee7, 0xa704, 0xc00f, 0xed9f, 0x2cf0, 0x4b53, 0xc0ba, + 0x775b, 0x557c, 0x57b7, 0xbb06, 0xf9ba, 0x178f, 0xec73, 0x8240); + VLOAD_16(v4, 0xad9d, 0x104d, 0xdc56, 0x96af, 0x8c68, 0x1d25, 0x2d70, 0x467a, + 0xc27c, 0x96e2, 0x1c85, 0xe8b6, 0xf7e0, 0xd069, 0x0bca, 0x4f36); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccsu.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_I32(5, v6, 0xdbc5b23d, 0x839d2928, 0xb744b5c2, 0x9d8c5e88, 0x237edfc4, + 0x628c33ca, 0xbd3110cd, 0x075acffb, 0x7ade2943, 0xb0b17e4e, + 0x90e5ba77, 0x8f921d88, 0x82d1976e, 0xbbb98e88, 0x989fbb9a, + 0x84411397); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xf8e162af4fefb46a, 0x8e859cff3b076a9d, 0xa7279ec622e749eb, + 0x67bbdace6d6bf1a9, 0xf2090d8d3b00e5b8, 0x9259e92430c5a337, + 0x7cc51e4cc8fd46c6, 0xe5c6946a8e9787fd, 0x0d36e747a75534cc, + 0x9c1a70c0989504f9, 0xa7b0f15e7b51c000, 0x4566f8ffa299d104, + 0xf385b581a4c1c25b, 0xb067f1a7621f9cdd, 0x54ffc96dc442d7b5, + 0x3fc18a6aa65ab8d5); + VSET(16, e32, m1); + VLOAD_32(v2, 0x189138d0, 0xe2f3f48f, 0x58448029, 0x44298d07, 0x6f6b15cf, + 0x13e9cf30, 0x23b6edb8, 0xd532420a, 0xdab302ee, 0xa5e6854e, + 0x538f91b0, 0xc5d4db0e, 0xbc6d31b3, 0x754d418c, 0x96198b07, + 0xf54f785a); + VLOAD_32(v4, 0x52d1517d, 0xa592227e, 0xbb122792, 0x531a3046, 0x88193da7, + 0x13db3502, 0x64efb3f9, 0x55c57a21, 0x31cd5a79, 0x5c0b4048, + 0x899cfb88, 0xfab9de9d, 0x6fa41232, 0x9462cda3, 0x0f8de6ea, + 0x8064029f); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccsu.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_I64(6, v6, 0xf8e162af4fefb46a, 0x7bbc44d6fa22c6ff, 0xa7279ec622e749eb, + 0x7ddc4c9a72efd193, 0xf2090d8d3b00e5b8, 0x93e550a88e8e3197, + 0x7cc51e4cc8fd46c6, 0xd76f3f99213ccf47, 0x0d36e747a75534cc, + 0x7bb552f0a51802e9, 0xa7b0f15e7b51c000, 0x0c6e9b2885384c9a, + 0xf385b581a4c1c25b, 0xf465e158f7657501, 0x54ffc96dc442d7b5, + 0x3a651986a4cf2cbb); +} + +void TEST_CASE3() { + VSET(16, e16, m1); + VLOAD_16(v6, 0xadd2, 0x2112, 0xbbc6, 0xd113, 0xc6f7, 0xbd07, 0xfd9a, 0x0c0e, + 0xe110, 0xe81b, 0xb432, 0x5c2c, 0x4da9, 0x8c48, 0x6f94, 0x6250); + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v4, 0xfe, 0xd1, 0xc2, 0x3b, 0x79, 0x2f, 0xf5, 0xe8, 0x7f, 0x4b, 0x64, + 0x57, 0x2b, 0x4f, 0x4e, 0xda); + asm volatile("vwmaccsu.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(7, v6, 0xb2c8, 0x2527, 0xbf90, 0xd23a, 0xc954, 0xbdf2, 0x0263, + 0x1096, 0xe38b, 0xe992, 0xb626, 0x5ddf, 0x4e80, 0x8dd3, 0x711a, + 0x6692); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x39d3ea89, 0x451d8e1a, 0x83edb2d7, 0xc1919ab3, 0x243c3d4d, + 0xd4745be8, 0x50a58cbe, 0x53b75e9f, 0x2a648b62, 0xd74ce1cf, + 0xa2c6a2e7, 0xc30eadb0, 0x7a908fb9, 0xd4455b56, 0x48109ee2, + 0x2f5b537a); + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v4, 0x29f8, 0x6958, 0x6635, 0x03a0, 0x07bc, 0x4881, 0x7d4e, 0x37e3, + 0x8370, 0x405f, 0x1f0d, 0x1252, 0xacf1, 0x06ee, 0x790d, 0x73af); + asm volatile("vwmaccsu.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(8, v6, 0x36616cc1, 0x3c7674b2, 0x7b888e64, 0xc1456153, 0x23999b29, + 0xce7fcb61, 0x465ab99c, 0x4f20386a, 0x1f98c352, 0xd2035436, + 0xa039b88c, 0xc18d7372, 0x6c5c1022, 0xd3b3a4d4, 0x3e1f3e87, + 0x25daceb1); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xd860771ff910e8a1, 0xd8de9ddf3be66e90, 0xe55e25348ff4c406, + 0x6ee24d9ebeda1c54, 0x78437fc8299017d1, 0x46a2833ed69dec1d, + 0x0331761dcc2485b7, 0x99c00b7ecbecb5bf, 0xd68d230a95510605, + 0x0e82f981980d47c8, 0x7bb0e1dd5f273626, 0x044cc7c24be55121, + 0x341b063e01c35796, 0xb77a96fdf1826215, 0xdcbd3fe115470433, + 0xc2797417b552325b); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x53046c2d, 0x3b0c65ed, 0x6565f981, 0xaa4c1d70, 0x0a18c71e, + 0xbc91ff46, 0xa52c32d1, 0x73cca3fc, 0xb2a7e5d2, 0x1939af0a, + 0xe4fdb1f5, 0x783f5c5d, 0x3514c875, 0xce346d04, 0x68047428, + 0x72ca548f); + asm volatile("vwmaccsu.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(9, v6, 0xd880804c10498af0, 0xd8f567313109141f, 0xe585463838d91671, + 0x6f2405141ab61224, 0x7847653b1c216e5b, 0x46eb47de4add375f, + 0x03713350939f4492, 0x99ecbb2b8c001a13, 0xd6d2143a6346dfcb, + 0x0e8cb57c0c43cff6, 0x7c093f98e48cef0d, 0x047b2edbc92e1f80, + 0x342f8210ca0537fd, 0xb7ca29b420c298c1, 0xdce563a087e10ceb, + 0xc2a5c016503018a0); +} + +void TEST_CASE4() { + VSET(16, e16, m1); + VLOAD_16(v6, 0xadd2, 0x2112, 0xbbc6, 0xd113, 0xc6f7, 0xbd07, 0xfd9a, 0x0c0e, + 0xe110, 0xe81b, 0xb432, 0x5c2c, 0x4da9, 0x8c48, 0x6f94, 0x6250); + VSET(16, e8, m1); + int64_t scalar = 5; + VLOAD_8(v4, 0xfe, 0xd1, 0xc2, 0x3b, 0x79, 0x2f, 0xf5, 0xe8, 0x7f, 0x4b, 0x64, + 0x57, 0x2b, 0x4f, 0x4e, 0xda); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccsu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(10, v6, 0xadd2, 0x2527, 0xbbc6, 0xd23a, 0xc6f7, 0xbdf2, 0xfd9a, + 0x1096, 0xe110, 0xe992, 0xb432, 0x5ddf, 0x4da9, 0x8dd3, 0x6f94, + 0x6692); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x39d3ea89, 0x451d8e1a, 0x83edb2d7, 0xc1919ab3, 0x243c3d4d, + 0xd4745be8, 0x50a58cbe, 0x53b75e9f, 0x2a648b62, 0xd74ce1cf, + 0xa2c6a2e7, 0xc30eadb0, 0x7a908fb9, 0xd4455b56, 0x48109ee2, + 0x2f5b537a); + VSET(16, e16, m1); + scalar = -5383; + VLOAD_16(v4, 0x29f8, 0x6958, 0x6635, 0x03a0, 0x07bc, 0x4881, 0x7d4e, 0x37e3, + 0x8370, 0x405f, 0x1f0d, 0x1252, 0xacf1, 0x06ee, 0x790d, 0x73af); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccsu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(11, v6, 0x39d3ea89, 0x3c7674b2, 0x83edb2d7, 0xc1456153, 0x243c3d4d, + 0xce7fcb61, 0x50a58cbe, 0x4f20386a, 0x2a648b62, 0xd2035436, + 0xa2c6a2e7, 0xc18d7372, 0x7a908fb9, 0xd3b3a4d4, 0x48109ee2, + 0x25daceb1); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xd860771ff910e8a1, 0xd8de9ddf3be66e90, 0xe55e25348ff4c406, + 0x6ee24d9ebeda1c54, 0x78437fc8299017d1, 0x46a2833ed69dec1d, + 0x0331761dcc2485b7, 0x99c00b7ecbecb5bf, 0xd68d230a95510605, + 0x0e82f981980d47c8, 0x7bb0e1dd5f273626, 0x044cc7c24be55121, + 0x341b063e01c35796, 0xb77a96fdf1826215, 0xdcbd3fe115470433, + 0xc2797417b552325b); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x53046c2d, 0x3b0c65ed, 0x6565f981, 0xaa4c1d70, 0x0a18c71e, + 0xbc91ff46, 0xa52c32d1, 0x73cca3fc, 0xb2a7e5d2, 0x1939af0a, + 0xe4fdb1f5, 0x783f5c5d, 0x3514c875, 0xce346d04, 0x68047428, + 0x72ca548f); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccsu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(12, v6, 0xd860771ff910e8a1, 0xd8f567313109141f, 0xe55e25348ff4c406, + 0x6f2405141ab61224, 0x78437fc8299017d1, 0x46eb47de4add375f, + 0x0331761dcc2485b7, 0x99ecbb2b8c001a13, 0xd68d230a95510605, + 0x0e8cb57c0c43cff6, 0x7bb0e1dd5f273626, 0x047b2edbc92e1f80, + 0x341b063e01c35796, 0xb7ca29b420c298c1, 0xdcbd3fe115470433, + 0xc2a5c016503018a0); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmaccu.c b/apps/riscv-tests/isa/rv64uv/vwmaccu.c new file mode 100644 index 0000000..8afd184 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmaccu.c @@ -0,0 +1,248 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x519d, 0x7122, 0x672c, 0x4d97, 0x436e, 0x3f1f, 0x423d, 0x44e8, + 0x3d7b, 0x5570, 0x1e90, 0x79f4, 0x456b, 0x0283, 0x02b5, 0x6865); + VSET(16, e8, m1); + VLOAD_8(v2, 0xce, 0x96, 0x33, 0x88, 0xf8, 0x3f, 0x0c, 0xde, 0x1e, 0x9d, 0x5a, + 0x75, 0x73, 0x43, 0xd9, 0x43); + VLOAD_8(v4, 0x51, 0x88, 0x16, 0xf6, 0x57, 0xab, 0xd8, 0x26, 0x2e, 0x35, 0x94, + 0xd1, 0xf0, 0xb9, 0x09, 0x8a); + asm volatile("vwmaccu.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(1, v6, 0x92cb, 0xc0d2, 0x6b8e, 0xd047, 0x97b6, 0x6934, 0x4c5d, + 0x65dc, 0x42df, 0x75f1, 0x5298, 0xd979, 0xb13b, 0x32ee, 0x0a56, + 0x8c83); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x1f50b763, 0x6d1a7f46, 0x17b8b2b5, 0x6b69c966, 0x25d945cb, + 0x3e6c375b, 0x314db8d3, 0x35ade27d, 0x74fa2d58, 0x735f513d, + 0x3cad4e4d, 0x628eb81a, 0x1c48c2f9, 0x14f08921, 0x77de05bf, + 0x528c354b); + VSET(16, e16, m1); + VLOAD_16(v2, 0x4ed5, 0xcf74, 0x3442, 0x280f, 0x795e, 0x3007, 0xdf3e, 0xb348, + 0x3865, 0xcb59, 0x1291, 0xa04b, 0xc5bd, 0x957f, 0xefe4, 0xe75d); + VLOAD_16(v4, 0x7d39, 0xddd8, 0x17d7, 0x0574, 0x251a, 0x4ce4, 0x4817, 0x9de1, + 0xd773, 0xdcc8, 0xeb92, 0x8fa8, 0x9382, 0x4369, 0xb1c7, 0x9185); + asm volatile("vwmaccu.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(2, v6, 0x45e045d0, 0x20e0ad26, 0x1c968423, 0x6c443b32, 0x37702f57, + 0x4cd91197, 0x702b3765, 0xa43e9cc5, 0xa47055b7, 0x22beaac5, + 0x4dc2ffff, 0xbc81ce52, 0x8e38b3f3, 0x3c4e1738, 0x1e7523fb, + 0xd610159c); + + VSET(16, e64, m1); + VLOAD_64(v6, 0x5118504f9237ea08, 0x6b71d4ee88073dde, 0x4420559f61e6927c, + 0x24eea54c6530475c, 0x289211cb16ebbbc9, 0x1a0b2b7644ecd474, + 0x159c16af3e71f736, 0x12dda0d2ca288012, 0x790fab107c1346b6, + 0x589cc8132c869645, 0x323623bba87568ce, 0x5ce2e94d5e335c5d, + 0x6e6b3c19c0d78ca0, 0x0502bed40a0600bc, 0x5ff6f4b3610e009c, + 0x40d6eb0605052915); + VSET(16, e32, m1); + VLOAD_32(v2, 0xd1247b78, 0xfd5d326b, 0x7fe40cf5, 0xfd802d90, 0x9ec23b7e, + 0x67219fe8, 0x9dc7f026, 0x257d8b7f, 0x782bc512, 0x42fa808b, + 0x48d3273d, 0x7ca0371d, 0x06409254, 0xb77ce3ba, 0x28aac174, + 0xd2e4cdbf); + VLOAD_32(v4, 0xab3b5969, 0xe91aa966, 0x336c2f4c, 0xfcc75a99, 0x1854180c, + 0xeec0354b, 0x8b4595bf, 0x9200fb5c, 0x0d627fcf, 0xdf0a8280, + 0x4b5733be, 0x4f3bd496, 0x10f5d788, 0x3499c99d, 0xdeee29dd, + 0x7e8643a4); + asm volatile("vwmaccu.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(3, v6, 0xdcfc2b3ca5c34640, 0x52260af0834ff780, 0x5dd0d00a7e576638, + 0x1f3e3a8021c0226c, 0x37a86e0412f255b1, 0x7a39dcd00fe1b56c, + 0x6b728942b1a24190, 0x283f5f30c90c26b6, 0x7f5820d2b91f8e44, + 0x92f7bdf9f97b71c5, 0x47a4ceb4fab8af14, 0x83757ab9b866ab5b, + 0x6ed5464e986dd540, 0x2ab6573b8294b3ce, 0x8360dddc474a95c0, + 0xa91223c6b56bf471); +} + +void TEST_CASE2() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x519d, 0x7122, 0x672c, 0x4d97, 0x436e, 0x3f1f, 0x423d, 0x44e8, + 0x3d7b, 0x5570, 0x1e90, 0x79f4, 0x456b, 0x0283, 0x02b5, 0x6865); + VSET(16, e8, m1); + VLOAD_8(v2, 0xce, 0x96, 0x33, 0x88, 0xf8, 0x3f, 0x0c, 0xde, 0x1e, 0x9d, 0x5a, + 0x75, 0x73, 0x43, 0xd9, 0x43); + VLOAD_8(v4, 0x51, 0x88, 0x16, 0xf6, 0x57, 0xab, 0xd8, 0x26, 0x2e, 0x35, 0x94, + 0xd1, 0xf0, 0xb9, 0x09, 0x8a); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccu.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(4, v6, 0x519d, 0xc0d2, 0x672c, 0xd047, 0x436e, 0x6934, 0x423d, + 0x65dc, 0x3d7b, 0x75f1, 0x1e90, 0xd979, 0x456b, 0x32ee, 0x02b5, + 0x8c83); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x1f50b763, 0x6d1a7f46, 0x17b8b2b5, 0x6b69c966, 0x25d945cb, + 0x3e6c375b, 0x314db8d3, 0x35ade27d, 0x74fa2d58, 0x735f513d, + 0x3cad4e4d, 0x628eb81a, 0x1c48c2f9, 0x14f08921, 0x77de05bf, + 0x528c354b); + VSET(16, e16, m1); + VLOAD_16(v2, 0x4ed5, 0xcf74, 0x3442, 0x280f, 0x795e, 0x3007, 0xdf3e, 0xb348, + 0x3865, 0xcb59, 0x1291, 0xa04b, 0xc5bd, 0x957f, 0xefe4, 0xe75d); + VLOAD_16(v4, 0x7d39, 0xddd8, 0x17d7, 0x0574, 0x251a, 0x4ce4, 0x4817, 0x9de1, + 0xd773, 0xdcc8, 0xeb92, 0x8fa8, 0x9382, 0x4369, 0xb1c7, 0x9185); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccu.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(5, v6, 0x1f50b763, 0x20e0ad26, 0x17b8b2b5, 0x6c443b32, 0x25d945cb, + 0x4cd91197, 0x314db8d3, 0xa43e9cc5, 0x74fa2d58, 0x22beaac5, + 0x3cad4e4d, 0xbc81ce52, 0x1c48c2f9, 0x3c4e1738, 0x77de05bf, + 0xd610159c); + + VSET(16, e64, m1); + VLOAD_64(v6, 0x5118504f9237ea08, 0x6b71d4ee88073dde, 0x4420559f61e6927c, + 0x24eea54c6530475c, 0x289211cb16ebbbc9, 0x1a0b2b7644ecd474, + 0x159c16af3e71f736, 0x12dda0d2ca288012, 0x790fab107c1346b6, + 0x589cc8132c869645, 0x323623bba87568ce, 0x5ce2e94d5e335c5d, + 0x6e6b3c19c0d78ca0, 0x0502bed40a0600bc, 0x5ff6f4b3610e009c, + 0x40d6eb0605052915); + VSET(16, e32, m1); + VLOAD_32(v2, 0xd1247b78, 0xfd5d326b, 0x7fe40cf5, 0xfd802d90, 0x9ec23b7e, + 0x67219fe8, 0x9dc7f026, 0x257d8b7f, 0x782bc512, 0x42fa808b, + 0x48d3273d, 0x7ca0371d, 0x06409254, 0xb77ce3ba, 0x28aac174, + 0xd2e4cdbf); + VLOAD_32(v4, 0xab3b5969, 0xe91aa966, 0x336c2f4c, 0xfcc75a99, 0x1854180c, + 0xeec0354b, 0x8b4595bf, 0x9200fb5c, 0x0d627fcf, 0xdf0a8280, + 0x4b5733be, 0x4f3bd496, 0x10f5d788, 0x3499c99d, 0xdeee29dd, + 0x7e8643a4); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccu.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(6, v6, 0x5118504f9237ea08, 0x52260af0834ff780, 0x4420559f61e6927c, + 0x1f3e3a8021c0226c, 0x289211cb16ebbbc9, 0x7a39dcd00fe1b56c, + 0x159c16af3e71f736, 0x283f5f30c90c26b6, 0x790fab107c1346b6, + 0x92f7bdf9f97b71c5, 0x323623bba87568ce, 0x83757ab9b866ab5b, + 0x6e6b3c19c0d78ca0, 0x2ab6573b8294b3ce, 0x5ff6f4b3610e009c, + 0xa91223c6b56bf471); +} + +void TEST_CASE3() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x6f50, 0x0299, 0x3578, 0x0e45, 0x752b, 0x60c7, 0x7d0c, 0x0943, + 0x3f2d, 0x47bc, 0x4468, 0x616d, 0x5844, 0x3a7d, 0x32fe, 0x7813); + VSET(16, e8, m1); + uint64_t scalar = 5; + VLOAD_8(v4, 0x01, 0xd6, 0x1e, 0x57, 0xcc, 0x31, 0x29, 0x06, 0x5a, 0xab, 0x1e, + 0x0a, 0x97, 0x6f, 0xe0, 0xfc); + asm volatile("vwmaccu.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(7, v6, 0x6f55, 0x06c7, 0x360e, 0x0ff8, 0x7927, 0x61bc, 0x7dd9, + 0x0961, 0x40ef, 0x4b13, 0x44fe, 0x619f, 0x5b37, 0x3ca8, 0x375e, + 0x7cff); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x681721c9, 0x5c07924a, 0x5147143e, 0x14da5785, 0x30a43e20, + 0x3498177e, 0x551df71d, 0x29656468, 0x12550807, 0x7dc95cbd, + 0x2167ff36, 0x194b0d6c, 0x79119a1d, 0x6d77fab6, 0x3e32c755, + 0x6e479bf4); + VSET(16, e16, m1); + scalar = 5383; + VLOAD_16(v4, 0x9752, 0x45a4, 0xfde9, 0xa659, 0x957b, 0x1a3f, 0x2212, 0x5d43, + 0xdc08, 0x1fb8, 0x5e15, 0x08da, 0x0468, 0x4458, 0xe1e2, 0x4ef7); + asm volatile("vwmaccu.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(8, v6, 0x7484ff07, 0x61bfedc6, 0x6622229d, 0x228430f4, 0x3ceb6b7d, + 0x36bffa37, 0x57ea5f9b, 0x310e703d, 0x2467b43f, 0x806452c5, + 0x29224ac9, 0x1a052d62, 0x796e40f5, 0x7315111e, 0x50c07e83, + 0x74c407b5); + + VSET(16, e64, m1); + VLOAD_64(v6, 0x27a0a02f7e9757d4, 0x7ff7bb4d394926a0, 0x09d25e3173571efd, + 0x11661c8ece6711ac, 0x1e5ffff32ed851dd, 0x0698334d63d206a9, + 0x79598c88fd85995f, 0x2fa78b4b7d90a222, 0x7d65cbfdfc7f2e1d, + 0x6c0101ef46924df6, 0x59ff3d4e018b50f4, 0x2c8ec8409f219401, + 0x20b183b4bb89c200, 0x28bee831261ca372, 0x5b9d142326bcef0a, + 0x1c2ad051e4e7281e); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x307dc235, 0x92187481, 0xa69319d1, 0x682b9abe, 0x8bdce4be, + 0x95ec65ce, 0x46915d6f, 0xd59243e6, 0x1d0943e5, 0x3ae27787, + 0x33c32e03, 0x8be66da2, 0x0fc78147, 0x2ce8d421, 0x9c9bc2fb, + 0x10c8c9f7); + asm volatile("vwmaccu.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(9, v6, 0x27b3569317ce3b7b, 0x80301be52297620b, 0x0a12a5e3bda6ead8, + 0x118e4f69e7a94c16, 0x1e95f8d392f37a47, 0x06d20e0c989e38c3, + 0x7974c7d7abd08544, 0x2ff9f5bd60308c44, 0x7d710070e7f94e54, + 0x6c17bb12e5fd05e3, 0x5a1336d961fce8b5, 0x2cc4c4ceefc069b7, + 0x20b79a86595c2d2d, 0x28d03cbe630746bd, 0x5bd98349d9e5fe73, + 0x1c314a6c44597cdb); +} + +void TEST_CASE4() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x6f50, 0x0299, 0x3578, 0x0e45, 0x752b, 0x60c7, 0x7d0c, 0x0943, + 0x3f2d, 0x47bc, 0x4468, 0x616d, 0x5844, 0x3a7d, 0x32fe, 0x7813); + VSET(16, e8, m1); + uint64_t scalar = 5; + VLOAD_8(v4, 0x01, 0xd6, 0x1e, 0x57, 0xcc, 0x31, 0x29, 0x06, 0x5a, 0xab, 0x1e, + 0x0a, 0x97, 0x6f, 0xe0, 0xfc); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(10, v6, 0x6f50, 0x06c7, 0x3578, 0x0ff8, 0x752b, 0x61bc, 0x7d0c, + 0x0961, 0x3f2d, 0x4b13, 0x4468, 0x619f, 0x5844, 0x3ca8, 0x32fe, + 0x7cff); + + VSET(16, e32, m1); + VLOAD_32(v6, 0x681721c9, 0x5c07924a, 0x5147143e, 0x14da5785, 0x30a43e20, + 0x3498177e, 0x551df71d, 0x29656468, 0x12550807, 0x7dc95cbd, + 0x2167ff36, 0x194b0d6c, 0x79119a1d, 0x6d77fab6, 0x3e32c755, + 0x6e479bf4); + VSET(16, e16, m1); + scalar = 5383; + VLOAD_16(v4, 0x9752, 0x45a4, 0xfde9, 0xa659, 0x957b, 0x1a3f, 0x2212, 0x5d43, + 0xdc08, 0x1fb8, 0x5e15, 0x08da, 0x0468, 0x4458, 0xe1e2, 0x4ef7); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(11, v6, 0x681721c9, 0x61bfedc6, 0x5147143e, 0x228430f4, 0x30a43e20, + 0x36bffa37, 0x551df71d, 0x310e703d, 0x12550807, 0x806452c5, + 0x2167ff36, 0x1a052d62, 0x79119a1d, 0x7315111e, 0x3e32c755, + 0x74c407b5); + + VSET(16, e64, m1); + VLOAD_64(v6, 0x27a0a02f7e9757d4, 0x7ff7bb4d394926a0, 0x09d25e3173571efd, + 0x11661c8ece6711ac, 0x1e5ffff32ed851dd, 0x0698334d63d206a9, + 0x79598c88fd85995f, 0x2fa78b4b7d90a222, 0x7d65cbfdfc7f2e1d, + 0x6c0101ef46924df6, 0x59ff3d4e018b50f4, 0x2c8ec8409f219401, + 0x20b183b4bb89c200, 0x28bee831261ca372, 0x5b9d142326bcef0a, + 0x1c2ad051e4e7281e); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x307dc235, 0x92187481, 0xa69319d1, 0x682b9abe, 0x8bdce4be, + 0x95ec65ce, 0x46915d6f, 0xd59243e6, 0x1d0943e5, 0x3ae27787, + 0x33c32e03, 0x8be66da2, 0x0fc78147, 0x2ce8d421, 0x9c9bc2fb, + 0x10c8c9f7); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccu.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(12, v6, 0x27a0a02f7e9757d4, 0x80301be52297620b, 0x09d25e3173571efd, + 0x118e4f69e7a94c16, 0x1e5ffff32ed851dd, 0x06d20e0c989e38c3, + 0x79598c88fd85995f, 0x2ff9f5bd60308c44, 0x7d65cbfdfc7f2e1d, + 0x6c17bb12e5fd05e3, 0x59ff3d4e018b50f4, 0x2cc4c4ceefc069b7, + 0x20b183b4bb89c200, 0x28d03cbe630746bd, 0x5b9d142326bcef0a, + 0x1c314a6c44597cdb); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmaccus.c b/apps/riscv-tests/isa/rv64uv/vwmaccus.c new file mode 100644 index 0000000..d1e4be5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmaccus.c @@ -0,0 +1,127 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x4c8e, 0xd449, 0xe266, 0xb6d1, 0xf28a, 0x1655, 0x3111, 0x4bde, + 0x8787, 0x2ce4, 0x1083, 0xaa0c, 0x9fdf, 0x3e42, 0x98e7, 0xe33b); + VSET(16, e8, m1); + uint64_t scalar = 5; + VLOAD_8(v4, 0x83, 0xfe, 0xa2, 0xc3, 0xa6, 0x18, 0xd9, 0x4c, 0x6e, 0xeb, 0x43, + 0xb7, 0xec, 0x48, 0xb7, 0xe5); + asm volatile("vwmaccus.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(1, v6, 0x4a1d, 0xd43f, 0xe090, 0xb5a0, 0xf0c8, 0x16cd, 0x304e, + 0x4d5a, 0x89ad, 0x2c7b, 0x11d2, 0xa89f, 0x9f7b, 0x3faa, 0x977a, + 0xe2b4); + + VSET(16, e32, m1); + VLOAD_32(v6, 0xe318cc7a, 0x489815a8, 0x6e6fc053, 0x8d746807, 0xbc3e6244, + 0xcdfeb4fe, 0x22d24149, 0x26962240, 0x5ef85b7e, 0x2f61a9e8, + 0x373dc202, 0x1567a6b5, 0x763c5239, 0x60dd0502, 0xab178102, + 0x753e0a11); + VSET(16, e16, m1); + scalar = 5383; + VLOAD_16(v4, 0xce02, 0x6935, 0xc803, 0x75bc, 0x80b7, 0x19d2, 0x3b7c, 0xc269, + 0xb639, 0x66f1, 0x678b, 0xc83e, 0x5a5c, 0x389e, 0x9e46, 0xfae9); + asm volatile("vwmaccus.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(2, v6, 0xdefd9888, 0x513c4f1b, 0x69d67768, 0x97200c2b, 0xb1c9ea45, + 0xd01da3bc, 0x27b50dad, 0x2187101f, 0x58e9040d, 0x37d63f7f, + 0x3fbefdcf, 0x10d33667, 0x7da856bd, 0x65838754, 0xa31092ec, + 0x74d30370); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xb6a5b1c3c6d69abb, 0x3c6a647eb0d79a41, 0xf0c3eb8821045259, + 0x91d74be946352cae, 0x524c6db6c58f9da6, 0x39185a920f7787e8, + 0x4080fbf0fdcc64ec, 0x9ed1fb83f53270fc, 0xff0661a19269f0c0, + 0x47d26c599193fe0b, 0xd8cc0342dc3104ce, 0xc51f802bc93381cd, + 0xe7d6522aa1c51245, 0x6fa0a9d3f57bc667, 0xd140731478a147a8, + 0x5d716379591922f4); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x09377def, 0x99ee4d30, 0x8b8452d1, 0xc9e17667, 0x2254aa29, + 0xb56ca9f5, 0xa1276371, 0x32ac1413, 0x59ff6af3, 0x6b61bf57, + 0xc0eb37b3, 0x26f06be7, 0x0e9b21b2, 0x22898a93, 0xe3646841, + 0xdd301fdc); + asm volatile("vwmaccus.vx v6, %[A], v4" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(3, v6, 0xb6a940470425dc20, 0x3c430136a5932551, 0xf096f84fcc847134, + 0x91c26988f191bc3b, 0x5259ad33e6940249, 0x38fb9358fb72e8cf, + 0x405c6235eb4a66a7, 0x9ee5895b4431c96d, 0xff291c64abdfe8d1, + 0x47fbdc7722d7f1e8, 0xd8b3ab8cf55eb11f, 0xc52e86eb9b0cedda, + 0xe7dbf512bdc5c2ab, 0x6fadfdb8b3d16658, 0xd13568f3f48a0453, + 0x5d63f4705f821de8); +} + +void TEST_CASE2() { + VSET(16, e16, m1); + VLOAD_16(v6, 0x4c8e, 0xd449, 0xe266, 0xb6d1, 0xf28a, 0x1655, 0x3111, 0x4bde, + 0x8787, 0x2ce4, 0x1083, 0xaa0c, 0x9fdf, 0x3e42, 0x98e7, 0xe33b); + VSET(16, e8, m1); + uint64_t scalar = 5; + VLOAD_8(v4, 0x83, 0xfe, 0xa2, 0xc3, 0xa6, 0x18, 0xd9, 0x4c, 0x6e, 0xeb, 0x43, + 0xb7, 0xec, 0x48, 0xb7, 0xe5); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccus.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(4, v6, 0x4c8e, 0xd43f, 0xe266, 0xb5a0, 0xf28a, 0x16cd, 0x3111, + 0x4d5a, 0x8787, 0x2c7b, 0x1083, 0xa89f, 0x9fdf, 0x3faa, 0x98e7, + 0xe2b4); + + VSET(16, e32, m1); + VLOAD_32(v6, 0xe318cc7a, 0x489815a8, 0x6e6fc053, 0x8d746807, 0xbc3e6244, + 0xcdfeb4fe, 0x22d24149, 0x26962240, 0x5ef85b7e, 0x2f61a9e8, + 0x373dc202, 0x1567a6b5, 0x763c5239, 0x60dd0502, 0xab178102, + 0x753e0a11); + VSET(16, e16, m1); + scalar = 5383; + VLOAD_16(v4, 0xce02, 0x6935, 0xc803, 0x75bc, 0x80b7, 0x19d2, 0x3b7c, 0xc269, + 0xb639, 0x66f1, 0x678b, 0xc83e, 0x5a5c, 0x389e, 0x9e46, 0xfae9); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccus.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(5, v6, 0xe318cc7a, 0x513c4f1b, 0x6e6fc053, 0x97200c2b, 0xbc3e6244, + 0xd01da3bc, 0x22d24149, 0x2187101f, 0x5ef85b7e, 0x37d63f7f, + 0x373dc202, 0x10d33667, 0x763c5239, 0x65838754, 0xab178102, + 0x74d30370); + + VSET(16, e64, m1); + VLOAD_64(v6, 0xb6a5b1c3c6d69abb, 0x3c6a647eb0d79a41, 0xf0c3eb8821045259, + 0x91d74be946352cae, 0x524c6db6c58f9da6, 0x39185a920f7787e8, + 0x4080fbf0fdcc64ec, 0x9ed1fb83f53270fc, 0xff0661a19269f0c0, + 0x47d26c599193fe0b, 0xd8cc0342dc3104ce, 0xc51f802bc93381cd, + 0xe7d6522aa1c51245, 0x6fa0a9d3f57bc667, 0xd140731478a147a8, + 0x5d716379591922f4); + VSET(16, e32, m1); + scalar = 6474219; + VLOAD_32(v4, 0x09377def, 0x99ee4d30, 0x8b8452d1, 0xc9e17667, 0x2254aa29, + 0xb56ca9f5, 0xa1276371, 0x32ac1413, 0x59ff6af3, 0x6b61bf57, + 0xc0eb37b3, 0x26f06be7, 0x0e9b21b2, 0x22898a93, 0xe3646841, + 0xdd301fdc); + VLOAD_8(v0, 0xAA, 0xAA); + asm volatile("vwmaccus.vx v6, %[A], v4, v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(6, v6, 0xb6a5b1c3c6d69abb, 0x3c430136a5932551, 0xf0c3eb8821045259, + 0x91c26988f191bc3b, 0x524c6db6c58f9da6, 0x38fb9358fb72e8cf, + 0x4080fbf0fdcc64ec, 0x9ee5895b4431c96d, 0xff0661a19269f0c0, + 0x47fbdc7722d7f1e8, 0xd8cc0342dc3104ce, 0xc52e86eb9b0cedda, + 0xe7d6522aa1c51245, 0x6fadfdb8b3d16658, 0xd140731478a147a8, + 0x5d63f4705f821de8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmul.c b/apps/riscv-tests/isa/rv64uv/vwmul.c new file mode 100644 index 0000000..c379e39 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmul.c @@ -0,0 +1,182 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xee, 0xfe, 0xbd, 0xc2, 0x02, 0xa4, 0x34, 0x33, 0x2b, 0x35, 0x16, + 0x9b, 0x3b, 0x5f, 0xfc, 0x8b); + VLOAD_8(v4, 0xcb, 0x24, 0xe8, 0xb2, 0xeb, 0x24, 0x80, 0x67, 0x43, 0x11, 0x7c, + 0x94, 0x22, 0x71, 0xca, 0x80); + asm volatile("vwmul.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_I16(1, v6, 0x03ba, 0xffb8, 0x0648, 0x12e4, 0xffd6, 0xf310, 0xe600, + 0x1485, 0x0b41, 0x0385, 0x0aa8, 0x2a9c, 0x07d6, 0x29ef, 0x00d8, + 0x3a80); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8aed, 0x2153, 0x5377, 0xc19c, 0x1051, 0x1b75, 0xbafd, 0xb200, + 0xb209, 0xa9a2, 0xbdc4, 0x1653, 0x5965, 0x145e, 0xb626, 0xd79c); + VLOAD_16(v4, 0x778d, 0xc104, 0x6eac, 0x78e8, 0xacd2, 0x698b, 0xc7d3, 0x1e29, + 0x0a58, 0x58b5, 0x29f9, 0x2fb0, 0x2166, 0x0ac4, 0x44e5, 0xbc40); + asm volatile("vwmul.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_I32(2, v6, 0xc953af89, 0xf7cd184c, 0x241535f4, 0xe2889560, 0xfab2ce72, + 0x0b51e587, 0x0f24c987, 0xf6cf8200, 0xfcd98d18, 0xe2129f8a, + 0xf523f7a4, 0x04289610, 0x0ba9a33e, 0x00db43f8, 0xec2007fe, + 0x0ab07700); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xbbc467cb, 0xfbb3efda, 0x652f8490, 0x5e7ea848, 0x21fbc400, + 0xbb409fde, 0x98413836, 0x14652ba4, 0xc3d3c86f, 0xc84d3ae3, + 0x3df53027, 0xbda29a2c, 0xa1d7d949, 0x60a3d06e, 0xa91e405d, + 0x7eea498f); + VLOAD_32(v4, 0x80407791, 0x3e51b6e0, 0xd0be8bc1, 0x683f33bd, 0xeddda6c8, + 0x34e351f2, 0xa6a93ab2, 0xc8893cb8, 0xcb61ddc1, 0x341a4cdc, + 0xd377dc52, 0x2f3f3dbf, 0xa97f8c35, 0x38a44020, 0x28e1cc8b, + 0x52d0e17a); + asm volatile("vwmul.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_I64(3, v6, 0x220c9d56193e26fb, 0xfef434f3d9f0dac0, 0xed5267a678ad2090, + 0x267ac8a1a8c09528, 0xfd97bcf001c92000, 0xf1cc14c54f865ddc, + 0x24347d81c3bb518c, 0xfb94cd6ed9b5cde0, 0x0c5e26a06dc0eeaf, + 0xf4a9f71526e7ff14, 0xf538e8d5150bf07e, 0xf3c075503fe182d4, + 0x1fd0bbab88bae81d, 0x1561d6be9f0d8dc0, 0xf220183a08740e7f, + 0x290e99b3f87dbd26); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xee, 0xfe, 0xbd, 0xc2, 0x02, 0xa4, 0x34, 0x33, 0x2b, 0x35, 0x16, + 0x9b, 0x3b, 0x5f, 0xfc, 0x8b); + VLOAD_8(v4, 0xcb, 0x24, 0xe8, 0xb2, 0xeb, 0x24, 0x80, 0x67, 0x43, 0x11, 0x7c, + 0x94, 0x22, 0x71, 0xca, 0x80); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmul.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_I16(4, v6, 0, 0xffb8, 0, 0x12e4, 0, 0xf310, 0, 0x1485, 0, 0x0385, 0, + 0x2a9c, 0, 0x29ef, 0, 0x3a80); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x8aed, 0x2153, 0x5377, 0xc19c, 0x1051, 0x1b75, 0xbafd, 0xb200, + 0xb209, 0xa9a2, 0xbdc4, 0x1653, 0x5965, 0x145e, 0xb626, 0xd79c); + VLOAD_16(v4, 0x778d, 0xc104, 0x6eac, 0x78e8, 0xacd2, 0x698b, 0xc7d3, 0x1e29, + 0x0a58, 0x58b5, 0x29f9, 0x2fb0, 0x2166, 0x0ac4, 0x44e5, 0xbc40); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmul.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_I32(5, v6, 0, 0xf7cd184c, 0, 0xe2889560, 0, 0x0b51e587, 0, 0xf6cf8200, 0, + 0xe2129f8a, 0, 0x04289610, 0, 0x00db43f8, 0, 0x0ab07700); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xbbc467cb, 0xfbb3efda, 0x652f8490, 0x5e7ea848, 0x21fbc400, + 0xbb409fde, 0x98413836, 0x14652ba4, 0xc3d3c86f, 0xc84d3ae3, + 0x3df53027, 0xbda29a2c, 0xa1d7d949, 0x60a3d06e, 0xa91e405d, + 0x7eea498f); + VLOAD_32(v4, 0x80407791, 0x3e51b6e0, 0xd0be8bc1, 0x683f33bd, 0xeddda6c8, + 0x34e351f2, 0xa6a93ab2, 0xc8893cb8, 0xcb61ddc1, 0x341a4cdc, + 0xd377dc52, 0x2f3f3dbf, 0xa97f8c35, 0x38a44020, 0x28e1cc8b, + 0x52d0e17a); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmul.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_I64(6, v6, 0, 0xfef434f3d9f0dac0, 0, 0x267ac8a1a8c09528, 0, + 0xf1cc14c54f865ddc, 0, 0xfb94cd6ed9b5cde0, 0, 0xf4a9f71526e7ff14, 0, + 0xf3c075503fe182d4, 0, 0x1561d6be9f0d8dc0, 0, 0x290e99b3f87dbd26); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x86, 0x79, 0xa0, 0x8a, 0x3e, 0xc3, 0x3e, 0x0c, 0x1b, 0xca, 0x80, + 0x41, 0x0e, 0xee, 0x94, 0xdf); + int64_t scalar = 5; + asm volatile("vwmul.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(7, v6, 0xfd9e, 0x025d, 0xfe20, 0xfdb2, 0x0136, 0xfecf, 0x0136, + 0x003c, 0x0087, 0xfef2, 0xfd80, 0x0145, 0x0046, 0xffa6, 0xfde4, + 0xff5b); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xb0ab, 0xcccb, 0x5fad, 0x9e24, 0x1496, 0xd4a0, 0x2552, 0xcef6, + 0x34b8, 0xef22, 0x69c3, 0xbb05, 0xbe72, 0x315b, 0x3f03, 0xf58b); + scalar = -5383; + asm volatile("vwmul.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(8, v6, 0x06842453, 0x0434bf73, 0xf8243145, 0x0809b904, 0xfe4f21e6, + 0x03900fa0, 0xfcef40c2, 0x04072946, 0xfbab76f8, 0x0162ac12, + 0xf7501cab, 0x05aa79dd, 0x056270e2, 0xfbf22f83, 0xfad307eb, + 0x00dbe233); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x71c6753d, 0x66646cc2, 0x23065c23, 0xde594cad, 0xa2f87c53, + 0xaebb2bcb, 0xc53688b8, 0xf0c161dd, 0x2d856780, 0xa520cce5, + 0x677c5e13, 0x83d288f4, 0x78b6acdc, 0x5b635dd1, 0x97dc75c8, + 0x1a1aa6d4); + scalar = 6474219; + asm volatile("vwmul.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(9, v6, 0x002be7b6249483ff, 0x0027833479d82816, 0x000d840f6a940f21, + 0xfff303a4936737cf, 0xffdc19bf4b7d4b31, 0xffe0a38d1ee99659, + 0xffe9508230d7f8e8, 0xfffa1e014df55adf, 0x001190f926b98280, + 0xffdceee1c5a5e337, 0x0027ef3ba84d4671, 0xffd014a6bd334bfc, + 0x002e952469a169f4, 0x0023441ed2e237db, 0xffd7d041966a2698, + 0x000a12cac09b989c); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x86, 0x79, 0xa0, 0x8a, 0x3e, 0xc3, 0x3e, 0x0c, 0x1b, 0xca, 0x80, + 0x41, 0x0e, 0xee, 0x94, 0xdf); + int64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmul.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(10, v6, 0, 0x025d, 0, 0xfdb2, 0, 0xfecf, 0, 0x003c, 0, 0xfef2, 0, + 0x0145, 0, 0xffa6, 0, 0xff5b); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xb0ab, 0xcccb, 0x5fad, 0x9e24, 0x1496, 0xd4a0, 0x2552, 0xcef6, + 0x34b8, 0xef22, 0x69c3, 0xbb05, 0xbe72, 0x315b, 0x3f03, 0xf58b); + scalar = -5383; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmul.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(11, v6, 0, 0x0434bf73, 0, 0x0809b904, 0, 0x03900fa0, 0, 0x04072946, + 0, 0x0162ac12, 0, 0x05aa79dd, 0, 0xfbf22f83, 0, 0x00dbe233); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x71c6753d, 0x66646cc2, 0x23065c23, 0xde594cad, 0xa2f87c53, + 0xaebb2bcb, 0xc53688b8, 0xf0c161dd, 0x2d856780, 0xa520cce5, + 0x677c5e13, 0x83d288f4, 0x78b6acdc, 0x5b635dd1, 0x97dc75c8, + 0x1a1aa6d4); + scalar = 6474219; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmul.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(12, v6, 0, 0x0027833479d82816, 0, 0xfff303a4936737cf, 0, + 0xffe0a38d1ee99659, 0, 0xfffa1e014df55adf, 0, 0xffdceee1c5a5e337, 0, + 0xffd014a6bd334bfc, 0, 0x0023441ed2e237db, 0, 0x000a12cac09b989c); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmulsu.c b/apps/riscv-tests/isa/rv64uv/vwmulsu.c new file mode 100644 index 0000000..c980d02 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmulsu.c @@ -0,0 +1,182 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x37, 0x4e, 0x9a, 0x08, 0x12, 0xfd, 0xa4, 0x21, 0x44, 0x58, 0x5a, + 0xa9, 0x1d, 0x5e, 0xd4, 0x8e); + VLOAD_8(v4, 0x60, 0x5b, 0x0e, 0x78, 0x67, 0xf4, 0xd3, 0x0f, 0x75, 0x34, 0xc3, + 0xb1, 0x62, 0x42, 0xa9, 0x75); + asm volatile("vwmulsu.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_I16(1, v6, 0x14a0, 0x1bba, 0xfa6c, 0x03c0, 0x073e, 0xfd24, 0xb42c, + 0x01ef, 0x1f14, 0x11e0, 0x448e, 0xc3d9, 0x0b1a, 0x183c, 0xe2f4, + 0xcbe6); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xba33, 0x3a22, 0x9f52, 0x0c6a, 0xcb67, 0x790c, 0x1a85, 0x958e, + 0xe967, 0x52b6, 0xa453, 0xe306, 0x3c91, 0x0309, 0xcbad, 0x9b78); + VLOAD_16(v4, 0x84ef, 0xf522, 0x6224, 0x6e02, 0xeedb, 0x5a1f, 0x98d7, 0xa498, + 0x7a66, 0xdc69, 0xd88b, 0xa611, 0x5a08, 0x6836, 0x9130, 0x85be); + asm volatile("vwmulsu.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_I32(2, v6, 0xdbc1219d, 0x37aa4284, 0xdaefcb88, 0x0555a4d4, 0xceecc31d, + 0x2a9ce074, 0x0fd53db3, 0xbb8fc450, 0xf532150a, 0x473654a6, + 0xb2744111, 0xed33f766, 0x154cde88, 0x013c4be6, 0xe2532d70, + 0xcb7abb10); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x8bc45f0a, 0x8a60bc63, 0xf3fcddb9, 0xa810b1c8, 0x8cb59934, + 0x8d3334b0, 0x4387cb58, 0xc59d7a46, 0x939dd006, 0xfbd1dfc1, + 0x75307321, 0xb46b5a27, 0xfd2fbdda, 0xec141137, 0x3a1bc8a7, + 0xf0b1eb21); + VLOAD_32(v4, 0xe193ae9a, 0x57eccb97, 0x41d9eeff, 0xe8d58ddd, 0x2057ccc2, + 0x3122b84c, 0x003bb317, 0xcdfc6918, 0xb5883636, 0x52788c1f, + 0xab90d0a1, 0x6d890387, 0xf9bf35e7, 0xf88259a4, 0x79d9e6f0, + 0x8203a804); + asm volatile("vwmulsu.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_I64(3, v6, 0x99948a03e977f804, 0xd79a13a8a4b59f65, 0xfce8fa6d09d3d947, + 0xb005c64673bca1a8, 0xf16f28a6e85f8968, 0xe9f73b3d68722440, + 0x000fbf89e1a9cce8, 0xd10589f688d22c90, 0xb324e8f72e5b2544, + 0xfea741c2f93fa45f, 0x4e89a7a8de9337c1, 0xdfa941cb4089ff91, + 0xfd4155b0080871b6, 0xeca94be43cc5263c, 0x1ba897cf74e12690, + 0xf83a217108785484); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x37, 0x4e, 0x9a, 0x08, 0x12, 0xfd, 0xa4, 0x21, 0x44, 0x58, 0x5a, + 0xa9, 0x1d, 0x5e, 0xd4, 0x8e); + VLOAD_8(v4, 0x60, 0x5b, 0x0e, 0x78, 0x67, 0xf4, 0xd3, 0x0f, 0x75, 0x34, 0xc3, + 0xb1, 0x62, 0x42, 0xa9, 0x75); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulsu.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_I16(4, v6, 0, 0x1bba, 0, 0x03c0, 0, 0xfd24, 0, 0x01ef, 0, 0x11e0, 0, + 0xc3d9, 0, 0x183c, 0, 0xcbe6); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xba33, 0x3a22, 0x9f52, 0x0c6a, 0xcb67, 0x790c, 0x1a85, 0x958e, + 0xe967, 0x52b6, 0xa453, 0xe306, 0x3c91, 0x0309, 0xcbad, 0x9b78); + VLOAD_16(v4, 0x84ef, 0xf522, 0x6224, 0x6e02, 0xeedb, 0x5a1f, 0x98d7, 0xa498, + 0x7a66, 0xdc69, 0xd88b, 0xa611, 0x5a08, 0x6836, 0x9130, 0x85be); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulsu.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_I32(5, v6, 0, 0x37aa4284, 0, 0x0555a4d4, 0, 0x2a9ce074, 0, 0xbb8fc450, 0, + 0x473654a6, 0, 0xed33f766, 0, 0x013c4be6, 0, 0xcb7abb10); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x8bc45f0a, 0x8a60bc63, 0xf3fcddb9, 0xa810b1c8, 0x8cb59934, + 0x8d3334b0, 0x4387cb58, 0xc59d7a46, 0x939dd006, 0xfbd1dfc1, + 0x75307321, 0xb46b5a27, 0xfd2fbdda, 0xec141137, 0x3a1bc8a7, + 0xf0b1eb21); + VLOAD_32(v4, 0xe193ae9a, 0x57eccb97, 0x41d9eeff, 0xe8d58ddd, 0x2057ccc2, + 0x3122b84c, 0x003bb317, 0xcdfc6918, 0xb5883636, 0x52788c1f, + 0xab90d0a1, 0x6d890387, 0xf9bf35e7, 0xf88259a4, 0x79d9e6f0, + 0x8203a804); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulsu.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_I64(6, v6, 0, 0xd79a13a8a4b59f65, 0, 0xb005c64673bca1a8, 0, + 0xe9f73b3d68722440, 0, 0xd10589f688d22c90, 0, 0xfea741c2f93fa45f, 0, + 0xdfa941cb4089ff91, 0, 0xeca94be43cc5263c, 0, 0xf83a217108785484); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x16, 0x39, 0x0d, 0xcb, 0x02, 0x2b, 0xcd, 0x30, 0xec, 0x03, 0x18, + 0x78, 0xec, 0xba, 0xf8, 0x49); + uint64_t scalar = 5; + asm volatile("vwmulsu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(7, v6, 0x006e, 0x011d, 0x0041, 0xfef7, 0x000a, 0x00d7, 0xff01, + 0x00f0, 0xff9c, 0x000f, 0x0078, 0x0258, 0xff9c, 0xfea2, 0xffd8, + 0x016d); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x602f, 0x1b08, 0xfdd6, 0x7e53, 0x59f7, 0x70f1, 0x8a33, 0x5d93, + 0x02a3, 0x9f70, 0x3919, 0x8f2b, 0xc9d3, 0x1b65, 0x15bd, 0xf8be); + scalar = 5383; + asm volatile("vwmulsu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(8, v6, 0x07e67c49, 0x02386538, 0xffd27eda, 0x0a604345, 0x0763b8c1, + 0x0946db97, 0xf652f665, 0x07af9e05, 0x00377175, 0xf8118c10, + 0x04b09caf, 0xf6bb712d, 0xfb8cd3c5, 0x024008c3, 0x01c9192b, + 0xff676332); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x77036e08, 0xeb7bd8dc, 0x9c0d7f6a, 0x19d320f6, 0xb0c0d792, + 0x3f02203c, 0xf72a9ea9, 0x392f2986, 0x85b78fe8, 0xdc6a281b, + 0x146ffa52, 0x61f96c3c, 0x876cda10, 0x24d22032, 0xb6ffba3d, + 0xbbd29543); + scalar = 6474219; + asm volatile("vwmulsu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(9, v6, 0x002ded2f109a4958, 0xfff8153a6c2ccdf4, 0xffd96e55a002304e, + 0x0009f73117dc67d2, 0xffe16b51302b8506, 0x00185082d93ab314, + 0xfffc975917645623, 0x001611286b315402, 0xffd0cfd1f64e41f8, + 0xfff24492094603c9, 0x0007e2fc81b92b46, 0x0025cec234e97714, + 0xffd178914242bcb0, 0x000e357b1b4ecfe6, 0xffe3d4511153daff, + 0xffe5b0d6e5269f81); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x16, 0x39, 0x0d, 0xcb, 0x02, 0x2b, 0xcd, 0x30, 0xec, 0x03, 0x18, + 0x78, 0xec, 0xba, 0xf8, 0x49); + uint64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulsu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_I16(10, v6, 0, 0x011d, 0, 0xfef7, 0, 0x00d7, 0, 0x00f0, 0, 0x000f, 0, + 0x0258, 0, 0xfea2, 0, 0x016d); + + VSET(16, e16, m1); + VLOAD_16(v2, 0x602f, 0x1b08, 0xfdd6, 0x7e53, 0x59f7, 0x70f1, 0x8a33, 0x5d93, + 0x02a3, 0x9f70, 0x3919, 0x8f2b, 0xc9d3, 0x1b65, 0x15bd, 0xf8be); + scalar = 5383; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulsu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_I32(11, v6, 0, 0x02386538, 0, 0x0a604345, 0, 0x0946db97, 0, 0x07af9e05, + 0, 0xf8118c10, 0, 0xf6bb712d, 0, 0x024008c3, 0, 0xff676332); + + VSET(16, e32, m1); + VLOAD_32(v2, 0x77036e08, 0xeb7bd8dc, 0x9c0d7f6a, 0x19d320f6, 0xb0c0d792, + 0x3f02203c, 0xf72a9ea9, 0x392f2986, 0x85b78fe8, 0xdc6a281b, + 0x146ffa52, 0x61f96c3c, 0x876cda10, 0x24d22032, 0xb6ffba3d, + 0xbbd29543); + scalar = 6474219; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulsu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_I64(12, v6, 0, 0xfff8153a6c2ccdf4, 0, 0x0009f73117dc67d2, 0, + 0x00185082d93ab314, 0, 0x001611286b315402, 0, 0xfff24492094603c9, 0, + 0x0025cec234e97714, 0, 0x000e357b1b4ecfe6, 0, 0xffe5b0d6e5269f81); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwmulu.c b/apps/riscv-tests/isa/rv64uv/vwmulu.c new file mode 100644 index 0000000..aa3c819 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwmulu.c @@ -0,0 +1,182 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x74, 0xfb, 0xf4, 0xe9, 0xe5, 0x4e, 0x02, 0x27, 0xe9, 0x83, 0xfe, + 0x03, 0xb2, 0xb9, 0x9a, 0x71); + VLOAD_8(v4, 0x67, 0xa9, 0x07, 0x0f, 0xe3, 0x0d, 0xce, 0x81, 0xa2, 0xa5, 0x59, + 0x18, 0x0d, 0xac, 0x80, 0x31); + asm volatile("vwmulu.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(1, v6, 0x2eac, 0xa5b3, 0x06ac, 0x0da7, 0xcb0f, 0x03f6, 0x019c, + 0x13a7, 0x9372, 0x546f, 0x584e, 0x0048, 0x090a, 0x7c4c, 0x4d00, + 0x15a1); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xcf44, 0x249f, 0x3b1d, 0xea59, 0x0c47, 0xd24b, 0xce3e, 0xdb61, + 0x3506, 0xcee2, 0x3c7e, 0xc169, 0x05fd, 0x7fe6, 0xf7db, 0xb7cd); + VLOAD_16(v4, 0xaa0b, 0x2176, 0x34bc, 0x4aa6, 0x221e, 0x9f98, 0x63f5, 0x8da7, + 0x001d, 0x18d7, 0x1dbb, 0x5f2d, 0x0783, 0xd756, 0xa08d, 0x9c49); + asm volatile("vwmulu.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(2, v6, 0x89ac0fec, 0x04c9604a, 0x0c2d4d4c, 0x4455afb6, 0x01a2de52, + 0x83197188, 0x50875b56, 0x79638947, 0x000601ae, 0x1412efce, + 0x0706760a, 0x47e7f675, 0x002cfb77, 0x6b952144, 0x9b71639f, + 0x70355575); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xd6f59ab7, 0x3b760112, 0x185928a9, 0x344f2f98, 0x07084e45, + 0x0af492c5, 0x5de6f51a, 0x76783522, 0x36835490, 0x043d016f, + 0xf583b765, 0xd8796652, 0x1bd09e8f, 0xeecf0026, 0xdb725a7d, + 0x3a4c3ab3); + VLOAD_32(v4, 0x19f9f18b, 0x801fde9f, 0xaf759e4c, 0x9206cfd4, 0x2dc70e82, + 0xb57cb666, 0xc4ab14ac, 0xbf231e21, 0xdc6caaf4, 0x5bbc4031, + 0x2021a0db, 0x4e68ad25, 0xb090da86, 0xe32bd2c2, 0xf45e06d0, + 0xa5320284); + asm volatile("vwmulu.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(3, v6, 0x15cfdbd14900485d, 0x1dc267886466462e, 0x10b022995dcd602c, + 0x1dd68d77269f51e0, 0x0141ed9cff22850a, 0x07c4420a9e36887e, + 0x48239482c2b0b578, 0x5873f004fd5ed562, 0x2ef0007a98143940, + 0x0184cd5f928d063f, 0x1ed0b72b9e520367, 0x424d80e7e10133da, + 0x132f2a19b6a8c4da, 0xd3ea6e817f5f48cc, 0xd179981358ee7390, + 0x259e854b7db9aa4c); +}; + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0x74, 0xfb, 0xf4, 0xe9, 0xe5, 0x4e, 0x02, 0x27, 0xe9, 0x83, 0xfe, + 0x03, 0xb2, 0xb9, 0x9a, 0x71); + VLOAD_8(v4, 0x67, 0xa9, 0x07, 0x0f, 0xe3, 0x0d, 0xce, 0x81, 0xa2, 0xa5, 0x59, + 0x18, 0x0d, 0xac, 0x80, 0x31); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulu.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(4, v6, 0, 0xa5b3, 0, 0x0da7, 0, 0x03f6, 0, 0x13a7, 0, 0x546f, 0, + 0x0048, 0, 0x7c4c, 0, 0x15a1); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xcf44, 0x249f, 0x3b1d, 0xea59, 0x0c47, 0xd24b, 0xce3e, 0xdb61, + 0x3506, 0xcee2, 0x3c7e, 0xc169, 0x05fd, 0x7fe6, 0xf7db, 0xb7cd); + VLOAD_16(v4, 0xaa0b, 0x2176, 0x34bc, 0x4aa6, 0x221e, 0x9f98, 0x63f5, 0x8da7, + 0x001d, 0x18d7, 0x1dbb, 0x5f2d, 0x0783, 0xd756, 0xa08d, 0x9c49); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulu.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(5, v6, 0, 0x04c9604a, 0, 0x4455afb6, 0, 0x83197188, 0, 0x79638947, 0, + 0x1412efce, 0, 0x47e7f675, 0, 0x6b952144, 0, 0x70355575); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xd6f59ab7, 0x3b760112, 0x185928a9, 0x344f2f98, 0x07084e45, + 0x0af492c5, 0x5de6f51a, 0x76783522, 0x36835490, 0x043d016f, + 0xf583b765, 0xd8796652, 0x1bd09e8f, 0xeecf0026, 0xdb725a7d, + 0x3a4c3ab3); + VLOAD_32(v4, 0x19f9f18b, 0x801fde9f, 0xaf759e4c, 0x9206cfd4, 0x2dc70e82, + 0xb57cb666, 0xc4ab14ac, 0xbf231e21, 0xdc6caaf4, 0x5bbc4031, + 0x2021a0db, 0x4e68ad25, 0xb090da86, 0xe32bd2c2, 0xf45e06d0, + 0xa5320284); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulu.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(6, v6, 0, 0x1dc267886466462e, 0, 0x1dd68d77269f51e0, 0, + 0x07c4420a9e36887e, 0, 0x5873f004fd5ed562, 0, 0x0184cd5f928d063f, 0, + 0x424d80e7e10133da, 0, 0xd3ea6e817f5f48cc, 0, 0x259e854b7db9aa4c); +}; + +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xf8, 0x11, 0x12, 0xf1, 0x63, 0x21, 0x88, 0x3b, 0x01, 0xf5, 0x6d, + 0xf5, 0xb1, 0x54, 0xcd, 0xb0); + uint64_t scalar = 5; + asm volatile("vwmulu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(7, v6, 0x04d8, 0x0055, 0x005a, 0x04b5, 0x01ef, 0x00a5, 0x02a8, + 0x0127, 0x0005, 0x04c9, 0x0221, 0x04c9, 0x0375, 0x01a4, 0x0401, + 0x0370); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xf8e5, 0x6a23, 0xb52f, 0x8838, 0xb6d4, 0x5279, 0xf80e, 0xa450, + 0x13ec, 0x916f, 0x8edd, 0x0162, 0x9350, 0x9f74, 0xe1e7, 0x2719); + scalar = 5383; + asm volatile("vwmulu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(8, v6, 0x14719743, 0x08b7c5f5, 0x0ee1cf49, 0x0b305188, 0x0f0463cc, + 0x06c62e4f, 0x145fee62, 0x0d7f0e30, 0x01a2e774, 0x0bf21509, + 0x0bbc090b, 0x001d13ae, 0x0c199730, 0x0d18e02c, 0x128e2051, + 0x03361eaf); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xc41bf344, 0xad5aef4c, 0xf2b11789, 0xeb0d7526, 0xd6c67427, + 0x73724130, 0x440f954a, 0x0661455f, 0x450070ca, 0xc258c90c, + 0xf095d838, 0x358b0916, 0x6e1f1918, 0x4ebf2685, 0x3805d683, + 0x73715886); + scalar = 6474219; + asm volatile("vwmulu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(9, v6, 0x004bad6117b0b36c, 0x0042e58b237456c4, 0x005da736d67d2bc3, + 0x005ab48c2ee15fe2, 0x0052e15f704d3ecd, 0x002c8ccba3708710, + 0x001a43a5dcd924ee, 0x00027644c9204535, 0x001aa097dd4a236e, + 0x004aff4713f2fa04, 0x005cd71f45c17368, 0x0014a974cb2f9d32, + 0x002a7ec31c6fe108, 0x001e63491da0c917, 0x00159e6c20eec541, + 0x002c8c71dad97902); +}; + +void TEST_CASE4(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 0xf8, 0x11, 0x12, 0xf1, 0x63, 0x21, 0x88, 0x3b, 0x01, 0xf5, 0x6d, + 0xf5, 0xb1, 0x54, 0xcd, 0xb0); + uint64_t scalar = 5; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(10, v6, 0, 0x0055, 0, 0x04b5, 0, 0x00a5, 0, 0x0127, 0, 0x04c9, 0, + 0x04c9, 0, 0x01a4, 0, 0x0370); + + VSET(16, e16, m1); + VLOAD_16(v2, 0xf8e5, 0x6a23, 0xb52f, 0x8838, 0xb6d4, 0x5279, 0xf80e, 0xa450, + 0x13ec, 0x916f, 0x8edd, 0x0162, 0x9350, 0x9f74, 0xe1e7, 0x2719); + scalar = 5383; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(11, v6, 0, 0x08b7c5f5, 0, 0x0b305188, 0, 0x06c62e4f, 0, 0x0d7f0e30, + 0, 0x0bf21509, 0, 0x001d13ae, 0, 0x0d18e02c, 0, 0x03361eaf); + + VSET(16, e32, m1); + VLOAD_32(v2, 0xc41bf344, 0xad5aef4c, 0xf2b11789, 0xeb0d7526, 0xd6c67427, + 0x73724130, 0x440f954a, 0x0661455f, 0x450070ca, 0xc258c90c, + 0xf095d838, 0x358b0916, 0x6e1f1918, 0x4ebf2685, 0x3805d683, + 0x73715886); + scalar = 6474219; + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwmulu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(12, v6, 0, 0x0042e58b237456c4, 0, 0x005ab48c2ee15fe2, 0, + 0x002c8ccba3708710, 0, 0x00027644c9204535, 0, 0x004aff4713f2fa04, 0, + 0x0014a974cb2f9d32, 0, 0x001e63491da0c917, 0, 0x002c8c71dad97902); +}; + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwredsum.c b/apps/riscv-tests/isa/rv64uv/vwredsum.c new file mode 100644 index 0000000..729831c --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwredsum.c @@ -0,0 +1,153 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 255); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U16(1, v4, 327); + + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U32(2, v4, 73); + + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U64(3, v4, 73); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 255); + VLOAD_16(v4, 1); + asm volatile("vwredsum.vs v4, v6, v2, v0.t"); + VCMP_U16(4, v4, 291); + + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + VLOAD_32(v4, 1); + asm volatile("vwredsum.vs v4, v6, v2, v0.t"); + VCMP_U32(5, v4, 37); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + VLOAD_64(v4, 1); + asm volatile("vwredsum.vs v4, v6, v2, v0.t"); + VCMP_U64(6, v4, 37); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U16(7, v4, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U32(8, v4, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U64(9, v4, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(15, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U16(10, v4, 65, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(1, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U32(11, v4, 2, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(3, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U64(12, v4, 7, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(15, e8, m1); + VLOAD_8(v0, 0x00, 0x40); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 100, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2, v0.t"); + VCMP_U16(13, v4, 107, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(1, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2, v0.t"); + VCMP_U32(14, v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(3, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsum.vs v4, v6, v2, v0.t"); + VCMP_U64(15, v4, 3, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Test difference from vwredsumu +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 255, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 255); + asm volatile("vwredsum.vs v4, v6, v2"); + VCMP_U16(16, v4, 325); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwredsumu.c b/apps/riscv-tests/isa/rv64uv/vwredsumu.c new file mode 100644 index 0000000..f088976 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwredsumu.c @@ -0,0 +1,153 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matteo Perotti + +#include "vector_macros.h" + +// Naive test +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 255); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U16(1, v4, 327); + + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U32(2, v4, 73); + + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U64(3, v4, 73); +} + +// Masked naive test +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 255); + VLOAD_16(v4, 1); + asm volatile("vwredsumu.vs v4, v6, v2, v0.t"); + VCMP_U16(4, v4, 291); + + VSET(16, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1); + VLOAD_32(v4, 1); + asm volatile("vwredsumu.vs v4, v6, v2, v0.t"); + VCMP_U32(5, v4, 37); + + VSET(16, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1); + VLOAD_64(v4, 1); + asm volatile("vwredsumu.vs v4, v6, v2, v0.t"); + VCMP_U64(6, v4, 37); +} + +// Are we respecting the undisturbed tail policy? +void TEST_CASE3(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U16(7, v4, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U32(8, v4, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(16, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U64(9, v4, 73, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Odd number of elements, undisturbed policy +void TEST_CASE4(void) { + VSET(15, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U16(10, v4, 65, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(1, e16, m1); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U32(11, v4, 2, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(3, e32, m1); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U64(12, v4, 7, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Odd number of elements, undisturbed policy, and mask +void TEST_CASE5(void) { + VSET(15, e8, m1); + VLOAD_8(v0, 0x00, 0x40); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 100, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2, v0.t"); + VCMP_U16(13, v4, 107, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(1, e16, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_16(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2, v0.t"); + VCMP_U32(14, v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + + VSET(3, e32, m1); + VLOAD_8(v0, 0xaa, 0x55); + VLOAD_32(v6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_64(v4, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + asm volatile("vwredsumu.vs v4, v6, v2, v0.t"); + VCMP_U64(15, v4, 3, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); +} + +// Test difference from vwredsumu +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_8(v6, 1, 2, 3, 4, 5, 6, 7, 8, 255, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v2, 255); + asm volatile("vwredsumu.vs v4, v6, v2"); + VCMP_U16(16, v4, 581); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwsub.c b/apps/riscv-tests/isa/rv64uv/vwsub.c new file mode 100644 index 0000000..29f3531 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwsub.c @@ -0,0 +1,234 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsub.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(1, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsub.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(2, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsub.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(3, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(4, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(5, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(6, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); +} + +void TEST_CASE3(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsub.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(7, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsub.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(8, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsub.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(9, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); +} + +void TEST_CASE4(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(10, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(11, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(12, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); +} + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsub.wv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(13, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsub.wv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(14, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsub.wv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(15, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); +} + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.wv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(16, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.wv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(17, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.wv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(18, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); +} + +void TEST_CASE7(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsub.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(19, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsub.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(20, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsub.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(21, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); +} + +void TEST_CASE8(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(22, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(23, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsub.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(24, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vwsubu.c b/apps/riscv-tests/isa/rv64uv/vwsubu.c new file mode 100644 index 0000000..760e605 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vwsubu.c @@ -0,0 +1,234 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsubu.vv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(1, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsubu.vv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(2, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsubu.vv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(3, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); +} + +void TEST_CASE2(void) { + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.vv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(4, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.vv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(5, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.vv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(6, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); +} + +void TEST_CASE3(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsubu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(7, v6, -4, 249, -2, 247, 0, 245, 2, 243, 4, 241, 6, 239, 8, 237, 10, + 235); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsubu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(8, v6, -4, 65529, -2, 65527, 0, 65525, 2, 65523, 4, 65521, 6, 65519, + 8, 65517, 10, 65515); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsubu.vx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(9, v6, -4, 4294967289, -2, 4294967287, 0, 4294967285, 2, 4294967283, + 4, 4294967281, 6, 4294967279, 8, 4294967277, 10, 4294967275); +} + +void TEST_CASE4(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_8(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(10, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e16, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(11, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e32, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.vx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(12, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); +} + +void TEST_CASE5(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsubu.wv v6, v2, v4"); + VSET(16, e16, m1); + VCMP_U16(13, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsubu.wv v6, v2, v4"); + VSET(16, e32, m1); + VCMP_U32(14, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + asm volatile("vwsubu.wv v6, v2, v4"); + VSET(16, e64, m1); + VCMP_U64(15, v6, -7, -5, -3, -1, 1, 3, 5, 7, -7, -5, -3, -1, 1, 3, 5, 7); +} + +void TEST_CASE6(void) { + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.wv v6, v2, v4, v0.t"); + VSET(16, e16, m1); + VCMP_U16(16, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_16(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.wv v6, v2, v4, v0.t"); + VSET(16, e32, m1); + VCMP_U32(17, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_32(v4, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.wv v6, v2, v4, v0.t"); + VSET(16, e64, m1); + VCMP_U64(18, v6, 0, -5, 0, -1, 0, 3, 0, 7, 0, -5, 0, -1, 0, 3, 0, 7); +} + +void TEST_CASE7(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsubu.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(19, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsubu.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(20, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16); + asm volatile("vwsubu.wx v6, v2, %[A]" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(21, v6, -4, -7, -2, -9, 0, -11, 2, -13, 4, -15, 6, -17, 8, -19, 10, + -21); +} + +void TEST_CASE8(void) { + const uint32_t scalar = 5; + + VSET(16, e8, m1); + VLOAD_16(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e16, m1); + VCMP_U16(22, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e16, m1); + VLOAD_32(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e32, m1); + VCMP_U32(23, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); + + VSET(16, e32, m1); + VLOAD_64(v2, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v6); + asm volatile("vwsubu.wx v6, v2, %[A], v0.t" ::[A] "r"(scalar)); + VSET(16, e64, m1); + VCMP_U64(24, v6, 0, -3, 0, -1, 0, 1, 0, 3, 0, -3, 0, -1, 0, 1, 0, 3); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + TEST_CASE7(); + TEST_CASE8(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vxor.c b/apps/riscv-tests/isa/rv64uv/vxor.c new file mode 100644 index 0000000..361f4d7 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vxor.c @@ -0,0 +1,309 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v3, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, + 0xf0); + asm volatile("vxor.vv v1, v2, v3"); + VCMP_U8(1, v1, 0x0f, 0x02, 0x00, 0x0f, 0x02, 0x00, 0x0f, 0x02, 0x00, 0x0f, + 0x02, 0x00); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_16(v3, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, + 0xf0f0, 0xff00, 0x0003, 0xf0f0); + asm volatile("vxor.vv v1, v2, v3"); + VCMP_U16(2, v1, 0x00ff, 0x0002, 0x0000, 0x00ff, 0x0002, 0x0000, 0x00ff, + 0x0002, 0x0000, 0x00ff, 0x0002, 0x0000); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_32(v3, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, 0x00000003, + 0xf0f0f0f0, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, + 0x00000003, 0xf0f0f0f0); + asm volatile("vxor.vv v1, v2, v3"); + VCMP_U32(3, v1, 0x0000ffff, 0x00000002, 0x00000000, 0x0000ffff, 0x00000002, + 0x00000000, 0x0000ffff, 0x00000002, 0x00000000, 0x0000ffff, + 0x00000002, 0x00000000); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v3, 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); + asm volatile("vxor.vv v1, v2, v3"); + VCMP_U64(4, v1, 0x00000000ffffffff, 0x0000000000000002, 0x0000000000000000, + 0x00000000ffffffff, 0x0000000000000002, 0x0000000000000000, + 0x00000000ffffffff, 0x0000000000000002, 0x0000000000000000, + 0x00000000ffffffff, 0x0000000000000002, 0x0000000000000000); +} + +void TEST_CASE2() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v3, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, 0xf0, 0xf0, 0x03, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vxor.vv v1, v2, v3, v0.t"); + VCMP_U8(5, v1, 0x0f, 0xef, 0x00, 0x0f, 0xef, 0x00, 0x0f, 0xef, 0x00, 0x0f, + 0xef, 0x00); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_16(v3, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, 0xf0f0, 0xff00, 0x0003, + 0xf0f0, 0xff00, 0x0003, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vxor.vv v1, v2, v3, v0.t"); + VCMP_U16(6, v1, 0x00ff, 0xbeef, 0x0000, 0x00ff, 0xbeef, 0x0000, 0x00ff, + 0xbeef, 0x0000, 0x00ff, 0xbeef, 0x0000); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_32(v3, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, 0x00000003, + 0xf0f0f0f0, 0xffff0000, 0x00000003, 0xf0f0f0f0, 0xffff0000, + 0x00000003, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vxor.vv v1, v2, v3, v0.t"); + VCMP_U32(7, v1, 0x0000ffff, 0xdeadbeef, 0x00000000, 0x0000ffff, 0xdeadbeef, + 0x00000000, 0x0000ffff, 0xdeadbeef, 0x00000000, 0x0000ffff, + 0xdeadbeef, 0x00000000); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_64(v3, 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0, + 0xffffffff00000000, 0x0000000000000003, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vxor.vv v1, v2, v3, v0.t"); + VCMP_U64(8, v1, 0x00000000ffffffff, 0xdeadbeefdeadbeef, 0x0000000000000000, + 0x00000000ffffffff, 0xdeadbeefdeadbeef, 0x0000000000000000, + 0x00000000ffffffff, 0xdeadbeefdeadbeef, 0x0000000000000000, + 0x00000000ffffffff, 0xdeadbeefdeadbeef, 0x0000000000000000); +} + +void TEST_CASE3() { + const uint64_t scalar = 0x0ff00ff00ff00ff0; + + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + asm volatile("vxor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U8(9, v1, 0x0f, 0xf1, 0x00, 0x0f, 0xf1, 0x00, 0x0f, 0xf1, 0x00, 0x0f, + 0xf1, 0x00); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + asm volatile("vxor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U16(10, v1, 0xf00f, 0x0ff1, 0xff00, 0xf00f, 0x0ff1, 0xff00, 0xf00f, + 0x0ff1, 0xff00, 0xf00f, 0x0ff1, 0xff00); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + asm volatile("vxor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U32(11, v1, 0xf00ff00f, 0x0ff00ff1, 0xff00ff00, 0xf00ff00f, 0x0ff00ff1, + 0xff00ff00, 0xf00ff00f, 0x0ff00ff1, 0xff00ff00, 0xf00ff00f, + 0x0ff00ff1, 0xff00ff00); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + asm volatile("vxor.vx v1, v2, %[A]" ::[A] "r"(scalar)); + VCMP_U64(12, v1, 0xf00ff00ff00ff00f, 0x0ff00ff00ff00ff1, 0xff00ff00ff00ff00, + 0xf00ff00ff00ff00f, 0x0ff00ff00ff00ff1, 0xff00ff00ff00ff00, + 0xf00ff00ff00ff00f, 0x0ff00ff00ff00ff1, 0xff00ff00ff00ff00, + 0xf00ff00ff00ff00f, 0x0ff00ff00ff00ff1, 0xff00ff00ff00ff00); +} + +void TEST_CASE4() { + const uint64_t scalar = 0x0ff00ff00ff00ff0; + + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vxor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U8(13, v1, 0x0f, 0xef, 0x00, 0x0f, 0xef, 0x00, 0x0f, 0xef, 0x00, 0x0f, + 0xef, 0x00); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vxor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U16(14, v1, 0xf00f, 0xbeef, 0xff00, 0xf00f, 0xbeef, 0xff00, 0xf00f, + 0xbeef, 0xff00, 0xf00f, 0xbeef, 0xff00); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vxor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U32(15, v1, 0xf00ff00f, 0xdeadbeef, 0xff00ff00, 0xf00ff00f, 0xdeadbeef, + 0xff00ff00, 0xf00ff00f, 0xdeadbeef, 0xff00ff00, 0xf00ff00f, + 0xdeadbeef, 0xff00ff00); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vxor.vx v1, v2, %[A], v0.t" ::[A] "r"(scalar)); + VCMP_U64(16, v1, 0xf00ff00ff00ff00f, 0xdeadbeefdeadbeef, 0xff00ff00ff00ff00, + 0xf00ff00ff00ff00f, 0xdeadbeefdeadbeef, 0xff00ff00ff00ff00, + 0xf00ff00ff00ff00f, 0xdeadbeefdeadbeef, 0xff00ff00ff00ff00, + 0xf00ff00ff00ff00f, 0xdeadbeefdeadbeef, 0xff00ff00ff00ff00); +} + +void TEST_CASE5() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + asm volatile("vxor.vi v1, v2, 15"); + VCMP_U8(17, v1, 0xf0, 0x0e, 0xff, 0xf0, 0x0e, 0xff, 0xf0, 0x0e, 0xff, 0xf0, + 0x0e, 0xff); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + asm volatile("vxor.vi v1, v2, 15"); + VCMP_U16(18, v1, 0xfff0, 0x000e, 0xf0ff, 0xfff0, 0x000e, 0xf0ff, 0xfff0, + 0x000e, 0xf0ff, 0xfff0, 0x000e, 0xf0ff); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + asm volatile("vxor.vi v1, v2, 15"); + VCMP_U32(19, v1, 0xfffffff0, 0x0000000e, 0xf0f0f0ff, 0xfffffff0, 0x0000000e, + 0xf0f0f0ff, 0xfffffff0, 0x0000000e, 0xf0f0f0ff, 0xfffffff0, + 0x0000000e, 0xf0f0f0ff); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + asm volatile("vxor.vi v1, v2, 15"); + VCMP_U64(20, v1, 0xfffffffffffffff0, 0x000000000000000e, 0xf0f0f0f0f0f0f0ff, + 0xfffffffffffffff0, 0x000000000000000e, 0xf0f0f0f0f0f0f0ff, + 0xfffffffffffffff0, 0x000000000000000e, 0xf0f0f0f0f0f0f0ff, + 0xfffffffffffffff0, 0x000000000000000e, 0xf0f0f0f0f0f0f0ff); +} + +void TEST_CASE6() { + VSET(12, e8, m1); + VLOAD_8(v2, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, + 0xf0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_8(v1, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, + 0xef); + asm volatile("vxor.vi v1, v2, 15, v0.t"); + VCMP_U8(21, v1, 0xf0, 0xef, 0xff, 0xf0, 0xef, 0xff, 0xf0, 0xef, 0xff, 0xf0, + 0xef, 0xff); + + VSET(12, e16, m1); + VLOAD_16(v2, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, 0xf0f0, 0xffff, 0x0001, + 0xf0f0, 0xffff, 0x0001, 0xf0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_16(v1, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, 0xbeef, + 0xbeef, 0xbeef, 0xbeef, 0xbeef); + asm volatile("vxor.vi v1, v2, 15, v0.t"); + VCMP_U16(22, v1, 0xfff0, 0xbeef, 0xf0ff, 0xfff0, 0xbeef, 0xf0ff, 0xfff0, + 0xbeef, 0xf0ff, 0xfff0, 0xbeef, 0xf0ff); + + VSET(12, e32, m1); + VLOAD_32(v2, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, 0x00000001, + 0xf0f0f0f0, 0xffffffff, 0x00000001, 0xf0f0f0f0, 0xffffffff, + 0x00000001, 0xf0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_32(v1, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, + 0xdeadbeef, 0xdeadbeef); + asm volatile("vxor.vi v1, v2, 15, v0.t"); + VCMP_U32(23, v1, 0xfffffff0, 0xdeadbeef, 0xf0f0f0ff, 0xfffffff0, 0xdeadbeef, + 0xf0f0f0ff, 0xfffffff0, 0xdeadbeef, 0xf0f0f0ff, 0xfffffff0, + 0xdeadbeef, 0xf0f0f0ff); + + VSET(12, e64, m1); + VLOAD_64(v2, 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0, + 0xffffffffffffffff, 0x0000000000000001, 0xf0f0f0f0f0f0f0f0); + VLOAD_8(v0, 0x6D, 0x0B); + VLOAD_64(v1, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, + 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef); + asm volatile("vxor.vi v1, v2, 15, v0.t"); + VCMP_U64(40, v1, 0xfffffffffffffff0, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff, + 0xfffffffffffffff0, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff, + 0xfffffffffffffff0, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff, + 0xfffffffffffffff0, 0xdeadbeefdeadbeef, 0xf0f0f0f0f0f0f0ff); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/isa/rv64uv/vzext.c b/apps/riscv-tests/isa/rv64uv/vzext.c new file mode 100644 index 0000000..5434dd5 --- /dev/null +++ b/apps/riscv-tests/isa/rv64uv/vzext.c @@ -0,0 +1,115 @@ +// Copyright 2021 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Author: Matheus Cavalcante +// Basile Bougenot + +#include "vector_macros.h" + +void TEST_CASE1(void) { + VSET(16, e16, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vzext.vf2 v2, v1"); + VCMP_U16(1, v2, 1, 2, 253, 252, 5, 6, 249, 248, 255, 254, 3, 4, 251, 250, 7, + 8); + + VSET(16, e32, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vzext.vf2 v2, v1"); + VCMP_U32(2, v2, 1, 2, 65533, 65532, 5, 6, 65529, 65528, 65535, 65534, 3, 4, + 65531, 65530, 7, 8); + + VSET(16, e64, m1); + VLOAD_32(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vzext.vf2 v2, v1"); + VCMP_U64(3, v2, 1, 2, 4294967293, 4294967292, 5, 6, 4294967289, 4294967288, + 4294967295, 4294967294, 3, 4, 4294967291, 4294967290, 7, 8); +} + +void TEST_CASE2(void) { + VSET(16, e16, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vzext.vf2 v2, v1, v0.t"); + VCMP_U16(4, v2, 0, 2, 0, 252, 0, 6, 0, 248, 0, 254, 0, 4, 0, 250, 0, 8); + + VSET(16, e32, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vzext.vf2 v2, v1, v0.t"); + VCMP_U32(5, v2, 0, 2, 0, 65532, 0, 6, 0, 65528, 0, 65534, 0, 4, 0, 65530, 0, + 8); + + VSET(16, e64, m1); + VLOAD_32(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vzext.vf2 v2, v1, v0.t"); + VCMP_U64(6, v2, 0, 2, 0, 4294967292, 0, 6, 0, 4294967288, 0, 4294967294, 0, 4, + 0, 4294967290, 0, 8); +} + +void TEST_CASE3(void) { + VSET(16, e32, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vzext.vf4 v2, v1"); + VCMP_U32(7, v2, 1, 2, 253, 252, 5, 6, 249, 248, 255, 254, 3, 4, 251, 250, 7, + 8); + + VSET(16, e64, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vzext.vf4 v2, v1"); + VCMP_U64(8, v2, 1, 2, 65533, 65532, 5, 6, 65529, 65528, 65535, 65534, 3, 4, + 65531, 65530, 7, 8); +} + +void TEST_CASE4(void) { + VSET(16, e32, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vzext.vf4 v2, v1, v0.t"); + VCMP_U32(9, v2, 0, 2, 0, 252, 0, 6, 0, 248, 0, 254, 0, 4, 0, 250, 0, 8); + + VSET(16, e64, m1); + VLOAD_16(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vzext.vf4 v2, v1, v0.t"); + VCMP_U64(10, v2, 0, 2, 0, 65532, 0, 6, 0, 65528, 0, 65534, 0, 4, 0, 65530, 0, + 8); +} + +void TEST_CASE5(void) { + VSET(16, e64, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + asm volatile("vzext.vf8 v2, v1"); + VCMP_U64(11, v2, 1, 2, 253, 252, 5, 6, 249, 248, 255, 254, 3, 4, 251, 250, 7, + 8); +} + +void TEST_CASE6(void) { + VSET(16, e64, m1); + VLOAD_8(v1, 1, 2, -3, -4, 5, 6, -7, -8, -1, -2, 3, 4, -5, -6, 7, 8); + VLOAD_8(v0, 0xAA, 0xAA); + VCLEAR(v2); + asm volatile("vzext.vf8 v2, v1, v0.t"); + VCMP_U64(12, v2, 0, 2, 0, 252, 0, 6, 0, 248, 0, 254, 0, 4, 0, 250, 0, 8); +} + +int main(void) { + INIT_CHECK(); + enable_vec(); + + TEST_CASE1(); + TEST_CASE2(); + TEST_CASE3(); + TEST_CASE4(); + TEST_CASE5(); + TEST_CASE6(); + + EXIT_CHECK(); +} diff --git a/apps/riscv-tests/mt/.gitignore b/apps/riscv-tests/mt/.gitignore new file mode 100644 index 0000000..131616e --- /dev/null +++ b/apps/riscv-tests/mt/.gitignore @@ -0,0 +1,6 @@ +*.riscv +*.host +*.o +*.dump +*.out +*.hex diff --git a/apps/riscv-tests/mt/Makefile b/apps/riscv-tests/mt/Makefile new file mode 100644 index 0000000..b45e551 --- /dev/null +++ b/apps/riscv-tests/mt/Makefile @@ -0,0 +1,162 @@ +#/======================================================================= +# UCB VLSI FLOW: Makefile for riscv-bmarks/mt +#----------------------------------------------------------------------- +# Henry Cook (hcook@cs.berkeley.edu) +# + +default: all + +bmarkdir = . +common = ../benchmarks/common + +instname = riscv-bmarks-mt +instbasedir = $(UCB_VLSI_HOME)/install + +#-------------------------------------------------------------------- +# Sources +#-------------------------------------------------------------------- + +bmarks_matmul = \ +ad_matmul\ +ae_matmul\ +af_matmul\ +ag_matmul\ +ai_matmul\ +ak_matmul\ +al_matmul\ +am_matmul\ +an_matmul\ +ap_matmul\ +aq_matmul\ +ar_matmul\ +at_matmul\ +av_matmul\ +ay_matmul\ +az_matmul\ +bb_matmul\ +bc_matmul\ +bf_matmul\ +bh_matmul\ +bj_matmul\ +bk_matmul\ +bm_matmul\ +bo_matmul\ +br_matmul\ +bs_matmul\ +ce_matmul\ +cf_matmul\ +cg_matmul\ +ci_matmul\ +ck_matmul\ +cl_matmul\ +cm_matmul\ +cs_matmul\ +cv_matmul\ +cy_matmul\ +dc_matmul\ +df_matmul\ +dm_matmul\ +do_matmul\ +dr_matmul\ +ds_matmul\ +du_matmul\ +dv_matmul\ + +bmarks_vvadd = \ +vvadd0\ +vvadd1\ +vvadd2\ +vvadd3\ +vvadd4\ + +bmarks = $(bmarks_vvadd) $(bmarks_matmul) + +#-------------------------------------------------------------------- +# Build rules +#-------------------------------------------------------------------- + +RISCV_PREFIX=riscv$(XLEN)-unknown-elf- +RISCV_GCC = $(RISCV_PREFIX)gcc +RISCV_GCC_OPTS = -std=gnu99 -O2 -ffast-math +RISCV_LINK = $(RISCV_GCC) -T $(common)/test.ld $(incs) +RISCV_LINK_OPTS = -nostdlib -nostartfiles -ffast-math -lc +RISCV_OBJDUMP = $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data +RISCV_SIM = spike -p2 + +VPATH += $(common) $(common)/../mt-matmul $(common)/../mt-vvadd + +incs += -I. -I$(bmarkdir)/../env -I$(common) -I$(common)/../mt-matmul -I$(common)/../mt-vvadd +objs := + +#include $(patsubst %, $(bmarkdir)/%/bmark.mk, $(bmarks)) + +#------------------------------------------------------------ +# Build and run benchmarks on riscv simulator +#------------------------------------------------------------ + +bmarks_riscv_obj = $(addsuffix .o, $(bmarks)) +bmarks_riscv_matmul_bin = $(addsuffix .riscv, $(bmarks_matmul)) +bmarks_riscv_vvadd_bin = $(addsuffix .riscv, $(bmarks_vvadd)) +bmarks_riscv_dump = $(addsuffix .riscv.dump, $(bmarks)) +bmarks_riscv_hex = $(addsuffix .riscv.hex, $(bmarks)) +bmarks_riscv_out = $(addsuffix .riscv.out, $(bmarks)) +bmarks_riscv_bin = $(bmarks_riscv_matmul_bin) $(bmarks_riscv_vvadd_bin) + +bmarks_defs = -DPREALLOCATE=1 -DHOST_DEBUG=0 +bmarks_cycles = 80000 + +%.hex: % + elf2hex 16 32768 $< > $@ + +$(bmarks_riscv_vvadd_bin): %.riscv: %.o mt-vvadd.o syscalls.o crt.o + $(RISCV_LINK) $< mt-vvadd.o syscalls.o crt.o $(RISCV_LINK_OPTS) -o $@ + +$(bmarks_riscv_matmul_bin): %.riscv: %.o mt-matmul.o syscalls.o crt.o + $(RISCV_LINK) $< mt-matmul.o syscalls.o crt.o $(RISCV_LINK_OPTS) -o $@ + +$(bmarks_riscv_dump): %.riscv.dump: %.riscv + $(RISCV_OBJDUMP) $< > $@ + +$(bmarks_riscv_out): %.riscv.out: %.riscv + $(RISCV_SIM) $< > $@ + +%.o: %.c + $(RISCV_GCC) $(RISCV_GCC_OPTS) $(bmarks_defs) -D__ASSEMBLY__=1 \ + -c $(incs) $< -o $@ + +%.o: %.S + $(RISCV_GCC) $(RISCV_GCC_OPTS) $(bmarks_defs) \ + -c $(incs) $< -o $@ + +riscv: $(bmarks_riscv_dump) $(bmarks_riscv_hex) +run-riscv: $(bmarks_riscv_out) + echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \ + +junk += $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(bmarks_riscv_hex) $(bmarks_riscv_out) $(bmarks_riscv_obj) + + +#------------------------------------------------------------ +# Default + +all: riscv + +#------------------------------------------------------------ +# Install + +date_suffix = $(shell date +%Y-%m-%d_%H-%M) +install_dir = $(instbasedir)/$(instname)-$(date_suffix) +latest_install = $(shell ls -1 -d $(instbasedir)/$(instname)* | tail -n 1) + +install: + mkdir $(install_dir) + cp -r $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(install_dir) + +install-link: + rm -rf $(instbasedir)/$(instname) + ln -s $(latest_install) $(instbasedir)/$(instname) + +#------------------------------------------------------------ +# Clean up + +clean: + rm -rf $(objs) $(junk) syscall.o crt.o mt-matmul.o mt-vvadd.o diff --git a/apps/riscv-tests/mt/ad_matmul.c b/apps/riscv-tests/mt/ad_matmul.c new file mode 100644 index 0000000..60e6e6c --- /dev/null +++ b/apps/riscv-tests/mt/ad_matmul.c @@ -0,0 +1,37 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + int i, k; + int j = coreid*(lda/ncores); + int jend = (coreid+1)*(lda/ncores); + for ( ; j < jend; j++ ) + { + int j32 = j << 5; + data_t* Cj32 = C + j32; + for ( k = 0; k < 32; k+=2 ) + { + data_t Aj32k = A[k + j32]; + data_t Aj32k2 = A[k + 1 + j32]; + data_t* Bk32 = B + (k << 5); + data_t* Bk322 = Bk32 + 32; + for ( i = 0; i < 32; i+=4 ) + { + Cj32[i] += Aj32k * Bk32 [i]; + Cj32[i] += Aj32k2 * Bk322 [i]; + Cj32[i+1] += Aj32k * Bk32 [i+1]; + Cj32[i+1] += Aj32k2 * Bk322[i+1]; + Cj32[i+2] += Aj32k * Bk32 [i+2]; + Cj32[i+2] += Aj32k2 * Bk322[i+2]; + Cj32[i+3] += Aj32k * Bk32 [i+3]; + Cj32[i+3] += Aj32k2 * Bk322[i+3]; + } + barrier(ncores); + } + } + + +} diff --git a/apps/riscv-tests/mt/ae_matmul.c b/apps/riscv-tests/mt/ae_matmul.c new file mode 100644 index 0000000..a1f97b2 --- /dev/null +++ b/apps/riscv-tests/mt/ae_matmul.c @@ -0,0 +1,110 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + + + + data_t *b1; + data_t *b2; + data_t *b3; + data_t *b4; + data_t c1; + data_t c2; + data_t c3; + data_t c4; + data_t a1; + data_t a2; + data_t a3; + data_t a4; + data_t a5; + data_t a6; + data_t a7; + data_t a8; + int i, j, k; + static data_t BB[1024]; + + + + //transpose B + for ( k = 0; k < lda; k++) { + for ( i = coreid*(lda/ncores); i < (coreid+1)*(lda/ncores); i++ ) { + BB[i*lda + k] = B[k*lda + i]; + } + barrier(ncores); + } + + for ( i = 0; i < lda; i+=4 ) { + for ( j = coreid*(lda/ncores); j < (coreid+1)*(lda/ncores); j++ ) { + c1 = 0; c2 = 0; c3 = 0; c4 = 0; + b1 = &BB[(i+0)*lda]; + b2 = &BB[(i+1)*lda]; + b3 = &BB[(i+2)*lda]; + b4 = &BB[(i+3)*lda]; + for ( k = 0; k < lda; k+=8 ) { + + a1 = A[j*lda + k+0]; + a2 = A[j*lda + k+1]; + a3 = A[j*lda + k+2]; + a4 = A[j*lda + k+3]; + a5 = A[j*lda + k+4]; + a6 = A[j*lda + k+5]; + a7 = A[j*lda + k+6]; + a8 = A[j*lda + k+7]; + + c1 += a1 * b1[k+0]; + c1 += a2 * b1[k+1]; + c1 += a3 * b1[k+2]; + c1 += a4 * b1[k+3]; + c1 += a5 * b1[k+4]; + c1 += a6 * b1[k+5]; + c1 += a7 * b1[k+6]; + c1 += a8 * b1[k+7]; + + c2 += a1 * b2[k+0]; + c2 += a2 * b2[k+1]; + c2 += a3 * b2[k+2]; + c2 += a4 * b2[k+3]; + c2 += a5 * b2[k+4]; + c2 += a6 * b2[k+5]; + c2 += a7 * b2[k+6]; + c2 += a8 * b2[k+7]; + + c3 += a1 * b3[k+0]; + c3 += a2 * b3[k+1]; + c3 += a3 * b3[k+2]; + c3 += a4 * b3[k+3]; + c3 += a5 * b3[k+4]; + c3 += a6 * b3[k+5]; + c3 += a7 * b3[k+6]; + c3 += a8 * b3[k+7]; + + c4 += a1 * b4[k+0]; + c4 += a2 * b4[k+1]; + c4 += a3 * b4[k+2]; + c4 += a4 * b4[k+3]; + c4 += a5 * b4[k+4]; + c4 += a6 * b4[k+5]; + c4 += a7 * b4[k+6]; + c4 += a8 * b4[k+7]; + + + } + C[i+0 + j*lda] = c1; + C[i+1 + j*lda] = c2; + C[i+2 + j*lda] = c3; + C[i+3 + j*lda] = c4; + barrier(ncores); + } + } + +} diff --git a/apps/riscv-tests/mt/af_matmul.c b/apps/riscv-tests/mt/af_matmul.c new file mode 100644 index 0000000..a147b62 --- /dev/null +++ b/apps/riscv-tests/mt/af_matmul.c @@ -0,0 +1,79 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + size_t i, j, k, l; + int row,row2, column, column2, column3, column4, column5, column6, column7, column8; + data_t element, element2, element3, element4, element5, element6, element7, element8; + data_t B1, B2, B3, B4; + data_t temp_mat[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + data_t temp_mat2[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int local_lda = lda; + + for (l=coreid*local_lda/ncores; l= 0; k--) { + Cval0 += A[j*lda+k]*B[k*lda+i]; + Cval1 += A[j*lda+k]*B[k*lda+i+1]; + Cval2 += A[j*lda+k]*B[k*lda+i+2]; + Cval3 += A[j*lda+k]*B[k*lda+i+3]; + } + } + C[j*lda+i] = Cval0; + C[j*lda+i+1] = Cval1; + C[j*lda+i+2] = Cval2; + C[j*lda+i+3] = Cval3; + } + } +*/ +} diff --git a/apps/riscv-tests/mt/ak_matmul.c b/apps/riscv-tests/mt/ak_matmul.c new file mode 100644 index 0000000..e4b34e4 --- /dev/null +++ b/apps/riscv-tests/mt/ak_matmul.c @@ -0,0 +1,62 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + int i, j, k, ii, jj, bsize; + bsize = 16; + for ( jj = bsize*coreid; jj < lda; jj += bsize*ncores) { + for ( ii = 0; ii < lda; ii += bsize) { + for ( j = jj; j < lda && j < jj + bsize; j++) { + for ( i = ii; i < lda && i < ii + bsize; i += 8) { + data_t c1 = C[i + j*lda]; + data_t c2 = C[i + j*lda + 1]; + data_t c3 = C[i + j*lda + 2]; + data_t c4 = C[i + j*lda + 3]; + data_t c5 = C[i + j*lda + 4]; + data_t c6 = C[i + j*lda + 5]; + data_t c7 = C[i + j*lda + 6]; + data_t c8 = C[i + j*lda + 7]; + for ( k = 0; k < lda; k+=4 ) { + for (int x = 0; x < 4; x++) { + data_t a = A[j*lda + k+x]; + data_t b1 = B[(k+x)*lda + i]; + data_t b2 = B[(k+x)*lda + i + 1]; + data_t b3 = B[(k+x)*lda + i + 2]; + data_t b4 = B[(k+x)*lda + i + 3]; + data_t b5 = B[(k+x)*lda + i + 4]; + data_t b6 = B[(k+x)*lda + i + 5]; + data_t b7 = B[(k+x)*lda + i + 6]; + data_t b8 = B[(k+x)*lda + i + 7]; + c1 += a * b1; + c2 += a * b2; + c3 += a * b3; + c4 += a * b4; + c5 += a * b5; + c6 += a * b6; + c7 += a * b7; + c8 += a * b8; + } + } + C[i + j*lda] = c1; + C[i + j*lda + 1] = c2; + C[i + j*lda + 2] = c3; + C[i + j*lda + 3] = c4; + C[i + j*lda + 4] = c5; + C[i + j*lda + 5] = c6; + C[i + j*lda + 6] = c7; + C[i + j*lda + 7] = c8; + } + } + } + } + +} diff --git a/apps/riscv-tests/mt/al_matmul.c b/apps/riscv-tests/mt/al_matmul.c new file mode 100644 index 0000000..e5ee410 --- /dev/null +++ b/apps/riscv-tests/mt/al_matmul.c @@ -0,0 +1,123 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + int i, j, k, x; + data_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + data_t temp8, temp9, temp10, temp11, temp12, temp13, temp14, temp15; + + //complete Q1 + if(coreid > 1) return; + if(coreid == 0) { + for(j = 0; j < 32; j++) { + temp0 = C[j*lda]; + temp1 = C[1 + j*lda]; + temp2 = C[2 + j*lda]; + temp3 = C[3 + j*lda]; + temp4 = C[4 + j*lda]; + temp5 = C[5 + j*lda]; + temp6 = C[6 + j*lda]; + temp7 = C[7 + j*lda]; + temp8 = C[8 + j*lda]; + temp9 = C[9 + j*lda]; + temp10 = C[10 + j*lda]; + temp11 = C[11 + j*lda]; + temp12 = C[12 + j*lda]; + temp13 = C[13 + j*lda]; + temp14 = C[14 + j*lda]; + temp15 = C[15 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[k*lda]; + temp1 += A[j*lda + k] * B[1+k*lda]; + temp2 += A[j*lda + k] * B[2+k*lda]; + temp3 += A[j*lda + k] * B[3+k*lda]; + temp4 += A[j*lda + k] * B[4+k*lda]; + temp5 += A[j*lda + k] * B[5+k*lda]; + temp6 += A[j*lda + k] * B[6+k*lda]; + temp7 += A[j*lda + k] * B[7+k*lda]; + temp8 += A[j*lda + k] * B[8+k*lda]; + temp9 += A[j*lda + k] * B[9+k*lda]; + temp10 += A[j*lda + k] * B[10+k*lda]; + temp11 += A[j*lda + k] * B[11+k*lda]; + temp12 += A[j*lda + k] * B[12+k*lda]; + temp13 += A[j*lda + k] * B[13+k*lda]; + temp14 += A[j*lda + k] * B[14+k*lda]; + temp15 += A[j*lda + k] * B[15+k*lda]; + } + C[j*lda] = temp0; + C[1 + j*lda] = temp1; + C[2 + j*lda] = temp2; + C[3 + j*lda] = temp3; + C[4 + j*lda] = temp4; + C[5 + j*lda] = temp5; + C[6 + j*lda] = temp6; + C[7 + j*lda] = temp7; + C[8 + j*lda] = temp8; + C[9 + j*lda] = temp9; + C[10 + j*lda] = temp10; + C[11 + j*lda] = temp11; + C[12 + j*lda] = temp12; + C[13 + j*lda] = temp13; + C[14 + j*lda] = temp14; + C[15 + j*lda] = temp15; + } + } + + if( coreid == 1 || ncores == 1) { + for(j = 0; j < 32; j++) { + temp0 = C[16 + j*lda]; + temp1 = C[17 + j*lda]; + temp2 = C[18 + j*lda]; + temp3 = C[19 + j*lda]; + temp4 = C[20 + j*lda]; + temp5 = C[21 + j*lda]; + temp6 = C[22 + j*lda]; + temp7 = C[23 + j*lda]; + temp8 = C[24 + j*lda]; + temp9 = C[25 + j*lda]; + temp10 = C[26 + j*lda]; + temp11 = C[27 + j*lda]; + temp12 = C[28 + j*lda]; + temp13 = C[29 + j*lda]; + temp14 = C[30 + j*lda]; + temp15 = C[31 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[16 + k*lda]; + temp1 += A[j*lda + k] * B[17 + k*lda]; + temp2 += A[j*lda + k] * B[18 + k*lda]; + temp3 += A[j*lda + k] * B[19 + k*lda]; + temp4 += A[j*lda + k] * B[20 + k*lda]; + temp5 += A[j*lda + k] * B[21 + k*lda]; + temp6 += A[j*lda + k] * B[22 + k*lda]; + temp7 += A[j*lda + k] * B[23 + k*lda]; + temp8 += A[j*lda + k] * B[24 + k*lda]; + temp9 += A[j*lda + k] * B[25 + k*lda]; + temp10 += A[j*lda + k] * B[26 + k*lda]; + temp11 += A[j*lda + k] * B[27 + k*lda]; + temp12 += A[j*lda + k] * B[28 + k*lda]; + temp13 += A[j*lda + k] * B[29 + k*lda]; + temp14 += A[j*lda + k] * B[30 + k*lda]; + temp15 += A[j*lda + k] * B[31 + k*lda]; + } + C[16 + j*lda] = temp0; + C[17 + j*lda] = temp1; + C[18 + j*lda] = temp2; + C[19 + j*lda] = temp3; + C[20 + j*lda] = temp4; + C[21 + j*lda] = temp5; + C[22 + j*lda] = temp6; + C[23 + j*lda] = temp7; + C[24 + j*lda] = temp8; + C[25 + j*lda] = temp9; + C[26 + j*lda] = temp10; + C[27 + j*lda] = temp11; + C[28 + j*lda] = temp12; + C[29 + j*lda] = temp13; + C[30 + j*lda] = temp14; + C[31 + j*lda] = temp15; + } + } +} diff --git a/apps/riscv-tests/mt/am_matmul.c b/apps/riscv-tests/mt/am_matmul.c new file mode 100644 index 0000000..a5622fe --- /dev/null +++ b/apps/riscv-tests/mt/am_matmul.c @@ -0,0 +1,64 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + size_t i, j, k, l; + int row,row2, column, column2, column3, column4, column5, column6, column7, column8; + size_t max_dim = 32*32; + data_t element, element2, element3, element4, element5, element6, element7, element8; + data_t temp_mat[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + data_t temp_mat2[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + //for (i=coreid*max_dim/ncores; i<(max_dim/ncores+coreid*max_dim/ncores); i+=8){ + for (l=coreid*32/ncores; l<32*(1+coreid)/ncores; l+=2){ + row=l*32; + row2=(l+1)*32; + for (i=0; i 1) return; + static __thread int i, j, k; + static __thread data_t tempA0, tempA1, tempA2, tempA3, tempA4, tempA5, tempA6, tempA7; + static __thread data_t tempC0, tempC1, tempC2, tempC3, tempC4, tempC5, tempC6, tempC7, tempC8, tempC9, tempC10, tempC11, tempC12, tempC13, tempC14, tempC15; + + static __thread int start, end, jStride, jToRow, jToCol; + + start = coreid << 9; + end = ((ncores == 1) ? 2 : (coreid+1) ) << 9; + jStride = 8; + + for (j=start; j < end; j+=jStride) { + jToRow = (j>>5)<<5; + jToCol = j%32; + tempC0 = 0; + tempC1 = 0; + tempC2 = 0; + tempC3 = 0; + tempC4 = 0; + tempC5 = 0; + tempC6 = 0; + tempC7 = 0; + for ( i=0; i < lda; i+=2 ) { + tempA0 = A[i + jToRow]; + tempA1 = A[i+1 + jToRow]; + tempC0 += tempA0 * B[(jToCol ) + (i<<5)]; + tempC1 += tempA0 * B[(jToCol+1 ) + (i<<5)]; + tempC2 += tempA0 * B[(jToCol+2 ) + (i<<5)]; + tempC3 += tempA0 * B[(jToCol+3 ) + (i<<5)]; + tempC4 += tempA0 * B[(jToCol+4 ) + (i<<5)]; + tempC5 += tempA0 * B[(jToCol+5 ) + (i<<5)]; + tempC6 += tempA0 * B[(jToCol+6 ) + (i<<5)]; + tempC7 += tempA0 * B[(jToCol+7 ) + (i<<5)]; + tempC0 += tempA1 * B[(jToCol ) + ((i+1)<<5)]; + tempC1 += tempA1 * B[(jToCol+1 ) + ((i+1)<<5)]; + tempC2 += tempA1 * B[(jToCol+2 ) + ((i+1)<<5)]; + tempC3 += tempA1 * B[(jToCol+3 ) + ((i+1)<<5)]; + tempC4 += tempA1 * B[(jToCol+4 ) + ((i+1)<<5)]; + tempC5 += tempA1 * B[(jToCol+5 ) + ((i+1)<<5)]; + tempC6 += tempA1 * B[(jToCol+6 ) + ((i+1)<<5)]; + tempC7 += tempA1 * B[(jToCol+7 ) + ((i+1)<<5)]; + } + C[j] =tempC0; + C[j + 1 ]=tempC1; + C[j + 2 ]=tempC2; + C[j + 3 ]=tempC3; + C[j + 4 ]=tempC4; + C[j + 5 ]=tempC5; + C[j + 6 ]=tempC6; + C[j + 7 ]=tempC7; + } + +} diff --git a/apps/riscv-tests/mt/az_matmul.c b/apps/riscv-tests/mt/az_matmul.c new file mode 100644 index 0000000..1668fb0 --- /dev/null +++ b/apps/riscv-tests/mt/az_matmul.c @@ -0,0 +1,181 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + if(coreid > 1) return; + static __thread int i, j, k; + static __thread data_t tempA0, tempA1, tempA2, tempA3, tempA4, tempA5, tempA6, tempA7; + static __thread data_t tempC0, tempC1, tempC2, tempC3, tempC4, tempC5, tempC6, tempC7; //tempC8, tempC9, tempC10, tempC11, tempC12, tempC13, tempC14, tempC15; + + static __thread int start, end, jStride, jToRow, jToCol, iToRow; + + start = coreid << 9; + end = ((ncores == 1) ? 2 : (coreid+1)) << 9; + jStride = 8; + + for (j=start; j < end; j+=jStride) { + jToRow = (j>>5)<<5; + jToCol = j%32; + tempC0 = 0; + tempC1 = 0; + tempC2 = 0; + tempC3 = 0; + tempC4 = 0; + tempC5 = 0; + tempC6 = 0; + tempC7 = 0; + //tempC8 = 0; + //tempC9 = 0; + //tempC10 = 0; + //tempC11 = 0; + //tempC12 = 0; + //tempC13 = 0; + //tempC14 = 0; + //tempC15 = 0; + + for ( i=0; i < lda; i+=2 ) { + iToRow = i << 5; + + tempA0 = A[i + jToRow]; + tempA1 = A[i+1 + jToRow]; + //tempA2 = A[i+2 + jToRow]; + //tempA3 = A[i+3 + jToRow]; + //tempA4 = A[i+4 + jToRow]; + //tempA5 = A[i+5 + jToRow]; + //tempA6 = A[i+6 + jToRow]; + //tempA7 = A[i+7 + jToRow]; + + tempC0 += tempA0 * B[(jToCol ) + (iToRow)]; + tempC1 += tempA0 * B[(jToCol+1 ) + (iToRow)]; + tempC2 += tempA0 * B[(jToCol+2 ) + (iToRow)]; + tempC3 += tempA0 * B[(jToCol+3 ) + (iToRow)]; + tempC4 += tempA0 * B[(jToCol+4 ) + (iToRow)]; + tempC5 += tempA0 * B[(jToCol+5 ) + (iToRow)]; + tempC6 += tempA0 * B[(jToCol+6 ) + (iToRow)]; + tempC7 += tempA0 * B[(jToCol+7 ) + (iToRow)]; + //tempC8 += tempA0 * B[(jToCol+8 ) + (iToRow)]; + //tempC9 += tempA0 * B[(jToCol+9 ) + (iToRow)]; + //tempC10 += tempA0 * B[(jToCol+10) + (iToRow)]; + //tempC11 += tempA0 * B[(jToCol+11) + (iToRow)]; + //tempC12 += tempA0 * B[(jToCol+12) + (iToRow)]; + //tempC13 += tempA0 * B[(jToCol+13) + (iToRow)]; + //tempC14 += tempA0 * B[(jToCol+14) + (iToRow)]; + //tempC15 += tempA0 * B[(jToCol+15) + (iToRow)]; + + iToRow += 32; + tempC0 += tempA1 * B[(jToCol ) + (iToRow)]; + tempC1 += tempA1 * B[(jToCol+1 ) + (iToRow)]; + tempC2 += tempA1 * B[(jToCol+2 ) + (iToRow)]; + tempC3 += tempA1 * B[(jToCol+3 ) + (iToRow)]; + tempC4 += tempA1 * B[(jToCol+4 ) + (iToRow)]; + tempC5 += tempA1 * B[(jToCol+5 ) + (iToRow)]; + tempC6 += tempA1 * B[(jToCol+6 ) + (iToRow)]; + tempC7 += tempA1 * B[(jToCol+7 ) + (iToRow)]; + //tempC8 += tempA1 * B[(jToCol+8 ) + (iToRow+32)]; + //tempC9 += tempA1 * B[(jToCol+9 ) + (iToRow+32)]; + //tempC10 += tempA1 * B[(jToCol+10) + (iToRow+32)]; + //tempC11 += tempA1 * B[(jToCol+11) + (iToRow+32)]; + //tempC12 += tempA1 * B[(jToCol+12) + (iToRow+32)]; + //tempC13 += tempA1 * B[(jToCol+13) + (iToRow+32)]; + //tempC14 += tempA1 * B[(jToCol+14) + (iToRow+32)]; + //tempC15 += tempA1 * B[(jToCol+15) + (iToRow+32)]; + + //iToRow += 32; + //tempC0 += tempA2 * B[(jToCol ) + (iToRow)]; + //tempC1 += tempA2 * B[(jToCol+1 ) + (iToRow)]; + //tempC2 += tempA2 * B[(jToCol+2 ) + (iToRow)]; + //tempC3 += tempA2 * B[(jToCol+3 ) + (iToRow)]; + //tempC4 += tempA2 * B[(jToCol+4 ) + (iToRow)]; + //tempC5 += tempA2 * B[(jToCol+5 ) + (iToRow)]; + //tempC6 += tempA2 * B[(jToCol+6 ) + (iToRow)]; + //tempC7 += tempA2 * B[(jToCol+7 ) + (iToRow)]; + //tempC8 += tempA2 * B[(jToCol+8 ) + (iToRow)]; + //tempC9 += tempA2 * B[(jToCol+9 ) + (iToRow)]; + //tempC10 += tempA2 * B[(jToCol+10) + (iToRow)]; + //tempC11 += tempA2 * B[(jToCol+11) + (iToRow)]; + //tempC12 += tempA2 * B[(jToCol+12) + (iToRow)]; + //tempC13 += tempA2 * B[(jToCol+13) + (iToRow)]; + //tempC14 += tempA2 * B[(jToCol+14) + (iToRow)]; + //tempC15 += tempA2 * B[(jToCol+15) + (iToRow)]; + + //iToRow += 32; + //tempC0 += tempA3 * B[(jToCol ) + (iToRow)]; + //tempC1 += tempA3 * B[(jToCol+1 ) + (iToRow)]; + //tempC2 += tempA3 * B[(jToCol+2 ) + (iToRow)]; + //tempC3 += tempA3 * B[(jToCol+3 ) + (iToRow)]; + //tempC4 += tempA3 * B[(jToCol+4 ) + (iToRow)]; + //tempC5 += tempA3 * B[(jToCol+5 ) + (iToRow)]; + //tempC6 += tempA3 * B[(jToCol+6 ) + (iToRow)]; + //tempC7 += tempA3 * B[(jToCol+7 ) + (iToRow)]; + //tempC8 += tempA3 * B[(jToCol+8 ) + (iToRow)]; + //tempC9 += tempA3 * B[(jToCol+9 ) + (iToRow)]; + //tempC10 += tempA3 * B[(jToCol+10) + (iToRow)]; + //tempC11 += tempA3 * B[(jToCol+11) + (iToRow)]; + //tempC12 += tempA3 * B[(jToCol+12) + (iToRow)]; + //tempC13 += tempA3 * B[(jToCol+13) + (iToRow)]; + //tempC14 += tempA3 * B[(jToCol+14) + (iToRow)]; + //tempC15 += tempA3 * B[(jToCol+15) + (iToRow)]; + + //iToRow += 32; + //tempC0 += tempA4 * B[(jToCol ) + (iToRow)]; + //tempC1 += tempA4 * B[(jToCol+1 ) + (iToRow)]; + //tempC2 += tempA4 * B[(jToCol+2 ) + (iToRow)]; + //tempC3 += tempA4 * B[(jToCol+3 ) + (iToRow)]; + //tempC4 += tempA4 * B[(jToCol+4 ) + (iToRow)]; + //tempC5 += tempA4 * B[(jToCol+5 ) + (iToRow)]; + //tempC6 += tempA4 * B[(jToCol+6 ) + (iToRow)]; + //tempC7 += tempA4 * B[(jToCol+7 ) + (iToRow)]; + // + //iToRow += 32; + //tempC0 += tempA5 * B[(jToCol ) + (iToRow)]; + //tempC1 += tempA5 * B[(jToCol+1 ) + (iToRow)]; + //tempC2 += tempA5 * B[(jToCol+2 ) + (iToRow)]; + //tempC3 += tempA5 * B[(jToCol+3 ) + (iToRow)]; + //tempC4 += tempA5 * B[(jToCol+4 ) + (iToRow)]; + //tempC5 += tempA5 * B[(jToCol+5 ) + (iToRow)]; + //tempC6 += tempA5 * B[(jToCol+6 ) + (iToRow)]; + //tempC7 += tempA5 * B[(jToCol+7 ) + (iToRow)]; + // + //iToRow += 32; + //tempC0 += tempA6 * B[(jToCol ) + (iToRow)]; + //tempC1 += tempA6 * B[(jToCol+1 ) + (iToRow)]; + //tempC2 += tempA6 * B[(jToCol+2 ) + (iToRow)]; + //tempC3 += tempA6 * B[(jToCol+3 ) + (iToRow)]; + //tempC4 += tempA6 * B[(jToCol+4 ) + (iToRow)]; + //tempC5 += tempA6 * B[(jToCol+5 ) + (iToRow)]; + //tempC6 += tempA6 * B[(jToCol+6 ) + (iToRow)]; + //tempC7 += tempA6 * B[(jToCol+7 ) + (iToRow)]; + // + //iToRow += 32; + //tempC0 += tempA7 * B[(jToCol ) + (iToRow)]; + //tempC1 += tempA7 * B[(jToCol+1 ) + (iToRow)]; + //tempC2 += tempA7 * B[(jToCol+2 ) + (iToRow)]; + //tempC3 += tempA7 * B[(jToCol+3 ) + (iToRow)]; + //tempC4 += tempA7 * B[(jToCol+4 ) + (iToRow)]; + //tempC5 += tempA7 * B[(jToCol+5 ) + (iToRow)]; + //tempC6 += tempA7 * B[(jToCol+6 ) + (iToRow)]; + //tempC7 += tempA7 * B[(jToCol+7 ) + (iToRow)]; + + } + C[j ] = tempC0; + C[j + 1 ] = tempC1; + C[j + 2 ] = tempC2; + C[j + 3 ] = tempC3; + C[j + 4 ] = tempC4; + C[j + 5 ] = tempC5; + C[j + 6 ] = tempC6; + C[j + 7 ] = tempC7; + //C[j + 8 ] = tempC8 ; + //C[j + 9 ] = tempC9 ; + //C[j + 10] = tempC10; + //C[j + 11] = tempC11; + //C[j + 12] = tempC12; + //C[j + 13] = tempC13; + //C[j + 14] = tempC14; + //C[j + 15] = tempC15; + } +} diff --git a/apps/riscv-tests/mt/bb_matmul.c b/apps/riscv-tests/mt/bb_matmul.c new file mode 100644 index 0000000..c335ed3 --- /dev/null +++ b/apps/riscv-tests/mt/bb_matmul.c @@ -0,0 +1,35 @@ +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + int i, j, k; + + for (i = 0; i < lda; i += 2) { + for (j = coreid * (lda / ncores); j < (coreid + 1) * (lda / ncores); j += 4) { + register data_t c00 = 0, c01 = 0; + register data_t c10 = 0, c11 = 0; + register data_t c20 = 0, c21 = 0; + register data_t c30 = 0, c31 = 0; + + register data_t a0, a1, a2, a3, b0, b1; + for (k = 0; k < lda; k++) { + a0 = A[j*lda + k + 0*lda]; + a1 = A[j*lda + k + 1*lda]; + a2 = A[j*lda + k + 2*lda]; + a3 = A[j*lda + k + 3*lda]; + + b0 = B[k*lda + i + 0]; + b1 = B[k*lda + i + 1]; + + c00 += a0 * b0; c01 += a0 * b1; + c10 += a1 * b0; c11 += a1 * b1; + c20 += a2 * b0; c21 += a2 * b1; + c30 += a3 * b0; c31 += a3 * b1; + } + + C[i + j*lda + 0 + 0*lda] = c00; C[i + j*lda + 1 + 0*lda] = c01; + C[i + j*lda + 0 + 1*lda] = c10; C[i + j*lda + 1 + 1*lda] = c11; + C[i + j*lda + 0 + 2*lda] = c20; C[i + j*lda + 1 + 2*lda] = c21; + C[i + j*lda + 0 + 3*lda] = c30; C[i + j*lda + 1 + 3*lda] = c31; + } + } +} diff --git a/apps/riscv-tests/mt/bc_matmul.c b/apps/riscv-tests/mt/bc_matmul.c new file mode 100644 index 0000000..61c4054 --- /dev/null +++ b/apps/riscv-tests/mt/bc_matmul.c @@ -0,0 +1,137 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" + +#define REG_I 8 +#define REG_J 2 +//#define BLOCK_I 32 +#define BLOCK_J 16 +#define BLOCK_K 16 +#define LDA 32 +#define NCORES 2 +#define MIN(X,Y) (X < Y ? X : Y) + +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + + int i, j, k, ri, rj, ii, jj, kk; + data_t *Aj, *Cj, *Bi; + data_t c[REG_I][REG_J], a[REG_J], b[REG_I]; + size_t start = coreid * (LDA / NCORES), end = (coreid == NCORES - 1 ? LDA : (coreid + 1) * (LDA / NCORES)); + + /* if (coreid > 0) { */ + /* return; */ + /* } */ + /* start = 0, end = lda; */ + if (ncores == NCORES && lda == LDA) { + for (jj = start; jj < end; jj += BLOCK_J) + for (kk = 0; kk < LDA; kk += BLOCK_K) + //for (ii = 0; ii < LDA; ii += BLOCK_I) + for (j = jj; j < MIN(end, jj + BLOCK_J); j += REG_J) { + Aj = A + j*LDA; + Cj = C + j*LDA; + for (i = 0; i < LDA; i += REG_I) { + /* Load C in register blocks. */ + Bi = B + i; + for (ri = 0; ri < REG_I; ri++) { + for (rj = 0; rj < REG_J; rj++) { + c[ri][rj] = Cj[i + ri + ( rj)*LDA]; + } + } + + + for (k = kk; k < MIN(LDA, kk + BLOCK_K); k++) { + /* Load a,b in register blocks. */ + /* for (rj = 0; rj < REG_J; rj++) { + a[rj] = A[(j + rj)*LDA + k]; + }*/ + /* for (ri = 0; ri < REG_I; ri++) { */ + /* b[ri] = Bi[k*LDA + ri]; */ + /* } */ + /* /\* Compute C in register blocks. *\/ */ + /* for (rj = 0; rj < REG_J; rj++) { */ + /* a[rj] = Aj[( rj)*LDA + k]; */ + /* for (ri = 0; ri < REG_I; ri++) { */ + /* c[ri][rj] += a[rj] * b[ri]; */ + /* } */ + /* } */ + a[0] = Aj[k]; + a[1] = Aj[k + LDA]; + b[0] = Bi[k*LDA]; + b[1] = Bi[k*LDA + 1]; + b[2] = Bi[k*LDA + 2]; + b[3] = Bi[k*LDA + 3]; + b[4] = Bi[k*LDA + 4]; + b[5] = Bi[k*LDA + 5]; + b[6] = Bi[k*LDA + 6]; + b[7] = Bi[k*LDA + 7]; + + + c[0][0] += b[0] * a[0]; + c[0][1] += b[0] * a[1]; + c[1][0] += b[1] * a[0]; + c[1][1] += b[1] * a[1]; + c[2][0] += b[2] * a[0]; + c[2][1] += b[2] * a[1]; + c[3][0] += b[3] * a[0]; + c[3][1] += b[3] * a[1]; + c[4][0] += b[4] * a[0]; + c[4][1] += b[4] * a[1]; + c[5][0] += b[5] * a[0]; + c[5][1] += b[5] * a[1]; + c[6][0] += b[6] * a[0]; + c[6][1] += b[6] * a[1]; + c[7][0] += b[7] * a[0]; + c[7][1] += b[7] * a[1]; + + + /* c[0][0] += b[0] * a[0]; */ + /* c[1][1] += b[1] * a[1]; */ + /* c[2][0] += b[2] * a[0]; */ + /* c[3][1] += b[3] * a[1]; */ + /* c[4][0] += b[4] * a[0]; */ + /* c[5][1] += b[5] * a[1]; */ + /* c[6][0] += b[6] * a[0]; */ + /* c[7][1] += b[7] * a[1]; */ + /* c[0][0] += b[0] * a[0]; */ + /* c[1][1] += b[1] * a[1]; */ + /* c[2][0] += b[2] * a[0]; */ + /* c[3][1] += b[3] * a[1]; */ + /* c[4][0] += b[4] * a[0]; */ + /* c[5][1] += b[5] * a[1]; */ + /* c[6][0] += b[6] * a[0]; */ + /* c[7][1] += b[7] * a[1]; */ + + } + + /* store C in register blocks. */ + for (ri = 0; ri < REG_I; ri++) { + for (rj = 0; rj < REG_J; rj++) { + Cj[i + ri + (rj)*LDA] = c[ri][rj]; + } + } + } + + + + + } + /* We only care about performance for 32x32 matrices and 2 cores. Otherwise just naive mat_mul */ + } else { + if (coreid > 0) + return; + + for ( i = 0; i < lda; i++ ) + for ( j = 0; j < lda; j++ ) + for ( k = 0; k < lda; k++ ) + C[i + j*lda] += A[j*lda + k] * B[k*lda + i]; + } +} diff --git a/apps/riscv-tests/mt/bf_matmul.c b/apps/riscv-tests/mt/bf_matmul.c new file mode 100644 index 0000000..04904b9 --- /dev/null +++ b/apps/riscv-tests/mt/bf_matmul.c @@ -0,0 +1,127 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + int j, k, i; + data_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + data_t temp8, temp9, temp10, temp11, temp12, temp13, temp14, temp15; + if(coreid == 0) { + for(j = 0; j < 32; j++) { + temp0 = 0; //C[j*lda]; + temp1 = 0; //C[1 + j*lda]; + temp2 = 0; //C[2 + j*lda]; + temp3 = 0; //C[3 + j*lda]; + temp4 = 0; //C[4 + j*lda]; + temp5 = 0; //C[5 + j*lda]; + temp6 = 0; //C[6 + j*lda]; + temp7 = 0; //C[7 + j*lda]; + temp8 = 0; //C[8 + j*lda]; + temp9 = 0; //C[9 + j*lda]; + temp10 = 0; //C[10 + j*lda]; + temp11 = 0; //C[11 + j*lda]; + temp12 = 0; //C[12 + j*lda]; + temp13 = 0; //C[13 + j*lda]; + temp14 = 0; //C[14 + j*lda]; + temp15 = 0; //C[15 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[k*lda]; + temp1 += A[j*lda + k] * B[1+k*lda]; + temp2 += A[j*lda + k] * B[2+k*lda]; + temp3 += A[j*lda + k] * B[3+k*lda]; + temp4 += A[j*lda + k] * B[4+k*lda]; + temp5 += A[j*lda + k] * B[5+k*lda]; + temp6 += A[j*lda + k] * B[6+k*lda]; + temp7 += A[j*lda + k] * B[7+k*lda]; + temp8 += A[j*lda + k] * B[8+k*lda]; + temp9 += A[j*lda + k] * B[9+k*lda]; + temp10 += A[j*lda + k] * B[10+k*lda]; + temp11 += A[j*lda + k] * B[11+k*lda]; + temp12 += A[j*lda + k] * B[12+k*lda]; + temp13 += A[j*lda + k] * B[13+k*lda]; + temp14 += A[j*lda + k] * B[14+k*lda]; + temp15 += A[j*lda + k] * B[15+k*lda]; + } + C[j*lda] = temp0; + C[1 + j*lda] = temp1; + C[2 + j*lda] = temp2; + C[3 + j*lda] = temp3; + C[4 + j*lda] = temp4; + C[5 + j*lda] = temp5; + C[6 + j*lda] = temp6; + C[7 + j*lda] = temp7; + C[8 + j*lda] = temp8; + C[9 + j*lda] = temp9; + C[10 + j*lda] = temp10; + C[11 + j*lda] = temp11; + C[12 + j*lda] = temp12; + C[13 + j*lda] = temp13; + C[14 + j*lda] = temp14; + C[15 + j*lda] = temp15; + } + } + + if(coreid == 1 || ncores == 1) { + for(j = 0; j < 32; j++) { + temp0 = 0; //C[16+j*lda]; + temp1 = 0; //C[17+j*lda]; + temp2 = 0; //C[18+j*lda]; + temp3 = 0; //C[19+j*lda]; + temp4 = 0; //C[20+j*lda]; + temp5 = 0; //C[21+j*lda]; + temp6 = 0; //C[22+j*lda]; + temp7 = 0; //C[23+j*lda]; + temp8 = 0; //C[24+j*lda]; + temp9 = 0; //C[25+j*lda]; + temp10 = 0; //C[26+j*lda]; + temp11 = 0; //C[27+j*lda]; + temp12 = 0; //C[28+j*lda]; + temp13 = 0; //C[29+j*lda]; + temp14 = 0; //C[30+j*lda]; + temp15 = 0; //C[31+j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[16+k*lda]; + temp1 += A[j*lda + k] * B[17+k*lda]; + temp2 += A[j*lda + k] * B[18+k*lda]; + temp3 += A[j*lda + k] * B[19+k*lda]; + temp4 += A[j*lda + k] * B[20+k*lda]; + temp5 += A[j*lda + k] * B[21+k*lda]; + temp6 += A[j*lda + k] * B[22+k*lda]; + temp7 += A[j*lda + k] * B[23+k*lda]; + temp8 += A[j*lda + k] * B[24+k*lda]; + temp9 += A[j*lda + k] * B[25+k*lda]; + temp10 += A[j*lda + k] * B[26+k*lda]; + temp11 += A[j*lda + k] * B[27+k*lda]; + temp12 += A[j*lda + k] * B[28+k*lda]; + temp13 += A[j*lda + k] * B[29+k*lda]; + temp14 += A[j*lda + k] * B[30+k*lda]; + temp15 += A[j*lda + k] * B[31+k*lda]; + } + C[16 + j*lda] = temp0; + C[17 + j*lda] = temp1; + C[18 + j*lda] = temp2; + C[19 + j*lda] = temp3; + C[20 + j*lda] = temp4; + C[21 + j*lda] = temp5; + C[22 + j*lda] = temp6; + C[23 + j*lda] = temp7; + C[24 + j*lda] = temp8; + C[25 + j*lda] = temp9; + C[26 + j*lda] = temp10; + C[27 + j*lda] = temp11; + C[28 + j*lda] = temp12; + C[29 + j*lda] = temp13; + C[30 + j*lda] = temp14; + C[31 + j*lda] = temp15; + } + } + +} diff --git a/apps/riscv-tests/mt/bh_matmul.c b/apps/riscv-tests/mt/bh_matmul.c new file mode 100644 index 0000000..c8d6f2b --- /dev/null +++ b/apps/riscv-tests/mt/bh_matmul.c @@ -0,0 +1,97 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + if(coreid > 1) return; + + int m, i, j, k, iB0, iB1; + data_t tempC0, tempC1, tempC2, tempC3, tempC4, tempC5, tempC6, tempC7; + data_t tempA0, tempA1; + + if (coreid == 0){ + for (m = 0; m < 2; m++){ + for (j = 0; j < lda/2; j++){ + for (i = 0; i < lda; i+=8){ + tempC0 = C[i + j*lda]; + tempC1 = C[i + j*lda+1]; + tempC2 = C[i + j*lda+2]; + tempC3 = C[i + j*lda+3]; + tempC4 = C[i + j*lda+4]; + tempC5 = C[i + j*lda+5]; + tempC6 = C[i + j*lda+6]; + tempC7 = C[i + j*lda+7]; + iB0 = m*lda*lda/2+i; + iB1 = iB0+lda; + for (k = m*lda/2; k < (m+1)*lda/2; k+=2){ + tempA0 = A[j*lda+k]; + tempA1 = A[j*lda+k+1]; + tempC0 += tempA0*B[iB0]+tempA1*B[iB1]; + tempC1 += tempA0*B[iB0+1]+tempA1*B[iB1+1]; + tempC2 += tempA0*B[iB0+2]+tempA1*B[iB1+2]; + tempC3 += tempA0*B[iB0+3]+tempA1*B[iB1+3]; + tempC4 += tempA0*B[iB0+4]+tempA1*B[iB1+4]; + tempC5 += tempA0*B[iB0+5]+tempA1*B[iB1+5]; + tempC6 += tempA0*B[iB0+6]+tempA1*B[iB1+6]; + tempC7 += tempA0*B[iB0+7]+tempA1*B[iB1+7]; + iB0 += 2*lda; + iB1 += 2*lda; + + } + C[i + j*lda] = tempC0; + C[i + j*lda + 1] = tempC1; + C[i + j*lda + 2] = tempC2; + C[i + j*lda + 3] = tempC3; + C[i + j*lda + 4] = tempC4; + C[i + j*lda + 5] = tempC5; + C[i + j*lda + 6] = tempC6; + C[i + j*lda + 7] = tempC7; + } + } + } + } + if(coreid == 1 || ncores == 1) { + for (m = 2; m > 0; m--){ + for (j = lda-1; j >= lda/2; j--){ + for (i = lda-1; i >= 0; i-=8){ + tempC0 = C[i + j*lda]; + tempC1 = C[i + j*lda - 1]; + tempC2 = C[i + j*lda - 2]; + tempC3 = C[i + j*lda - 3]; + tempC4 = C[i + j*lda - 4]; + tempC5 = C[i + j*lda - 5]; + tempC6 = C[i + j*lda - 6]; + tempC7 = C[i + j*lda - 7]; + for (k = m*lda/2-1; k >= (m-1)*lda/2; k-=2){ + tempA0 = A[j*lda+k]; + tempA1 = A[j*lda+k-1]; + tempC0 += tempA0*B[k*lda+i]+tempA1*B[(k-1)*lda+i]; + tempC1 += tempA0*B[k*lda+i-1]+tempA1*B[(k-1)*lda+i-1]; + tempC2 += tempA0*B[k*lda+i-2]+tempA1*B[(k-1)*lda+i-2]; + tempC3 += tempA0*B[k*lda+i-3]+tempA1*B[(k-1)*lda+i-3]; + tempC4 += tempA0*B[k*lda+i-4]+tempA1*B[(k-1)*lda+i-4]; + tempC5 += tempA0*B[k*lda+i-5]+tempA1*B[(k-1)*lda+i-5]; + tempC6 += tempA0*B[k*lda+i-6]+tempA1*B[(k-1)*lda+i-6]; + tempC7 += tempA0*B[k*lda+i-7]+tempA1*B[(k-1)*lda+i-7]; + } + C[i + j*lda] = tempC0; + C[i + j*lda - 1] = tempC1; + C[i + j*lda - 2] = tempC2; + C[i + j*lda - 3] = tempC3; + C[i + j*lda - 4] = tempC4; + C[i + j*lda - 5] = tempC5; + C[i + j*lda - 6] = tempC6; + C[i + j*lda - 7] = tempC7; + } + } + } + } +} diff --git a/apps/riscv-tests/mt/bj_matmul.c b/apps/riscv-tests/mt/bj_matmul.c new file mode 100644 index 0000000..df1f880 --- /dev/null +++ b/apps/riscv-tests/mt/bj_matmul.c @@ -0,0 +1,97 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + + int m, i, j, k, iB0, iB1; + data_t tempC0, tempC1, tempC2, tempC3, tempC4, tempC5, tempC6, tempC7; + data_t tempA0, tempA1; + + if(coreid > 1) return; + if (coreid == 0){ + for (m = 0; m < 2; m++){ + for (j = 0; j < lda/2; j++){ + for (i = 0; i < lda; i+=8){ + tempC0 = C[i + j*lda]; + tempC1 = C[i + j*lda+1]; + tempC2 = C[i + j*lda+2]; + tempC3 = C[i + j*lda+3]; + tempC4 = C[i + j*lda+4]; + tempC5 = C[i + j*lda+5]; + tempC6 = C[i + j*lda+6]; + tempC7 = C[i + j*lda+7]; + iB0 = m*lda*lda/2+i; + iB1 = iB0+lda; + for (k = m*lda/2; k < (m+1)*lda/2; k+=2){ + tempA0 = A[j*lda+k]; + tempA1 = A[j*lda+k+1]; + tempC0 += tempA0*B[iB0]+tempA1*B[iB1]; + tempC1 += tempA0*B[iB0+1]+tempA1*B[iB1+1]; + tempC2 += tempA0*B[iB0+2]+tempA1*B[iB1+2]; + tempC3 += tempA0*B[iB0+3]+tempA1*B[iB1+3]; + tempC4 += tempA0*B[iB0+4]+tempA1*B[iB1+4]; + tempC5 += tempA0*B[iB0+5]+tempA1*B[iB1+5]; + tempC6 += tempA0*B[iB0+6]+tempA1*B[iB1+6]; + tempC7 += tempA0*B[iB0+7]+tempA1*B[iB1+7]; + iB0 += 2*lda; + iB1 += 2*lda; + + } + C[i + j*lda] = tempC0; + C[i + j*lda + 1] = tempC1; + C[i + j*lda + 2] = tempC2; + C[i + j*lda + 3] = tempC3; + C[i + j*lda + 4] = tempC4; + C[i + j*lda + 5] = tempC5; + C[i + j*lda + 6] = tempC6; + C[i + j*lda + 7] = tempC7; + } + } + } + } + if(coreid == 1 || ncores == 1) { + for (m = 2; m > 0; m--){ + for (j = lda-1; j >= lda/2; j--){ + for (i = lda-1; i >= 0; i-=8){ + tempC0 = C[i + j*lda]; + tempC1 = C[i + j*lda - 1]; + tempC2 = C[i + j*lda - 2]; + tempC3 = C[i + j*lda - 3]; + tempC4 = C[i + j*lda - 4]; + tempC5 = C[i + j*lda - 5]; + tempC6 = C[i + j*lda - 6]; + tempC7 = C[i + j*lda - 7]; + for (k = m*lda/2-1; k >= (m-1)*lda/2; k-=2){ + tempA0 = A[j*lda+k]; + tempA1 = A[j*lda+k-1]; + tempC0 += tempA0*B[k*lda+i]+tempA1*B[(k-1)*lda+i]; + tempC1 += tempA0*B[k*lda+i-1]+tempA1*B[(k-1)*lda+i-1]; + tempC2 += tempA0*B[k*lda+i-2]+tempA1*B[(k-1)*lda+i-2]; + tempC3 += tempA0*B[k*lda+i-3]+tempA1*B[(k-1)*lda+i-3]; + tempC4 += tempA0*B[k*lda+i-4]+tempA1*B[(k-1)*lda+i-4]; + tempC5 += tempA0*B[k*lda+i-5]+tempA1*B[(k-1)*lda+i-5]; + tempC6 += tempA0*B[k*lda+i-6]+tempA1*B[(k-1)*lda+i-6]; + tempC7 += tempA0*B[k*lda+i-7]+tempA1*B[(k-1)*lda+i-7]; + } + C[i + j*lda] = tempC0; + C[i + j*lda - 1] = tempC1; + C[i + j*lda - 2] = tempC2; + C[i + j*lda - 3] = tempC3; + C[i + j*lda - 4] = tempC4; + C[i + j*lda - 5] = tempC5; + C[i + j*lda - 6] = tempC6; + C[i + j*lda - 7] = tempC7; + } + } + } + } +} diff --git a/apps/riscv-tests/mt/bk_matmul.c b/apps/riscv-tests/mt/bk_matmul.c new file mode 100644 index 0000000..dae49fc --- /dev/null +++ b/apps/riscv-tests/mt/bk_matmul.c @@ -0,0 +1,92 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + int i, j, k, ii, jj, kk; + if(coreid > 1) return; + if (coreid == 0) { +// for ( ii = 0; ii < 32; ii+=IC ) + for ( kk = 0; kk < 32; kk+=16 ) + for ( j = 0; j < 16; j++ ) +// for ( j = 0; j < 16; j++ ) + { + for ( i = 0; i < 32; i+=8 ) +// for ( i = ii; i < ii + IC && i < 32; i+=8 ) + { + data_t temp0 = C[i+j*32]; + data_t temp1 = C[i+j*32+1]; + data_t temp2 = C[i+j*32+2]; + data_t temp3 = C[i+j*32+3]; + data_t temp4 = C[i+j*32+4]; + data_t temp5 = C[i+j*32+5]; + data_t temp6 = C[i+j*32+6]; + data_t temp7 = C[i+j*32+7]; + for ( k = kk; k < kk+16 && k < 32; k++ ) +// for ( k = 0; k < 32; k++ ) + { + data_t tempA = A[j*32+k]; + temp0 += tempA * B[k*32 + i]; + temp1 += tempA * B[k*32 + i+1]; + temp2 += tempA * B[k*32 + i+2]; + temp3 += tempA * B[k*32 + i+3]; + temp4 += tempA * B[k*32 + i+4]; + temp5 += tempA * B[k*32 + i+5]; + temp6 += tempA * B[k*32 + i+6]; + temp7 += tempA * B[k*32 + i+7]; + } + C[i+j*32] = temp0; + C[i+j*32+1] = temp1; + C[i+j*32+2] = temp2; + C[i+j*32+3] = temp3; + C[i+j*32+4] = temp4; + C[i+j*32+5] = temp5; + C[i+j*32+6] = temp6; + C[i+j*32+7] = temp7; + } + } + } + if(coreid == 1 || ncores == 1) { +// for ( ii = 0; ii < 32; ii+=IC ) + for ( kk = 0; kk < 32; kk+=16 ) + for ( j = 16; j < 32; j++ ) +// for ( j = 16; j < 32; j++ ) + { + for ( i = 0; i < 32; i+=8 ) +// for ( i = ii; i < ii + IC && i < 32; i+=8 ) + { + data_t temp0 = C[i+j*32]; + data_t temp1 = C[i+j*32+1]; + data_t temp2 = C[i+j*32+2]; + data_t temp3 = C[i+j*32+3]; + data_t temp4 = C[i+j*32+4]; + data_t temp5 = C[i+j*32+5]; + data_t temp6 = C[i+j*32+6]; + data_t temp7 = C[i+j*32+7]; + for ( k = kk; k < kk+16 && k < 32; k++ ) + { + data_t tempA = A[j*32+k]; + temp0 += tempA * B[k*32 + i]; + temp1 += tempA * B[k*32 + i+1]; + temp2 += tempA * B[k*32 + i+2]; + temp3 += tempA * B[k*32 + i+3]; + temp4 += tempA * B[k*32 + i+4]; + temp5 += tempA * B[k*32 + i+5]; + temp6 += tempA * B[k*32 + i+6]; + temp7 += tempA * B[k*32 + i+7]; + } + C[i+j*32] = temp0; + C[i+j*32+1] = temp1; + C[i+j*32+2] = temp2; + C[i+j*32+3] = temp3; + C[i+j*32+4] = temp4; + C[i+j*32+5] = temp5; + C[i+j*32+6] = temp6; + C[i+j*32+7] = temp7; + } + + } + } +} diff --git a/apps/riscv-tests/mt/bm_matmul.c b/apps/riscv-tests/mt/bm_matmul.c new file mode 100644 index 0000000..ae225d4 --- /dev/null +++ b/apps/riscv-tests/mt/bm_matmul.c @@ -0,0 +1,205 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + int i, j, k; + int space=lda/ncores; + int max= space*coreid+space; + data_t temp=0; + + data_t temp1=0; + data_t temp2=0; + data_t temp3=0; + data_t temp4=0; + + data_t temp_1=0; + + data_t temp1_1=0; + data_t temp2_1=0; + data_t temp3_1=0; + data_t temp4_1=0; + + data_t temp_2=0; + + data_t temp1_2=0; + data_t temp2_2=0; + data_t temp3_2=0; + data_t temp4_2=0; + + data_t temp_3=0; + + data_t temp1_3=0; + data_t temp2_3=0; + data_t temp3_3=0; + data_t temp4_3=0; + + if (coreid!=ncores-1){ + //main loop + for (i=space*coreid;i 1) return; + int i,j,k,l; + data_t element1, element2, element3, element4, element5, element6, element7, element8; + int row, row2; + int column1, column2, column3, column4, column5, column6, column7, column8; + data_t temp[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + data_t temp2[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + if (coreid == 0){ + for (i=0; i<32; i+=2){ + row = i*32; + row2 = (i+1)*32; + for (j=0; j<16; j+=4){ + element1 = A[row+j]; + element2 = A[row+j+1]; + element3 = A[row+j+2]; + element4 = A[row+j+3]; + column1 = j*32; + column2 = (j+1)*32; + column3 = (j+2)*32; + column4 = (j+3)*32; + element5 = A[row2+j]; + element6 = A[row2+j+1]; + element7 = A[row2+j+2]; + element8 = A[row2+j+3]; + + for (k=0; k<32; k+=4){ + temp[k]+=element1*B[column1+k]+element2*B[column2+k]+element3*B[column3+k]+element4*B[column4+k]; + temp[k+1]+=element1*B[column1+k+1]+element2*B[column2+k+1]+element3*B[column3+k+1]+element4*B[column4+k+1]; + temp[k+2]+=element1*B[column1+k+2]+element2*B[column2+k+2]+element3*B[column3+k+2]+element4*B[column4+k+2]; + temp[k+3]+=element1*B[column1+k+3]+element2*B[column2+k+3]+element3*B[column3+k+3]+element4*B[column4+k+3]; + temp2[k]+=element5*B[column1+k]+element6*B[column2+k]+element7*B[column3+k]+element8*B[column4+k]; + temp2[k+1]+=element5*B[column1+k+1]+element6*B[column2+k+1]+element7*B[column3+k+1]+element8*B[column4+k+1]; + temp2[k+2]+=element5*B[column1+k+2]+element6*B[column2+k+2]+element7*B[column3+k+2]+element8*B[column4+k+2]; + temp2[k+3]+=element5*B[column1+k+3]+element6*B[column2+k+3]+element7*B[column3+k+3]+element8*B[column4+k+3]; + } + + + } + for (l=0; l<32; l++){ + C[row+l]+=temp[l]; + C[row2+l]+=temp2[l]; + temp[l]=0; + temp2[l]=0; + } + + } + } + if(coreid == 1 || ncores == 1) { + for (i=0; i<32; i+=2){ + row = (31-i)*32; + row2 = (31-i-1)*32; + for (j=16; j<32; j+=4){ + element1 = A[row+j]; + element2 = A[row+j+1]; + element3 = A[row+j+2]; + element4 = A[row+j+3]; + element5 = A[row2+j]; + element6 = A[row2+j+1]; + element7 = A[row2+j+2]; + element8 = A[row2+j+3]; + column1 = j*32; + column2 = (j+1)*32; + column3 = (j+2)*32; + column4 = (j+3)*32; + for (k=0; k<32; k+=4){ + temp[k]+=element1*B[column1+k]+element2*B[column2+k]+element3*B[column3+k]+element4*B[column4+k]; + temp[k+1]+=element1*B[column1+k+1]+element2*B[column2+k+1]+element3*B[column3+k+1]+element4*B[column4+k+1]; + temp[k+2]+=element1*B[column1+k+2]+element2*B[column2+k+2]+element3*B[column3+k+2]+element4*B[column4+k+2]; + temp[k+3]+=element1*B[column1+k+3]+element2*B[column2+k+3]+element3*B[column3+k+3]+element4*B[column4+k+3]; + temp2[k]+=element5*B[column1+k]+element6*B[column2+k]+element7*B[column3+k]+element8*B[column4+k]; + temp2[k+1]+=element5*B[column1+k+1]+element6*B[column2+k+1]+element7*B[column3+k+1]+element8*B[column4+k+1]; + temp2[k+2]+=element5*B[column1+k+2]+element6*B[column2+k+2]+element7*B[column3+k+2]+element8*B[column4+k+2]; + temp2[k+3]+=element5*B[column1+k+3]+element6*B[column2+k+3]+element7*B[column3+k+3]+element8*B[column4+k+3]; + } + + + + } + for (l=0; l<32; l++){ + C[row+l]+=temp[l]; + C[row2+l]+=temp2[l]; + temp[l]=0; + temp2[l]=0; + } + } + } + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + +} diff --git a/apps/riscv-tests/mt/cg_matmul.c b/apps/riscv-tests/mt/cg_matmul.c new file mode 100644 index 0000000..9db30cd --- /dev/null +++ b/apps/riscv-tests/mt/cg_matmul.c @@ -0,0 +1,78 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + int i, j, k; + + for ( i = 0; i < lda; i+=2 ) + { + for (k = 0; k < lda; k+=4) + { + int d0 = B[k*lda + i]; + int c0 = B[k*lda + i + 1]; + int d1 = B[(k+1)*lda + i]; + int c1 = B[(k+1)*lda + i + 1]; + int d2 = B[(k+2)*lda + i]; + int c2 = B[(k+2)*lda + i + 1]; + int d3 = B[(k+3)*lda + i]; + int c3 = B[(k+3)*lda + i + 1]; + + for ( j = coreid*(lda/ncores); j < (coreid+1)*(lda/ncores); j+=4) + { + + int sum = A[j*lda + k] * d0; + sum += A[j*lda + k + 1] * d1; + sum += A[j*lda + k + 2] * d2; + sum += A[j*lda + k + 3] * d3; + C[j*lda +i] += sum; + + sum = A[j*lda + k] * c0; + sum += A[j*lda + k + 1] * c1; + sum += A[j*lda + k + 2] * c2; + sum += A[j*lda + k + 3] * c3; + C[j*lda + i + 1] += sum; + + sum = A[(j+1)*lda + k] * d0; + sum += A[(j+1)*lda + k + 1] * d1; + sum += A[(j+1)*lda + k + 2] * d2; + sum += A[(j+1)*lda + k + 3] * d3; + C[(j+1)*lda +i] += sum; + + sum = A[(j+1)*lda + k] * c0; + sum += A[(j+1)*lda + k + 1] * c1; + sum += A[(j+1)*lda + k + 2] * c2; + sum += A[(j+1)*lda + k + 3] * c3; + C[(j+1)*lda + i + 1] += sum; + + sum = A[(j+2)*lda + k] * d0; + sum += A[(j+2)*lda + k + 1] * d1; + sum += A[(j+2)*lda + k + 2] * d2; + sum += A[(j+2)*lda + k + 3] * d3; + C[(j+2)*lda +i] += sum; + + sum = A[(j+2)*lda + k] * c0; + sum += A[(j+2)*lda + k + 1] * c1; + sum += A[(j+2)*lda + k + 2] * c2; + sum += A[(j+2)*lda + k + 3] * c3; + C[(j+2)*lda + i + 1] += sum; + + sum = A[(j+3)*lda + k] * d0; + sum += A[(j+3)*lda + k + 1] * d1; + sum += A[(j+3)*lda + k + 2] * d2; + sum += A[(j+3)*lda + k + 3] * d3; + C[(j+3)*lda +i] += sum; + + sum = A[(j+3)*lda + k] * c0; + sum += A[(j+3)*lda + k + 1] * c1; + sum += A[(j+3)*lda + k + 2] * c2; + sum += A[(j+3)*lda + k + 3] * c3; + C[(j+3)*lda + i + 1] += sum; + + } + barrier(ncores); + } + } +} diff --git a/apps/riscv-tests/mt/ci_matmul.c b/apps/riscv-tests/mt/ci_matmul.c new file mode 100644 index 0000000..3b7977d --- /dev/null +++ b/apps/riscv-tests/mt/ci_matmul.c @@ -0,0 +1,70 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + +//----------MSI-------------- +/* + int i,j,k; + barrier(nc); + for(j = coreid*lda/ncores; j < coreid*lda/ncores + lda/ncores; j++) { + for(i = 0; i < lda; i+=4) { + data_t Cval0 = 0; + data_t Cval1 = 0; + data_t Cval2 = 0; + data_t Cval3 = 0; + for(k = 0; k < lda; k++) { + Cval0 += A[j*lda+k]*B[k*lda+i]; + Cval1 += A[j*lda+k]*B[k*lda+i+1]; + Cval2 += A[j*lda+k]*B[k*lda+i+2]; + Cval3 += A[j*lda+k]*B[k*lda+i+3]; + } + C[j*lda+i] = Cval0; + C[j*lda+i+1] = Cval1; + C[j*lda+i+2] = Cval2; + C[j*lda+i+3] = Cval3; + } + } +*/ + +//------------------MI------------------- + + int i,j,k; + barrier(ncores); + for(j = coreid*lda/ncores; j < coreid*lda/ncores + lda/ncores; j++) { + for(i = 0; i < lda; i+=4) { + data_t Cval0 = 0; + data_t Cval1 = 0; + data_t Cval2 = 0; + data_t Cval3 = 0; + if(coreid == 0) { + for(k = 0; k < lda; k++) { + Cval0 += A[j*lda+k]*B[k*lda+i]; + Cval1 += A[j*lda+k]*B[k*lda+i+1]; + Cval2 += A[j*lda+k]*B[k*lda+i+2]; + Cval3 += A[j*lda+k]*B[k*lda+i+3]; + } + } else { + for(k = lda-1; k >= 0; k--) { + Cval0 += A[j*lda+k]*B[k*lda+i]; + Cval1 += A[j*lda+k]*B[k*lda+i+1]; + Cval2 += A[j*lda+k]*B[k*lda+i+2]; + Cval3 += A[j*lda+k]*B[k*lda+i+3]; + } + } + C[j*lda+i] = Cval0; + C[j*lda+i+1] = Cval1; + C[j*lda+i+2] = Cval2; + C[j*lda+i+3] = Cval3; + } + } +} diff --git a/apps/riscv-tests/mt/ck_matmul.c b/apps/riscv-tests/mt/ck_matmul.c new file mode 100644 index 0000000..753a36d --- /dev/null +++ b/apps/riscv-tests/mt/ck_matmul.c @@ -0,0 +1,61 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + int i, j, k, ii, jj, bsize, start; + bsize = 16; + start = bsize*coreid; + for ( jj = start; jj < lda; jj += bsize*ncores) { + int first = 1; + for ( ii = start; ii !=start || first; ii=(bsize+ii) % lda) { + first = 0; + for ( j = jj; j < lda && j < jj + bsize; j+=4) { + for ( i = ii; i < lda && i < ii + bsize; i+=2) { + data_t c1 = C[i + j*lda]; + data_t c2 = C[i + j*lda + 1]; + data_t c3 = C[i + (j+1)*lda]; + data_t c4 = C[i + (j+1)*lda + 1]; + data_t c5 = C[i + (j+2)*lda]; + data_t c6 = C[i + (j+2)*lda + 1]; + data_t c7 = C[i + (j+3)*lda]; + data_t c8 = C[i + (j+3)*lda + 1]; + for ( k = 0; k < lda; k+=8){ + for (int x = 0; x < 8; x++) { + data_t a = A[j*lda + k+x]; + data_t a1 = A[(j+1)*lda +k+x]; + data_t a2 = A[(j+2)*lda +k+x]; + data_t a3 = A[(j+3)*lda +k+x]; + data_t b1 = B[(k+x)*lda + i]; + data_t b2 = B[(k+x)*lda + i + 1]; + c1 += a * b1; + c2 += a * b2; + c3 += a1* b1; + c4 += a1* b2; + c5 += a2* b1; + c6 += a2* b2; + c7 += a3* b1; + c8 += a3* b2; + } + } + C[i + j*lda] = c1; + C[i + j*lda + 1] = c2; + C[i + (j+1)*lda] = c3; + C[i + (j+1)*lda + 1] = c4; + C[i + (j+2)*lda] = c5; + C[i + (j+2)*lda + 1] = c6; + C[i + (j+3)*lda] = c7; + C[i + (j+3)*lda + 1] = c8; + } + } + } + } +} diff --git a/apps/riscv-tests/mt/cl_matmul.c b/apps/riscv-tests/mt/cl_matmul.c new file mode 100644 index 0000000..086a614 --- /dev/null +++ b/apps/riscv-tests/mt/cl_matmul.c @@ -0,0 +1,176 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + if(coreid > 1) return; + // feel free to make a separate function for MI and MSI versions. + int i, j, k, x; + data_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + data_t temp8, temp9, temp10, temp11, temp12, temp13, temp14, temp15; + + + if(coreid == 0) { + for(j = 0; j < 32; j++) { + temp0 = C[j*lda]; + temp1 = C[1 + j*lda]; + temp2 = C[2 + j*lda]; + temp3 = C[3 + j*lda]; + temp4 = C[4 + j*lda]; + temp5 = C[5 + j*lda]; + temp6 = C[6 + j*lda]; + temp7 = C[7 + j*lda]; + temp8 = C[8 + j*lda]; + temp9 = C[9 + j*lda]; + temp10 = C[10 + j*lda]; + temp11 = C[11 + j*lda]; + temp12 = C[12 + j*lda]; + temp13 = C[13 + j*lda]; + temp14 = C[14 + j*lda]; + temp15 = C[15 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[k*lda]; + temp1 += A[j*lda + k] * B[1 + k*lda]; + temp2 += A[j*lda + k] * B[2 + k*lda]; + temp3 += A[j*lda + k] * B[3 + k*lda]; + temp4 += A[j*lda + k] * B[4 + k*lda]; + temp5 += A[j*lda + k] * B[5 + k*lda]; + temp6 += A[j*lda + k] * B[6 + k*lda]; + temp7 += A[j*lda + k] * B[7 + k*lda]; + temp8 += A[j*lda + k] * B[8 + k*lda]; + temp9 += A[j*lda + k] * B[9 + k*lda]; + temp10 += A[j*lda + k] * B[10 + k*lda]; + temp11 += A[j*lda + k] * B[11 + k*lda]; + temp12 += A[j*lda + k] * B[12 + k*lda]; + temp13 += A[j*lda + k] * B[13 + k*lda]; + temp14 += A[j*lda + k] * B[14 + k*lda]; + temp15 += A[j*lda + k] * B[15 + k*lda]; + } + C[j*lda] = temp0; + C[1 + j*lda] = temp1; + C[2 + j*lda] = temp2; + C[3 + j*lda] = temp3; + C[4 + j*lda] = temp4; + C[5 + j*lda] = temp5; + C[6 + j*lda] = temp6; + C[7 + j*lda] = temp7; + C[8 + j*lda] = temp8; + C[9 + j*lda] = temp9; + C[10 + j*lda] = temp10; + C[11 + j*lda] = temp11; + C[12 + j*lda] = temp12; + C[13 + j*lda] = temp13; + C[14 + j*lda] = temp14; + C[15 + j*lda] = temp15; + } + } + + if(coreid == 1 || ncores == 1) { + for(j = 16; j < 32; j++) { + temp0 = C[16 + j*lda]; + temp1 = C[17 + j*lda]; + temp2 = C[18 + j*lda]; + temp3 = C[19 + j*lda]; + temp4 = C[20 + j*lda]; + temp5 = C[21 + j*lda]; + temp6 = C[22 + j*lda]; + temp7 = C[23 + j*lda]; + temp8 = C[24 + j*lda]; + temp9 = C[25 + j*lda]; + temp10 = C[26 + j*lda]; + temp11 = C[27 + j*lda]; + temp12 = C[28 + j*lda]; + temp13 = C[29 + j*lda]; + temp14 = C[30 + j*lda]; + temp15 = C[31 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[16 + k*lda]; + temp1 += A[j*lda + k] * B[17 + k*lda]; + temp2 += A[j*lda + k] * B[18 + k*lda]; + temp3 += A[j*lda + k] * B[19 + k*lda]; + temp4 += A[j*lda + k] * B[20 + k*lda]; + temp5 += A[j*lda + k] * B[21 + k*lda]; + temp6 += A[j*lda + k] * B[22 + k*lda]; + temp7 += A[j*lda + k] * B[23 + k*lda]; + temp8 += A[j*lda + k] * B[24 + k*lda]; + temp9 += A[j*lda + k] * B[25 + k*lda]; + temp10 += A[j*lda + k] * B[26 + k*lda]; + temp11 += A[j*lda + k] * B[27 + k*lda]; + temp12 += A[j*lda + k] * B[28 + k*lda]; + temp13 += A[j*lda + k] * B[29 + k*lda]; + temp14 += A[j*lda + k] * B[30 + k*lda]; + temp15 += A[j*lda + k] * B[31 + k*lda]; + } + C[16 + j*lda] = temp0; + C[17 + j*lda] = temp1; + C[18 + j*lda] = temp2; + C[19 + j*lda] = temp3; + C[20 + j*lda] = temp4; + C[21 + j*lda] = temp5; + C[22 + j*lda] = temp6; + C[23 + j*lda] = temp7; + C[24 + j*lda] = temp8; + C[25 + j*lda] = temp9; + C[26 + j*lda] = temp10; + C[27 + j*lda] = temp11; + C[28 + j*lda] = temp12; + C[29 + j*lda] = temp13; + C[30 + j*lda] = temp14; + C[31 + j*lda] = temp15; + } + for(j = 0; j <16; j++) { + temp0 = C[16 + j*lda]; + temp1 = C[17 + j*lda]; + temp2 = C[18 + j*lda]; + temp3 = C[19 + j*lda]; + temp4 = C[20 + j*lda]; + temp5 = C[21 + j*lda]; + temp6 = C[22 + j*lda]; + temp7 = C[23 + j*lda]; + temp8 = C[24 + j*lda]; + temp9 = C[25 + j*lda]; + temp10 = C[26 + j*lda]; + temp11 = C[27 + j*lda]; + temp12 = C[28 + j*lda]; + temp13 = C[29 + j*lda]; + temp14 = C[30 + j*lda]; + temp15 = C[31 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[16 + k*lda]; + temp1 += A[j*lda + k] * B[17 + k*lda]; + temp2 += A[j*lda + k] * B[18 + k*lda]; + temp3 += A[j*lda + k] * B[19 + k*lda]; + temp4 += A[j*lda + k] * B[20 + k*lda]; + temp5 += A[j*lda + k] * B[21 + k*lda]; + temp6 += A[j*lda + k] * B[22 + k*lda]; + temp7 += A[j*lda + k] * B[23 + k*lda]; + temp8 += A[j*lda + k] * B[24 + k*lda]; + temp9 += A[j*lda + k] * B[25 + k*lda]; + temp10 += A[j*lda + k] * B[26 + k*lda]; + temp11 += A[j*lda + k] * B[27 + k*lda]; + temp12 += A[j*lda + k] * B[28 + k*lda]; + temp13 += A[j*lda + k] * B[29 + k*lda]; + temp14 += A[j*lda + k] * B[30 + k*lda]; + temp15 += A[j*lda + k] * B[31 + k*lda]; + } + C[16 + j*lda] = temp0; + C[17 + j*lda] = temp1; + C[18 + j*lda] = temp2; + C[19 + j*lda] = temp3; + C[20 + j*lda] = temp4; + C[21 + j*lda] = temp5; + C[22 + j*lda] = temp6; + C[23 + j*lda] = temp7; + C[24 + j*lda] = temp8; + C[25 + j*lda] = temp9; + C[26 + j*lda] = temp10; + C[27 + j*lda] = temp11; + C[28 + j*lda] = temp12; + C[29 + j*lda] = temp13; + C[30 + j*lda] = temp14; + C[31 + j*lda] = temp15; + } + } +} diff --git a/apps/riscv-tests/mt/cm_matmul.c b/apps/riscv-tests/mt/cm_matmul.c new file mode 100644 index 0000000..ae52b27 --- /dev/null +++ b/apps/riscv-tests/mt/cm_matmul.c @@ -0,0 +1,91 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + int i,j,k,l; + data_t element1, element2, element3, element4, element5, element6, element7, element8; + int row, row2; + int column1, column2, column3, column4, column5, column6, column7, column8; + data_t temp[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + data_t temp2[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + if (coreid == 0){ + for (i=0; i 1) return; + static __thread int i, j, k; + static __thread data_t tempA0, tempA1, tempA2, tempA3, tempA4, tempA5, tempA6, tempA7; + static __thread data_t tempC0, tempC1, tempC2, tempC3, tempC4, tempC5, tempC6, tempC7, tempC8, tempC9, tempC10, tempC11, tempC12, tempC13, tempC14, tempC15; + + static __thread int start, end, jStride, jToRow, jToCol; + static data_t A1[1024], B1[1024];; + + start = coreid << 9; + end = ((ncores == 1) ? 2 :(coreid+1)) << 9; + jStride = 8; + + if (coreid == 0) { + for (j=start; j < end; j+=jStride) { + jToRow = (j>>5)<<5; + jToCol = j%32; + tempC0 = 0; + tempC1 = 0; + tempC2 = 0; + tempC3 = 0; + tempC4 = 0; + tempC5 = 0; + tempC6 = 0; + tempC7 = 0; + for ( i=0; i < lda; i+=2 ) { + tempA0 = A[i + jToRow]; + tempA1 = A[i+1 + jToRow]; + tempC0 += tempA0 * B[(jToCol ) + (i<<5)]; + tempC1 += tempA0 * B[(jToCol+1 ) + (i<<5)]; + tempC2 += tempA0 * B[(jToCol+2 ) + (i<<5)]; + tempC3 += tempA0 * B[(jToCol+3 ) + (i<<5)]; + tempC4 += tempA0 * B[(jToCol+4 ) + (i<<5)]; + tempC5 += tempA0 * B[(jToCol+5 ) + (i<<5)]; + tempC6 += tempA0 * B[(jToCol+6 ) + (i<<5)]; + tempC7 += tempA0 * B[(jToCol+7 ) + (i<<5)]; + tempC0 += tempA1 * B[(jToCol ) + ((i+1)<<5)]; + tempC1 += tempA1 * B[(jToCol+1 ) + ((i+1)<<5)]; + tempC2 += tempA1 * B[(jToCol+2 ) + ((i+1)<<5)]; + tempC3 += tempA1 * B[(jToCol+3 ) + ((i+1)<<5)]; + tempC4 += tempA1 * B[(jToCol+4 ) + ((i+1)<<5)]; + tempC5 += tempA1 * B[(jToCol+5 ) + ((i+1)<<5)]; + tempC6 += tempA1 * B[(jToCol+6 ) + ((i+1)<<5)]; + tempC7 += tempA1 * B[(jToCol+7 ) + ((i+1)<<5)]; + } + C[j] =tempC0; + C[j + 1 ]=tempC1; + C[j + 2 ]=tempC2; + C[j + 3 ]=tempC3; + C[j + 4 ]=tempC4; + C[j + 5 ]=tempC5; + C[j + 6 ]=tempC6; + C[j + 7 ]=tempC7; + } + } + else { + for (i = 0; i < 1024; i++) { + A1[i] = A[i]; + B1[i] = B[i]; + } + for (j=start; j < end; j+=jStride) { + jToRow = (j>>5)<<5; + jToCol = j%32; + tempC0 = 0; + tempC1 = 0; + tempC2 = 0; + tempC3 = 0; + tempC4 = 0; + tempC5 = 0; + tempC6 = 0; + tempC7 = 0; + for ( i=0; i < lda; i+=2 ) { + tempA0 = A1[i + jToRow]; + tempA1 = A1[i+1 + jToRow]; + tempC0 += tempA0 * B1[(jToCol ) + (i<<5)]; + tempC1 += tempA0 * B1[(jToCol+1 ) + (i<<5)]; + tempC2 += tempA0 * B1[(jToCol+2 ) + (i<<5)]; + tempC3 += tempA0 * B1[(jToCol+3 ) + (i<<5)]; + tempC4 += tempA0 * B1[(jToCol+4 ) + (i<<5)]; + tempC5 += tempA0 * B1[(jToCol+5 ) + (i<<5)]; + tempC6 += tempA0 * B1[(jToCol+6 ) + (i<<5)]; + tempC7 += tempA0 * B1[(jToCol+7 ) + (i<<5)]; + tempC0 += tempA1 * B1[(jToCol ) + ((i+1)<<5)]; + tempC1 += tempA1 * B1[(jToCol+1 ) + ((i+1)<<5)]; + tempC2 += tempA1 * B1[(jToCol+2 ) + ((i+1)<<5)]; + tempC3 += tempA1 * B1[(jToCol+3 ) + ((i+1)<<5)]; + tempC4 += tempA1 * B1[(jToCol+4 ) + ((i+1)<<5)]; + tempC5 += tempA1 * B1[(jToCol+5 ) + ((i+1)<<5)]; + tempC6 += tempA1 * B1[(jToCol+6 ) + ((i+1)<<5)]; + tempC7 += tempA1 * B1[(jToCol+7 ) + ((i+1)<<5)]; + } + C[j] =tempC0; + C[j + 1 ]=tempC1; + C[j + 2 ]=tempC2; + C[j + 3 ]=tempC3; + C[j + 4 ]=tempC4; + C[j + 5 ]=tempC5; + C[j + 6 ]=tempC6; + C[j + 7 ]=tempC7; + } + } +} diff --git a/apps/riscv-tests/mt/dc_matmul.c b/apps/riscv-tests/mt/dc_matmul.c new file mode 100644 index 0000000..a2b583e --- /dev/null +++ b/apps/riscv-tests/mt/dc_matmul.c @@ -0,0 +1,168 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" + +#define REG_I 8 +#define REG_J 2 +#define BLOCK_I 32 +#define BLOCK_J 16 +#define BLOCK_K 16 +#define LDA 32 +#define NCORES 2 +#define MIN(X,Y) (X < Y ? X : Y) + +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + + int i, j, k, ri, rj, ii, jj, kk; + data_t *Aj, *Cj, *Bi; + data_t c[REG_I][REG_J], a[REG_J], b[REG_I]; + size_t start = coreid * (LDA / NCORES), end = (coreid == NCORES - 1 ? LDA : (coreid + 1) * (LDA / NCORES)); + + /* if (coreid > 0) { */ + /* return; */ + /* } */ + /* start = 0, end = lda; */ + if (ncores == NCORES && lda == LDA) { + for (jj = start; jj < end; jj += BLOCK_J) { + int kk_start= (coreid == 0 ? 0 : LDA/2) ,kk_end = (coreid == 0 ? LDA/2 : LDA); + for (kk = kk_start; kk < kk_end; kk += BLOCK_K) { + // for (ii = 0; ii < LDA; ii += BLOCK_I) + for (j = jj; j < MIN(end, jj + BLOCK_J); j += REG_J) { + Aj = A + j*LDA; + Cj = C + j*LDA; + for (i = 0; i < LDA/*, ii + BLOCK_I)*/; i += REG_I) { + /* Load C in register blocks. */ + Bi = B + i; + for (ri = 0; ri < REG_I; ri++) { + for (rj = 0; rj < REG_J; rj++) { + c[ri][rj] = Cj[i + ri + ( rj)*LDA]; + } + } + + + for (k = kk; k < MIN(LDA, kk + BLOCK_K); k++) { + for (ri = 0; ri < REG_I; ri++) { + b[ri] = Bi[k*LDA + ri]; + } + /* Compute C in register blocks. */ + for (rj = 0; rj < REG_J; rj++) { + a[rj] = Aj[(rj)*LDA + k]; + for (ri = 0; ri < REG_I; ri++) { + c[ri][rj] += a[rj] * b[ri]; + } + } + } + + /* store C in register blocks. */ + for (ri = 0; ri < REG_I; ri++) { + for (rj = 0; rj < REG_J; rj++) { + Cj[i + ri + ( rj)*LDA] = c[ri][rj]; + } + } + } + } + /* barrier(nc); */ + + /* kk_start= (coreid == 1 ? 0 : LDA/2); */ + /* kk_end = (coreid == 1 ? LDA/2 : LDA); */ + /* for (kk = kk_start; kk < kk_end; kk += BLOCK_K) { */ + /* // for (ii = 0; ii < LDA; ii += BLOCK_I) */ + /* for (j = jj; j < MIN(end, jj + BLOCK_J); j += REG_J) { */ + /* Aj = A + j*LDA; */ + /* Cj = C + j*LDA; */ + /* for (i = 0; i < LDA/\*, ii + BLOCK_I)*\/; i += REG_I) { */ + /* /\* Load C in register blocks. *\/ */ + /* Bi = B + i; */ + /* for (ri = 0; ri < REG_I; ri++) { */ + /* for (rj = 0; rj < REG_J; rj++) { */ + /* c[ri][rj] = Cj[i + ri + ( rj)*LDA]; */ + /* } */ + /* } */ + + + /* for (k = kk; k < MIN(LDA, kk + BLOCK_K); k++) { */ + /* for (ri = 0; ri < REG_I; ri++) { */ + /* b[ri] = Bi[k*LDA + ri]; */ + /* } */ + /* /\* Compute C in register blocks. *\/ */ + /* for (rj = 0; rj < REG_J; rj++) { */ + /* a[rj] = Aj[(rj)*LDA + k]; */ + /* for (ri = 0; ri < REG_I; ri++) { */ + /* c[ri][rj] += a[rj] * b[ri]; */ + /* } */ + /* } */ + /* } */ + + /* store C in register blocks. */ + /* for (ri = 0; ri < REG_I; ri++) { */ + /* for (rj = 0; rj < REG_J; rj++) { */ + /* Cj[i + ri + ( rj)*LDA] = c[ri][rj]; */ + /* } */ + /* } */ + /* } */ + /* } */ + } + } + + + //barrier(nc); + for (jj = start; jj < end; jj += BLOCK_J) { + int kk_start= (coreid != 0 ? 0 : LDA/2), kk_end = (coreid != 0 ? LDA/2 : LDA); + for (kk = kk_start; kk < kk_end; kk += BLOCK_K) { + // for (ii = 0; ii < LDA; ii += BLOCK_I) + for (j = jj; j < MIN(end, jj + BLOCK_J); j += REG_J) { + Aj = A + j*LDA; + Cj = C + j*LDA; + for (i = 0; i < LDA/*, ii + BLOCK_I)*/; i += REG_I) { + /* Load C in register blocks. */ + Bi = B + i; + for (ri = 0; ri < REG_I; ri++) { + for (rj = 0; rj < REG_J; rj++) { + c[ri][rj] = Cj[i + ri + ( rj)*LDA]; + } + } + + + for (k = kk; k < MIN(LDA, kk + BLOCK_K); k++) { + for (ri = 0; ri < REG_I; ri++) { + b[ri] = Bi[k*LDA + ri]; + } + /* Compute C in register blocks. */ + for (rj = 0; rj < REG_J; rj++) { + a[rj] = Aj[(rj)*LDA + k]; + for (ri = 0; ri < REG_I; ri++) { + c[ri][rj] += a[rj] * b[ri]; + } + } + } + + /* store C in register blocks. */ + for (ri = 0; ri < REG_I; ri++) { + for (rj = 0; rj < REG_J; rj++) { + Cj[i + ri + ( rj)*LDA] = c[ri][rj]; + } + } + } + } + } + } + /* We only care about performance for 32x32 matrices and 2 cores. Otherwise just naive mat_mul */ +} else { + if (coreid > 0) + return; + + for ( i = 0; i < lda; i++ ) + for ( j = 0; j < lda; j++ ) + for ( k = 0; k < lda; k++ ) + C[i + j*lda] += A[j*lda + k] * B[k*lda + i]; + } + } diff --git a/apps/riscv-tests/mt/df_matmul.c b/apps/riscv-tests/mt/df_matmul.c new file mode 100644 index 0000000..56d9c4b --- /dev/null +++ b/apps/riscv-tests/mt/df_matmul.c @@ -0,0 +1,237 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + int j, k; + data_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + data_t temp8, temp9, temp10, temp11, temp12, temp13, temp14, temp15; + if(coreid == 0) { + //16*0:16*(0+1) ;; 16*1+16*(1+1) + //0:16 ;; 16:32 + + //complete Q1 + for(j = 0; j < 16; j++) { + temp0 = C[j*lda]; + temp1 = C[1 + j*lda]; + temp2 = C[2 + j*lda]; + temp3 = C[3 + j*lda]; + temp4 = C[4 + j*lda]; + temp5 = C[5 + j*lda]; + temp6 = C[6 + j*lda]; + temp7 = C[7 + j*lda]; + temp8 = C[8 + j*lda]; + temp9 = C[9 + j*lda]; + temp10 = C[10 + j*lda]; + temp11 = C[11 + j*lda]; + temp12 = C[12 + j*lda]; + temp13 = C[13 + j*lda]; + temp14 = C[14 + j*lda]; + temp15 = C[15 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[k*lda]; + temp1 += A[j*lda + k] * B[1+k*lda]; + temp2 += A[j*lda + k] * B[2+k*lda]; + temp3 += A[j*lda + k] * B[3+k*lda]; + temp4 += A[j*lda + k] * B[4+k*lda]; + temp5 += A[j*lda + k] * B[5+k*lda]; + temp6 += A[j*lda + k] * B[6+k*lda]; + temp7 += A[j*lda + k] * B[7+k*lda]; + temp8 += A[j*lda + k] * B[8+k*lda]; + temp9 += A[j*lda + k] * B[9+k*lda]; + temp10 += A[j*lda + k] * B[10+k*lda]; + temp11 += A[j*lda + k] * B[11+k*lda]; + temp12 += A[j*lda + k] * B[12+k*lda]; + temp13 += A[j*lda + k] * B[13+k*lda]; + temp14 += A[j*lda + k] * B[14+k*lda]; + temp15 += A[j*lda + k] * B[15+k*lda]; + } + C[j*lda] = temp0; + C[1 + j*lda] = temp1; + C[2 + j*lda] = temp2; + C[3 + j*lda] = temp3; + C[4 + j*lda] = temp4; + C[5 + j*lda] = temp5; + C[6 + j*lda] = temp6; + C[7 + j*lda] = temp7; + C[8 + j*lda] = temp8; + C[9 + j*lda] = temp9; + C[10 + j*lda] = temp10; + C[11 + j*lda] = temp11; + C[12 + j*lda] = temp12; + C[13 + j*lda] = temp13; + C[14 + j*lda] = temp14; + C[15 + j*lda] = temp15; + } + for(j = 16; j < 32; j++) { + temp0 = C[j*lda]; + temp1 = C[1 + j*lda]; + temp2 = C[2 + j*lda]; + temp3 = C[3 + j*lda]; + temp4 = C[4 + j*lda]; + temp5 = C[5 + j*lda]; + temp6 = C[6 + j*lda]; + temp7 = C[7 + j*lda]; + temp8 = C[8 + j*lda]; + temp9 = C[9 + j*lda]; + temp10 = C[10 + j*lda]; + temp11 = C[11 + j*lda]; + temp12 = C[12 + j*lda]; + temp13 = C[13 + j*lda]; + temp14 = C[14 + j*lda]; + temp15 = C[15 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[k*lda]; + temp1 += A[j*lda + k] * B[1+k*lda]; + temp2 += A[j*lda + k] * B[2+k*lda]; + temp3 += A[j*lda + k] * B[3+k*lda]; + temp4 += A[j*lda + k] * B[4+k*lda]; + temp5 += A[j*lda + k] * B[5+k*lda]; + temp6 += A[j*lda + k] * B[6+k*lda]; + temp7 += A[j*lda + k] * B[7+k*lda]; + temp8 += A[j*lda + k] * B[8+k*lda]; + temp9 += A[j*lda + k] * B[9+k*lda]; + temp10 += A[j*lda + k] * B[10+k*lda]; + temp11 += A[j*lda + k] * B[11+k*lda]; + temp12 += A[j*lda + k] * B[12+k*lda]; + temp13 += A[j*lda + k] * B[13+k*lda]; + temp14 += A[j*lda + k] * B[14+k*lda]; + temp15 += A[j*lda + k] * B[15+k*lda]; + } + C[j*lda] = temp0; + C[1 + j*lda] = temp1; + C[2 + j*lda] = temp2; + C[3 + j*lda] = temp3; + C[4 + j*lda] = temp4; + C[5 + j*lda] = temp5; + C[6 + j*lda] = temp6; + C[7 + j*lda] = temp7; + C[8 + j*lda] = temp8; + C[9 + j*lda] = temp9; + C[10 + j*lda] = temp10; + C[11 + j*lda] = temp11; + C[12 + j*lda] = temp12; + C[13 + j*lda] = temp13; + C[14 + j*lda] = temp14; + C[15 + j*lda] = temp15; + } + } + //16*(2-1) : 16*2 ;; 16*(1-1) : 16*1 + //16:32 ;; 0:16 + if(coreid == 1 || ncores == 1) { + //complete Q3 + for(j = 16; j < 32; j++) { + temp0 = C[16+j*lda]; + temp1 = C[17+j*lda]; + temp2 = C[18+j*lda]; + temp3 = C[19+j*lda]; + temp4 = C[20+j*lda]; + temp5 = C[21+j*lda]; + temp6 = C[22+j*lda]; + temp7 = C[23+j*lda]; + temp8 = C[24+j*lda]; + temp9 = C[25+j*lda]; + temp10 = C[26+j*lda]; + temp11 = C[27+j*lda]; + temp12 = C[28+j*lda]; + temp13 = C[29+j*lda]; + temp14 = C[30+j*lda]; + temp15 = C[31+j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[16+k*lda]; + temp1 += A[j*lda + k] * B[17+k*lda]; + temp2 += A[j*lda + k] * B[18+k*lda]; + temp3 += A[j*lda + k] * B[19+k*lda]; + temp4 += A[j*lda + k] * B[20+k*lda]; + temp5 += A[j*lda + k] * B[21+k*lda]; + temp6 += A[j*lda + k] * B[22+k*lda]; + temp7 += A[j*lda + k] * B[23+k*lda]; + temp8 += A[j*lda + k] * B[24+k*lda]; + temp9 += A[j*lda + k] * B[25+k*lda]; + temp10 += A[j*lda + k] * B[26+k*lda]; + temp11 += A[j*lda + k] * B[27+k*lda]; + temp12 += A[j*lda + k] * B[28+k*lda]; + temp13 += A[j*lda + k] * B[29+k*lda]; + temp14 += A[j*lda + k] * B[30+k*lda]; + temp15 += A[j*lda + k] * B[31+k*lda]; + } + C[16 + j*lda] = temp0; + C[17 + j*lda] = temp1; + C[18 + j*lda] = temp2; + C[19 + j*lda] = temp3; + C[20 + j*lda] = temp4; + C[21 + j*lda] = temp5; + C[22 + j*lda] = temp6; + C[23 + j*lda] = temp7; + C[24 + j*lda] = temp8; + C[25 + j*lda] = temp9; + C[26 + j*lda] = temp10; + C[27 + j*lda] = temp11; + C[28 + j*lda] = temp12; + C[29 + j*lda] = temp13; + C[30 + j*lda] = temp14; + C[31 + j*lda] = temp15; + } + //complete Q4 + for(j = 0; j < 16; j++) { + temp0 = C[16 + j*lda]; + temp1 = C[17 + j*lda]; + temp2 = C[18 + j*lda]; + temp3 = C[19 + j*lda]; + temp4 = C[20 + j*lda]; + temp5 = C[21 + j*lda]; + temp6 = C[22 + j*lda]; + temp7 = C[23 + j*lda]; + temp8 = C[24 + j*lda]; + temp9 = C[25 + j*lda]; + temp10 = C[26 + j*lda]; + temp11 = C[27 + j*lda]; + temp12 = C[28 + j*lda]; + temp13 = C[29 + j*lda]; + temp14 = C[30 + j*lda]; + temp15 = C[31 + j*lda]; + for(k = 0; k < 32; k++) { + temp0 += A[j*lda + k] * B[16 + k*lda]; + temp1 += A[j*lda + k] * B[17 + k*lda]; + temp2 += A[j*lda + k] * B[18 + k*lda]; + temp3 += A[j*lda + k] * B[19 + k*lda]; + temp4 += A[j*lda + k] * B[20 + k*lda]; + temp5 += A[j*lda + k] * B[21 + k*lda]; + temp6 += A[j*lda + k] * B[22 + k*lda]; + temp7 += A[j*lda + k] * B[23 + k*lda]; + temp8 += A[j*lda + k] * B[24 + k*lda]; + temp9 += A[j*lda + k] * B[25 + k*lda]; + temp10 += A[j*lda + k] * B[26 + k*lda]; + temp11 += A[j*lda + k] * B[27 + k*lda]; + temp12 += A[j*lda + k] * B[28 + k*lda]; + temp13 += A[j*lda + k] * B[29 + k*lda]; + temp14 += A[j*lda + k] * B[30 + k*lda]; + temp15 += A[j*lda + k] * B[31 + k*lda]; + } + C[16 + j*lda] = temp0; + C[17 + j*lda] = temp1; + C[18 + j*lda] = temp2; + C[19 + j*lda] = temp3; + C[20 + j*lda] = temp4; + C[21 + j*lda] = temp5; + C[22 + j*lda] = temp6; + C[23 + j*lda] = temp7; + C[24 + j*lda] = temp8; + C[25 + j*lda] = temp9; + C[26 + j*lda] = temp10; + C[27 + j*lda] = temp11; + C[28 + j*lda] = temp12; + C[29 + j*lda] = temp13; + C[30 + j*lda] = temp14; + C[31 + j*lda] = temp15; + } + } +} diff --git a/apps/riscv-tests/mt/dm_matmul.c b/apps/riscv-tests/mt/dm_matmul.c new file mode 100644 index 0000000..1a777d9 --- /dev/null +++ b/apps/riscv-tests/mt/dm_matmul.c @@ -0,0 +1,196 @@ +#include "stdlib.h" + +#include "util.h" + +#include "dataset.h" +void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) +{ + + // ***************************** // + // **** ADD YOUR CODE HERE ***** // + // ***************************** // + // + // feel free to make a separate function for MI and MSI versions. + int i, j, k; + int space=lda/ncores; + int max= space*coreid+space; + static data_t B1[32*32]; + if (coreid==ncores-1){ + for (i=0; i 1) return; + if (coreid || ncores == 1) { +// for ( ii = 0; ii < 32; ii+=IC ) + for ( kk = 0; kk < 32; kk+=16 ) + for ( j = 0; j < 16; j++ ) +// for ( j = 0; j < 16; j++ ) + { + for ( i = 0; i < 32; i+=8 ) +// for ( i = ii; i < ii + IC && i < 32; i+=8 ) + { + data_t temp0 = C[i+j*32]; + data_t temp1 = C[i+j*32+1]; + data_t temp2 = C[i+j*32+2]; + data_t temp3 = C[i+j*32+3]; + data_t temp4 = C[i+j*32+4]; + data_t temp5 = C[i+j*32+5]; + data_t temp6 = C[i+j*32+6]; + data_t temp7 = C[i+j*32+7]; + for ( k = kk; k < kk+16 && k < 32; k++ ) +// for ( k = 0; k < 32; k++ ) + { + data_t tempA = A[j*32+k]; + temp0 += tempA * B[k*32 + i]; + temp1 += tempA * B[k*32 + i+1]; + temp2 += tempA * B[k*32 + i+2]; + temp3 += tempA * B[k*32 + i+3]; + temp4 += tempA * B[k*32 + i+4]; + temp5 += tempA * B[k*32 + i+5]; + temp6 += tempA * B[k*32 + i+6]; + temp7 += tempA * B[k*32 + i+7]; + } + C[i+j*32] = temp0; + C[i+j*32+1] = temp1; + C[i+j*32+2] = temp2; + C[i+j*32+3] = temp3; + C[i+j*32+4] = temp4; + C[i+j*32+5] = temp5; + C[i+j*32+6] = temp6; + C[i+j*32+7] = temp7; + } + } + } + if(coreid == 0){ +// for ( ii = 0; ii < 32; ii+=IC ) + for ( kk = 0; kk < 32; kk+=16 ) + for ( j = 16; j < 32; j++ ) +// for ( j = 16; j < 32; j++ ) + { + for ( i = 0; i < 32; i+=8 ) +// for ( i = ii; i < ii + IC && i < 32; i+=8 ) + { + data_t temp0 = C[i+j*32]; + data_t temp1 = C[i+j*32+1]; + data_t temp2 = C[i+j*32+2]; + data_t temp3 = C[i+j*32+3]; + data_t temp4 = C[i+j*32+4]; + data_t temp5 = C[i+j*32+5]; + data_t temp6 = C[i+j*32+6]; + data_t temp7 = C[i+j*32+7]; + for ( k = kk; k < kk+16 && k < 32; k++ ) + { + data_t tempA = A[j*32+k]; + temp0 += tempA * B[k*32 + i]; + temp1 += tempA * B[k*32 + i+1]; + temp2 += tempA * B[k*32 + i+2]; + temp3 += tempA * B[k*32 + i+3]; + temp4 += tempA * B[k*32 + i+4]; + temp5 += tempA * B[k*32 + i+5]; + temp6 += tempA * B[k*32 + i+6]; + temp7 += tempA * B[k*32 + i+7]; + } + C[i+j*32] = temp0; + C[i+j*32+1] = temp1; + C[i+j*32+2] = temp2; + C[i+j*32+3] = temp3; + C[i+j*32+4] = temp4; + C[i+j*32+5] = temp5; + C[i+j*32+6] = temp6; + C[i+j*32+7] = temp7; + } + + } + } +} diff --git a/apps/riscv-tests/mt/vvadd0.c b/apps/riscv-tests/mt/vvadd0.c new file mode 100644 index 0000000..4cc66b9 --- /dev/null +++ b/apps/riscv-tests/mt/vvadd0.c @@ -0,0 +1,14 @@ +#include "stdlib.h" +#include "dataset.h" + +void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z) +{ + size_t i; + size_t leftover = n % (n / ncores); + for (i = coreid * (n / ncores); i < (coreid + 1) * (n / ncores); i++) { + z[i] = x[i] + y[i]; + } + for (i = (n - leftover) + coreid; i < n; i += ncores) { + z[i] = x[i] + y[i]; + } +} diff --git a/apps/riscv-tests/mt/vvadd1.c b/apps/riscv-tests/mt/vvadd1.c new file mode 100644 index 0000000..b7e44a7 --- /dev/null +++ b/apps/riscv-tests/mt/vvadd1.c @@ -0,0 +1,17 @@ +#include "stdlib.h" +#include "dataset.h" + +void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z) +{ + size_t i; + for (i = coreid*4; i < n; i += 8*ncores) { + z[i] = x[i] + y[i]; + z[i+1] = x[i+1] + y[i+1]; + z[i+2] = x[i+2] + y[i+2]; + z[i+3] = x[i+3] + y[i+3]; + z[i+ncores*4] = x[i+ncores*4] + y[i+ncores*4]; + z[i+ncores*4+1] = x[i+ncores*4+1] + y[i+ncores*4+1]; + z[i+ncores*4+2] = x[i+ncores*4+2] + y[i+ncores*4+2]; + z[i+ncores*4+3] = x[i+ncores*4+3] + y[i+ncores*4+3]; + } +} diff --git a/apps/riscv-tests/mt/vvadd2.c b/apps/riscv-tests/mt/vvadd2.c new file mode 100644 index 0000000..937a2e9 --- /dev/null +++ b/apps/riscv-tests/mt/vvadd2.c @@ -0,0 +1,11 @@ +#include "stdlib.h" +#include "dataset.h" + +void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z) +{ + size_t i; + for (i = coreid; i < n; i += 2*ncores) { + z[i] = x[i] + y[i]; + z[i+ncores] = x[i+ncores] + y[i+ncores]; + } +} diff --git a/apps/riscv-tests/mt/vvadd3.c b/apps/riscv-tests/mt/vvadd3.c new file mode 100644 index 0000000..d18d2de --- /dev/null +++ b/apps/riscv-tests/mt/vvadd3.c @@ -0,0 +1,22 @@ +#include "stdlib.h" +#include "dataset.h" + +void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z) +{ + data_t* to = &z[coreid * (n / ncores)]; + const data_t* from1 = &x[coreid * (n / ncores)]; + const data_t* from2 = &y[coreid * (n / ncores)]; + size_t count = n / ncores; + size_t c = (count + 7) / 8; + switch(count % 8) { + case 0: do { *to++ = *from1++ + *from2++; + case 7: *to++ = *from1++ + *from2++; + case 6: *to++ = *from1++ + *from2++; + case 5: *to++ = *from1++ + *from2++; + case 4: *to++ = *from1++ + *from2++; + case 3: *to++ = *from1++ + *from2++; + case 2: *to++ = *from1++ + *from2++; + case 1: *to++ = *from1++ + *from2++; + } while(--c > 0); + } +} diff --git a/apps/riscv-tests/mt/vvadd4.c b/apps/riscv-tests/mt/vvadd4.c new file mode 100644 index 0000000..8f4d43f --- /dev/null +++ b/apps/riscv-tests/mt/vvadd4.c @@ -0,0 +1,16 @@ +#include "stdlib.h" +#include "dataset.h" + +//-------------------------------------------------------------------------- +// vvadd function + +void __attribute__((noinline)) vvadd(int coreid, int ncores, size_t n, const data_t* x, const data_t* y, data_t* z) +{ + size_t i; + + // interleave accesses + for (i = coreid; i < n; i+=ncores) + { + z[i] = x[i] + y[i]; + } +} diff --git a/config/16_lanes.mk b/config/16_lanes.mk index a832ce3..3c520d0 100644 --- a/config/16_lanes.mk +++ b/config/16_lanes.mk @@ -19,6 +19,8 @@ # Number of vector lanes nr_lanes ?= 16 +# Number of clusters +nr_clusters ?= 4 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/2_lanes.mk b/config/2_lanes.mk index 11ed9d6..5edb8a4 100644 --- a/config/2_lanes.mk +++ b/config/2_lanes.mk @@ -19,6 +19,8 @@ # Number of vector lanes nr_lanes ?= 2 +# Number of clusters +nr_clusters ?= 4 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/4_lanes.mk b/config/4_lanes.mk index 67af28e..7edea50 100644 --- a/config/4_lanes.mk +++ b/config/4_lanes.mk @@ -19,6 +19,8 @@ # Number of vector lanes nr_lanes ?= 4 +# Number of clusters +nr_clusters ?= 4 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/8_lanes.mk b/config/8_lanes.mk index 573f7a5..b07a3b9 100644 --- a/config/8_lanes.mk +++ b/config/8_lanes.mk @@ -19,6 +19,8 @@ # Number of vector lanes nr_lanes ?= 8 +# Number of clusters +nr_clusters ?= 4 # Length of each vector register (in bits) # Constraints: VLEN > 128 From 951b411c2eb092dc8d584166b86a939c88115588 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 19:35:28 +0100 Subject: [PATCH 07/37] [CI] delete sphinx.yml --- .github/workflows/{sphinx.yml => sphinx.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{sphinx.yml => sphinx.txt} (100%) diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.txt similarity index 100% rename from .github/workflows/sphinx.yml rename to .github/workflows/sphinx.txt From 2f3f5ef38fb129bbb75e50f134c8d5d98ae3ad23 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 19:39:26 +0100 Subject: [PATCH 08/37] [CI] uncomment benchmark part --- .github/workflows/ci.yml | 102 +++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a64d12..8a03b8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -505,57 +505,57 @@ jobs: # Benchmark stage # ##################### - # benchmark: - # runs-on: ubuntu-22.04 - # strategy: - # max-parallel: 1 - # matrix: - # ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] - # needs: ["compile-ara", "compile-apps"] - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v4 - # with: - # python-version: 3.12.0 - # - name: Install Python requirements - # run: pip install -r python-requirements.txt - # - name: Download the LLVM toolchain - # uses: actions/download-artifact@v4 - # with: - # name: tc-llvm - # - name: Untar LLVM - # run: tar xvf tc-llvm.tar - # - name: Get Spike artifacts - # uses: actions/download-artifact@v4 - # with: - # name: tc-isa-sim - # - name: Untar Spike - # run: tar xvf tc-isa-sim.tar - # - name: Get Verilated model of Ara - # uses: actions/download-artifact@v4 - # with: - # name: compile-ara-${{ matrix.ara_config }} - # - name: Untar Verilated model of Ara - # run: tar xvf ara.tar - # - name: Benchmark Ara - # run: config=${{ matrix.ara_config }} ./scripts/benchmark.sh ci - # - name: Tar [f]dotproduct runtime results - # run: | - # tar -cvf dotproducts-${{ matrix.ara_config }}.tar *dotproduct*.benchmark - # rm *dotproduct*.benchmark - # - name: Tar runtime results - # run: | - # tar -cvf benchmarks-${{ matrix.ara_config }}.tar *.benchmark - # - name: Upload [f]dotproduct runtime results - # uses: actions/upload-artifact@v4 - # with: - # name: dotproducts-${{ matrix.ara_config }} - # path: dotproducts-${{ matrix.ara_config }}.tar - # - name: Upload runtime results - # uses: actions/upload-artifact@v4 - # with: - # name: benchmark-${{ matrix.ara_config }} - # path: benchmarks-${{ matrix.ara_config }}.tar + benchmark: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + needs: ["compile-ara", "compile-apps"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.12.0 + - name: Install Python requirements + run: pip install -r python-requirements.txt + - name: Download the LLVM toolchain + uses: actions/download-artifact@v4 + with: + name: tc-llvm + - name: Untar LLVM + run: tar xvf tc-llvm.tar + - name: Get Spike artifacts + uses: actions/download-artifact@v4 + with: + name: tc-isa-sim + - name: Untar Spike + run: tar xvf tc-isa-sim.tar + - name: Get Verilated model of Ara + uses: actions/download-artifact@v4 + with: + name: compile-ara-${{ matrix.ara_config }} + - name: Untar Verilated model of Ara + run: tar xvf ara.tar + - name: Benchmark Ara + run: config=${{ matrix.ara_config }} ./scripts/benchmark.sh ci + - name: Tar [f]dotproduct runtime results + run: | + tar -cvf dotproducts-${{ matrix.ara_config }}.tar *dotproduct*.benchmark + rm *dotproduct*.benchmark + - name: Tar runtime results + run: | + tar -cvf benchmarks-${{ matrix.ara_config }}.tar *.benchmark + - name: Upload [f]dotproduct runtime results + uses: actions/upload-artifact@v4 + with: + name: dotproducts-${{ matrix.ara_config }} + path: dotproducts-${{ matrix.ara_config }}.tar + - name: Upload runtime results + uses: actions/upload-artifact@v4 + with: + name: benchmark-${{ matrix.ara_config }} + path: benchmarks-${{ matrix.ara_config }}.tar # roofline: # runs-on: ubuntu-22.04 From 74f1461dde02353cb55da15d367d4b44f94c149e Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 19:40:55 +0100 Subject: [PATCH 09/37] [CI] uncomment roofline part --- .github/workflows/ci.yml | 302 +++++++++++++++++++-------------------- 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a03b8b..fb89d67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -557,157 +557,157 @@ jobs: name: benchmark-${{ matrix.ara_config }} path: benchmarks-${{ matrix.ara_config }}.tar - # roofline: - # runs-on: ubuntu-22.04 - # needs: benchmark - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v4 - # with: - # python-version: 3.12.0 - # - name: Install Python requirements - # run: pip install -r python-requirements.txt - # - uses: actions/checkout@v4 - # - name: Get [f]dotproduct results (2 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: dotproducts-2_lanes - # - name: Get [f]dotproduct results (4 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: dotproducts-4_lanes - # - name: Get [f]dotproduct results (8 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: dotproducts-8_lanes - # - name: Get [f]dotproduct results (16 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: dotproducts-16_lanes - # - name: Get benchmark results (2 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: benchmark-2_lanes - # - name: Get benchmark results (4 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: benchmark-4_lanes - # - name: Get benchmark results (8 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: benchmark-8_lanes - # - name: Get benchmark results (16 lanes) - # uses: actions/download-artifact@v4 - # with: - # name: benchmark-16_lanes - # - name: Untar the [f]dotproduct results - # run: | - # tar xvf dotproducts-2_lanes.tar - # tar xvf dotproducts-4_lanes.tar - # tar xvf dotproducts-8_lanes.tar - # tar xvf dotproducts-16_lanes.tar - # - name: Untar the results - # run: | - # tar xvf benchmarks-2_lanes.tar - # tar xvf benchmarks-4_lanes.tar - # tar xvf benchmarks-8_lanes.tar - # tar xvf benchmarks-16_lanes.tar - # - name: Install gnuplot - # run: | - # sudo apt-get update - # sudo apt-get install gnuplot - # - name: Plot [f]dotproduct plots - # run: | - # for kernel in fdotproduct dotproduct; do - # > ${kernel}.benchmark - # for nr_lanes in 2 4 8 16; do - # cat ${kernel}_${nr_lanes}_bar_plots.benchmark >> ${kernel}.benchmark - # done - # python scripts/process_dotp.py ${kernel} ${kernel}.benchmark ${kernel} - # tar -cvf ${kernel}.tar $(find . -name "${kernel}_*.png") - # done - # - name: Plot the rooflines - # run: gnuplot -c scripts/benchmark.gnuplot - # - name: Upload the imatmul roofline - # uses: actions/upload-artifact@v4 - # with: - # name: imatmul_roofline - # path: imatmul.png - # - name: Upload the fmatmul roofline - # uses: actions/upload-artifact@v4 - # with: - # name: fmatmul_roofline - # path: fmatmul.png - # - name: Upload the iconv2d roofline - # uses: actions/upload-artifact@v4 - # with: - # name: iconv2d_roofline - # path: iconv2d.png - # - name: Upload the fconv2d roofline - # uses: actions/upload-artifact@v4 - # with: - # name: fconv2d_roofline - # path: fconv2d.png - # - name: Upload the fconv3d roofline - # uses: actions/upload-artifact@v4 - # with: - # name: fconv3d_roofline - # path: fconv3d.png - # - name: Upload the jacobi2d roofline - # uses: actions/upload-artifact@v4 - # with: - # name: jacobi2d_roofline - # path: jacobi2d.png - # - name: Upload the dropout roofline - # uses: actions/upload-artifact@v4 - # with: - # name: dropout_roofline - # path: dropout.png - # - name: Upload the fft roofline - # uses: actions/upload-artifact@v4 - # with: - # name: fft_roofline - # path: fft.png - # - name: Upload the dwt roofline - # uses: actions/upload-artifact@v4 - # with: - # name: dwt_roofline - # path: dwt.png - # - name: Upload the exp roofline - # uses: actions/upload-artifact@v4 - # with: - # name: exp_roofline - # path: exp.png - # - name: Upload the softmax roofline - # uses: actions/upload-artifact@v4 - # with: - # name: softmax_roofline - # path: softmax.png - # - name: Upload the fdotproduct roofline - # uses: actions/upload-artifact@v4 - # with: - # name: fdotproduct_plots - # path: fdotproduct.tar - # - name: Upload the dotproduct roofline - # uses: actions/upload-artifact@v4 - # with: - # name: dotproduct_plots - # path: dotproduct.tar - # - name: Upload the pathfinder roofline - # uses: actions/upload-artifact@v4 - # with: - # name: pathfinder_roofline - # path: pathfinder.png - # - name: Upload the roi_align roofline - # uses: actions/upload-artifact@v4 - # with: - # name: roi_align_roofline - # path: roi_align.png - # - name: Upload the lavamd roofline - # uses: actions/upload-artifact@v4 - # with: - # name: lavamd_roofline - # path: lavamd.png + roofline: + runs-on: ubuntu-22.04 + needs: benchmark + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.12.0 + - name: Install Python requirements + run: pip install -r python-requirements.txt + - uses: actions/checkout@v4 + - name: Get [f]dotproduct results (2 lanes) + uses: actions/download-artifact@v4 + with: + name: dotproducts-2_lanes + - name: Get [f]dotproduct results (4 lanes) + uses: actions/download-artifact@v4 + with: + name: dotproducts-4_lanes + - name: Get [f]dotproduct results (8 lanes) + uses: actions/download-artifact@v4 + with: + name: dotproducts-8_lanes + - name: Get [f]dotproduct results (16 lanes) + uses: actions/download-artifact@v4 + with: + name: dotproducts-16_lanes + - name: Get benchmark results (2 lanes) + uses: actions/download-artifact@v4 + with: + name: benchmark-2_lanes + - name: Get benchmark results (4 lanes) + uses: actions/download-artifact@v4 + with: + name: benchmark-4_lanes + - name: Get benchmark results (8 lanes) + uses: actions/download-artifact@v4 + with: + name: benchmark-8_lanes + - name: Get benchmark results (16 lanes) + uses: actions/download-artifact@v4 + with: + name: benchmark-16_lanes + - name: Untar the [f]dotproduct results + run: | + tar xvf dotproducts-2_lanes.tar + tar xvf dotproducts-4_lanes.tar + tar xvf dotproducts-8_lanes.tar + tar xvf dotproducts-16_lanes.tar + - name: Untar the results + run: | + tar xvf benchmarks-2_lanes.tar + tar xvf benchmarks-4_lanes.tar + tar xvf benchmarks-8_lanes.tar + tar xvf benchmarks-16_lanes.tar + - name: Install gnuplot + run: | + sudo apt-get update + sudo apt-get install gnuplot + - name: Plot [f]dotproduct plots + run: | + for kernel in fdotproduct dotproduct; do + > ${kernel}.benchmark + for nr_lanes in 2 4 8 16; do + cat ${kernel}_${nr_lanes}_bar_plots.benchmark >> ${kernel}.benchmark + done + python scripts/process_dotp.py ${kernel} ${kernel}.benchmark ${kernel} + tar -cvf ${kernel}.tar $(find . -name "${kernel}_*.png") + done + - name: Plot the rooflines + run: gnuplot -c scripts/benchmark.gnuplot + - name: Upload the imatmul roofline + uses: actions/upload-artifact@v4 + with: + name: imatmul_roofline + path: imatmul.png + - name: Upload the fmatmul roofline + uses: actions/upload-artifact@v4 + with: + name: fmatmul_roofline + path: fmatmul.png + - name: Upload the iconv2d roofline + uses: actions/upload-artifact@v4 + with: + name: iconv2d_roofline + path: iconv2d.png + - name: Upload the fconv2d roofline + uses: actions/upload-artifact@v4 + with: + name: fconv2d_roofline + path: fconv2d.png + - name: Upload the fconv3d roofline + uses: actions/upload-artifact@v4 + with: + name: fconv3d_roofline + path: fconv3d.png + - name: Upload the jacobi2d roofline + uses: actions/upload-artifact@v4 + with: + name: jacobi2d_roofline + path: jacobi2d.png + - name: Upload the dropout roofline + uses: actions/upload-artifact@v4 + with: + name: dropout_roofline + path: dropout.png + - name: Upload the fft roofline + uses: actions/upload-artifact@v4 + with: + name: fft_roofline + path: fft.png + - name: Upload the dwt roofline + uses: actions/upload-artifact@v4 + with: + name: dwt_roofline + path: dwt.png + - name: Upload the exp roofline + uses: actions/upload-artifact@v4 + with: + name: exp_roofline + path: exp.png + - name: Upload the softmax roofline + uses: actions/upload-artifact@v4 + with: + name: softmax_roofline + path: softmax.png + - name: Upload the fdotproduct roofline + uses: actions/upload-artifact@v4 + with: + name: fdotproduct_plots + path: fdotproduct.tar + - name: Upload the dotproduct roofline + uses: actions/upload-artifact@v4 + with: + name: dotproduct_plots + path: dotproduct.tar + - name: Upload the pathfinder roofline + uses: actions/upload-artifact@v4 + with: + name: pathfinder_roofline + path: pathfinder.png + - name: Upload the roi_align roofline + uses: actions/upload-artifact@v4 + with: + name: roi_align_roofline + path: roi_align.png + - name: Upload the lavamd roofline + uses: actions/upload-artifact@v4 + with: + name: lavamd_roofline + path: lavamd.png #################### # Clean-up stage # From 85b07eb2986eebe15588cc6322eb93059d4127f3 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 19:52:55 +0100 Subject: [PATCH 10/37] [CI] remove variables --- .github/workflows/ci.yml | 136 +++++++++---------- .github/workflows/{sphinx.txt => sphinx.yml} | 0 2 files changed, 68 insertions(+), 68 deletions(-) rename .github/workflows/{sphinx.txt => sphinx.yml} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb89d67..4b9d5ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,8 @@ # Run functional regression checks name: ci on: [push, pull_request] -variables: - TOOL_DIR=/usr/scratch2/tokyo/mperotti/tools/arathon/install +# variables: +# TOOL_DIR=/usr/scratch2/tokyo/mperotti/tools/arathon/install # Only allow one workflow per PR/Branch (the last one) # https://docs.github.com/en/actions/learn-github-actions/expressions @@ -75,7 +75,7 @@ jobs: # sudo apt-get install -y ninja-build # CC=gcc CXX=g++ make toolchain-llvm - name: Copy LLVM tools - run: cp -Lr ${TOOL_DIR}/riscv-llvm install + run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-llvm install - name: Tar LLVM run: tar -cvf tc-llvm.tar install/riscv-llvm - name: Upload LLVM @@ -128,7 +128,7 @@ jobs: # sudo apt-get install libmpc-dev # CC=gcc CXX=g++ make toolchain-gcc - name: Copy GCC tools - run: cp -Lr ${TOOL_DIR}/riscv-gcc install + run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-gcc install - name: Tar GCC run: tar -cvf tc-gcc.tar install/riscv-gcc - name: Upload GCC @@ -165,7 +165,7 @@ jobs: # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' # run: make riscv-isa-sim - name: Copy Spike - run: cp -Lr ${TOOL_DIR}/riscv-isa-sim install + run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-isa-sim install - name: Tar Spike run: tar -cvf tc-isa-sim.tar install/riscv-isa-sim - name: Upload Spike @@ -203,7 +203,7 @@ jobs: # sudo apt-get install flex libfl-dev help2man # make verilator - name: Copy Verilator - run: cp -Lr ${TOOL_DIR}/verilator install + run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/verilator install - name: Tar Verilator run: tar -cvf tc-verilator.tar install/verilator - name: Upload Verilator @@ -371,69 +371,69 @@ jobs: # RISC-V Tests stage # ######################## - # riscv-tests-simv: - # runs-on: ubuntu-22.04 - # strategy: - # max-parallel: 1 - # matrix: - # ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] - # needs: ["compile-ara", "compile-riscv-tests"] - # steps: - # - uses: actions/checkout@v4 - # - name: Get Spike artifacts - # uses: actions/download-artifact@v4 - # with: - # name: tc-isa-sim - # - name: Untar Spike - # run: tar xvf tc-isa-sim.tar - # - name: Get Verilated model of Ara - # uses: actions/download-artifact@v4 - # with: - # name: compile-ara-${{ matrix.ara_config }} - # - name: Untar Verilated model of Ara - # run: tar xvf ara.tar - # - name: Get RISC-V tests - # uses: actions/download-artifact@v4 - # with: - # name: compile-riscv-tests-${{ matrix.ara_config }} - # path: apps/bin - # - name: Run tests - # run: config=${{ matrix.ara_config }} make -C hardware -j8 riscv_tests_simv + riscv-tests-simv: + runs-on: ubuntu-22.04 + strategy: + max-parallel: 1 + matrix: + ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + needs: ["compile-ara", "compile-riscv-tests"] + steps: + - uses: actions/checkout@v4 + - name: Get Spike artifacts + uses: actions/download-artifact@v4 + with: + name: tc-isa-sim + - name: Untar Spike + run: tar xvf tc-isa-sim.tar + - name: Get Verilated model of Ara + uses: actions/download-artifact@v4 + with: + name: compile-ara-${{ matrix.ara_config }} + - name: Untar Verilated model of Ara + run: tar xvf ara.tar + - name: Get RISC-V tests + uses: actions/download-artifact@v4 + with: + name: compile-riscv-tests-${{ matrix.ara_config }} + path: apps/bin + - name: Run tests + run: config=${{ matrix.ara_config }} make -C hardware -j8 riscv_tests_simv - # riscv-tests-spike: - # runs-on: ubuntu-22.04 - # needs: ["tc-isa-sim", "compile-riscv-tests"] - # steps: - # - uses: actions/checkout@v4 - # - name: Get Spike artifacts - # uses: actions/download-artifact@v4 - # with: - # name: tc-isa-sim - # - name: Untar Spike - # run: tar xvf tc-isa-sim.tar - # - name: Download the LLVM toolchain - # uses: actions/download-artifact@v4 - # with: - # name: tc-llvm - # - name: Untar LLVM - # run: tar xvf tc-llvm.tar - # - name: Download the GCC toolchain - # uses: actions/download-artifact@v4 - # with: - # name: tc-gcc - # - name: Untar GCC - # run: tar xvf tc-gcc.tar - # - name: Run tests - # run: | - # make -C apps/riscv-tests/isa clean - # make -C apps riscv_tests_spike - # - name: Upload dumps - # uses: actions/upload-artifact@v4 - # with: - # name: riscv-tests-spike - # path: | - # apps/riscv-tests/isa/*.dump - # apps/riscv-tests/isa/*.out32 + riscv-tests-spike: + runs-on: ubuntu-22.04 + needs: ["tc-isa-sim", "compile-riscv-tests"] + steps: + - uses: actions/checkout@v4 + - name: Get Spike artifacts + uses: actions/download-artifact@v4 + with: + name: tc-isa-sim + - name: Untar Spike + run: tar xvf tc-isa-sim.tar + - name: Download the LLVM toolchain + uses: actions/download-artifact@v4 + with: + name: tc-llvm + - name: Untar LLVM + run: tar xvf tc-llvm.tar + - name: Download the GCC toolchain + uses: actions/download-artifact@v4 + with: + name: tc-gcc + - name: Untar GCC + run: tar xvf tc-gcc.tar + - name: Run tests + run: | + make -C apps/riscv-tests/isa clean + make -C apps riscv_tests_spike + - name: Upload dumps + uses: actions/upload-artifact@v4 + with: + name: riscv-tests-spike + path: | + apps/riscv-tests/isa/*.dump + apps/riscv-tests/isa/*.out32 ################### # Linting stage # diff --git a/.github/workflows/sphinx.txt b/.github/workflows/sphinx.yml similarity index 100% rename from .github/workflows/sphinx.txt rename to .github/workflows/sphinx.yml From 1b5a9c1bbc6ccc4f9522098342567ac20fcee3a9 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 19:59:15 +0100 Subject: [PATCH 11/37] [CI]update sciki-learn kit --- python-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-requirements.txt b/python-requirements.txt index cba2d9d..cf27f08 100644 --- a/python-requirements.txt +++ b/python-requirements.txt @@ -12,4 +12,4 @@ tabulate yamlfmt numpy matplotlib -sklearn +scikit-learn From 62794b6061ccd3fd772b689d7f2011c81e08a00b Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 20:25:57 +0100 Subject: [PATCH 12/37] [CI] ci trial on toolchain --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b9d5ed..bbf773c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,7 +165,7 @@ jobs: # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' # run: make riscv-isa-sim - name: Copy Spike - run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-isa-sim install + run: cp -Lr $GITHUB_WORKSPACE/install/riscv-isa-sim install - name: Tar Spike run: tar -cvf tc-isa-sim.tar install/riscv-isa-sim - name: Upload Spike From 1022af4605a391d92118bd0f511951a864f4befc Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 20:28:41 +0100 Subject: [PATCH 13/37] [CI] ci trial on toolchain --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbf773c..e1f1746 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,7 +165,7 @@ jobs: # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' # run: make riscv-isa-sim - name: Copy Spike - run: cp -Lr $GITHUB_WORKSPACE/install/riscv-isa-sim install + run: cp -Lr $GITHUB_WORKSPACE/toolchain/riscv-isa-sim install - name: Tar Spike run: tar -cvf tc-isa-sim.tar install/riscv-isa-sim - name: Upload Spike From 5a2d75efd2fe1d6c59a3303dbca9c8f585385ee3 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 21:20:44 +0100 Subject: [PATCH 14/37] [spyglass] Fix license declaration --- hardware/spyglass/sdc/func.sdc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/spyglass/sdc/func.sdc b/hardware/spyglass/sdc/func.sdc index 3660b98..287db8d 100644 --- a/hardware/spyglass/sdc/func.sdc +++ b/hardware/spyglass/sdc/func.sdc @@ -1,4 +1,4 @@ -# Copyright 2022v ETH Zurich and University of Bologna. +# Copyright 2022 ETH Zurich and University of Bologna. # Solderpad Hardware License, Version 0.51, see LICENSE for details. # SPDX-License-Identifier: SHL-0.51 From 4cde560e77ca1134475677564f88b9058016f6cd Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 21:34:52 +0100 Subject: [PATCH 15/37] [spyglass] Modify toolchain install flow --- .github/workflows/ci.yml | 138 +++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1f1746..7254903 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,12 +46,12 @@ jobs: large-packages: true docker-images: true swap-storage: true - # - uses: actions/checkout@v4 - # - name: Recover the submodule commit hash - # id: recover_hash - # run: | - # git submodule status toolchain/riscv-llvm | cut -d' ' -f1 - # echo "tc-llvm-hash=`git submodule status toolchain/riscv-llvm | cut -d' ' -f1`" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: Recover the submodule commit hash + id: recover_hash + run: | + git submodule status toolchain/riscv-llvm | cut -d' ' -f1 + echo "tc-llvm-hash=`git submodule status toolchain/riscv-llvm | cut -d' ' -f1`" >> $GITHUB_ENV - name: Cache the LLVM toolchain uses: actions/cache@v4 id: tc-llvm-cache @@ -62,20 +62,20 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-llvm-hash }} restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-llvm-hash }} - # - name: Download the LLVM toolchain - # if: steps.tc-llvm-cache.outputs.cache-hit != 'true' - # run: git submodule update --init --recursive --checkout -- toolchain/riscv-llvm - # - name: Download Newlib - # if: steps.tc-llvm-cache.outputs.cache-hit != 'true' - # run: git submodule update --init --recursive --checkout -- toolchain/newlib - # - name: Compile LLVM - # if: steps.tc-llvm-cache.outputs.cache-hit != 'true' - # run: | - # sudo apt-get install libmpc-dev - # sudo apt-get install -y ninja-build - # CC=gcc CXX=g++ make toolchain-llvm - - name: Copy LLVM tools - run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-llvm install + - name: Download the LLVM toolchain + if: steps.tc-llvm-cache.outputs.cache-hit != 'true' + run: git submodule update --init --recursive --checkout -- toolchain/riscv-llvm + - name: Download Newlib + if: steps.tc-llvm-cache.outputs.cache-hit != 'true' + run: git submodule update --init --recursive --checkout -- toolchain/newlib + - name: Compile LLVM + if: steps.tc-llvm-cache.outputs.cache-hit != 'true' + run: | + sudo apt-get install libmpc-dev + sudo apt-get install -y ninja-build + CC=gcc CXX=g++ make toolchain-llvm + # - name: Copy LLVM tools + # run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-llvm install - name: Tar LLVM run: tar -cvf tc-llvm.tar install/riscv-llvm - name: Upload LLVM @@ -103,12 +103,12 @@ jobs: large-packages: true docker-images: true swap-storage: true - # - uses: actions/checkout@v4 - # - name: Recover the submodule commit hash - # id: recover_hash - # run: | - # git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1 - # echo "tc-gcc-hash=`git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1`" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: Recover the submodule commit hash + id: recover_hash + run: | + git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1 + echo "tc-gcc-hash=`git submodule status toolchain/riscv-gnu-toolchain | cut -d' ' -f1`" >> $GITHUB_ENV - name: Cache the GCC toolchain uses: actions/cache@v4 id: tc-gcc-cache @@ -119,16 +119,16 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-gcc-hash }} restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-gcc-hash }} - # - name: Download the GCC toolchain - # if: steps.tc-gcc-cache.outputs.cache-hit != 'true' - # run: git submodule update --init --recursive --checkout -- toolchain/riscv-gnu-toolchain - # - name: Compile GCC - # if: steps.tc-gcc-cache.outputs.cache-hit != 'true' - # run: | - # sudo apt-get install libmpc-dev - # CC=gcc CXX=g++ make toolchain-gcc - - name: Copy GCC tools - run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-gcc install + - name: Download the GCC toolchain + if: steps.tc-gcc-cache.outputs.cache-hit != 'true' + run: git submodule update --init --recursive --checkout -- toolchain/riscv-gnu-toolchain + - name: Compile GCC + if: steps.tc-gcc-cache.outputs.cache-hit != 'true' + run: | + sudo apt-get install libmpc-dev + CC=gcc CXX=g++ make toolchain-gcc + # - name: Copy GCC tools + # run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/riscv-gcc install - name: Tar GCC run: tar -cvf tc-gcc.tar install/riscv-gcc - name: Upload GCC @@ -140,12 +140,12 @@ jobs: tc-isa-sim: runs-on: ubuntu-22.04 steps: - # - uses: actions/checkout@v4 - # - name: Recover the submodule commit hash - # id: recover_hash - # run: | - # git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1 - # echo "tc-isa-sim-hash=`git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1`" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: Recover the submodule commit hash + id: recover_hash + run: | + git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1 + echo "tc-isa-sim-hash=`git submodule status toolchain/riscv-isa-sim | cut -d' ' -f1`" >> $GITHUB_ENV - name: Cache Spike uses: actions/cache@v4 id: tc-isa-sim-cache @@ -156,16 +156,16 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-isa-sim-hash }} restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.tc-isa-sim-hash }} - # - name: Download Spike - # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' - # run: | - # git submodule update --init --recursive -- toolchain/riscv-isa-sim - # git submodule foreach --recursive git reset --hard - # - name: Compile Spike - # if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' - # run: make riscv-isa-sim - - name: Copy Spike - run: cp -Lr $GITHUB_WORKSPACE/toolchain/riscv-isa-sim install + - name: Download Spike + if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' + run: | + git submodule update --init --recursive -- toolchain/riscv-isa-sim + git submodule foreach --recursive git reset --hard + - name: Compile Spike + if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' + run: make riscv-isa-sim + # - name: Copy Spike + # run: cp -Lr $GITHUB_WORKSPACE/toolchain/riscv-isa-sim install - name: Tar Spike run: tar -cvf tc-isa-sim.tar install/riscv-isa-sim - name: Upload Spike @@ -177,12 +177,12 @@ jobs: tc-verilator: runs-on: ubuntu-22.04 steps: - # - uses: actions/checkout@v4 - # - name: Recover the submodule commit hash - # id: recover_hash - # run: | - # git submodule status toolchain/verilator | cut -d' ' -f1 - # echo "tc-verilator-hash=`git submodule status toolchain/verilator | cut -d' ' -f1`" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: Recover the submodule commit hash + id: recover_hash + run: | + git submodule status toolchain/verilator | cut -d' ' -f1 + echo "tc-verilator-hash=`git submodule status toolchain/verilator | cut -d' ' -f1`" >> $GITHUB_ENV - name: Cache Verilator uses: actions/cache@v4 id: tc-verilator-cache @@ -193,17 +193,17 @@ jobs: key: ${{ runner.os }}-build-llvm10-${{ env.cache-name }}-${{ env.tc-verilator-hash }} restore-keys: ${{ runner.os }}-build-llvm10-${{ env.cache-name }}-${{ env.tc-verilator-hash }} - # - name: Download Verilator - # if: steps.tc-verilator-cache.outputs.cache-hit != 'true' - # run: | - # git submodule update --init --recursive -- toolchain/verilator - # - name: Compile Verilator - # if: steps.tc-verilator-cache.outputs.cache-hit != 'true' - # run: | - # sudo apt-get install flex libfl-dev help2man - # make verilator - - name: Copy Verilator - run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/verilator install + - name: Download Verilator + if: steps.tc-verilator-cache.outputs.cache-hit != 'true' + run: | + git submodule update --init --recursive -- toolchain/verilator + - name: Compile Verilator + if: steps.tc-verilator-cache.outputs.cache-hit != 'true' + run: | + sudo apt-get install flex libfl-dev help2man + make verilator + # - name: Copy Verilator + # run: cp -Lr /usr/scratch2/tokyo/mperotti/tools/arathon/install/verilator install - name: Tar Verilator run: tar -cvf tc-verilator.tar install/verilator - name: Upload Verilator From 13b36131ddaccb3c44ca3b3920b012370c51f083 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 21:44:22 +0100 Subject: [PATCH 16/37] [makefile] update spike commit --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 76088c4..8d4e396 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ ISA_SIM_MOD_INSTALL_DIR ?= ${INSTALL_DIR}/riscv-isa-sim-mod VERIL_INSTALL_DIR ?= ${INSTALL_DIR}/verilator RISCV_TESTS_INSTALL_DIR ?= ${INSTALL_DIR}/riscv_tests VERIL_VERSION ?= v5.012 -DTC_COMMIT ?= b6910bec11614980a21e46fbccc35934b671bd81 +# DTC_COMMIT ?= b6910bec11614980a21e46fbccc35934b671bd81 +DTC_COMMIT ?= 7f3184a6c550bb8fb59e93c9901d75dced889dcf CMAKE ?= cmake From 348420f7f7c3e6d12db1539b1d67e82ec807a9a4 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 3 Nov 2025 21:57:22 +0100 Subject: [PATCH 17/37] [CI] try to clone dtc from github mirror --- .github/workflows/ci.yml | 3 ++- Makefile | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7254903..18c94b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,7 +163,8 @@ jobs: git submodule foreach --recursive git reset --hard - name: Compile Spike if: steps.tc-isa-sim-cache.outputs.cache-hit != 'true' - run: make riscv-isa-sim + # run: make riscv-isa-sim + run: make riscv-isa-sim LDFLAGS="-static-libstdc++" # - name: Copy Spike # run: cp -Lr $GITHUB_WORKSPACE/toolchain/riscv-isa-sim install - name: Tar Spike diff --git a/Makefile b/Makefile index 8d4e396..ee2a285 100644 --- a/Makefile +++ b/Makefile @@ -27,8 +27,8 @@ ISA_SIM_MOD_INSTALL_DIR ?= ${INSTALL_DIR}/riscv-isa-sim-mod VERIL_INSTALL_DIR ?= ${INSTALL_DIR}/verilator RISCV_TESTS_INSTALL_DIR ?= ${INSTALL_DIR}/riscv_tests VERIL_VERSION ?= v5.012 -# DTC_COMMIT ?= b6910bec11614980a21e46fbccc35934b671bd81 -DTC_COMMIT ?= 7f3184a6c550bb8fb59e93c9901d75dced889dcf +DTC_COMMIT ?= b6910bec11614980a21e46fbccc35934b671bd81 +# DTC_COMMIT ?= 7f3184a6c550bb8fb59e93c9901d75dced889dcf CMAKE ?= cmake @@ -146,7 +146,7 @@ ${ISA_SIM_MOD_INSTALL_DIR}: Makefile patches/0003-riscv-isa-sim-patch ${ISA_SIM_ # Spike was compiled successfully using gcc and g++ version 7.2.0. cd toolchain/riscv-isa-sim && git stash && git apply ../../patches/0003-riscv-isa-sim-patch && \ rm -rf build && mkdir -p build && cd build; \ - [ -d dtc ] || git clone https://git.kernel.org/pub/scm/utils/dtc/dtc.git && cd dtc && git checkout $(DTC_COMMIT); \ + [ -d dtc ] || git clone https://github.com/dgibson/dtc.git dtc && cd dtc && git checkout $(DTC_COMMIT); \ make install SETUP_PREFIX=$(ISA_SIM_MOD_INSTALL_DIR) PREFIX=$(ISA_SIM_MOD_INSTALL_DIR) && \ PATH=$(ISA_SIM_MOD_INSTALL_DIR)/bin:$$PATH; cd ..; \ ../configure --prefix=$(ISA_SIM_MOD_INSTALL_DIR) \ @@ -161,7 +161,7 @@ ${ISA_SIM_INSTALL_DIR}: Makefile # make riscv-isa-sim LDFLAGS="-static-libstdc++" # Spike was compiled successfully using gcc and g++ version 7.2.0. cd toolchain/riscv-isa-sim && rm -rf build && mkdir -p build && cd build; \ - [ -d dtc ] || git clone https://git.kernel.org/pub/scm/utils/dtc/dtc.git && cd dtc && git checkout $(DTC_COMMIT); \ + [ -d dtc ] || git clone https://github.com/dgibson/dtc.git dtc && cd dtc && git checkout $(DTC_COMMIT); \ make install SETUP_PREFIX=$(ISA_SIM_INSTALL_DIR) PREFIX=$(ISA_SIM_INSTALL_DIR) && \ PATH=$(ISA_SIM_INSTALL_DIR)/bin:$$PATH; cd ..; \ ../configure --prefix=$(ISA_SIM_INSTALL_DIR) \ From 881a2e9dca45634d698e62ca2856edd1ca61cb78 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 00:08:34 +0100 Subject: [PATCH 18/37] [tb] Add cluster-related parameters in verilater tb --- hardware/tb/ara_tb_verilator.sv | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hardware/tb/ara_tb_verilator.sv b/hardware/tb/ara_tb_verilator.sv index e31c6ac..218ab6d 100644 --- a/hardware/tb/ara_tb_verilator.sv +++ b/hardware/tb/ara_tb_verilator.sv @@ -25,10 +25,22 @@ module ara_tb_verilator #( * DUT * *********/ + // ara_testharness #( + // .NrLanes (NrLanes ), + // .AxiAddrWidth(AxiAddrWidth ), + // .AxiDataWidth(AxiWideDataWidth) + // ) dut ( + // .clk_i (clk_i ), + // .rst_ni(rst_ni), + // .exit_o(exit_o) + // ); + ara_testharness #( .NrLanes (NrLanes ), + .NrClusters (NrClusters ), .AxiAddrWidth(AxiAddrWidth ), - .AxiDataWidth(AxiWideDataWidth) + .AxiDataWidth(AxiWideDataWidth), + .ClusterAxiDataWidth(ClusterAxiDataWidth) ) dut ( .clk_i (clk_i ), .rst_ni(rst_ni), From 49659b6c940ea5ddf70a97914be5a49048023e5c Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 00:25:31 +0100 Subject: [PATCH 19/37] [verilator] add cluster-related parameters verilator tb --- hardware/Makefile | 2 ++ hardware/tb/ara_tb_verilator.sv | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hardware/Makefile b/hardware/Makefile index a4ac10f..d3d3a2c 100644 --- a/hardware/Makefile +++ b/hardware/Makefile @@ -213,6 +213,7 @@ $(veril_library)/V$(veril_top): $(config_file) Makefile ../Bender.yml $(shell fi # Verilate the design $(veril_path)/verilator -f $(veril_library)/bender_script_$(config) \ -GNrLanes=$(nr_lanes) \ + -GNrClusters=$(nr_clusters) \ -O3 \ -Wno-fatal \ -Wno-PINCONNECTEMPTY \ @@ -235,6 +236,7 @@ $(veril_library)/V$(veril_top): $(config_file) Makefile ../Bender.yml $(shell fi --compiler clang \ -CFLAGS "-DTOPLEVEL_NAME=$(veril_top)" \ -CFLAGS "-DNR_LANES=$(nr_lanes)" \ + -CFLAGS "-DNR_CLUSTERS=$(nr_clusters)" \ -CFLAGS -I$(ROOT_DIR)/tb/verilator/lowrisc_dv_verilator_memutil_dpi/cpp \ -CFLAGS -I$(ROOT_DIR)/tb/verilator/lowrisc_dv_verilator_memutil_verilator/cpp \ -CFLAGS -I$(ROOT_DIR)/tb/verilator/lowrisc_dv_verilator_simutil_verilator/cpp \ diff --git a/hardware/tb/ara_tb_verilator.sv b/hardware/tb/ara_tb_verilator.sv index 218ab6d..e0b136a 100644 --- a/hardware/tb/ara_tb_verilator.sv +++ b/hardware/tb/ara_tb_verilator.sv @@ -7,7 +7,8 @@ // Description: Top level testbench module for Verilator. module ara_tb_verilator #( - parameter int unsigned NrLanes = 0 + parameter int unsigned NrLanes = 0, + parameter int unsigned NrClusters = 0 )( input logic clk_i, input logic rst_ni, @@ -18,8 +19,11 @@ module ara_tb_verilator #( * Definitions * *****************/ - localparam AxiAddrWidth = 64; - localparam AxiWideDataWidth = 64 * NrLanes / 2; + // localparam AxiAddrWidth = 64; + // localparam AxiWideDataWidth = 64 * NrLanes / 2; + localparam AxiAddrWidth = 64; + localparam AxiWideDataWidth = 32 * NrLanes * NrClusters; + localparam ClusterAxiDataWidth = 32 * NrLanes; /********* * DUT * From 1d9bb98f308a728535c2dee09cee696b6130bce7 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 00:58:51 +0100 Subject: [PATCH 20/37] [verilater] update dram word width to 32*NrLanes*NrClusters --- hardware/tb/verilator/ara_tb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/tb/verilator/ara_tb.cpp b/hardware/tb/verilator/ara_tb.cpp index 6f27c68..99ae0b2 100644 --- a/hardware/tb/verilator/ara_tb.cpp +++ b/hardware/tb/verilator/ara_tb.cpp @@ -26,7 +26,7 @@ int main(int argc, char **argv) { // Initialize the DRAM MemAreaLoc l2_mem = {.base=0x80000000, .size=0x00100000}; memutil.RegisterMemoryArea( - "ram", "TOP.ara_tb_verilator.dut.i_ara_soc.i_dram", 64*NR_LANES/2, &l2_mem); + "ram", "TOP.ara_tb_verilator.dut.i_ara_soc.i_dram", 32*NrLanes*NrClusters, &l2_mem); simctrl.RegisterExtension(&memutil); simctrl.SetInitialResetDelay(5); From 1c8c60e056db4e47878c0853b3805b207a1ad82c Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 01:25:24 +0100 Subject: [PATCH 21/37] [verilator] change the ways how parameters are passed to top level tb --- hardware/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/Makefile b/hardware/Makefile index d3d3a2c..7d1c032 100644 --- a/hardware/Makefile +++ b/hardware/Makefile @@ -212,8 +212,8 @@ $(veril_library)/V$(veril_top): $(config_file) Makefile ../Bender.yml $(shell fi $(BENDER) script verilator $(bender_targs_veril) $(bender_defs) > $(veril_library)/bender_script_$(config) # Verilate the design $(veril_path)/verilator -f $(veril_library)/bender_script_$(config) \ - -GNrLanes=$(nr_lanes) \ - -GNrClusters=$(nr_clusters) \ + -Gara_tb_verilator.NrLanes=2 \ + -Gara_tb_verilator.NrClusters=4 \ -O3 \ -Wno-fatal \ -Wno-PINCONNECTEMPTY \ From 62eca9e0c3a1bd02753070b35b1966ca594885d6 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 01:30:50 +0100 Subject: [PATCH 22/37] [verilator] pass NrLanes and NrClusters with defined value --- hardware/tb/ara_tb_verilator.sv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/tb/ara_tb_verilator.sv b/hardware/tb/ara_tb_verilator.sv index e0b136a..6c3cc9a 100644 --- a/hardware/tb/ara_tb_verilator.sv +++ b/hardware/tb/ara_tb_verilator.sv @@ -7,8 +7,8 @@ // Description: Top level testbench module for Verilator. module ara_tb_verilator #( - parameter int unsigned NrLanes = 0, - parameter int unsigned NrClusters = 0 + parameter int unsigned NrLanes = `NR_LANES, + parameter int unsigned NrClusters = `NR_CLUSTERS )( input logic clk_i, input logic rst_ni, From adae12d516c91e2fbb5cfb4b6011b7810a25b505 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 01:34:38 +0100 Subject: [PATCH 23/37] [verilator] remove GNrLanes and GNrClusters define --- hardware/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/hardware/Makefile b/hardware/Makefile index 7d1c032..7f78781 100644 --- a/hardware/Makefile +++ b/hardware/Makefile @@ -212,8 +212,6 @@ $(veril_library)/V$(veril_top): $(config_file) Makefile ../Bender.yml $(shell fi $(BENDER) script verilator $(bender_targs_veril) $(bender_defs) > $(veril_library)/bender_script_$(config) # Verilate the design $(veril_path)/verilator -f $(veril_library)/bender_script_$(config) \ - -Gara_tb_verilator.NrLanes=2 \ - -Gara_tb_verilator.NrClusters=4 \ -O3 \ -Wno-fatal \ -Wno-PINCONNECTEMPTY \ From a763aa7881fbdfa1f05ab1d6db6309a3f6579ff0 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 01:40:56 +0100 Subject: [PATCH 24/37] [verilator] fix parameter name unmatch --- hardware/tb/verilator/ara_tb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/tb/verilator/ara_tb.cpp b/hardware/tb/verilator/ara_tb.cpp index 99ae0b2..ac5954a 100644 --- a/hardware/tb/verilator/ara_tb.cpp +++ b/hardware/tb/verilator/ara_tb.cpp @@ -26,7 +26,7 @@ int main(int argc, char **argv) { // Initialize the DRAM MemAreaLoc l2_mem = {.base=0x80000000, .size=0x00100000}; memutil.RegisterMemoryArea( - "ram", "TOP.ara_tb_verilator.dut.i_ara_soc.i_dram", 32*NrLanes*NrClusters, &l2_mem); + "ram", "TOP.ara_tb_verilator.dut.i_ara_soc.i_dram", 32*Nr_Lanes*Nr_Clusters, &l2_mem); simctrl.RegisterExtension(&memutil); simctrl.SetInitialResetDelay(5); From 0486a0cdff625c86e4cfa91f5a131991eb711887 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 01:47:37 +0100 Subject: [PATCH 25/37] [verilator] fix parameter name unmatch --- hardware/tb/verilator/ara_tb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/tb/verilator/ara_tb.cpp b/hardware/tb/verilator/ara_tb.cpp index ac5954a..9eab8a7 100644 --- a/hardware/tb/verilator/ara_tb.cpp +++ b/hardware/tb/verilator/ara_tb.cpp @@ -26,7 +26,7 @@ int main(int argc, char **argv) { // Initialize the DRAM MemAreaLoc l2_mem = {.base=0x80000000, .size=0x00100000}; memutil.RegisterMemoryArea( - "ram", "TOP.ara_tb_verilator.dut.i_ara_soc.i_dram", 32*Nr_Lanes*Nr_Clusters, &l2_mem); + "ram", "TOP.ara_tb_verilator.dut.i_ara_soc.i_dram", 32*NR_LANES*NR_CLUSTERS, &l2_mem); simctrl.RegisterExtension(&memutil); simctrl.SetInitialResetDelay(5); From 2837f772d9ac2b4d315fc6f0e81b15911f37d9c3 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 09:30:15 +0100 Subject: [PATCH 26/37] [config] temporarily limit NrLanes to 16 in total --- config/16_lanes.mk | 2 +- config/8_lanes.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/16_lanes.mk b/config/16_lanes.mk index 3c520d0..86a776e 100644 --- a/config/16_lanes.mk +++ b/config/16_lanes.mk @@ -20,7 +20,7 @@ # Number of vector lanes nr_lanes ?= 16 # Number of clusters -nr_clusters ?= 4 +nr_clusters ?= 1 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/8_lanes.mk b/config/8_lanes.mk index b07a3b9..b6b9f97 100644 --- a/config/8_lanes.mk +++ b/config/8_lanes.mk @@ -20,7 +20,7 @@ # Number of vector lanes nr_lanes ?= 8 # Number of clusters -nr_clusters ?= 4 +nr_clusters ?= 2 # Length of each vector register (in bits) # Constraints: VLEN > 128 From 8944f39e3497ca45cedd7683b4c468ee5b89c4c6 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 10:42:34 +0100 Subject: [PATCH 27/37] [apps] Add riscv-test header file and makefile --- apps/common/riscv_test.h | 98 ++++++++++++++++++++++++++++++++++++++ apps/common/riscv_tests.mk | 33 +++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 apps/common/riscv_test.h create mode 100644 apps/common/riscv_tests.mk diff --git a/apps/common/riscv_test.h b/apps/common/riscv_test.h new file mode 100644 index 0000000..59ec2e2 --- /dev/null +++ b/apps/common/riscv_test.h @@ -0,0 +1,98 @@ +#ifndef _ENV_ARIANE_H +#define _ENV_ARIANE_H + +#include "encoding.h" + +//----------------------------------------------------------------------- +// Begin Macro +//----------------------------------------------------------------------- + +#define RVTEST_RV64U + +#define RVTEST_RV64UF \ + .globl rvtest_init; \ + rvtest_init: \ + RVTEST_FP_ENABLE; \ + ret + +#define RVTEST_RV64UV \ + .globl rvtest_init; \ + rvtest_init: \ + RVTEST_VECTOR_ENABLE; \ + ret + +#define RVTEST_RV64M \ + .globl rvtest_init; \ + rvtest_init: \ + RVTEST_ENABLE_MACHINE; \ + ret + +#define RVTEST_RV64S \ + .globl rvtest_init; \ + rvtest_init: \ + RVTEST_ENABLE_SUPERVISOR; \ + ret + +#define RVTEST_ENABLE_SUPERVISOR \ + li a0, MSTATUS_MPP &(MSTATUS_MPP >> 1); \ + csrs mstatus, a0; \ + li a0, SIP_SSIP | SIP_STIP; \ + csrs mideleg, a0; + +#define RVTEST_ENABLE_MACHINE \ + li a0, MSTATUS_MPP; \ + csrs mstatus, a0; + +#define RVTEST_FP_ENABLE \ + li a0, MSTATUS_FS &(MSTATUS_FS >> 1); \ + csrs mstatus, a0; \ + csrwi fcsr, 0 + +#define RVTEST_VECTOR_ENABLE \ + li a0, (MSTATUS_VS & (MSTATUS_VS >> 1)) | (MSTATUS_FS & (MSTATUS_FS >> 1)); \ + csrs mstatus, a0; \ + csrwi fcsr, 0; \ + csrwi vcsr, 0; + +#define RISCV_MULTICORE_DISABLE \ + csrr a0, mhartid; \ + 1 : bnez a0, 1b + +#define RVTEST_CODE_BEGIN \ + .globl main; \ + .align 2; \ + main: + +//----------------------------------------------------------------------- +// End Macro +//----------------------------------------------------------------------- + +#define RVTEST_CODE_END unimp + +//----------------------------------------------------------------------- +// Pass/Fail Macro +//----------------------------------------------------------------------- + +#define RVTEST_PASS \ + li a0, 0; \ + j _eoc + +#define TESTNUM gp +#define RVTEST_FAIL \ + fence; \ + 1 : beqz TESTNUM, 1b; \ + sll TESTNUM, TESTNUM, 1; \ + or TESTNUM, TESTNUM, 1; \ + addi a0, TESTNUM, 0; \ + j _fail + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#define EXTRA_DATA + +#define RVTEST_DATA_BEGIN +#define RVTEST_DATA_END + +#endif diff --git a/apps/common/riscv_tests.mk b/apps/common/riscv_tests.mk new file mode 100644 index 0000000..adf0ada --- /dev/null +++ b/apps/common/riscv_tests.mk @@ -0,0 +1,33 @@ +#======================================================================= +# Makefrag for instructions employed in CVA6 +#----------------------------------------------------------------------- + +include $(TESTS_DIR)/rv64ui/Makefrag +include $(TESTS_DIR)/rv64uc/Makefrag +include $(TESTS_DIR)/rv64um/Makefrag +include $(TESTS_DIR)/rv64ua/Makefrag +include $(TESTS_DIR)/rv64uf/Makefrag +include $(TESTS_DIR)/rv64ud/Makefrag +include $(TESTS_DIR)/rv64uv/Makefrag +include $(TESTS_DIR)/rv64si/Makefrag + +rv64ui_ara_tests := $(addprefix rv64ui-ara-, $(rv64ui_sc_tests)) +rv64um_ara_tests := $(addprefix rv64um-ara-, $(rv64um_sc_tests)) +rv64ua_ara_tests := $(addprefix rv64ua-ara-, $(rv64ua_sc_tests)) +rv64uc_ara_tests := $(addprefix rv64uc-ara-, $(rv64uc_sc_tests)) +rv64uf_ara_tests := $(addprefix rv64uf-ara-, $(rv64uf_sc_tests)) +rv64ud_ara_tests := $(addprefix rv64ud-ara-, $(rv64ud_sc_tests)) +rv64uv_ara_tests := $(addprefix rv64uv-ara-, $(rv64uv_sc_tests)) +rv64si_ara_tests := $(addprefix rv64si-ara-, $(rv64si_sc_tests)) + +cva6_tests := $(rv64ui_ara_tests) \ + $(rv64um_ara_tests) \ + $(rv64uc_ara_tests) \ + $(rv64uf_ara_tests) \ + $(rv64ud_ara_tests) \ + $(rv64si_ara_tests) + +# Atomics are messy, since there is currently no memory region capable of handling them +# $(rv64ua_ara_tests) \ + +ara_tests := $(rv64uv_ara_tests) From 3b2ad21a32e6613ef08d4c53f10efa9f3c05150c Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 11:12:22 +0100 Subject: [PATCH 28/37] [riscv-tests] Include riscv-test makefile in apps makefile --- apps/Makefile | 1 + hardware/src/ara_dispatcher.sv | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/Makefile b/apps/Makefile index 7413a13..b1751ad 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -23,6 +23,7 @@ TESTS_DIR := $(ROOT_DIR)/riscv-tests/isa # This will overwrite the ROOT_DIR variable from the included makefile include $(COMMON_DIR)/runtime.mk +include $(COMMON_DIR)/riscv_tests.mk include $(COMMON_DIR)/default_args.mk # Number of clusters diff --git a/hardware/src/ara_dispatcher.sv b/hardware/src/ara_dispatcher.sv index 992c9f3..8b3cc90 100644 --- a/hardware/src/ara_dispatcher.sv +++ b/hardware/src/ara_dispatcher.sv @@ -246,8 +246,10 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( elen_t vfmvfs_result; vlen_t total_cluster_pieces; + id_cluster_t total_cluster_pieces_id; // assign total_cluster_pieces = vlen_t'(acc_req_i.rs1) >> $clog2(VLENB >> vtype_d.vsew); assign total_cluster_pieces = vlen_t'(acc_req_i.rs1) >> $clog2(NrLanes); + assign total_cluster_pieces_id = (NrClusters > 1) ? total_cluster_pieces[$clog2(NrClusters) - 1 : 0] : 0; vlen_t check_total_cluster_pieces; assign check_total_cluster_pieces = ((total_cluster_pieces >> $clog2(NrClusters)) + 1) * NrLanes; @@ -532,9 +534,9 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // Return the new vl acc_resp_o.result = vl_d << num_clusters_i; end else begin - if (cluster_id_i < total_cluster_pieces[$clog2(NrClusters) - 1 : 0]) begin + if (cluster_id_i < total_cluster_pieces_id) begin vl_d = ((total_cluster_pieces >> $clog2(NrClusters)) + 1) * NrLanes; - end else if (cluster_id_i == total_cluster_pieces[$clog2(NrClusters) - 1 : 0]) begin + end else if (cluster_id_i == total_cluster_pieces_id) begin vl_d = (total_cluster_pieces >> $clog2(NrClusters)) * NrLanes + acc_req_i.rs1 % NrLanes; end else begin From 76fe0049ec1bed4ac1fcfeadbd3f76a845862fdd Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 17:22:34 +0100 Subject: [PATCH 29/37] [HW] adapt suhffle stage to support single cluster --- .github/workflows/ci.yml | 2 +- hardware/src/ara_dispatcher.sv | 11 +- hardware/src/vlsu/shuffle_stage.sv | 866 +++++++++++++++-------------- 3 files changed, 444 insertions(+), 435 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18c94b7..81258d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -343,7 +343,7 @@ jobs: strategy: max-parallel: 1 matrix: - app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, fconv3d, jacobi2d, dropout, fft, dwt, exp, softmax, dotproduct, fdotproduct, pathfinder, roi_align, lavamd] + app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, jacobi2d, exp, softmax, dotproduct, fdotproduct, fconv3d, pathfinder, roi_align, lavamd, dwt, dropout, fft, gemv] ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] needs: ["compile-ara", "compile-apps"] steps: diff --git a/hardware/src/ara_dispatcher.sv b/hardware/src/ara_dispatcher.sv index 8b3cc90..e25a7ca 100644 --- a/hardware/src/ara_dispatcher.sv +++ b/hardware/src/ara_dispatcher.sv @@ -223,7 +223,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( // NP2 Slide support logic is_stride_np2; // logic [idx_width(idx_width(VLENB << 3)):0] sldu_popc; - logic [$clog2(NrLanes)-1:0] sldu_popc; + logic [$clog2($clog2(NrLanes)):0] sldu_popc; // Is the stride power of two? popcount #( @@ -233,7 +233,7 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( ) i_np2_stride ( //.data_i (ara_req_d.stride[idx_width(VLENB << 3)-1:0]), .data_i (ara_req_d.stride[$clog2(NrLanes)-1:0] ), - .popcount_o(sldu_popc ) + .popcount_o (sldu_popc ) ); assign is_stride_np2 = sldu_popc > 1; @@ -249,7 +249,12 @@ module ara_dispatcher import ara_pkg::*; import rvv_pkg::*; #( id_cluster_t total_cluster_pieces_id; // assign total_cluster_pieces = vlen_t'(acc_req_i.rs1) >> $clog2(VLENB >> vtype_d.vsew); assign total_cluster_pieces = vlen_t'(acc_req_i.rs1) >> $clog2(NrLanes); - assign total_cluster_pieces_id = (NrClusters > 1) ? total_cluster_pieces[$clog2(NrClusters) - 1 : 0] : 0; + + if (NrClusters > 1) begin + assign total_cluster_pieces_id = total_cluster_pieces[$clog2(NrClusters) - 1 : 0]; + end else begin + assign total_cluster_pieces_id = 0; + end vlen_t check_total_cluster_pieces; assign check_total_cluster_pieces = ((total_cluster_pieces >> $clog2(NrClusters)) + 1) * NrLanes; diff --git a/hardware/src/vlsu/shuffle_stage.sv b/hardware/src/vlsu/shuffle_stage.sv index abe0056..a232215 100644 --- a/hardware/src/vlsu/shuffle_stage.sv +++ b/hardware/src/vlsu/shuffle_stage.sv @@ -38,491 +38,495 @@ module shuffle_stage import ara_pkg::*; import rvv_pkg::*; #( output axi_resp_t [NrClusters-1:0] axi_resp_o ); -localparam int unsigned MAXVL_CL = VLEN * NrClusters; -typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; - -typedef struct packed { - axi_addr_t addr; - vlen_t [NrClusters-1:0] len; - elen_t stride; - vew_e vew; - logic is_load; - logic is_burst; - logic [NumStages-1:0] shuffle_en; - logic buffer_en; - logic valid; -} req_track_t; - -localparam int unsigned NumTrackers=8; -typedef logic [$clog2(NumTrackers)-1:0] pnt_t; -typedef logic [$clog2(NumTrackers):0] cnt_t; - -req_track_t [NumTrackers-1:0] rd_tracker_d, rd_tracker_q; -pnt_t rd_accept_pnt_d, rd_accept_pnt_q; -pnt_t [NumStages-1:0] rd_issue_pnt_d, rd_issue_pnt_q; -cnt_t rd_cnt_d, rd_cnt_q; - -req_track_t [NumTrackers-1:0] wr_tracker_d, wr_tracker_q; -pnt_t wr_accept_pnt_d, wr_accept_pnt_q; -pnt_t [NumStages-1:0] wr_issue_pnt_d, wr_issue_pnt_q; -cnt_t wr_cnt_d, wr_cnt_q; - -typedef axi_r_t [NrClusters-1:0] stage_r_t; -stage_r_t [NumStages-1:0] r_data_in, r_data_out; - -typedef axi_w_t [NrClusters-1:0] stage_w_t; -stage_w_t [NumStages-1:0] w_data_in, w_data_out; - -logic [NumStages-1:0] r_valid, r_ready, w_valid, w_ready; -logic [NumStages-1:0] r_shuffle_en, w_shuffle_en; - -logic [NrClusters-1:0] r_ready_i, r_valid_o; -logic [NrClusters-1:0] w_valid_i, w_ready_o; - -logic rd_full, wr_full; -assign rd_full = (rd_cnt_q >= NumTrackers); -assign wr_full = (wr_cnt_q >= NumTrackers); - -// To handle cases where vlsu of each cluster is ready to -// receive read resp or not. -stream_fork #( - .N_OUP(NrClusters) -) i_cluster_stream_fork ( - .clk_i (clk_i), - .rst_ni (rst_ni), - .valid_o(r_valid_o ), - .valid_i(r_valid[NumStages-1] ), - .ready_i(r_ready_i ), - .ready_o(r_ready[NumStages-1] ) -); - -// To handle cases where write data does not come simultaneously -// from all the clusters -stream_join #( - .N_INP(NrClusters) -) i_cluster_stream_join ( - .inp_ready_o(w_ready_o), - .inp_valid_i(w_valid_i), - .oup_ready_i(w_ready[0]), - .oup_valid_o(w_valid[0]) -); +if (NrClusters == 1) begin + assign axi_req_o = axi_req_i; + assign axi_resp_o = axi_resp_i; +end else begin + localparam int unsigned MAXVL_CL = VLEN * NrClusters; + typedef logic [$clog2(MAXVL_CL+1)-1:0] vlen_cl_t; + + typedef struct packed { + axi_addr_t addr; + vlen_t [NrClusters-1:0] len; + elen_t stride; + vew_e vew; + logic is_load; + logic is_burst; + logic [NumStages-1:0] shuffle_en; + logic buffer_en; + logic valid; + } req_track_t; + + localparam int unsigned NumTrackers=8; + typedef logic [$clog2(NumTrackers)-1:0] pnt_t; + typedef logic [$clog2(NumTrackers):0] cnt_t; + + req_track_t [NumTrackers-1:0] rd_tracker_d, rd_tracker_q; + pnt_t rd_accept_pnt_d, rd_accept_pnt_q; + pnt_t [NumStages-1:0] rd_issue_pnt_d, rd_issue_pnt_q; + cnt_t rd_cnt_d, rd_cnt_q; + + req_track_t [NumTrackers-1:0] wr_tracker_d, wr_tracker_q; + pnt_t wr_accept_pnt_d, wr_accept_pnt_q; + pnt_t [NumStages-1:0] wr_issue_pnt_d, wr_issue_pnt_q; + cnt_t wr_cnt_d, wr_cnt_q; + + typedef axi_r_t [NrClusters-1:0] stage_r_t; + stage_r_t [NumStages-1:0] r_data_in, r_data_out; + + typedef axi_w_t [NrClusters-1:0] stage_w_t; + stage_w_t [NumStages-1:0] w_data_in, w_data_out; + + logic [NumStages-1:0] r_valid, r_ready, w_valid, w_ready; + logic [NumStages-1:0] r_shuffle_en, w_shuffle_en; + + logic [NrClusters-1:0] r_ready_i, r_valid_o; + logic [NrClusters-1:0] w_valid_i, w_ready_o; + + logic rd_full, wr_full; + assign rd_full = (rd_cnt_q >= NumTrackers); + assign wr_full = (wr_cnt_q >= NumTrackers); + + // To handle cases where vlsu of each cluster is ready to + // receive read resp or not. + stream_fork #( + .N_OUP(NrClusters) + ) i_cluster_stream_fork ( + .clk_i (clk_i), + .rst_ni (rst_ni), + .valid_o(r_valid_o ), + .valid_i(r_valid[NumStages-1] ), + .ready_i(r_ready_i ), + .ready_o(r_ready[NumStages-1] ) + ); -for (genvar s=0; s= 1) begin - stream_register #( - .T (stage_r_t) - ) i_shuffle_reg_r ( - .clk_i ( clk_i ), - .rst_ni ( rst_ni ), - .clr_i ( 1'b0 ), - .testmode_i ( 1'b0 ), - // Input - .valid_i ( r_valid [s-1] ), - .ready_o ( r_ready [s-1] ), - .data_i ( r_data_out [s-1] ), - // Output - .valid_o ( r_valid [s] ), - .ready_i ( r_ready [s] ), - .data_o ( r_data_in [s] ) + for (genvar s=0; s= 1) begin + stream_register #( + .T (stage_r_t) + ) i_shuffle_reg_r ( + .clk_i ( clk_i ), + .rst_ni ( rst_ni ), + .clr_i ( 1'b0 ), + .testmode_i ( 1'b0 ), + // Input + .valid_i ( r_valid [s-1] ), + .ready_o ( r_ready [s-1] ), + .data_i ( r_data_out [s-1] ), + // Output + .valid_o ( r_valid [s] ), + .ready_i ( r_ready [s] ), + .data_o ( r_data_in [s] ) + ); + end - if (s >= 1) begin - stream_register #( - .T (stage_w_t) - ) i_shuffle_reg_w ( - .clk_i ( clk_i ), - .rst_ni ( rst_ni ), - .clr_i ( 1'b0 ), - .testmode_i ( 1'b0 ), - // Input - .valid_i ( w_valid [s-1] ), - .ready_o ( w_ready [s-1] ), - .data_i ( w_data_out [s-1] ), - // Output - .valid_o ( w_valid [s] ), - .ready_i ( w_ready [s] ), - .data_o ( w_data_in [s] ) + // Shuffling write data + shuffle #( + .NrLanes (NrLanes), + .NrClusters (NrClusters ), + .ClusterAxiDataWidth (ClusterAxiDataWidth ), + .T (stage_w_t ), + .scale (s ), + .isRead (0 ) + ) i_shuffle_wr ( + .data_i ( w_data_in [s] ), + .data_o ( w_data_out [s] ), + .enable_i ( w_shuffle_en [s] ) ); - end -end - -// Set status of shuffle stage to the current pointers -for (genvar s=0; s= 1) begin + stream_register #( + .T (stage_w_t) + ) i_shuffle_reg_w ( + .clk_i ( clk_i ), + .rst_ni ( rst_ni ), + .clr_i ( 1'b0 ), + .testmode_i ( 1'b0 ), + // Input + .valid_i ( w_valid [s-1] ), + .ready_o ( w_ready [s-1] ), + .data_i ( w_data_out [s-1] ), + // Output + .valid_o ( w_valid [s] ), + .ready_i ( w_ready [s] ), + .data_o ( w_data_in [s] ) + ); + end end -end -always_ff @(posedge clk_i or negedge rst_ni) begin - if(~rst_ni) begin - rd_tracker_q <= '0; - rd_accept_pnt_q <= '0; - rd_issue_pnt_q <= '0; - rd_cnt_q <= '0; - - wr_tracker_q <= '0; - wr_accept_pnt_q <= '0; - wr_issue_pnt_q <= '0; - wr_cnt_q <= '0; - end else begin - rd_tracker_q <= rd_tracker_d; - rd_accept_pnt_q <= rd_accept_pnt_d; - rd_issue_pnt_q <= rd_issue_pnt_d; - rd_cnt_q <= rd_cnt_d; - - wr_tracker_q <= wr_tracker_d; - wr_accept_pnt_q <= wr_accept_pnt_d; - wr_issue_pnt_q <= wr_issue_pnt_d; - wr_cnt_q <= wr_cnt_d; + // Set status of shuffle stage to the current pointers + for (genvar s=0; s= vew_ar_i) ? 1'b1 : 1'b0; + // Read Responses + typedef axi_r_t [NrClusters-1:0] axi_resp_ext_t; + axi_resp_ext_t [NumBuffers-1:0] buf_d, buf_q; + axi_resp_t [NrClusters-1:0] axi_resp_buf_out; + + logic rdbuf_pnt_q, rdbuf_pnt_d; + logic [NumBuffers-1:0] shift_d, shift_q; // For each buffer a single bit is needed. (For BW 32N only) + logic [NumBuffers-1:0] buf_valid_d, buf_valid_q; + logic r_ready_buf, r_ready_buf_q; + + logic rd_buffer_en, rd_buffer_en_last_stage; + assign rd_buffer_en = rd_tracker_q[rd_issue_pnt_q[0]].buffer_en; + assign rd_buffer_en_last_stage = rd_tracker_q[rd_issue_pnt_q[NumStages-1]].buffer_en; + + // Write packets + logic [NrClusters-1:0] [ClusterAxiDataWidth*2-1:0] wrbuf_d, wrbuf_q; + logic [NrClusters-1:0] [(ClusterAxiDataWidth*2/8)-1:0] wrbuf_be_d, wrbuf_be_q; + axi_req_t [NrClusters-1:0] axi_req_buf_out; + + logic [$clog2(NrClusters)-1:0] wrbuf_pnt_q, wrbuf_pnt_d; + logic [NrClusters-1:0] wr_shift_d, wr_shift_q; + logic [NrClusters-1:0] wrbuf_valid, wrbuf_valid_q; + logic [NrClusters-1:0] wrbuf_full, wrbuf_full_q; + logic wr_out_ready, wr_out_valid; + + logic wr_buffer_en, wr_buffer_en_last_stage; + assign wr_buffer_en = wr_tracker_q[wr_issue_pnt_q[0]].buffer_en; + assign wr_buffer_en_last_stage = wr_tracker_q[wr_issue_pnt_q[NumStages-1]].buffer_en; + + + always_ff @(posedge clk_i or negedge rst_ni) begin + if(~rst_ni) begin + // R + buf_q <= '0; + buf_valid_q <= '0; + rdbuf_pnt_q <= '0; + shift_q <= '0; + r_ready_buf_q <= 1'b1; + // W + wrbuf_q <= '0; + wrbuf_pnt_q <= '0; + wr_shift_q <= '0; + wrbuf_valid_q <= '0; + wrbuf_full_q <= '0; + wrbuf_be_q <= '0; + end else begin + // R + buf_q <= buf_d; + buf_valid_q <= buf_valid_d; + rdbuf_pnt_q <= rdbuf_pnt_d; + shift_q <= shift_d; + r_ready_buf_q <= r_ready_buf; + // W + wrbuf_q <= wrbuf_d; + wrbuf_pnt_q <= wrbuf_pnt_d; + wr_shift_q <= wr_shift_d; + wrbuf_valid_q <= wrbuf_valid; + wrbuf_full_q <= wrbuf_full; + wrbuf_be_q <= wrbuf_be_d; end - rd_tracker_d[rd_accept_pnt_q].buffer_en = NumStages < vew_ar_i ? 1'b1 : 1'b0; end - if (axi_req_i[0].aw_valid & axi_resp_o[0].aw_ready) begin - wr_tracker_d[wr_accept_pnt_q].vew = vew_aw_i; //vew_aw_i; - for (int c=0; c= vew_aw_i) ? 1'b1 : 1'b0; + always_ff @(posedge clk_i or negedge rst_ni) begin + if(~rst_ni) begin + rd_tracker_q <= '0; + rd_accept_pnt_q <= '0; + rd_issue_pnt_q <= '0; + rd_cnt_q <= '0; + + wr_tracker_q <= '0; + wr_accept_pnt_q <= '0; + wr_issue_pnt_q <= '0; + wr_cnt_q <= '0; + end else begin + rd_tracker_q <= rd_tracker_d; + rd_accept_pnt_q <= rd_accept_pnt_d; + rd_issue_pnt_q <= rd_issue_pnt_d; + rd_cnt_q <= rd_cnt_d; + + wr_tracker_q <= wr_tracker_d; + wr_accept_pnt_q <= wr_accept_pnt_d; + wr_issue_pnt_q <= wr_issue_pnt_d; + wr_cnt_q <= wr_cnt_d; end - wr_tracker_d[wr_accept_pnt_q].buffer_en = NumStages < vew_aw_i ? 1'b1 : 1'b0; end - // Update counters for shuffle stage - // Update issue pointer of each stage - // Once last packet is received by each stage, point to the next tracker. - for (int s=0; s < NumStages; s++) begin - - // Reset shuffle config for the read shuffle stages - // If the last stage sends the last packet, we need to go to the vew of the next request - if (r_data_out[s][0].last & r_valid[s] & r_ready[s]) begin - rd_issue_pnt_d[s] = (rd_issue_pnt_q[s] == NumTrackers-1) ? '0 : rd_issue_pnt_q[s] + 1; - // In the last stage, reset the shift enable for the tracker instance - if (s==NumStages-1) begin - rd_tracker_d[rd_issue_pnt_q[s]].shuffle_en = '0; - rd_cnt_d -= 1'b1; + always_comb begin + + rd_tracker_d = rd_tracker_q; + rd_accept_pnt_d = rd_accept_pnt_q; + rd_issue_pnt_d = rd_issue_pnt_q; + rd_cnt_d = rd_cnt_q; + + wr_tracker_d = wr_tracker_q; + wr_accept_pnt_d = wr_accept_pnt_q; + wr_issue_pnt_d = wr_issue_pnt_q; + wr_cnt_d = wr_cnt_q; + + axi_resp_buf_out = '0; + axi_req_buf_out = '0; + + ////////////// + // Requests // + ////////////// + + // If a request arrives, add to tracker. + if (axi_req_i[0].ar_valid & axi_resp_o[0].ar_ready) begin + rd_tracker_d[rd_accept_pnt_q].vew = vew_ar_i; //vew_ar_i; + for (int c=0; c= vew_ar_i) ? 1'b1 : 1'b0; end + rd_tracker_d[rd_accept_pnt_q].buffer_en = NumStages < vew_ar_i ? 1'b1 : 1'b0; end - - // Reset shuffle config for the write shuffle stages - if (w_data_out[s][0].last & w_valid[s] & w_ready[s]) begin - wr_issue_pnt_d[s] = (wr_issue_pnt_q[s] == NumTrackers-1) ? '0 : wr_issue_pnt_q[s] + 1; - // In the last stage, reset the shift enable for the tracker instance - if (s==NumStages-1) begin - wr_tracker_d[wr_issue_pnt_q[s]].shuffle_en = '0; - wr_cnt_d -= 1'b1; + + if (axi_req_i[0].aw_valid & axi_resp_o[0].aw_ready) begin + wr_tracker_d[wr_accept_pnt_q].vew = vew_aw_i; //vew_aw_i; + for (int c=0; c= vew_aw_i) ? 1'b1 : 1'b0; end + wr_tracker_d[wr_accept_pnt_q].buffer_en = NumStages < vew_aw_i ? 1'b1 : 1'b0; end - end - /////////////// - // Buffering // - /////////////// - - // Handling buffering of read responses - - // Handling cases where input data maps only to a single cluster e.g. ClusterAxiDataWidth=32N and EW=64 - // In this case, need to buffer the current data to be used in the following cycles. - // NOTE : This buffering logic implemented only works for the default BW config. - // ClusterAxiDataWidth = 32N and AxiDataWidth=32NC - - buf_d = buf_q; - buf_valid_d = buf_valid_q; - rdbuf_pnt_d = rdbuf_pnt_q; - shift_d = shift_q; - r_ready_buf = r_ready_buf_q; - - if (rd_buffer_en) begin - // If have a valid handshake on response add to the buffer - if (axi_resp_i[0].r_valid && r_ready_buf_q) begin - for (int c=0; c Date: Tue, 4 Nov 2025 18:23:36 +0100 Subject: [PATCH 30/37] [makefiles] update makefiles for compilation --- apps/Makefile | 32 ++++++++++++------- apps/common/runtime.mk | 51 +++++++++++++++++++++++------- config/8_lanes.mk | 2 +- hardware/Makefile | 4 ++- hardware/src/vlsu/shuffle_stage.sv | 2 +- 5 files changed, 64 insertions(+), 27 deletions(-) diff --git a/apps/Makefile b/apps/Makefile index b1751ad..b9bf0e3 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -30,8 +30,9 @@ include $(COMMON_DIR)/default_args.mk nr_clusters ?= 2 APPS := $(patsubst $(APPS_DIR)/%/main.c,%,$(shell find $(APPS_DIR) -name "main.c")) +APPS += $(patsubst $(APPS_DIR)/%/main.cpp,%,$(shell find $(APPS_DIR) -name "main.cpp")) # Don't automatically compile the benchmark app, which is only a wrapper around the other apps -BINARIES := $(filter-out bin/benchmarks, $(addprefix bin/,$(APPS))) +BINARIES := $(filter-out bin/benchmarks bin/rivec-bmarks% bin/_%, $(addprefix bin/,$(APPS))) CVA6_EXTENSIONS := rv64ui rv64uc rv64um rv64uf rv64ud rv64si # Atomics are messy, since there is currently no memory region capable of handling them @@ -40,6 +41,13 @@ CVA6_BINARIES := $(addprefix bin/, $(cva6_tests)) ARA_EXTENSIONS := rv64uv ARA_BINARIES := $(addprefix bin/, $(ara_tests)) +# Suffix for binaries +ifeq ($(LINUX),1) +BIN_SUFFIX := -linux +else +BIN_SUFFIX := +endif + # FFT requires special treatment because of its header files ifeq ($(ENV_DEFINES),) bin/fft: ENV_DEFINES += -DFFT_SAMPLES=$(subst ",,$(firstword $(def_args_fft))) @@ -93,17 +101,17 @@ endef $(foreach app,$(APPS),$(eval $(call app_compile_template_ideal,$(app)))) define app_compile_template_spike -bin/$1.spike: $1/data.S.o.spike $(addsuffix .o.spike, $(shell find $(1) -name "*.c" -o -name "*.S")) $(RUNTIME_SPIKE) $(COMMON_SPIKE) patch-spike-crt0 +bin/$1.spike: $1/data.S.o.spike $(addsuffix .o.spike, $(shell find $(1) -name "*.c" -o -name "*.cpp" -o -name "*.S")) $(RUNTIME_SPIKE) $(COMMON_SPIKE) patch-spike-crt0 mkdir -p bin/ - $$(RISCV_CC) -Iinclude $$(RISCV_CCFLAGS_SPIKE) -o $$@ $$(addsuffix .o.spike, $$(shell find $(1) -name "*.c" -o -name "*.S")) $(RUNTIME_SPIKE) $$(RISCV_LDFLAGS_SPIKE) -DSPIKE + $$(RISCV_CC) -Iinclude $$(RISCV_CCFLAGS_SPIKE) -o $$@ $$(addsuffix .o.spike, $$(shell find $(1) -name "*.c" -o -name "*.cpp" -o -name "*.S")) $(RUNTIME_SPIKE) $$(RISCV_LDFLAGS_SPIKE) -DSPIKE $$(RISCV_OBJDUMP) $$(RISCV_OBJDUMP_FLAGS) -D $$@ > $$@.dump endef $(foreach app,$(APPS),$(eval $(call app_compile_template_spike,$(app)))) define app_compile_template -bin/$1: $1/data.S.o $(addsuffix .o, $(shell find $(1) -name "*.c" -o -name "*.S")) $(RUNTIME_LLVM) linker_script +bin/$1$(BIN_SUFFIX): $1/data.S.o $(addsuffix .o, $(shell find -L $(1) -name "*.c" -o -name "*.cpp" -o -name "*.S")) $(RUNTIME_LLVM) linker_script mkdir -p bin/ - $$(RISCV_CC) -Iinclude $(RISCV_CCFLAGS) -o $$@ $$(addsuffix .o, $$(shell find $(1) -name "*.c" -o -name "*.S")) $(RUNTIME_LLVM) $$(RISCV_LDFLAGS) -T$$(CURDIR)/common/link.ld + $$(RISCV_CC) -Iinclude $(RISCV_CCFLAGS) -o $$@ $$(addsuffix .o, $$(shell find -L $(1) -name "*.c" -o -name "*.cpp" -o -name "*.S")) $(RUNTIME_LLVM) $$(RISCV_LDFLAGS) $$(RISCV_OBJDUMP) $$(RISCV_OBJDUMP_FLAGS) -D $$@ > $$@.dump $$(RISCV_STRIP) $$@ -S --strip-unneeded endef @@ -117,7 +125,7 @@ TESTS_$(1) := $(addprefix bin/, $($(addsuffix _ara_tests, $1))) bin/$(1)-ara-%: $(TESTS_DIR)/$(1)/%.$(2) $(RUNTIME_GCC) linker_script mkdir -p bin/ - $$(RISCV_CC_GCC) -Iinclude -I$$(TESTS_DIR)/macros/scalar -I$$(TESTS_DIR)/macros/vector $$(RISCV_CCFLAGS_GCC) $$(RISCV_LDFLAGS_GCC) -o $$@ $$< $(RUNTIME_GCC) -T$$(CURDIR)/common/link.ld + $$(RISCV_CC_GCC) -Iinclude -I$$(TESTS_DIR)/macros/scalar -I$$(TESTS_DIR)/macros/vector $$(RISCV_CCFLAGS_GCC) $$(RISCV_LDFLAGS_GCC) -o $$@ $$< $(RUNTIME_GCC) $$(RISCV_OBJDUMP) $$(RISCV_OBJDUMP_FLAGS) -D $$@ > $$@.dump $$(RISCV_STRIP) $$@ -S --strip-unneeded endef @@ -127,7 +135,7 @@ TESTS_$(1) := $(addprefix bin/, $($(addsuffix _ara_tests, $1))) bin/$(1)-ara-%: $(TESTS_DIR)/$(1)/%.$(2) $(RUNTIME_LLVM) linker_script mkdir -p bin/ - $$(RISCV_CC) -Iinclude -I$$(TESTS_DIR)/macros/scalar -I$$(TESTS_DIR)/macros/vector $$(RISCV_CCFLAGS) $$(RISCV_LDFLAGS) -o $$@ $$< $(RUNTIME_LLVM) -T$$(CURDIR)/common/link.ld + $$(RISCV_CC) -Iinclude -I$$(TESTS_DIR)/macros/scalar -I$$(TESTS_DIR)/macros/vector $$(RISCV_CCFLAGS) $$(RISCV_LDFLAGS) -o $$@ $$< $(RUNTIME_LLVM) $$(RISCV_OBJDUMP) $$(RISCV_OBJDUMP_FLAGS) -D $$@ > $$@.dump $$(RISCV_STRIP) $$@ -S --strip-unneeded endef @@ -166,11 +174,11 @@ $(foreach app,$(APPS),$(eval $(call run_benchmark_spike,$(app)))) riscv_tests_spike_clean: make -C riscv-tests/isa clean -# Compile standardized riscv tests -.PHONY: riscv_tests_compile -riscv_tests_compile: - cd riscv-tests && \ - make benchmarks && make isa -i +# # Compile standardized riscv tests +# .PHONY: riscv_tests_compile +# riscv_tests_compile: +# cd riscv-tests && \ +# make benchmarks && make isa -i .PHONY: benchmarks_clean benchmarks_clean: diff --git a/apps/common/runtime.mk b/apps/common/runtime.mk index a59dafc..a681a92 100644 --- a/apps/common/runtime.mk +++ b/apps/common/runtime.mk @@ -1,4 +1,4 @@ -# Copyright 2020-2025 ETH Zurich and University of Bologna. +# Copyright 2020 ETH Zurich and University of Bologna. # # SPDX-License-Identifier: Apache-2.0 # @@ -44,7 +44,18 @@ RISCV_ARCH ?= rv$(RISCV_XLEN)gcv RISCV_ABI ?= lp64d RISCV_TARGET ?= riscv$(RISCV_XLEN)-unknown-elf -# Use LLVM +# Use LLVM for bare-metal RVV and GCC for Linux RVV +ifeq ($(LINUX),1) +RISCV_PREFIX ?= $(ARA_DIR)/cheshire/sw/cva6-sdk/buildroot/output/host/bin/riscv64-buildroot-linux-gnu- +RISCV_CC ?= $(RISCV_PREFIX)gcc +RISCV_CXX ?= $(RISCV_PREFIX)g++ +RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump +RISCV_OBJCOPY ?= $(RISCV_PREFIX)objcopy +RISCV_AS ?= $(RISCV_PREFIX)as +RISCV_AR ?= $(RISCV_PREFIX)ar +RISCV_LD ?= $(RISCV_PREFIX)ld.lld +RISCV_STRIP ?= $(RISCV_PREFIX)strip +else RISCV_PREFIX ?= $(LLVM_INSTALL_DIR)/bin/ RISCV_CC ?= $(RISCV_PREFIX)clang RISCV_CXX ?= $(RISCV_PREFIX)clang++ @@ -54,6 +65,7 @@ RISCV_AS ?= $(RISCV_PREFIX)llvm-as RISCV_AR ?= $(RISCV_PREFIX)llvm-ar RISCV_LD ?= $(RISCV_PREFIX)ld.lld RISCV_STRIP ?= $(RISCV_PREFIX)llvm-strip +endif # Use gcc to compile scalar riscv-tests RISCV_CC_GCC ?= $(GCC_INSTALL_DIR)/bin/$(RISCV_TARGET)-gcc @@ -75,40 +87,55 @@ PYTHON ?= python3 # Defines ENV_DEFINES ?= +ifeq ($(LINUX),1) +ENV_DEFINES += -DARA_LINUX=1 +endif ifeq ($(vcd_dump),1) ENV_DEFINES += -DVCD_DUMP=1 endif -MAKE_DEFINES = -DNR_LANES=$(nr_lanes) -DVLEN=$(vlen) -DNR_CLUSTERS=$(nr_clusters) +MAKE_DEFINES = -DNR_LANES=$(nr_lanes) -DVLEN=$(vlen) DEFINES += $(ENV_DEFINES) $(MAKE_DEFINES) # Common flags RISCV_WARNINGS += -Wunused-variable -Wall -Wextra -Wno-unused-command-line-argument # -Werror # LLVM Flags -LLVM_FLAGS ?= -march=rv64gcv_zfh_zvfh -menable-experimental-extensions -mabi=$(RISCV_ABI) -mno-relax -fuse-ld=lld +LLVM_FLAGS ?= -march=rv64gcv_zfh_zvfh -mabi=$(RISCV_ABI) -mno-relax -fuse-ld=lld LLVM_V_FLAGS ?= -fno-vectorize -mllvm -scalable-vectorization=off -mllvm -riscv-v-vector-bits-min=0 -mno-implicit-float -RISCV_FLAGS ?= $(LLVM_FLAGS) $(LLVM_V_FLAGS) -mcmodel=medany -I$(CURDIR)/common -std=gnu99 -O3 -ffast-math -fno-common -fno-builtin-printf $(DEFINES) $(RISCV_WARNINGS) -RISCV_CCFLAGS ?= $(RISCV_FLAGS) -ffunction-sections -fdata-sections -RISCV_CCFLAGS_SPIKE ?= $(RISCV_FLAGS) $(SPIKE_CCFLAGS) -ffunction-sections -fdata-sections +RISCV_FLAGS ?= $(LLVM_FLAGS) $(LLVM_V_FLAGS) -mcmodel=medany -I$(CURDIR)/common -O3 -ffast-math -fno-common -fno-builtin-printf $(DEFINES) $(RISCV_WARNINGS) +ifeq ($(LINUX),1) +RISCV_CCFLAGS ?= -march=rv64gcv -mabi=$(RISCV_ABI) -I$(CURDIR)/common -O2 $(DEFINES) +RISCV_LDFLAGS ?= -lm -lstdc++ +RISCV_CXXFLAGS ?= -march=rv64gcv -mabi=$(RISCV_ABI) -I$(CURDIR)/common -O2 $(DEFINES) +else +RISCV_CCFLAGS ?= $(RISCV_FLAGS) -ffunction-sections -fdata-sections -std=gnu99 +RISCV_LDFLAGS ?= -static -nostartfiles -lm -Wl,--gc-sections -T$(CURDIR)/common/link.ld +endif +RISCV_CCFLAGS_SPIKE ?= $(RISCV_FLAGS) $(SPIKE_CCFLAGS) -ffunction-sections -fdata-sections -std=gnu99 RISCV_CXXFLAGS ?= $(RISCV_FLAGS) -ffunction-sections -fdata-sections -RISCV_LDFLAGS ?= -static -nostartfiles -lm -Wl,--gc-sections -RISCV_LDFLAGS_SPIKE ?= $(RISCV_LDFLAGS) $(SPIKE_LDFLAGS) -Wl,--gc-sections +RISCV_LDFLAGS_SPIKE ?= -static -nostartfiles -lm $(SPIKE_LDFLAGS) -Wl,--gc-sections # GCC Flags -RISCV_FLAGS_GCC ?= -mcmodel=medany -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -I$(CURDIR)/common -static -std=gnu99 -O3 -ffast-math -fno-common -fno-builtin-printf $(DEFINES) $(RISCV_WARNINGS) -RISCV_CCFLAGS_GCC ?= $(RISCV_FLAGS_GCC) +RISCV_FLAGS_GCC ?= -mcmodel=medany -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -I$(CURDIR)/common -static -O3 -ffast-math -fno-common -fno-builtin-printf $(DEFINES) $(RISCV_WARNINGS) +RISCV_CCFLAGS_GCC ?= $(RISCV_FLAGS_GCC) -std=gnu99 RISCV_CXXFLAGS_GCC ?= $(RISCV_FLAGS_GCC) -RISCV_LDFLAGS_GCC ?= -static -nostartfiles -lm -lgcc $(RISCV_FLAGS_GCC) +RISCV_LDFLAGS_GCC ?= -static -nostartfiles -lm -lgcc $(RISCV_FLAGS_GCC) -std=gnu99 -T$(CURDIR)/common/link.ld ifeq ($(COMPILER),gcc) RISCV_OBJDUMP_FLAGS ?= else +ifneq ($(LINUX),1) RISCV_OBJDUMP_FLAGS ?= --mattr=v endif +endif # Compile two different versions of the runtime, since we cannot link code compiled with two different toolchains RUNTIME_GCC ?= common/crt0-gcc.S.o common/printf-gcc.c.o common/string-gcc.c.o common/serial-gcc.c.o common/util-gcc.c.o +ifeq ($(LINUX),1) +RUNTIME_LLVM ?= common/util-llvm.c.o +else RUNTIME_LLVM ?= common/crt0-llvm.S.o common/printf-llvm.c.o common/string-llvm.c.o common/serial-llvm.c.o common/util-llvm.c.o +endif RUNTIME_SPIKE ?= $(spike_env_dir)/benchmarks/common/crt.S.o.spike $(spike_env_dir)/benchmarks/common/syscalls.c.o.spike common/util.c.o.spike .INTERMEDIATE: $(RUNTIME_GCC) $(RUNTIME_LLVM) diff --git a/config/8_lanes.mk b/config/8_lanes.mk index b6b9f97..b07a3b9 100644 --- a/config/8_lanes.mk +++ b/config/8_lanes.mk @@ -20,7 +20,7 @@ # Number of vector lanes nr_lanes ?= 8 # Number of clusters -nr_clusters ?= 2 +nr_clusters ?= 4 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/hardware/Makefile b/hardware/Makefile index 7f78781..aa88935 100644 --- a/hardware/Makefile +++ b/hardware/Makefile @@ -129,6 +129,8 @@ ifneq ($(ring_latency), 0) endif bender_defs += --define USE_EEW1 +bender_defs_veril := $(bender_defs) --define COMMON_CELLS_ASSERTS_OFF + #use_eew1 ?= 0 #ifneq ($(use_eew1), 0) # bender_defs += --define USE_EEW1 @@ -209,7 +211,7 @@ verilate: $(buildpath) bender $(veril_library)/V$(veril_top) $(veril_library)/V$(veril_top): $(config_file) Makefile ../Bender.yml $(shell find src -type f) $(shell find ../config -type f) $(shell find include -type f) $(shell find tb -type f) $(shell find deps -type f) rm -rf $(veril_library); mkdir -p $(veril_library) - $(BENDER) script verilator $(bender_targs_veril) $(bender_defs) > $(veril_library)/bender_script_$(config) + $(BENDER) script verilator $(bender_targs_veril) $(bender_defs_veril) > $(veril_library)/bender_script_$(config) # Verilate the design $(veril_path)/verilator -f $(veril_library)/bender_script_$(config) \ -O3 \ diff --git a/hardware/src/vlsu/shuffle_stage.sv b/hardware/src/vlsu/shuffle_stage.sv index a232215..5b452ce 100644 --- a/hardware/src/vlsu/shuffle_stage.sv +++ b/hardware/src/vlsu/shuffle_stage.sv @@ -38,7 +38,7 @@ module shuffle_stage import ara_pkg::*; import rvv_pkg::*; #( output axi_resp_t [NrClusters-1:0] axi_resp_o ); -if (NrClusters == 1) begin +if (NrClusters == 1) begin assign axi_req_o = axi_req_i; assign axi_resp_o = axi_resp_i; end else begin From 8971c765fa3e9ae9d4eeed93d905524f05427b83 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 18:39:18 +0100 Subject: [PATCH 31/37] [makefile] add NrClusters param in runtime.mk --- apps/common/runtime.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/runtime.mk b/apps/common/runtime.mk index a681a92..18ec921 100644 --- a/apps/common/runtime.mk +++ b/apps/common/runtime.mk @@ -93,7 +93,7 @@ endif ifeq ($(vcd_dump),1) ENV_DEFINES += -DVCD_DUMP=1 endif -MAKE_DEFINES = -DNR_LANES=$(nr_lanes) -DVLEN=$(vlen) +MAKE_DEFINES = -DNR_LANES=$(nr_lanes) -DVLEN=$(vlen) -DNR_CLUSTERS=$(nr_clusters) DEFINES += $(ENV_DEFINES) $(MAKE_DEFINES) # Common flags From e36bb6c3135a34157be7d75ff82295b0cadc8fea Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 19:19:59 +0100 Subject: [PATCH 32/37] [config] limited total number of lanes under 16 --- config/8_lanes.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/8_lanes.mk b/config/8_lanes.mk index b07a3b9..b6b9f97 100644 --- a/config/8_lanes.mk +++ b/config/8_lanes.mk @@ -20,7 +20,7 @@ # Number of vector lanes nr_lanes ?= 8 # Number of clusters -nr_clusters ?= 4 +nr_clusters ?= 2 # Length of each vector register (in bits) # Constraints: VLEN > 128 From f7b48d3a976240c20d55cd0fbd3258ff9e1ab3de Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Tue, 4 Nov 2025 19:33:25 +0100 Subject: [PATCH 33/37] [makefile] add rvv isa ara_tests --- hardware/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/Makefile b/hardware/Makefile index aa88935..8c1c656 100644 --- a/hardware/Makefile +++ b/hardware/Makefile @@ -202,6 +202,7 @@ simc: compile # RISC-V Tests simulation APPS_DIR := $(abspath $(ROOT_DIR)/../apps) TESTS_DIR := $(APPS_DIR)/riscv-tests/isa +include $(APPS_DIR)/common/riscv_tests.mk tests := $(ara_tests) $(cva6_tests) From f08f3be07b9061edc5fd2e01fe14b1bd89223050 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 14 Nov 2025 15:59:30 +0100 Subject: [PATCH 34/37] [Config] Change configuration file for NrLanes and NrClusters --- config/16_lanes.mk | 4 ++-- config/2_lanes.mk | 2 +- config/4_lanes.mk | 4 ++-- config/8_lanes.mk | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/16_lanes.mk b/config/16_lanes.mk index 86a776e..55e573d 100644 --- a/config/16_lanes.mk +++ b/config/16_lanes.mk @@ -18,9 +18,9 @@ # Matheus Cavalcante, ETH Zurich # Number of vector lanes -nr_lanes ?= 16 +nr_lanes ?= 4 # Number of clusters -nr_clusters ?= 1 +nr_clusters ?= 4 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/2_lanes.mk b/config/2_lanes.mk index 5edb8a4..6c0e0c8 100644 --- a/config/2_lanes.mk +++ b/config/2_lanes.mk @@ -20,7 +20,7 @@ # Number of vector lanes nr_lanes ?= 2 # Number of clusters -nr_clusters ?= 4 +nr_clusters ?= 1 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/4_lanes.mk b/config/4_lanes.mk index 7edea50..cf76672 100644 --- a/config/4_lanes.mk +++ b/config/4_lanes.mk @@ -18,9 +18,9 @@ # Matheus Cavalcante, ETH Zurich # Number of vector lanes -nr_lanes ?= 4 +nr_lanes ?= 2 # Number of clusters -nr_clusters ?= 4 +nr_clusters ?= 2 # Length of each vector register (in bits) # Constraints: VLEN > 128 diff --git a/config/8_lanes.mk b/config/8_lanes.mk index b6b9f97..1a63aac 100644 --- a/config/8_lanes.mk +++ b/config/8_lanes.mk @@ -18,7 +18,7 @@ # Matheus Cavalcante, ETH Zurich # Number of vector lanes -nr_lanes ?= 8 +nr_lanes ?= 4 # Number of clusters nr_clusters ?= 2 From 6d8fa8b731c563cd67cb671c168dbc5d98385941 Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 14 Nov 2025 16:12:09 +0100 Subject: [PATCH 35/37] [CI] Disable 2_lanes configuration first --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81258d8..d8224e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -222,7 +222,7 @@ jobs: strategy: max-parallel: 1 matrix: - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] needs: tc-llvm steps: - uses: actions/checkout@v4 From b24b4df7a7e746ee02bd1b1b56be32c3753bc36d Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Fri, 14 Nov 2025 16:22:38 +0100 Subject: [PATCH 36/37] [CI] Disable 2_lanes tests --- .github/workflows/ci.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8224e0..60782c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -254,7 +254,7 @@ jobs: strategy: max-parallel: 1 matrix: - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] needs: ["tc-llvm", "tc-gcc", "tc-isa-sim"] steps: - uses: actions/checkout@v4 @@ -293,7 +293,7 @@ jobs: strategy: max-parallel: 1 matrix: - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] needs: ["tc-verilator", "tc-isa-sim"] steps: - uses: actions/checkout@v4 @@ -344,7 +344,7 @@ jobs: max-parallel: 1 matrix: app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, jacobi2d, exp, softmax, dotproduct, fdotproduct, fconv3d, pathfinder, roi_align, lavamd, dwt, dropout, fft, gemv] - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] needs: ["compile-ara", "compile-apps"] steps: - uses: actions/checkout@v4 @@ -377,7 +377,7 @@ jobs: strategy: max-parallel: 1 matrix: - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] needs: ["compile-ara", "compile-riscv-tests"] steps: - uses: actions/checkout@v4 @@ -511,7 +511,7 @@ jobs: strategy: max-parallel: 1 matrix: - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] needs: ["compile-ara", "compile-apps"] steps: - uses: actions/checkout@v4 @@ -569,10 +569,10 @@ jobs: - name: Install Python requirements run: pip install -r python-requirements.txt - uses: actions/checkout@v4 - - name: Get [f]dotproduct results (2 lanes) - uses: actions/download-artifact@v4 - with: - name: dotproducts-2_lanes + # - name: Get [f]dotproduct results (2 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: dotproducts-2_lanes - name: Get [f]dotproduct results (4 lanes) uses: actions/download-artifact@v4 with: @@ -585,10 +585,10 @@ jobs: uses: actions/download-artifact@v4 with: name: dotproducts-16_lanes - - name: Get benchmark results (2 lanes) - uses: actions/download-artifact@v4 - with: - name: benchmark-2_lanes + # - name: Get benchmark results (2 lanes) + # uses: actions/download-artifact@v4 + # with: + # name: benchmark-2_lanes - name: Get benchmark results (4 lanes) uses: actions/download-artifact@v4 with: @@ -603,13 +603,13 @@ jobs: name: benchmark-16_lanes - name: Untar the [f]dotproduct results run: | - tar xvf dotproducts-2_lanes.tar + # tar xvf dotproducts-2_lanes.tar tar xvf dotproducts-4_lanes.tar tar xvf dotproducts-8_lanes.tar tar xvf dotproducts-16_lanes.tar - name: Untar the results run: | - tar xvf benchmarks-2_lanes.tar + # tar xvf benchmarks-2_lanes.tar tar xvf benchmarks-4_lanes.tar tar xvf benchmarks-8_lanes.tar tar xvf benchmarks-16_lanes.tar @@ -736,7 +736,7 @@ jobs: strategy: max-parallel: 1 matrix: - ara_config: [2_lanes, 4_lanes, 8_lanes, 16_lanes] + ara_config: [4_lanes, 8_lanes, 16_lanes] if: always() # needs: ["simulate", "riscv-tests-spike", "riscv-tests-simv"] needs: ["simulate"] From 36503b28bd862c1f386ec4e55ed0909e72a719da Mon Sep 17 00:00:00 2001 From: Hong Pang Date: Mon, 17 Nov 2025 14:21:43 +0100 Subject: [PATCH 37/37] [CI] Shrink kernel tests --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60782c3..17bd4c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -343,7 +343,8 @@ jobs: strategy: max-parallel: 1 matrix: - app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, jacobi2d, exp, softmax, dotproduct, fdotproduct, fconv3d, pathfinder, roi_align, lavamd, dwt, dropout, fft, gemv] + # app: [hello_world, imatmul, fmatmul, iconv2d, fconv2d, jacobi2d, exp, softmax, dotproduct, fdotproduct, fconv3d, pathfinder, roi_align, lavamd, dwt, dropout, fft, gemv] + app: [hello_world, imatmul, fmatmul, exp, softmax, dotproduct, fdotproduct, gemv, fconv2d] ara_config: [4_lanes, 8_lanes, 16_lanes] needs: ["compile-ara", "compile-apps"] steps: