All of lore.kernel.org
 help / color / mirror / Atom feed
From: BAndViG <bandvig@mail.ru>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] OpenRISC 1.3 spec
Date: Fri, 10 May 2019 10:56:05 +0300	[thread overview]
Message-ID: <AED0C7019AE04A2F87CD0E432FA20A70@BAndViG> (raw)
In-Reply-To: <3ce42625-83fe-4ee2-b48f-23e6362ee616@twiddle.net>

> From: Richard Henderson
> Sent: Friday, May 10, 2019 12:47 AM
> To: BAndViG ; Stafford Horne
> Cc: Openrisc
> Subject: Re: [OpenRISC] OpenRISC 1.3 spec

> > On 5/8/19 11:05 AM, BAndViG wrote:
> > Ah, I implemented similar approach in MAROCCHINO independently :), see 
> > latest
> > commit to fp_unordered_cmp branch:
> > https://github.com/openrisc/or1k_marocchino/commit/313b256875c8b619f5b16db47d915e5dfaedfff7

> In the commit above, you say

> > If A1/B1/D1 address `> 30` than `invalid instruction` exception is raised.

Oh, it is just misprint. It should be `>= 30`.

> But that doesn't handle D1=30, D1P=1.
> Since you are using a (5-bit?) add-with-carry circuit, is it easy to raise 
> the
> invalid instruction if there is carry out of bit 4, instead of the hard-coded
> comparison against 30?

A1/B1/D1 boundaries check is implemented in or1k_marocchino_decode.v, lines 
#348-351

//  # check legality of A1/B1/D1 addresses: they must be < r30
wire op_fp64_rfa1_adr_l = ~(&fetch_rfa1_adr_i[OPTION_RF_ADDR_WIDTH-1:1]);
wire op_fp64_rfb1_adr_l = ~(&fetch_rfb1_adr_i[OPTION_RF_ADDR_WIDTH-1:1]);
wire op_fp64_rfd1_adr_l = ~(&fetch_rfd1_adr_i[OPTION_RF_ADDR_WIDTH-1:1]);

And here, commentary is correct :).
`_l` suffix here means `legal`.
I check that [4:1] bits must not be 4'b1111, because 5'd30 is 5'b11110 and 
5'd31 is all ones.

> Otherwise, I'd drop the invalid instruction and let D2 wrap around.
> D1=31,D1P=1 would be a valid (but silly) instruction clobbering the stack
> pointer (R1).  As would D1=31,D1P=0, overwriting the
> ought-to-have-been-hardwired-but-isn't R0.  Both are certainly user bugs, but
> so what -- Don't Do That Then.

:) As you correctly mentioned, current GPRs implementation in MAROCCHINO (and 
in any pipe of mor1kx if I remember correctly) allows writing into R0 just to 
simplify design. As a result a user have got enough room for bugs already.
I've been thinking about a variants for R0 write protection. R0 could be zero 
initialized at cpu_rst by dedicated circuits. And `invalid instruction` 
exception should be raised if an instruction tries to write to R0. At the same 
time such behavior is incompatible with current run-time initialization 
sequences implemented in OR1K tool chains. The circle is closed.

WBR
Andrey 


  reply	other threads:[~2019-05-10  7:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 20:56 [OpenRISC] OpenRISC 1.3 spec Stafford Horne
2019-04-12 21:17 ` Richard Henderson
2019-04-12 21:48   ` Stafford Horne
2019-04-13  8:11     ` Richard Henderson
2019-04-13  8:47       ` Stafford Horne
2019-04-14  9:41         ` BAndViG
2019-04-25 21:17           ` Stafford Horne
2019-04-26 22:22             ` Stafford Horne
2019-05-02 12:22               ` BAndViG
2019-05-07 15:28             ` Richard Henderson
2019-05-07 21:12               ` Stafford Horne
2019-05-08 18:05                 ` BAndViG
2019-05-09 20:29                   ` Stafford Horne
2019-05-09 21:47                   ` Richard Henderson
2019-05-10  7:56                     ` BAndViG [this message]
2019-05-11 10:04                       ` Stafford Horne
2019-05-12 19:58                         ` BAndViG
2019-05-12 23:09                           ` Stafford Horne
2019-06-06 22:11                           ` Stafford Horne
2019-06-15  6:14                             ` Stafford Horne
2019-04-13  8:03 ` Richard Henderson
2019-04-14  6:30   ` Stafford Horne
2019-04-14  6:48     ` Stafford Horne

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=AED0C7019AE04A2F87CD0E432FA20A70@BAndViG \
    --to=bandvig@mail.ru \
    --cc=openrisc@lists.librecores.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.