arm11

所属分类:处理器开发
开发工具:Ruby
文件大小:0KB
下载次数:0
上传日期:2022-05-11 22:08:45
上 传 者sh-1993
说明:  CO161 Summer C项目-ARM11模拟器和汇编程序,
(CO161 Summer C Project - ARM11 Emulator and Assembler,)

文件列表:
doc/ (0, 2022-05-11)
doc/Checkpoint.tex (1104, 2022-05-11)
doc/Makefile (243, 2022-05-11)
doc/Report.tex (611, 2022-05-11)
programs/ (0, 2022-05-11)
programs/gpio.s (0, 2022-05-11)
src/ (0, 2022-05-11)
src/Makefile (254, 2022-05-11)
src/assemble.c (80, 2022-05-11)
src/emulate.c (80, 2022-05-11)
tests/ (0, 2022-05-11)
tests/lib/ (0, 2022-05-11)
tests/lib/json_pure-1.5.3/ (0, 2022-05-11)
tests/lib/json_pure-1.5.3/CHANGES (10581, 2022-05-11)
tests/lib/json_pure-1.5.3/COPYING (2574, 2022-05-11)
tests/lib/json_pure-1.5.3/COPYING-json-jruby (2591, 2022-05-11)
tests/lib/json_pure-1.5.3/GPL (18114, 2022-05-11)
tests/lib/json_pure-1.5.3/Gemfile (136, 2022-05-11)
tests/lib/json_pure-1.5.3/Rakefile (11628, 2022-05-11)
tests/lib/json_pure-1.5.3/TODO (1, 2022-05-11)
tests/lib/json_pure-1.5.3/VERSION (6, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/ (0, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/ (0, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat (24370, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat (44737, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat (21697, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat (42371, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat (24215, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat (45842, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat (23809, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat (68974, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat (23597, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat (68183, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat (23629, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat (67859, 2022-05-11)
tests/lib/json_pure-1.5.3/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat (23668, 2022-05-11)
... ...

# ARM 11 Emulator and Assembler **This is just the placeholder, needs to update the repo once I finish my exams!** ## Part I: Emulator - We are going to run this emulator via the following command line instruction: ``` ./emulate add01.bin ``` - Considering this command line instruction: - `emulate` is the executable file, building from the `Makefile`. - We also need one `Makefile` for building executables. - `add01.bin` is the ARM 11 **binary code**. ### Task 1: Design an interface for reading input binary file #### Implementation: Memory of the machine (for emulator) - Firstly we should read the file line by line, and store the lines **i.e. ARM instructions** somewhere called **memory** of the machine, maybe an array in this inplementation. - Possible problems: - You cannot really have a primary data structure that has a dynamic size, so to store the instructions line by line, we could either: - Use a linked list, and append each "instruction" at the end of the list once we have read it. - Use an array, with the array size subject to the maximum ARM machine memory, **64KB**. (I prefer this one). - Given that all instructions are 32 bits and aligned on a 4-byte boundary, the memory should be implemented as a "table", with the instruction in each row, and the address of the "head" of each row, should be a multiple of 4. - Then we could see, the memory is **an array of 8 bits unsigned integers** in this implementation, with size 2^16 = 65536. Once we want to fetch data from the memory, we should start with indices (which is a multiple of 4). - Note that our ARM memory is _byte-addressable_, so the bytes are addressing in **big-endian** scheme. #### Implementation: Registers of the machine (for emulator) - Given that: - an ARM system has 17 registers: - 0 - 12 General purpose - 13, 14 (ignored) - PC register is 15 - CPSR register is 16 - The CPSR register is used to: - configure the **operating mode** of the ARM processor - check conditions for conditional ARM instructions - should be initialised as **0** - **IMPORTANT:** the top **four** bits carry the status flags. (the NZCV flags) - a register is represented as a 32-bit integer - We need another data structure to store values in the registers (_In this case, an array of course_). - Idea: **You might could define a C data structure (e.g. a struct)** to represent the internal state of an ARM machine. - Note: the ARM instruction set **does not have a** _halt_ **instuction**, i.e. we need to use a `while (true)` loop in the implementation to make the processor run forever. Also, the machine should interpret an all-zero instruction as the signal of termination. - Then we should print the value of each register, and contents (instructions) of any non-zero location.

近期下载者

相关文件


收藏者