Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
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 }}
Mercury-0510
riscv-sim
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
riscv-sim
/
programs
/
testcode
/
diff_smoke.S
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
64 lines (63 loc) · 1.57 KB
main
Breadcrumbs
riscv-sim
/
programs
/
testcode
/
diff_smoke.S
Copy path
Top
File metadata and controls
Code
Blame
64 lines (63 loc) · 1.57 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
/* RV64IMA only。每条源寄存器都显式初始化,避免复位后的未知值混进差分比较。 */
.section .text.init
.globl _start, test_done
_start:
auipc x4, 0
addi x1, x0, -13
addi x2, x0, 5
add x3, x1, x2
sw x3, 0x400(x4)
lw x5, 0x400(x4)
bne x3, x5, fail
sb x1, 0x404(x4)
lb x6, 0x404(x4)
lbu x7, 0x404(x4)
sh x1, 0x406(x4)
lh x8, 0x406(x4)
lhu x9, 0x406(x4)
mul x10, x1, x2
mulh x11, x1, x2
mulhsu x12, x1, x2
mulhu x13, x1, x2
div x14, x1, x2
divu x15, x1, x2
rem x16, x1, x2
remu x17, x1, x2
addi x18, x0, 3
loop:
addi x18, x18, -1
bne x18, x0, loop
jal x19, target
sw x0, 0x400(x4) /* wrong path */
fail:
addi x31, x0, -1
jal x0, fail
target:
auipc x20, 0
addi x20, x20, 12
jalr x21, x20, 0
test_done:
addi x31, x0, 1
/* 用 HTIF 通知 Spike 退出(exitcode 0):向 tohost 写 64 位值 1。
* 模拟器不实现 HTIF,它靠 --stop-pc test_done 在上一行停机,所以这几条
* 不会在被测侧执行——这段代码唯一的验证来源是 Spike 的进程退出码。 */
lla x7, tohost
addi x8, x0, 1
#if __riscv_xlen == 64
sd x8, 0(x7)
#else
sw x8, 0(x7)
sw x0, 4(x7)
#endif
halt:
jal x0, halt
/* HTIF 通信字。link.ld 把它固定在 0x80001000,与 .text 分开,因此不会
* 撑大取指窗口,也不影响 test_done 之前任何一条指令的退休计数。 */
.section .tohost,"aw",@progbits
.align 3
.globl tohost
tohost:
.dword 0
.globl fromhost
fromhost:
.dword 0
You can’t perform that action at this time.