What is the simplest instruction set that has a C++/C compiler to write an emulator for? [closed]Seeing how Instructions get Translated (Computer Architecture)Does anyone know the hardware of a Nike+ SportWatch GPS?Building a simple PC - looking for a CPUConfused what computer architecture is in realWriting DSP algorithms directly in C or assembly?Would semi-VLIW make sense?C++ - Help Interpreting the instructions of a CRC error-checking programming assignmentHow Specifically the Control Unit (CU) WorksWould a standardized graphics chip socket be sensible?Treating Multiple CPU Cores as One

Circle symbol compatible with square and triangle

What is a good example for artistic ND filter applications?

Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?

What would the United Kingdom's "optimal" Brexit deal look like?

What is the highest achievable score in Catan

How to innovate in OR

Scam? Checks via Email

Why did Windows 95 crash the whole system but newer Windows only crashed programs?

Verb Classification of あげる (to give)

"DDoouubbllee ssppeeaakk!!"

Is it possible to tell if a child will turn into a Hag?

Unique custom field - contact creation

Why did some Apollo missions carry a grenade launcher?

Can a US President, after impeachment and removal, be re-elected or re-appointed?

May a hotel provide accommodation for fewer people than booked?

Why does the Rust compiler not optimize code assuming that two mutable references cannot alias?

PCB design using code instead of clicking a mouse?

How to have poached eggs in "sphere form"?

Unknown indication below upper stave

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

Word for giving preference to the oldest child

How to prevent a single-element caster from being useless against immune foes?

Coworker mumbles to herself when working, how to ask her to stop?

How did astronauts using rovers tell direction without compasses on the Moon?



What is the simplest instruction set that has a C++/C compiler to write an emulator for? [closed]


Seeing how Instructions get Translated (Computer Architecture)Does anyone know the hardware of a Nike+ SportWatch GPS?Building a simple PC - looking for a CPUConfused what computer architecture is in realWriting DSP algorithms directly in C or assembly?Would semi-VLIW make sense?C++ - Help Interpreting the instructions of a CRC error-checking programming assignmentHow Specifically the Control Unit (CU) WorksWould a standardized graphics chip socket be sensible?Treating Multiple CPU Cores as One






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5












$begingroup$


I'm looking into writing a little software emulator that emulates/runs instructions.



The easiest would be to invent my own instruction set, but I thought it would be more fun if I write an emulator for an instruction set that already has a C++/C compiler.



What is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?



By easiest, I mean the least number of instructions.










share|improve this question











$endgroup$




closed as primarily opinion-based by pipe, Dmitry Grigoryev, Dave Tweed Jul 22 at 0:07


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 1




    $begingroup$
    Do you mean "what is the simplest instruction set that could have a C compiler?", or "what is the simplest instruction set that already exists and does have a C compiler?" The answers are different (the answer to the first is "anything that's Turing complete").
    $endgroup$
    – TimWescott
    Jul 20 at 16:21






  • 2




    $begingroup$
    @appmaker1358 C arrived from 1969-1973, together with Unix. In the time I became involved with the Unix v6 kernel, circa 1978, Unix was going through a "portability" phase and the first published book on C also arrived (I still have my original copy from that year, since I needed to learn C to work on the Unix kernel.) The C development team got a PDP-11 (previously, C was in the process of deriving from B on the PDP-7) in 1970. It's arguable about where the ++ and -- operators came from. But I can, for sure, tell you that generating assembly code for the PDP-11 from C is pretty easy.
    $endgroup$
    – jonk
    Jul 21 at 8:12






  • 1




    $begingroup$
    @MarcusMüller I've just been lucky enough to work on some fun projects with some interesting people.
    $endgroup$
    – jonk
    Jul 21 at 18:39







  • 1




    $begingroup$
    @MarcusMüller There's no good way to make money being a pure basic physics researcher. A good friend, Dr. Saul-Paul Sirag, worked on M-theory (with Dr. Ed Witten, at times) and made about USD3k/yr! You can't live on that. I made money as a programmer. My interests remain with mathematics and physics and I've been lucky enough to secure some nice programming roles near people solving interesting physics problems. I've had the benefit of having my cake and eating it - paid good to work with great folks doing interesting physics and fun mathematics solving meaningful problems. Can't get better.
    $endgroup$
    – jonk
    Jul 21 at 18:56






  • 3




    $begingroup$
    This has now turned in to a question that's both a list question and unclear. The answers so far are disregarded due to some unwritten criteria of yours (suddenly you don't want a simple and small, you want at least 50 instructions and 32 bits. What else?)
    $endgroup$
    – pipe
    Jul 21 at 20:47

















5












$begingroup$


I'm looking into writing a little software emulator that emulates/runs instructions.



The easiest would be to invent my own instruction set, but I thought it would be more fun if I write an emulator for an instruction set that already has a C++/C compiler.



What is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?



By easiest, I mean the least number of instructions.










share|improve this question











$endgroup$




closed as primarily opinion-based by pipe, Dmitry Grigoryev, Dave Tweed Jul 22 at 0:07


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 1




    $begingroup$
    Do you mean "what is the simplest instruction set that could have a C compiler?", or "what is the simplest instruction set that already exists and does have a C compiler?" The answers are different (the answer to the first is "anything that's Turing complete").
    $endgroup$
    – TimWescott
    Jul 20 at 16:21






  • 2




    $begingroup$
    @appmaker1358 C arrived from 1969-1973, together with Unix. In the time I became involved with the Unix v6 kernel, circa 1978, Unix was going through a "portability" phase and the first published book on C also arrived (I still have my original copy from that year, since I needed to learn C to work on the Unix kernel.) The C development team got a PDP-11 (previously, C was in the process of deriving from B on the PDP-7) in 1970. It's arguable about where the ++ and -- operators came from. But I can, for sure, tell you that generating assembly code for the PDP-11 from C is pretty easy.
    $endgroup$
    – jonk
    Jul 21 at 8:12






  • 1




    $begingroup$
    @MarcusMüller I've just been lucky enough to work on some fun projects with some interesting people.
    $endgroup$
    – jonk
    Jul 21 at 18:39







  • 1




    $begingroup$
    @MarcusMüller There's no good way to make money being a pure basic physics researcher. A good friend, Dr. Saul-Paul Sirag, worked on M-theory (with Dr. Ed Witten, at times) and made about USD3k/yr! You can't live on that. I made money as a programmer. My interests remain with mathematics and physics and I've been lucky enough to secure some nice programming roles near people solving interesting physics problems. I've had the benefit of having my cake and eating it - paid good to work with great folks doing interesting physics and fun mathematics solving meaningful problems. Can't get better.
    $endgroup$
    – jonk
    Jul 21 at 18:56






  • 3




    $begingroup$
    This has now turned in to a question that's both a list question and unclear. The answers so far are disregarded due to some unwritten criteria of yours (suddenly you don't want a simple and small, you want at least 50 instructions and 32 bits. What else?)
    $endgroup$
    – pipe
    Jul 21 at 20:47













