Skip to content
Snippets Groups Projects
Verified Commit 79ae3d38 authored by Minyong Li's avatar Minyong Li :speech_balloon:
Browse files

core.Adder: fix timing by using Z_{2^{32}} arithmetics

An addition is trivially synthesized to a ripple-carry adder. With
512b + 512b the carry chain is super long and delay becomes super
high. Although the results are same, now just use 16 32b ripple-
carry adders, which is also what the standards specify. Later a
faster adder may be considered.
parent 5bd73e7e
Branches
Tags
No related merge requests found
...@@ -10,5 +10,10 @@ class Adder extends MultiIOModule { ...@@ -10,5 +10,10 @@ class Adder extends MultiIOModule {
val rhs = IO(Input(UInt(512.W))) val rhs = IO(Input(UInt(512.W)))
val out = IO(Output(UInt(512.W))) val out = IO(Output(UInt(512.W)))
out := lhs + rhs private val _lhs = lhs.asTypeOf(Vec(16, UInt(32.W)))
private val _rhs = rhs.asTypeOf(Vec(16, UInt(32.W)))
private val _out = Wire(Vec(16, UInt(32.W)))
out := _out.asUInt()
_lhs.zip(_rhs).zip(_out).foreach { case ((l, r), o) => o := l + r }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment