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.

Step 1: Download the logictools overlay


In [1]:
from pynq.overlays.logictools import LogicToolsOverlay

logictools_olay = LogicToolsOverlay('logictools.bit')

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


In [2]:
function = ['LD2 = PB3 ^ PB0']

Step 3: Instantiate and setup of the boolean generator object.

The logic function defined in the previous step is setup using the setup() method


In [3]:
boolean_generator = logictools_olay.boolean_generator
boolean_generator.setup(function)

Find the On-board pushbuttons and LEDs

Step 4: Run the boolean generator verify operation


In [4]:
boolean_generator.run()

Verify the operation of the XOR function

PB0 PB3 LD2
0 0 0
0 1 1
1 0 1
1 1 0

Step 5: Stop the boolean generator


In [5]:
boolean_generator.stop()

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.
**Alternative format:**

function = {'XOR_gate': 'LD2 = PB3 ^ PB0'}

In [6]:
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()

Stop the boolean generator


In [7]:
boolean_generator.stop()