You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[core] Deprecate BlackBox in favor of ExtModule (#5103)
Deprecate BlackBox and tell users to switch to ExtModule. BlackBox has a
ton of baggage associated with it, due to it mandating, at runtime, a
single `val io` call and no additional calls to `IO` while also magically
removing the `io_` prefix in the generated FIRRTL. `ExtModule` is far
cleaner and works as a user would expect. You can call `IO` as much as
you want. No magic prefixing happens.
This is slightly unfortunate as one could argue that `BlackBox` is a good
name. However, you can also argue (more strongly I would add) that this
is an "external module" and it would be better to call it as such. If
this is controversial, we can consider a migration back from `ExtModule`
to `BlackBox`.
Migrate some tests that were only testing blackboxes to be duplicated in
the external module tests. This will allow us to just delete this test
later.
This has three motivations:
1. `BlackBox` has always been janky for the reasons above and `ExtModule`
is the saner generator API.
2. It's bad to have two similar, though subtly different ways of doing
things.
3. The singular IO that `BlackBox` forces users to go through means that
`BlackBox` cannot have domain information attached to it. This
essentially means that `BlackBox` will be essentially unusable until
domains gain support for being in subfields. It's easier to just
deprecate `BlackBox` than to require that domains gain this complicated
feature addition just now.
Signed-off-by: Schuyler Eldridge <[email protected]>
Copy file name to clipboardExpand all lines: docs/src/appendix/experimental-features.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,6 @@ Chisel has a number of new features that are worth checking out. This page is a
16
16
The standard Chisel *Module* requires a `val io = IO(...)`, the experimental package introduces several
17
17
new ways of defining Modules
18
18
- BaseModule: no contents, instantiable
19
-
- BlackBox extends BaseModule
20
19
- UserDefinedModule extends BaseModule: this module can contain Chisel RTL. No default clock or reset lines. No default IO. - User should be able to specify non-io ports, ideally multiple of them.
21
20
- ImplicitModule extends UserModule: has clock, reset, and io, essentially current Chisel Module.
22
21
- RawModule: will be the user-facing version of UserDefinedModule
### Providing Implementations for External Modules
58
56
59
-
Chisel provides the following ways of delivering the code underlying the blackbox. Consider the following blackbox that
57
+
Chisel provides the following ways of delivering the code underlying the external module. Consider the following external module that
60
58
adds two real numbers together. The numbers are represented in chisel3 as 64-bit unsigned integers.
61
59
62
60
```scala mdoc:silent:reset
63
61
importchisel3._
64
-
classBlackBoxRealAddextendsBlackBox {
65
-
valio=IO(newBundle {
66
-
valin1=Input(UInt(64.W))
67
-
valin2=Input(UInt(64.W))
68
-
valout=Output(UInt(64.W))
69
-
})
62
+
classExtModuleRealAddextendsExtModule {
63
+
valin1=IO(Input(UInt(64.W)))
64
+
valin2=IO(Input(UInt(64.W)))
65
+
valout=IO(Output(UInt(64.W)))
70
66
}
71
67
```
72
68
73
69
The implementation is described by the following verilog
74
70
75
71
```verilog
76
-
module BlackBoxRealAdd(
72
+
module ExtModuleRealAdd(
77
73
input [63:0] in1,
78
74
input [63:0] in2,
79
75
output reg [63:0] out
@@ -84,20 +80,17 @@ module BlackBoxRealAdd(
84
80
endmodule
85
81
```
86
82
87
-
### Blackboxes with Verilog in a Resource File
83
+
### External Modules with Verilog in a Resource File
88
84
89
-
In order to deliver the verilog snippet above to the backend simulator, chisel3 provides the following tools based on the chisel/firrtl[annotation system](../explanations/annotations). Add the trait `HasBlackBoxResource` to the declaration, and then call a function in the body to say where the system can find the verilog. The Module now looks like
85
+
In order to deliver the Verilog snippet above to the backend simulator, chisel3 provides the following tools basedf on the Chisel/FIRRTL[annotation system](../explanations/annotations) via methods that are already available on `ExtModule`. To include a Java resource, use `addResource`:
0 commit comments