Skip to content

Replace deprecated usage of Vec(initVals) with VecInit(initVals). #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/scala/examples/Router.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Packet extends Bundle {
*
* @param n is the number of fanned outputs for the routed packet
*/
class RouterIO(n: Int) extends Bundle {
class RouterIO(val n: Int) extends Bundle {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious as to why this became a val, I can't see a reference to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto clone type (rightly) complains about bundle parameters that aren't immutable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks.

val read_routing_table_request = DeqIO(new ReadCmd())
val read_routing_table_response = EnqIO(UInt(Router.addressWidth.W))
val load_routing_table_request = DeqIO(new WriteCmd())
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/problems/VecShiftRegisterSimple.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class VecShiftRegisterSimple extends Module {
})

val initValues = Seq.fill(4) { 0.U(8.W) }
val delays = RegInit(Vec(initValues))
val delays = RegInit(VecInit(initValues))

// Implement below ----------

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/solutions/Mul.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Mul extends Module {
for (i <- 0 until 16)
for (j <- 0 until 16)
mulsValues += (i * j).asUInt(8.W)
val tbl = Vec(mulsValues)
val tbl = VecInit(mulsValues)
io.z := tbl((io.x << 4.U) | io.y)

}
2 changes: 1 addition & 1 deletion src/main/scala/solutions/VecShiftRegisterParam.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VecShiftRegisterParam(val n: Int, val w: Int) extends Module {
})

val initValues = Seq.fill(n) { 0.U(w.W) }
val delays = RegInit(Vec(initValues))
val delays = RegInit(VecInit(initValues))

for (i <- n-1 to 1 by -1) {
delays(i) := delays(i - 1)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/solutions/VecShiftRegisterSimple.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class VecShiftRegisterSimple extends Module {
})

val initValues = Seq.fill(4) { 0.U(8.W) }
val delays = RegInit(Vec(initValues))
val delays = RegInit(VecInit(initValues))

delays(0) := io.in
delays(1) := delays(0)
Expand Down