Created
July 30, 2010 00:53
-
-
Save bdonlan/499618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------- | |
----- | |
----- util.vhd | |
----- | |
library IEEE; | |
use IEEE.STD_LOGIC_1164.all; | |
use IEEE.NUMERIC_STD.ALL; | |
package util is | |
function repl_unsigned(VAL: STD_LOGIC; SIZE: integer) return unsigned; | |
end util; | |
package body util is | |
function repl_unsigned(VAL: STD_LOGIC; SIZE: integer) return unsigned is | |
variable RESULT : unsigned(SIZE - 1 downto 0); | |
begin | |
for i in 0 to SIZE - 1 loop | |
RESULT(i) := VAL; | |
end loop; | |
return RESULT; | |
end; | |
end util; | |
--------------------------------------------------- | |
----- | |
----- mintest.vhd | |
----- | |
library IEEE; | |
use IEEE.STD_LOGIC_1164.ALL; | |
use IEEE.NUMERIC_STD.ALL; | |
--- Synthesis fails with this line uncommented | |
--library util; | |
--- ISIM fails here if the above line is NOT uncommented | |
use util.ALL; | |
entity mintest is | |
Port ( v : out unsigned (1 downto 0)); | |
end mintest; | |
architecture Behavioral of mintest is | |
begin | |
--- ISIM fails to find the repl_unsigned function here | |
v <= repl_unsigned('1', 2); | |
end Behavioral; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment