Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ARM Emulator
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sella, Iftach
ARM Emulator
Commits
0eea7de6
Commit
0eea7de6
authored
2 years ago
by
Ben James
Browse files
Options
Downloads
Patches
Plain Diff
branch instruction
parent
f7f6372f
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
fixed a bug
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
emulate.c
+20
-0
20 additions, 0 deletions
emulate.c
with
20 additions
and
0 deletions
emulate.c
+
20
−
0
View file @
0eea7de6
...
...
@@ -308,6 +308,26 @@ void dataProcessingInstr(struct ProcessorState *processor, int address)
}
}
void
branchInstr
(
struct
ProcessorState
*
processor
,
uint32_t
instruction
)
{
// Check if address is valid
verifyAddress
(
address
);
uint32_t
instr
=
processor
->
memory
[
address
];
// Check if the instruction should be executed according to its condition codes
if
(
!
validCond
(
getBits
(
instr
,
28
,
31
),
processor
)){
return
;
}
// Calculating offset and sign
int32_t
offset
=
getBits
(
instr
,
0
,
23
);
int
sign
=
getBits
(
offset
,
23
,
23
);
// Offset shifted and extended and new address (including +8 bytes) loaded to PC
processor
->
registers
[
14
]
=
(((
offset
*
4
)
|
0
)
|
((
sign
)
?
0
:
0xFC000000
))
+
64
;
return
;
}
// Steps through pipeline calling appropriate instruction method.
// Sets teminate if instruction is all-0.
...
...
This diff is collapsed.
Click to expand it.
James, Ben
@bj420
mentioned in commit
5d435e49
·
2 years ago
mentioned in commit
5d435e49
mentioned in commit 5d435e49762e66d10cbc426b3102075e0e77c2d0
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment