Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ENSIA-AI
Computer_Architecture_II_RISC-V_Edition
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
Computer_Architecture_II_RISC-V_Edition
/
MatrixMultiplication.asm
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
79 lines (69 loc) · 1.29 KB
main
Breadcrumbs
Computer_Architecture_II_RISC-V_Edition
/
MatrixMultiplication.asm
Copy path
Top
File metadata and controls
Code
Blame
79 lines (69 loc) · 1.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
.data
EndLine:
.string
"\n"
EndMatrix:
.string
"##############################\n"
Space:
.string
" "
.data
Matrix1:
.word
2
,
3
,
4
,
5
Matrix2:
.word
2
,
3
,
4
,
5
MatrixResult:
.word
0
,
0
,
0
,
0
.text
# Base addresses
la
s0, Matrix1
la
s1, Matrix1
la
s2, MatrixResult
addi
s3, x0,
2
# Number of rows
0
-
-3
addi
s4, x0,
2
# Number of columns
0
-
-3
addi
t0, x0,
0
# i
FirstLoop:
beq
t0, s3 EndFirstLoop
addi
t1, x0,
0
# j
SecondtLoop:
beq
t1, s3 EndSecondtLoop
addi
t2, x0,
0
# k
add
s5, x0, x0 # Holds a sum
ThirdLoop:
beq
t2, s3 EndThirdLoop
# @Matrix_1[i,k] = base@ + (i
* columns + k) * element size
mul
t3, t0, s3
add
t3, t3, t2
slli
t3, t3,
2
add
t3, t3, s0
lw
a0
, (t3)
add
a1
, x0,
a0
# @Matrix_2[k,j] = base@ + (k
* columns + j) * element size
mul
t4, t2, s3
add
t4, t4, t1
slli
t4, t4,
2
add
t4, t4, s1
lw
a0
, (t4)
mul
a1
,
a1
,
a0
add
s5, s5,
a1
addi
t2, t2,
1
j
ThirdLoop
EndThirdLoop:
# @Matrix_Result[i,j] = base@ + (i
* columns + j) * element size
mul
t5, t0, s3
add
t5, t5, t1
slli
t5, t5,
2
add
t5, t5, s2
sw
s5, (t5)
addi
t1, t1,
1
# Just printing
add
a0
, x0, s5
addi
a7
, x0,
1
ecall
la
a0
, Space
addi
a7
, x0,
4
ecall
j
SecondtLoop
EndSecondtLoop:
addi
t0, t0,
1
# Just a new line
la
a0
, EndLine
addi
a7
, x0,
4
ecall
j
FirstLoop
EndFirstLoop:
You can’t perform that action at this time.