Simplest instruction set that has an c++/C compiler to write an emulator for?Seeing how Instructions get Translated (Computer Architecture)Does anyone know the hardware of a Nike+ SportWatch GPS?Building a simple PC - looking for a CPUExample Instruction Set ArchitechtureConfused what computer architecture is in realWriting DSP algorithms directly in C or assembly?How Specifically the Control Unit (CU) WorksWould a standardized graphics chip socket be sensible?Treating Multiple CPU Cores as OneSAP-2 ADD instruction possible in 4 T states?

Why does a tetrahedral molecule like methane have a dipole moment of zero?

Could Europeans in Europe demand protection under UN Declaration on the Rights of Indigenous Peoples?

How to determine Platform Event Size in Apex to ensure to be within < 1 MB

Should I have one hand on the throttle during engine ignition?

How should I interpret a promising preprint that was never published in a peer-reviewed journal?

Suggestions for how to track down the source of this force:source:push error?

What makes MOVEQ quicker than a normal MOVE in 68000 assembly?

A "Replace" sort problem. Basic but haunts me

Authorship dispute on a paper that came out of a final report of a course?

"Je suis petite, moi?", purpose of the "moi"?

Why should fork() have been designed to return a file descriptor?

Integration using partial fraction is wrong

Why are flying carpets banned while flying brooms are not?

Align the contents of a numerical matrix when you have minus signs

Is "repository" pronounced /rɪˈpɒzɪt(ə)ri/ or ri-ˈpä-zə-ˌtȯr-ē or /rəˈpäzəˌtôrē/?

How did Jayne know when to shoot?

How to not confuse readers with simultaneous events?

Why did my "seldom" get corrected?

Was demon possession only a New Testament phenomenon?

Discontinuous Tube visualization

I have found a mistake on someone's code published online: what is the protocol?

What is the mistake in this solution?

Equality of complex numbers in general

Who or what determines if a curse is valid or not?



Simplest instruction set that has an c++/C compiler to write an emulator for?


Seeing how Instructions get Translated (Computer Architecture)Does anyone know the hardware of a Nike+ SportWatch GPS?Building a simple PC - looking for a CPUExample Instruction Set ArchitechtureConfused what computer architecture is in realWriting DSP algorithms directly in C or assembly?How Specifically the Control Unit (CU) WorksWould a standardized graphics chip socket be sensible?Treating Multiple CPU Cores as OneSAP-2 ADD instruction possible in 4 T states?






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








2












$begingroup$


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



Easiest would be to invent my own instruction set, but I thought it would be more fun if what 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?



With easiest I mean the least amount of instructions.










share|improve this question











$endgroup$











  • $begingroup$
    emulator for what? Because what describe sounds like you want to build a CPU.
    $endgroup$
    – Marcus Müller
    10 hours ago










  • $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
    7 hours ago










  • $begingroup$
    @Marcus Müller I want to emulate a existing cpu with instruction set that has a c++/c compiler. No I don't want to build a cpu. Yes, I do think it might be fun to TRY to implement it on an fpga, but I don't think I know enough about fpga's for that.
    $endgroup$
    – appmaker1358
    7 hours ago










  • $begingroup$
    this may give you some ideas ... esolangs.org/wiki/Main_Page ... esolangs.org/wiki/Language_list
    $endgroup$
    – jsotola
    7 hours ago










  • $begingroup$
    @jsotola that's about programming languages, not about CPUs!
    $endgroup$
    – Marcus Müller
    7 hours ago

















2












$begingroup$


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



Easiest would be to invent my own instruction set, but I thought it would be more fun if what 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?



With easiest I mean the least amount of instructions.










share|improve this question