5












5








5


1



$begingroup$


I'm looking into writing a little software emulator that emulates/runs instructions.



The easiest would be to invent my own instruction set, but I thought it would be more fun if I write an emulator for an instruction set that already has a C++/C compiler.



What is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?



By easiest, I mean the least number of instructions.










share|improve this question











$endgroup$




I'm looking into writing a little software emulator that emulates/runs instructions.



The easiest would be to invent my own instruction set, but I thought it would be more fun if I write an emulator for an instruction set that already has a C++/C compiler.



What is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?



By easiest, I mean the least number of instructions.







c cpu computer-architecture c++ architecture






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 21 at 13:04









Peter Mortensen

1,5993 gold badges14 silver badges22 bronze badges




1,5993 gold badges14 silver badges22 bronze badges










asked Jul 20 at 13:32









appmaker1358appmaker1358

1411 silver badge9 bronze badges




1411 silver badge9 bronze badges





closed as primarily opinion-based by pipe, Dmitry Grigoryev, Dave Tweed Jul 22 at 0:07


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.











closed as primarily opinion-based by pipe, Dmitry Grigoryev, Dave Tweed Jul 22 at 0:07


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as primarily opinion-based by pipe, Dmitry Grigoryev, Dave Tweed Jul 22 at 0:07


Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    $begingroup$
    Do you mean "what is the simplest instruction set that could have a C compiler?", or "what is the simplest instruction set that already exists and does have a C compiler?" The answers are different (the answer to the first is "anything that's Turing complete").
    $endgroup$
    – TimWescott
    Jul 20 at 16:21






  • 2




    $begingroup$
    @appmaker1358 C arrived from 1969-1973, together with Unix. In the time I became involved with the Unix v6 kernel, circa 1978, Unix was going through a "portability" phase and the first published book on C also arrived (I still have my original copy from that year, since I needed to learn C to work on the Unix kernel.) The C development team got a PDP-11 (previously, C was in the process of deriving from B on the PDP-7) in 1970. It's arguable about where the ++ and -- operators came from. But I can, for sure, tell you that generating assembly code for the PDP-11 from C is pretty easy.
    $endgroup$
    – jonk
    Jul 21 at 8:12






  • 1




    $begingroup$
    @MarcusMüller I've just been lucky enough to work on some fun projects with some interesting people.
    $endgroup$
    – jonk
    Jul 21 at 18:39







  • 1




    $begingroup$
    @MarcusMüller There's no good way to make money being a pure basic physics researcher. A good friend, Dr. Saul-Paul Sirag, worked on M-theory (with Dr. Ed Witten, at times) and made about USD3k/yr! You can't live on that. I made money as a programmer. My interests remain with mathematics and physics and I've been lucky enough to secure some nice programming roles near people solving interesting physics problems. I've had the benefit of having my cake and eating it - paid good to work with great folks doing interesting physics and fun mathematics solving meaningful problems. Can't get better.
    $endgroup$
    – jonk
    Jul 21 at 18:56






  • 3




    $begingroup$
    This has now turned in to a question that's both a list question and unclear. The answers so far are disregarded due to some unwritten criteria of yours (suddenly you don't want a simple and small, you want at least 50 instructions and 32 bits. What else?)
    $endgroup$
    – pipe
    Jul 21 at 20:47












  • 1




    $begingroup$
    Do you mean "what is the simplest instruction set that could have a C compiler?", or "what is the simplest instruction set that already exists and does have a C compiler?" The answers are different (the answer to the first is "anything that's Turing complete").
    $endgroup$
    – TimWescott
    Jul 20 at 16:21






  • 2




    $begingroup$
    @appmaker1358 C arrived from 1969-1973, together with Unix. In the time I became involved with the Unix v6 kernel, circa 1978, Unix was going through a "portability" phase and the first published book on C also arrived (I still have my original copy from that year, since I needed to learn C to work on the Unix kernel.) The C development team got a PDP-11 (previously, C was in the process of deriving from B on the PDP-7) in 1970. It's arguable about where the ++ and -- operators came from. But I can, for sure, tell you that generating assembly code for the PDP-11 from C is pretty easy.
    $endgroup$
    – jonk
    Jul 21 at 8:12






  • 1




    $begingroup$
    @MarcusMüller I've just been lucky enough to work on some fun projects with some interesting people.
    $endgroup$
    – jonk
    Jul 21 at 18:39







  • 1




    $begingroup$
    @MarcusMüller There's no good way to make money being a pure basic physics researcher. A good friend, Dr. Saul-Paul Sirag, worked on M-theory (with Dr. Ed Witten, at times) and made about USD3k/yr! You can't live on that. I made money as a programmer. My interests remain with mathematics and physics and I've been lucky enough to secure some nice programming roles near people solving interesting physics problems. I've had the benefit of having my cake and eating it - paid good to work with great folks doing interesting physics and fun mathematics solving meaningful problems. Can't get better.
    $endgroup$
    – jonk
    Jul 21 at 18:56






  • 3




    $begingroup$
    This has now turned in to a question that's both a list question and unclear. The answers so far are disregarded due to some unwritten criteria of yours (suddenly you don't want a simple and small, you want at least 50 instructions and 32 bits. What else?)
    $endgroup$
    – pipe
    Jul 21 at 20:47







1




1




$begingroup$
Do you mean "what is the simplest instruction set that could have a C compiler?", or "what is the simplest instruction set that already exists and does have a C compiler?" The answers are different (the answer to the first is "anything that's Turing complete").
$endgroup$
– TimWescott
Jul 20 at 16:21




$begingroup$
Do you mean "what is the simplest instruction set that could have a C compiler?", or "what is the simplest instruction set that already exists and does have a C compiler?" The answers are different (the answer to the first is "anything that's Turing complete").
$endgroup$
– TimWescott
Jul 20 at 16:21




2




2




$begingroup$
@appmaker1358 C arrived from 1969-1973, together with Unix. In the time I became involved with the Unix v6 kernel, circa 1978, Unix was going through a "portability" phase and the first published book on C also arrived (I still have my original copy from that year, since I needed to learn C to work on the Unix kernel.) The C development team got a PDP-11 (previously, C was in the process of deriving from B on the PDP-7) in 1970. It's arguable about where the ++ and -- operators came from. But I can, for sure, tell you that generating assembly code for the PDP-11 from C is pretty easy.
$endgroup$
– jonk
Jul 21 at 8:12




