acvarif 0 Posted December 19, 2012 · Report post Имеется дешифратор типа process(clk) begin if clk'event and clk = '0' then if s_rclk = '0' then s_we_res <= "1111111111111111"; else case s_address_rdram is when "0000" => s_we_res <= "1111111111111110"; when "0001" => s_we_res <= "1111111111111101"; when "0010" => s_we_res <= "1111111111111011"; when "0011" => s_we_res <= "1111111111110111"; when "0100" => s_we_res <= "1111111111101111"; when "0101" => s_we_res <= "1111111111011111"; when "0110" => s_we_res <= "1111111110111111"; when "0111" => s_we_res <= "1111111101111111"; when "1000" => s_we_res <= "1111111011111111"; when "1001" => s_we_res <= "1111110111111111"; when "1010" => s_we_res <= "1111101111111111"; when "1011" => s_we_res <= "1111011111111111"; when "1100" => s_we_res <= "1110111111111111"; when "1101" => s_we_res <= "1101111111111111"; when "1110" => s_we_res <= "1011111111111111"; when "1111" => s_we_res <= "0111111111111111"; when others => s_we_res <= "1111111111111111"; end case; end if; end if; end process; Но требуется такой-же дешифратор но уже не на 16, а на 48 нулей Можно-ли как-то упростить писанину, на цикле или еще как? Quote Ответить с цитированием Share this post Link to post Share on other sites
Dimidrol 0 Posted December 19, 2012 · Report post Имеется дешифратор типа ... Можно-ли как-то упростить писанину, на цикле или еще как? Может написать функцию? По идее, можно написать компактно. Quote Ответить с цитированием Share this post Link to post Share on other sites
TRILLER 0 Posted December 19, 2012 · Report post Здравствуйте. Можно. library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; process(clk) variable s_we_res_temp : std_logic_vector(47 downto 0); begin if clk'event and clk = '0' then if s_rclk = '0' then s_we_res <= (others => '1'); else s_we_res_temp := (others => '1'); s_we_res_temp(conv_integer(s_address_rdram)) := '0'; s_we_res <= s_we_res_temp; end if; end if; end process; Quote Ответить с цитированием Share this post Link to post Share on other sites
Muscat 0 Posted December 19, 2012 · Report post process (clk) variable Cnt: integer range 0 to 47; begin process (clk) if rising_edge(clk) then cnt:=conv_integer(s_address_rdram); s_we_res<=(cnt=>'0',others=>'1'); end if; end process; Или просто логикой For i in 0 to 47 generate s_we_res(i)<='1' when conv_integer(s_address_rdram)=i else '0'; end generate Или так if rising_edge(clk) then s_we_res<=(others=>'1'); s_we_res(conv_integer(s_address_rdram))<='0'; end if; UPD TRILLER, а зачем промежуточное значение типа переменной? Все равно приоритет имеет последнее присвоение. Quote Ответить с цитированием Share this post Link to post Share on other sites
vitus_strom 0 Posted December 19, 2012 · Report post Имеется дешифратор типа process(clk) begin if clk'event and clk = '0' then if s_rclk = '0' then s_we_ res <= "1111111111111111"; else case s_address_rdram is when "0000" => s_we_res <= "1111111111111110"; when "0001" => s_we_res <= "1111111111111101"; ... when "1111" => s_we_res <= "0111111111111111"; when others => s_we_res <= "1111111111111111"; end case; end if; end if; end process; Но требуется такой-же дешифратор но уже не на 16, а на 48 нулей Можно-ли как-то упростить писанину, на цикле или еще как? Можно вот так: process(clk) variable decoder_v : std_logic_vector(2**s_address_rdram'length-1 downto 0) := (others => '1'); begin decoder_v := (others => '1'); decoder_v(conv_integer(unsigned(s_address_rdram)) := '0'; decoder_i <= decoder_v; end process; process(clk) begin if clk'event and clk = '0' then if s_rclk='0' then s_we_ res <= "1111111111111111"; else s_we_ res <= decoder_i; end if; end if; end process; Quote Ответить с цитированием Share this post Link to post Share on other sites
TRILLER 0 Posted December 19, 2012 (edited) · Report post Ну, в данном случае не нужно. Просто, иногда неоходимо, допустим, поксорить несколько элементов между собой или ещё чего. А так, действительно не нужно. Сколько решений простой задачи мы предложили. Вот так бы со сложными))) Edited December 19, 2012 by TRILLER Quote Ответить с цитированием Share this post Link to post Share on other sites
Muscat 0 Posted December 19, 2012 · Report post Кто бы мне сейчас накидал решений, почему в модели Xilinx MIG RLDRAMII не выполняется init_calib_complete при моделировании :-( Quote Ответить с цитированием Share this post Link to post Share on other sites
vitus_strom 0 Posted December 19, 2012 · Report post а в доке ничего про это не написано - если я правильно помню его очень долго надо ждать и поэтому генериком ставится таймаут через сколько его выставить Quote Ответить с цитированием Share this post Link to post Share on other sites
Muscat 0 Posted December 19, 2012 · Report post Для DDR3 я его дожидался 80мкс, коллега вот дал старый проект, для MIG 1.49, тут init_calib_complete выставляется через 28мкс В процессе калибровки он что то кидает в память, что то читает. А у меня одна транзакция в начале и молчок. 200мкс моделил, все равно молчит. Такое чувство, что где то что то не подключилось. Quote Ответить с цитированием Share this post Link to post Share on other sites
acvarif 0 Posted December 19, 2012 · Report post Спасибо всем за варианты. Все работают. Quote Ответить с цитированием Share this post Link to post Share on other sites