forked from TinyTapeout/tt09-verilog-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
10 changed files
with
135 additions
and
9 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
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,13 @@ | ||
|
||
# Test the Chisel design | ||
run-test: | ||
sbt test | ||
|
||
# generate the Verilog | ||
run-verilog: | ||
sbt run | ||
|
||
# Configure the Basys3 with open source tools | ||
|
||
config: | ||
openocd -f 7series.txt |
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,37 @@ | ||
import chisel3._ | ||
|
||
/** | ||
* Example design in Chisel. | ||
* A redesign of the Tiny Tapeout example. | ||
*/ | ||
class ChiselTop() extends Module { | ||
val io = IO(new Bundle { | ||
val ui_in = Input(UInt(8.W)) // Dedicated inputs | ||
val uo_out = Output(UInt(8.W)) // Dedicated outputs | ||
val uio_in = Input(UInt(8.W)) // IOs: Input path | ||
val uio_out = Output(UInt(8.W)) // IOs: Output path | ||
val uio_oe = Output(UInt(8.W)) // IOs: Enable path (active high: 0=input, 1=output) | ||
val ena = Input(Bool()) // will go high when the design is enabled | ||
}) | ||
|
||
io.uio_out := 0.U | ||
// use bi-directionals as input | ||
io.uio_oe := 0.U | ||
|
||
val add = WireDefault(0.U(7.W)) | ||
add := io.ui_in + io.uio_in | ||
|
||
// Blink with 1 Hzq | ||
val cntReg = RegInit(0.U(32.W)) | ||
val ledReg = RegInit(0.U(1.W)) | ||
cntReg := cntReg + 1.U | ||
when (cntReg === 25000000.U) { | ||
cntReg := 0.U | ||
ledReg := ~ledReg | ||
} | ||
io.uo_out := ledReg ## add | ||
} | ||
|
||
object ChiselTop extends App { | ||
emitVerilog(new ChiselTop(), Array("--target-dir", "src")) | ||
} |
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 @@ | ||
/* | ||
* Copyright (c) 2024 Your Name | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
`define default_netname none | ||
|
||
module tt_um_example ( | ||
input wire [7:0] ui_in, // Dedicated inputs | ||
output wire [7:0] uo_out, // Dedicated outputs | ||
input wire [7:0] uio_in, // IOs: Input path | ||
output wire [7:0] uio_out, // IOs: Output path | ||
output wire [7:0] uio_oe, // IOs: 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 | ||
); | ||
|
||
// All output pins must be assigned. If not used, assign to 0. | ||
// assign uo_out = ui_in + uio_in; // Example: ou_out is the sum of ui_in and uio_in | ||
// assign uio_out = 0; | ||
// assign uio_oe = 0; | ||
wire reset = !rst_n; | ||
// Just wrap the Chisel generated Verilog | ||
|
||
ChiselTop ChiselTop(.clock(clk), | ||
.reset(reset), | ||
.io_ui_in(ui_in), | ||
.io_uo_out(uo_out), | ||
.io_uio_in(uio_in), | ||
.io_uio_out(uio_out), | ||
.io_uio_oe(uio_oe), | ||
.io_ena(ena)); | ||
|
||
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
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