Forum Discussion
Altera_Forum
Honored Contributor
10 years agoAssuming you are using std_logic and std_logic_vector:
Write a function:function copyextend( l : std_logic; width : positive) return std_logic_vector is
variable r : std_logic_vector( width - 1 downto 0);
begin
for i in 0 to width-1 loop
r(i) := l;
end loop;
return r;
end function ;
PreMHQ1P <= PosMHQAD and copyextend( AddAndDb, 21 ) ;
Put the function in a package and you can re-use it everywhere.