From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13684 invoked by alias); 27 Jul 2006 08:00:38 -0000 Received: (qmail 13642 invoked by uid 22791); 27 Jul 2006 08:00:33 -0000 X-Spam-Check-By: sourceware.org Received: from mailrelay1.uni-rostock.de (HELO antivirus.uni-rostock.de) (139.30.8.201) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 27 Jul 2006 08:00:29 +0000 Received: from antivirus.exch.rz.uni-rostock.de ([127.0.0.1]) by antivirus.uni-rostock.de with Microsoft SMTPSVC(6.0.3790.1830); Thu, 27 Jul 2006 10:00:26 +0200 Received: from antivirus.uni-rostock.de (unverified) by antivirus.exch.rz.uni-rostock.de (Content Technologies SMTPRS 4.3.20) with ESMTP id for ; Thu, 27 Jul 2006 10:00:26 +0200 Received: from mail pickup service by antivirus.uni-rostock.de with Microsoft SMTPSVC; Thu, 27 Jul 2006 10:00:26 +0200 X-SCL: 7 94.34% Received: from mail.uni-rostock.de ([139.30.8.11]) by antivirus.uni-rostock.de with Microsoft SMTPSVC(6.0.3790.1830); Thu, 27 Jul 2006 09:59:30 +0200 Received: from conversion-daemon.mail2.uni-rostock.de by mail2.uni-rostock.de (iPlanet Messaging Server 5.2 HotFix 2.09 (built Nov 18 2005)) id <0J3100301WZFLJ@mail.uni-rostock.de> (original mail from ronald.hecht@uni-rostock.de) for cgen@sourceware.org; Thu, 27 Jul 2006 09:59:29 +0200 (MEST) Received: from [139.30.201.25] (pike.e-technik.uni-rostock.de [139.30.201.25]) by mail2.uni-rostock.de (iPlanet Messaging Server 5.2 HotFix 2.09 (built Nov 18 2005)) with ESMTPS id <0J3100J0GY6ZSV@mail.uni-rostock.de> for cgen@sourceware.org; Thu, 27 Jul 2006 09:59:23 +0200 (MEST) Date: Thu, 27 Jul 2006 08:00:00 -0000 From: Ronald Hecht Subject: Disassembly with variable instruction size To: cgen@sourceware.org Message-id: <44C872F5.9060809@uni-rostock.de> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag)" User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501) 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-q3/txt/msg00008.txt.bz2 This is a multi-part message in MIME format. --Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT Content-length: 606 Hello, I'm porting a very simple architecture for educational purposes. I got gas working, but the dissasemble with objdump not. It is an 8 bit processor with variable instruction size. The first byte is the opcode the second an 8 bit immediate or together with the third byte an 16 bit immediate. The disassemble of the "make gas-test" looks very strange, whereas the object file is correct. I played with "lsb0". As I saw in the mailing list there are problems with #t. So I decided to use #f. Attached is the cpu file, the assemble, disasemble, and the object file. Thanks in advance Ronald --Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag) Content-type: text/plain; name=proc.cpu Content-transfer-encoding: 7BIT Content-disposition: inline; filename=proc.cpu Content-length: 1941 ; Simple 8 Bit Processor -*- Scheme -*- (include "simplify.inc") ; FIXME: Delete sign extension of accumulator results. ; Sign extension is done when accumulator is read. ; define-arch must appear first (define-arch (name proc) ; name of cpu family (comment "8 Bit Processor") (insn-lsb0? #f) (machs proc) (isas proc) ) (define-isa (name proc) (default-insn-bitsize 8) (base-insn-bitsize 8) (default-insn-word-bitsize 8) ) (define-cpu (name proc) (comment "8 Bit Processor Family") (endian big) (word-bitsize 8) ) (define-mach (name proc) (comment "8 Bit FPGA Processor") (cpu proc) ) (define-model (name proc) (comment "8 Bit Processor Model") (attrs) (mach proc) (unit u-exec "Execution Unit" () 1 1 () () () ()) ) (dnf f-op "op" () 0 8) (dnf f-uimm8 "unsigned 8 bit immediate" () 8 8) (dnf f-uimm16 "unsigned 16 bit immediate" () 8 16) (define-normal-insn-enum insn-op "insn format enums" () OP_ f-op (.map .str (.iota 256)) ) (dnh h-pc "program counter" (PC PROFILE) (pc) () () ()) (define-hardware (name h-accu) (comment "Accumulator") (attrs PROFILE );CACHE-ADDR) (type register DI ) ) (define-attr (for operand) (type boolean) (name HASH-PREFIX) (comment "immediates have an optional '#' prefix") ) (dnop accu "accumulator" () h-accu f-nil) (dnop uimm8 "unsigned 8 bit immediate" () h-uint f-uimm8) (dnop uimm16 "unsigned 16 bit immediate" () h-uint f-uimm16) (dni nop "nop" () "nop" (+ OP_0) (nop) () ) (dni lda "lda" () "lda $uimm16" (+ OP_1 uimm16) (set accu (mem WI uimm16)) () ) (dni ldc "ldc" () "ldc $uimm8" (+ OP_2 uimm8) (set accu uimm8) () ) (dni decx "decx" () "decx" (+ OP_100) (nop) () ) (dni decy "decy" () "decy" (+ OP_101) (nop) () ) --Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag) Content-type: text/x-dsrc; name=allinsn.d Content-transfer-encoding: 7BIT Content-disposition: inline; filename=allinsn.d Content-length: 881 #as: #objdump: -dr #name: allinsn *: +file format .* Disassembly of section \.text: 00000000 : \.\.\. 00000001 : 1: 01 00 -> lda 0x100 3: 00 01 -> nop 5: ff ff || \*unknown\* 7: 01 80 -> lda 0xffff 9: 00 01 -> nop b: 7f ff -> \*unknown\* d: 01 00 -> lda 0x100 f: 01 01 -> lda 0x100 11: c5 bd || \*unknown\* 13: 01 fa -> lda 0xc5bd 15: 6d 01 -> \*unknown\* 17: 5e 51 -> \*unknown\* 00000019 : 19: 02 00 -> ldc 0x2 1b: 02 ff -> ldc 0x2 1d: 02 80 -> ldc 0x2 1f: 02 7f -> ldc 0x2 21: 02 01 -> ldc 0x2 23: 02 f7 -> ldc 0x2 25: 02 54 -> ldc 0x2 27: 02 ea -> ldc 0x2 00000029 : 29: 64 65 -> decx 0000002a : 2a: 65 00 -> decy --Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag) Content-type: text/plain; name=allinsn.s Content-transfer-encoding: 7BIT Content-disposition: inline; filename=allinsn.s Content-length: 334 .data foodata: .word 42 .text footext: .text .global nop nop: nop .text .global lda lda: lda 0 lda 65535 lda 32768 lda 32767 lda 1 lda 50621 lda 64109 lda 24145 .text .global ldc ldc: ldc 0 ldc 255 ldc 128 ldc 127 ldc 1 ldc 247 ldc 84 ldc 234 .text .global decx decx: decx .text .global decy decy: decy --Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag) Content-type: application/octet-stream; name=a.out Content-transfer-encoding: BASE64 Content-disposition: attachment; filename=a.out Content-length: 277 AAABBwAAACwAAAACAAAAAAAAAFQAAAAAAAAAAAAAAAAAAQAAAf//AYAAAX// AQABAcW9AfptAV5RAgAC/wKAAn8CAQL3AlQC6mRlACoAAAAABAYAAAAAAAAs AAAADAQAAAAAAAAAAAAAFAUAAAAAAAAAAAAAGAUAAAAAAAABAAAAHAUAAAAA AAAZAAAAIAUAAAAAAAApAAAAJQUAAAAAAAAqAAAAKmZvb2RhdGEAZm9vdGV4 dABub3AAbGRhAGxkYwBkZWN4AGRlY3kA --Boundary_(ID_Dxj+k8s5RdGq/oiVa1DMag)--