From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3640 invoked by alias); 21 Oct 2005 05:36:17 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 3616 invoked by uid 22791); 21 Oct 2005 05:36:15 -0000 Received: from mail5.kpit.com (HELO sohm.kpit.com) (203.197.93.231) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 21 Oct 2005 05:36:15 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Problem in decoding instructions in simulator Date: Fri, 21 Oct 2005 05:36:00 -0000 Message-ID: <4A1BE23A7B777442B60F4B4916AE0F130830D0F1@sohm.kpit.com> From: "Shrirang Khishti" To: X-SW-Source: 2005-q4/txt/msg00015.txt.bz2 Hi all, =20 I am currently working on porting a simulator to a "16 bit LITTLE endian" = architecture. with instrctions having size 2 bytes as well as 4 bytes. I am using cgen for it. I have done following things. 1. Added target specific cpu files to cgen source code 2. I am referring to m32r port and I have done corresponding similar change= s to top-level=20 configure and also added some other files needed in sim/target folder. 3. I am building simulator using enable-cgen-maint option. And I have obser= ved that my target specific .c and .h files are generated in sim/target folder an= d also simulator=20 is getting built . My main queries are=20 1. Though I have specified little endian in define-cpu construct in my targ= et.cpu file (define-cpu (name target)=20 (comment "Target family") (endian little) (insn-chunk-bitsize 32) (word-bitsize 16) (parallel-insns 1) ) I observed that in arch.h file which is generated from cgen it is definin= g following macro #define TARGET_BIG_ENDIAN 1 Are there any other factors affecting this macro ?=20 =20=20=20=20=20=20=20=20 2. My next query is regarding following dump code ..=20 400: e0 20 mov r0,#0x2 402: e6 f1 7b 00 mov r1,#0x7b 406: 00 01 add r0,r1 408: f0 10 mov r1,r0 40a: f0 20 mov r2,r0 40c: a8 20 mov r2,[r0] 40e: cb 00 ret=20 Although PC is at the location 0x400 instruction being decoded is from the= location 0x402 What might be reason for this ?=09 This is dump of test object code for which I am debugging simulator with t= he help of native gdb. Problem I am facing is that in targetbf_decode function pc is 400 which is= correct but it is=20 showing base_insn (I think instruction opcode ) as F1 E6 ,which correspon= ds to opcode=20 from location 402. And after that it is incrementing cpu by=20 2 irrespective of instruction size, and decoding object file in BIG endia= n mode.=20 According to me this targetbf_decode is called from mloop.c file which is = generated from=20 mloop.in file . I want to ask whether beacuse of this file , it is giving = above behavior=20 or is there any other affecting factor ? Also is there any documentation a= bout how to write mloop.in file. Thanks in advance Regards, Shrirang Khisti KPIT Cummins Infosystems Ltd. =09=09=09