View unanswered posts | View active topics It is currently Thu Jul 09, 2020 12:45 am

Reply to topic  [ 1 post ] 
 A RISC-V model, in C, in just a couple of pages of code 
Author Message

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1419
Notable: ... c-version/ ... /C_Version

There are a few RISC-V software versions out there, but my hope was to write something very simple and accessible. It only has 130 lines of code including comments!

Each loop though main() is effectively a single RISC-V clock tick. So one instruction per tick/loop. At the end of each loop I print out the program counter, the instruction’s name, some registers and decoded opcode parameters, then it waits for a keypress. This way you can single-step through your code and see the internals of the CPU!

Thu Apr 02, 2020 7:14 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software