Add speedtest_read task in testbench
authorJean THOMAS <git0@pub.jeanthomas.me>
Tue, 28 Jul 2020 17:04:32 +0000 (19:04 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Tue, 28 Jul 2020 17:04:32 +0000 (19:04 +0200)
gram/simulation/simsoctb.v

index 3f91c0f2602d101bdef4885b9bba185849d38ada..42d44300469cc4025509b407a32b467f4f1d7286 100644 (file)
@@ -282,4 +282,36 @@ module simsoctb;
         end
     end
   endtask
+
+  integer i;
+  integer tstart;
+  integer tend;
+
+  task speedtest_read;
+    begin
+      tstart = $time;
+      for (i = 0; i < 10; i = i+1) begin
+        wishbone_read(32'h10000000 >> 2, tmp);
+        wishbone_read(32'h10000004 >> 2, tmp);
+        wishbone_read(32'h10000008 >> 2, tmp);
+        wishbone_read(32'h1000000C >> 2, tmp);
+        wishbone_read(32'h10000010 >> 2, tmp);
+        wishbone_read(32'h10000014 >> 2, tmp);
+        wishbone_read(32'h10000018 >> 2, tmp);
+        wishbone_read(32'h1000001C >> 2, tmp);
+        wishbone_read(32'h10000020 >> 2, tmp);
+        wishbone_read(32'h10000024 >> 2, tmp);
+        wishbone_read(32'h10000028 >> 2, tmp);
+        wishbone_read(32'h1000002C >> 2, tmp);
+        wishbone_read(32'h10000030 >> 2, tmp);
+        wishbone_read(32'h10000034 >> 2, tmp);
+        wishbone_read(32'h10000038 >> 2, tmp);
+        wishbone_read(32'h1000003C >> 2, tmp);
+      end
+      tend = $time;
+
+      //$display("Read speedtest: %d B/s", (10*16*4)*1000000000/(1024*1024)/(tend-tstart));
+      $display("Read speedtest: %d MB/s", 610352/(tend-tstart));
+    end
+  endtask
 endmodule