$begingroup$
@appmaker1358 C arrived from 1969-1973, together with Unix. In the time I became involved with the Unix v6 kernel, circa 1978, Unix was going through a "portability" phase and the first published book on C also arrived (I still have my original copy from that year, since I needed to learn C to work on the Unix kernel.) The C development team got a PDP-11 (previously, C was in the process of deriving from B on the PDP-7) in 1970. It's arguable about where the ++ and -- operators came from. But I can, for sure, tell you that generating assembly code for the PDP-11 from C is pretty easy.
$endgroup$
– jonk
Jul 21 at 8:12




1




1




$begingroup$
@MarcusMüller I've just been lucky enough to work on some fun projects with some interesting people.
$endgroup$
– jonk
Jul 21 at 18:39





$begingroup$
@MarcusMüller I've just been lucky enough to work on some fun projects with some interesting people.
$endgroup$
– jonk
Jul 21 at 18:39





1




1




$begingroup$
@MarcusMüller There's no good way to make money being a pure basic physics researcher. A good friend, Dr. Saul-Paul Sirag, worked on M-theory (with Dr. Ed Witten, at times) and made about USD3k/yr! You can't live on that. I made money as a programmer. My interests remain with mathematics and physics and I've been lucky enough to secure some nice programming roles near people solving interesting physics problems. I've had the benefit of having my cake and eating it - paid good to work with great folks doing interesting physics and fun mathematics solving meaningful problems. Can't get better.
$endgroup$
– jonk
Jul 21 at 18:56




$begingroup$
@MarcusMüller There's no good way to make money being a pure basic physics researcher. A good friend, Dr. Saul-Paul Sirag, worked on M-theory (with Dr. Ed Witten, at times) and made about USD3k/yr! You can't live on that. I made money as a programmer. My interests remain with mathematics and physics and I've been lucky enough to secure some nice programming roles near people solving interesting physics problems. I've had the benefit of having my cake and eating it - paid good to work with great folks doing interesting physics and fun mathematics solving meaningful problems. Can't get better.
$endgroup$
– jonk
Jul 21 at 18:56




3




3




$begingroup$
This has now turned in to a question that's both a list question and unclear. The answers so far are disregarded due to some unwritten criteria of yours (suddenly you don't want a simple and small, you want at least 50 instructions and 32 bits. What else?)
$endgroup$
– pipe
Jul 21 at 20:47




$begingroup$
This has now turned in to a question that's both a list question and unclear. The answers so far are disregarded due to some unwritten criteria of yours (suddenly you don't want a simple and small, you want at least 50 instructions and 32 bits. What else?)
$endgroup$
– pipe
Jul 21 at 20:47










9 Answers
9






active

oldest

votes


















8












$begingroup$


Easiest would be to invent my own instruction set




uh, ok, we might come from very different experiences here…




With easiest I mean the least amount of instructions.




That's not necessarily the easiest to implement. Often, having more instructions is a good complexity tradeoff compared to having more complex instructions.




So my question is, what is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?




This sounds like no job for C++, so let's concentrate on C. (If you don't understand the difference having C++ RAII paradigm makes, you might not be in the optimum position to design your own ISA.)



