惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 热门话题
C
Check Point Blog
Hugging Face - Blog
Hugging Face - Blog
N
News | PayPal Newsroom
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Troy Hunt's Blog
H
Heimdal Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Secure Thoughts
博客园 - Franky
A
Arctic Wolf
Spread Privacy
Spread Privacy
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
The Last Watchdog
The Last Watchdog
博客园_首页
Forbes - Security
Forbes - Security
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
T
Threatpost
Y
Y Combinator Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
小众软件
小众软件
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Schneier on Security
Schneier on Security
博客园 - 叶小钗
量子位
Security Latest
Security Latest
酷 壳 – CoolShell
酷 壳 – CoolShell
U
Unit 42
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 聂微东
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
P
Privacy International News Feed
Help Net Security
Help Net Security
博客园 - 司徒正美
D
DataBreaches.Net
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
T
The Exploit Database - CXSecurity.com

StrongWong

什么是超低功耗基准测试——ULPMark Benchmark 浅谈 RISC-V 软件开发生态之 IDE 简单了解一下小米 vela wujian100 的 PWM 周期问题 用 Kindle 做树莓派的显示屏 关于 RISC-V 架构下 RTOS 的一些知识 使用 vivado 综合 wujian100 生成 bitstream 文件 FPGA 数字图像处理联合仿真平台的搭建及使用举例 拆解一个很有意思的开关 拆解某宝上热销的一款蓝牙耳机 Archives Windows10 环境下搭建 RISC-V 调试环境 Contact 使用汇编实现 pc 和 sp 的保存及恢复操作 数字 IC 设计流程 SDRAM 两次踏进同一条河 初窥 SDRAM 从计数器开始,看数字 IC 设计 使用 Docker + GitLab 构建自用的代码管理服务 提升数字 IC 设计效率从 Vim 开始 总线- SoC 内部的主干道 Tools 使用树莓派 3b 和 RTL_SDR 搭建小功率无线电监测点 关于 ARM Cortex-M3 的启动文件分析及分散加载 make 命令及 makefile 文件编写 ROS 基础知识 在 Jetson TX2 上安装 ROS 机器人操作系统 Jetson TX2 重新编译内核添加usb等驱动 Nvidia Jetson TX2 刷机并安装JetPack3.1 我的毕业设计--基于ROS的移动机器人 使用 Hexo+Github Pages 搭建个人博客 About
Windows 下学习阿里平头哥 RISC-V 芯片开发平台 wujian100
BH6BAO · 2019-11-09 · via StrongWong

前言

上个月,在第六届互联网大会上,阿里的平头哥,对,就是那个人狠话不多的公司!他们宣布开源了 wujian100 这个芯片设计平台。搭载基于 RISC-V 架构的玄铁 902 处理器。 基础硬件代码和配套软件代码发布在了 GitHub 上了,使用的是 MIT 许可证。大家也都可以去下载学习。

GitHub 链接:https://github.com/T-head-Semi/wujian100_open

介绍视频

https://www.bilibili.com/video/av74527234

搭建仿真环境

安装 Linux 环境

我们要去学习 wujian100 这个代码,首先要去搭建一下运行仿真的环境。跑无剑这个仿真是需要 Linux 环境的,所以我就安装了 WSL( Windows subsystem of Linux),我这里呢安装了 Ubuntu 18.04 的版本。要安装 WSL ,首先要去 控制面板->程序->启用或关闭 Windows 功能 勾选开启 适用于 Linux 的 Windows 子系统 这个选项,这样你就可以去微软应用商店正常安装 Linux 子系统了。

安装好子系统之后,我们直接进入到子系统下面进行操作就可以了。

新建目录 Clone 官方代码

首先我们按照官方在 GitHub 上的教程新建一个项目目录,然后进入到目录, clone 官方发布的代码。

$ mkdir test_prj
$ cd test_prj
$ git clone https://github.com/T-head-Semi/wujian100_open.git

安装 RISC-V 工具链

接下来,新建工具链目录,去官方给定的地址下载编译代码需要的 risc-v 工具链,解开压缩包,找到 riscv64-elf-x86_64-20190731.tar.gz 这个工具链,拷贝到工具链目录,解压安装工具链即可。

$ mkdir riscv_toolchain
$ cd riscv_toolchain
# 下面这条命令不一定跟我一样,工具链下载后的具体路径根据你自己的系统确定
$ cp /mnt/d/download/T-Head\ Tools\ package/T-Head\ RISC-V\ Toolchain-V1.2.2/riscv64-elf-x86_64-20190731.tar.gz ./

$ tar -zxvf riscv64-elf-x86_64-20190731.tar.gz

安装仿真工具

仿真工具可以选择官方推荐的 VCS 仿真,但是我这里呢使用 iverilog 进行仿真, gtkwave 来查看波形文件,verilator 是编辑软件。然后由于我这边安装的 ubuntu18.04 默认没有安装 make 工具,所以也一起安装了。

$ sudo apt install iverilog gtkwave verilator
$ sudo apt install make

注:有些同学可能是 Ubuntu 16.04 版本,直接通过 apt 命令安装 iverilog 会自动安装一个版本较低的,低版本运行这个仿真是有问题的,这时建议同学自己手动编译安装 10.0 以上版本的 iverilog 。

编辑 setup 脚本,配置环境变量

工具安装完成之后,编辑 setup 脚本并通过执行它,来设置 EDA 环境变量。 由于原本的脚本是 csh 在 bash 环境下有一些不兼容的地方,所以我这里做了一些修改,修改内容如下:

setup.sh 脚本内容:

#Copyright (c) 2019 Alibaba Group Holding Limited
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:


#set VCS path
#setenv VCS_HOME
#set path=($VCS_HOME/linux/bin $path)

#set VCS license
#setenv SNPSLMD_LICENSE_FILE

#set iverilog path
export iverilog_path=(/usr/bin)
export gtkwave_path=(/usr/bin)
export path=($iverilog_path:$path)
export path=($gtkwave_path:$path)


#set tools path
export TOOL_PATH='../../riscv_toolchain'

export wujian100_open_PATH='`pwd | perl -pe "s/wujian100_open.*/wujian100_open\//"`'
$ cd ../wujian100_open/tools
$ vim setup.sh
$ chmod +x setup.sh
$ source setup.sh

运行仿真

接下来,进入到 workdir 目录下运行仿真,然后通过 gtkwave 打开仿真波形。

$ cd ../workdir
$ ../tools/run_case -sim_tool iverilog ../case/timer/timer_test.c

当你看到 Hello Friend! 就表明你的仿真就跑起来了。

VCD info: dumpfile test.vcd opened for output.
        ******START TO LOAD PROGRAM******

Hello Friend!

timer test successfully
***************************************

*              Test Pass              *

***************************************

Step4 (Run simulation) is finished

用 gtkwave 打开 workdir 目录下的 test.vcd 波形文件,查看仿真波形,(打开波形文件需要图形化界面,我这里还安装了 VcXsrv,具体安装方法请自行搜索一下)波形图如下

wujian100_test_wave

好了,到这里你的仿真就跑起来了,然后接下来就是进行综合生成 bit 流文件了,下一篇文章在来更新 vivado 综合的步骤。

跑通仿真视频教程

Done!