Skip to content

Commit

Permalink
feat(chisel-practice): add "projects" package
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlekcahdp4 authored and serjzimmerman committed Apr 13, 2024
1 parent 7b4563b commit 78aa017
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
15 changes: 14 additions & 1 deletion projects/chisel-practice/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NEXTPNR_FREQ = 27.00
.DEFAULT_GOAL := all
.PHONY := clean all

all: blinky.fs sevenseg.fs
all: blinky.fs sevenseg.fs countcomb.fs

generated/blinky/Top.sv:
$(SBT) "runMain blinky.BlinkyVerilog"
Expand Down Expand Up @@ -39,5 +39,18 @@ pnrsevenseg.json: sevenseg.json
sevenseg.fs: pnrsevenseg.json
$(APICULA) -d $(NEXTPNR_FAMILY) -o sevenseg.fs pnrsevenseg.json

generated/projects/SevenSegTop.sv: ./src/main/scala/projects/CountCombinations.scala
$(SBT) "runMain projects.CountCombinationsVerilog"

countcomb.json: generated/projects/SevenSegTop.sv
$(YOSYS) -p "read_verilog -sv generated/projects/SevenSegTop.sv; synth_gowin -json countcomb.json"

pnrcountcomb.json: countcomb.json
$(NEXTPNR) --freq $(NEXTPNR_FREQ) --json countcomb.json --write pnrcountcomb.json --device $(NEXTPNR_DEVICE) \
--family $(NEXTPNR_FAMILY) --cst boards/tangnano9k.cst

countcomb.fs: pnrcountcomb.json
$(APICULA) -d $(NEXTPNR_FAMILY) -o countcomb.fs pnrcountcomb.json

clean:
rm -rf target/ *.fs *.json generated/
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SevenSegTop(

object SevenSegVerilog extends App {
ChiselStage.emitSystemVerilogFile(
new SevenSegTop(4, 6, 270_000, 2_700_000, 128),
new SevenSegTop(4, 6, 270_000, 2_700_000, 0xffff),
args = Array("--target-dir", "generated/blinky"),
firtoolOpts = Array(
"--disable-all-randomization",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package projects

import util.ClockDivider
import blinky.SevenSegTop
import chisel3._
import chisel3.util.Counter
import circt.stage.ChiselStage


object CountCombinationsVerilog extends App {
ChiselStage.emitSystemVerilogFile(
new SevenSegTop(4, 6, 270_000, 2_700_000, 0xffff),
args = Array("--target-dir", "generated/projects"),
firtoolOpts = Array(
"--disable-all-randomization",
"--strip-debug-info",
"--lowering-options=disallowLocalVariables,disallowPackedArrays"
)
)
}

0 comments on commit 78aa017

Please sign in to comment.