-
Notifications
You must be signed in to change notification settings - Fork 3
/
xilinx_main.py
33 lines (26 loc) · 1.29 KB
/
xilinx_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from example.xilinx_context import XilinxContextFactory
from example.xilinx_converter import XilinxBitstreamConverter
from example.xilinx_model import XilinxBitstream
import wget
def run():
context_factory = XilinxContextFactory()
# Register the XilinxBitsreamConverter
context_factory.register_converter(XilinxBitstream, XilinxBitstreamConverter)
lx9_bin = wget.download('https://redballoonsecurity.com/files/JwfEU4veQSNFao8h/lx9.bin')
with open(lx9_bin, "rb") as f:
data = f.read()
context = context_factory.create(data)
bitstream_object = context.get_data()
print("Bitstream object: {}".format(bitstream_object))
print("Bitstream model type: {}".format(bitstream_object.get_model_type()))
print("Bitstream model description: {}".format(bitstream_object.get_model_description()))
print("\nUNPACKING\n")
bitstream_object.unpack()
print("Bitstream object: {}".format(bitstream_object))
print("\nHEADER\n")
header_object = bitstream_object.get_model().get_header()
print("Bitstream header object: {}".format(header_object))
print("Bitstream header model type: {}".format(header_object.get_model_type()))
print("Bitstream header model description: {}".format(header_object.get_model_description()))
if __name__ == "__main__":
run()