diff --git a/flake.nix b/flake.nix index 0561e2b..8a9b2f0 100644 --- a/flake.nix +++ b/flake.nix @@ -15,9 +15,9 @@ vflags = ''-Wpedantic -Wwarn-lint -Wwarn-style -Wno-PINCONNECTEMPTY -CFLAGS "-Wpedantic -std=c++20"''; verilate-src = cmd: '' - cp -r ${./verilog-src} ./verilog-src + cp -r ${./src} ./src cp -r ${./simulation} ./simulation - find ./verilog-src/ -name '*.v' -exec ${verilator}/bin/verilator ${vflags} ${cmd} {} + + find ./src/ -name '*.v' -exec ${verilator}/bin/verilator ${vflags} ${cmd} {} + ''; lint = pkgs.runCommand "lint" {} '' @@ -27,14 +27,14 @@ ''; alu-sim = pkgs.runCommandCC "alu-sim" {} '' - ${verilate-src "--cc --build --exe ./simulation/tester.cpp ./simulation/test_alu.cpp"} + ${verilate-src "--cc --build --exe ./simulation/tester.cpp ./simulation/test_alu.cpp -top alu"} mv obj_dir "$out" mkdir "$out/bin" && cp "$out/Valu" "$out/bin/alu-sim" ''; alu-synth = pkgs.runCommandCC "alu-synth" {} '' mkdir -p "$out" - find ${./verilog-src} -name '*.v' -exec ${yosys}/bin/yosys -Q -p "synth_ice40 -top topmost -json $out/synth.json -dsp" {} + + find ${./src} -name '*.v' -exec ${yosys}/bin/yosys -Q -p "synth_ice40 -top topmost -json $out/synth.json -dsp" {} + ''; alu-synth-view = pkgs.writeScriptBin "alu-synth-view" '' diff --git a/verilog-src/alu.v b/src/alu/alu.v similarity index 100% rename from verilog-src/alu.v rename to src/alu/alu.v diff --git a/verilog-src/alu/carry_select_adder.v b/src/alu/carry_select_adder.v similarity index 100% rename from verilog-src/alu/carry_select_adder.v rename to src/alu/carry_select_adder.v diff --git a/verilog-src/alu/carry_select_block.v b/src/alu/carry_select_block.v similarity index 100% rename from verilog-src/alu/carry_select_block.v rename to src/alu/carry_select_block.v diff --git a/verilog-src/alu/fa.v b/src/alu/fa.v similarity index 100% rename from verilog-src/alu/fa.v rename to src/alu/fa.v diff --git a/verilog-src/alu/multiplier.v b/src/alu/multiplier.v similarity index 100% rename from verilog-src/alu/multiplier.v rename to src/alu/multiplier.v diff --git a/verilog-src/topmost.v b/src/topmost.v similarity index 100% rename from verilog-src/topmost.v rename to src/topmost.v