ZYNQ学习笔记

ZYNQ学习笔记

学习资料

  1. 百度Edgeboard文章汇总

  2. FPGA Tutorial

    在这里收集了近1G的电子书,希望能赶紧看完哈哈😆

  3. EdgeBoard文档目录

  4. Edgeboard-MPSOC-FPGA

  5. edgeboard

    1. blinky(fpga开发板)
  6. Verilog 教程

  7. 正点原子视频教程

  8. Zynq UltraScale+MPSoc 开发(一)

oj

  1. https://verilogoj.ustc.edu.cn/oj/
    https://www.zhihu.com/answer/2291310107
  2. HDLBits 中文导学

Linux

问题

  1. VMware ubuntu压缩虚拟磁盘
1
2
sudo apt-get install open-vm-tools
sudo vmware-toolbox-cmd disk shrink /
1
2
3
4
#虚拟机
#开启自动扩容时禁用
cat /dev/zero > zero.fill
rm -f zero.fill
1
2
3
4
#主机
#如我的VMware安装在F盘,在windows的命令行中:
$ F:\>cd VMware
$ F:\VMware>vmware-vdiskmanager.exe -k "F:\UbuntuVMware\Ubuntu1804\Ubuntu 64-bit.vmdk"
  1. VMware虚拟机扩展Ubuntu系统磁盘空间
  2. 完美解决虚拟机占用硬盘越来越大、删除快照出现内存不足错误
  3. PETALINUX安装过程中遇到的坑【PETALINUX2018.3基于UBUNTU16.04.4(64-BIT)】
  4. 使用vitis开发Linux应用程序

Vivado

工欲善其事必先利其器

  1. FPGA Develop Support 使用手册-version 0.1.18

  2. 用Vscode代替Vivado原生编辑器

    D:/Program Files/Microsoft VS Code/Code.exe -g [file name]:[line number]

    D:/Program Files/Microsoft VS Code/Code.exe --disable-features=CalculateNativeWinOcclusion -g [file name]:[line number]

    D:/Program Files/Sublime Text/sublime_text.exe [file name] -l[line number]

    cmd /S /k “code -g [file name]:[line number]”

    使用cmd /S /k "code -g [file name]:[line number]"解决VsCode卡顿的问题

  3. 【超实用】一分钟学会如何用最小存储空间保存Vivado工程!

  4. vivado工程保存为tcl脚本及用tcl脚本恢复vivado工程

    1
    2
    3
    4
    5
    6
    7
    8
    #导出工程
    write_project_tcl D:/Study/FPGA/Backup/backup.tcl

    #打开工程
    cd D:/Study/FPGA/Backup/
    #source ./backup.tcl
    #vivado -mode tcl -source FZ3B_board.tcl -tclargs --origin_dir "origin_dir地址"
    tcl -source FZ3B_board.tcl -tclargs --origin_dir "origin_dir地址"

    注意

    Please note that by default, the file path for the project source files were set wth respect to the ‘origin_dir’ variable in the
    generated script. When this script is executed from the output directory, these source files will be referenced with respect to this ‘origin_dir’ path value.
    In case this script was later moved to a different directory, the ‘origin_dir’ value must be set manually in the script with the path
    relative to the new output directory to make sure that the source files are referenced correctly from the original project. You can also set the
    ‘origin_dir’ automatically by setting the ‘origin_dir_loc’ variable in the tcl shell before sourcing this generated script. The ‘origin_dir_loc’
    variable should be set to the path relative to the new output directory. Alternatively, if you are sourcing the script from the Vivado command line,
    then set the origin dir using ‘-tclargs --origin_dir ’. For example, 'vivado -mode tcl -source FZ3B_board.tcl -tclargs --origin_dir “…”

  5. 创建自定义Board FIle

    Creating Xilinx Vivado board files for EBAZ4205

  6. vscode插件:verilog-format

  7. Vivado使用VSCode编辑器的各种配置:功能加持

  8. sublime text 插件:SublimeLinter-contrib-xsim

  9. set_param general.maxThreads x

