move verilator tick() to correct location, and increase memory size
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 1 Jan 2022 17:03:31 +0000 (17:03 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 1 Jan 2022 17:03:31 +0000 (17:03 +0000)
verilator/microwatt-verilator.cpp

index dbdee9271bbc4b28be8d9ca9f8d309bfebec950d..324dc5283b652a2d27af8f68c7b355d9fd124745 100644 (file)
@@ -119,8 +119,9 @@ int main(int argc, char **argv)
         close(fd);
 
         // allocate more memory than is in the file, copy it over
-        size_t sz = 0x2000000;
+        size_t sz = 0x20000000;
         mem = (unsigned char*)malloc(sz);
+        memset(mem, sz, 0);
         memcpy(mem, fmem, statbuf.st_size);
         munmap(fmem, statbuf.st_size);
     }
@@ -155,7 +156,6 @@ int main(int argc, char **argv)
     unsigned long long bram_do = 0;
 
        while(!Verilated::gotFinish()) {
-               tick(top);
 
         // read/write the memory to/from the mmap'd file (if given)
         if (mem != NULL) {
@@ -168,6 +168,8 @@ int main(int argc, char **argv)
             }
         }
 
+               tick(top);
+
                uart_tx(top->uart0_txd);
                top->uart0_rxd = uart_rx();