EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Virtual (cycle accurate) CPU simulations

Started by strubi 5 years ago3 replieslatest reply 5 years ago197 views

Hi all,

I've been hacking away on a CPU builder in the past years that allows to build a microcontroller kinda from scratch with some standard peripherals in a configureable way using the linux kernel config tools. Finally, I've gotten around all the politics to make an githubbed version of it (HDL licenses are a bitch..).

Here it is: https://github.com/hackfin/MaSoCist

To give a quick overview, also for the non-FPGA hackers:

  • Allows to build a few CPU cores and run programs on it
  • Heavily based on GHDL simulator to create a cycle accurate 'virtual machine' of your chip
  • VHDL designs of CPU and peripherals The provided Docker container setup installs all the necessary tools (Compiler, ...).

The default build uses Stephan Nolting's msp430 clone 'neo430', which will fire up and speak to you through a virtual UART upon 'make all' (if you got the docker setup right).The difference to a CPU simulator like qemu or skyeye is, that the full hardware is simulated -- clock cycle accurately, therefore a few 1000 times slower. For safety related programming for instance, you can trace uninitialized memory issues or all kind of scenarios which may slip through compile time checkers (MISRA, etc.).

On the other hand, it can be just fun to see what a CPU is doing (debugging, learning...)Once you dive into the world of hardware synthesis on FPGAs, you can use this to configure and build your own microcontroller. Unfortunately, these synthesis setups don't 'opensource' well, so they're omitted from the github repo.

My particular real world application is a piece of FPGA based hardware made for safety relevant real time remote control - I've posted a snapshot at https://hackaday.io/project/162259-netpp-node. The more real cool shaite on the higher end is a full Camera SoC reference design that does compressed video network streaming on a Lattice HDR60 kit.

Have fun!

[ - ]
Reply by mr_banditNovember 30, 2018

Wow! Shows what an obsessed nerd can do with the tools available now. You have done what 20+ years ago took an entire team to do, with the resources of an Intel or Motorola!

You are an inspiration to obsessed nerds everywhere! Definately worth a few beers!

[ - ]
Reply by strubiNovember 30, 2018

Hi,


thanks for the beer, however, you could actually consider this being done by a 'team' in some way. I wouldn't have made it without Tristan Gingolds GHDL and all the nice tools from the GNU world.

Heh, well, that's the beauty of OpenSource :-)


[ - ]
Reply by mr_banditNovember 30, 2018

Point taken.

We have such incredible tools and resources today. My father worked at GE Computer systems in Phoenix in the 60's. Memory (core) was in the kilobyte range. Speeds were in the kilocycles. And the costs were in the 10's to 100's of millions. 

Google "ge erma computer" - this was the first computer to be used by the banking industry - Bank of America. quote: "The first production ERMA system, known as the GE-100, was installed in 1959" See https://en.wikipedia.org/wiki/Electronic_Recording...

To give you an idea of what it took to run: IBM replaced it after ERMA ran for 5..6 years. But see http://ed-thelen.org/comp-hist/ERMA.html

"The IBM contract to replace the ERMA systems had a delivery penalty. IBM was to pay the ERMA maintenance until their system was up and running.

"For 18 months I had the monthly joy of phoning IBM and dunning them for payment of the $250,000 monthly bill. Today, it's hard to conceive of such amounts. (emphasis added)

The bill was for power to run it, air conditioning, support staff. I don't have the link, but I know the air conditioning cost more than the electricity to run the computer itself.

Specs: https://www.smecc.org/ge_erma_-_100_series_-_the_s...  for example:

Average error-free running period 2 Hours
Good time 60 Hours/Week (Average)
Attempted to run time 62 Hours/Week (Average)

http://www.computerhistory.org/brochures/g-i/

Now, we can get a 100 MHz ARM (rPi), in the mail, for under $100, with free tools. An Arduino 8MHz for $20.

We truly stand on the shoulders of Giants.

The 2024 Embedded Online Conference