当前位置: 首页 > news >正文

GitHub - riscv-software-src/riscv-isa-sim: Spike, a RISC-V ISA Simulator

GitHub - riscv-software-src/riscv-isa-sim: Spike, a RISC-V ISA Simulator

操作手册

$ apt-get install device-tree-compiler libboost-regex-dev libboost-system-dev
$ mkdir build
$ cd build
$ ../configure --prefix=$RISCV
$ make
$ [sudo] make install

具体安装

安装依赖

sudo apt-get install device-tree-compiler libboost-regex-dev libboost-system-dev

安装gcc编译器

sudo apt install gcc-riscv64-unknown-elf

git clone下载源码

git clone https://githubfast.com/riscv-software-src/riscv-isa-sim

编译 

cd riscv-isa-sim
mkdir build
cd build
../configure --prefix=$RISCV
make -j 12
sudo make install

安装完成:

mkdir /include/softfloat
../scripts/mk-install-dirs.sh /include
for dir in fesvr       ; \do \../scripts/mk-install-dirs.sh /include/$dir; \/usr/bin/install -c -m 644 config.h /include/$dir; \done
make: Circular libriscv.so <- libriscv.so dependency dropped.
make: Circular libcustomext.so <- libcustomext.so dependency dropped.
make: Circular libsoftfloat.so <- libsoftfloat.so dependency dropped.
../scripts/mk-install-dirs.sh /lib
for file in libfesvr.a libriscv.so libdisasm.a libcustomext.so libsoftfloat.so; \do \/usr/bin/install -c -m 644 $file /lib; \done
../scripts/mk-install-dirs.sh /bin
for file in elf2hex spike spike-log-parser xspike termios-xspike spike-dasm; \do \/usr/bin/install -c -m 755 $file /bin; \done
../scripts/mk-install-dirs.sh /lib/pkgconfig/
mkdir /lib/pkgconfig
for file in riscv-fesvr.pc riscv-riscv.pc riscv-disasm.pc; \do \/usr/bin/install -c -m 644 $file /lib/pkgconfig/; \done

Compiling and Running a Simple C Program

Install spike (see Build Steps), riscv-gnu-toolchain, and riscv-pk.

Write a short C program and name it hello.c. Then, compile it into a RISC-V ELF binary named hello:

$ riscv64-unknown-elf-gcc -o hello hello.c

Now you can simulate the program atop the proxy kernel:

$ spike pk hello

Simulating a New Instruction

Adding an instruction to the simulator requires two steps:

  1. Describe the instruction's functional behavior in the file riscv/insns/<new_instruction_name>.h. Examine other instructions in that directory as a starting point.

  2. Add the opcode and opcode mask to riscv/opcodes.h. Alternatively, add it to the riscv-opcodes package, and it will do so for you:

     $ cd ../riscv-opcodes$ vi opcodes       // add a line for the new instruction$ make install
    
  3. Add the instruction to riscv/riscv.mk.in. Otherwise, the instruction will not be included in the build and will be treated as an illegal instruction.

  4. Rebuild the simulator.

调试

编译报错fatal error: stdio.h: No such file or directory

riscv64-unknown-elf-gcc -o hello hello.c
hello.c:1:10: fatal error: stdio.h: No such file or directory
    1 | #include <stdio.h>
      |          ^~~~~~~~~
compilation terminated.

没有解决

安装gcc-riscv64-linux-gnu试试

sudo apt install gcc-riscv64-linux-gnu

然后用这条命令:

riscv64-linux-gnu-gcc -o hello hello.c
skywalk@DESKTOP-9C5AU01:~/work$ file hello
hello: ELF 64-bit LSB pie executable, UCB RISC-V, RVC, double-float ABI, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=2fbc3940bdd6f61378b1a8629c6bac6f89b9aa41, for GNU/Linux 4.15.0, not stripped

编译成功!

运行spike pk hello报错could not open pk; searched paths:

