public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Adding custom instructions to bcc
@ 2011-10-21 20:16 Joshua Weber
  2011-10-22  5:26 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Joshua Weber @ 2011-10-21 20:16 UTC (permalink / raw)
  To: gcc-help

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.

Thanks,
Joshua Weber

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Adding custom instructions to bcc
  2011-10-21 20:16 Adding custom instructions to bcc Joshua Weber
@ 2011-10-22  5:26 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-10-22  5:26 UTC (permalink / raw)
  To: Joshua Weber; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-22  5:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-21 20:16 Adding custom instructions to bcc Joshua Weber
2011-10-22  5:26 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).