Writing Hardware Simulators?

M

Miki Tebeka

Hello All,

I'll be writing a hardware simulator for one of our CPU's shortly.
Any advices/links/... on the subject?

Thanks.
Miki
 
P

Peter Hansen

Miki said:
I'll be writing a hardware simulator for one of our CPU's shortly.
Any advices/links/... on the subject?

No links I'm aware of, although you can easily find an HC11 simulator
out there somewhere.

Kaval has written but not yet released (okay, not even completed) an
HC12 simulator (independent of the above effort).

Performance is roughly 1/60 of the actual CPU speed running at the
nominal clock speed (16MHz), when the code is run on the simulator
on a PC of about 600MHz.

If performance is not your greatest concern (which presumably it isn't
or you wouldn't consider Python in the first place :), you shouldn't
have much difficulty...

Advice? Write *lots* of tests. In fact, write dozens (literally!)
of test cases for each opcode.

Make sure you have a clear idea of your priorities and don't try to
implement more than you really need, to begin with. I didn't need
anything involving simulating the actual instruction cycle times
(i.e. simulating time was not important yet), and I haven't gotten
to the point where I care much about simulating hardware peripherals
such as the serial port. I'm just doing the basic CPU and opcodes,
and obviously memory. As a result of this narrow focus, it took
only a few weeks to produce an effective, usable simulator, although
I still have a few opcodes to complete. (Even the opcodes I'm
implementing only as I have code that requires them. I suggest
implementing an UnimplementedOpcode exception for *all* opcodes,
then running your code. Only implement the actual opcodes as you
need them...)

-Peter
 
D

Donald 'Paddy' McCarthy

I take it that this is an instruction set simulator (ISS) rather than an
RTL level simulator?
 
M

Miki Tebeka

Hello Donald,
I take it that this is an instruction set simulator (ISS) rather than an
RTL level simulator?
Not so sure about the difference (RTL = Real Time Logic?).
It should simulate the CPU and some peripherials as well.
Currently I can ignore the pipline and some other stuff.

Thanks.
Miki
 
J

Jan Decaluwe

Miki said:
Hello Donald,



Not so sure about the difference (RTL = Real Time Logic?).
It should simulate the CPU and some peripherials as well.
Currently I can ignore the pipline and some other stuff.

RTL = Register Transfer Level. This is a hardware description style
that models transfers between registers. In practice, it is often
used to refer to "synthesizable" hardware models, that is, models
that can be converted to a gate implementation automatically.

If you need to model hardware, it may be easier when you have a
light-weight model for deterministic concurrency. This is what
so-called "hardware description languages" (HDLs) provide. I wrote
a package that turns Python into an HDL, using generators:

http://jandecaluwe.com/Tools/MyHDL/Overview.html

There is a one-week old mailing list:

http://sourceforge.net/mail/?group_id=91207

with a nntp gateway though gmane:

nntp://news.gmane.org/gmane.comp.python.myhdl

Nick Patavalis has just posted an example CPU simulator
to this mailing list, so you may want to check it out.

Regards, Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top