From 9a1a5579bf543af4c6c520b6402a42df0cbc91c6 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Wed, 14 Oct 2009 21:15:31 +0000 Subject: [PATCH] Bugfix in gen_fill_mask_rom (wrong result on zero shift amounts due to width mismatch) Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@509 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/CPUs/MIPS/src/core/mips_shifter.vhd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/CPUs/MIPS/src/core/mips_shifter.vhd b/lib/CPUs/MIPS/src/core/mips_shifter.vhd index 34036a2..7f047ec 100644 --- a/lib/CPUs/MIPS/src/core/mips_shifter.vhd +++ b/lib/CPUs/MIPS/src/core/mips_shifter.vhd @@ -54,10 +54,12 @@ architecture Behavioral of shifter is function gen_fill_mask_rom(data_width : natural) return fill_mask_rom_t is variable result : fill_mask_rom_t; begin - for i in 0 to data_width-1 loop + result(0) := (data_width-1 downto 0 => '0'); + for i in 1 to data_width-1 loop result(i) := (data_width-1-i downto 0 => '0') & (i-1 downto 0 => '1'); end loop; - for i in 0 to data_width-1 loop + result(data_width) := (data_width-1 downto 0 => '0'); + for i in 1 to data_width-1 loop result(data_width+i) := (i-1 downto 0 => '1') & (data_width-1-i downto 0 => '0'); end loop; return result;