本帖最后由 SuperX-man 于 2010-11-26 11:21 编辑
最近帮别人调试一个工程,碰到一个PicroBlaze问题.
然后写了个简单的回环测试.
psm代码如下:
CONSTANT LCM_READ, 08
CONSTANT LCM_READOUT, 01
CONSTANT LCM_CONTROL, 02
CONSTANT LCM_DATAOUT, 04
NAMEREG SA,CONTROL
NAMEREG SB,LCM_DATA
;
start: LOAD CONTROL, 04
LOAD LCM_DATA,00
LOAD SF, 00
ENABLE INTERRUPT
;
DATAOUT: OUTPUT CONTROL, LCM_CONTROL
OUTPUT LCM_DATA, LCM_DATAOUT
OUTPUT SF,LCM_READOUT
INPUT SF, LCM_READ
ADD LCM_DATA,02
ADD CONTROL, 01
JUMP DATAOUT
;
VHDL中的连接如下:
IO_registers: process(clk)
begin
if clk'event and clk='1' then
-- lcm_control register at address 01
if port_id(0)='1' and write_strobe='1' then
lcm_read_test <= out_port;
end if;
-- lcm_control register at address 02
if port_id(1)='1' and write_strobe='1' then
lcm_control <= out_port;
end if;
-- lcm_data register at address 04
if port_id(2)='1' and write_strobe='1' then
lcm_data_out <= out_port;
end if;
-- read lcm_data
if port_id(3)='1' and read_strobe='1' then
in_port <= lcm_data_out;
end if;
end if;
end process IO_registers;
然后在仿真的时候,总会有一个XXX状态,并且回环读回的lcm_read_test总是比lcm_data_out慢两个循环,psm代码中没有延迟,应该最多慢一个阿.求解
|