spike pk hello
terminate called after throwing an instance of 'std::runtime_error'
  what():  could not open pk; searched paths:
        . (current directory)
        /riscv64-unknown-elf/bin/ (based on configured --prefix and --with-target)

相关文章:

GitHub - riscv-software-src/riscv-isa-sim: Spike, a RISC-V ISA Simulator

GitHub - riscv-software-src/riscv-isa-sim: Spike, a RISC-V ISA Simulator 操作手册 $ apt-get install device-tree-compiler libboost-regex-dev libboost-system-dev $ mkdir build $ cd build $ ../configure --prefix$RISCV $ make $ [sudo] make install 具体安装 …...

ubuntu开机启动服务

需求背景&#xff1a; 需要监控日志&#xff0c;每次都是手动启动 nohup ./prometheus >/dev/null & nohub ./node_exporter >/dev/null & 需求目标&#xff1a; 重启后系统自动启动服务...

电子电气架构 --- 设计车载充电机的关键考虑因素

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 简单,单纯,喜欢独处,独来独往,不易合同频过着接地气的生活,除了生存温饱问题之外,没有什么过多的欲望,表面看起来很高冷,内心热情,如果你身…...

2025_0105_生活记录

3号去内蒙看了流星雨。还记得上次看流星的时间是2018年&#xff0c;也是冬天&#xff0c;大家在雁栖湖校区的操场上仰望星空。那个时候幸运的看到了一颗流星&#xff0c;便迅速地在心里许愿。这次看到了三颗流星&#xff0c;我也许了愿&#xff0c;希望实现。 24年走过了十多个…...

电池管理系统(BMS)架构详细解析:原理与器件选型指南

BMS&#xff08;电池管理系统&#xff09;架构详细讲解 从你提供的BMS&#xff08;Battery Management System&#xff09;架构图来看&#xff0c;主要涉及到电池监控模块、通信模块、功率控制模块等部分。下面我将详细讲解该架构的各个功能模块及其工作原理。 1. 电池管理核…...

用JAVA编写一个简单的小游戏

用Java语言编写一个简单的小游戏。这里是一个非常基础的猜数字小游戏的代码示例。在这个游戏中&#xff0c;程序会随机选择一个1到100之间的整数&#xff0c;玩家需要猜测这个数字是什么。每次猜测后&#xff0c;程序会告诉玩家他们猜的数字是太高了、太低了还是正确。 impor…...

【SpringSecurity】二、自定义页面前后端分离

文章目录 1、用户认证流程AuthenticationSuccessHandler AuthenticationFailureHandlerSecurityFilterChain配置用户认证信息 2、会话并发处理2.1、实现处理器接口2.2、SecurityFilterChain配置 1、用户认证流程 AuthenticationSuccessHandler AuthenticationFailureHandler …...

小兔鲜儿:头部区域的logo,导航,搜索,购物车

头部&#xff1a;logo ,导航&#xff0c;搜索&#xff0c;购物车 头部总体布局: 设置好上下外边距以及总体高度&#xff0c; flex布局让总体一行排列 logo&#xff1a; logo考虑搜索引擎优化&#xff0c;所以要使用 h1中包裹 a 标签&#xff0c;a 里边写内容&#xff08;到时候…...

什么是VLAN?

VLAN&#xff08;Virtual Local Area Network&#xff0c;虚拟局域网&#xff09;是一种将物理局域网划分成多个逻辑上独立的虚拟网络的技术。VLAN不依赖于设备的物理位置&#xff0c;而是通过逻辑划分&#xff0c;将局域网内的设备虚拟地组织到同一组。这种技术允许网络管理员…...

WPS计算机二级•数据查找分析

听说这里是目录哦 通配符&#x1f30c;问号&#xff08;?&#xff09;星号&#xff08;*&#xff09;波形符&#xff08;~&#xff09; 排序&#x1f320;数字按大小排序以当前选定区域排序以扩展选定区域排序 文字按首字母排序 快速筛选分类数据☄️文字筛选数字筛选颜色筛选…...

