Click here to Skip to main content
15,908,015 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hello ! I want to start a new project . My goal is to simulate a CISC arhitecture(I have the structure of my arhitecture). Ok my first step is to make a language interpretor (I don`t know if this is the corect word but I hope you understand what I mean). For exp for the line mov r1,[r2] the result will be 0000 000001 010010.
So
mov = 0000
r1 = 0001 and the first 2 bits represent the "Addressing modes" 00 - direct
r2 = 0010 01 - indirect

My problem is that I don`t know what is better for me to make the connection between these two.
I thought to store my data in a hashtable like : value = "mov" as a string and key = 0000 as a byte . I know that I can do it with this method but I want some other opinions about this .

What do you suggest that is better to use . I want just some ideas , not code or something like that .


Thank you very much in advance.

CISC arhitecture
Posted
Updated 10-Dec-11 5:13am
v3
Comments
Amir Mahfoozi 10-Dec-11 7:44am    
I think you meant Dictionary data structure rather than Hashtable. Because in hash tables two or more inputs will reach to the same output, but you don't need this condition.
BillWoodruff 10-Dec-11 19:02pm    
It seems to me this is a problem domain that might be addressed by the use of the Domain Specific Language facilities in .NET. You might take a look at this two-part series on CP: http://www.codeproject.com/KB/recipes/YourFirstDSL.aspx

Disclaimer: I've never used the DSL aspects of .NET.

1 solution

That is called a cross assembler, and while I have never seem one written in C#, there are quite a lot written in C or C++.
Google will help you find them - it's not as simple as you think! Have a look at how some existing ones are written, and try to see if there are ideas you can use.

To be honest, I would start this from the other end, if you are simulating the whole CISC architecture: start with the CPU core and write the instruction processor. That way, you have something to test the cross assembler against when you have written it... :laugh:
 
Share this answer
 
Comments
Radu_Socaciu 10-Dec-11 8:31am    
Thank you for your replay. I know that is not easy to do this , but I`ve already implemented the idea with hashtables and is working (I mean I can give a set of instruction and convert it in machine language only if the code is corect).

You`re ideea "I would start this from the other end" is interesting And I will try it .

I don`t know if i can attach an image , but if I can I will attach one with my arhitecture just to make an ideea.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900