ARCHITECTURE studentVersion OF triangleToPolygon IS signal mySignal : unsigned(bitNb downto 0); constant aFullTriangle : unsigned(bitNb downto 0) := (others => '1'); BEGIN convert: process(triangle) begin if (('0' & triangle) + ('0' & shift_right(triangle, 1))) < shift_right(aFullTriangle, 3) then mySignal <= shift_right(aFullTriangle,3); elsif (('0' & triangle) + ('0' & shift_right(triangle, 1))) > (shift_right(aFullTriangle, 1) + shift_right('0' & aFullTriangle, 3)) then mySignal <= (shift_right(aFullTriangle,1) + shift_right(aFullTriangle,3)); elsif '1' then mySignal <= ('0' & triangle) + ('0' & shift_right(triangle, 1) ); end if ; end process convert; polygon <= resize(mySignal-shift_right('0' & aFullTriangle,3), bitNb); END ARCHITECTURE studentVersion;