public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Dave Brolley <brolley@redhat.com>
To: Ronald Hecht <ronald.hecht@uni-rostock.de>
Cc: cgen@sourceware.org
Subject: Re: Simulator: base_insn and insn in decode.c
Date: Thu, 03 Aug 2006 21:55:00 -0000	[thread overview]
Message-ID: <44D270CF.30506@redhat.com> (raw)
In-Reply-To: <44CDF0AC.6070707@uni-rostock.de>

Ronald Hecht wrote:

> Hello again,
>
> i found another problem in decode. c. As I have variable instruction 
> size, decode.c does not handle base_insn and insn in the right way. 
> The file looks like this:
>
> const IDESC *
> proc8bf_decode (SIM_CPU *current_cpu, IADDR pc,
>              CGEN_INSN_INT base_insn, CGEN_INSN_INT entire_insn,
>              ARGBUF *abuf)
> {
>  /* Result of decoder.  */
>  PROC8BF_INSN_TYPE itype;
>
>  {
>    CGEN_INSN_INT insn = base_insn;
>
>    {
>      unsigned int val = (((insn >> 0) & (63 << 0)));
>      switch (val)
>      {
>      case 0 :
>        if ((entire_insn & 0xff) == 0x0)
>          { itype = PROC8BF_INSN_NOP; goto extract_sfmt_nop; }
>        itype = PROC8BF_INSN_X_INVALID; goto extract_sfmt_empty;

The generated decoder expects base_insn to be the first base-insn-size 
bits of the insn shifted as far right as possible. What you have 
specified is correct and the (((insn >> 0) & (63 << 0))) test us 
correct. It is looking at the low order 6 bits of the base_insn which 
are the only significant ones (according to your cpu file.

The generated decoder expects entire_insn to the all of the insn bits, 
also shifted as far right as possible.

The test around the goto is intended to make sure that the untested 
base_insn bits are as expected. It needs to be there, otherwise, invalid 
insns get recognized as valid ones. However, it would seem that the test 
should be against base_insn and not against entire_insn. I'll have a 
look at some other cgen simulators, including those which use SID to 
make sure that this assertion holds water. It probably hasn't come up 
until now, since most sims I have seen are able to pass the same value 
for base_insn and entire_insn.

Dave

  reply	other threads:[~2006-08-03 21:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31 11:58 Ronald Hecht
2006-08-03 21:55 ` Dave Brolley [this message]
2006-08-03 22:08   ` Dave Brolley
2006-08-07 14:39     ` Ronald Hecht
2006-08-07 14:53     ` Ronald Hecht
2006-08-14 21:19       ` Dave Brolley
2006-08-15  8:39         ` Ronald Hecht
2006-08-04  8:51   ` Ronald Hecht
2006-08-14 20:34     ` Dave Brolley

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=44D270CF.30506@redhat.com \
    --to=brolley@redhat.com \
    --cc=cgen@sourceware.org \
    --cc=ronald.hecht@uni-rostock.de \
    /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).