Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

assigning pins location to a component pin

Hi

this is a little complicated but I'll try to be clear:

in order to get a clearer VHDL code, I want to reduce the number of ports in the top level entity.

so I wanted to assign pins location to pins directly in the components, instead of connecting them to ports in the top level entity.

so in the .qsf file I have something like:

set_location_assignment PIN_A1 -to "my_srffe:b2v_inst1|Q"

when I look in the floor plan I can see that the pin is assigned to the IO.

but in the compilation report I get a warning that the assignment have been ignored because the node does not exist in the design.

when I program the device it seems that the pin is not assigned.

I tried using the keep attribute in the component architecture, but it didn't help.

any ideas?

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Dave

    I'll take you up on your offer :), please see this simple top level entity:

    --- Quote Start ---

    package tcl_test is

    type HW is (dff_board, srff_board);

    end tcl_test;

    LIBRARY ieee;

    USE ieee.std_logic_1164.all;

    LIBRARY work;

    USE work.tcl_test.all;

    ENTITY simple IS

    GENERIC (board: HW);

    PORT

    (

    --for dff board

    D : IN STD_LOGIC_VECTOR(1 DOWNTO 0);

    CLK : IN STD_LOGIC;

    ENA : IN STD_LOGIC;

    Q : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);

    -- for srff board

    S : IN STD_LOGIC;

    CLK2 : IN STD_LOGIC;

    R : IN STD_LOGIC;

    Q3 : OUT STD_LOGIC

    );

    END simple;

    ARCHITECTURE bdf_type OF simple IS

    -- for dff board

    COMPONENT my_dffe

    GENERIC

    (

    BUS_WIDTH : INTEGER

    );

    PORT

    (

    D : IN STD_LOGIC_VECTOR(BUS_WIDTH - 1 DOWNTO 0);

    CLK : IN STD_LOGIC;

    ENA : IN STD_LOGIC:= '1';

    Q : OUT STD_LOGIC_VECTOR(BUS_WIDTH - 1 DOWNTO 0)

    );

    END COMPONENT;

    -- for srff board

    COMPONENT my_srffe

    PORT(S : IN STD_LOGIC;

    CLK : IN STD_LOGIC;

    R : IN STD_LOGIC;

    Q : OUT STD_LOGIC

    );

    END COMPONENT;

    BEGIN

    tagDFF: IF (board= dff_board) GENERATE

    b2v_inst : my_dffe

    GENERIC MAP

    (

    BUS_WIDTH => 2

    )

    PORT MAP(D => D,

    CLK => CLK,

    ENA => ENA,

    Q => Q);

    END GENERATE;

    tagDFF: IF (board= srff_board) GENERATE

    b2v_inst1 : my_srffe

    PORT MAP(S => S,

    CLK => CLK2,

    R => R);

    Q => Q3);

    END GENERATE;

    END bdf_type;

    --- Quote End ---

    as you can see in this simple project there are 2 kinds of board: one for DFF and the other for SRFF. the board type is defined by an external tcl script.

    please show me how to write tcl that declares only the pins (and components) related to the current hardware.

    thanks in advance

    Ron

    P.S

    i'll try to get a hold on one of Brent Welch's books so I can study more on my own
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Ron,

    --- Quote Start ---

    I'll take you up on your offer :), please see this simple top level entity:

    --- Quote End ---

    Sure, I'll write some Tcl code.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Ron,

    Your example is a little too simple, in that it does not really show what we were discussing (its more like two completely separate designs). I was under the impression you had a design with a lot of common components, and then a few interfaces that needed to be different between boards.

    I've attached some Tcl code (rename the file from _tcl.txt to .tcl). Source this in Quartus and it will generate two top-level entities. Not particularly exciting, but the Tcl constructs show you how to use loops over lists, printing into buffers, and then writing out to files.

    The architecture bodies could be similarly generated.

    You'll want to put the components you are using into a VHDL package file, that way you can just add "library mylib; use mylib.mypackage.all;", and the Tcl generator architecture section can just print out the VHDL you would normally write.

    This may be enough for you to get started. If its not, send a project that actually has real components, synthesis constraints for two separate boards, etc.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Dave

    thanks for the code, it's looks like tcl is much more powerful than I thought. I'll go over it. I also downloaded Brent Welch book draft from his personal site. It's not updated, but it's free :-P , and I believe it will be enough for me. (I work in a small company and we don't excatly have a library here)

    you impression about my design was correct, but my boss wouldn't appreciate if I published source code on the web... I think my very simple code and your elaborate tcl will be enough to get me going.

    just a technical question: how do I make Quartus run this script each time I switch revision \ run compilation? do I have to excute it manually from the tcl console, or can I call it from the qsf file?

    thanks in advance
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    you impression about my design was correct, but my boss wouldn't appreciate if I published source code on the web... I think my very simple code and your elaborate tcl will be enough to get me going.

    --- Quote End ---

    That is what I figured.

    If you want to discuss your code off-list, just email me (via the email address that is my forum name).

    Cheers,

    Dave