public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Christian Walter <wolti@sil.at>
To: cgen@sourceware.org
Subject: Implementation of Register Indirect Addressing with scaled Displacement
Date: Fri, 20 Oct 2006 23:12:00 -0000	[thread overview]
Message-ID: <453957E7.5080207@sil.at> (raw)


Hello,

I would like to ask a question about implementing a load instruction 
with displacement using the GNU binutils/CGEN. I have spent the last 
days working with CGEN, BFD and the other stuff and have at least a 
basic knowledge about the topics (And already got a basic assembler 
working for our target). I know most of you are doing an advanced degree 
and might be bored about the questions but I have not figured out how to 
do it so I try to ask:

I would like to implement a instruction for our 16bit processor 
(university project) to support a instruction of the form 'ld rX, 
#3(rY)' where the displacement is scaled by the factor 8. rY can be any 
register and specially the program counter. Therefore the following code 
should be possible:

constant:
	.byte 0x33
label0:
	ld r0, #constant[pc]
	ld pc, #label1[pc]
	...
label1:
	ld pc, lr

Using a displacement would require the labels to be aligned for 3 bit 
(factor of eight). We have chosen this instruction set because of a 
16bit processor and to save space in our opcodes. I have not found an 
elegant way to this except adding an alignment information into the 
assembler code. Is there any other way to do this?

How did all of you learn working with binutils/...? Studying source code 
and reading the BFD/binutils documentation? I found starting somewhat 
difficult to be honest - Specially BFD and the ELF backend.

Kind Regards,
	Christian Walter

--
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\ \\
email: wolti@sil.at      \ Friends don't let friends drink and su(1)
web: www.freemodbus.org  \               -- Kevin Harris


                 reply	other threads:[~2006-10-20 23:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=453957E7.5080207@sil.at \
    --to=wolti@sil.at \
    --cc=cgen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).