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 325] create POWER9 TRAP pipeline
Date: Sun, 07 Jun 2020 21:11:59 +0000
Message-ID: <bug-325-13-Gg2ZPaQehx@https.bugs.libre-soc.org/> (raw)
In-Reply-To: <bug-325-13@https.bugs.libre-soc.org/>

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

--- Comment #80 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Cole Poirier from comment #79)
> (In reply to Luke Kenneth Casson Leighton from comment #75)
> > commit d2e0e6bea57795fb522e0805b16e6f2852472f98
> > Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
> > Date:   Sun Jun 7 07:03:58 2020 +0100
> > 
> >     add MSR to simulator context
> > 
> > as comment says.  i also updated the git submodule so that sprset now
> > contains the (new, untested) mtmsr/mfmsr.  if you rerun pywriter.py
> > you'll see the code now gets created.
> > 
> > and that in turn means that if you add a unit test that uses mfmsr
> > or mtmsr, the code in the auto-generated sprset.py for op_mfmsr/op_mtmsr
> > will get called.
> > 
> > whether that (completely untested) code is *accurate* or not is another
> > matter.
> > 
> > we now have a situation of two "unknowns"
> > 
> > 1. unknown simulator
> > 2. unknown hardware code.
> > 
> > the normal solution for this is to "call in" something that *is* known,
> > and that would be the qemu emulator.  except we kinda need some help from
> > michael to do that in a short timescale, or we need to investigate it
> > in a longer one.  given that there's a critical task needed (investigating
> > the CR bit-ordering) i'd rather we not pull him off of that.
> 
> So until we have the known qemu emulator I should just try writing
> appropriate unit tests for when we have the emulator working? Should I raise
> a bug report for investigating the qemu powerpc emulator on a longer
> timescale? What should I say in the bug description?
> 
> (In reply to Luke Kenneth Casson Leighton from comment #76)
> > i'm also attempting to add support for TRAP - as a function - in the
> > parser and simulator, *without* changing fixedtrap.mdwn, which is
> > taken directly from the 3.0B PDF.  bit of a pain.
> > 
> > now, if you create a test_tdi() function in trap test_pipe_caller.py,
> > the simulator *should* print out "TRAP TODO".
> > 
> > 
> > diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py
> > index 61aa451..ae5d479 100644
> > --- a/src/soc/decoder/isa/caller.py
> > +++ b/src/soc/decoder/isa/caller.py
> > @@ -233,6 +233,11 @@ class ISACaller:
> >          self.decoder = decoder2.dec
> >          self.dec2 = decoder2
> >  
> > +    def TRAP(self, trap_addr=0x700):
> > +        print ("TRAP: TODO")
> > +        # store PC in SRR0, set PC to 0x700
> > +        # store MSR in SRR1, set MSR to um errr something
> > +
> >      def memassign(self, ea, sz, val):
> >          self.mem.memassign(ea, sz, val)
> 
> This is our autogenerated from parsing csv files emulator? 

nono, that's actually the function that gets called *by* the emulator.
it's decoder/isa/caller.py (which is the base class for the simulator)

> Is this something I can help with 

actually, probably yes.  it should be as brain-dead simple as
putting things into the self.spr dict:

    self.spr['SRR0'] = self.pc.CIA

and also modify the NIA.  that sort of thing.


> So is this TRAP function added in sort of ad hoc via caller.py, because it
> isn't contained in fixedtrap.mdwn?

it is... however look at the PDF SPEC (or see comment #1 which contains
the pseudo-code.  that's not a function, is it?

so what i did was, identify the keyword "TRAP" and got it to output
a *function* call "self.TRAP()".  auto-generated decoder/isa/fixedtrap.py
now contains this:

class fixedtrap:

    @inject()
    def op_twi(self, RA):
        a = EXTS(RA[32:64])
        if lt(a, EXTS(SI)) & TO[0]:self.TRAP()
        if gt(a, EXTS(SI)) & TO[1]:self.TRAP()


*now* it can call the function which was added in caller.py, *now* we
can get that function to make the required modifications to the SPRs
and to the PC (NIA - Next Instruction Address).

-- 
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: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 12:28 [libre-riscv-dev] [Bug 325] New: " bugzilla-daemon
2020-05-19 12:29 ` [libre-riscv-dev] [Bug 325] " bugzilla-daemon
2020-05-19 12:30 ` bugzilla-daemon
2020-05-19 14:11 ` bugzilla-daemon
2020-05-19 14:57 ` bugzilla-daemon
2020-05-19 15:49 ` bugzilla-daemon
2020-05-19 16:54 ` bugzilla-daemon
2020-05-19 18:09 ` bugzilla-daemon
2020-05-19 18:13 ` bugzilla-daemon
2020-05-19 20:43 ` bugzilla-daemon
2020-05-19 23:19 ` bugzilla-daemon
2020-05-19 23:31 ` bugzilla-daemon
2020-05-24  3:41 ` bugzilla-daemon
2020-05-24  3:43 ` bugzilla-daemon
2020-05-25  2:41 ` bugzilla-daemon
2020-05-27 14:43 ` bugzilla-daemon
2020-05-27 14:48 ` bugzilla-daemon
2020-05-27 14:49 ` bugzilla-daemon
2020-06-01 19:05 ` bugzilla-daemon
2020-06-02 11:21 ` bugzilla-daemon
2020-06-02 14:06 ` bugzilla-daemon
2020-06-02 17:54 ` bugzilla-daemon
2020-06-02 23:07 ` bugzilla-daemon
2020-06-02 23:07 ` bugzilla-daemon
2020-06-02 23:46 ` bugzilla-daemon
2020-06-02 23:54 ` bugzilla-daemon
2020-06-02 23:59 ` bugzilla-daemon
2020-06-03  0:11 ` bugzilla-daemon
2020-06-03  0:38 ` bugzilla-daemon
2020-06-03  0:47 ` bugzilla-daemon
2020-06-03  1:13 ` bugzilla-daemon
2020-06-03  1:28 ` bugzilla-daemon
2020-06-03  1:35 ` bugzilla-daemon
2020-06-03  1:41 ` bugzilla-daemon
2020-06-03  1:50 ` bugzilla-daemon
2020-06-03  2:31 ` bugzilla-daemon
2020-06-03  3:27 ` bugzilla-daemon
2020-06-04  0:29 ` bugzilla-daemon
2020-06-04  0:34 ` bugzilla-daemon
2020-06-04 22:41 ` bugzilla-daemon
2020-06-05  0:32 ` bugzilla-daemon
2020-06-05  0:35 ` bugzilla-daemon
2020-06-05  1:06 ` bugzilla-daemon
2020-06-05  1:09 ` bugzilla-daemon
2020-06-05  1:25 ` bugzilla-daemon
2020-06-05  2:13 ` bugzilla-daemon
2020-06-05  2:34 ` bugzilla-daemon
2020-06-05  3:37 ` bugzilla-daemon
2020-06-05  3:52 ` bugzilla-daemon
2020-06-05  4:19 ` bugzilla-daemon
2020-06-05 14:16 ` bugzilla-daemon
2020-06-05 15:12 ` bugzilla-daemon
2020-06-05 15:21 ` bugzilla-daemon
2020-06-05 15:33 ` bugzilla-daemon
2020-06-05 15:43 ` bugzilla-daemon
2020-06-05 15:46 ` bugzilla-daemon
2020-06-05 16:14 ` bugzilla-daemon
2020-06-05 18:14 ` bugzilla-daemon
2020-06-05 19:08 ` bugzilla-daemon
2020-06-05 19:15 ` bugzilla-daemon
2020-06-05 19:49 ` bugzilla-daemon
2020-06-05 20:12 ` bugzilla-daemon
2020-06-05 21:59 ` bugzilla-daemon
2020-06-05 22:02 ` bugzilla-daemon
2020-06-05 23:25 ` bugzilla-daemon
2020-06-05 23:46 ` bugzilla-daemon
2020-06-06  2:23 ` bugzilla-daemon
2020-06-07  0:31 ` bugzilla-daemon
2020-06-07  0:38 ` bugzilla-daemon
2020-06-07  0:39 ` bugzilla-daemon
2020-06-07  0:44 ` bugzilla-daemon
2020-06-07  0:51 ` bugzilla-daemon
2020-06-07  1:32 ` bugzilla-daemon
2020-06-07  1:42 ` bugzilla-daemon
2020-06-07  1:52 ` bugzilla-daemon
2020-06-07  2:09 ` bugzilla-daemon
2020-06-07  2:36 ` bugzilla-daemon
2020-06-07  3:09 ` bugzilla-daemon
2020-06-07  3:23 ` bugzilla-daemon
2020-06-07  6:11 ` bugzilla-daemon
2020-06-07  6:26 ` bugzilla-daemon
2020-06-07 20:42 ` bugzilla-daemon
2020-06-07 20:45 ` bugzilla-daemon
2020-06-07 20:51 ` bugzilla-daemon
2020-06-07 21:11 ` bugzilla-daemon [this message]
2020-06-07 21:18 ` bugzilla-daemon
2020-06-07 21:23 ` bugzilla-daemon
2020-06-07 21:31 ` bugzilla-daemon
2020-06-07 22:32 ` bugzilla-daemon
2020-06-07 22:34 ` bugzilla-daemon
2020-06-08 12:59 ` bugzilla-daemon
2020-06-08 13:42 ` bugzilla-daemon
2020-06-08 21:03 ` bugzilla-daemon
2020-06-08 22:51 ` bugzilla-daemon
2020-06-09 19:32 ` bugzilla-daemon
2020-06-09 20:59 ` 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-325-13-Gg2ZPaQehx@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