计算机网络 (28)虚拟专用网VPN

前言 虚拟专用网络&#xff08;VPN&#xff09;是一种在公共网络上建立私有网络连接的技术&#xff0c;它允许远程用户通过加密通道访问内部网络资源&#xff0c;实现远程办公和安全通信。 一、基本概念 定义&#xff1a;VPN是一种通过公共网络&#xff08;如互联网&#xff09…...

【Python学习(七)——序列、列表、元组、range、字符串、字典、集合、可变类型不可变类型】

Python学习&#xff08;七&#xff09;——序列、列表、元组、range、字符串、字典、集合、可变类型&不可变类型 本文介绍了序列、列表、元组、range、字符串、字典、集合、可变类型&不可变类型&#xff0c;仅作为本人学习时记录&#xff0c;感兴趣的初学者可以一起看…...

MATLAB常用建模方法——常用非参数检验

常用非参数检验 在用样本数据对正态总体参数作出统计判断&#xff08;例如参数估计和假设检验&#xff09;时&#xff0c;要求样本数据应服从正态分布&#xff0c;这种数据分布类型已知的总体参数的假设检验称为参数假设检验。 与参数假设检验相对应的还有非参数假设检验&#…...

【多线程初阶篇 ²】创建线程的方式

目录 二、多线程代码 1.继承Thread类 2.实现Runnable接口 3.匿名内部类 3.1 创建Thread⼦类对象 3.2 创建Runnable⼦类对象 4.lambda表达式&#xff08;推荐&#xff09; 小结&#xff1a; &#x1f525;面试题&#xff1a;Java中创建线程都有哪些写法 二、多线程代码 …...

纵览!报表控件 Stimulsoft Reports、Dashboards 和 Forms 2025.1 新版本发布!

Stimulsoft 2025.1 新版发布&#xff0c;旨在增强您创建报告、仪表板和 PDF 表单的体验&#xff01;此最新版本为您带来了许多改进和新功能&#xff0c;使数据处理更加高效和用户友好。亮点包括对 .NET 9 的支持、Microsoft Analysis Services 的新数据适配器、发布向导中适用于…...

游戏引擎学习第75天

仓库:https://gitee.com/mrxiao_com/2d_game_2 Blackboard: 处理楼梯通行 为了实现楼梯的平滑过渡和角色的移动控制&#xff0c;需要对楼梯区域的碰撞与玩家的运动方式进行优化。具体的处理方式和遇到的问题如下&#xff1a; 楼梯区域的过渡&#xff1a; 在三维空间中&#x…...

Java 23 集合框架详解:Set 接口及实现类(HashSet、TreeSet、LinkedHashSet)

&#x1f4da; Java 23 集合框架详解&#xff1a;Set 接口及实现类&#xff08;HashSet、TreeSet、LinkedHashSet&#xff09; &#x1f4d6; 概述 Set 是 Java 集合框架中用于存储 无序、不重复元素 的接口。它的实现类包括 HashSet、TreeSet 和 LinkedHashSet&#xff0c;它…...

ARMv8架构 CortexR52+ 内核 coresight_soc400介绍

前言&#xff1a;笔者在工作中接触到了一款多核芯片&#xff0c;其采用的处理器为CortexR52&#xff0c;使用的架构为ARMv8&#xff0c;我通过CoreSight SOC-400组件完成了对该芯片烧录代码的开发。这里芯片型号就不透露了&#xff0c;本文仅介绍我自己从ARM官网上提供的R52核等…...

1.Python浅过(语法基础)

1.简介 Python是一种面向对象的解释型高级编程语言&#xff0c;是强类型的动态脚本语言。 解释型语言跨平台性比编译型语言&#xff08;如c语言&#xff09;好。 print("hello world")2.Bug,Debug 多看&#xff0c;多思考&#xff0c;多尝试、查资料、记录 3.prin…...

