-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from antmicro/test_flatten
Test flatten option
- Loading branch information
Showing
6 changed files
with
220 additions
and
12 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (C) 2020 The SymbiFlow Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
`include "halfAdder.v" | ||
|
||
module fullAdder ( | ||
output wire cout, s, | ||
input wire cin, x, y | ||
); | ||
wire c1, c2, s1; | ||
|
||
halfAdder h1(c1, s1, x, y); | ||
halfAdder h2(c2, s, cin, s1); | ||
|
||
assign cout = c1 | c2; | ||
|
||
endmodule |
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,27 @@ | ||
/* | ||
* Copyright (C) 2020 The SymbiFlow Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
module halfAdder ( | ||
output wire c, s, | ||
input wire x, y | ||
); | ||
|
||
assign s = x ^ y; | ||
assign c = x & y; | ||
|
||
endmodule |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
Test Flatten Option | ||
=================== | ||
|
||
This test checks whether a ``:flatten:`` option in the ``hdl-diagram`` | ||
directive works as intended. The ``:flatten:`` option is used to resolve | ||
the black boxes created by Yosys in place of instantiated modules. | ||
With this option enabled Yosys will convert everything into low-level logic | ||
where only basic logic cells and basic FPGA primitives will be used. | ||
|
||
Netlistsvg Diagram | ||
------------------ | ||
|
||
Here is the diagram of a half-adder with its RST code:: | ||
|
||
.. hdl-diagram:: halfAdder.v | ||
:type: netlistsvg | ||
:module: halfAdder | ||
|
||
.. hdl-diagram:: halfAdder.v | ||
:type: netlistsvg | ||
:module: halfAdder | ||
|
||
The diagram below has been created without the ``:flatten:`` option:: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: netlistsvg | ||
:module: fullAdder | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: netlistsvg | ||
:module: fullAdder | ||
|
||
The diagram below has been created using the ``:flatten:`` option. | ||
You can see that the ``halfAdder`` black box is substituted by the appropriate | ||
logic elements:: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: netlistsvg | ||
:module: fullAdder | ||
:flatten: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: netlistsvg | ||
:module: fullAdder | ||
:flatten: | ||
|
||
Yosys BlackBox Diagram | ||
---------------------- | ||
|
||
Here is the diagram of a half-adder with its RST code:: | ||
|
||
.. hdl-diagram:: halfAdder.v | ||
:type: yosys-blackbox | ||
:module: halfAdder | ||
|
||
.. hdl-diagram:: halfAdder.v | ||
:type: yosys-blackbox | ||
:module: halfAdder | ||
|
||
The diagram below has been created without the ``:flatten:`` option:: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-blackbox | ||
:module: fullAdder | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-blackbox | ||
:module: fullAdder | ||
|
||
The diagram below has been created using the ``:flatten:`` option. | ||
You can see that the ``halfAdder`` black box is substituted by the appropriate | ||
logic elements:: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-blackbox | ||
:module: fullAdder | ||
:flatten: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-blackbox | ||
:module: fullAdder | ||
:flatten: | ||
|
||
Yosys AIG Diagram | ||
----------------- | ||
|
||
Here is the diagram of a half-adder with its RST code:: | ||
|
||
.. hdl-diagram:: halfAdder.v | ||
:type: yosys-aig | ||
:module: halfAdder | ||
|
||
.. hdl-diagram:: halfAdder.v | ||
:type: yosys-aig | ||
:module: halfAdder | ||
|
||
The diagram below has been created without the ``:flatten:`` option:: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-aig | ||
:module: fullAdder | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-aig | ||
:module: fullAdder | ||
|
||
The diagram below has been created using the ``:flatten:`` option. | ||
You can see that the ``halfAdder`` black box is substituted by the appropriate | ||
logic elements:: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-aig | ||
:module: fullAdder | ||
:flatten: | ||
|
||
.. hdl-diagram:: fullAdder.v | ||
:type: yosys-aig | ||
:module: fullAdder | ||
:flatten: |