에서 net "sda"에 대한 여러 상수 드라이버를 해결할 수 없습니다. 자체 I2C 통신을 만들기 위해 노력 중이며 곱셈 드라이버에 문제가 있습니다. 그 (것)들을 이해하지 말라 나는 다만 그들을 보지 않는다 (나는 아직도 VHDL에 신선하다), 그래서 다만 나의 부호를보고 mi에게 왜 그런 과오가 있는지 말하십시오.오류 (10028) : I2C_com.vhd (185)
나는 버스에서 여러 개의 신호 드라이버를 사용하기 위해 플래그를 조작하려고하지만 올바르지 않은 것이 있습니다. 여러 드라이버는 scl, sda, start_clk 및 stop_clk에 있습니다. 이러한 플래그는 예를 들어 두 개의 서로 다른 프로세스에 있기 때문입니까?
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity I2C_com is
port (
reset_en: in std_logic;
clk: in std_logic;
sda: inout std_logic;
scl: out std_logic;
RD:in std_logic;
WR: in std_logic;
addr: buffer std_logic_vector(7 downto 0)
);
end I2C_com;
architecture MAIN of I2C_com is
signal data :std_logic_vector (12 downto 0):="0000000000010";
signal i2c_clk: std_logic ;
signal clk_count : unsigned(19 downto 0):="00000000000000000100";
type program_state is (start,init,error_rd_wr,slave,ack);
signal state: program_state;
signal write_data: std_logic_vector (7 downto 0):=(others => '0');
signal read_data: std_logic_vector (7 downto 0):=(others => '0');
signal clk_enable: std_logic;
signal reset: std_logic:='1';
signal start_clk: std_logic:= 'Z';
signal stop_clk: std_logic:= 'Z';
signal strech: std_logic := '0';
signal cnt_addr: integer := 0;
signal ack_error: std_logic;
signal sda_data: std_logic;
signal start_data: std_logic:= 'Z';
begin
i2c_clock: process(clk,reset_en,reset)
begin
if reset_en = '1' or reset = '1' then
elsif falling_edge(clk) then
if clk_count < unsigned(data) then
clk_count <= clk_count + 1;
clk_enable <= '1';
else
clk_count <= x"00000";
clk_enable <= '0';
end if;
i2c_clk <= clk_enable;
if start_clk = '1' then
sda <= '0';
scl <= '0';
start_clk <= '0';
end if;
if stop_clk = '1' then
sda <= '0';
scl <= '0';
stop_clk <= '0';
end if;
end if;
end process i2c_clock;
--
process(i2c_clk,reset_en,reset)
begin
if reset_en = '1' or reset = '1' then
reset <= '0';
cnt_addr <= 0;
state <= init;
elsif rising_edge(i2c_clk) then
case state is
when init =>
if RD = '1' or WR = '1' then
state <= start;
else
state <= error_rd_wr;
end if;
when start =>
start_clk <= '1';
state <= slave;
when slave =>
start_data <= '1';
if cnt_addr < 8 then
sda_data <= addr(cnt_addr);
cnt_addr <= cnt_addr + 1;
else
cnt_addr <= 0;
state <= ack;
end if;
when error_rd_wr =>
reset <= '1';
when ack =>
start_data <= '0';
ack_error <= sda;
if ack_error = '1' then
stop_clk <= '1';
reset <= '1';
else
end if;
if RD = '1' then
elsif WR = '1' then
else
stop_clk <= '1';
reset <= '1';
end if;
end case;
end if;
end process;
sda <= sda_data when start_data = '1' else 'Z';
scl <= i2c_clk when start_clk = '0' and stop_clk = '0' else 'Z';
end MAIN;
참고 : 밀접하게 HTTP 관련 :
하나의 가능성
scl
및sda
처럼 쓸 수 합성 툴은 종종 트라이 상태 출력을 선호하기 때문에 단지 연속 할당에서이 드라이브하는 것입니다 // 유래 .com/questions/20908103/vhdl-multiple-constant-drivers, http://stackoverflow.com/questions/21061596/error-10028-cant-resolve-multiple-constant-drivers-for-net-vhdl-error, http : //stackoverflow.com/questions/12529551/constant-drivers-for-net-vhdl-shiftreg, http://stackoverflow.com/questions/5073519/syntax-error-in-vhdl 및 기타 여러 가지가 있습니다. – fru1tbat코드를 읽을 수있는 형식으로 들여 쓰거나 들여 쓰기하십시오 ... – mbschenkel