Implementation of a MIPS processor in VHDL - vhdl

please I want the VHDL code of The RISC MIPS Processor Core (32 bits) with some MIPS Processor Core Instructions. Anyone have an idea?
thank you

You can have a look at Open Cores. This is a great site with several open source implementations of different peripherals and cores. For example, the Edge Processor may be what you're looking for, even though it is in Verilog. Or maybe a Ion - MIPS(tm) compatible CPU in VHDL. Best thing is to browse through their library and see for yourself what suits your needs the best.

See this question Project on MIPS pipelined processor and the answer. I updated the link to the ECE 3055 course downloadable source (32-bit MIPS VHDL Model ). Also see the Instructions link.

Related

RISCV on zynq ultrascale+ zcu102

I want to load riscv on zcu102 xilinx board. I looked at various sites, they have codes for other specific boards and I am not quite sure how to port it.
Since I am a beginner, can you provide some starting point for it ?
I tried lowrisc implementation but i am not able to port it to zcu102.
Sorry for ambiguity. I wanted to run riscv soc platform such as lowrisc on fpga. But the code given in their github is optimized for nexy4 ddr board. And I am getting issues for converting it to zcu102. So, I was asking if there is some steps I can follow ? Like list of interfaces need to be changed ?
Risc-V is not a processor.
Risc-V is an Instructions Set (ISA) implemented by some processors.
Then if you want to "load" a Risc-V processor you have to choose one, then synthetize it with your FPGA tools (Vivado for Xilinx).
Here a list of Risc-V cores on Risc-v fondation website.
You can try the Instant Soc from FPGA Cores.
The compiler builds a soc including this RISC-V processor and UARTs, I2Cs etc directly from C++. All peripherals are defined as C++ objects. Very easy to use.
I have mostly used it with Artix to interface the AXIS streams on the Ethernet cores.

Most simple architecture available as GCC target

I'm looking for CPU architecture, which is supported by GCC (and is still maintained) for which is easiest to implement software simulator.
It should be something simple, with flat memory model, 16bit+ address space, 16-32 bit ALU and good code dencity is prefered as for it will be running programs with program memory limitations.
Just few words about origin of those requirements. I need virtual CPU for running 'sandboxed' programs. That will be running on microcontrollers with ~5 KBytes RAM, ARM CPU ~20 MHz clock speed.
Performance is non an issue at all, what I really need is writing C/C++ programs and then running them in sandbox without stdlib. For writing programs GCC can help, just need implement vcpu for one of target architectures.
I've got acquainted with ARMv7-m, avr32 references and found them pretty accaptable but some more powerfull then I need. The less/simpler code I need to write for vcpu implementation, the sooner I will have what I need and less bugs will be there.
UPDATE:
Seems like I found what I need. Is was already answered here: What is the smallest, simplest CPU that gcc can compile for?
Thank you all.

Profiling a benchmark compiled for the SPARC v8 on an x86

I'm trying to make a (small) improvement to the leon3 processor (instruction set is SPARC v8) for an academic exercise. Before I decide what to improve, I want to profile a couple of benchmark programs that I want to tailor the improvements to.
I don't have access to a SPARC v8 machine.
Currently, I'm using an evaluation version of 'tsim' (a leon3 simulator) which does profiling at the functional level. Which is not really all that useful.
I have tried weird stuff like compiling with loop unrolling enabled and then counting the interesting instructions in the assembly code, but gcc refuses to unroll the loops, probably because some of them go too deep (e.g. 4 nested 'for' loops).
Ideally, what I'm looking for is a SPARC v8 simulator that runs the benchmark and profiles it at the instruction level (stuff like: 'smul' was executed x times) so that I can decide where to start trying with the improvement. Of course if there are other ways I can do this if not a profiler, I won't mind.
Any ideas?
Simulating the processor in Modelsim could be an option. With Modelsim you can do a functional simulation of the complete LEON3 processor. Although the simulation will be quite slow and probably complete overkill for your purposes but Aeroflex Gaisler provides excellent scripts to work with Modelsim.
A student edition of modelsim can be found here:
http://www.mentor.com/company/higher_ed/modelsim-student-edition
If you really want to dig that deep into the hardware, you'll find a simulator useful that helps you with that.
Simics comes into mind. They used to have free academic licenses, but since they were bought by Intel, you now need to apply for one, which from my experience takes a couple of weeks. If you are willing to invest this time, you'll certainly get a tool that suits your needs, although they support LEON2, not LEON3, as a model, but for profiling this should be fine.
Qemu also has LEON support but as they're heavily recompiling, it will probably be hard to to instruction-level profiling with it.

What is the smallest, simplest CPU that GCC can compile for?

In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it.
Moxie is a great target because it was designed specifically to be an ideal target for GCC. I am the author and would be happy to answer any questions. green at moxielogic dot com
GCC supports Moxie (originally ggx), a little architecture invented by Anthony Green for experimentation.
You, too, can follow the steps he took to invent your own small simple CPU and port GCC to it.
ZPU (an FPGA targeted 32bit processor) is very small.
Possibly the AVR ATTiny45 or similar AVR chip.
This probably isn't an uncommon question; I'd hope that most CPU/machine simulation toolkits would include a simple example implementation, but some don't.
I haven't worked with it, but Knuth's MMIX architecture (wikipedia) looks interesting. Like Moxie, it was created to "illustrate machine-level aspects of programming" and is simpler than real machines. It's supported by GCC and there appear to be multiple existing simulators that could be used as a reference in your efforts.
Maybe something from the Ti MSP430 series.
MIPS I (one of the targets of GCC) is a surprisingly easy-to-emulate 32-bit platform. Here is an short and simple emulator which can load and run a statically linked Linux MIPS I executable: https://github.com/pts/pts-mips-emulator

Machine Code tutorial for Mac

I want to learn machine code. Not for a specific reason. Just for the heck of it. I was wondering if there were any good machine code tutorials. I have a macbook with a 2.4 GHz Intel Core 2 Duo processor.
First of all, unless you are a masochist, I think you would prefer a tutorial on intel assembly language programming to machine code. Assembly language uses human readable instructions - kind of a low level programming language. Machine code is machine readable - good for machines, not so good for wetware ;-)
All intel chips use some variation of the x86 instruction set. The Wikipedia article referenced above gives examples of assembly vs machine code as well as resources to learn assembly language (see the external links at the bottom of the article).
It's a great question...and I had the same back in the 1980's on my Commodore 64 and Apple IIe (back when every byte and instruction mattered). Mike Smith wrote a great book titled "6502 Machine and Assembly Language Programming" that taught me to experiment in machine code. Similar books to this one are available as pdf online. A good book like this, written for the processor you choose, will ultimately teach you the logic of performing operations in assembly and how to convert into machine code. Most want to stop at Assembly Language, but it's worth taking the next step to machine code at least once.
Here's a site that gives some decent tutorials. I used this a while ago, but I learned a lot from it. =D
http://www.angelfire.com/electronic2/machinelanguage/lesson1.html

Resources