-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VTA] Add VTA PYNQ metal_test bitstream program logic and fix compile…
… issue. (#3400) * [VTA] Add VTA PYNQ metal_test bitstream program logic and fix couple compile issue. Issue: VTAProgram not exist and cause compile error. No logic to program the bitstream into FPGA. metal test still use pynq 2.1 library which not support on latest pynq 2.4. Solution: remove old VTAProgram. when setting is pynq, program the bitstream during compile. change DMA link library to libcma. * Address review commends.
- Loading branch information
Showing
4 changed files
with
69 additions
and
12 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
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,57 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
"""VTA specific bitstream program library.""" | ||
import os | ||
import argparse | ||
|
||
def main(): | ||
"""Main funciton""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("target", type=str, default="", | ||
help="target") | ||
parser.add_argument("bitstream", type=str, default="", | ||
help="bitstream path") | ||
args = parser.parse_args() | ||
|
||
if (args.target != 'pynq' and args.target != 'sim'): | ||
raise RuntimeError("Unknown target {}".format(args.target)) | ||
|
||
curr_path = os.path.dirname( | ||
os.path.abspath(os.path.expanduser(__file__))) | ||
path_list = [ | ||
os.path.join(curr_path, "/{}".format(args.bitstream)), | ||
os.path.join('./', "{}".format(args.bitstream)) | ||
] | ||
ok_path_list = [p for p in path_list if os.path.exists(p)] | ||
if not ok_path_list: | ||
raise RuntimeError("Cannot find bitstream file in %s" % str(path_list)) | ||
|
||
bitstream_program(args.target, args.bitstream) | ||
|
||
def pynq_bitstream_program(bitstream_path): | ||
from pynq import Bitstream | ||
bitstream = Bitstream(bitstream_path) | ||
bitstream.download() | ||
|
||
def bitstream_program(target, bitstream): | ||
if target == 'pynq': | ||
pynq_bitstream_program(bitstream) | ||
elif target != 'sim': | ||
raise RuntimeError("Unknown target {}".format(target)) | ||
|
||
if __name__ == "__main__": | ||
main() |
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
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