$endgroup$











  • $begingroup$
    emulator for what? Because what describe sounds like you want to build a CPU.
    $endgroup$
    – Marcus Müller
    10 hours ago










  • $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
    7 hours ago










  • $begingroup$
    @Marcus Müller I want to emulate a existing cpu with instruction set that has a c++/c compiler. No I don't want to build a cpu. Yes, I do think it might be fun to TRY to implement it on an fpga, but I don't think I know enough about fpga's for that.
    $endgroup$
    – appmaker1358
    7 hours ago










  • $begingroup$
    this may give you some ideas ... esolangs.org/wiki/Main_Page ... esolangs.org/wiki/Language_list
    $endgroup$
    – jsotola
    7 hours ago










  • $begingroup$
    @jsotola that's about programming languages, not about CPUs!
    $endgroup$
    – Marcus Müller
    7 hours ago













2












2








2





$begingroup$


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



Easiest would be to invent my own instruction set, but I thought it would be more fun if what 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?



With easiest I mean the least amount of instructions.










share|improve this question











$endgroup$




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



Easiest would be to invent my own instruction set, but I thought it would be more fun if what 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?



With easiest I mean the least amount 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 7 hours ago









Marcus Müller

38.6k3 gold badges64 silver badges105 bronze badges




38.6k3 gold badges64 silver badges105 bronze badges










asked 10 hours ago









appmaker1358appmaker1358

1161 silver badge8 bronze badges




1161 silver badge8 bronze badges











  • $begingroup$
    emulator for what? Because what describe sounds like you want to build a CPU.
    $endgroup$
    – Marcus Müller
    10 hours ago










  • $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
    7 hours ago










  • $begingroup$
    @Marcus Müller I want to emulate a existing cpu with instruction set that has a c++/c compiler. No I don't want to build a cpu. Yes, I do think it might be fun to TRY to implement it on an fpga, but I don't think I know enough about fpga's for that.
    $endgroup$
    – appmaker1358
    7 hours ago










  • $begingroup$
    this may give you some ideas ... esolangs.org/wiki/Main_Page ... esolangs.org/wiki/Language_list
    $endgroup$
    – jsotola
    7 hours ago










  • $begingroup$
    @jsotola that's about programming languages, not about CPUs!
    $endgroup$
    – Marcus Müller
    7 hours ago
















  • $begingroup$
    emulator for what? Because what describe sounds like you want to build a CPU.
    $endgroup$
    – Marcus Müller
    10 hours ago










  • $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
    7 hours ago










  • $begingroup$
    @Marcus Müller I want to emulate a existing cpu with instruction set that has a c++/c compiler. No I don't want to build a cpu. Yes, I do think it might be fun to TRY to implement it on an fpga, but I don't think I know enough about fpga's for that.
    $endgroup$
    – appmaker1358
    7 hours ago










  • $begingroup$
    this may give you some ideas ... esolangs.org/wiki/Main_Page ... esolangs.org/wiki/Language_list
    $endgroup$
    – jsotola
    7 hours ago










  • $begingroup$
    @jsotola that's about programming languages, not about CPUs!
    $endgroup$
    – Marcus Müller
    7 hours ago















$begingroup$
emulator for what? Because what describe sounds like you want to build a CPU.
$endgroup$
– Marcus Müller
10 hours ago




$begingroup$
emulator for what? Because what describe sounds like you want to build a CPU.
$endgroup$
– Marcus Müller
10 hours ago












$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
7 hours ago




$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
7 hours ago












$begingroup$
@Marcus Müller I want to emulate a existing cpu with instruction set that has a c++/c compiler. No I don't want to build a cpu. Yes, I do think it might be fun to TRY to implement it on an fpga, but I don't think I know enough about fpga's for that.
$endgroup$
– appmaker1358
7 hours ago




$begingroup$
@Marcus Müller I want to emulate a existing cpu with instruction set that has a c++/c compiler. No I don't want to build a cpu. Yes, I do think it might be fun to TRY to implement it on an fpga, but I don't think I know enough about fpga's for that.
$endgroup$
– appmaker1358
7 hours ago












$begingroup$
this may give you some ideas ... esolangs.org/wiki/Main_Page ... esolangs.org/wiki/Language_list
$endgroup$
– jsotola
7 hours ago