ioremap_nocache函数

ioremap_nocache 是 Linux 内核中用于将物理地址映射到内核虚拟地址空间的函数&#xff0c;特别是用于 I/O 内存映射&#xff0c;并且禁用缓存。 一、基本语法 void __iomem *ioremap_nocache(phys_addr_t phys_addr, size_t size); 二、基本功能 将物理内存地址映射到内核虚拟…...

利用最小二乘法找圆心和半径

#include <iostream> #include <vector> #include <cmath> #include <Eigen/Dense> // 需安装Eigen库用于矩阵运算 // 定义点结构 struct Point { double x, y; Point(double x_, double y_) : x(x_), y(y_) {} }; // 最小二乘法求圆心和半径 …...

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…...

RocketMQ延迟消息机制

两种延迟消息 RocketMQ中提供了两种延迟消息机制 指定固定的延迟级别 通过在Message中设定一个MessageDelayLevel参数&#xff0c;对应18个预设的延迟级别指定时间点的延迟级别 通过在Message中设定一个DeliverTimeMS指定一个Long类型表示的具体时间点。到了时间点后&#xf…...

汽车生产虚拟实训中的技能提升与生产优化​

在制造业蓬勃发展的大背景下&#xff0c;虚拟教学实训宛如一颗璀璨的新星&#xff0c;正发挥着不可或缺且日益凸显的关键作用&#xff0c;源源不断地为企业的稳健前行与创新发展注入磅礴强大的动力。就以汽车制造企业这一极具代表性的行业主体为例&#xff0c;汽车生产线上各类…...

1.3 VSCode安装与环境配置

进入网址Visual Studio Code - Code Editing. Redefined下载.deb文件&#xff0c;然后打开终端&#xff0c;进入下载文件夹&#xff0c;键入命令 sudo dpkg -i code_1.100.3-1748872405_amd64.deb 在终端键入命令code即启动vscode 需要安装插件列表 1.Chinese简化 2.ros …...

Android15默认授权浮窗权限

我们经常有那种需求&#xff0c;客户需要定制的apk集成在ROM中&#xff0c;并且默认授予其【显示在其他应用的上层】权限&#xff0c;也就是我们常说的浮窗权限&#xff0c;那么我们就可以通过以下方法在wms、ams等系统服务的systemReady()方法中调用即可实现预置应用默认授权浮…...

Mobile ALOHA全身模仿学习

一、题目 Mobile ALOHA&#xff1a;通过低成本全身远程操作学习双手移动操作 传统模仿学习&#xff08;Imitation Learning&#xff09;缺点&#xff1a;聚焦与桌面操作&#xff0c;缺乏通用任务所需的移动性和灵活性 本论文优点&#xff1a;&#xff08;1&#xff09;在ALOHA…...

Angular微前端架构:Module Federation + ngx-build-plus (Webpack)

以下是一个完整的 Angular 微前端示例&#xff0c;其中使用的是 Module Federation 和 npx-build-plus 实现了主应用&#xff08;Shell&#xff09;与子应用&#xff08;Remote&#xff09;的集成。 &#x1f6e0;️ 项目结构 angular-mf/ ├── shell-app/ # 主应用&…...

JavaScript基础-API 和 Web API

在学习JavaScript的过程中&#xff0c;理解API&#xff08;应用程序接口&#xff09;和Web API的概念及其应用是非常重要的。这些工具极大地扩展了JavaScript的功能&#xff0c;使得开发者能够创建出功能丰富、交互性强的Web应用程序。本文将深入探讨JavaScript中的API与Web AP…...

python爬虫——气象数据爬取

一、导入库与全局配置 python 运行 import json import datetime import time import requests from sqlalchemy import create_engine import csv import pandas as pd作用&#xff1a; 引入数据解析、网络请求、时间处理、数据库操作等所需库。requests&#xff1a;发送 …...