-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
242 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
-------------------------------------------------------------------------------- | ||
Multi-file Compilation | ||
-------------------------------------------------------------------------------- | ||
|
||
The ability to split a SystemRDL register model into several RDL files seems like | ||
an inherently useful way to manage a design that spans multiple components. | ||
|
||
Unfortunately, the SystemRDL 2.0 spec provides no insight on how "compilation units" | ||
are handled. Below are the assumptions I made to guide the implementation of this | ||
compiler. | ||
|
||
|
||
1. Each file is its own compilation unit | ||
---------------------------------------- | ||
|
||
Semantics: | ||
a. The contents of files included using one or more `include directives become | ||
part of the compilation unit of the file within which they are included. | ||
b. Declarations must be completed within the boundaries of a compilation unit. | ||
If there is a declaration that is incomplete at the end of a compilation unit, | ||
it shall be a compile error. | ||
c. Any Verilog-style preprocessor macros defined within a file are discarded at the | ||
end of the compilation unit. | ||
|
||
Rationale: | ||
Isolating each file provided to the compiler to a design unit reduces | ||
confusing scenarios where things like preprocessor macros 'leak' unexpectedly | ||
between files. | ||
|
||
|
||
2. SystemRDL namespaces are global across compilation units | ||
----------------------------------------------------------- | ||
The root scope of the official SystemRDL namespaces are shared across files. | ||
|
||
Specifically the three namespaces described in the SystemRDL 2.0 spec: | ||
a. Type namespace | ||
Component definitions, enum types, and struct types | ||
b. Element namespace | ||
In the $root scope, this is limited to signal instances. | ||
c. Property namespace | ||
User-defined properties declared in the root scope | ||
|
||
Reiterating the concepts described in section 5.1.4: types, elements, and properties | ||
shall be defined prior to being used. This is extended for compilation units and | ||
means that the order in which files are compiled matters. | ||
|
||
Rationale: | ||
If supporting multiple file compile, then sharing these namespaces is | ||
essential. | ||
Enforcing that file order honor that identifiers are defined prior to being | ||
used significantly simplifies the compiler design. | ||
|
||
|
||
3. Default property assignments are limited to the compilation unit | ||
------------------------------------------------------------------- | ||
|
||
Any default property assignments made in the root scope are limited to the | ||
current compilation unit. Default property assignments are discarded from the | ||
root scope at the end of each compilation unit. | ||
|
||
Rationale: | ||
Allowing default property assignments to carry over between files/compilation | ||
units would be incredibly confusing. | ||
A default property assignment in a prior design unit's root scope would | ||
inevitably influence all subsequent files, causing all kinds of unintended | ||
consequences. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.