forked from sysprog21/ca2025-mycpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
147 lines (138 loc) · 5.43 KB
/
build.sbt
File metadata and controls
147 lines (138 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// SPDX-License-Identifier: MIT
// MyCPU is freely redistributable under the MIT License. See the file
// "LICENSE" for information on usage and redistribution of this file.
ThisBuild / scalaVersion := "2.13.10"
ThisBuild / version := "0.1.0"
ThisBuild / organization := "tw.edu.ncku"
val chiselVersion = "3.6.1"
// Root aggregate project
lazy val root = (project in file("."))
.aggregate(common, minimal, singleCycle, mmioTrap, pipeline, soc)
.settings(
name := "mycpu-root"
)
// Common shared module - hardware modules used by multiple projects
lazy val common = (project in file("common"))
.settings(
name := "mycpu-common",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test",
"edu.berkeley.cs" %% "firrtl" % "1.6.0",
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-feature",
"-Xcheckinit",
// Suppress deprecation warnings for legacy FIRRTL compiler usage
// Shared module intentionally uses FIRRTL 1.6.0 for compatibility
"-Wconf:cat=deprecation:s",
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
)
// 0-minimal: Minimal CPU supporting only jit.s (AUIPC, ADDI, LW, SW, JALR, ECALL)
lazy val minimal = (project in file("0-minimal"))
.settings(
name := "mycpu-minimal",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test",
"edu.berkeley.cs" %% "firrtl" % "1.6.0",
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-feature",
"-Xcheckinit",
"-Wconf:cat=deprecation:s",
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
Test / fork := true,
Test / javaOptions += s"-Duser.dir=${(ThisBuild / baseDirectory).value}/0-minimal",
)
// 1-single-cycle: Basic RV32I single-cycle processor
lazy val singleCycle = (project in file("1-single-cycle"))
.dependsOn(common)
.settings(
name := "mycpu-single-cycle",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test",
"edu.berkeley.cs" %% "firrtl" % "1.6.0",
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-feature",
"-Xcheckinit",
"-Wconf:cat=deprecation:s",
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
Test / fork := true,
Test / javaOptions += s"-Duser.dir=${(ThisBuild / baseDirectory).value}/1-single-cycle",
)
// 2-mmio-trap: Single-cycle with MMIO peripherals and trap handling
lazy val mmioTrap = (project in file("2-mmio-trap"))
.dependsOn(common)
.settings(
name := "mycpu-mmio-trap",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test",
"edu.berkeley.cs" %% "firrtl" % "1.6.0",
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-feature",
"-Xcheckinit",
"-Wconf:cat=deprecation:s",
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
Test / fork := true,
Test / javaOptions += s"-Duser.dir=${(ThisBuild / baseDirectory).value}/2-mmio-trap",
)
// 3-pipeline: Pipelined processor with forwarding
// Note: Does not depend on common due to architectural differences:
// - RegisterFile requires write forwarding for pipeline optimization
// - Parameters needs 4 implementation types (3-stage, 5-stage × 3 variants)
// - These differences are fundamental to the pipelined architecture
lazy val pipeline = (project in file("3-pipeline"))
.settings(
name := "mycpu-pipeline",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test",
"edu.berkeley.cs" %% "firrtl" % "1.6.0",
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-feature",
"-Xcheckinit",
"-Wconf:cat=deprecation:s",
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
Test / fork := true,
Test / javaOptions += s"-Duser.dir=${(ThisBuild / baseDirectory).value}/3-pipeline",
)
// 4-soc: System-on-Chip with AXI4-Lite bus, VGA, UART, and branch prediction
// Complete implementation without exercises - extends pipelined core with:
// - AXI4-Lite bus protocol for standardized peripheral access
// - VGA controller with 640x480@72Hz output and double-buffered framebuffer
// - UART controller with TX/RX buffering at 115200 baud
// - Branch prediction: BTB (32-entry) + RAS (4-entry) + IndirectBTB (8-entry)
lazy val soc = (project in file("4-soc"))
.settings(
name := "mycpu-soc",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test",
"edu.berkeley.cs" %% "firrtl" % "1.6.0",
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-feature",
"-Xcheckinit",
"-Wconf:cat=deprecation:s",
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
Test / fork := true,
Test / javaOptions += s"-Duser.dir=${(ThisBuild / baseDirectory).value}/4-soc",
)