问题

  1. Xilinx Vivado卡在Initializing Language Server的解决方法

    打开 Tools -> Settings -> Tool Settings -> Text Editor -> Syntax Checking,将 Syntax checking 从 Sigasi 改为 Vivado:

  2. 自定义board_file:

    1. reating Xilinx Vivado board files for EBAZ4205
  3. 红框的作用参见https://www.xilinx.com/html_docs/xilinx2020_2/vitis_doc/embeddedplatforms.html

    • 以前的流程

    • 勾选后的流程

    • 区别图

      • not checking the box “project is an extensible vitis platform”, you get the standard flow from previous versions of Vivado.
      • check the box, you will be met with a radically changed flow when you try to export the platform (Export -> Export Platform).
  4. 【FPGA】Vivado综合停滞、死机(PID Not Specified)解决方法

  5. Modelsim安装,及其Vivado2021库编译

  6. Vivado添加资源一直卡进度条 Never ending adding source…

  7. 解决 重新启动 Vivado 设置 (文本编辑器)无法保存 会初始化

    用VSCode代替Vivado的文本编辑器进行编辑

  8. Vivado仿真卡在executing analysis and compilation step阶段

  9. 解决Vivado与modelsim仿真卡在Executing analysis and compilation step

    Vivado仿真卡在Executing analysis and compilation step循环不出去,检查是否有vivado报不出来的低级语法错误,还是不行,把sim文件里的sim_1文件删了,重新跑就好了

  10. 环境报错

1
2
3
4
5
6
7
8
9
10
11
12
13
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\Scripts\conda-script.py", line 11, in <module>
from conda.cli import main
ModuleNotFoundError: No module named 'conda'
Invoke-Expression : 无法将参数绑定到参数“Command”,因为该参数为空字符串。
所在位置 D:\Users\PC-GWJ\Documents\WindowsPowerShell\profile.ps1:4 字符: 91

+ ... onda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression

+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:PSObject) [Invoke-Expression],ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.InvokeExpressionCommand
~~~~~~~~~~~~~~~~~

定位问题

1
2
$env:PYTHONHOME
D:/Xilinx/Vivado/2021.2\tps\win64\python-3.8.3

但是系统环境变量没设置

参考PowerShell命令行输出和添加系统环境变量

D:\Users\PC-GWJ\Documents\WindowsPowerShell\profile.ps1添加

1
$env:PYTHONHOME=""

问题根本原因

这是因为是从Vivado启动的Vscode

Vitis

  1. [vivado 20.1]FSBL项目-This application requires xilffs library in the Board Support Package.
    BSP Settings - Modify BSP - 勾选 xilffs

  2. 【Vitis】调用math.h函数提示未定义的解决办法

  3. 2021.2 hw_server working very slow.

    After looking into this on our end, we fixed the problem.

    What it looks like is happening is hw_server is trying to dns resolve localhost.

    You can fix this in a few ways:

    1. Make sure your hosts file in windows points 127.0.0.1 to localhost
    2. Make an explicit target connection to your PC’s host name.

    After patching our hosts file, we have high speed hw_server operation again.

  4. No executable has been specified and target does not support

    自带的gdb有问题,手动指定其他版本gdb,比如xpack-arm-none-eabi-gcc

  5. 新界面

    1
    2
    3
    4
    vitis -new -w <workspace>

    D:/Xilinx/Vitis/2023.1/settings64.bat
    vitis -new -w ./
  6. 添加map文件

    C/C++ Build的Settings-Linker Flags 添加gcc -Wl,-Map c:\debug\test.map

