-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from denizkasap/OBI_virtualization
OBI Virtualization.
- Loading branch information
Showing
11 changed files
with
2,669 additions
and
395 deletions.
There are no files selected for viewing
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,5 @@ | ||
# X-HEEP hardware reference | ||
|
||
https://github.com/esl-epfl/x-heep-femu | ||
|
||
d7b7341d2be860289760541477f1009ade953a49 |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
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,32 @@ | ||
# Copyright 2023 EPFL | ||
# Solderpad Hardware License, Version 2.1, see LICENSE.md for details. | ||
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1 | ||
# | ||
# Author: Simone Machetti - [email protected] | ||
|
||
# Import the X-HEEP Python class | ||
from pynq import x_heep | ||
|
||
# Load the X-HEEP bitstream | ||
x_heep = x_heep() | ||
|
||
# Compile the application | ||
x_heep.compile_app("virtual_obi_read") | ||
|
||
# Init the OBI memory | ||
obi = x_heep.init_obi_mem() | ||
|
||
# Reset the OBI memory | ||
x_heep.reset_obi_mem(obi) | ||
|
||
# Write to the OBI memory | ||
write_list = list() | ||
for i in range(1024): | ||
write_list.append(i ** 2) | ||
x_heep.write_obi_mem(write_list, obi) | ||
|
||
# Run the application | ||
x_heep.run_app() | ||
|
||
# Delete OBI | ||
del obi |
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,34 @@ | ||
# Copyright 2023 EPFL | ||
# Solderpad Hardware License, Version 2.1, see LICENSE.md for details. | ||
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1 | ||
# | ||
# Author: Simone Machetti - [email protected] | ||
|
||
# Import the X-HEEP Python class | ||
from pynq import x_heep | ||
|
||
# Load the X-HEEP bitstream | ||
x_heep = x_heep() | ||
|
||
# Compile the application | ||
x_heep.compile_app("virtual_obi_write") | ||
|
||
# Init the OBI memory | ||
obi = x_heep.init_obi_mem() | ||
|
||
# Reset the OBI memory | ||
x_heep.reset_obi_mem(obi) | ||
|
||
# Run the application | ||
x_heep.run_app() | ||
|
||
# Read the OBI memory | ||
obi_read = x_heep.read_obi_mem(obi) | ||
target_read = list() | ||
for i in range(1024): | ||
target_read.append(i ** 2) | ||
if target_read == obi_read: | ||
print("Write operation successful.") | ||
|
||
# Delete OBI | ||
del obi |
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,116 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "63f1eaa7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Import the X-HEEP Python class\n", | ||
"from pynq import x_heep" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2d224b64", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Load the X-HEEP bitstream\n", | ||
"x_heep = x_heep()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d6af7d95", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Compile the application\n", | ||
"x_heep.compile_app(\"virtual_obi_read\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "75a905c1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Init the OBI memory\n", | ||
"obi = x_heep.init_obi_mem()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "00c60248", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Reset the OBI memory\n", | ||
"x_heep.reset_obi_mem(obi)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "35615647", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Write to the OBI memory\n", | ||
"write_list = list()\n", | ||
"for i in range(1024):\n", | ||
" write_list.append(i ** 2)\n", | ||
"x_heep.write_obi_mem(write_list, obi)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b4b82dd7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run the application\n", | ||
"x_heep.run_app()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "84f8d8c9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Delete OBI\n", | ||
"del obi" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.10.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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,118 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "63f1eaa7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Import the X-HEEP Python class\n", | ||
"from pynq import x_heep" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2d224b64", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Load the X-HEEP bitstream\n", | ||
"x_heep = x_heep()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d6af7d95", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Compile the application\n", | ||
"x_heep.compile_app(\"virtual_obi_write\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "75a905c1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Init the OBI memory\n", | ||
"obi = x_heep.init_obi_mem()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "35615647", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Reset the OBI memory\n", | ||
"x_heep.reset_obi_mem(obi)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fd8e74c7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run the application\n", | ||
"x_heep.run_app()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b9065ea6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Read the OBI memory\n", | ||
"obi_read = x_heep.read_obi_mem(obi)\n", | ||
"target_read = list()\n", | ||
"for i in range(1024):\n", | ||
" target_read.append(i ** 2)\n", | ||
"if target_read == obi_read:\n", | ||
" print(\"Write operation successful.\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4e507c63", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Delete OBI\n", | ||
"del obi" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.10.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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
Oops, something went wrong.