NVBoard项目搭建

ysyx · 02-16 · 573 人浏览
NVBoard项目搭建

在刚接触NVBoard时感到非常棘手,因为不知道怎么配置引脚,也不知道怎么在cpp文件中接入nvboard,后来想到了阅读example项目的makefile,尝试模仿example的项目结构搭建,最后算是顺利完成了~

Step 0

配置环境,具体见README

https://github.com/NJU-ProjectN/nvboard

Step 1

创建项目框架

.
├── constr
│   └── top.nxdc
├── csrc
│   └── nvb.cpp
├── makefile
└── vsrc
    ├── MuxKeyInternal.v
    ├── MuxKey.v
    ├── MuxKeyWithDefault.v
    └── top.v

共3个目录(constr, csrc, vsrc),1个makefile文件

makefile文件我是直接复制的官方仓库/example/Makefile

Step 2

编写好.cpp文件,其实就是根据手册上说的:

  • 在进入verilator仿真的循环前,先对引脚进行绑定,然后对NVBoard进行初始化
  • 在verilator仿真的循环中更新NVBoard各组件的状态
  • 退出verilator仿真的循环后,销毁NVBoard的相关资源

2.17 Update:

main.cpp其实只要有如下框架即可,不需要自己写激励了,因为修改NVBoard FPGA板的输入(比如拨动SW)就是一种激励。

#include <nvboard.h>
#include <Vtop.h>

void nvboard_bind_all_pins(Vtop* top);

int main(int argc, char** argv) {
    VerilatedContext* contextp = new VerilatedContext;
    contextp->commandArgs(argc, argv);
    Vtop* top = new Vtop{contextp};

    nvboard_bind_all_pins(top);
    nvboard_init();
    while(!contextp->gotFinish())
        {
            top->eval();
            nvboard_update();
        }

    nvboard_quit();
    return 0;
}
Note: 绑定多个引脚时,从左到右是MSB->LSB

Step 3

在项目根目录下执行

make run

Summary

以后要养成习惯,不知道怎么下手时先看示例是怎么写的,模仿着来就可以,同时要阅读示例的README

ysyx verilog NVBoard
  1. Get Blockchain Insurance globally!

    Get professional insurance of global importance from an insurer in Chelyabinsk, Russia.

    More than 50 types of non-criminal insurance. The price starts from $ 1.25 per month.

    Once a month, a document is created that can be shown to the regulatory authorities. We're taking over the negotiations.

    We insure risks such as:
    1. Arbitrary legislation
    2. Arbitrariness of the Central Bank
    3. Possible harm to other people

    Accept crypto and gift card payment.

    Link: http://realthing.liveblog365.com/insurance/common/

    http://realthing.liveblog365.com/insurance/common/

    Click it!

Theme Jasmine by Kent Liao