From 056bf638663f69da7142fc2f8fd9d23729eb3387 Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Tue, 21 Apr 2020 16:03:03 +0200 Subject: [PATCH] Add more consistancy tests --- .../demo/smp/VexRiscvSmpCluster.scala | 4 +- .../vexriscv/plugin/DBusCachedPlugin.scala | 2 +- src/test/cpp/raw/smp/build/smp.asm | 660 ++++++++++-------- src/test/cpp/raw/smp/build/smp.bin | Bin 1144 -> 1388 bytes src/test/cpp/raw/smp/src/crt.S | 68 +- 5 files changed, 437 insertions(+), 297 deletions(-) diff --git a/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala b/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala index 0371b29..f823f4f 100644 --- a/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala +++ b/src/main/scala/vexriscv/demo/smp/VexRiscvSmpCluster.scala @@ -488,7 +488,9 @@ object VexRiscvSmpClusterTest extends App{ } } - +// echo "echo 10000 | dhrystone >> log" > test +// time sh test & +// top -b -n 1 object VexRiscvSmpClusterOpenSbi extends App{ import spinal.core.sim._ diff --git a/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala b/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala index 82c7953..8308bc0 100644 --- a/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala +++ b/src/main/scala/vexriscv/plugin/DBusCachedPlugin.scala @@ -236,7 +236,7 @@ class DBusCachedPlugin(val config : DataCacheConfig, if(withLrSc) insert(MEMORY_FENCE_BACK) setWhen(input(MEMORY_LRSC)) if(withAmo) insert(MEMORY_FENCE_BACK) setWhen(input(MEMORY_AMO)) } - when(input(INSTRUCTION)(25)) { //RL but a bit pessimistic as could be MEMORY_FENCE_BACK when the memory op isn't a read + when(input(INSTRUCTION)(25)) { //RL but a bit pessimistic as it could be MEMORY_FENCE_BACK when the memory op isn't a read if(withLrSc) insert(MEMORY_FENCE_FRONT) setWhen(input(MEMORY_LRSC)) if(withAmo) insert(MEMORY_FENCE_FRONT) setWhen(input(MEMORY_AMO)) } diff --git a/src/test/cpp/raw/smp/build/smp.asm b/src/test/cpp/raw/smp/build/smp.asm index 19fc727..b0492f9 100644 --- a/src/test/cpp/raw/smp/build/smp.asm +++ b/src/test/cpp/raw/smp/build/smp.asm @@ -10,24 +10,24 @@ Disassembly of section .crt_section: 80000008: f1402373 csrr t1,mhartid 8000000c: 01031313 slli t1,t1,0x10 80000010: 006282b3 add t0,t0,t1 -80000014: 0082a023 sw s0,0(t0) # f8000000 +80000014: 0082a023 sw s0,0(t0) # f8000000 80000018 : 80000018: 00100513 li a0,1 8000001c: 00000597 auipc a1,0x0 -80000020: 36058593 addi a1,a1,864 # 8000037c +80000020: 42058593 addi a1,a1,1056 # 8000043c 80000024: 00a5a02f amoadd.w zero,a0,(a1) 80000028 : 80000028: 00000417 auipc s0,0x0 -8000002c: 35442403 lw s0,852(s0) # 8000037c +8000002c: 41442403 lw s0,1044(s0) # 8000043c 80000030: 19000513 li a0,400 -80000034: 33c000ef jal ra,80000370 +80000034: 3fc000ef jal ra,80000430 80000038: 00000497 auipc s1,0x0 -8000003c: 3444a483 lw s1,836(s1) # 8000037c +8000003c: 4044a483 lw s1,1028(s1) # 8000043c 80000040: fe8494e3 bne s1,s0,80000028 80000044: f80002b7 lui t0,0xf8000 -80000048: 00428293 addi t0,t0,4 # f8000004 +80000048: 00428293 addi t0,t0,4 # f8000004 8000004c: f1402373 csrr t1,mhartid 80000050: 01031313 slli t1,t1,0x10 80000054: 006282b3 add t0,t0,t1 @@ -35,319 +35,407 @@ Disassembly of section .crt_section: 8000005c : 8000005c: 00100513 li a0,1 -80000060: 1d0000ef jal ra,80000230 +80000060: 290000ef jal ra,800002f0 80000064: 00200513 li a0,2 -80000068: 1c8000ef jal ra,80000230 +80000068: 288000ef jal ra,800002f0 8000006c: 00300513 li a0,3 -80000070: 1c0000ef jal ra,80000230 +80000070: 280000ef jal ra,800002f0 80000074: 00400513 li a0,4 -80000078: 234000ef jal ra,800002ac +80000078: 2f4000ef jal ra,8000036c 8000007c: 00500513 li a0,5 -80000080: 22c000ef jal ra,800002ac +80000080: 2ec000ef jal ra,8000036c 80000084: 00600513 li a0,6 -80000088: 224000ef jal ra,800002ac +80000088: 2e4000ef jal ra,8000036c 8000008c: 00700513 li a0,7 -80000090: 1a0000ef jal ra,80000230 +80000090: 260000ef jal ra,800002f0 80000094: 00800513 li a0,8 -80000098: 214000ef jal ra,800002ac +80000098: 2d4000ef jal ra,8000036c 8000009c: 00000197 auipc gp,0x0 -800000a0: 2ec1a183 lw gp,748(gp) # 80000388 +800000a0: 3ac1a183 lw gp,940(gp) # 80000448 -800000a4 : -800000a4: 00018513 mv a0,gp -800000a8: 00118193 addi gp,gp,1 -800000ac: 200000ef jal ra,800002ac -800000b0: 00000297 auipc t0,0x0 -800000b4: 2e42a283 lw t0,740(t0) # 80000394 -800000b8: 00a00313 li t1,10 -800000bc: 1662d863 bge t0,t1,8000022c -800000c0: 00000297 auipc t0,0x0 -800000c4: 2cc2a283 lw t0,716(t0) # 8000038c -800000c8: 00000317 auipc t1,0x0 -800000cc: 2c832303 lw t1,712(t1) # 80000390 -800000d0: 06628a63 beq t0,t1,80000144 -800000d4: f14022f3 csrr t0,mhartid -800000d8: 00000317 auipc t1,0x0 -800000dc: 2b432303 lw t1,692(t1) # 8000038c -800000e0: 00000417 auipc s0,0x0 -800000e4: 32040413 addi s0,s0,800 # 80000400 -800000e8: 00000497 auipc s1,0x0 -800000ec: 31c48493 addi s1,s1,796 # 80000404 -800000f0: 02628863 beq t0,t1,80000120 -800000f4: 00000317 auipc t1,0x0 -800000f8: 29c32303 lw t1,668(t1) # 80000390 -800000fc: 00000417 auipc s0,0x0 -80000100: 30840413 addi s0,s0,776 # 80000404 -80000104: 00000497 auipc s1,0x0 -80000108: 2fc48493 addi s1,s1,764 # 80000400 -8000010c: 00628a63 beq t0,t1,80000120 +800000a4 : +800000a4: 00000297 auipc t0,0x0 +800000a8: 06828293 addi t0,t0,104 # 8000010c +800000ac: 00000317 auipc t1,0x0 +800000b0: 48532a23 sw t0,1172(t1) # 80000540 +800000b4: 00000297 auipc t0,0x0 +800000b8: 06028293 addi t0,t0,96 # 80000114 +800000bc: 00000317 auipc t1,0x0 +800000c0: 48532423 sw t0,1160(t1) # 80000544 +800000c4: 00000297 auipc t0,0x0 +800000c8: 01428293 addi t0,t0,20 # 800000d8 +800000cc: 00000317 auipc t1,0x0 +800000d0: 46532e23 sw t0,1148(t1) # 80000548 +800000d4: 0640006f j 80000138 -80000110 : -80000110: 00018513 mv a0,gp -80000114: 00118193 addi gp,gp,1 -80000118: 194000ef jal ra,800002ac -8000011c: 0280006f j 80000144 +800000d8 : +800000d8: 00000297 auipc t0,0x0 +800000dc: 03428293 addi t0,t0,52 # 8000010c +800000e0: 00000317 auipc t1,0x0 +800000e4: 46532023 sw t0,1120(t1) # 80000540 +800000e8: 00000297 auipc t0,0x0 +800000ec: 04028293 addi t0,t0,64 # 80000128 +800000f0: 00000317 auipc t1,0x0 +800000f4: 44532a23 sw t0,1108(t1) # 80000544 +800000f8: 00000297 auipc t0,0x0 +800000fc: 2f428293 addi t0,t0,756 # 800003ec +80000100: 00000317 auipc t1,0x0 +80000104: 44532423 sw t0,1096(t1) # 80000548 +80000108: 0300006f j 80000138 -80000120 : -80000120: 29a00913 li s2,666 -80000124: 00018513 mv a0,gp -80000128: 00118193 addi gp,gp,1 -8000012c: 0004a983 lw s3,0(s1) -80000130: 17c000ef jal ra,800002ac -80000134: 01242023 sw s2,0(s0) -80000138: 0120000f fence w,r -8000013c: 0004a983 lw s3,0(s1) -80000140: 05342023 sw s3,64(s0) +8000010c : +8000010c: 0004a983 lw s3,0(s1) +80000110: 0c40006f j 800001d4 -80000144 : -80000144: 0330000f fence rw,rw -80000148: 00018513 mv a0,gp -8000014c: 00118193 addi gp,gp,1 -80000150: 15c000ef jal ra,800002ac -80000154: f14022f3 csrr t0,mhartid -80000158: f40296e3 bnez t0,800000a4 +80000114 : +80000114: 01242023 sw s2,0(s0) +80000118: 0120000f fence w,r +8000011c: 0004a983 lw s3,0(s1) +80000120: 05342023 sw s3,64(s0) +80000124: 0cc0006f j 800001f0 -8000015c : -8000015c: 00000297 auipc t0,0x0 -80000160: 2302a283 lw t0,560(t0) # 8000038c -80000164: 00000317 auipc t1,0x0 -80000168: 22c32303 lw t1,556(t1) # 80000390 -8000016c: 04628263 beq t0,t1,800001b0 -80000170: 00000517 auipc a0,0x0 -80000174: 2d452503 lw a0,724(a0) # 80000444 -80000178: f80002b7 lui t0,0xf8000 -8000017c: 01428293 addi t0,t0,20 # f8000014 -80000180: f1402373 csrr t1,mhartid -80000184: 01031313 slli t1,t1,0x10 -80000188: 006282b3 add t0,t0,t1 -8000018c: 00a2a023 sw a0,0(t0) -80000190: 00000517 auipc a0,0x0 -80000194: 2b052503 lw a0,688(a0) # 80000440 -80000198: f80002b7 lui t0,0xf8000 -8000019c: 01428293 addi t0,t0,20 # f8000014 -800001a0: f1402373 csrr t1,mhartid -800001a4: 01031313 slli t1,t1,0x10 -800001a8: 006282b3 add t0,t0,t1 -800001ac: 00a2a023 sw a0,0(t0) +80000128 : +80000128: 01242023 sw s2,0(s0) +8000012c: 1204a9af lr.w.rl s3,(s1) +80000130: 05342023 sw s3,64(s0) +80000134: 0bc0006f j 800001f0 -800001b0 : -800001b0: f14022f3 csrr t0,mhartid -800001b4: ee0298e3 bnez t0,800000a4 -800001b8: 00000297 auipc t0,0x0 -800001bc: 2402a423 sw zero,584(t0) # 80000400 -800001c0: 00000297 auipc t0,0x0 -800001c4: 2402a223 sw zero,580(t0) # 80000404 -800001c8: 00000417 auipc s0,0x0 -800001cc: 1b442403 lw s0,436(s0) # 8000037c -800001d0: 00000297 auipc t0,0x0 -800001d4: 1c02a283 lw t0,448(t0) # 80000390 -800001d8: 00128293 addi t0,t0,1 -800001dc: 00000317 auipc t1,0x0 -800001e0: 1a532a23 sw t0,436(t1) # 80000390 -800001e4: 04829063 bne t0,s0,80000224 -800001e8: 00000317 auipc t1,0x0 -800001ec: 1a032423 sw zero,424(t1) # 80000390 -800001f0: 00000297 auipc t0,0x0 -800001f4: 19c2a283 lw t0,412(t0) # 8000038c -800001f8: 00128293 addi t0,t0,1 -800001fc: 00000317 auipc t1,0x0 -80000200: 18532823 sw t0,400(t1) # 8000038c -80000204: 02829063 bne t0,s0,80000224 -80000208: 00000317 auipc t1,0x0 -8000020c: 18032223 sw zero,388(t1) # 8000038c -80000210: 00000297 auipc t0,0x0 -80000214: 1842a283 lw t0,388(t0) # 80000394 -80000218: 00128293 addi t0,t0,1 -8000021c: 00000317 auipc t1,0x0 -80000220: 16532c23 sw t0,376(t1) # 80000394 +80000138 : +80000138: 00018513 mv a0,gp +8000013c: 00118193 addi gp,gp,1 +80000140: 22c000ef jal ra,8000036c +80000144: 00000297 auipc t0,0x0 +80000148: 3002a823 sw zero,784(t0) # 80000454 -80000224 : -80000224: 0130000f fence w,rw -80000228: e7dff06f j 800000a4 +8000014c : +8000014c: 00018513 mv a0,gp +80000150: 00118193 addi gp,gp,1 +80000154: 218000ef jal ra,8000036c +80000158: 00000297 auipc t0,0x0 +8000015c: 2fc2a283 lw t0,764(t0) # 80000454 +80000160: 03200313 li t1,50 +80000164: 1662da63 bge t0,t1,800002d8 +80000168: 00000297 auipc t0,0x0 +8000016c: 2e42a283 lw t0,740(t0) # 8000044c +80000170: 00000317 auipc t1,0x0 +80000174: 2e032303 lw t1,736(t1) # 80000450 +80000178: 06628c63 beq t0,t1,800001f0 +8000017c: f14022f3 csrr t0,mhartid +80000180: 00000317 auipc t1,0x0 +80000184: 2cc32303 lw t1,716(t1) # 8000044c +80000188: 00000417 auipc s0,0x0 +8000018c: 33840413 addi s0,s0,824 # 800004c0 +80000190: 00000497 auipc s1,0x0 +80000194: 33448493 addi s1,s1,820 # 800004c4 +80000198: 02628863 beq t0,t1,800001c8 +8000019c: 00000317 auipc t1,0x0 +800001a0: 2b432303 lw t1,692(t1) # 80000450 +800001a4: 00000417 auipc s0,0x0 +800001a8: 32040413 addi s0,s0,800 # 800004c4 +800001ac: 00000497 auipc s1,0x0 +800001b0: 31448493 addi s1,s1,788 # 800004c0 +800001b4: 00628a63 beq t0,t1,800001c8 -8000022c : -8000022c: 1000006f j 8000032c +800001b8 : +800001b8: 00018513 mv a0,gp +800001bc: 00118193 addi gp,gp,1 +800001c0: 1ac000ef jal ra,8000036c +800001c4: 02c0006f j 800001f0 -80000230 : -80000230: f80002b7 lui t0,0xf8000 -80000234: 00c28293 addi t0,t0,12 # f800000c -80000238: f1402373 csrr t1,mhartid -8000023c: 01031313 slli t1,t1,0x10 -80000240: 006282b3 add t0,t0,t1 -80000244: 00a2a023 sw a0,0(t0) -80000248: 00000e97 auipc t4,0x0 -8000024c: 13ceae83 lw t4,316(t4) # 80000384 -80000250: 00000297 auipc t0,0x0 -80000254: 13028293 addi t0,t0,304 # 80000380 -80000258: 00100313 li t1,1 -8000025c: 0062a2af amoadd.w t0,t1,(t0) -80000260: 00128293 addi t0,t0,1 -80000264: 00000317 auipc t1,0x0 -80000268: 11832303 lw t1,280(t1) # 8000037c -8000026c: 00629c63 bne t0,t1,80000284 -80000270: 001e8293 addi t0,t4,1 -80000274: 00000317 auipc t1,0x0 -80000278: 10032623 sw zero,268(t1) # 80000380 -8000027c: 00000317 auipc t1,0x0 -80000280: 10532423 sw t0,264(t1) # 80000384 +800001c8 : +800001c8: 00000297 auipc t0,0x0 +800001cc: 3782a283 lw t0,888(t0) # 80000540 +800001d0: 000280e7 jalr t0 -80000284 : -80000284: 00000297 auipc t0,0x0 -80000288: 1002a283 lw t0,256(t0) # 80000384 -8000028c: ffd28ce3 beq t0,t4,80000284 -80000290: f80002b7 lui t0,0xf8000 -80000294: 01028293 addi t0,t0,16 # f8000010 -80000298: f1402373 csrr t1,mhartid -8000029c: 01031313 slli t1,t1,0x10 -800002a0: 006282b3 add t0,t0,t1 -800002a4: 00a2a023 sw a0,0(t0) -800002a8: 00008067 ret +800001d4 : +800001d4: 29a00913 li s2,666 +800001d8: 00018513 mv a0,gp +800001dc: 00118193 addi gp,gp,1 +800001e0: 18c000ef jal ra,8000036c +800001e4: 00000297 auipc t0,0x0 +800001e8: 3602a283 lw t0,864(t0) # 80000544 +800001ec: 000280e7 jalr t0 -800002ac : -800002ac: f80002b7 lui t0,0xf8000 -800002b0: 00c28293 addi t0,t0,12 # f800000c -800002b4: f1402373 csrr t1,mhartid -800002b8: 01031313 slli t1,t1,0x10 -800002bc: 006282b3 add t0,t0,t1 -800002c0: 00a2a023 sw a0,0(t0) -800002c4: 00000e97 auipc t4,0x0 -800002c8: 0c0eae83 lw t4,192(t4) # 80000384 -800002cc: 00000297 auipc t0,0x0 -800002d0: 0b428293 addi t0,t0,180 # 80000380 +800001f0 : +800001f0: 0330000f fence rw,rw +800001f4: 00018513 mv a0,gp +800001f8: 00118193 addi gp,gp,1 +800001fc: 170000ef jal ra,8000036c +80000200: f14022f3 csrr t0,mhartid +80000204: f40294e3 bnez t0,8000014c -800002d4 : -800002d4: 1002a32f lr.w t1,(t0) -800002d8: 00130313 addi t1,t1,1 -800002dc: 1862a3af sc.w t2,t1,(t0) -800002e0: fe039ae3 bnez t2,800002d4 -800002e4: 00000297 auipc t0,0x0 -800002e8: 0982a283 lw t0,152(t0) # 8000037c -800002ec: 00629c63 bne t0,t1,80000304 -800002f0: 001e8293 addi t0,t4,1 -800002f4: 00000317 auipc t1,0x0 -800002f8: 08032623 sw zero,140(t1) # 80000380 -800002fc: 00000317 auipc t1,0x0 -80000300: 08532423 sw t0,136(t1) # 80000384 +80000208 : +80000208: 00000297 auipc t0,0x0 +8000020c: 2442a283 lw t0,580(t0) # 8000044c +80000210: 00000317 auipc t1,0x0 +80000214: 24032303 lw t1,576(t1) # 80000450 +80000218: 04628263 beq t0,t1,8000025c +8000021c: 00000517 auipc a0,0x0 +80000220: 2e852503 lw a0,744(a0) # 80000504 +80000224: f80002b7 lui t0,0xf8000 +80000228: 01428293 addi t0,t0,20 # f8000014 +8000022c: f1402373 csrr t1,mhartid +80000230: 01031313 slli t1,t1,0x10 +80000234: 006282b3 add t0,t0,t1 +80000238: 00a2a023 sw a0,0(t0) +8000023c: 00000517 auipc a0,0x0 +80000240: 2c452503 lw a0,708(a0) # 80000500 +80000244: f80002b7 lui t0,0xf8000 +80000248: 01428293 addi t0,t0,20 # f8000014 +8000024c: f1402373 csrr t1,mhartid +80000250: 01031313 slli t1,t1,0x10 +80000254: 006282b3 add t0,t0,t1 +80000258: 00a2a023 sw a0,0(t0) -80000304 : -80000304: 00000297 auipc t0,0x0 -80000308: 0802a283 lw t0,128(t0) # 80000384 -8000030c: ffd28ce3 beq t0,t4,80000304 -80000310: f80002b7 lui t0,0xf8000 -80000314: 01028293 addi t0,t0,16 # f8000010 -80000318: f1402373 csrr t1,mhartid -8000031c: 01031313 slli t1,t1,0x10 -80000320: 006282b3 add t0,t0,t1 -80000324: 00a2a023 sw a0,0(t0) -80000328: 00008067 ret +8000025c : +8000025c: f14022f3 csrr t0,mhartid +80000260: ee0296e3 bnez t0,8000014c +80000264: 00000297 auipc t0,0x0 +80000268: 2402ae23 sw zero,604(t0) # 800004c0 +8000026c: 00000297 auipc t0,0x0 +80000270: 2402ac23 sw zero,600(t0) # 800004c4 +80000274: 00000417 auipc s0,0x0 +80000278: 1c842403 lw s0,456(s0) # 8000043c +8000027c: 00000297 auipc t0,0x0 +80000280: 1d42a283 lw t0,468(t0) # 80000450 +80000284: 00128293 addi t0,t0,1 +80000288: 00000317 auipc t1,0x0 +8000028c: 1c532423 sw t0,456(t1) # 80000450 +80000290: 04829063 bne t0,s0,800002d0 +80000294: 00000317 auipc t1,0x0 +80000298: 1a032e23 sw zero,444(t1) # 80000450 +8000029c: 00000297 auipc t0,0x0 +800002a0: 1b02a283 lw t0,432(t0) # 8000044c +800002a4: 00128293 addi t0,t0,1 +800002a8: 00000317 auipc t1,0x0 +800002ac: 1a532223 sw t0,420(t1) # 8000044c +800002b0: 02829063 bne t0,s0,800002d0 +800002b4: 00000317 auipc t1,0x0 +800002b8: 18032c23 sw zero,408(t1) # 8000044c +800002bc: 00000297 auipc t0,0x0 +800002c0: 1982a283 lw t0,408(t0) # 80000454 +800002c4: 00128293 addi t0,t0,1 +800002c8: 00000317 auipc t1,0x0 +800002cc: 18532623 sw t0,396(t1) # 80000454 -8000032c : -8000032c: 00000413 li s0,0 -80000330: f80002b7 lui t0,0xf8000 -80000334: 00828293 addi t0,t0,8 # f8000008 -80000338: f1402373 csrr t1,mhartid -8000033c: 01031313 slli t1,t1,0x10 -80000340: 006282b3 add t0,t0,t1 -80000344: 0082a023 sw s0,0(t0) -80000348: 0240006f j 8000036c +800002d0 : +800002d0: 0130000f fence w,rw +800002d4: e79ff06f j 8000014c -8000034c : -8000034c: 00100413 li s0,1 +800002d8 : +800002d8: 00000417 auipc s0,0x0 +800002dc: 27042403 lw s0,624(s0) # 80000548 +800002e0: 00018513 mv a0,gp +800002e4: 00118193 addi gp,gp,1 +800002e8: 084000ef jal ra,8000036c +800002ec: 000400e7 jalr s0 + +800002f0 : +800002f0: f80002b7 lui t0,0xf8000 +800002f4: 00c28293 addi t0,t0,12 # f800000c +800002f8: f1402373 csrr t1,mhartid +800002fc: 01031313 slli t1,t1,0x10 +80000300: 006282b3 add t0,t0,t1 +80000304: 00a2a023 sw a0,0(t0) +80000308: 00000e97 auipc t4,0x0 +8000030c: 13ceae83 lw t4,316(t4) # 80000444 +80000310: 00000297 auipc t0,0x0 +80000314: 13028293 addi t0,t0,304 # 80000440 +80000318: 00100313 li t1,1 +8000031c: 0062a2af amoadd.w t0,t1,(t0) +80000320: 00128293 addi t0,t0,1 +80000324: 00000317 auipc t1,0x0 +80000328: 11832303 lw t1,280(t1) # 8000043c +8000032c: 00629c63 bne t0,t1,80000344 +80000330: 001e8293 addi t0,t4,1 +80000334: 00000317 auipc t1,0x0 +80000338: 10032623 sw zero,268(t1) # 80000440 +8000033c: 00000317 auipc t1,0x0 +80000340: 10532423 sw t0,264(t1) # 80000444 + +80000344 : +80000344: 00000297 auipc t0,0x0 +80000348: 1002a283 lw t0,256(t0) # 80000444 +8000034c: ffd28ce3 beq t0,t4,80000344 80000350: f80002b7 lui t0,0xf8000 -80000354: 00828293 addi t0,t0,8 # f8000008 +80000354: 01028293 addi t0,t0,16 # f8000010 80000358: f1402373 csrr t1,mhartid 8000035c: 01031313 slli t1,t1,0x10 80000360: 006282b3 add t0,t0,t1 -80000364: 0082a023 sw s0,0(t0) -80000368: 0040006f j 8000036c +80000364: 00a2a023 sw a0,0(t0) +80000368: 00008067 ret -8000036c : -8000036c: 0000006f j 8000036c +8000036c : +8000036c: f80002b7 lui t0,0xf8000 +80000370: 00c28293 addi t0,t0,12 # f800000c +80000374: f1402373 csrr t1,mhartid +80000378: 01031313 slli t1,t1,0x10 +8000037c: 006282b3 add t0,t0,t1 +80000380: 00a2a023 sw a0,0(t0) +80000384: 00000e97 auipc t4,0x0 +80000388: 0c0eae83 lw t4,192(t4) # 80000444 +8000038c: 00000297 auipc t0,0x0 +80000390: 0b428293 addi t0,t0,180 # 80000440 -80000370 : -80000370: fff50513 addi a0,a0,-1 -80000374: fe051ee3 bnez a0,80000370 -80000378: 00008067 ret +80000394 : +80000394: 1002a32f lr.w t1,(t0) +80000398: 00130313 addi t1,t1,1 +8000039c: 1862a3af sc.w t2,t1,(t0) +800003a0: fe039ae3 bnez t2,80000394 +800003a4: 00000297 auipc t0,0x0 +800003a8: 0982a283 lw t0,152(t0) # 8000043c +800003ac: 00629c63 bne t0,t1,800003c4 +800003b0: 001e8293 addi t0,t4,1 +800003b4: 00000317 auipc t1,0x0 +800003b8: 08032623 sw zero,140(t1) # 80000440 +800003bc: 00000317 auipc t1,0x0 +800003c0: 08532423 sw t0,136(t1) # 80000444 -8000037c : -8000037c: 0000 unimp +800003c4 : +800003c4: 00000297 auipc t0,0x0 +800003c8: 0802a283 lw t0,128(t0) # 80000444 +800003cc: ffd28ce3 beq t0,t4,800003c4 +800003d0: f80002b7 lui t0,0xf8000 +800003d4: 01028293 addi t0,t0,16 # f8000010 +800003d8: f1402373 csrr t1,mhartid +800003dc: 01031313 slli t1,t1,0x10 +800003e0: 006282b3 add t0,t0,t1 +800003e4: 00a2a023 sw a0,0(t0) +800003e8: 00008067 ret + +800003ec : +800003ec: 00000413 li s0,0 +800003f0: f80002b7 lui t0,0xf8000 +800003f4: 00828293 addi t0,t0,8 # f8000008 +800003f8: f1402373 csrr t1,mhartid +800003fc: 01031313 slli t1,t1,0x10 +80000400: 006282b3 add t0,t0,t1 +80000404: 0082a023 sw s0,0(t0) +80000408: 0240006f j 8000042c + +8000040c : +8000040c: 00100413 li s0,1 +80000410: f80002b7 lui t0,0xf8000 +80000414: 00828293 addi t0,t0,8 # f8000008 +80000418: f1402373 csrr t1,mhartid +8000041c: 01031313 slli t1,t1,0x10 +80000420: 006282b3 add t0,t0,t1 +80000424: 0082a023 sw s0,0(t0) +80000428: 0040006f j 8000042c + +8000042c : +8000042c: 0000006f j 8000042c + +80000430 : +80000430: fff50513 addi a0,a0,-1 +80000434: fe051ee3 bnez a0,80000430 +80000438: 00008067 ret + +8000043c : +8000043c: 0000 unimp ... -80000380 : -80000380: 0000 unimp - ... - -80000384 : -80000384: 0000 unimp - ... - -80000388 : -80000388: 1000 addi s0,sp,32 - ... - -8000038c : -8000038c: 0000 unimp - ... - -80000390 : -80000390: 0000 unimp - ... - -80000394 : -80000394: 0000 unimp -80000396: 0000 unimp -80000398: 00000013 nop -8000039c: 00000013 nop -800003a0: 00000013 nop -800003a4: 00000013 nop -800003a8: 00000013 nop -800003ac: 00000013 nop -800003b0: 00000013 nop -800003b4: 00000013 nop -800003b8: 00000013 nop -800003bc: 00000013 nop -800003c0: 00000013 nop -800003c4: 00000013 nop -800003c8: 00000013 nop -800003cc: 00000013 nop -800003d0: 00000013 nop -800003d4: 00000013 nop -800003d8: 00000013 nop -800003dc: 00000013 nop -800003e0: 00000013 nop -800003e4: 00000013 nop -800003e8: 00000013 nop -800003ec: 00000013 nop -800003f0: 00000013 nop -800003f4: 00000013 nop -800003f8: 00000013 nop -800003fc: 00000013 nop - -80000400 : -80000400: 0000 unimp - ... - -80000404 : -80000404: 0000 unimp -80000406: 0000 unimp -80000408: 00000013 nop -8000040c: 00000013 nop -80000410: 00000013 nop -80000414: 00000013 nop -80000418: 00000013 nop -8000041c: 00000013 nop -80000420: 00000013 nop -80000424: 00000013 nop -80000428: 00000013 nop -8000042c: 00000013 nop -80000430: 00000013 nop -80000434: 00000013 nop -80000438: 00000013 nop -8000043c: 00000013 nop - -80000440 : +80000440 : 80000440: 0000 unimp ... -80000444 : +80000444 : +80000444: 0000 unimp + ... + +80000448 : +80000448: 1000 addi s0,sp,32 + ... + +8000044c : +8000044c: 0000 unimp + ... + +80000450 : +80000450: 0000 unimp + ... + +80000454 : +80000454: 0000 unimp +80000456: 0000 unimp +80000458: 00000013 nop +8000045c: 00000013 nop +80000460: 00000013 nop +80000464: 00000013 nop +80000468: 00000013 nop +8000046c: 00000013 nop +80000470: 00000013 nop +80000474: 00000013 nop +80000478: 00000013 nop +8000047c: 00000013 nop +80000480: 00000013 nop +80000484: 00000013 nop +80000488: 00000013 nop +8000048c: 00000013 nop +80000490: 00000013 nop +80000494: 00000013 nop +80000498: 00000013 nop +8000049c: 00000013 nop +800004a0: 00000013 nop +800004a4: 00000013 nop +800004a8: 00000013 nop +800004ac: 00000013 nop +800004b0: 00000013 nop +800004b4: 00000013 nop +800004b8: 00000013 nop +800004bc: 00000013 nop + +800004c0 : +800004c0: 0000 unimp + ... + +800004c4 : +800004c4: 0000 unimp +800004c6: 0000 unimp +800004c8: 00000013 nop +800004cc: 00000013 nop +800004d0: 00000013 nop +800004d4: 00000013 nop +800004d8: 00000013 nop +800004dc: 00000013 nop +800004e0: 00000013 nop +800004e4: 00000013 nop +800004e8: 00000013 nop +800004ec: 00000013 nop +800004f0: 00000013 nop +800004f4: 00000013 nop +800004f8: 00000013 nop +800004fc: 00000013 nop + +80000500 : +80000500: 0000 unimp + ... + +80000504 : +80000504: 0000 unimp +80000506: 0000 unimp +80000508: 00000013 nop +8000050c: 00000013 nop +80000510: 00000013 nop +80000514: 00000013 nop +80000518: 00000013 nop +8000051c: 00000013 nop +80000520: 00000013 nop +80000524: 00000013 nop +80000528: 00000013 nop +8000052c: 00000013 nop +80000530: 00000013 nop +80000534: 00000013 nop +80000538: 00000013 nop +8000053c: 00000013 nop + +80000540 : +80000540: 0000 unimp + ... + +80000544 : +80000544: 0000 unimp + ... + +80000548 : ... diff --git a/src/test/cpp/raw/smp/build/smp.bin b/src/test/cpp/raw/smp/build/smp.bin index b391a14e6fda4e289fe59a0e77fca47434fcb461..5ce691833aa5418f5dbaaa0a6dafe4f821e092e2 100755 GIT binary patch literal 1388 zcmcgrL2DC182xr;C#1Br+YXpC*0N^TXf-C$ih>u{H5QM;{sGxNc#P0L5GM(U^dN3A zAc8SfuprIBL$0yjJ$Uq*LvF^Pf~VA(ooQntwjkod^5xCjdGCGSOxA5@&_?iM-Esz$ zV(l&S!D=v|#DF>h2y4X6H(o(P2f%jmIwi2!ht9P+$CZ~wr@L7liv1yTVO-;Jq|pah zp~Qqfl+RF7;1zgvcy;oW+~&2DqvVdjyxtRhhLWVGPN7(j?CEi|TTL->(#xiYf4opp8%e+KN z(23Ss+xmjS)3l~Rcz>Sf?4*U3^%@mMYvq$-t%7%AN!hi z1`@x|iuqE#x+>-xR*S2_10PB5#yQF97ZrCQc<95(tCQmSkkn^adSwK3sA z2HBz?Y*&{At~A{fAzJ|9YuVmX@QBGX%Hfpc(eVR5?WH&$&Be-M)fZbl;4@y5_otP< zJnu;l{q(3;C*A`c+EFjN6L+-<^;w=}=K~dR(H#Ag!k->^meE7Tgaf8LTk%UcAw&*)Mrx@{&D3WSN`#%{3)Ni x%*Q7BXX4%?svC##{2P8p$@jhPG8u|~#vWq~0p;+2y!)-Dep@9P{^e*$`^7D)gA delta 517 zcmZ{hF;Buk6vtn$cSc=6FVcdLRIVl>2&m}XAZ`vMd;!yb08IPxtkAN}9s2btK;8_AyV-C2-G{1k*Z* zpZVoHl|8Ut%vk6LIYs6Hn3J2Jbit&y}dO$F7?Xq;rj4`FM)U!=so(~}>+5dRZ{04oB=B$hKKz*c(W%w7Y3h($R z>DtR6=2qEeEn&57EDY1-L|8D0&kEQ^P31gz6_%FOkeAh8o~y<9hEjd>`d$Z!_C`oW L?h(=4DvAC8dYFFt diff --git a/src/test/cpp/raw/smp/src/crt.S b/src/test/cpp/raw/smp/src/crt.S index 4f984eb..9a72bd7 100644 --- a/src/test/cpp/raw/smp/src/crt.S +++ b/src/test/cpp/raw/smp/src/crt.S @@ -1,4 +1,4 @@ -#define CONSISTENCY_REDO_COUNT 10 +#define CONSISTENCY_REDO_COUNT 50 #define REPORT_OFFSET 0xF8000000 @@ -59,6 +59,51 @@ barrier_amo_test: lw gp, barrier_allocator + +consistancy_test1: + la t0, consistancy_init_load + sw t0, consistancy_init_call, t1 + la t0, consistancy_do_simple_fence + sw t0, consistancy_do_call, t1 + la t0, consistancy_test2 + sw t0, consistancy_done_call, t1 + j consistancy_start + +consistancy_test2: + la t0, consistancy_init_load + sw t0, consistancy_init_call, t1 + la t0, consistancy_do_rl_fence + sw t0, consistancy_do_call, t1 + la t0, success + sw t0, consistancy_done_call, t1 + j consistancy_start + + +consistancy_init_load: + lw s3, (s1) //Help getting the cache loaded for the consistancy check + j consistancy_do_init_done + +consistancy_do_simple_fence: + //Consistancy check : write to read ordering on two thread + sw s2, (s0) + fence w,r + lw s3, (s1) + sw s3, 64(s0) + j consistancy_join + +consistancy_do_rl_fence: + //Consistancy check : write to read ordering on two thread + sw s2, (s0) + lr.w.rl s3, (s1) + sw s3, 64(s0) + j consistancy_join + + +consistancy_start: + mv a0, gp + addi gp, gp, 1 + call barrier_lrsc + sw x0, consistancy_all_tested, t0 consistancy_loop: //Sync mv a0, gp @@ -91,17 +136,17 @@ consistancy_hart_not_involved: j consistancy_join consistancy_do: + lw t0, consistancy_init_call + jalr t0 +consistancy_do_init_done: li s2, 666 mv a0, gp addi gp, gp, 1 - lw s3, (s1) //Help getting the cache loaded for the consistancy check call barrier_lrsc - //Consistancy check : write to read ordering on two thread - sw s2, (s0) - fence w,r - lw s3, (s1) - sw s3, 64(s0) + + lw t0, consistancy_do_call + jalr t0 consistancy_join: fence rw, rw //ensure updated values @@ -144,7 +189,11 @@ consistancy_increment_fence: j consistancy_loop consistancy_passed: - j success + lw s0, consistancy_done_call + mv a0, gp + addi gp, gp, 1 + call barrier_lrsc + jalr s0 @@ -234,4 +283,5 @@ consistancy_a_readed: .word 0 .align 6 //Same cache line consistancy_init_call: .word 0 -consistancy_do_call: .word 0 \ No newline at end of file +consistancy_do_call: .word 0 +consistancy_done_call: .word 0 \ No newline at end of file