首页 > 解决方案 > 尝试运行实现时 Vivado 中出现“Opt_Design 错误”

问题描述

尝试制作一个UART发送器将数据从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,and done_reg/Q"

“[Vivado_Tcl 4-78] 在 DRC 期间发现错误。Opt_Design 未运行。”

这个错误的原因是什么?

标签: vhdluartxilinxvivado

解决方案


done在 first 和 second 中都进行了分配process,这正是实现所抱怨的,您不能有多个驱动程序。

done<='0';从第一个过程中删除,它应该完成实施。

(我没有检查其余代码是否完全符合您的要求。)


推荐阅读