An overview of the source files and subsystems

Download Report

Transcript An overview of the source files and subsystems

Code base
• PTLsim is written in C++ with extensive use of
x86 and x86-64 inline assembly code.
• It must be compiled with gcc on a Linux 2.6
based x86 or x86-64 machine.
• The C++ variant used by PTLsim is Embedded
C++. only use the features found in C, but add
templates,classes and operator overloading.
• It have standard template library, SuperSTL, that
must be used in place of the C++ STL.
An overview of the source
files and subsystems
•
•
•
•
•
•
•
PTLsim Core Subsystems
Decoder, Microcode and Basic Block Cache
Out Of Order Core
Linux Hosted Kernel Interface
PTLsim/X Bare Hardware and Xen Interface
Support Subsystems
Userspace Tools
PTLsim Core Subsystems
• ptlsim.cpp and ptlsim.h
– 负责PTLsim高层次的工作,用于选择合适的模拟内核
代码
• uopimpl.cpp
– 包含了所有微操作及其变量的执行代码,PTLsim使用
汇编语言执行绝大部分的ALU和浮点微操作
• ptlhwdef.cpp and ptlhwdef.h
– 定义了基本的微操作编码、标志及寄存器。
• seqcore.cpp
Decoder, Microcode and Basic
Block Cache
• decode-core.cpp
– 用于将X86与X86-64译为微操作,控制基本的cache块
并处理自适应代码
• decode-fast.cpp
– 使用4个或更少的微操作解码被95%的指令所使用的
X86指令集
• decode-sse.cpp
– 解码所有的sse、sse2、sse3和mmx指令
• decode-x87.cpp
– 解码X-87浮点指令,并提供相关的微代码
• decode-complex.cpp
• decode.h
Out Of Order Core
• ooocore.cpp
– out of order模拟器的控制逻辑
• oooexec.cpp
– 操作所有的功能单元,load/store单元、发射队列和
replay逻辑
• dcache.cpp and dcache.h
– 包含数据cache的模式,当前L1/L2/L3的存储层次都支
持
• ooopipe.cpp
• ooocore.h
• branchpred.cpp and branchpred.h
Linux Hosted Kernel Interface
• kernel.cpp and kernel.h
– 使PTLsim从模拟状态与32位/64位状态之间转换
• lowlevel-64bit.S
– 包含了64位的启动与上下文切换代码,如果运行在
X86-64的系统上PTLsim从这里开始执行
• lowlevel-32bit.S
– 包含了32位的启动与上下文切换代码,如果运行在
X86-32的系统上PTLsim从这里开始执行
• injectcode.cpp
• loader.h
PTLsim/X Bare Hardware
and Xen Interface
• ptlxen-memory.cpp
– 负责控制PTLsim所有基于分页式的内存操作
• ptlxen-events.cpp
– 提供所有的中断与事件处理
• ptlxen.h
– 提供所有与full system PTLsim/x相关的函数与定义
•
•
•
•
•
•
•
•
•
ptlmon.cpp
ptlxen-common.cpp
ptlxen.cpp
xen-types.h
ptlsim-xen-hypervisor.diff and ptlsim-xen-tools.diff
ptlxen.lds and ptlmon.lds
lowlevel-64bit-xen.S
ptlctl.cpp
ptlcalls.h
Support Subsystems
• superstl.h, superstl.cpp and globals.h
– 实现各种标准库函数与类用于代替C++的标准库
• logic.h
– C++模板库,用于实现像数组、队列、寄存器文件相关的同步逻
辑结构
• mm.cpp
– PTLsim的存储控制器
• mathlib.cpp and mathlib.h
– 提供适合于嵌入式系统使用的标准的浮点功能函数
•
•
•
•
klibc.cpp and klibc.h
syscalls.cpp and syscalls.h
config.cpp and config.h
datastore.cpp and datastore.h
Userspace Tools
• ptlstats.cpp
– 使用一些便于人们理解的方式分析并打印统计数据
• glibc.cpp
– 包含些userspace的函数
•
•
•
•
ptlcalls.c and ptlcalls.h
dstbuild
makeusage.cpp
cpuid.cpp
Common Libraries and Logic
Design APIs
• PTLsim includes a number of powerful C++
templates, macros and functions
• This section provide an overview of these
structures so that users of PTLsim will use them
instead of trying to duplicate work which have
already done.
General Purpose Macros
• globals.h
– It contains very useful definitions, functions
and macros
•
•
•
•
•
•
•
Basic data types used throughout PTLsim
Type safe C++ template based functions
Iterator macros
Bit manipulation macros
Definitions of basic x86 functions
Miscellaneous functions
….
Super Standard Template Library
• It is an internal C++ library and used
internally in lieu of the normal C++ STL.
• The full documentation is in superstl.h and
superstl.cpp.
•
•
•
•
•
•
•
I/O stream classes familiar from Standard C++
read and write binary data class
String buffer class
String formatting classes
Bit vector
Queue list node template class
…
Logic Standard Template Library
• It is an internally developed add-on to
SuperSTL
• It supports structures useful for modeling
sequential logic
• The full documentation is in logic.h
•
•
•
•
latch template class
Queue template class
HistoryBuffer
Iterators for Queue objects
• ….
Miscellaneous Code
• The out of order simulator, ooocore.h,
• It contains several reusable classes,
• IssueQueue template class
• StateList and ListOfStateLists