首页 > 其他分享 >gem5 学习二 —— gem5基础

gem5 学习二 —— gem5基础

时间:2024-11-02 21:58:29浏览次数:5  
标签:gem5 -- 基础 学习 Default build file ARM

Building gem5

Platforms

  • Linux, BSD, MacOS X, Solaris, etc
  • 64 bit machines help quite a bit

Tools

If using Ubuntu install

  • apt-get install python-dev scons m4 build-essential g++ swig zlib-dev

Compile Targets

build:

  • build/<isa>/<binary>

ISAs:

  • ARM, ALPHA, MIPS, SPARC, POWER, X86, RISCV

Binaries

  • gem5.debug
    • debug build, symbols, tracing, assert
  • gem5.opt
    • optimized build, symbols, tracing, assert
  • gem5.fast
    • optimized build, no debugging, no symbols, no tracing, no assertions
  • gem5.prof
    • gem5.fast + profiling support

Sample Compile

[/work/gem5] scons build/ARM/gem5.opt –j4

Running Simulation

[/work/gem5] ./build/ARM/gem5.opt -h

Usage 
===== 
 gem5.opt [gem5 options] script.py [script options] 
 
 gem5 is copyrighted software; use the --copyright option for details. 
 
Options 
======= 
--version                show program's version number and exit 
--help, -h               show this help message and exit 
--build-info, -B         Show build information 
--copyright, -C          Show full copyright information 
--readme, -R             Show the readme 
--outdir=DIR, -d DIR     Set the output directory to DIR [Default: m5out] 
--redirect-stdout, -r    Redirect stdout (& stderr, without -e) to file 
--redirect-stderr, -e    Redirect stderr to file 
--stdout-file=FILE       Filename for -r redirection [Default: simout] 
--stderr-file=FILE       Filename for -e redirection [Default: simerr] 
--interactive, -i        Invoke the interactive interpreter after running the 
                         script 
--pdb                    Invoke the python debugger before running the script 
--path=PATH[:PATH], -p PATH[:PATH] 
                         Prepend PATH to the system path when invoking the 
                         script 

Running Simulation

Statistics Options 
------------------ 
--stats-file=FILE  Sets the output file for statistics [Default: stats.txt] 
 
Configuration Options 
--------------------- 
--dump-config=FILE  Dump configuration output file [Default: config.ini] 
--json-config=FILE  Create JSON output of the configuration [Default: config.json] 
 
Debugging Options 
----------------- 
--debug-break=TIME[,TIME] 
                         Cycle to create a breakpoint 
--debug-help             Print help on trace flags 
--debug-flags=FLAG[,FLAG] 
                         Sets the flags for tracing (-FLAG disables a flag) 
--remote-gdb-port=REMOTE_GDB_PORT 
                         Remote gdb base port (set to 0 to disable listening) 
 
Trace Options 
------------- 
--trace-start=TIME      Start tracing at TIME (must be in ticks) 
--trace-file=FILE       Sets the output file for tracing [Default: cout] 
--trace-ignore=EXPR     Ignore EXPR sim objects

gem5 has two fundamental modes

Full system (FS)

  • For booting operating systems
  • Models bare hardware, including devices
  • Interrupts, exceptions, privileged instructions, fault handlers
  • Simulated UART output
  • Simulated frame buffer output

Syscall emulation (SE)

  • For running individual applications, or set of applications on MP
  • Models user-visible ISA plus common system calls
  • System calls emulated, typically by calling host OS
  • Simplified address translation model, no scheduling

Now dependent on how you run the binary

  • No longer need to compile different binaries

Sample Run – Syscall Emulation

 [/work/gem5] ./build/ARM/gem5.opt configs/example/se.py  \
              -c tests/test-progs/hello/bin/arm/linux/hello 

Sample Run – Full System

Command Line: 
22:13:19 [/work/gem5] ./build/ARM/gem5.opt configs/example/fs.py  
… 
info: kernel located at: /dist/binaries/vmlinux.arm.smp.fb.2.6.38.8 
Listening for system connection on port 5900 
Listening for system connection on port 3456 
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000 
info: Using bootloader at address 0x80000000 
**** REAL SIMULATION **** 
info: Entering event queue @ 0.  Starting simulation... 
warn: The clidr register always reports 0 caches. 
warn: clidr LoUIS field of 0b001 to match current ARM implementations. 


