Разные способы зачитать из ячейки памяти адреса устройства и ригистра.
This commit is contained in:
parent
072de08545
commit
dfe22a8ab2
@ -65,7 +65,27 @@ signal lineBusy : std_logic := '1';
|
|||||||
signal start : std_logic := '0';
|
signal start : std_logic := '0';
|
||||||
signal startPrev : std_logic := '0';
|
signal startPrev : std_logic := '0';
|
||||||
|
|
||||||
begin
|
signal currentMemoryCell : integer range 0 to ARRAY_LENGTH - 1 := 0;
|
||||||
|
|
||||||
|
begin
|
||||||
|
|
||||||
|
memoryAddress(0) <= x"30";
|
||||||
|
memoryAddress(1) <= x"30";
|
||||||
|
memoryAddress(2) <= x"31";
|
||||||
|
memoryAddress(3) <= x"31";
|
||||||
|
memoryAddress(4) <= x"32";
|
||||||
|
memoryAddress(5) <= x"32";
|
||||||
|
memoryAddress(6) <= x"33";
|
||||||
|
memoryAddress(7) <= x"33";
|
||||||
|
memoryAddress(8) <= x"34";
|
||||||
|
memoryAddress(9) <= x"34";
|
||||||
|
memoryAddress(10) <= x"35";
|
||||||
|
memoryAddress(11) <= x"35";
|
||||||
|
memoryAddress(12) <= x"36";
|
||||||
|
memoryAddress(13) <= x"36";
|
||||||
|
memoryAddress(14) <= x"37";
|
||||||
|
memoryAddress(15) <= x"37";
|
||||||
|
|
||||||
|
|
||||||
process (we, oe, ce)
|
process (we, oe, ce)
|
||||||
variable addr : integer range 0 to 2**ADDRESS_BUS_WIDTH - 1 := 0;
|
variable addr : integer range 0 to 2**ADDRESS_BUS_WIDTH - 1 := 0;
|
||||||
@ -115,8 +135,8 @@ begin
|
|||||||
fasBuf(15 downto 8) <= data;
|
fasBuf(15 downto 8) <= data;
|
||||||
when PB_FILL_ADDRESS_SPACE_LOWER =>
|
when PB_FILL_ADDRESS_SPACE_LOWER =>
|
||||||
fasBuf(7 downto 0) <= data;
|
fasBuf(7 downto 0) <= data;
|
||||||
position := conv_integer(data);
|
--position := conv_integer(data);
|
||||||
memoryAddress(position) <= fasBuf(15 downto 8);
|
--memoryAddress(position) <= fasBuf(15 downto 8);
|
||||||
when others =>
|
when others =>
|
||||||
data <= (others => 'Z'); -- Запретить запись на шину
|
data <= (others => 'Z'); -- Запретить запись на шину
|
||||||
end case;
|
end case;
|
||||||
@ -125,7 +145,9 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
elsif (addr >= conv_integer(firstFreeBuf) and addr <= conv_integer(firstFreeBuf) + conv_integer(cmdBuf(7 downto 0))) then
|
elsif (addr >= conv_integer(firstFreeBuf) and addr <= conv_integer(firstFreeBuf) + conv_integer(cmdBuf(7 downto 0))) then
|
||||||
if (oe = '0') then -- Если сигнал чтения активен
|
if (oe = '0') then -- Если сигнал чтения активен
|
||||||
data <= memoryData(addr - conv_integer(firstFreeBuf));
|
-- data <= memoryData(addr - conv_integer(firstFreeBuf));
|
||||||
|
data <= memoryAddress(addr - conv_integer(firstFreeBuf)); -- для проверки обратного считывания адреса устройства и адреса регистра.
|
||||||
|
currentMemoryCell <= addr - conv_integer(firstFreeBuf);
|
||||||
else
|
else
|
||||||
data <= (others => 'Z'); -- Запретить запись на шину
|
data <= (others => 'Z'); -- Запретить запись на шину
|
||||||
end if;
|
end if;
|
||||||
@ -218,13 +240,25 @@ begin
|
|||||||
when ReceiveCheck =>
|
when ReceiveCheck =>
|
||||||
if pback = '0' then
|
if pback = '0' then
|
||||||
if pbdata = not dataTemp then
|
if pbdata = not dataTemp then
|
||||||
memoryData(position) <= dataTemp(15 downto 8);
|
-- if currentMemoryCell rem 2 = 0 and currentMemoryCell = position then
|
||||||
memoryData(position + 1) <= dataTemp(7 downto 0);
|
-- if currentMemoryCell /= position then
|
||||||
controlBuf <= memoryAddress(position);
|
-- memoryData(position) <= dataTemp(15 downto 8);
|
||||||
|
-- memoryData(position + 1) <= dataTemp(7 downto 0);
|
||||||
|
-- controlBuf <= memoryAddress(position);
|
||||||
|
-- if position + 1 < conv_integer(cmdBuf(7 downto 0)) then
|
||||||
|
-- position := position + 2;
|
||||||
|
-- else
|
||||||
|
-- position := 0;
|
||||||
|
-- circleCounter := circleCounter + 1;
|
||||||
|
-- end if;
|
||||||
|
-- end if;
|
||||||
CommunicationState <= Timeout;
|
CommunicationState <= Timeout;
|
||||||
count := 0;
|
count := 0;
|
||||||
pbce <= '1';
|
pbce <= '1';
|
||||||
countValue := 5;
|
countValue := 5;
|
||||||
|
memoryData(position) <= dataTemp(15 downto 8);
|
||||||
|
memoryData(position + 1) <= dataTemp(7 downto 0);
|
||||||
|
controlBuf <= memoryAddress(position);
|
||||||
if position + 1 < conv_integer(cmdBuf(7 downto 0)) then
|
if position + 1 < conv_integer(cmdBuf(7 downto 0)) then
|
||||||
position := position + 2;
|
position := position + 2;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user