60 lines
2 KiB
Ruby
60 lines
2 KiB
Ruby
class Verilator < Formula
|
|
desc "Verilog simulator"
|
|
homepage "http://www.veripool.org/wiki/verilator"
|
|
url "http://www.veripool.org/ftp/verilator-3.886.tgz"
|
|
sha256 "d21c882e0c079ade4b155cb4a763f7d246decead8b38d2d0aad8d1dd03e0f77d"
|
|
|
|
bottle do
|
|
sha256 "15e76edd90d337938bc7ab4aa65262f84bea0e829c518f0130277e7c7c83efff" => :sierra
|
|
sha256 "4c588bfd844073b06b638c543cd7b77a994702afde965a2943bcee7b46dbead2" => :el_capitan
|
|
sha256 "29b48507f10e9a315d93b6acc55cb4eb0b5f7e67ba74c67be5bb74c45a33e7b2" => :yosemite
|
|
end
|
|
|
|
head do
|
|
url "http://git.veripool.org/git/verilator", :using => :git
|
|
depends_on "automake" => :build
|
|
depends_on "autoconf" => :build
|
|
end
|
|
|
|
skip_clean "bin" # Allows perl scripts to keep their executable flag
|
|
|
|
# Needs a newer flex on Lion (and presumably below)
|
|
# http://www.veripool.org/issues/720-Verilator-verilator-not-building-on-Mac-OS-X-Lion-10-7-
|
|
depends_on "flex" if MacOS.version <= :lion
|
|
|
|
def install
|
|
system "autoconf" if build.head?
|
|
system "./configure", "--prefix=#{prefix}"
|
|
# `make` and `make install` need to be separate for parallel builds
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.v").write <<-EOS.undent
|
|
module test;
|
|
initial begin $display("Hello World"); $finish; end
|
|
endmodule
|
|
EOS
|
|
(testpath/"test.cpp").write <<-EOS.undent
|
|
#include "Vtest.h"
|
|
#include "verilated.h"
|
|
int main(int argc, char **argv, char **env) {
|
|
Verilated::commandArgs(argc, argv);
|
|
Vtest* top = new Vtest;
|
|
while (!Verilated::gotFinish()) { top->eval(); }
|
|
delete top;
|
|
exit(0);
|
|
}
|
|
EOS
|
|
system "/usr/bin/perl", bin/"verilator", "-Wall", "--cc", "test.v", "--exe", "test.cpp"
|
|
cd "obj_dir" do
|
|
system "make", "-j", "-f", "Vtest.mk", "Vtest"
|
|
expected = <<-EOS.undent
|
|
Hello World
|
|
- test.v:2: Verilog $finish
|
|
EOS
|
|
assert_equal expected, shell_output("./Vtest")
|
|
end
|
|
end
|
|
end
|