summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util
diff options
context:
space:
mode:
authorMartin Schoeberl2019-02-19 14:30:11 -0800
committerSchuyler Eldridge2019-02-19 17:30:11 -0500
commite89ed8f052ffcfd12b27bd201e0d976e362159f8 (patch)
tree1cfd8085226f158a0809fce5d2e1bf281640f376 /src/main/scala/chisel3/util
parentc7d095eed6dca1ff7308201912abd4eff2416055 (diff)
Documentation for Reg utilities (#1018)
Diffstat (limited to 'src/main/scala/chisel3/util')
-rw-r--r--src/main/scala/chisel3/util/Reg.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/util/Reg.scala b/src/main/scala/chisel3/util/Reg.scala
index 34d22a07..2101f998 100644
--- a/src/main/scala/chisel3/util/Reg.scala
+++ b/src/main/scala/chisel3/util/Reg.scala
@@ -6,6 +6,10 @@ import chisel3._
object RegEnable {
/** Returns a register with the specified next, update enable gate, and no reset initialization.
+ *
+ * @example {{{
+ * val regWithEnable = RegEnable(nextVal, ena)
+ * }}}
*/
def apply[T <: Data](next: T, enable: Bool): T = {
val r = Reg(chiselTypeOf(next))
@@ -14,6 +18,10 @@ object RegEnable {
}
/** Returns a register with the specified next, update enable gate, and reset initialization.
+ *
+ * @example {{{
+ * val regWithEnableAndReset = RegEnable(nextVal, 0.U, ena)
+ * }}}
*/
def apply[T <: Data](next: T, init: T, enable: Bool): T = {
val r = RegInit(init)
@@ -29,6 +37,10 @@ object ShiftRegister
* @param in input to delay
* @param n number of cycles to delay
* @param en enable the shift
+ *
+ * @example {{{
+ * val regDelayTwo = ShiftRegister(nextVal, 2, ena)
+ * }}}
*/
def apply[T <: Data](in: T, n: Int, en: Bool = true.B): T = {
// The order of tests reflects the expected use cases.
@@ -45,6 +57,10 @@ object ShiftRegister
* @param n number of cycles to delay
* @param resetData reset value for each register in the shift
* @param en enable the shift
+ *
+ * @example {{{
+ * val regDelayTwoReset = ShiftRegister(nextVal, 2, 0.U, ena)
+ * }}}
*/
def apply[T <: Data](in: T, n: Int, resetData: T, en: Bool): T = {
// The order of tests reflects the expected use cases.