资料

  1. 移植linux到zedboard过程中杂项错误总结

  2. Xilinx Vitis 启动时未响应的解决方法

    D:\Xilinx\Vitis\2021.2\bin\vitis.bat

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    @echo off
    rem #
    rem # COPYRIGHT NOTICE
    rem # Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
    rem #
    set RDI_EXIT=

    rem # JD
    rem # avoid PATH overflow
    set PATH=

    setlocal enableextensions enabledelayedexpansion

    rem # RDI_ARGS_FUNCTION must be cleared here, otherwise child
    rem # planAhead processes will inherit the parent's args.
    set RDI_ARGS_FUNCTION=
  3. undefined reference to `sin’

  4. 配置编译inculde path时,如果导入其他工程的settings,要修改"Includes"和"Libraries"中${resolvePlatformFile:project=zynq_eco_filter,fileType=bspLib},将project=后面的名称改成自己工程

  5. -l-Wl,–start-group,-lxil,-lgcc,-lc,–end-group: No such file or directory

    math.h库需要添加libm,必须在C/C++ Build -> Settings添加!

    Adding the library path using the “Add Library” option in “Project Properties -> C/C++ General -> Paths And Symbols -> Libraries” is corrupting the makefile.

    Any subsequent changes are effected by this change.

    To work around this issue, create a new application and copy the sources from the old application. Then, apply the library settings for the new application by following these steps:

    1. Right-click on the application project.
    2. Go to C/C++ Build -> Settings.
    3. Select “Libraries” section under “Microblaze gcc linker”
    4. Press “Add” button and give the library name.
    5. Optionally, add the “Library Search Path”, if your library is in different path.

Verilog

问题

  1. ModelSim出现Unable to checkout a viewer license
  2. Modelsim关联VS Code

笔记

  1. 时序逻辑赋值用<=,组合逻辑赋值用=

    1: 当为时序逻辑建模,使用“非阻塞赋值”。
    2: 当为锁存器(latch) 建模,使用“非阻塞赋值”。
    3: 当用always块为组合逻辑建模,使用“阻塞赋值”
    4: 当在同一个always块里面既为组合逻辑又为时序逻辑建模,使用“非阻塞赋值”。
    5: 不要在同一个always块里面混合使用“阻塞赋值”和“非阻塞赋值”。
    6: 不要在两个或两个以上always块里面对同一个变量进行赋值。
    7: 使用$strobe以显示已被“非阻塞赋值”的值。
    8: 不要使用#0延迟的赋值。

  2. 敏感信号表:所有的右边表达式中的变量以及if,case条件中的变量

  3. if/else要配对以避免latch(锁存器)的产生,同样的case语句加default语句

  4. 状态机(fsm):

    1. 使用独热码,每个状态只有一个寄存器置位,译码逻辑简单

    2. 三段式可以在组合逻辑后再增加一级寄存器来实现时序逻辑输出:

      • 可以有效地滤去组合逻辑输出的毛刺
      • 可以有效地进行时序计算与约束
      • 另外对于总线形式的输出信号来说,容易使总线数据对齐,从而减小总线数据间的偏移,减小接收端数据采样出错的频率。
  5. Matlab产生TestBeach所需要的波形数据

FZ3B Edgeboard

开发板信息

  1. 芯片型号:

    MYC-XCZU3EG
    逻辑核心 XAZU3EG-1SFVC784I(不知为何教程是xczu3eg-sfvc784-1-E)
    可编程逻辑单元 154K
    Look-Up Tables 71K
    触发器 141K
    Block RAM Distributed RAM 1.8Mb / Block RAM 7.6Mb
    DSP slice 360
    AMS-System Monitor 1
  2. 引导模式和 JTAG 模式选择

    Name PS_MODE0 PS_MODE1 PS_MODE2 PSMODE3
    SW1 M0 M1 M2 M3
    JTAG ON ON ON ON
    QSPI32 ON OFF ON ON
    SD1 OFF ON OFF ON
    eMMC18 ON OFF OFF ON
  3. 似乎百度FZ3和米尔的FZ3硬件及引脚是基本一致的,不一样的地方如下:

    米尔FZ3 百度FZ3
    Ethernet AR8035-AL1B-R KSZ9031RNX
    CAN image-20220117155835724 image-20220117155857451
    RS485 image-20220117155936665 image-20220117155918871
  4. FZ3A和FZ3B不同处

    FZ3A FZ3B
    DDR3 U3,U5 数据32位 U3,U5,U71,U72 数据64位

使用

PYNQ

资料

EdgeBoard的PYNQ移植

仿真

资料

  1. matlab产生数据到vivado仿真

其他

matlab产生数据到vivado仿真

其他

  1. 好消息,Xilinx放出了FTDI下载器的制作工具

  2. source insight 支持verilog 及使用技巧

  3. 易灵思的JTAG调试器和Alinx的JTAG调试器冲突

    插上alinx的xilinx cable后出现

    说明识别为之前安装的易灵思的驱动了两个调试器都使用了FT232.。。

    解决方式:用DISM++卸载掉lib-usbK和lib-usbwin32对应的elites驱动。

    下午调试Xilinx的板子发现JTag连不上了,想着之前能用为啥现在用不了。百思不得其解。搞了半天一看设备管理器,好家伙,之前为学校易灵思的FPGA板子的烧写器ft232安装了对应的驱动libusbK,一看黑金的调试器是ft232改的,显然就是把xilinx的调试器识别为易灵思的了。。同时顺带解决了遗留一年多的spi flash烧不进去的问题😂😭

ADI HDL NO-OS

  1. ERROR: vivado version mismatch; expected 2022.2, got 2021.2.
    This ERROR message can be down-graded to CRITICAL WARNING by setting ADI_IGNORE_VERSION_CHECK environment variable to 1. Be aware that ADI will not support you, if you are using a different tool version.
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17

    `export ADI_IGNORE_VERSION_CHECK=1 `

    Cygwin安装时勾选`make`和`git`包

    `D:\cygwin64\etc`添加

    ```bash
    export PATH=$PATH:/cygdrive/d/Xilinx/Vivado/2023.1/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vivado_HLS/2023.1/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vitis/2023.1/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vitis/2023.1/gnu/microblaze/nt/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vitis/2023.1/gnu/arm/nt/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vitis/2023.1/gnu/microblaze/linux_toolchain/nt64_be/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vitis/2023.1/gnu/microblaze/linux_toolchain/nt64_le/bin
    export PATH=$PATH:/cygdrive/d/Xilinx/Vitis/2023.1/gnu/aarch32/nt/gcc-arm-none-eabi/bin
    export ADI_IGNORE_VERSION_CHECK=1
  2. no-os编译前 git submodule update --recursive --init

  3. no-os D:/Xilinx/Vitis/2021.2/settings64.bat

  4. 使用up_dac_common.v时,注意parameter COMMON_ID = 6'h10

    1
    2
    assign up_wreq_s = (up_waddr[13:7] == {COMMON_ID,1'b0}) ? up_wreq : 1'b0;
    assign up_rreq_s = (up_raddr[13:7] == {COMMON_ID,1'b0}) ? up_rreq : 1'b0;

    意味着访问时,要在基地址baseaddr上增加0x4000偏移,或者将COMMON_ID改为0。这样设计是为了兼容同时用到adc和dac的ip。

    对于up_dac_common.v中的up_clock_monup_clk来自于aclk,一般为100MHz,dac_clk来自外部dac_div_clk,为dac实际工作时钟的4分频,所以dac_clk_ratio应设置为32'd4,寄存器得到的dac时钟频率计算公式为 DAC_FREQ = CLK_FREQ * CLK_RATIO*390625/256,CLK_FREQ 是参考aclk计算的频率。参考链接:https://wiki.analog.com/resources/fpga/docs/axi_dac_ip

  5. no-os dmac irq 参考https://github.com/analogdevicesinc/no-OS/commit/c74747c699f0eb6380db840ac34f9fc3dba5ffbf

  6. MMCM axi_clk 小数分频 按0.125步进

  7. ADI util_delay bug

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    module util_delay #(

    parameter DATA_WIDTH = 1,
    // the minimum valid value for DELAY_CYCLES is 1
    parameter DELAY_CYCLES = 1
    ) (
    input clk,
    input reset,
    input [DATA_WIDTH-1:0] din,//原先为input din,
    output [DATA_WIDTH-1:0] dout
    );

时序约束

  1. input delay

    output delay

    set_input_delay是说该输入信号是在时钟沿后多长时间到达模块的port上的 。

    set_output_delay是说该输出信号在后级模块中需要在时钟沿之前提前多长时间准备好。

  2. VIVADO常用的时钟约束语法

  3. FPGA学习-时序分析vivado篇

  4. VIVADO时序约束之Output Delay(set_output_delay)

  5. Vivado使用技巧----------IO延迟的约束方法

  6. set_input_delay/set_output_delay

  7. output_delay:

    min = - hold time
    max = setup time
    max - min = 数据稳定时间

CMSIS DSP

  1. //ARM_MATH_NEON
    ARM_MATH_LOOPUNROLL
    
    1
    2
    3

    2. ```
    Source/**/arm_**
  2. other flags 默认

    1
    -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard
作者

GWJ

发布于

2022-01-01

更新于

2023-11-28

许可协议

评论