The below code gives me an error hat i cant read from out object Q
Im sure newer version of VHDL supports it, how do i enable in Vivado does anyone know?
Before i used GHDL compiler with a flag option --use ieee=08
Or something similar to this
library IEEE;
use IEEE.Std_logic_1164.all;
--Non-gated SR latch, general configuration 2NORS
--Only works when using the new VHDL version
--Declare SR_Latch entity
entity SRLatch is
port(
clk: in std_logic;
set : in std_logic:='0';
reset : in std_logic:= '0';
Q : out std_logic:='0';
Q_n : out std_logic:='1'
);
end SRLatch;
architecture behavioural of SRLatch is
begin
process(clk) begin
Q <= reset NOR Q_n;
Q_n <= set NOR Q;
end process;
end behavioural;
```
Best Answer
It never worked as far as I know. Not just in Vivado. Q is an output. You cannot read an output as you attempted with NOR. You can only write to it.
You could use inout, but this is dangerous. But best practice is to manipulate an internal signal and write that to Q.
But I believe you can set VHDL-2008 somewhere in the menu settings. Don't know about a syntactical way to do it though.
EDIT: It seems to be hiding in plain sight. It is set per source file in the "Source File Properties" window which is probably already open and just sitting in your regular layout in Vivado.
Also from the Vivado manual starting page 203:
https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_4/ug901-vivado-synthesis.pdf