From: DJ Delorie <dj@redhat.com>
To: tnt@246tNt.com
Cc: gcc@gcc.gnu.org
Subject: Re: Design a microcontroller for gcc
Date: Tue, 14 Feb 2006 23:40:00 -0000 [thread overview]
Message-ID: <200602142339.k1ENdpCF013521@greed.delorie.com> (raw)
In-Reply-To: <43F2666E.70703@246tNt.com> (message from Sylvain Munaut on Wed, 15 Feb 2006 00:23:26 +0100)
> * 8 bit RISC microcontroller
Not 16?
> * 16 general purpose registers
> * 16 level deep hardware call stack
If you have RAM, why not use it? Model calls like the PPC - put
current $pc in a register and jump. The caller saves the old $pc in
the regular stack. GCC is going to want a "normal" frame. This is
easy to do in hardware, and more flexible than a hardware call stack.
> * load/store to a flat "memory" (minimum 1k, up to 16k)
> (addressing in that memory uses a register for the 8 lsb and
> a special register for the msbs)
> that memory can be loaded along with the code to have known
> content at startup for eg.
GCC is going to want register pairs to work as larger registers.
Like, if you have $r2 and $r3 as 8 bit registers, gcc wants [$r2$r3]
to be usable as a 16 bit register. Another reason to go with 16 bit
registers ;-)
GCC won't like having an address split across "special" registers.
But it's OK to limit index registers to evenly numbered ones.
> * pipelined with some restriction on instruction scheduling
> (cfr later)
GCC works better if the hardware enforces the locks; it's good at
scheduling pipelines but it doesn't *always* do the right thing; it's
easier if your hardware allows this, if suboptimally.
Of course, I don't know *that* much about the current scheduler.
There may be a way to deal with this cleanly now.
> * 2 flags Carry & Zero for testing.
GCC will want 4 (add sign and overflow) to support signed comparisons.
Sign should be easy; overflow is the carry out of bit 6.
> I mentionned earlier that there is some scheduling restriction on the
> instructions due to internal pipelining. For example, the result of a
> fetch from memory may not be used in the instruction directly following
> the fetch. When there is a conditionnal branch, the instruction just
> following the branch will always be executed, no matter what the result
> is (branch/call/... are not immediate but have a 1 instruction latency
> beforce the occur). Is theses kind of limitation 'easily' supported by
> gcc ?
Delay slots are common; gcc handles them well. You might need to add
custom code to enforce the pipeline rules if your pipeline won't
automatically stall.
> I saw several time that gcc works better with a lot of GPRs. I could
> increase them to 32 but then arithmetic instructions would have to use
> the same register for destination than for src1.
16 is sufficient.
next prev parent reply other threads:[~2006-02-14 23:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-14 23:22 Sylvain Munaut
2006-02-14 23:40 ` DJ Delorie [this message]
2006-02-15 0:28 ` Sylvain Munaut
2006-02-15 0:41 ` DJ Delorie
2006-02-15 19:59 ` Sylvain Munaut
2006-02-15 20:06 ` DJ Delorie
2006-02-15 20:23 ` Paul Brook
2006-02-15 21:21 ` DJ Delorie
2006-02-15 22:10 ` Hans-Peter Nilsson
2006-02-15 23:10 ` David Daney
2006-02-16 0:26 ` Sylvain Munaut
2006-02-16 0:46 ` DJ Delorie
2006-02-16 2:49 ` Hans-Peter Nilsson
2006-02-16 3:21 ` DJ Delorie
2006-02-16 3:34 ` Hans-Peter Nilsson
2006-02-16 3:37 ` Hans-Peter Nilsson
2006-02-16 3:44 ` DJ Delorie
2006-02-16 3:40 ` DJ Delorie
2006-02-16 3:56 ` Hans-Peter Nilsson
2006-02-16 4:10 ` Hans-Peter Nilsson
2006-02-16 4:17 ` DJ Delorie
2006-02-16 4:13 ` DJ Delorie
2006-02-16 11:42 ` Hans-Peter Nilsson
2006-02-16 20:49 ` Sylvain Munaut
2006-02-17 0:28 ` Hans-Peter Nilsson
2006-02-20 8:54 ` Sylvain Munaut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200602142339.k1ENdpCF013521@greed.delorie.com \
--to=dj@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=tnt@246tNt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).