-
Notifications
You must be signed in to change notification settings - Fork 20
Example implementation of LC3 #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Benchmarking (Linux) factorialCompiling factorial (factorial.con) Benchmarking (Linux) fibCompiling fib (fib.con) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #231 +/- ##
=======================================
Coverage 56.29% 56.29%
=======================================
Files 25 25
Lines 5516 5516
=======================================
Hits 3105 3105
Misses 2411 2411 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmarking (macOS) factorialCompiling factorial (factorial.con) Benchmarking (macOS) fibCompiling fib (fib.con) |
This PRs adds an example implementation of a LC3 virtual machine, based on Write your Own Virtual Machine, by Justin Meiners and Ryan Pendleton.
I added the full implementation to
examples/lc3
. Additionally, I changed some elements of the standard library.The implementation contains some
FIX
notes, that indicate that I had to use a hacky solution to workaround a current limitation of the language.Some important features that are missing are:
&self.field.inner
or&self.field[3]
.[0; 3]
instead of[0, 0, 0]
.&
,<<
,>>
.Debugging is also bit difficult right now, as we don't have a good way to format values. The workaround I found is to write raw data to a file, and read it with another tool. As an example, I added a justfile with some commands that allowed me to inspect the raw data.
Implementation