Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help to understand simple error code VHDL

Status
Not open for further replies.

mrclrn

Newbie level 1
Joined
Oct 4, 2014
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
9
Hello guys,

I'm new with VHDL. I'm trying to understand what this error mean :

vhd(20): Cannot read output "s1".

There is my code:

---------------------------------------

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
 
 
entity b1 is
 
  PORT ( a, clk, reset_sync   :in STD_LOGIC;
         s1, s2               :out STD_LOGIC);
END b1;
 
architecture Behavior of b1 is
 
component dff
    Port ( D, clk, reset_sync   : in STD_LOGIC;
           Q        :out STD_LOGIC);
end component;
signal y1:std_Logic;
begin
 y1 <= s1;
 dffa : dff port map (a, clk, reset_sync, y1);
 dffb : dff port map (y1, clk, reset_sync, s2);
end Behavior;



-------------------------
the error is on line 20: y1 <= s1;


Thank you for your help!
 
Last edited by a moderator:

You have defined 's1' to be an output of the entity. Prior to VHDL-2008, outputs could not be read, which means they cannot be on the right hand side of an assignment, so 'y1 <= s1;' is illegal which is the error that is being reported. There are two pre-2008 solutions:
- Define s1 as 'buffer' instead of 'out' in the entity. Then it is legit to use s1 on both the left and the right hand side.
- Define an internal signal (say 's1_internal') and use that everywhere you want. Add an assignment 's1 <= s1_internal' to connect that new signal to the entity output.

Using VHDL-2008 rules, it is much simpler since they have removed that requirement so 'y1 <= s1;' is legal. In the Modelsim project window, right click and you should run across an option to compile it according to the 2008 standard. If you're trying to synthesize the design into an actual part, you will have to do the same thing in that tool to tell it which set of rules to follow. If your tool does not support 2008, then complain to the supplier and tell them you'll be taking your business elsewhere. There have been four major revisions of the language: 1987, 1993, 2002 and 2008.

Kevin Jennings
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top