1
votes

When I compile my project in Quartus (15.0 Webedition) I get following error message:

10430 VHDL Primary Unit Declaration error at nios.vhd: primary unit "NIOS" already exists in library "nios"

In my project files I have the file "NIOS.vhd". After compiling, Quartus generates another file in the db-folder with the name "nios.vhd". This files is not the same as my file "NIOS.vhd" and therefore I get this error message. What is not clear at this point, why Quartus generates another file in the database? How can I get rid of this problem?

1
Is it a problem of case-sensitive filenames? - user_1818839
Did you name nios one of your own design units? If yes, don't. As Quartus does the same you end up with two design units with the same name in the same library which is not supported by the language. - Renaud Pacalet

1 Answers

0
votes

See QuartusII Help - VHDL Primary Unit Declaration error at <location>: primary unit "<name>" already exists in library "<name>" (ID: 10430)

CAUSE: In a primary unit declaration at the specified location in a VHDL Design File (.vhd), you declared the specified primary unit. However, the specified library already contains a primary unit with the same name.

See IEEE Std 1076-2008 13.1 Design units, para 2:

primary_unit ::= entity_declaration
    | configuration_declaration
    | package_declaration
    | package_instantiation_declaration
    | context_declaration
    | PSL_Verification_Unit

para 5:

The name of a primary unit is given by the first identifier after the initial reserved word of that unit. Of the secondary units, only architecture bodies are named; the name of an architecture body is given by the identifier following the reserved word architecture. Each primary unit in a given library shall have a simple name that is unique within the given library, and each architecture body associated with a given entity declaration shall have a simple name that is unique within the set of names of the architecture bodies associated with that entity declaration.

1.3 Structure and terminology of this standard, 1.3.1 General, para 4:

In this document, the word shall is used to indicate a mandatory requirement. The word should is used to indicate a recommendation. The word may is used to indicate a permissible action. The word can is used for statements of possibility and capability.

1.3.3 Semantic description, para 2:

The following terms are used in these semantic descriptions with the following meanings:

erroneous: The condition described represents an ill-formed description; however, implementations are not required to detect and report this condition. Conditions are deemed erroneous only when it is impossible in general to detect the condition during the processing of the language.

error: The condition described represents an ill-formed description; implementations are required to detect the condition and report an error to the user of the tool.

The 'shall have' is mandatory in VHDL, where a violation is an ill-formed description and is reported as an error.

It's complaining your declaration of nios doesn't match an existing declaration already in the library. (If they matched the existing declaration would be replaced):

13.1 Design units, para 1:

Certain constructs are independently analyzed and inserted into a design library; these constructs are called design units. One or more design units in sequence comprise a design file.

13.5 Order of analysis, para 5:

A given library unit is potentially affected by a change in any library unit whose name is referenced within the given library unit. A secondary unit is potentially affected by a change in its corresponding primary unit. If a library unit is changed (e.g., by reanalysis of the corresponding design unit), then all library units that are potentially affected by such a change become obsolete and shall be reanalyzed before they can be used again.

So if re-analyzed a primary unit of the same entity class (13.1, primary_unit) you'd replace the primary unit. Try with a different entity class of primary unit and you'll get an error.

Back to QuartusII Help:

ACTION: Compile the two primary units into different libraries or assign them unique names.

You state your working directory contains your analyzed design files and a file named nios.vhd that's a distinct name from your design file NIOS.vhd.

The issue isn't file name, it's primary unit name. In this case it's a primary unit name Altera feels free to use indiscriminately in the process of synthesis. Thankfully it's a primary unit of a different entity class. You'd be left with circular analysis dependencies (from 13.5) that'd be harder to fathom.

You should change your primary unit name, and because it's common to tie primary unit name to file name (while a design file can contain any number of design units), you might also change your design file name.