Altera_Forum
Honored Contributor
14 years agoProblem with port mapping in Quartus
Hello,
I am trying to model a two dimensional array of registers using port mapping in quartus. I have first designed a five stage shift register for which I am getting the desired result i.e., the output appears with the fifth clock pulse after the CE is asserted. I then port mapped this shift register 16 times to get a 16x5 array. I am supposed to get the output after the fifth clock pulse but it appears after the 21st clock pulse after asserting CE. I have failed to comprehend the reason behind this anomalous behavior of my design. I would request you to please help me out. The codes for both the entities are given below. ______________________________________________________________ Five stage shift register library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity MEMBLOCK is Port ( Input : in STD_LOGIC; CLK : in STD_LOGIC; CLR : in STD_LOGIC; CE : in std_logic; Output : out STD_LOGIC); end MEMBLOCK; architecture Behavioral of MEMBLOCK is signal temp:std_logic_vector(4 downto 0); begin process(CLK,CLR,Input,Temp,CE) begin if(clr='1') then output <= '0'; temp<="00000"; elsif (clk'event and clk = '1' and CE= '1') then temp(0) <= input; temp(4 downto 1) <= temp(3 downto 0); end if; output <= temp(4); end process; end Behavioral; ________________________________________________________________ 16x5 array library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity Memoryblock is Port ( Input : in STD_LOGIC_VECTOR (15 downto 0); Output : out STD_LOGIC_VECTOR (15 downto 0); CLK : in STD_LOGIC; CLR : in STD_LOGIC; CE : in STD_LOGIC); end Memoryblock; architecture Behavioral of Memoryblock is component MEMBLOCK is Port ( Input : in STD_LOGIC; CLK : in STD_LOGIC; CLR : in STD_LOGIC; CE : in std_logic; Output : out STD_LOGIC); end component; begin A0 : MEMBLOCK port map( Input(0), CLK, CLR, CE, Output(0)); A1 : MEMBLOCK port map( Input(1), CLK, CLR, CE, Output(1)); A2 : MEMBLOCK port map( Input(2), CLK, CLR, CE, Output(2)); A3 : MEMBLOCK port map( Input(3), CLK, CLR, CE, Output(3)); A4 : MEMBLOCK port map( Input(4), CLK, CLR, CE, Output(4)); A5 : MEMBLOCK port map( Input(5), CLK, CLR, CE, Output(5)); A6 : MEMBLOCK port map( Input(6), CLK, CLR, CE, Output(6)); A7 : MEMBLOCK port map( Input(7), CLK, CLR, CE, Output(7)); A8 : MEMBLOCK port map( Input(8), CLK, CLR, CE, Output(8)); A9 : MEMBLOCK port map( Input(9), CLK, CLR, CE, Output(9)); A10 : MEMBLOCK port map( Input(10), CLK, CLR, CE, Output(10)); A11 : MEMBLOCK port map( Input(11), CLK, CLR, CE, Output(11)); A12 : MEMBLOCK port map( Input(12), CLK, CLR, CE, Output(12)); A13 : MEMBLOCK port map( Input(13), CLK, CLR, CE, Output(13)); A14 : MEMBLOCK port map( Input(14), CLK, CLR, CE, Output(14)); A15 : MEMBLOCK port map( Input(15), CLK, CLR, CE, Output(15)); end Behavioral; ________________________________________________________________ I would like to draw your attention to the fact that both the codes operate properly and give desired results with XILINX.