Skip to content

Commit bd89870

Browse files
committed
Updated Project 4/5 Documentation
- Updated documentation for Project 4 - Added documentation for Project 5
1 parent cd474b3 commit bd89870

File tree

4 files changed

+139
-6
lines changed

4 files changed

+139
-6
lines changed

Project 4 - 64-Bit Adder/behavioral_adder_64/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ This module tested: all possible combinations from 0 to 31 and, seperately, two
1010

1111
Test 1: Simulation results from the Verilog representation of this Behavioral Adder **(All possible combinations from 0 to 31)**
1212

13-
![Project 4 Waveform for Test 1](Project 4 - 64-Bit Adder/behavioral_adder_64/Simulation Waveforms/project4_test_E.png)
13+
![Project 4 Waveform for Test 1](/Project 4 - 64-Bit Adder/behavioral_adder_64/Simulation Waveforms/project4_test_E.png)
1414

1515
Test 2: Simulation results from the Verilog representation of this Behavioral Adder **(Two large 32-bit integers)**
1616

17-
![Project 4 Waveform for Test 2](Project 4 - 64-Bit Adder/behavioral_adder_64/Simulation Waveforms/project4_test_F.png)
17+
![Project 4 Waveform for Test 2](/Project 4 - 64-Bit Adder/behavioral_adder_64/Simulation Waveforms/project4_test_F.png)
1818

1919
## Source Files
2020

Project 4 - 64-Bit Adder/look_ahead_adder_64/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ This module tested: all possible combinations from 0 to 31 and, seperately, two
1212

1313
Test 1: Simulation results from the Verilog representation of this 2-Bit Look Ahead Adder **(All possible combinations from 0 to 31)**
1414

15-
![Project 4 Waveform for Test 1](Project 4 - 64-Bit Adder/look_ahead_adder_64/Simulation Waveforms/project4_test_C.png)
15+
![Project 4 Waveform for Test 1](/Project 4 - 64-Bit Adder/look_ahead_adder_64/Simulation Waveforms/project4_test_C.png)
1616

1717
Test 2: Simulation results from the Verilog representation of this 2-Bit Look Ahead Adder **(Two large 32-bit integers)**
1818

19-
![Project 4 Waveform for Test 2](Project 4 - 64-Bit Adder/look_ahead_adder_64/Simulation Waveforms/project4_test_D.png)
19+
![Project 4 Waveform for Test 2](/Project 4 - 64-Bit Adder/look_ahead_adder_64/Simulation Waveforms/project4_test_D.png)
2020

2121
## Source Files
2222

Project 4 - 64-Bit Adder/ripple_adder_64/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ This module tested: all possible combinations from 0 to 31 and, seperately, two
1010

1111
Test 1: Simulation results from the Verilog representation of this Ripple Carry Adder **(All possible combinations from 0 to 31)**
1212

13-
![Project 4 Waveform for Test 1](Project 4 - 64-Bit Adder/ripple_adder_64/Simulation Waveforms/project4_test_A.png)
13+
![Project 4 Waveform for Test 1](/Project 4 - 64-Bit Adder/ripple_adder_64/Simulation Waveforms/project4_test_A.png)
1414

1515
Test 2: Simulation results from the Verilog representation of this Ripple Carry Adder **(Two large 32-bit integers)**
1616

17-
![Project 4 Waveform for Test 2](Project 4 - 64-Bit Adder/ripple_adder_64/Simulation Waveforms/project4_test_B.png)
17+
![Project 4 Waveform for Test 2](/Project 4 - 64-Bit Adder/ripple_adder_64/Simulation Waveforms/project4_test_B.png)
1818