Terminal: 
22:13:19 [/work/gem5] ./util/term/m5term 127.0.0.1 3456 
==== m5 slave terminal: Terminal 0 ==== 
[0.000000] Linux version 2.6.38.8-gem5 (saidi@zeep) (gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41) ) 
#1 SMP Mon Aug 15 21:18:38 EDT 2011 
[0.000000] CPU: ARMv7 Processor [350fc000] revision 0 (ARMv7), cr=10c53c7f 
[0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache 
[0.000000] Machine: ARM-RealView PBX
...
starting pid 354, tty '': '/sbin/getty -L ttySA0 38400 vt100' 
AEL login:

Sample Run – Behind the scenes

gem5 architecture

标签:gem5,--,基础,学习,Default,build,file,ARM
From: https://www.cnblogs.com/sys-123456/p/18520951

相关文章

  • Java学习教程,从入门到精通,Java 循环结构:while 和 do...while(17)
    Java循环结构:while和do…while在Java中,while和do...while是两种基本的循环控制结构,用于在特定条件下重复执行一段代码。1.while循环语法:while(condition){//循环体}知识点:condition是一个布尔表达式。在每次循环开始前,都会检查condition是否为......
  • 2024-2025-1 20241311 《计算机基础与程序设计》第六周学习总结
    学期(2024-2025-1)学号(20241311)《计算机基础与程序设计》第六周学习总结作业信息这个作业属于哪个课程<班级的链接>(如2024-2025-1-计算机基础与程序设计)这个作业要求在哪里<作业要求的链接>(如2024-2025-1计算机基础与程序设计第六周作业)这个作业的目标<写上具体......
  • 学期:2024-2025-1 学号:20241303 《计算机基础与程序设计》第六周学习总结
    作业信息这个作业属于哪个课程<班级的链接>(如2024-2025-1-计算机基础与程序设计)这个作业要求在哪里<作业要求的链接>(如2024-2025-1计算机基础与程序设计第六周作业)这个作业的目标<写上具体方面>自学教材《计算机科学概论(第七版)》第7章,并完成云班课测试,《C语言程......
  • JavaScript基础语法
    ps:区分大小写,//(注释)一输出语句点击查看代码<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title></head><body><script>window.alert("hellojs~&q......
  • 本科阶段讲个透(全)|保研/推免(流程、时间、前期必要的准备、心得感悟)、考试学习(思政类、
    文章目录一、前言二、保研/推免2.1保研流程2.2保研的前期准备2.3保研心得2.4如何择校三、考试学习(学习方法、学习时间、记忆方法、各科的学习大致规划)四、科研竞赛(途径、队友、机会)五、志愿六、社会工作七、就业7.1为什么考虑就业7.1明白自己具体做什么7.2招聘看......
  • 深度学习周报(10.28-11.3)
    目录摘要Abstract1卷积神经网络(ConvolutionaNeuralNetwork,CNN)1.1什么是卷积神经网络1.2感受野(ReceptiveField)1.3参数共享(ParameterSharing)1.4卷积层(ConvolutionalLayer)1.5 池化(Pooling)1.6 CNN整体流程2CNN实例——手写数字识别2.1 数据集......
  • CTF学习(17)MISC(后门查杀/webshell后门)
    后门查杀1.解压获得html文件夹(入门用的工具题吗)--->使用D盾以文本文件格式打开include.php文件后发现pass处有段md5数据(实为flag)(还是不太明白md5加密的特征,只是长度一样吗)FLAG:flag{6ac45fb83b3bc355c024f5034b947dd3}webshell后门1.根据题目提示得知密码即为flag--......
  • 2024-2025-1 20231406《计算机基础与程序设计》第五周助教总结
    2024-2025-120231406《计算机基础与程序设计》第五周助教总结课程答疑由于这两周进行了C语言第一次实验,同学们的问题主要集中在实验上C语言开发环境的搭建集中体现于在ESC上新建目录,编译程序,运行代码等步骤。主要原因是大家对一些指令不太理解,经常出现输入错误的情况。希望......
  • 一些AI数学基础
    众所周知,在当前机器学习看待数据的很重要一个方式是概率,例如分类问题是建模一个P(Y=C|X)。在面对离散变量的时候,例如人名这种离散变量。假设有问题:给一个名字,判断该人是中国哪里人。(或许在现实生活中,该问题是不合理的,一般情况下无法根据人名判断是哪里人)假设我们有所有省份的人......
  • NGO-RELM基于北方苍鹰优化正则化极限学习机的数据预测Matlab程序多特征输入单输出
    NGO-RELM基于北方苍鹰优化正则化极限学习机的数据预测Matlab程序多特征输入单输出目录NGO-RELM基于北方苍鹰优化正则化极限学习机的数据预测Matlab程序多特征输入单输出预测结果评价指标基本介绍程序设计参考资料预测结果评价指标训练集数据的R2......