Puh, some microcontroller instruction set that is early, but not too early (because too early would imply "designed around the limitations of digital logic of that time, like e.g. 8051).



AVR might be a good choice, though I personally don't like that too much.



I hear Zilog Z80 is easy to implement (there's really several Z80 implementations out there), but it's pretty ancient, and not very comfortable (being from the mid-70s).



If you really just want a small core to control what your system is doing, why not pick one of the many processor core designs that are out there?



For example, RISC-V is a (fairly complex) instruction set architecture, with mature compilers, and many open source implementations. For a minimal FPGA core, picoRV32 would probably the core of choice. And on a computer, you'd just run QEMU.






share|improve this answer











$endgroup$










  • 4




    $begingroup$
    RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
    $endgroup$
    – Lucas Ramage
    Jul 20 at 13:59






  • 4




    $begingroup$
    It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
    $endgroup$
    – Marcus Müller
    Jul 20 at 14:03










  • $begingroup$
    C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
    $endgroup$
    – Ben Voigt
    Jul 20 at 14:09










  • $begingroup$
    @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
    $endgroup$
    – Marcus Müller
    Jul 20 at 14:23










  • $begingroup$
    @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
    $endgroup$
    – Ben Voigt
    Jul 20 at 14:40


















8












$begingroup$

You should take al look at the PIC microcontroller family. The instruction set is limited to 35 different instructions, while the controller is actually still used.
Look at the datasheet at page 228: PIC16F datasheet



The controller is using 8 bits and is also available with less periphery, but that does not change anything for the instruction set.






share|improve this answer









$endgroup$














  • $begingroup$
    Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
    $endgroup$
    – appmaker1358
    Jul 20 at 16:22






  • 4




    $begingroup$
    Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
    $endgroup$
    – jusaca
    Jul 20 at 16:37


















7












$begingroup$

You need a One Instruction Set Computer (OISC)




A one instruction set computer (OISC), sometimes called an ultimate
reduced instruction set computer (URISC), is an abstract machine that
uses only one instruction – obviating the need for a machine language
opcode. With a judicious choice for the single instruction
and given infinite resources, an OISC is capable of being a universal
computer in the same manner as traditional computers that have
multiple instructions. OISCs have been recommended as aids in
teaching computer architecture and have been used as
computational models in structural computing research.




Whether a compiler exists, I do not know. But I suspect some unlucky student somewhere has probably been assigned the task of writing one.






share|improve this answer









$endgroup$










  • 1




    $begingroup$
    Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
    $endgroup$
    – appmaker1358
    Jul 20 at 16:24






  • 6




    $begingroup$
    Here is a C compiler that compiles to only MOV instructions: movfuscator
    $endgroup$
    – Paul
    Jul 21 at 9:44






  • 2




    $begingroup$
    @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
    $endgroup$
    – Peter Cordes
    Jul 21 at 15:04



















6












$begingroup$


I hope for something with like 50 instructions. Also, 32 bit and c++




The "Beta" architecture used in MIT's 6.004 core track class is a 32-bit RISC design often referred to as a simplification of the DEC Alpha. It's been implemented in many ways - personally in an FPGA - and at one time there was an old version of GCC for it, though that may at this point be challenging to dig up if no one is continuing to work with it.



One example of the architecture documentation is here, the full link will be retained as which year versions of the course are published online changes from time to time and it can be worth looking at several as different information may be included: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/labs/






share|improve this answer









$endgroup$






















    6












    $begingroup$

    Donald Knuth's MMIX architecture has a 64-bit RISC instruction set with 256 opcodes and existing C compilers (GCC, actively maintained) and emulators (mixvm, etc.).






    share|improve this answer









    $endgroup$






















      5












      $begingroup$

      A simple instruction set of only 8 instructions used for teaching is known as the MU0 instruction set. It originated at Manchester University and is used for teaching both compiler writing and hardware design. There are several online documents describing it, including class notes at Manchester University.



      Bibliography:



      • http://digitalbyte.weebly.com/processor-design/the-mu0-processor-instructions

      • http://www.cs.man.ac.uk/~pjj/cs1001/arch/node1.html





      share|improve this answer









      $endgroup$










      • 1




        $begingroup$
        LC-3 is another such toy language for learning.
        $endgroup$
        – Nobody
        Jul 21 at 14:27


















      2












      $begingroup$

      My recommendation would be the LC-3 ("Little Computer 3"), which was specifically designed for ECE students to be able to implement a basic CPU in hardware. It's significantly cleaner and easier to emulate than any "real-world" architecture, such as x86's absolute mess of instructions. A C compiler is available for it, though without floating-point support (since the LC-3 doesn't have a FPU).



      If you want something that's actively used in the real world, try MIPS-I. MIPS is still widely used on embedded systems, and is best-known for being used in the Nintendo 64 and the Playstation. The standard emulator for it is SPIM.



      (And of course, as other answers have mentioned, Knuth's MMIX was made famous by The Art of Computer Programming, though unlike the others, to the best of my knowledge, it's never had a true hardware implementation.)






      share|improve this answer









      $endgroup$






















        0












        $begingroup$

        This is not a completely serious answer but it might suit your case, if you want to keep the instructions to implement for your emulator low.



        In fact the x86 mov instruction is turing complete. And there even is a C compiler for it.






        share|improve this answer









        $endgroup$






















          -1












          $begingroup$

          As you found out the simplest is not necessarily the most fun or most useful. If you are doing this for a learning experience, you might want to look into MMIX which is the RISC architecture used by Knuth for "The Art of Computer Programming".



          In other words, an architecture explicitly designed for learning documented accordingly, and with some of the most well-thought out example programs for demonstrating computer science concepts so you can actually do more with it afterwards.



          https://en.wikipedia.org/wiki/MMIX






          share|improve this answer









          $endgroup$























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            8












            $begingroup$


            Easiest would be to invent my own instruction set




            uh, ok, we might come from very different experiences here…




            With easiest I mean the least amount of instructions.




            That's not necessarily the easiest to implement. Often, having more instructions is a good complexity tradeoff compared to having more complex instructions.




            So my question is, what is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?




            This sounds like no job for C++, so let's concentrate on C. (If you don't understand the difference having C++ RAII paradigm makes, you might not be in the optimum position to design your own ISA.)



            Puh, some microcontroller instruction set that is early, but not too early (because too early would imply "designed around the limitations of digital logic of that time, like e.g. 8051).



            AVR might be a good choice, though I personally don't like that too much.



            I hear Zilog Z80 is easy to implement (there's really several Z80 implementations out there), but it's pretty ancient, and not very comfortable (being from the mid-70s).



            If you really just want a small core to control what your system is doing, why not pick one of the many processor core designs that are out there?



            For example, RISC-V is a (fairly complex) instruction set architecture, with mature compilers, and many open source implementations. For a minimal FPGA core, picoRV32 would probably the core of choice. And on a computer, you'd just run QEMU.






            share|improve this answer











            $endgroup$










            • 4




              $begingroup$
              RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
              $endgroup$
              – Lucas Ramage
              Jul 20 at 13:59






            • 4




              $begingroup$
              It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:03










            • $begingroup$
              C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:09










            • $begingroup$
              @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:23










            • $begingroup$
              @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:40















            8












            $begingroup$


            Easiest would be to invent my own instruction set




            uh, ok, we might come from very different experiences here…




            With easiest I mean the least amount of instructions.




            That's not necessarily the easiest to implement. Often, having more instructions is a good complexity tradeoff compared to having more complex instructions.




            So my question is, what is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?




            This sounds like no job for C++, so let's concentrate on C. (If you don't understand the difference having C++ RAII paradigm makes, you might not be in the optimum position to design your own ISA.)



            Puh, some microcontroller instruction set that is early, but not too early (because too early would imply "designed around the limitations of digital logic of that time, like e.g. 8051).



            AVR might be a good choice, though I personally don't like that too much.



            I hear Zilog Z80 is easy to implement (there's really several Z80 implementations out there), but it's pretty ancient, and not very comfortable (being from the mid-70s).



            If you really just want a small core to control what your system is doing, why not pick one of the many processor core designs that are out there?



            For example, RISC-V is a (fairly complex) instruction set architecture, with mature compilers, and many open source implementations. For a minimal FPGA core, picoRV32 would probably the core of choice. And on a computer, you'd just run QEMU.






            share|improve this answer











            $endgroup$










            • 4




              $begingroup$
              RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
              $endgroup$
              – Lucas Ramage
              Jul 20 at 13:59






            • 4




              $begingroup$
              It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:03










            • $begingroup$
              C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:09










            • $begingroup$
              @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:23










            • $begingroup$
              @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:40













            8












            8








            8





            $begingroup$


            Easiest would be to invent my own instruction set




            uh, ok, we might come from very different experiences here…




            With easiest I mean the least amount of instructions.




            That's not necessarily the easiest to implement. Often, having more instructions is a good complexity tradeoff compared to having more complex instructions.




            So my question is, what is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?




            This sounds like no job for C++, so let's concentrate on C. (If you don't understand the difference having C++ RAII paradigm makes, you might not be in the optimum position to design your own ISA.)



            Puh, some microcontroller instruction set that is early, but not too early (because too early would imply "designed around the limitations of digital logic of that time, like e.g. 8051).



            AVR might be a good choice, though I personally don't like that too much.



            I hear Zilog Z80 is easy to implement (there's really several Z80 implementations out there), but it's pretty ancient, and not very comfortable (being from the mid-70s).



            If you really just want a small core to control what your system is doing, why not pick one of the many processor core designs that are out there?



            For example, RISC-V is a (fairly complex) instruction set architecture, with mature compilers, and many open source implementations. For a minimal FPGA core, picoRV32 would probably the core of choice. And on a computer, you'd just run QEMU.






            share|improve this answer











            $endgroup$




            Easiest would be to invent my own instruction set




            uh, ok, we might come from very different experiences here…




            With easiest I mean the least amount of instructions.




            That's not necessarily the easiest to implement. Often, having more instructions is a good complexity tradeoff compared to having more complex instructions.




            So my question is, what is the easiest instruction set/architecture that has a (hopefully stable) C++ and/or C compiler?




            This sounds like no job for C++, so let's concentrate on C. (If you don't understand the difference having C++ RAII paradigm makes, you might not be in the optimum position to design your own ISA.)



            Puh, some microcontroller instruction set that is early, but not too early (because too early would imply "designed around the limitations of digital logic of that time, like e.g. 8051).



            AVR might be a good choice, though I personally don't like that too much.



            I hear Zilog Z80 is easy to implement (there's really several Z80 implementations out there), but it's pretty ancient, and not very comfortable (being from the mid-70s).



            If you really just want a small core to control what your system is doing, why not pick one of the many processor core designs that are out there?



            For example, RISC-V is a (fairly complex) instruction set architecture, with mature compilers, and many open source implementations. For a minimal FPGA core, picoRV32 would probably the core of choice. And on a computer, you'd just run QEMU.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jul 20 at 16:30

























            answered Jul 20 at 13:51









            Marcus MüllerMarcus Müller

            39.3k3 gold badges66 silver badges107 bronze badges




            39.3k3 gold badges66 silver badges107 bronze badges










            • 4




              $begingroup$
              RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
              $endgroup$
              – Lucas Ramage
              Jul 20 at 13:59






            • 4




              $begingroup$
              It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:03










            • $begingroup$
              C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:09










            • $begingroup$
              @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:23










            • $begingroup$
              @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:40












            • 4




              $begingroup$
              RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
              $endgroup$
              – Lucas Ramage
              Jul 20 at 13:59






            • 4




              $begingroup$
              It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:03










            • $begingroup$
              C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:09










            • $begingroup$
              @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
              $endgroup$
              – Marcus Müller
              Jul 20 at 14:23










            • $begingroup$
              @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
              $endgroup$
              – Ben Voigt
              Jul 20 at 14:40







            4




            4




            $begingroup$
            RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
            $endgroup$
            – Lucas Ramage
            Jul 20 at 13:59




            $begingroup$
            RISC-V on QEMU is an excellent option. Also, never knew about the Z80s. What don't you like about AVR?
            $endgroup$
            – Lucas Ramage
            Jul 20 at 13:59




            4




            4




            $begingroup$
            It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
            $endgroup$
            – Marcus Müller
            Jul 20 at 14:03




            $begingroup$
            It's just that I find the assembler unpleasant to write, and that a lot of the things people use large AVRs with hand-optimized assembler for could be done cheaper and quicker by writing C for a Cortex-M. But that opinion is historically based – in modern days, the ATtiny actually takes a sensible niche.
            $endgroup$
            – Marcus Müller
            Jul 20 at 14:03












            $begingroup$
            C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
            $endgroup$
            – Ben Voigt
            Jul 20 at 14:09




            $begingroup$
            C++ compiles to the exact same machine code as C. Any architecture with the features needed by C also has everything needed by C++. RAII has absolutely nothing to do with it.
            $endgroup$
            – Ben Voigt
            Jul 20 at 14:09












            $begingroup$
            @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
            $endgroup$
            – Marcus Müller
            Jul 20 at 14:23




            $begingroup$
            @BenVoigt point is that if you have a system that has a C++ compiler, chances are very high you'd want to use that to produce OS-targetting code. My reasoning iis that while libc can be pretty hefty, a C++ runtime that actually supports arbitrary C++ (instead of C++ with a lot of custom allocators and potentially std data structures you shouldn't use) does require a memory allocator, and that does influence your desire of your CPU supporting different addressing modes. I've written C++ for Renesas H8300 – it works, but it's really not "stuff for your first CPU".
            $endgroup$
            – Marcus Müller
            Jul 20 at 14:23












            $begingroup$
            @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
            $endgroup$
            – Ben Voigt
            Jul 20 at 14:40




            $begingroup$
            @MarcusMüller So... bare metal systems don't play well with most of the C++ library. How is that different from C? Dynamic allocation you've already mentioned but there are also file I/O, signals, Bessel functions... a whole bunch of stuff that you won't use unless it is absolutely essential to your project, because implementation on that hardware is so ridiculously inefficient. On the other hand, templates, RAII, namespaces, member functions are all highly useful for keeping a large software project maintained, no matter the size of the hardware that runs it.
            $endgroup$
            – Ben Voigt
            Jul 20 at 14:40













            8












            $begingroup$

            You should take al look at the PIC microcontroller family. The instruction set is limited to 35 different instructions, while the controller is actually still used.
            Look at the datasheet at page 228: PIC16F datasheet



            The controller is using 8 bits and is also available with less periphery, but that does not change anything for the instruction set.






            share|improve this answer









            $endgroup$














            • $begingroup$
              Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
              $endgroup$
              – appmaker1358
              Jul 20 at 16:22






            • 4




              $begingroup$
              Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
              $endgroup$
              – jusaca
              Jul 20 at 16:37















            8












            $begingroup$

            You should take al look at the PIC microcontroller family. The instruction set is limited to 35 different instructions, while the controller is actually still used.
            Look at the datasheet at page 228: PIC16F datasheet



            The controller is using 8 bits and is also available with less periphery, but that does not change anything for the instruction set.






            share|improve this answer









            $endgroup$














            • $begingroup$
              Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
              $endgroup$
              – appmaker1358
              Jul 20 at 16:22






            • 4




              $begingroup$
              Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
              $endgroup$
              – jusaca
              Jul 20 at 16:37













            8












            8








            8





            $begingroup$

            You should take al look at the PIC microcontroller family. The instruction set is limited to 35 different instructions, while the controller is actually still used.
            Look at the datasheet at page 228: PIC16F datasheet



            The controller is using 8 bits and is also available with less periphery, but that does not change anything for the instruction set.






            share|improve this answer









            $endgroup$



            You should take al look at the PIC microcontroller family. The instruction set is limited to 35 different instructions, while the controller is actually still used.
            Look at the datasheet at page 228: PIC16F datasheet



            The controller is using 8 bits and is also available with less periphery, but that does not change anything for the instruction set.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 20 at 13:44









            jusacajusaca

            2,3957 silver badges28 bronze badges




            2,3957 silver badges28 bronze badges














            • $begingroup$
              Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
              $endgroup$
              – appmaker1358
              Jul 20 at 16:22






            • 4




              $begingroup$
              Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
              $endgroup$
              – jusaca
              Jul 20 at 16:37
















            • $begingroup$
              Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
              $endgroup$
              – appmaker1358
              Jul 20 at 16:22






            • 4




              $begingroup$
              Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
              $endgroup$
              – jusaca
              Jul 20 at 16:37















            $begingroup$
            Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
            $endgroup$
            – appmaker1358
            Jul 20 at 16:22




            $begingroup$
            Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
            $endgroup$
            – appmaker1358
            Jul 20 at 16:22




            4




            4




            $begingroup$
            Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
            $endgroup$
            – jusaca
            Jul 20 at 16:37




            $begingroup$
            Well, I think basically all 32 bit cores are quite more complex in there design, but the MIPS instruction set has (in its initial form) something like 48 instructions. But I think in all relevant implementations this is increased to some extend by more modern versions of MIPS.
            $endgroup$
            – jusaca
            Jul 20 at 16:37











            7












            $begingroup$

            You need a One Instruction Set Computer (OISC)




            A one instruction set computer (OISC), sometimes called an ultimate
            reduced instruction set computer (URISC), is an abstract machine that
            uses only one instruction – obviating the need for a machine language
            opcode. With a judicious choice for the single instruction
            and given infinite resources, an OISC is capable of being a universal
            computer in the same manner as traditional computers that have
            multiple instructions. OISCs have been recommended as aids in
            teaching computer architecture and have been used as
            computational models in structural computing research.




            Whether a compiler exists, I do not know. But I suspect some unlucky student somewhere has probably been assigned the task of writing one.






            share|improve this answer









            $endgroup$










            • 1




              $begingroup$
              Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
              $endgroup$
              – appmaker1358
              Jul 20 at 16:24






            • 6




              $begingroup$
              Here is a C compiler that compiles to only MOV instructions: movfuscator
              $endgroup$
              – Paul
              Jul 21 at 9:44






            • 2




              $begingroup$
              @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
              $endgroup$
              – Peter Cordes
              Jul 21 at 15:04
















            7












            $begingroup$

            You need a One Instruction Set Computer (OISC)




            A one instruction set computer (OISC), sometimes called an ultimate
            reduced instruction set computer (URISC), is an abstract machine that
            uses only one instruction – obviating the need for a machine language
            opcode. With a judicious choice for the single instruction
            and given infinite resources, an OISC is capable of being a universal
            computer in the same manner as traditional computers that have
            multiple instructions. OISCs have been recommended as aids in
            teaching computer architecture and have been used as
            computational models in structural computing research.




            Whether a compiler exists, I do not know. But I suspect some unlucky student somewhere has probably been assigned the task of writing one.






            share|improve this answer









            $endgroup$










            • 1




              $begingroup$
              Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
              $endgroup$
              – appmaker1358
              Jul 20 at 16:24






            • 6




              $begingroup$
              Here is a C compiler that compiles to only MOV instructions: movfuscator
              $endgroup$
              – Paul
              Jul 21 at 9:44






            • 2




              $begingroup$
              @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
              $endgroup$
              – Peter Cordes
              Jul 21 at 15:04














            7












            7








            7





            $begingroup$

            You need a One Instruction Set Computer (OISC)




            A one instruction set computer (OISC), sometimes called an ultimate
            reduced instruction set computer (URISC), is an abstract machine that
            uses only one instruction – obviating the need for a machine language
            opcode. With a judicious choice for the single instruction
            and given infinite resources, an OISC is capable of being a universal
            computer in the same manner as traditional computers that have
            multiple instructions. OISCs have been recommended as aids in
            teaching computer architecture and have been used as
            computational models in structural computing research.




            Whether a compiler exists, I do not know. But I suspect some unlucky student somewhere has probably been assigned the task of writing one.






            share|improve this answer









            $endgroup$



            You need a One Instruction Set Computer (OISC)




            A one instruction set computer (OISC), sometimes called an ultimate
            reduced instruction set computer (URISC), is an abstract machine that
            uses only one instruction – obviating the need for a machine language
            opcode. With a judicious choice for the single instruction
            and given infinite resources, an OISC is capable of being a universal
            computer in the same manner as traditional computers that have
            multiple instructions. OISCs have been recommended as aids in
            teaching computer architecture and have been used as
            computational models in structural computing research.




            Whether a compiler exists, I do not know. But I suspect some unlucky student somewhere has probably been assigned the task of writing one.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 20 at 13:59









            Dirk BruereDirk Bruere

            6,4575 gold badges33 silver badges71 bronze badges




            6,4575 gold badges33 silver badges71 bronze badges










            • 1




              $begingroup$
              Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
              $endgroup$
              – appmaker1358
              Jul 20 at 16:24






            • 6




              $begingroup$
              Here is a C compiler that compiles to only MOV instructions: movfuscator
              $endgroup$
              – Paul
              Jul 21 at 9:44






            • 2




              $begingroup$
              @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
              $endgroup$
              – Peter Cordes
              Jul 21 at 15:04













            • 1




              $begingroup$
              Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
              $endgroup$
              – appmaker1358
              Jul 20 at 16:24






            • 6




              $begingroup$
              Here is a C compiler that compiles to only MOV instructions: movfuscator
              $endgroup$
              – Paul
              Jul 21 at 9:44






            • 2




              $begingroup$
              @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
              $endgroup$
              – Peter Cordes
              Jul 21 at 15:04








            1




            1




            $begingroup$
            Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
            $endgroup$
            – appmaker1358
            Jul 20 at 16:24




            $begingroup$
            Okay, this is not really what I'm looking for. With as little instructions as possible, I meant within reason. I don't need as little as possible. I just don't want to implement 2000 different instructions. I hope for something with like 50 instructions. Also, 32 bit and c++.
            $endgroup$
            – appmaker1358
            Jul 20 at 16:24




            6




            6




            $begingroup$
            Here is a C compiler that compiles to only MOV instructions: movfuscator
            $endgroup$
            – Paul
            Jul 21 at 9:44




            $begingroup$
            Here is a C compiler that compiles to only MOV instructions: movfuscator
            $endgroup$
            – Paul
            Jul 21 at 9:44




            2




            2




            $begingroup$
            @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
            $endgroup$
            – Peter Cordes
            Jul 21 at 15:04





            $begingroup$
            @Paul: That's not a OISC. Multiple different opcodes share the same mov mnemonic on x86. (felixcloutier.com/x86/mov). Also, decoding x86 machine code with ModR/M + SIB addressing modes is not totally trivial. Compiling to mov instructions is pretty horribly inefficient, although so is any OISC. That probably makes debugging your emulator hard using any real compiler output, because grokking what the machine code is supposed to be doing is hard, and so is following it in your head. I'd go with a simple toy ISA like y86 or a subset of a RISC ISA like MIPS.
            $endgroup$
            – Peter Cordes
            Jul 21 at 15:04












            6












            $begingroup$


            I hope for something with like 50 instructions. Also, 32 bit and c++




            The "Beta" architecture used in MIT's 6.004 core track class is a 32-bit RISC design often referred to as a simplification of the DEC Alpha. It's been implemented in many ways - personally in an FPGA - and at one time there was an old version of GCC for it, though that may at this point be challenging to dig up if no one is continuing to work with it.



            One example of the architecture documentation is here, the full link will be retained as which year versions of the course are published online changes from time to time and it can be worth looking at several as different information may be included: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/labs/






            share|improve this answer









            $endgroup$



















              6












              $begingroup$


              I hope for something with like 50 instructions. Also, 32 bit and c++




              The "Beta" architecture used in MIT's 6.004 core track class is a 32-bit RISC design often referred to as a simplification of the DEC Alpha. It's been implemented in many ways - personally in an FPGA - and at one time there was an old version of GCC for it, though that may at this point be challenging to dig up if no one is continuing to work with it.



              One example of the architecture documentation is here, the full link will be retained as which year versions of the course are published online changes from time to time and it can be worth looking at several as different information may be included: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/labs/






              share|improve this answer









              $endgroup$

















                6












                6








                6





                $begingroup$


                I hope for something with like 50 instructions. Also, 32 bit and c++




                The "Beta" architecture used in MIT's 6.004 core track class is a 32-bit RISC design often referred to as a simplification of the DEC Alpha. It's been implemented in many ways - personally in an FPGA - and at one time there was an old version of GCC for it, though that may at this point be challenging to dig up if no one is continuing to work with it.



                One example of the architecture documentation is here, the full link will be retained as which year versions of the course are published online changes from time to time and it can be worth looking at several as different information may be included: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/labs/






                share|improve this answer









                $endgroup$




                I hope for something with like 50 instructions. Also, 32 bit and c++




                The "Beta" architecture used in MIT's 6.004 core track class is a 32-bit RISC design often referred to as a simplification of the DEC Alpha. It's been implemented in many ways - personally in an FPGA - and at one time there was an old version of GCC for it, though that may at this point be challenging to dig up if no one is continuing to work with it.



                One example of the architecture documentation is here, the full link will be retained as which year versions of the course are published online changes from time to time and it can be worth looking at several as different information may be included: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/labs/







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 20 at 16:32









                Chris StrattonChris Stratton

                24.9k2 gold badges30 silver badges69 bronze badges




                24.9k2 gold badges30 silver badges69 bronze badges
























                    6












                    $begingroup$

                    Donald Knuth's MMIX architecture has a 64-bit RISC instruction set with 256 opcodes and existing C compilers (GCC, actively maintained) and emulators (mixvm, etc.).






                    share|improve this answer









                    $endgroup$



















                      6












                      $begingroup$

                      Donald Knuth's MMIX architecture has a 64-bit RISC instruction set with 256 opcodes and existing C compilers (GCC, actively maintained) and emulators (mixvm, etc.).






                      share|improve this answer









                      $endgroup$

















                        6












                        6








                        6





                        $begingroup$

                        Donald Knuth's MMIX architecture has a 64-bit RISC instruction set with 256 opcodes and existing C compilers (GCC, actively maintained) and emulators (mixvm, etc.).






                        share|improve this answer









                        $endgroup$



                        Donald Knuth's MMIX architecture has a 64-bit RISC instruction set with 256 opcodes and existing C compilers (GCC, actively maintained) and emulators (mixvm, etc.).







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jul 21 at 13:16









                        YouYou

                        1613 bronze badges




                        1613 bronze badges
























                            5












                            $begingroup$

                            A simple instruction set of only 8 instructions used for teaching is known as the MU0 instruction set. It originated at Manchester University and is used for teaching both compiler writing and hardware design. There are several online documents describing it, including class notes at Manchester University.



                            Bibliography:



                            • http://digitalbyte.weebly.com/processor-design/the-mu0-processor-instructions

                            • http://www.cs.man.ac.uk/~pjj/cs1001/arch/node1.html





                            share|improve this answer









                            $endgroup$










                            • 1




                              $begingroup$
                              LC-3 is another such toy language for learning.
                              $endgroup$
                              – Nobody
                              Jul 21 at 14:27















                            5












                            $begingroup$

                            A simple instruction set of only 8 instructions used for teaching is known as the MU0 instruction set. It originated at Manchester University and is used for teaching both compiler writing and hardware design. There are several online documents describing it, including class notes at Manchester University.



                            Bibliography:



                            • http://digitalbyte.weebly.com/processor-design/the-mu0-processor-instructions

                            • http://www.cs.man.ac.uk/~pjj/cs1001/arch/node1.html





                            share|improve this answer









                            $endgroup$










                            • 1




                              $begingroup$
                              LC-3 is another such toy language for learning.
                              $endgroup$
                              – Nobody
                              Jul 21 at 14:27













                            5












                            5








                            5





                            $begingroup$

                            A simple instruction set of only 8 instructions used for teaching is known as the MU0 instruction set. It originated at Manchester University and is used for teaching both compiler writing and hardware design. There are several online documents describing it, including class notes at Manchester University.



                            Bibliography:



                            • http://digitalbyte.weebly.com/processor-design/the-mu0-processor-instructions

                            • http://www.cs.man.ac.uk/~pjj/cs1001/arch/node1.html





                            share|improve this answer









                            $endgroup$



                            A simple instruction set of only 8 instructions used for teaching is known as the MU0 instruction set. It originated at Manchester University and is used for teaching both compiler writing and hardware design. There are several online documents describing it, including class notes at Manchester University.



                            Bibliography:



                            • http://digitalbyte.weebly.com/processor-design/the-mu0-processor-instructions

                            • http://www.cs.man.ac.uk/~pjj/cs1001/arch/node1.html






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jul 21 at 10:40









                            Brian Tompsett - 汤莱恩Brian Tompsett - 汤莱恩

                            1513 bronze badges




                            1513 bronze badges










                            • 1




                              $begingroup$
                              LC-3 is another such toy language for learning.
                              $endgroup$
                              – Nobody
                              Jul 21 at 14:27












                            • 1




                              $begingroup$
                              LC-3 is another such toy language for learning.
                              $endgroup$
                              – Nobody
                              Jul 21 at 14:27







                            1




                            1




                            $begingroup$
                            LC-3 is another such toy language for learning.
                            $endgroup$
                            – Nobody
                            Jul 21 at 14:27




                            $begingroup$
                            LC-3 is another such toy language for learning.
                            $endgroup$
                            – Nobody
                            Jul 21 at 14:27











                            2












                            $begingroup$

                            My recommendation would be the LC-3 ("Little Computer 3"), which was specifically designed for ECE students to be able to implement a basic CPU in hardware. It's significantly cleaner and easier to emulate than any "real-world" architecture, such as x86's absolute mess of instructions. A C compiler is available for it, though without floating-point support (since the LC-3 doesn't have a FPU).



                            If you want something that's actively used in the real world, try MIPS-I. MIPS is still widely used on embedded systems, and is best-known for being used in the Nintendo 64 and the Playstation. The standard emulator for it is SPIM.



                            (And of course, as other answers have mentioned, Knuth's MMIX was made famous by The Art of Computer Programming, though unlike the others, to the best of my knowledge, it's never had a true hardware implementation.)






                            share|improve this answer









                            $endgroup$



















                              2












                              $begingroup$

                              My recommendation would be the LC-3 ("Little Computer 3"), which was specifically designed for ECE students to be able to implement a basic CPU in hardware. It's significantly cleaner and easier to emulate than any "real-world" architecture, such as x86's absolute mess of instructions. A C compiler is available for it, though without floating-point support (since the LC-3 doesn't have a FPU).



                              If you want something that's actively used in the real world, try MIPS-I. MIPS is still widely used on embedded systems, and is best-known for being used in the Nintendo 64 and the Playstation. The standard emulator for it is SPIM.



                              (And of course, as other answers have mentioned, Knuth's MMIX was made famous by The Art of Computer Programming, though unlike the others, to the best of my knowledge, it's never had a true hardware implementation.)






                              share|improve this answer









                              $endgroup$

















                                2












                                2








                                2





                                $begingroup$

                                My recommendation would be the LC-3 ("Little Computer 3"), which was specifically designed for ECE students to be able to implement a basic CPU in hardware. It's significantly cleaner and easier to emulate than any "real-world" architecture, such as x86's absolute mess of instructions. A C compiler is available for it, though without floating-point support (since the LC-3 doesn't have a FPU).



                                If you want something that's actively used in the real world, try MIPS-I. MIPS is still widely used on embedded systems, and is best-known for being used in the Nintendo 64 and the Playstation. The standard emulator for it is SPIM.



                                (And of course, as other answers have mentioned, Knuth's MMIX was made famous by The Art of Computer Programming, though unlike the others, to the best of my knowledge, it's never had a true hardware implementation.)






                                share|improve this answer









                                $endgroup$



                                My recommendation would be the LC-3 ("Little Computer 3"), which was specifically designed for ECE students to be able to implement a basic CPU in hardware. It's significantly cleaner and easier to emulate than any "real-world" architecture, such as x86's absolute mess of instructions. A C compiler is available for it, though without floating-point support (since the LC-3 doesn't have a FPU).



                                If you want something that's actively used in the real world, try MIPS-I. MIPS is still widely used on embedded systems, and is best-known for being used in the Nintendo 64 and the Playstation. The standard emulator for it is SPIM.



                                (And of course, as other answers have mentioned, Knuth's MMIX was made famous by The Art of Computer Programming, though unlike the others, to the best of my knowledge, it's never had a true hardware implementation.)







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Jul 21 at 20:25









                                DraconisDraconis

                                1212 bronze badges




                                1212 bronze badges
























                                    0












                                    $begingroup$

                                    This is not a completely serious answer but it might suit your case, if you want to keep the instructions to implement for your emulator low.



                                    In fact the x86 mov instruction is turing complete. And there even is a C compiler for it.






                                    share|improve this answer









                                    $endgroup$



















                                      0












                                      $begingroup$

                                      This is not a completely serious answer but it might suit your case, if you want to keep the instructions to implement for your emulator low.



                                      In fact the x86 mov instruction is turing complete. And there even is a C compiler for it.






                                      share|improve this answer









                                      $endgroup$

















                                        0












                                        0








                                        0





                                        $begingroup$

                                        This is not a completely serious answer but it might suit your case, if you want to keep the instructions to implement for your emulator low.



                                        In fact the x86 mov instruction is turing complete. And there even is a C compiler for it.






                                        share|improve this answer









                                        $endgroup$



                                        This is not a completely serious answer but it might suit your case, if you want to keep the instructions to implement for your emulator low.



                                        In fact the x86 mov instruction is turing complete. And there even is a C compiler for it.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Jul 21 at 16:16









                                        Uroc327Uroc327

                                        1091 bronze badge




                                        1091 bronze badge
























                                            -1












                                            $begingroup$

                                            As you found out the simplest is not necessarily the most fun or most useful. If you are doing this for a learning experience, you might want to look into MMIX which is the RISC architecture used by Knuth for "The Art of Computer Programming".



                                            In other words, an architecture explicitly designed for learning documented accordingly, and with some of the most well-thought out example programs for demonstrating computer science concepts so you can actually do more with it afterwards.



                                            https://en.wikipedia.org/wiki/MMIX






                                            share|improve this answer









                                            $endgroup$



















                                              -1












                                              $begingroup$

                                              As you found out the simplest is not necessarily the most fun or most useful. If you are doing this for a learning experience, you might want to look into MMIX which is the RISC architecture used by Knuth for "The Art of Computer Programming".



                                              In other words, an architecture explicitly designed for learning documented accordingly, and with some of the most well-thought out example programs for demonstrating computer science concepts so you can actually do more with it afterwards.



                                              https://en.wikipedia.org/wiki/MMIX






                                              share|improve this answer









                                              $endgroup$

















                                                -1












                                                -1








                                                -1





                                                $begingroup$

                                                As you found out the simplest is not necessarily the most fun or most useful. If you are doing this for a learning experience, you might want to look into MMIX which is the RISC architecture used by Knuth for "The Art of Computer Programming".



                                                In other words, an architecture explicitly designed for learning documented accordingly, and with some of the most well-thought out example programs for demonstrating computer science concepts so you can actually do more with it afterwards.



                                                https://en.wikipedia.org/wiki/MMIX






                                                share|improve this answer









                                                $endgroup$



                                                As you found out the simplest is not necessarily the most fun or most useful. If you are doing this for a learning experience, you might want to look into MMIX which is the RISC architecture used by Knuth for "The Art of Computer Programming".



                                                In other words, an architecture explicitly designed for learning documented accordingly, and with some of the most well-thought out example programs for demonstrating computer science concepts so you can actually do more with it afterwards.



                                                https://en.wikipedia.org/wiki/MMIX







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jul 21 at 15:42









                                                Thorbjørn Ravn AndersenThorbjørn Ravn Andersen

                                                992 bronze badges




                                                992 bronze badges
















                                                    Popular posts from this blog

                                                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                                                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                                                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?