From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20923 invoked by alias); 9 May 2008 10:35:03 -0000 Received: (qmail 20846 invoked by uid 22791); 9 May 2008 10:35:00 -0000 X-Spam-Check-By: sourceware.org Received: from smtpauth01.prod.mesa1.secureserver.net (HELO smtpauth01.prod.mesa1.secureserver.net) (64.202.165.181) by sourceware.org (qpsmtpd/0.31) with SMTP; Fri, 09 May 2008 10:34:41 +0000 Received: (qmail 22482 invoked from network); 9 May 2008 10:34:37 -0000 Received: from unknown (68.37.53.103) by smtpauth01.prod.mesa1.secureserver.net (64.202.165.181) with ESMTP; 09 May 2008 10:34:37 -0000 Message-ID: <482428B4.5070209@duaneellis.com> Date: Fri, 09 May 2008 15:28:00 -0000 From: Duane Ellis Reply-To: duane-gcc-help@duaneellis.com User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: Porting GCC to 8051 Microcontroller Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg00097.txt.bz2 andrew>> I've been thinking about this some more. I andrew>> suspect you could get good results by andrew>> generating not 8051 assembly language, andrew>> which would be gross, but a simple bytecode engine. I know this for a fact :-) in a previous life we modeled the one we did off the instruction set like the MIPS. Why? Simple - it has to do with the way the flags register is done. On some CPUs - when you add "r0 + r1" => r2, you either *must* update the flags (zero, carry, overflow) or not. having to maintain that in a simulator is added wasteful steps that you often do not need... For example the test: if( a == b ){ do_this(); } For us the opcodes became: test r1=r2 ;; test(r1==r2) braf +4 ; branch if false jsr24 do_this ; 24bit relative call. This simplified the interpretation code and was a huge performance win on a 6502 @ 1mhz. The simulation engine was a big 6502 switch statement. In effect, the 6502 was a micro-code engine :-) -Duane.