Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SWEN90006-A1-2018
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Zhangyun Ye
SWEN90006-A1-2018
Commits
ed1a1e8f
Commit
ed1a1e8f
authored
6 years ago
by
Zhangyun Ye
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
82ea52e6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/B14.s
+17
-0
17 additions, 0 deletions
examples/B14.s
with
17 additions
and
0 deletions
examples/B14.s
0 → 100644
+
17
−
0
View file @
ed1a1e8f
MOV
R3
12
; N = 12
MOV
R2
1
;
;; local variables
;; R1 holds 'i', which is a counter from 0 .. N
;; R0 holds 'n', which is always equal to i!
MOV
R1
0
; i = 0;
MOV
R0
1
; n = 1;
;; program body
;; loop invariant (see SWEN90010 next semester): n = i!
SUB
R4
R3
R1
; while(i != N)
JZ
R4
4
; {
ADD
R1
R1
R2
; i = i + 1;
MUL
R0
R0
R1
; n = n * i;
JMP
1
; }
RET
R0
; return n;
This diff is collapsed.
Click to expand it.
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