This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding custom instructions to bcc


Joshua Weber <jweber8@hawk.iit.edu> writes:

> I am looking to be able to add custom instructions to the gcc/gas compiler.
>
> I have already written a full microprocessor simulator that simulates
> execution of all machine code. I am looking to extend the instruction
> set of the microprocessor to support new custom instructions.
>
> I would ideally like to be able to simply place custom instructions in
> C code using asm blocks. I would even be happy with coding in machine
> code directly (hexadecimal definitions) in asm blocks.
>
> I have been attempting to read and understand the internals of both
> gcc and the binutils (gas). I still feel unclear if I need to modify
> gcc at all. Would the simple addition of the new opcodes to the
> binutils/opcodes/<arch>-opc.c file be sufficient to support the
> additional custom instructions?
>
> Any help in this regard would be greatly appreciated. I have failed to
> identify many online resources for this, even though there seems to be
> a degree of interest in it. It is very common within the SoC and FPGA
> microprocessor world for the extension of the ISA to include new
> instructions, and yet there is very little existing documentation on
> this subject.

If you are only going to use asm blocks to generate the new
instructions, then you do not need to modify gcc.  It will suffice to
modify gas.

For some targets, changing <arch>-opc.c will suffice.  It depends on how
the target is implemented in gas.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]