From: Bernhard Urban Date: Sun, 11 Apr 2010 12:22:44 +0000 (+0200) Subject: alu/div: weniger code und weniger logic elements X-Git-Tag: review_abgabe~15 X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=cd6c796957a62bf9e35ebed2cb2f2598266f9036;p=hwmod.git alu/div: weniger code und weniger logic elements 4% (423/10570) logic elements @ 81.59MHz, klingt schon mal besser :) --- diff --git a/src/gen_pkg.vhd b/src/gen_pkg.vhd index 6f1ff43..6fb4a46 100644 --- a/src/gen_pkg.vhd +++ b/src/gen_pkg.vhd @@ -14,18 +14,10 @@ end package gen_pkg; package body gen_pkg is function find_msb(a : csigned) return natural is variable r : natural := 0; - variable count : boolean := true; begin for i in (CBITS-1) downto 0 loop - if count then - if a(i) = '1' then - count := false; - else - r := r+1; - end if; - else - null; - end if; + exit when a(i) = '1'; + r := r+1; end loop; return (CBITS - r); end function find_msb;