[an error occurred while processing this directive]
VHDL проблема с шиной МК
(«Телесистемы»: Конференция «Языки описания аппаратуры (VHDL и др.))

миниатюрный аудио-видеорекордер mAVR

Отправлено Romario 27 июля 2004 г. 22:52



процедура записи и чтения PIDH,PIDL (адреса записи 010,011 чтения 110,111)
код в ПЛИС

da: buffer(inout) std_logic_vector(7 DOWNTO 0);

process(mwr)
begin
if (rising_edge(mwr)) then
case adr_lo(2 downto 0) is
when "000" =>uartbrgh <= da(7 downto 2);
when "001" =>uartbrgl <= da(7 downto 2);
when "010" =>PIDH <= da;
when "011" =>PIDL <= da;
when others => null;
end case;
end if;
end process;

process(rd)
begin
if (falling_edge(rd)) then
case adr_lo(2 downto 0) is
when "000" =>da <= Rcnt( 7 downto 0);
when "001" =>da <= Rcnt(11 downto 8) & "0000";
when "010" =>da <= Lcnt( 7 downto 0);
when "011" =>da <= Lcnt(11 downto 8) & "0000";
when "100" =>da <= "0000" & c;
when "101" =>da <= ram_rd;
when "110" =>da <= PIDH;
when "111" =>da <= PIDL;
when others => null;
end case;
else
da<="ZZZZZZZZ";
end if;
end process;

код в МК
*(p + 2) = 0x03;
*(p + 3) = 0x8e;


x=*(p + 6); // x=6 вместо 0x03
y=*(p + 7); // x=7 виесто 0x8e


если же сделать так:


ENTITY readpid_ent IS
PORT (
mwr : in std_logic;
adr_lo : in Std_logic_vector(7 DOWNTO 0);
da_lath: in Std_logic_vector(7 DOWNTO 0);
uartbrgh: out Std_logic_vector(5 DOWNTO 0);
uartbrgl: out Std_logic_vector(5 DOWNTO 0);
PIDH: out Std_logic_vector(7 DOWNTO 0);
PIDL: out Std_logic_vector(7 DOWNTO 0)
);
END readpid_ent;

ARCHITECTURE readpid_rtl OF readpid_ent IS

BEGIN
process(mwr)
begin
if (rising_edge(mwr)) then
case adr_lo(2 downto 0) is
when "000" =>uartbrgh <= da_lath(7 downto 2);
when "001" =>uartbrgl <= da_lath(7 downto 2);
when "010" =>PIDH <= da_lath;
when "011" =>PIDL <= da_lath;
when others => null;
end case;
end if;
end process;
END readpid_rtl;

............................................................

pinst : component readpid PORT MAP(
mwr =>mwr,
adr_lo =>adr_lo,
da_lath =>da,
uartbrgh =>uartbrgh,
uartbrgl =>uartbrgl,
PIDH =>PIDH,
PIDL =>PIDL
);

process(clk,rd)
begin
if (rising_edge(clk) and rd = '0') then
case adr_lo(2 downto 0) is
when "000" =>da <= Rcnt( 7 downto 0);
when "001" =>da <= Rcnt(11 downto 8) & "0000";
when "010" =>da <= Lcnt( 7 downto 0);
when "011" =>da <= Lcnt(11 downto 8) & "0000";
when "100" =>da <= "0000" & c;
when "101" =>da <= ram_rd;
when "110" =>da <= PIDH;
when "111" =>da <= PIDL;
when others => null;
end case;
else
da<="ZZZZZZZZ";
end if;
end process;

то PIDH и PIDL считываются корректно.

в чем может быть проблема? почему первый пример глючит? видимо как то неправильно обрабатываю
двунаправленную шину da?


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru