0

I need to write instruction of addition modulo 255 to or1ksim, which is an openRISC simulator. At the first I learnt something about this processor/simulator, then I wrote program HelloWorld in C, compile it using gcc and debbuging according to section 'Using GDB with Or1ksim' from http://opencores.org/or1k/OpenRISC_GNU_tool_chain

Now i have a problem. I don't know how to write a instruction of addition. Which file, from which path should i edit? This function must be written in asembly or C?

stolar
  • 1
  • 1
  • 1
    If you have to update everything, you will need to edit multiple places. You will need to edit the assembler so it can recognize the mnemonic and generate proper machine code, you will need to edit the disassembler so it can turn that machine code back to mnemonics and you also need to edit the simulator code so it can execute the instruction. – Jester Apr 26 '16 at 16:51
  • It's my own project. I don't want to upload it to the internet. I needy only to extend the **simulator**. Could you tell me something more? Where i can find helpful information? Maybe some sample code connected with my topic? – stolar Apr 26 '16 at 17:32
  • Generally you can just look at how the existing instructions are simulated and add whatever is necessary. – Jester Apr 26 '16 at 17:52
  • Ok, but where I can find these existing instructions, in which file? – stolar Apr 26 '16 at 18:05
  • For starters, the various `or1k*.cpu` files. See [or1k.cpu](https://github.com/openrisc/or1k-src/blob/or1k/cpu/or1k.cpu) as a starting point. – Jester Apr 26 '16 at 18:16
  • So i check out these files, but i don't know what i should learn from it. I have no idea what majority of lines means. What next? Can you tell me exactly what should i do? – stolar Apr 26 '16 at 19:40
  • SO is not a code writing service. You will have to do some learning yourself or hire somebody to do it for you. See also the [documentation](https://github.com/openrisc/or1k-src/tree/or1k/cgen/doc). You should copy an existing addition instruction and extend it with the modulo operation. – Jester Apr 26 '16 at 22:02

0 Answers0