This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
forked from TinyTapeout/tt06-verilog-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
172 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: wokwi_test | ||
# either manually started, or on a schedule | ||
on: [ push, workflow_dispatch ] | ||
jobs: | ||
wokwi_test: | ||
# ubuntu | ||
runs-on: ubuntu-latest | ||
steps: | ||
# need the repo checked out | ||
- name: checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
# install oss fpga tools | ||
- name: install oss-cad-suite | ||
uses: YosysHQ/setup-oss-cad-suite@v2 | ||
with: | ||
python-override: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- run: | | ||
yosys --version | ||
iverilog -V | ||
cocotb-config --libpython | ||
cocotb-config --python-bin | ||
- name: checkout tt tools repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: tinytapeout/tt-support-tools | ||
path: tt | ||
ref: tt06 | ||
|
||
# need python and requirements | ||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- run: pip install -r tt/requirements.txt | ||
|
||
# fetch the truth table | ||
- name: fetch Verilog and build config | ||
run: ./tt/tt_tool.py --create-user-config | ||
|
||
# does the wokwi project have a truthtable? | ||
- name: Check the truthtable exists | ||
id: check_files | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: "src/truthtable.md" | ||
|
||
- name: test | ||
if: steps.check_files.outputs.files_exists == 'true' | ||
run: | | ||
cd src | ||
make clean | ||
make | ||
# make will return success even if the test fails, so check for failure in the results.xml | ||
! grep failure results.xml | ||
- name: upload vcd | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-vcd | ||
path: src/*.vcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
This file provides the mapping from the Wokwi modules to Verilog HDL. | ||
It's only needed for Wokwi designs. | ||
*/ | ||
|
||
`define default_netname none | ||
|
||
module buffer_cell ( | ||
input wire in, | ||
output wire out | ||
); | ||
assign out = in; | ||
endmodule | ||
|
||
module and_cell ( | ||
input wire a, | ||
input wire b, | ||
output wire out | ||
); | ||
|
||
assign out = a & b; | ||
endmodule | ||
|
||
module or_cell ( | ||
input wire a, | ||
input wire b, | ||
output wire out | ||
); | ||
|
||
assign out = a | b; | ||
endmodule | ||
|
||
module xor_cell ( | ||
input wire a, | ||
input wire b, | ||
output wire out | ||
); | ||
|
||
assign out = a ^ b; | ||
endmodule | ||
|
||
module nand_cell ( | ||
input wire a, | ||
input wire b, | ||
output wire out | ||
); | ||
|
||
assign out = !(a&b); | ||
endmodule | ||
|
||
module not_cell ( | ||
input wire in, | ||
output wire out | ||
); | ||
|
||
assign out = !in; | ||
endmodule | ||
|
||
module mux_cell ( | ||
input wire a, | ||
input wire b, | ||
input wire sel, | ||
output wire out | ||
); | ||
|
||
assign out = sel ? b : a; | ||
endmodule | ||
|
||
module dff_cell ( | ||
input wire clk, | ||
input wire d, | ||
output reg q, | ||
output wire notq | ||
); | ||
|
||
assign notq = !q; | ||
always @(posedge clk) | ||
q <= d; | ||
|
||
endmodule | ||
|
||
module dffsr_cell ( | ||
input wire clk, | ||
input wire d, | ||
input wire s, | ||
input wire r, | ||
output reg q, | ||
output wire notq | ||
); | ||
|
||
assign notq = !q; | ||
|
||
always @(posedge clk or posedge s or posedge r) begin | ||
if (r) | ||
q <= 0; | ||
else if (s) | ||
q <= 1; | ||
else | ||
q <= d; | ||
end | ||
endmodule |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.