From 0b3df8ab00b31077a9666671b21c84df52ba750a Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 15 Dec 2025 08:27:42 +1100 Subject: [PATCH] bitsort: Fix bperm instruction (#456) The result byte needs to be zero when the index byte value is >= 64. Fixes: 23ff954059fa ("core: Change bperm to a simpler and slower implementation", 2025-01-07) Signed-off-by: Paul Mackerras --- bitsort.vhdl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitsort.vhdl b/bitsort.vhdl index 01b34b5..179efba 100644 --- a/bitsort.vhdl +++ b/bitsort.vhdl @@ -108,7 +108,9 @@ begin end process; -- bit permutation - bperm_res(7) <= rb_bp(to_integer(unsigned(not rs_sr(5 downto 0)))) when not is_X(rs_sr) + bperm_res(7) <= (rb_bp(to_integer(unsigned(not rs_sr(5 downto 0)))) + and not (rs_sr(6) or rs_sr(7))) + when not is_X(rs_sr) else 'X'; bperm_r: process(clk)