summaryrefslogtreecommitdiff
path: root/docs/src/wiki-deprecated/troubleshooting.md
diff options
context:
space:
mode:
authorAdam Izraelevitz2020-08-21 12:02:26 -0700
committerGitHub2020-08-21 19:02:26 +0000
commit7edba2d10f980016462f917c6d21d64585ddfd6b (patch)
tree3eb2a106b0e528b1ae8ed05b54200f828902de09 /docs/src/wiki-deprecated/troubleshooting.md
parent70fd01d4b0ad18a87bc46558ff246254792aa9b8 (diff)
Added website docs and mdoc. (#1560)
* Added website docs and mdoc. Removed all warnings * Updated README and added build to circle ci * Added how to build documentation, deprecated wiki * Fix copypasta Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'docs/src/wiki-deprecated/troubleshooting.md')
-rw-r--r--docs/src/wiki-deprecated/troubleshooting.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/docs/src/wiki-deprecated/troubleshooting.md b/docs/src/wiki-deprecated/troubleshooting.md
new file mode 100644
index 00000000..333adec4
--- /dev/null
+++ b/docs/src/wiki-deprecated/troubleshooting.md
@@ -0,0 +1,57 @@
+---
+layout: docs
+title: "Troubleshooting"
+section: "chisel3"
+---
+This page is a starting point for recording common and not so common problems in developing with Chisel3. In particular, those situations where there is a work around that will keep you going.
+
+### `type mismatch` specifying width/value of a `UInt`/`SInt`
+
+*I have some old code that used to work correctly in chisel2 (and still does if I use the `import Chisel._` compatibility layer)
+but causes a `type mismatch` error in straight chisel3:*
+
+```scala
+class TestBlock extends Module {
+ val io = IO(new Bundle {
+ val output = Output(UInt(width=3))
+ })
+}
+```
+*produces*
+```bash
+type mismatch;
+[error] found : Int(3)
+[error] required: chisel3.internal.firrtl.Width
+[error] val output = Output(UInt(width=3))
+```
+
+The single argument, multi-function object/constructors from chisel2 have been removed from chisel3.
+It was felt these were too prone to error and made it difficult to diagnose error conditions in chisel3 code.
+
+In chisel3, the single argument to the `UInt`/`SInt` object/constructor specifies the *width* and must be a `Width` type.
+Although there are no automatic conversions from `Int` to `Width`, an `Int` may be converted to a `Width` by applying the `W` method to an `Int`.
+In chisel3, the above code becomes:
+```scala
+class TestBlock extends Module {
+ val io = IO(new Bundle {
+ val output = Output(UInt(3.W))
+ })
+}
+```
+`UInt`/`SInt` literals may be created from an `Int` with the application of either the `U` or `S` method.
+
+```scala
+UInt(42)
+```
+in chisel2, becomes
+```scala
+42.U
+```
+in chisel3
+
+A literal with a specific width is created by calling the `U` or `S` method with a `W` argument.
+Use:
+```scala
+1.S(8.W)
+```
+to create an 8-bit wide (signed) literal with value 1.