Swift-RISCV-Emulator

所属分类:处理器开发
开发工具:Swift
文件大小:0KB
下载次数:0
上传日期:2023-06-19 23:40:09
上 传 者sh-1993
说明:  Swift RISCV模拟器,
(A Swift RISCV Emulator,)

文件列表:
Documentation/ (0, 2023-06-19)
Documentation/Screen Recording 2023-06-19 at 16.30.09.mov (3300688, 2023-06-19)
Documentation/Screenshot 2023-06-19 at 16.30.15.png (530800, 2023-06-19)
LICENSE (1501, 2023-06-19)
RISCV/ (0, 2023-06-19)
RISCV/Package.resolved (298, 2023-06-19)
RISCV/Package.swift (672, 2023-06-19)
RISCV/Sources/ (0, 2023-06-19)
RISCV/Sources/RISCV/ (0, 2023-06-19)
RISCV/Sources/RISCV/Assembler.swift (4113, 2023-06-19)
RISCV/Sources/RISCV/Examples.swift (3365, 2023-06-19)
RISCV/Sources/RISCV/InstructionSet.swift (6700, 2023-06-19)
RISCV/Sources/RISCV/Memory.swift (5069, 2023-06-19)
RISCV/Sources/RISCV/Processor.swift (3857, 2023-06-19)
RISCV/Sources/RISCV/RV32I+Formats.swift (6038, 2023-06-19)
RISCV/Sources/RISCV/RV32I+Instructions.swift (10490, 2023-06-19)
RISCV/Sources/RISCV/Register.swift (2133, 2023-06-19)
RISCV/Tests/ (0, 2023-06-19)
RISCV/Tests/RISCVTests/ (0, 2023-06-19)
RISCV/Tests/RISCVTests/RISCVTests.swift (353, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/ (0, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.pbxproj (17706, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.xcworkspace/ (0, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.xcworkspace/contents.xcworkspacedata (135, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.xcworkspace/xcshareddata/ (0, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (238, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/ (0, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (569, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/xcshareddata/ (0, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/xcshareddata/xcschemes/ (0, 2023-06-19)
Swift-RISCV-Emulator.xcodeproj/xcshareddata/xcschemes/Swift-RISV-Emulator.xcscheme (2959, 2023-06-19)
Swift-RISCV-Emulator/ (0, 2023-06-19)
Swift-RISCV-Emulator/Assets.xcassets/ (0, 2023-06-19)
Swift-RISCV-Emulator/Assets.xcassets/AccentColor.colorset/ (0, 2023-06-19)
Swift-RISCV-Emulator/Assets.xcassets/AccentColor.colorset/Contents.json (123, 2023-06-19)
Swift-RISCV-Emulator/Assets.xcassets/AppIcon.appiconset/ (0, 2023-06-19)
Swift-RISCV-Emulator/Assets.xcassets/AppIcon.appiconset/Contents.json (999, 2023-06-19)
... ...

# Swift-RISCV-Emulator ## What the heck is this? It's a Swift RISCV Emulator! ![Alt text](https://github.com/schwa/Swift-RISCV-Emulator/blob/master/) [Demo](https://github.com/schwa/Swift-RISCV-Emulator/blob/master/) ## Does it work? "Sure" ## No really, does it work? "Suure" ## How much of RISC-V does it emulate? RV32I: 32-bit Integer Instructions. So not very much. And maybe not all of RV32I - I forgot (this code is kinda old) ## Is it "correct"? Buggered if I know. I haven't tried comparing it to a real emulator. Let's go with no. ## Is it "fast"? It's not what you would call fast. The SwiftUI gui slows it down quite a bit and running headless speeds it up considerably. But it's not fast regardless. I wrote the code to be instructional. ## What's it doing? The sample project prints(*) "hello world" to the ECALL system call instruction. (* And by print, I mean not actually printing because ECALL isn't hooked up). ```asm LUI x1 \(globalsAddress) ; load address of "hello world" into x1 upper ADDI x1 x1 \(globalsAddress) ; load address of "hello world" into x1 lower ; start of loop LBU x2 x1 0 ; load byte at address x1 BEQ x2 x0 8 ; exit loop if x2 is nil byte ECALL ; system call ADDI x1 x1 1 ; increment x1 JAL x0 -8 ; jump to start of loop JAL x0 -14 ; jump to start ;JALR x0 x0 0 ; Force an illegal instruction to bail ``` ## Why? Because I found RISCV interesting, and I wanted to play with it. ## Why are you releasing this? Because it's kinda fun and it is rather old code I couldn't release it before because of employer restrictions. And someone might find it vaguely interesting/entertaining. ## Is there an assembler? There is but it's not great. But it assemblies the hello world program. What more do you want? ## Are you going to do more with it? Probably not. Hey, look! A squirrel! ## What license is this? BSD 3-Clause License as god intended. ## Where can I find out more about RISCV? Really?

近期下载者

相关文件


收藏者