TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RISC-V Assembler: Arithmetic

72 pointsby WillFluxover 1 year ago

4 comments

throwaway71271over 1 year ago
I love RISC-V assembler.<p>I did a bit of x86 as stuff 20 years ago but hated it, now I wanted to teach my daughter some c and assembler and was thinking between arm and riscv, but riscv is just a joy to teach (I made a riscv assembler boardgame to help with the task <a href="https:&#x2F;&#x2F;punkx.org&#x2F;overflow&#x2F;" rel="nofollow">https:&#x2F;&#x2F;punkx.org&#x2F;overflow&#x2F;</a>)<p>Recently I was rewatching Hackers(1995) and I also got excited about the same quote:<p>&gt; “RISC architecture is going to change everything.” — Acid Burn<p>After spending some time with esp32s and riscv assembler, I think its more true than before :)<p>If you havent given it a try yet, there are many articles like the one, and also projects like <a href="https:&#x2F;&#x2F;luplab.gitlab.io&#x2F;rvcodecjs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;luplab.gitlab.io&#x2F;rvcodecjs&#x2F;</a> or <a href="https:&#x2F;&#x2F;riscv.vercel.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;riscv.vercel.app&#x2F;</a> where you can play with it, or even make your own emulator by learning from other emulators like <a href="https:&#x2F;&#x2F;github.com&#x2F;OpenMachine-ai&#x2F;tinyfive&#x2F;blob&#x2F;main&#x2F;machine.py">https:&#x2F;&#x2F;github.com&#x2F;OpenMachine-ai&#x2F;tinyfive&#x2F;blob&#x2F;main&#x2F;machine...</a><p>this cheatsheet is also very useful: <a href="https:&#x2F;&#x2F;www.cl.cam.ac.uk&#x2F;teaching&#x2F;1617&#x2F;ECAD+Arch&#x2F;files&#x2F;docs&#x2F;RISCVGreenCardv8-20151013.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cl.cam.ac.uk&#x2F;teaching&#x2F;1617&#x2F;ECAD+Arch&#x2F;files&#x2F;docs&#x2F;...</a>
评论 #39218243 未加载
评论 #39223313 未加载
WillFluxover 1 year ago
68000 is, in many ways, the pinnacle of assembler for programming, but RISC-V is pretty fun, too. I hope RISC-V tempts a few more people to try asm programming (again).
评论 #39202961 未加载
sylwareover 1 year ago
RISC-V, being an ISA worldwide royalty free standard, is meant for assembly writting. The main reason, above the &quot;comfort&quot; reason of C and similar, was ISA abstraction which has no meaning in the RISC-V realm. The middle ground is those very high level language interpreters (python&#x2F;lua&#x2F;ruby&#x2F;javascript&#x2F;etc) written directly in RISC-V assembly (without abuse of any assembler preprocessor, ofc).<p>I am currently writting my own rv64 on x64 virtual machine process, to code my programs in rv64 and not anymore in x64 in order to be &quot;real hardware ready&quot;.<p>BTW, anybody knows a EU based distributor of milk-v duo boards with the cv1800 SOC (the one without ARM cores and a rv64 MCU) which I can contact using my domestic email server?
IshKebabover 1 year ago
&gt; ProTip: Hexadecimal literals are prefixed with 0x.<p>I love the idea that someone could get to this page and not already know that!<p>Also this nicely highlights my pet peeve with assembly:<p><pre><code> add rd, rs1, rs2 # rd = rs1 + rs2 </code></pre> It&#x27;s very difficult to remember which parameter is the destination etc. IMO it would be much nicer if assembly had just a <i>little</i> more syntax for that sort of thing. E.g.<p><pre><code> rd = add rs1, rs2 t0 = li 5 </code></pre> Just so the destination register is obvious. Ah well, nobody&#x27;s going to do that. Assembly parsing is a total mess; there&#x27;s no official grammar or anything - it&#x27;s just &quot;what GCC&#x2F;LLVM do&quot;.
评论 #39220502 未加载
评论 #39219526 未加载
评论 #39220435 未加载
评论 #39224099 未加载
评论 #39220376 未加载
评论 #39232038 未加载
评论 #39222908 未加载
评论 #39221054 未加载
评论 #39221010 未加载