Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Dominic Sweetman <dom@mips.com>
To: "karthikeyan natarajan" <karthik_96cse@yahoo.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Dominic Sweetman <dom@mips.com>,
	linux-mips@linux-mips.org
Subject: Re: In r4k, where does PC point to?
Date: Mon, 19 Jan 2004 17:08:20 +0000	[thread overview]
Message-ID: <16396.3844.762068.691269@gladsmuir.mips.com> (raw)
In-Reply-To: <20040119154538.92376.qmail@web10108.mail.yahoo.com>


> Am curious to know, how the PC register can be used to
> locate the instruction which caused the exception as 
> the exception can happen at any one of the eight 
> pipeline stages..

You can't, of course, because there isn't a "PC register".  But now I
understand your question...

Most MIPS implementations actually respond to all exceptions at the
same pipe-stage.  (If you took exceptions when you first noticed them,
an early-stage event like a I-side TLBmiss might happen before a
D-side TLBmiss for an instruction which is earlier in the instruction
stream... and that would be bad.  We're pretending this is a
sequential processor).

So exception conditions detected early in the pipe set a flag which is
then carried down the pipeline and always looked at in the same stage.

The choice of which stage to do this is somewhat implementation
dependent; it wants to be the last stage where you can find out that
an exception is needed.  Generally that will be about the same time as
you'd access the D-cache (you may get exceptions when you're
translating the D-address).

So there needs to be a way to figure out the address where the
instruction currently at the "X" pipestage came from.  You need that
for exceptions; but you also need it (for example) when executing a
'jal' instruction and figuring out the return address.

A conceptually simple way to do this is to carry the instruction's
address along the pipeline with it, in case you need it.  But
sometimes CPU designers do something more complicated to save the
storage.

> Here is the link..
> http://www.cag.lcs.mit.edu/raw/documents/R4400_Uman_book_Ed2.pdf
> 
> The documentation about the PC is present in the chapter-1 under the
> section "CPU Register Overview".
> 
> Please let me know whether this manual is correct.

Ah, that book.  That picture is nonsense, really.  Sorry, that
happens!

--
Dominic Sweetman
MIPS Technologies.

  reply	other threads:[~2004-01-19 17:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-19  7:42 In r4k, where does PC point to? karthikeyan natarajan
2004-01-19 14:50 ` Ralf Baechle
2004-01-19 14:57   ` Dominic Sweetman
2004-01-19 15:14     ` karthikeyan natarajan
2004-01-19 15:22       ` Ralf Baechle
2004-01-19 15:45         ` karthikeyan natarajan
2004-01-19 17:08           ` Dominic Sweetman [this message]
2004-01-19 16:30       ` Dominic Sweetman
2004-01-19 16:49         ` karthikeyan natarajan

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=16396.3844.762068.691269@gladsmuir.mips.com \
    --to=dom@mips.com \
    --cc=karthik_96cse@yahoo.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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