assigning output to input

Discussion in 'VHDL' started by Simone Winkler, Aug 28, 2003.

  1. Hello!

    I tried to do a RS-flip-flop with nor-gates in VHDL. But i got the following
    error message:

    Parameter notq of mode out can not be associated with a f
    ormal parameter of mode in.


    the vhdl code was:

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;

    entity rs is
    Port ( S : in std_logic;
    R : in std_logic;
    Q : out std_logic;
    notQ : out std_logic);
    end rs;

    architecture Behavioral of rs is

    begin
    Q <= S nor notQ;
    notQ <= R nor Q;
    end Behavioral;


    ....it was just to try the functionality of vhdl......
    what can i do to solve this problem?

    thanx...
     
    Simone Winkler, Aug 28, 2003
    #1
    1. Advertisements

  2. Sounds like you may have two problems.

    First, your code is trying to use the value of an "out" port,
    which is illegal in VHDL. You must create an internal signal, use
    that internal signal for all the useful work, and then copy it
    to the out port(s).

    Second, the error message: it sounds as if your testbench for
    this module is connecting to the ports inappropriately - or
    perhaps it's just a confusing error message.
    You don't need arithmetic packages for this code.
    Get rid of them.
    OK so far.
    architecture Corrected of rs is
    signal Q_int: std_logic;
    signal Qbar_int: std_logic;
    begin
    Q_int <= S nor Qbar_int; -- this is OK
    Qbar_int <= R nor Q_int;
    -- now get the signals out to the ports:
    Q <= Q_int;
    notQ <= Qbar_int;
    end Corrected;
    OK, but be aware that combinational feedback is always a bad
    idea for synthesisable logic.
    --

    Jonathan Bromley, Consultant

    DOULOS - Developing Design Know-how
    VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

    Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
    Tel: +44 (0)1425 471223 mail:
    Fax: +44 (0)1425 471573 Web: http://www.doulos.com

    The contents of this message may contain personal views which
    are not the views of Doulos Ltd., unless specifically stated.
     
    Jonathan Bromley, Aug 28, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.