public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Ronald Hecht <ronald.hecht@uni-rostock.de>
To: Dave Brolley <brolley@redhat.com>
Cc: cgen@sourceware.org
Subject: Re: Simulator: base_insn and insn in decode.c
Date: Tue, 15 Aug 2006 08:39:00 -0000	[thread overview]
Message-ID: <44E188DF.4070003@uni-rostock.de> (raw)
In-Reply-To: <44E0E8BE.5010100@redhat.com>

Dave Brolley wrote:

> I've been looking at what other ports do and it seems that most are 
> able to pass the same value base_insn and entire_insn because the 
> opcode bits are scattered throughout the insns. The ones which aren't 
> so lucky do one of two things:
>
> 1) Write some ugly code which examines the base_insn bits in order to 
> decide how to position entire_insn.


This sounds good, but it would be helpful to have the instruction size 
in the automatically generated instruction descriptor table. I say this 
in the disassembler code. This way a lookup would be easier. The 
instruction size may be also used in the <cpu>-sem.cxx code.

>
> 2) Set base-insn-bitsize in the define-isa of the .cpu file to be the 
> size of the largest insn. For SID, base_insn and entire_insn can then 
> be passed identically as the insn bits aligned at the 
> 'base-insn-bitsize' bit. For example, in your case, the max insn 
> length appears to be 24, so you could simply read 3 bytes individually 
> (to avoid endianness problems) and place them sequentially in the low 
> order bytes of base_insn and entire_insn.
>

This actually works for me! Thanks alot for the help. Now, my code looks 
like this:

      try
        {
          // Fetch 24-bit pieces separately, so endianness
          // conversions can be done on this chunk size.
          UQI insn0 = this->GETIMEMQI (pc, pc);
          UQI insn1 = this->GETIMEMQI (pc, pc+1);
          UQI insn2 = this->GETIMEMQI (pc, pc+2);
          USI insn = (insn0 << 16) | (insn1 << 8) | insn2;

          sem->decode (this, pc, insn, insn);

        }
      catch (cpu_memory_fault& t)
        {
          this->memory_trap (t);
          break;
        }

The file can be found on 
http://www-md.e-technik.uni-rostock.de/lehre/vlsi_i/proc8/src/sid/component/cgen-cpu/proc8/proc8bf.cxx
The simulator also works with gdb except for a "Memory access error 
while loading section .text." occuring some times. But I suspect, this 
is out of the scope of this mailing list.

Thanks again
Ronald

  reply	other threads:[~2006-08-15  8:39 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
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 [this message]
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=44E188DF.4070003@uni-rostock.de \
    --to=ronald.hecht@uni-rostock.de \
    --cc=brolley@redhat.com \
    --cc=cgen@sourceware.org \
    /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).