【发布时间】:2019-08-01 19:03:45
【问题描述】:
尝试制作一个UART Transmitter将数据从FPGA发送到PC; 9600 波特率,8 位,无奇偶校验,1 个开始和停止位;我用 VHDL 编写了一个代码,运行综合并以我喜欢的方式对其进行仿真。我想在 BASYS 3 FPGA 上看到它,在创建约束后,运行实现发出一个错误,称为“Opt_Design 错误”。
library ieee;
use ieee.std_logic_1164.all;
entity rs232_omo is
generic(clk_max:integer:=10400); --for baudrate
port(
clk : in std_logic;
rst : in std_logic;
start : in std_logic;
input : in std_logic_vector(7 downto 0);
done : out std_logic;
output : out std_logic;
showstates: out std_logic_vector(3 downto 0)
);
end entity;
architecture dataflow of rs232_omo is
type states is (idle_state,start_state,send_state,stop_state);
signal present_state,next_state : states;
signal data,data_next : std_logic;
begin
process(clk,rst)
variable count : integer range 0 to clk_max;
variable index : integer range 0 to 10;
begin
if rst='1' then
present_state<=idle_state;
count:=0;
data<='1';
done<='0';
elsif rising_edge(clk) then
present_state<=next_state;
count:=count+1;
index:=index+1;
data<=data_next;
end if;
end process;
process(present_state,data,clk,rst,start)
variable count : integer range 0 to clk_max;
variable index : integer range 0 to 10;
begin
done<='0';
data_next<='1';
case present_state is
when idle_state =>
showstates<="1000";
data_next<='1';
if start='1' and rst='0' then
count:=count+1;
if count=clk_max then
next_state<=start_state;
count:=0;
end if;
end if;
when start_state =>
showstates<="0100";
data_next<='0';
count:=count+1;
if count=clk_max then
next_state<=send_state;
count:=0;
end if;
when send_state =>
showstates<="0010";
count:=count+1;
data_next<=input(index);
if count=clk_max then
if index=7 then
index:=0;
next_state<=stop_state;
else
index:=index+1;
end if;
count:=0;
end if;
when stop_state =>
showstates<="0001";
count:=count+1;
if count=clk_max then
next_state<=idle_state;
done<='1';
count:=0;
end if;
end case;
end process;
output<=data;
end architecture;
这是详细的错误信息
"[DRC MDRV-1]Multiple Driver Nets:Net done_OBUF有多个驱动: done_OBUF_inst_i_1/O,和 done_reg/Q"
“[Vivado_Tcl 4-78] 在 DRC 期间发现错误。Opt_Design 未运行。”
这个错误的原因是什么?
【问题讨论】:
-
std_logic(例如输出端口完成)是一种已解析的数据类型,一个或多个驱动程序经过解析以确定该值。多个驱动程序与 Xilinx FPGA 架构不兼容,并且已检查(DRC 错误)。解决方案是仅从一个进程驱动完成,每个分配给信号的进程都有该信号的驱动程序。