Sunday, September 14, 2008

VHDL Part 43 : Mask Generator 2

Jeppe is kind enough to answer me. Here it goes.

Hi tahder

Not sure - but I guess the generate statement not allowed inside a process.

try this instead

---------------------------------------------------------------------------------- 
library IEEE; 
use 
IEEE.STD_LOGIC_1164.ALL; 
use 
IEEE.STD_LOGIC_ARITH.ALL; 
use 
IEEE.STD_LOGIC_UNSIGNED.ALL; 

entity mskgen is 
   generic
( n: natural := 10; 
             
r: natural := 10); 
    
port( clk,maskEn: std_logic); 
end mskgen; 

architecture bhv of mskGen is 
   subtype patternArray is std_logic_vector 
(n-1 downto 0); 
   
type referenceArray is array (r-1 downto 0) of patternArray; 
   
signal memory,maskIn_P,maskIn_R : referenceArray; 

begin 
    process 
(clk, maskEn) 
    
begin 
        
if clk = '1' and clk'event then 
            if maskEn = '
1' then 
                for j in 0 to r-1 loop 
                    for i in 0 to n-1 loop 
                       if maskIn_P(i)=maskIn_R(j) then 
                           memory(i)(j) <= '
1'; 
                        else 
                           memory(i)(j) <= '
0; 
                        
end if; 
                    
end loop; 
                
end loop; 
            
end if; 
        
end if; 
    
end process; 
end bhv;  


Regards
Jeppe

No comments: