Reputation: 175
I've looked at all the previous questions and no one seems to have a problem as simple as mine. Also I've searched the web and can't find a solution.
I'm new to VHDL and am trying to compile the simple example provided by Altera, which is as follows:
library ieee;
use ieee.std_logic_1164.all;
entity light is
port(x1, x2: in std_logic;
f: out std_logic);
end light;
architecture LogicFunction of light is
begin
f <= (x1 and not x2) or (not x1 and x2);
end LogicFunction;
I followed the project creation steps in the Altera tutorial, but when I try to compile the project I get the error:
Error (12007): Top-level design entity "alt_ex_1" is undefined
Upvotes: 10
Views: 121563
Reputation: 1
The name of the .vhd file should be the same as the name of top-level entity, solution is simple - just replace light with alt_ex_1
Upvotes: 0
Reputation: 5767
Error (12007): Top-level design entity "alt_ex_1" is undefined
The error message is far from trivial to make sense of, but in a roundabout
way it does tell what is wrong.
You are (probably) using alt_ex_1.vhd
as the name of your design file.
In Altera Quartus, the file name must be the same as the name of the
(top level) entity
declared in the VHDL design code.
What you need to do is to change the file name from alt_ex_1.vhd
to
light.vhd
.
To keep it simple, create a new project named light
instead of alt_ex_1
.
Reproducing the error is straightforward. Here is what I did. 1
After starting the Quartus Prime Lite Edition click File
>
New Project Wizard...
.
If you see an Introduction, click Next >
. Choose a working directory.
As name of the project enter alt_ex_1
.
Click Next >
twice and then Finish
.
Create a design file: File
> New...
.
Under Design Files
, choose VHDL File
, then OK.
Next File
> Save As...
. Type or paste alt_ex_1.vhd
and click
Save
.
Paste the code:
library ieee;
use ieee.std_logic_1164.all;
entity light is
port(x1, x2: in std_logic;
f: out std_logic);
end light;
architecture LogicFunction of light is
begin
f <= (x1 and not x2) or (not x1 and x2);
end LogicFunction;
and save the file again.
Compile with Processing
> Start
> Start Analysis & Synthesis
- or press
Ctrl + K.
The Message window displays the error:
12007 Top-level design entity "alt_ex_1" is undefined
To get rid of the annoying error, delete all the files that were created in
the working directory, and then start all over.
Follow the instructions as above, but this time make sure to replace every
occurrence of alt_ex_1
with light
.
In the Message window expect to see something like:
Quartus Analysis & Synthesis was successful. 0 errors, 1 warning
as one of the last lines.
1 Using Altera / Intel Quartus Lite 18.1 on Windows 10, but the version is likely not important.
Upvotes: 1
Reputation: 400
Just put the pointer over the file name in the project navigator panel and click with right button and then push on (set as top-level entity). Done.
Upvotes: 2
Reputation: 2431
My problem was about verilog code compiler. But when I search for problem, I always saw this question. So I decided to add my solution too to guide others. It took me much time to find solution. here is what I had done to solve the problem.Just follow these steps (Quartus II 14.0.0) ; Assignments
-> Settings
-> Top-Level Entity
->Select your module
Upvotes: 20
Reputation: 5751
In chapter Starting a New Project
, you were asked to call your project light
. It seems to me that you didn't follow that step correctly and name your project alt_ex_1
. That's why you're getting 12007 error, since the compiler has no idea what is the top-level entity in you design.
To solve that problem you can:
Assignments -> Device -> General
.Project Navigator
(Files -> Set as top-level entity
).Btw 1, 2, 3, ... - all about the same problem.
Upvotes: 13