generated from TinyTapeout/tt05-submission-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created skeleton for SN76489 PSG chip implementation
- Loading branch information
Showing
5 changed files
with
168 additions
and
27 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 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,36 @@ | ||
# Makefile | ||
# See https://docs.cocotb.org/en/stable/quickstart.html for more info | ||
|
||
# defaults | ||
SIM ?= icarus | ||
TOPLEVEL_LANG ?= verilog | ||
|
||
# normal simulation | ||
ifneq ($(GATES),yes) | ||
|
||
# this is the only part you should need to modify: | ||
VERILOG_SOURCES += $(PWD)/tb.v $(PWD)/tt_um_rejunity_sn76489.v | ||
|
||
else | ||
|
||
# gate level simulation requires some extra setup, you shouldn't need to touch this | ||
COMPILE_ARGS += -DGL_TEST | ||
COMPILE_ARGS += -DFUNCTIONAL | ||
COMPILE_ARGS += -DUSE_POWER_PINS | ||
COMPILE_ARGS += -DSIM | ||
COMPILE_ARGS += -DUNIT_DELAY=\#1 | ||
VERILOG_SOURCES += $(PDK_ROOT)/sky130A/libs.ref/sky130_fd_sc_hd/verilog/primitives.v | ||
VERILOG_SOURCES += $(PDK_ROOT)/sky130A/libs.ref/sky130_fd_sc_hd/verilog/sky130_fd_sc_hd.v | ||
|
||
# this gets copied in by the GDS action workflow | ||
VERILOG_SOURCES += $(PWD)/tb.v $(PWD)/gate_level_netlist.v | ||
endif | ||
|
||
# TOPLEVEL is the name of the toplevel module in your Verilog or VHDL file | ||
TOPLEVEL = tb | ||
|
||
# MODULE is the basename of the Python test file | ||
MODULE = test | ||
|
||
# include cocotb's make rules to take care of the simulator setup | ||
include $(shell cocotb-config --makefiles)/Makefile.sim |
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,46 @@ | ||
`default_nettype none | ||
`timescale 1ns/1ps | ||
|
||
/* | ||
this testbench just instantiates the module and makes some convenient wires | ||
that can be driven / tested by the cocotb test.py | ||
*/ | ||
|
||
// testbench is controlled by test.py | ||
module tb (); | ||
|
||
// this part dumps the trace to a vcd file that can be viewed with GTKWave | ||
initial begin | ||
$dumpfile ("tb.vcd"); | ||
$dumpvars (0, tb); | ||
#1; | ||
end | ||
|
||
// wire up the inputs and outputs | ||
wire [7:0] ui_in; | ||
wire [7:0] uo_out; | ||
wire [7:0] uio_in; | ||
wire [7:0] uio_out; | ||
wire [7:0] uio_oe; | ||
wire clk; | ||
wire rst_n; | ||
wire ena; | ||
|
||
tt_um_rejunity_sn76489 tt_um_rejunity_sn76489_uut | ||
( | ||
// include power ports for the Gate Level test | ||
`ifdef GL_TEST | ||
.VPWR( 1'b1), | ||
.VGND( 1'b0), | ||
`endif | ||
.ui_in (ui_in), // Dedicated inputs | ||
.uo_out (uo_out), // Dedicated outputs | ||
.uio_in (uio_in), // IOs: Input path | ||
.uio_out (uio_out), // IOs: Output path | ||
.uio_oe (uio_oe), // IOs: Enable path (active high: 0=input, 1=output) | ||
.ena (ena), // enable - goes high when design is selected | ||
.clk (clk), // clock | ||
.rst_n (rst_n) // not reset | ||
); | ||
|
||
endmodule |
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,26 @@ | ||
import cocotb | ||
from cocotb.clock import Clock | ||
from cocotb.triggers import RisingEdge, FallingEdge, Timer, ClockCycles | ||
|
||
|
||
|
||
@cocotb.test() | ||
async def test_rule110_automata(dut): | ||
|
||
dut._log.info("start") | ||
clock = Clock(dut.clk, 10, units="us") | ||
cocotb.start_soon(clock.start()) | ||
|
||
dut._log.info("reset") | ||
dut.rst_n.value = 0 | ||
await ClockCycles(dut.clk, 10) | ||
dut.rst_n.value = 1 | ||
|
||
dut._log.info("run") | ||
for i in range(32): | ||
await ClockCycles(dut.clk, 1) | ||
print( | ||
#dut.uio_out.value, | ||
dut.uo_out.value) | ||
|
||
dut._log.info("done") |
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,35 @@ | ||
`default_nettype none | ||
|
||
module tt_um_rejunity_sn76489 #( parameter NUM_VOICES = 3 ) ( | ||
input wire [7:0] ui_in, // Dedicated inputs - connected to the input switches | ||
output wire [7:0] uo_out, // Dedicated outputs - connected to the 7 segment display | ||
input wire [7:0] uio_in, // IOs: Bidirectional Input path | ||
output wire [7:0] uio_out, // IOs: Bidirectional Output path | ||
output wire [7:0] uio_oe, // IOs: Bidirectional Enable path (active high: 0=input, 1=output) | ||
input wire ena, // will go high when the design is enabled | ||
input wire clk, // clock | ||
input wire rst_n // reset_n - low to reset | ||
); | ||
assign uo_out[7:0] = {8{1'b0}}; | ||
assign uio_oe[7:0] = {8{1'b1}}; // Bidirectional path set to output | ||
assign uio_out[7:0] = {8{1'b0}}; | ||
wire reset = ! rst_n; | ||
|
||
always @(posedge clk) begin | ||
if (reset) begin | ||
end else begin | ||
end | ||
end | ||
|
||
genvar i; | ||
generate | ||
for (i = 0; i < NUM_VOICES; i = i + 1) begin | ||
end | ||
endgenerate | ||
|
||
wire snd_out; | ||
assign snd_out = 0; | ||
assign uo_out[0] = snd_out; | ||
|
||
|
||
endmodule |