summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Koenig2021-07-07 16:56:35 -0700
committerGitHub2021-07-07 16:56:35 -0700
commit558df41db062a14f52617fc44edd0aff569afa67 (patch)
treeca560b875761ee798626dc55319d87e8240a5cde
parent503ae520e7f997bcbc639b79869c9a4214d402ed (diff)
Fix ChiselEnum docs (#2016)
Also add newline to end of `verilog` modifier code blocks so that there is always a newline between code blocks and following material.
-rw-r--r--docs-target/src/main/scala/chisel3/docs/VerilogMdocModifier.scala2
-rw-r--r--docs/src/explanations/chisel-enum.md7
2 files changed, 6 insertions, 3 deletions
diff --git a/docs-target/src/main/scala/chisel3/docs/VerilogMdocModifier.scala b/docs-target/src/main/scala/chisel3/docs/VerilogMdocModifier.scala
index a76e412a..f41fff73 100644
--- a/docs-target/src/main/scala/chisel3/docs/VerilogMdocModifier.scala
+++ b/docs-target/src/main/scala/chisel3/docs/VerilogMdocModifier.scala
@@ -27,7 +27,7 @@ class VerilogMdocModifier extends PostModifier {
case (None, _) => None
}
result match {
- case Some(content) => s"```verilog\n$content```"
+ case Some(content) => s"```verilog\n$content```\n"
case None => ""
}
}
diff --git a/docs/src/explanations/chisel-enum.md b/docs/src/explanations/chisel-enum.md
index 3f0f3b18..96fc9e8a 100644
--- a/docs/src/explanations/chisel-enum.md
+++ b/docs/src/explanations/chisel-enum.md
@@ -74,6 +74,7 @@ class AluMux1File extends Module {
}
}
```
+
```scala mdoc:verilog
ChiselStage.emitVerilog(new AluMux1File)
```
@@ -140,8 +141,9 @@ that the `UInt` could hit, you will see a warning like the following:
```scala mdoc:passthrough
val (log, _) = grabLog(ChiselStage.emitChirrtl(new FromUInt))
-println(s"```$log```")
+println(s"```\n$log```")
```
+
(Note that the name of the Enum is ugly as an artifact of our documentation generation flow, it will
be cleaner in normal use).
@@ -162,7 +164,7 @@ Now there will be no warning:
```scala mdoc:passthrough
val (log2, _) = grabLog(ChiselStage.emitChirrtl(new SafeFromUInt))
-println(s"```$log2```")
+println(s"```\n$log2```")
```
## Testing
@@ -181,6 +183,7 @@ def expectedSel(sel: AluMux1Sel.Type): Boolean = sel match {
```
Some additional useful methods defined on the `ChiselEnum` object are:
+
* `.all`: returns the enum values within the enumeration
* `.getWidth`: returns the width of the hardware type