$begingroup$
this may give you some ideas ... esolangs.org/wiki/Main_Page ... esolangs.org/wiki/Language_list
$endgroup$
– jsotola
7 hours ago












$begingroup$
@jsotola that's about programming languages, not about CPUs!
$endgroup$
– Marcus Müller
7 hours ago




$begingroup$
@jsotola that's about programming languages, not about CPUs!
$endgroup$
– Marcus Müller
7 hours ago










4 Answers
4






active

oldest

votes


















3












$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$












  • $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
    10 hours ago






  • 1




    $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
    10 hours ago










  • $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
    10 hours ago










  • $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
    9 hours ago










  • $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
    9 hours ago


















2












$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
    7 hours ago










  • $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
    7 hours ago


















1












$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$




















    0












    $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$












    • $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
      7 hours ago













    Your Answer






    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("schematics", function ()
    StackExchange.schematics.init();
    );
    , "cicuitlab");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "135"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f449212%2fsimplest-instruction-set-that-has-an-c-c-compiler-to-write-an-emulator-for%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3












    $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$












    • $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
      10 hours ago






    • 1




      $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
      10 hours ago










    • $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
      10 hours ago










    • $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
      9 hours ago










    • $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
      9 hours ago















    3












    $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$












    • $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
      10 hours ago






    • 1




      $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
      10 hours ago










    • $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
      10 hours ago










    • $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
      9 hours ago










    • $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
      9 hours ago













    3












    3








    3





    $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 7 hours ago

























    answered 10 hours ago









    Marcus MüllerMarcus Müller

    38.6k3 gold badges64 silver badges105 bronze badges




    38.6k3 gold badges64 silver badges105 bronze badges











    • $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
      10 hours ago






    • 1




      $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
      10 hours ago










    • $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
      10 hours ago










    • $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
      9 hours ago










    • $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
      9 hours ago
















    • $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
      10 hours ago






    • 1




      $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
      10 hours ago










    • $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
      10 hours ago










    • $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
      9 hours ago










    • $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
      9 hours ago















    $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
    10 hours ago




    $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
    10 hours ago




    1




    1




    $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
    10 hours ago




    $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
    10 hours ago












    $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
    10 hours ago




    $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
    10 hours ago












    $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
    9 hours ago




    $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
    9 hours ago












    $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
    9 hours ago




    $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
    9 hours ago













    2












    $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
      7 hours ago










    • $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
      7 hours ago















    2












    $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
      7 hours ago










    • $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
      7 hours ago













    2












    2








    2





    $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 10 hours ago









    jusacajusaca

    1,7436 silver badges25 bronze badges




    1,7436 silver badges25 bronze badges











    • $begingroup$
      Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
      $endgroup$
      – appmaker1358
      7 hours ago










    • $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
      7 hours ago
















    • $begingroup$
      Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
      $endgroup$
      – appmaker1358
      7 hours ago










    • $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
      7 hours ago















    $begingroup$
    Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
    $endgroup$
    – appmaker1358
    7 hours ago




    $begingroup$
    Pic is interesting, but I prefer something 32 bit. Do you know anything like that?
    $endgroup$
    – appmaker1358
    7 hours ago












    $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
    7 hours ago




    $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
    7 hours ago











    1












    $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$

















      1












      $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$















        1












        1








        1





        $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 7 hours ago









        Chris StrattonChris Stratton

        24.8k2 gold badges30 silver badges69 bronze badges




        24.8k2 gold badges30 silver badges69 bronze badges





















            0












            $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$












            • $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
              7 hours ago















            0












            $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$












            • $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
              7 hours ago













            0












            0








            0





            $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 10 hours ago









            Dirk BruereDirk Bruere

            6,3315 gold badges33 silver badges71 bronze badges




            6,3315 gold badges33 silver badges71 bronze badges











            • $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
              7 hours ago
















            • $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
              7 hours ago















            $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
            7 hours ago




            $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
            7 hours ago

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Electrical Engineering Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f449212%2fsimplest-instruction-set-that-has-an-c-c-compiler-to-write-an-emulator-for%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її