Skip to content

Component names clash with imported names in HDL #1439

Description

@paddytheplaster

Hi again,

When I compile the following with Clash 1.3.0 the generated VHDL causes a VHDL compilation error.

rotate_right
    :: forall n . (KnownNat n, 1 <= n)
    => Bool
    -- ^ Client request
    -> BitVector n
    -- ^ Object of shift operation
    -> BitVector n
    -- ^ Result.
rotate_right bv
    = leToPlus @1 @n (rotate_right' bv)
{-# NOINLINE rotate_right #-}

rotate_right'
    :: forall n . (KnownNat n)
    => Bool
    -- ^ Client request
    -> BitVector (n+1)
    -- ^ Object of shift in operation
    -> BitVector (n+1)
    -- ^ Result.
rotate_right' bool bv
    | bool      = pack b ++# (fst $ split# bv)
    | otherwise = bv
    where b = lsb bv
{-# NOINLINE rotate_right' #-}

The compilation error is as follows:

Error (10621): VHDL Use Clause error at rotate_right_0.vhdl(20): more than one Use Clause imports a declaration of simple name "rotate_right" -- none of the declarations are directly visible File: /home/paddy/Altera/Clash/vhdl/TopEntity/circuit/rotate_right_0.vhdl Line: 20
Error (10784): HDL error at numeric_std_vhdl1993.vhd(584): see declaration for object "ROTATE_RIGHT" File: /opt/altera/quartus/libraries/vhdl/ieee/1993/numeric_std_vhdl1993.vhd Line: 584
Error (10609): VHDL error at numeric_std_vhdl1993.vhd(595): another match for "rotate_right" File: /opt/altera/quartus/libraries/vhdl/ieee/1993/numeric_std_vhdl1993.vhd Line: 595
Error (10609): VHDL error at rotate_right.vhdl(10): another match for "rotate_right" File: /home/paddy/Altera/Clash/vhdl/TopEntity/circuit/rotate_right.vhdl Line: 10
Error (10476): VHDL error at rotate_right_0.vhdl(20): type of identifier "ROTATE_RIGHT" does not agree with its usage as "entity" type File: /home/paddy/Altera/Clash/vhdl/TopEntity/circuit/rotate_right_0.vhdl Line: 20
Error (10467): VHDL Component Configuration or Component Instantiation Statement error at rotate_right_0.vhdl(20): component "ROTATE_RIGHT" is used but not declared File: /home/paddy/Altera/Clash/vhdl/TopEntity/circuit/rotate_right_0.vhdl Line: 20
Error: Quartus Prime Analysis & Synthesis was unsuccessful. 6 errors, 0 warnings
    Error: Peak virtual memory: 955 megabytes
    Error: Processing ended: Fri Jul 10 10:18:03 2020
    Error: Elapsed time: 00:00:11
    Error: Total CPU time (on all processors): 00:00:23

The following is the relevant generated VHDL. The second line of the third block is Line 20.

entity rotate_right_0 is
  port(eta2    : in boolean;
       \c$arg\ : in std_logic_vector(31 downto 0);
       result  : out std_logic_vector(31 downto 0));
end;

architecture structural of rotate_right_0 is

begin
  rotate_right_result : entity rotate_right
    port map
      ( result => result
      , bool   => eta2
      , bv     => \c$arg\ );
end;

Regards,

Paddy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions