Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
From: bugzilla-daemon@libre-soc.org
To: libre-riscv-dev@lists.libre-riscv.org
Subject: [libre-riscv-dev] [Bug 313] Create Branch Pipeline for POWER9
Date: Fri, 15 May 2020 20:31:18 +0000
Message-ID: <bug-313-13-qMbPYtiYO3@https.bugs.libre-soc.org/> (raw)
In-Reply-To: <bug-313-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=313

--- Comment #11 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #10)

> I removed the TAR input, because the branch instruction would need to decide
> which of the 3 inputs to branch to. Instead, it should be fed that operand
> in the spr input (though that does mean it will be fed ctr twice for
> bcctr...). Does that seem reasonable?

nggghhh.  *thinks*, *thinks*....

ok, the way that the Function Units work is: well, let me find a diagram..
https://libre-soc.org/3d_gpu/comp_unit_req_rel.jpg

although that's an ALU FU, in the case of a *branch* FU, those inputs would
be:

* CTR
* CIA
* CR
* TAR

basically, those latches at the top "accumulate" all of the inputs needed
(some of which as you can see actually come from the operand - this is
CompBROpSubset)

anything that needs to be read from a regfile - whether it be the SPR one,
the Condition Regfile or the INT Regfile - all needs to have those pairs
of REQUEST/GO_READ signals.

* the outgoing one *requests* the register (actually the regfile port)
* the incoming one (GO_READ) demands that the FU latch the incoming register
  data, right now.  it will not get another chance.

so the idea of doing time-synchronous feeding of the input data (sharing one
of the register inputs for two registers, one after the other) is massively
more complicated than simply storing the data in (multiple) Function Unit
latches.

now, *at the regfile* there may only be one available Reg Port Bus.

therefore *over the (one) Reg Port Bus*, it may take two clock cycles:
* one to read CTR
* one to read TAR

and this can be done in any order: CTR first, TAR first, or if 2 Reg Port
Buses happen to be available, *both* simultaneously.

however that task is handled at the CompUnit (like in the diagram above),
precisely so that the pipelines *do not* have to have such complexity.

therefore, really, if the branch op needs 2 regs (one CTR, one TAR), then the
BranchCompUnit will need 2 latches to cover them, and consequently
BranchInputData
needs to have both ctr and tar.

let's have a look at what was generated by the parser.  all the others are
subsets (less regs) than this one:

    @inject()
    def op_bctarl(self, CTR, CR, TAR, LR):
        global NIA
        if mode_is_64bit:
            M = 0
        else:
            M = 32
        if ~BO[2]:
            CTR = CTR - 1
        ctr_ok = BO[2] | ne(CTR[M:64], 0) ^ BO[3]
        cond_ok = BO[0] | ~(CR[BI + 32] ^ BO[1])
        if ctr_ok & cond_ok:
            NIA = concat(TAR[0:62], SelectableInt(value=0x0, bits=2))
        if LK:
            LR = CIA + 4
        return (CTR, CR, TAR, LR,)

that's interesting.  TAR is returned but i do not see it being modified.
that's a bug.

NIA however is calculated but is not returned *from* the... oh wait, yes
i see, it's a global.  ok.  got it.

so, yes, apologies, we can't use spr for dual-purpose, we need 2 regs,
and they might as well be named ctr and tar, rather than spr.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

  parent reply index

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 15:30 [libre-riscv-dev] [Bug 313] New: " bugzilla-daemon
2020-05-15 15:30 ` [libre-riscv-dev] [Bug 313] " bugzilla-daemon
2020-05-15 15:33 ` bugzilla-daemon
2020-05-15 17:26 ` bugzilla-daemon
2020-05-15 17:41 ` bugzilla-daemon
2020-05-15 18:58 ` bugzilla-daemon
2020-05-15 19:01 ` bugzilla-daemon
2020-05-15 19:14 ` bugzilla-daemon
2020-05-15 19:17 ` bugzilla-daemon
2020-05-15 19:28 ` bugzilla-daemon
2020-05-15 19:33 ` bugzilla-daemon
2020-05-15 19:36 ` bugzilla-daemon
2020-05-15 20:11 ` bugzilla-daemon
2020-05-15 20:31 ` bugzilla-daemon [this message]
2020-05-15 20:39 ` bugzilla-daemon
2020-05-15 20:46 ` bugzilla-daemon
2020-05-15 21:07 ` bugzilla-daemon
2020-05-15 21:26 ` bugzilla-daemon
2020-05-15 21:27 ` bugzilla-daemon
2020-05-15 22:23 ` bugzilla-daemon
2020-05-15 23:49 ` bugzilla-daemon
2020-05-16  0:56 ` bugzilla-daemon
2020-05-17 17:37 ` bugzilla-daemon
2020-05-17 18:11 ` bugzilla-daemon
2020-05-17 19:17 ` bugzilla-daemon
2020-05-19 12:30 ` bugzilla-daemon
2020-05-19 18:09 ` bugzilla-daemon
2020-05-19 18:30 ` bugzilla-daemon
2020-05-19 21:02 ` bugzilla-daemon
2020-05-19 21:06 ` bugzilla-daemon
2020-05-19 21:09   ` Jacob Lifshay
2020-05-19 21:14 ` bugzilla-daemon
2020-05-19 21:19 ` bugzilla-daemon
2020-05-19 21:22 ` bugzilla-daemon
2020-05-19 21:41 ` bugzilla-daemon
2020-05-20 18:43   ` [libre-riscv-dev] monorepo Jacob Lifshay
2020-05-20 19:08     ` Luke Kenneth Casson Leighton
2020-05-20 19:17       ` Luke Kenneth Casson Leighton
2020-05-19 21:44 ` [libre-riscv-dev] [Bug 313] Create Branch Pipeline for POWER9 bugzilla-daemon
2020-05-22  2:39 ` bugzilla-daemon
2020-05-22  8:44 ` bugzilla-daemon
2020-05-22 13:10 ` bugzilla-daemon
2020-05-22 13:46 ` bugzilla-daemon
2020-05-22 14:11 ` bugzilla-daemon
2020-05-22 14:33 ` bugzilla-daemon
2020-05-22 14:51 ` bugzilla-daemon
2020-05-22 18:21 ` bugzilla-daemon
2020-05-23  1:29 ` bugzilla-daemon
2020-05-23  3:06 ` bugzilla-daemon
2020-06-01 20:39 ` bugzilla-daemon
2020-06-02 18:27 ` bugzilla-daemon
2020-06-02 18:43 ` bugzilla-daemon
2020-06-02 19:09 ` bugzilla-daemon
2020-06-02 20:11 ` bugzilla-daemon
2020-06-02 20:19 ` bugzilla-daemon
2020-06-02 20:30 ` bugzilla-daemon
2020-06-02 21:03 ` bugzilla-daemon
2020-06-02 21:33 ` bugzilla-daemon
2020-06-02 21:38 ` bugzilla-daemon
2020-06-02 22:41 ` bugzilla-daemon

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=bug-313-13-qMbPYtiYO3@https.bugs.libre-soc.org/ \
    --to=bugzilla-daemon@libre-soc.org \
    --cc=libre-riscv-dev@lists.libre-riscv.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

Libre RISC-V Mailing list Archives (accessible via public-inbox)

Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev

Example config snippet for mirrors


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git