how to start developing a CPU emulator?

I have this task in front of me: Develop a processor emulator, create an assembly language for it, and write several programs. You need to come up with your own CPU architecture and come up with a number of commands, read about modern architectures and for example the SSE and AVX command sets.

Please help me understand. I understood it this way(although the understanding is still very superficial): I don't have to directly mess with registers and all that? The main thing is that everything is correct at the logical level do it and not physically? That is, you can take any YAP, for example Java, and write a processor on it? It will have nothing to do with physical processors, but logically we will correspond to them. That is, we can have a program in which an array is created - our memory emulation, for example: long[] memory = new long[1024 * 1024]. Another array is emulated registers. Our main program starts, both arrays are created, and then it starts reading from a pre-prepared software file one line. But in the file, we will write our command system in advance - Logical - and, or, not, xor. Numerical-add, sub, mul, div. The program will read them and execute them. That is, in the main function of the program that reads and executes commands, you can write switch if add - > add, if mul - > multiply, etc. Please tell me, at least the direction of thoughts is correct?

1 answers

For training purposes, it is better to take a simple processor that has the makings and a lot in common with the real ones, but not the real one - it is 100%. There will be a lot of optimization in the hardware that you will not understand and limitations due to the cruel real world, which does not allow you to implement everything as simply as you would like in theory.

The professor showed us how to get from simple binary operations to C++. In the end (all who passed) easily proved the invariance of C++ programs and logical states of the processor software steps. But I'm afraid you can't do without a good teacher. Look at this example, to just understand what an ALU is, you need to be pretty good at discrete math. Working with memory is not possible without MUX DEMUX and knowledge about them, what is the stack and where the OP is stored, etc. Languages are a separate topic and very extensive.

enter a description of the image here

Look at Computation Structures-Part 1 and Computation Structures - Part 2, I I am sure that these courses will give you an order of magnitude more than what you yourself will wander in haphazard wiki articles, and even more so here. With all my respect for this project, it is absolutely not academic and does not strive for it.

P. S. Here is a good set of commands - from my relics ) enter a description of the image here enter a description of the image here

 4
Author: Webaib, 2016-03-10 22:35:07