1919
## Source Files
2020

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Project 5 - ARM LEGv8 Simulator
2+
3+
## Objective
4+
5+
This functional single cycle (non-pipelined) processor is capable of performing basic arithmetic, logic and data operations. It is based on a ARM 64-bit architecture, with 32 registers each 64-bits wide long with instruction lengths of 32-bits each.
6+
7+
The basic assembly instructions of LDUR, STUR, ADD, SUB, ORR, AND, CBZ and B were to be supported by the CPU, with LDUR and STUR supporting immediate values when performing certain operations to the register values.
8+
9+
During development, the group took the same assembly instructions and tested it on a PSoC 5LP (using the equivalent ARM v7 ISA) and it produced the result as the simulated ARM CPU.
10+
11+
When working with the unconditional branch, instead of a written label the tested instruction contains the immediate to where the branch would have been.
12+
13+
Since the ARM CPU is little endian, the instruction memory in this project was designed to have 64 8-bits for each index.
14+
15+
The Data Memory was made up of 31 64-bit values to show that the values could be accessed and stored via the CPU.
16+
17+
With the instruction memory, data memory and register memory located outside the CPU itself, the project could be incrementally tested and treated as independent components on a physical board.
18+
19+
## Supported ISA
20+
21+
The examples below use the following 'variables' to show off the functionaility for each instruction:
22+
23+
- r{#}: Register # in the CPU (From 0 to 31)
24+
- RAM: Random Access Memory (or Data Memory)
25+
- PC: Program Counter
26+
27+
### LDUR: Load RAM into Registers
28+
29+
Example 1: LDUR r2, [r10]
30+
31+
- Sudo-C code: r2 = RAM[r10]
32+
- Explanation: Get the value in memory with the address r10 and put that memory value into r2
33+
34+
Example 2: LDUR r3, [r10, #1]
35+
36+
- Sudo-C code: r3 = RAM[r10 + 1]
37+
- Explanation: Get the value in memory with the address r10 + immediate (1) and put that memory value into r3
38+
39+
### STUR: Store Registers into RAM
40+
41+
Example 1: STUR r1, [r9]
42+
43+
- Sudo-C code: RAM[r9] = r1
44+
- Explanation: Put the value of r1 into RAM at the address of the value r9
45+
46+
Example 2: STUR r4, [r7, #1]
47+
48+
- Sudo-C code: RAM[r7 + 1] = r4
49+
- Explanation: Put the value of r4 into RAM at the address of the value r7 + immediate (1)
50+
51+
### ADD: Add Registers
52+
53+
Example: ADD r5, r3, r2
54+
55+
- Sudo-C code: r5 = r3 + r2
56+
- Explanation: Add the values of r3 and r2 and put the result into r5
57+
58+
*Note: This does not support immediate values. Only register-to-register operations*
59+
60+
### SUB: Subtract Registers
61+
62+
Example: SUB r4, r3, r2
63+
64+
- Sudo-C code: r4 = r3 - r2
65+
- Explanation: Subtract the values of r3 and r2 and put the result into r4
66+
67+
*Note: This does not support immediate values. Only register-to-register operations*
68+
69+
### ORR: Bit-wise OR Registers
70+
71+
Example: ORR r6, r2, r3
72+
73+
- Sudo-C code: r6 = r2 | r3
74+
- Explanation: Bit-wise OR the values of r2 and r3 and put the result into r6
75+
76+
*Note: This does not support immediate values. Only register-to-register operations*
77+
78+
### AND: Bit-wise AND Registers
79+
80+
Example: SUB r4, r3, r2
81+
82+
- Sudo-C code: r4 = r3 & r2
83+
- Explanation: Bit-wise AND the values of r3 and r2 and put the result into r4
84+
85+
*Note: This does not support immediate values. Only register-to-register operations*
86+
87+
### CBZ: Conditional Jump (when the value in Register is zero)
88+
89+
Example: CBZ r1, #2
90+
91+
- Sudo-C code: if (r1 == 0) { PC = PC + 2 }
92+
- Explanation: If the value of r1 is zero then jump two instructions, otherwise, continue executing PC++
93+
94+
### B: Unconditional (arbitrary) Jump
95+
96+
Example: B #2
97+
98+
- Sudo-C: PC = PC + 2
99+
- Explanation: Jump two instructions
100+
101+
## Test Program (Instructions)
102+
103+
The test program used to test the CPU runs through thirteen instructions as shown in the table below.
104+
105+
| Line # | ARM Assembly | Machine Code | Hexadecimal|
106+
|:------:|:------------------|:---------------------------------------:|:----------:|
107+
| 1 | LDUR r2, [r10] | 1111 1000 0100 0000 0000 0001 0100 0010 | 0xF8400142 |
108+
| 2 | LDUR r3, [r10, #1]| 1111 1000 0100 0000 0001 0001 0100 0011 | 0xF8401143 |
109+
| 3 | SUB r4, r3, r2 | 1100 1011 0000 0010 0000 0000 0110 0100 | 0xCB020064 |
110+
| 4 | ADD r5, r3, r2 | 1000 1011 0000 0010 0000 0000 0110 0101 | 0x8B020065 |
111+
| 5 | CBZ r1, #2 | 1011 0100 0000 0000 0000 0000 0100 0001 | 0xB4000041 |
112+
| 6 | CBZ r0, #2 | 1011 0100 0000 0000 0000 0000 0100 0000 | 0xB4000040 |
113+
| 7 | LDUR r2, [r10] | 1111 1000 0100 0000 0000 0001 0100 0010 | 0xF8400142 |
114+
| 8 | ORR r6, r2, r3 | 1010 1010 0000 0011 0000 0000 0100 0110 | 0xAA030046 |
115+
| 9 | AND r7, r2, r3 | 1000 1010 0000 0011 0000 0000 0100 0111 | 0x8A030047 |
116+
| 10 | STUR r4, [r7, #1] | 1111 1000 0000 0000 0001 0000 1110 0100 | 0xF80010E4 |
117+
| 11 | B #2 | 0001 0100 0000 0000 0000 0000 0000 0011 | 0x14000003 |
118+
| 12 | LDUR r3, [r10, #1]| 1111 1000 0100 0000 0001 0001 0100 0011 | 0xF8401143 |
119+
| 13 | ADD r8, r0, r1 | 1000 1011 0000 0001 0000 0000 0000 1000 | 0x8B010008 |
120+
121+
## Test Program (Register and Data Memory Setup)
122+
123+
The Instruction Memory was entered into the instruction memory itself to properly show its functionality while simulated.
124+
125+
The Registers were initialized with values from 0-30 with register 31 defined as 0 in the reference sheet for LEG v8.
126+
127+
The Data Memory was initialized with values starting from 0-3100 with each content of memory being 100 more than the previous index with an exception of index 10 and 11 with the contents 1540 and 2117 respectively.
128+
129+
## Source Directories
130+
131+
- **ARM LEGv8 CPU Module** - ARM_CPU.v
132+
133+
- **ARM LEGv8 Testbench** - CPU_TEST.v

0 commit comments

Comments
 (0)