-1

Question: is there a (preferably online or Linux-operational) RISC compiler, with an interface to display the register contents and such without requiring hardware? (I suppose a simple emulator of sorts is what I'm looking for.)

Background: I've been looking online for quite a while, and the closest I can seem to find is an unstable NIOS II compiler. I've been able to run NIOS assembly code when hooked up to Altera hardware and such, but I don't often have access to that (and I'd rather not have to convert RISC to NIOS every time). I've also seen something of a Unix-based compiler, but as far as I've researched, that requires hardware as well.

I understand the complications of this (at one point, I started coding my own RISC compiler, but I'm still studying the language and hit that road block fairly quick) but I still wonder if there's a simple enough emulator/compiler that can parse a length of RISC that I'm overlooking.

(Note: I'm looking for RISC as sampled here, not RISC-V, as I've run into in some questions. I've tried GCC and ARM, but they're not what I'm looking for)

sami
  • 11
  • 2
  • 1
    if you say "A and B are not what I'm looking for", you might want to explain better why they're not what you're looking for and what you're missing. The altera monitor you linked to looks like a 90s, badly usable debugger to me, and you can get much better based on GDB these days. – Marcus Müller Oct 16 '16 at 18:49
  • Yeah, it's pretty old, but functionally, it gives me "an interface to display the register contents and such". My own IDE search failed; which ARM GDB in specific would you recommend (+ link)? – sami Oct 16 '16 at 18:58
  • Asking for links is off-topic on SO, really. And Google is still your friend. But try Eclipse + CDT; there's a lot of people that ship customized Eclipse versions tailored for ARM development. – Marcus Müller Oct 16 '16 at 20:36
  • Are you looking for a RISC CPU *emulator*? – Nayuki Oct 17 '16 at 14:19
  • "I suppose a simple emulator of sorts is what I'm looking for.", so yes, that's probably the proper term. – sami Oct 17 '16 at 18:03

1 Answers1

3

ARM stands for "advanced RISC machine"; there's a very stable and versatile and optimized compiler targetting that platform: GCC. Clang targets ARM, too, as do a lot of other compilers (after all, it's one of the most popular architectures, and comes in several revisions and sizes, from the tiniest embeddable microcontrollers to fully-fledged desktop/laptop multicore GHz CPUs, network fabric controllers etc).

Seeing the the ubiquity of ARM processors, it's very likely you even have hardware: Most smart phones run on ARM, your car (if its newer) certainly has several ARM microcontrollers inside, your favourite piece of electronics (washing mashine? Stereo?) isn't that unlikely to have an ARM Cortex-M-something microcontroller; and even if you don't have hardware right now, but want to experiment with a RISC microcontroller: eval boards are available for < $10.

With qemu-arm, you also get a mature emulator, so you really don't need any hardware; you can comfortably combine emulated or real-world execution with GDB, the GNU Debugger, and would get an awesome insight in not only the registers, but also arbitrary memory locations (which for ARM pretty much represents every piece of hardware that's not CPU core).

RISC architectures are pretty popular – you should just look up the target architectures that GCC supports, and pick one of these. I still maintain ARM (or RISCV) is a good choice – there's actual hardware out there, there's a mature emulator, and a lot of community knowledge.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
  • I probably should have mentioned that sources/links would be very helpful. I've seen the RISCV/ARM and the GCC, and I don't think it's quite what I'm looking for. – sami Oct 16 '16 at 18:31
  • then: what are you looking for? I really don't think I need to link to ARM or the GCC - you do have access to google and wikipedia, and those are the most common architecture and most widely used compiler, world wide, probably. – Marcus Müller Oct 16 '16 at 18:36
  • I'm looking for something like the [Altera Monitor Program](http://www-ug.eecg.toronto.edu/msl/nios_labs_SoC/6/interrupt.html), where it compiles, as well as provides an interface where I can see the register contents and so forth. Except I can't use that without the specific board. – sami Oct 16 '16 at 18:42
  • GCC+GDB+Qemu for ARM +IDE of your choice, as said. – Marcus Müller Oct 16 '16 at 18:43
  • oh gawd, Altera Monitor seems terrible compared to modern debuggers and emulators... – Marcus Müller Oct 16 '16 at 18:45