File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # This workflow uses actions that are not certified by GitHub.
2+ # They are provided by a third-party and are governed by
3+ # separate terms of service, privacy policy, and support
4+ # documentation.
5+
6+ name : Scala CI
7+
8+ on :
9+ push :
10+ branches : [ "master" ]
11+ pull_request :
12+ branches : [ "master" ]
13+
14+ permissions :
15+ contents : read
16+
17+ jobs :
18+ build :
19+
20+ runs-on : ubuntu-latest
21+
22+ steps :
23+
24+ - uses : actions/checkout@v4
25+ - name : Set up JDK 11
26+ uses : actions/setup-java@v4
27+ with :
28+ java-version : ' 11'
29+ distribution : ' temurin'
30+ - name : Setup sbt
31+ uses : sbt/setup-sbt@v1
32+ - name : Run tests
33+ run : sbt test
Original file line number Diff line number Diff line change 1+ # Generate Verilog code
2+ doit :
3+ sbt run
4+
5+ # Run the test
6+ test :
7+ sbt test
8+
9+ clean :
10+ git clean -fd
11+
Original file line number Diff line number Diff line change 1+ # chisel-empty
2+
3+ An almost empty chisel project (and adder) as a starting point for hardware design.
4+
5+ To generate Verilog code for the adder execute:
6+ ``` bash
7+ make
8+ ```
9+
10+ Run the tests with:
11+ ``` bash
12+ make test
13+ ```
14+
15+ Cleanup the repository with:
16+ ``` bash
17+ make clean
18+ ```
Original file line number Diff line number Diff line change 1+ scalacOptions ++= Seq (
2+ " -deprecation" ,
3+ " -feature" ,
4+ " -unchecked" ,
5+ // "-Xfatal-warnings",
6+ " -language:reflectiveCalls" ,
7+ )
8+
9+ scalaVersion := " 2.13.14"
10+ val chiselVersion = " 3.6.1"
11+ addCompilerPlugin(" edu.berkeley.cs" %% " chisel3-plugin" % chiselVersion cross CrossVersion .full)
12+ libraryDependencies += " edu.berkeley.cs" %% " chisel3" % chiselVersion
13+ libraryDependencies += " edu.berkeley.cs" %% " chiseltest" % " 0.6.2"
14+
15+
16+ /*
17+ scalaVersion := "2.13.14"
18+ val chiselVersion = "6.5.0"
19+ addCompilerPlugin("org.chipsalliance" % "chisel-plugin" % chiselVersion cross CrossVersion.full)
20+ libraryDependencies += "org.chipsalliance" %% "chisel" % chiselVersion
21+ libraryDependencies += "edu.berkeley.cs" %% "chiseltest" % "6.0.0"
22+ */
Original file line number Diff line number Diff line change 1+ PROJECT_REVISION = "add"
Original file line number Diff line number Diff line change 1+ set_global_assignment -name FAMILY "Cyclone IV E"
2+ set_global_assignment -name DEVICE EP4CE115F29C7
3+
4+ set_global_assignment -name TOP_LEVEL_ENTITY Add
5+ set_global_assignment -name VERILOG_FILE ../generated/Add.v
6+ set_global_assignment -name VERILOG_MACRO "SYNTHESIS=<None>"
7+
8+ set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
9+ set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
10+ set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
11+ set_global_assignment -name USE_CONFIGURATION_DEVICE OFF
12+ set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVCMOS"
13+
14+
15+ set_location_assignment PIN_Y2 -to clock
16+
17+ set_global_assignment -name LAST_QUARTUS_VERSION "16.1.0 Lite Edition"
18+ set_global_assignment -name RESERVE_ALL_UNUSED_PINS "AS INPUT TRI-STATED WITH WEAK PULL-UP"
19+
20+
21+ set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
Original file line number Diff line number Diff line change 1+ /*
2+ * Dummy file to start a Chisel project.
3+ *
4+ * Author: Martin Schoeberl (martin@jopdesign.com)
5+ *
6+ */
7+
8+ package empty
9+
10+ import chisel3 ._
11+ // import chisel3.util._
12+
13+ class Add extends Module {
14+ val io = IO (new Bundle {
15+ val a = Input (UInt (8 .W ))
16+ val b = Input (UInt (8 .W ))
17+ val c = Output (UInt (8 .W ))
18+ })
19+
20+ val reg = RegInit (0 .U (8 .W ))
21+ reg := io.a + io.b
22+
23+ io.c := reg
24+ }
25+
26+ object AddMain extends App {
27+ println(" Generating the adder hardware" )
28+ emitVerilog(new Add (), Array (" --target-dir" , " generated" ))
29+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Dummy tester to start a Chisel project.
3+ *
4+ * Author: Martin Schoeberl (martin@jopdesign.com)
5+ *
6+ */
7+
8+ package empty
9+
10+ import chisel3 ._
11+ import chiseltest ._
12+ import org .scalatest .flatspec .AnyFlatSpec
13+
14+ class AddTester extends AnyFlatSpec with ChiselScalatestTester {
15+
16+ " Add" should " work" in {
17+ test(new Add ) { dut =>
18+ for (a <- 0 to 2 ) {
19+ for (b <- 0 to 3 ) {
20+ val result = a + b
21+ dut.io.a.poke(a.U )
22+ dut.io.b.poke(b.U )
23+ dut.clock.step(1 )
24+ dut.io.c.expect(result.U )
25+ }
26+ }
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments