# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## TRIERES showcase example
# ### Case study: Give an input string to FPGA and get the upper-capitalized from FPGA 
# ### You don't neet and FPGA knowledge, just basic Python syntax !!!

# ![Trieres Logo](./etc/trieres.png)
#
# Assuming that FPGA is already flashed

# Start a python shell (Add OCSE libs to path only for cosim)

# %env LD_LIBRARY_PATH=${OCSE_ROOT}/libocxl/ python3

# Configure the Python path to look for FPGA aceleration library

import sys

import os

snap_action_sw=os.environ['SNAP_ROOT'] + "/actions/hls_helloworld_python/sw"
sys.path.append(snap_action_sw)

# Import the FPGA accelerator library

import snap_helloworld_python

input = "Hello world. This is my first OpenCAPI TriEres experience with Python. It's extremely fun"

# Currently we reserve space on host for output (can also be done in library)

output = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

# Execute the FPGA accelerator as a Python function

out, output = snap_helloworld_python.uppercase(input)

print("Output from FPGA:"+output)

print("Output from CPU :"+input.upper())

StarcoderdataJupyterScriptsDedupFiltered