--------------------------------------------------------------- -- this entity is the output buffer that stores characters -- to be output to the LEDS -- the array is indexed by a multiplier from -- the count given by the input generation block (time or temp) -- INPUTS: index from input geneator block and character code from LUT -- OUTPUTS: a sequence of LED commands (on/off) for the mux in the output block -- GENERICS: width how many columns of LEDs in a display block -- ( num of "pixels" in display area not the whole circle) -- char_width : how many LED columns are in one char, plus one space after the char -- height: how mnay LEDs tall a character is. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity outputbuffer is generic ( width : positive := 20; char_width : positive := 4; height : positive := 5; ctrl_width : positive := 3 ); port ( clock : in std_logic; index : in std_logic_vector (ctrl_width-1 downto 0); char_bitmap : in std_logic_vector (((char_width-1)*height)-1 downto 0); LED_0_pattern : out std_logic_vector (width-1 downto 0); LED_1_pattern : out std_logic_vector (width-1 downto 0); LED_2_pattern : out std_logic_vector (width-1 downto 0); LED_3_pattern : out std_logic_vector (width-1 downto 0); LED_4_pattern : out std_logic_vector (width-1 downto 0) ); end entity outputbuffer; architecture behavioural of outputbuffer is signal n : integer; signal char0, char1, char2, char3, char4 : std_logic_vector( height*char_width-1 downto 0 ); begin latch_LUT_data : process( clock ) variable i : integer range (width/char_width)-1 downto 0; begin if rising_edge( clock ) then if index = "000" then char0(((char_width-1)*height)-1 downto 0) <= char_bitmap; char0( ((char_width)*height)-1 downto ((char_width-1)*height)) <= "00000"; elsif index = "001" then char1(((char_width-1)*height)-1 downto 0) <= char_bitmap; char1( ((char_width)*height)-1 downto ((char_width-1)*height)) <= "00000"; elsif index = "010" then char2(((char_width-1)*height)-1 downto 0) <= char_bitmap; char2( ((char_width)*height)-1 downto ((char_width-1)*height)) <= "00000"; elsif index = "011" then char3(((char_width-1)*height)-1 downto 0) <= char_bitmap; char3( ((char_width)*height)-1 downto ((char_width-1)*height)) <= "00000"; elsif index = "100" then char4(((char_width-1)*height)-1 downto 0) <= char_bitmap; char4( ((char_width)*height)-1 downto ((char_width-1)*height)) <= "00000"; end if; end if; end process latch_LUT_data; assign_outputs: for n in 0 to char_width-1 generate LED_0_pattern(n) <= char0(n*height); LED_1_pattern(n) <= char0(n*height+ 1); LED_2_pattern(n) <= char0(n*height+ 2); LED_3_pattern(n) <= char0(n*height+ 3); LED_4_pattern(n) <= char0(n*height+ 4); LED_0_pattern(n+char_width) <= char1(n*height); LED_1_pattern(n+char_width) <= char1(n*height+ 1); LED_2_pattern(n+char_width) <= char1(n*height+ 2); LED_3_pattern(n+char_width) <= char1(n*height+ 3); LED_4_pattern(n+char_width) <= char1(n*height+ 4); LED_0_pattern(n+(char_width)*2) <= char2(n*height); LED_1_pattern(n+(char_width)*2) <= char2(n*height+ 1); LED_2_pattern(n+(char_width)*2) <= char2(n*height+ 2); LED_3_pattern(n+(char_width)*2) <= char2(n*height+ 3); LED_4_pattern(n+(char_width)*2) <= char2(n*height+ 4); LED_0_pattern(n+(char_width)*3) <= char3(n*height); LED_1_pattern(n+(char_width)*3) <= char3(n*height+ 1); LED_2_pattern(n+(char_width)*3) <= char3(n*height+ 2); LED_3_pattern(n+(char_width)*3) <= char3(n*height+ 3); LED_4_pattern(n+(char_width)*3) <= char3(n*height+ 4); LED_0_pattern(n+(char_width)*4) <= char4(n*height); LED_1_pattern(n+(char_width)*4) <= char4(n*height+ 1); LED_2_pattern(n+(char_width)*4) <= char4(n*height+ 2); LED_3_pattern(n+(char_width)*4) <= char4(n*height+ 3); LED_4_pattern(n+(char_width)*4) <= char4(n*height+ 4); end generate assign_outputs; --LED_0_pattern <= "00110011001100110011"; --LED_1_pattern <= "00110011001100110011"; --LED_2_pattern <= "00110011001100110011"; --LED_3_pattern <= "00110011001100110011"; --LED_4_pattern <= "00110011001100110011"; end behavioural;