Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
From: Michael Nolan <mtnolan2640@gmail.com>
To: openpower-hdl-cores@mailinglist.openpowerfoundation.org,
	Libre-RISCV General Development
	<libre-riscv-dev@lists.libre-riscv.org>
Subject: [libre-riscv-dev] Power ISA v3.1 bug - parityw
Date: Fri, 15 May 2020 11:07:12 -0400
Message-ID: <48876f64-f3fa-c616-6710-ba773c89173c@gmail.com> (raw)

Hello! I'm with the Libre-SOC team, and was working on testing our 
implementation of the parityw and parityd instructions when I came 
across the following bug in the specification. The specification 
describes prtyd as follows:

s <- 0

do i = 0 to 7

     s <- s (XOR) RS[i%8 + 7]

RA <- 63'b0 || s

The least significant bit in each byte of the contents of register RS is 
examined. If there is an odd number of one bits the value 1 is placed 
into register RA; otherwise the value 0 is placed into register RA.



The description of "least significant bit in each byte" leads me to 
believe that RS[i%8 + 7] should really be RS[i*8+7]. This is also how it 
is implemented in microwatt

https://github.com/antonblanchard/microwatt/blob/master/ppc_fx_insns.vhdl 
line 297:

     function ppc_prtyd (rs: std_ulogic_vector(63 downto 0)) return std_ulogic_vector is
         variable tmp : std_ulogic;
         variable ret : std_ulogic_vector(63 downto 0);
     begin
         ret := (others => '0');

         tmp := '0';
         for i in 0 to 7 loop
             tmp := tmp xor rs(i*8);
         end loop;

         ret(0) := tmp;
         return ret;
     end;

Could you confirm whether RS[i*8+7] is the correct behavior?

Thanks,
Michael Nolan

P.S. Our discussion on the Libre-SOC bugzilla: https://bugs.libre-soc.org/show_bug.cgi?id=305#c73


_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

             reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 15:07 Michael Nolan [this message]
2020-05-15 15:09 ` Luke Kenneth Casson Leighton
2020-05-26  5:44 ` [libre-riscv-dev] [OpenPOWER-HDL-Cores] " Paul Mackerras
2020-05-27 21:49 ` Paul Mackerras
2020-05-27 22:09   ` [libre-riscv-dev] " Luke Kenneth Casson Leighton

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=48876f64-f3fa-c616-6710-ba773c89173c@gmail.com \
    --to=mtnolan2640@gmail.com \
    --cc=libre-riscv-dev@lists.libre-riscv.org \
    --cc=openpower-hdl-cores@mailinglist.openpowerfoundation.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