Skip to content
Snippets Groups Projects
Commit dba26db5 authored by Rock Qu's avatar Rock Qu Committed by Graham Schelle
Browse files

add logictools notebooks

parent 8403422d
No related branches found
No related tags found
No related merge requests found
Showing
with 2791 additions and 0 deletions
%% Cell type:markdown id: tags:
# Boolean Generator
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 id: tags:
### Step 1: Download the `logictools` overlay
%% Cell type:code id: tags:
``` python
from pynq.overlays.logictools import LogicToolsOverlay
logictools_olay = LogicToolsOverlay('logictools.bit')
```
%% Output
%% Cell type:markdown id: tags:
### Step 2: Specify the boolean function of a 2-input XOR
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 id: tags:
``` python
function = ['LD2 = PB3 ^ PB0']
```
%% Cell type:markdown id: tags:
### Step 3: Instantiate and setup of the boolean generator object.
The logic function defined in the previous step is setup using the `setup()` method
%% Cell type:code id: tags:
``` python
boolean_generator = logictools_olay.boolean_generator
boolean_generator.setup(function)
```
%% Cell type:markdown id: tags:
__Find the On-board pushbuttons and LEDs__
%% Cell type:markdown id: tags:
![](images/boolean_generator.png)
%% Cell type:markdown id: tags:
### Step 4: Run the boolean generator verify operation
%% Cell type:code id: tags:
``` python
boolean_generator.run()
```
%% Cell type:markdown id: tags:
#### Verify the operation of the XOR function
| PB0 | PB3 | LD2 |
|:---:|:---:|:---:|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
%% Cell type:markdown id: tags:
### Step 5: Stop the boolean generator
%% Cell type:code id: tags:
``` python
boolean_generator.stop()
```
%% Cell type:markdown id: tags:
### Step 6: Re-run the entire boolean function generation in a single cell
**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`.
<font color="DodgerBlue">**Alternative format:**</font>
```python
function = {'XOR_gate': 'LD2 = PB3 ^ PB0'}
```
%% Cell type:code id: tags:
``` python
from pynq.overlays.logictools import LogicToolsOverlay
logictools_olay = LogicToolsOverlay('logictools.bit')
boolean_generator = logictools_olay.boolean_generator
function = {'XOR_gate': 'LD2 = PB3 ^ PB0'}
boolean_generator.setup(function)
boolean_generator.run()
```
%% Cell type:markdown id: tags:
__Stop the boolean generator__
%% Cell type:code id: tags:
``` python
boolean_generator.stop()
```
Source diff could not be displayed: it is too large. Options to address this: view the blob.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment