Click to See Complete Forum and Search --> : IO level of abstraction in a Virtual Machine


Khaled.Alshaya
December 17th, 2008, 08:16 AM
First, it is my pleasure to be a new member of this community

Second, I am reading these days about virtual machines, and their architectures. I decided to write my own very simple easy to program hypothetical VM. I could easily imagine the level of abstraction needed to design my processor ISA and memory system. But I need some information about the IO interface.

Which architecture is easier to implement and which of them is easier to program? : Memory mapped IO or port mapped IO. Basically, I just want to support keyboard input and simple screen output like a console, of course my VM environment is going to be implemented on top of windows .

Sorry if what I am asking about is not clear enough.

Best regards...

TheCPUWizard
December 17th, 2008, 09:02 AM
There are many different types of "Virtual Machines". At one end of the spectrum you have language environments such as the Javas VM. At the other end, you have complete system virtualization [VirtualPC, VMWare, Citrix/Zen]

So the first questions is which type are you considering implementing?

Khaled.Alshaya
December 17th, 2008, 09:24 AM
I am not interested in an emulation of a real processor. What I am trying to design is a hypothetical machine like the Java virtual machine. I am not trying to do something big like JVM. My purpose is educational in first place. So the environment could contain an assembler, debugger and of course the executer. Maybe the best available example is the Ant Machine: The Ant Virtual Machine (http://ant.eecs.harvard.edu/)

Thanks for your help...

TheCPUWizard
December 17th, 2008, 09:41 AM
I am not interested in an emulation of a real processor. What I am trying to design is a hypothetical machine like the Java virtual machine. I am not trying to do something big like JVM. My purpose is educational in first place. So the environment could contain an assembler, debugger and of course the executer. Maybe the best available example is the Ant Machine: The Ant Virtual Machine (http://ant.eecs.harvard.edu/)

Thanks for your help...

Then start with a simple set of 2 instructions, one to write a character and one to read a character.

Remember you will be defining the virtual architecture. Rather than attempting to come up with one on your own, it would probably be best to pick one of the 1970's generation microprocessors (8080, 6800, 1802, etc) to identify common instructions.

Khaled.Alshaya
December 17th, 2008, 10:22 AM
Ok, I have a clear idea how the input operation could be done. What about the output?
Is it a good idea to represent screen in the following way:
If we assume that the screen of our machine is capable of drawing 80*25 characters. Then an example of output operation could be like this:

out register, [Address]
{Op src, des}
Where [Address] = 0 -> 1999

So the programmer could write the character where ever he wants on the screen. Is it a good idea?

I understand from you that port-mapped IO is a better solution in my situation!
By the way, I took a lot of ideas from the 68K which I studied in computer architecture class two years ago :D

Thanks...

TheCPUWizard
December 17th, 2008, 10:30 AM
1) That would be one way, but you might want to start with a simple "teletype" style interface [ie a console with no cursor controls, atributes or anything else].

2) Whay to you think IO needs to be Port or Memory mapped??? It is simpler to just define an INSTRUCTION (as I stated in my original reply). If you are going to use a "mapped" arrangement, then you have tradeoffs. Memory does not NEED any additional instructions (but does require a smart "linker"). Port requires additional instruction(s) - so is at least (probable more) work than a simple instruction.

3) The 68K is a fairly complex architecture, but not a bad environment.

Khaled.Alshaya
December 17th, 2008, 10:40 AM
Thank you, your posts are very helpful. It is clear now.