Skip to content

Commit

Permalink
updating logictools notebooks
Browse files Browse the repository at this point in the history
fixed image paths

fixed image path
  • Loading branch information
npurusho authored and schelleg committed Jul 28, 2017
1 parent d1fc462 commit 4911984
Show file tree
Hide file tree
Showing 19 changed files with 1,797 additions and 3,466 deletions.
215 changes: 215 additions & 0 deletions boards/Pynq-Z1/logictools/notebooks/boolean_generator.ipynb
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 boards/Pynq-Z1/logictools/notebooks/fsm_generator.ipynb

Large diffs are not rendered by default.

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 boards/Pynq-Z1/logictools/notebooks/images/PG.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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4911984

Please sign in to comment.