From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24531 invoked by alias); 26 Oct 2009 16:13:03 -0000 Received: (qmail 24521 invoked by uid 22791); 26 Oct 2009 16:13:02 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX X-Spam-Check-By: sourceware.org Received: from sebabeach.org (HELO sebabeach.org) (64.165.110.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Oct 2009 16:12:58 +0000 Received: from sspiff.sspiff.org (seba.sebabeach.org [10.8.159.10]) by sebabeach.org (Postfix) with ESMTP id 62B6D6E3D4; Mon, 26 Oct 2009 09:12:56 -0700 (PDT) Message-ID: <4AE5CA87.5030500@sebabeach.org> Date: Mon, 26 Oct 2009 16:13:00 -0000 From: Doug Evans User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Dave Korn , Dmitry Eremin-Solenikov CC: cgen Subject: Re: cgen->sim question References: <4AE59913.5040402@gmail.com> In-Reply-To: <4AE59913.5040402@gmail.com> 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-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00025.txt.bz2 Dave Korn wrote: > Dmitry Eremin-Solenikov wrote: > >> Hello, >> >> I have a question regarding generating sim code from cgen description. >> >> I have an instruction operand instantiated from field with type h-addr. >> If in the semantics part of the instruction I try to access the operandr >> as an address: '(mem QI ddaddr)', I get an error from cgen: >> >> simplify.inc:131:3: op:new-mode: invalid mode for operand `ddaddr': USI >> >> This is the definition of ddaddr: >> >> (dif f-dd-1 "1-byte direct address at 1 position" (ABS-ADDR) 8 8 0 8 UINT #f #f) >> (dno ddaddr "direct address" () h-addr f-dd-1) >> >> > > I've seen this too. I made it go away by changing the hardware element type > in the define-normal-operand from h-addr to h-uint (or h-sint in some cases). > I don't know for a fact if it was the right thing to do, but all the > generated code ended up looking sane; it does leave me a little unsure, > however, because now I don't know what h-addr is actually supposed to be used > for - my port ends up not using it at all anywhere, and everything appears to > work. > Huh. I tried it and it worked ok. (dni dmitry-test "dmitry's h-addr issue" () "dmitry $ddaddr" (+ OP1_7 OP1_1 ddaddr) (set (mem QI ddaddr) 0) () ) The generated code for a basic simulator has: i_ddaddr = f_dd_1; { QI opval = 0; SETMEMQI (current_cpu, pc, i_ddaddr, opval); TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval); } What does the instruction definition look like?