public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Jean-Marc Saffroy <jean-marc.saffroy@joguin.com>
To: Dalibor Kovacevic <malonj@gmail.com>
Cc: cgen@sourceware.org
Subject: Re: porting to a new architecture
Date: Wed, 17 Nov 2010 14:16:00 -0000	[thread overview]
Message-ID: <4CE3E3C3.6040302@joguin.com> (raw)
In-Reply-To: <AANLkTinB-QteqFBhkKOVQWD3NBPSjaaX1OVXyoDdHMfg@mail.gmail.com>

Hi Dalibor,

> My client wants me to port GDB to his CPU but he does not have any
> kind of simulator yet on which I could try out my port.

No simulator? This sounds really surprising!

> Reading about
> the quickest way to generate a simulator and came across CGEN.

It seems a good idea, CGEN can save you a lot of time in writing a
simulator, though it is still a fair bit of work, possibly much more
than a simple gdb port.

> So I`m wondering can I do that but not in the order like on
> http://sourceware.org/cgen/docs-1.0/cgen_5.html

Indeed, if all you want is a simulator, then you don't need to follow
all the steps described in the CGEN documentation. What you really want
is a working simulator, so the steps needed are:
- modify configure etc. stuff for your arch
- .cpu and .opc files to feed to CEN; you should look at other ports for
ideas, but it seems you will need to start from scratch
- simple modifications for opcodes support; CGEN generates almost
everything here
- simulator code:
 . some boiler plate code to start the simulator; most can be stolen
from other simple ports
 . mloop.in: a template for the main loop, which can very generic code,
with little (if any) knowledge of the simulated arch; again, there are
good examples in other ports
 . support code for specific aspects of your target: traps,
interruptions, and the like; this is of course much more specific to
your target

> for that I need a .cpu
> file which I don`t have and before I start making one just wanted to
> check is there a way to get that file out of already ported gcc or
> binutils. I have searched them for all .cpu files but my architecture
> is not there.

The binutils CVS repo on sourceware.org has .cpu files under two
directories: cpu/ and cgen/cpu/. Though it looks like the latter
contains some unfinished stuff.

There is no .cpu file in gcc; CGEN's RTL and gcc's RTL are meant to look
familiar, but they really are different things. Maybe you could use an
existing gcc port for hints, if the CPU documentation isn't clear
enough, but then you have other serious problems!


Cheers,
Jean-Marc

      reply	other threads:[~2010-11-17 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 10:36 Dalibor Kovacevic
2010-11-17 14:16 ` Jean-Marc Saffroy [this message]

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=4CE3E3C3.6040302@joguin.com \
    --to=jean-marc.saffroy@joguin.com \
    --cc=cgen@sourceware.org \
    --cc=malonj@gmail.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).