From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11365 invoked by alias); 20 Oct 2006 23:12:45 -0000 Received: (qmail 11357 invoked by uid 22791); 20 Oct 2006 23:12:44 -0000 X-Spam-Check-By: sourceware.org Received: from mx-02.sil.at (HELO mx-02.sil.at) (86.59.12.200) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 20 Oct 2006 23:12:42 +0000 Received: from pcno-4.ikaros.eu.org ([213.129.231.173]) by mx-02.sil.at with esmtpa (Exim 4.60) (envelope-from ) id 1Gb3Xc-0004EU-5T for cgen@sourceware.org; Sat, 21 Oct 2006 01:12:40 +0200 Message-ID: <453957E7.5080207@sil.at> Date: Fri, 20 Oct 2006 23:12:00 -0000 From: Christian Walter User-Agent: Thunderbird 1.5.0.7 (X11/20060915) MIME-Version: 1.0 To: cgen@sourceware.org Subject: Implementation of Register Indirect Addressing with scaled Displacement Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2006-q4/txt/msg00003.txt.bz2 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