Skip to content

Instantly share code, notes, and snippets.

@pcornier
Last active December 6, 2021 16:33
Show Gist options
  • Select an option

  • Save pcornier/76bddf0f517fa1ed1c4b7be1329438eb to your computer and use it in GitHub Desktop.

Select an option

Save pcornier/76bddf0f517fa1ed1c4b7be1329438eb to your computer and use it in GitHub Desktop.
Verilator on Termux
curl -fsSL https://its-pointless.github.io/setup-pointless-repo.sh | bash -
apt install git clang binutils make autoconf flex bison python3
git clone http://git.veripool.org/git/verilator
cd verilator
autoconf
./configure --prefix=${PREFIX}
make
make install

test.cpp:

#include "Vtest.h"
#include "verilated.h"
int main(int argc, char** argv, char** env) {
  Verilated::commandArgs(argc, argv);
  Vtest* test = new Vtest;
  while (!Verilated::gotFinish()) { test->eval(); }
  delete test;
  exit(0);
}

test.v:

module test;
  initial
    begin
      $display("it works");
      $finish;
    end
endmodule
export VERILATOR_ROOT="${PREFIX}/../home/verilator"
verilator -Wall --cc test.v --exe test.cpp
make -j -C obj_dir -f Vtest.mk Vtest
obj_dir/Vtest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment