forked from Xilinx/PYNQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed image paths fixed image path
- Loading branch information
Showing
19 changed files
with
1,797 additions
and
3,466 deletions.
There are no files selected for viewing
215 changes: 215 additions & 0 deletions
215
boards/Pynq-Z1/logictools/notebooks/boolean_generator.ipynb
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,215 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Boolean Generator\n", | ||
"This notebook will show how to use the boolean generator to generate a boolean combinational function. The function that is implemented is a 2-input XOR." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Step 1: Download the `logictools` overlay" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from pynq.overlays.logictools import LogicToolsOverlay\n", | ||
"from pynq.lib.logictools import BooleanGenerator\n", | ||
"\n", | ||
"logictools_olay = LogicToolsOverlay('logictools.bit')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Step 2: Specify the boolean function of a 2-input XOR \n", | ||
"The logic is applied to the on-board pushbuttons and LED, pushbuttons **PB0** and **PB3** are set as inputs and LED **LD2** is set as an output" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"function = ['LD2 = PB3 ^ PB0']" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Step 3: Instantiate and setup of the boolean generator object. \n", | ||
"The logic function defined in the previous step is setup using the `setup()` method " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"boolean_generator = logictools_olay.boolean_generator\n", | ||
"boolean_generator.setup(function)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"__Find the On-board pushbuttons and LEDs__" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<img src=\"images/BG.png\" width=50%/>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Step 4: Run the boolean generator verify operation\n", | ||
"__Note: Unused on-board LEDs `LD0`, `LD1` and `LD3` are switched ON by default.__" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"boolean_generator.run()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Verify the operation of the XOR function\n", | ||
"\n", | ||
"| PB0 | PB3 | LD2 |\n", | ||
"|:---:|:---:|:---:|\n", | ||
"| 0 | 0 | 0 |\n", | ||
"| 0 | 1 | 1 |\n", | ||
"| 1 | 0 | 1 |\n", | ||
"| 1 | 1 | 0 |" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Step 5: Stop the boolean generator" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"boolean_generator.stop()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Step 6: Re-run the entire boolean function generation in a single cell\n", | ||
"**Note**: The boolean expression format can be `list` or `dict`. We had used a `list` in the example above. We will now use a `dict`. \n", | ||
"<font color=\"DodgerBlue\">**Alternative format:**</font> \n", | ||
"```python\n", | ||
"function = {'XOR_gate': 'LD2 = PB3 ^ PB0'}\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from pynq.overlays.logictools import LogicToolsOverlay\n", | ||
"from pynq.lib.logictools import BooleanGenerator\n", | ||
"\n", | ||
"logictools_olay = LogicToolsOverlay('logictools.bit')\n", | ||
"boolean_generator = logictools_olay.boolean_generator\n", | ||
"\n", | ||
"function = {'XOR_gate': 'LD2 = PB3 ^ PB0'}\n", | ||
"\n", | ||
"boolean_generator.setup(function)\n", | ||
"boolean_generator.run()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"__Stop the boolean generator__" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"boolean_generator.stop()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.0" | ||
}, | ||
"widgets": { | ||
"application/vnd.jupyter.widget-state+json": { | ||
"state": {}, | ||
"version_major": 1, | ||
"version_minor": 0 | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 1 | ||
} |
291 changes: 291 additions & 0 deletions
291
boards/Pynq-Z1/logictools/notebooks/fsm_generator.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+265 KB
boards/Pynq-Z1/logictools/notebooks/images/FSM_specification_format.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+149 KB
boards/Pynq-Z1/logictools/notebooks/images/WD_specification_format0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+145 KB
boards/Pynq-Z1/logictools/notebooks/images/WD_specification_format1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+160 KB
boards/Pynq-Z1/logictools/notebooks/images/WD_specification_format2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+264 KB
boards/Pynq-Z1/logictools/notebooks/images/WD_specification_format3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.