I received this error message when I compile my design:
Error (10430): VHDL Primary Unit Declaration error at ps_control_tb.vhd(13): primary unit "ps_control_tb" already exists in library "work". Compile the two primary units into different libraries or assign them unique names.
This file is a working vhdl testbench (attached file) used in Modelsim.
First why did I get this error and how to fix it . Somehow I noticed another partial copy got into my
Quartus "output " folder. How do I remove these properly
Second, why is Quartus calling my testbench during compilation/analysis/synthesis. I want it to call my top level design and not the testbench
Your Quartus project must be looking at this file as the top-level entity instead of the actual top-level. Two things to do:
1) Open your actual top-level design (guessing it's ps_control.vhd) and set it as the top-level entity using the option near the bottom of the Project menu in Quartus. Make sure you see the top-level entity name as ps_control in the project hierarchy in the Project Navigator.
2) Go to Project menu -> Add/remove files and remove the _tb file from your Quartus project file list.
I'm guessing you saved this _tb file in the Quartus project directory. Quartus will use any design files in this directory for compilation automatically so you don't have to add them manually to the project, so it might be best to put simulation-related files in a different directory.
The above post is absolutely correct, try at your end & let us know if you have any different concern.
You can also use the "Processing" Menu -> "Start" -> "Start Testbench Template Writer" option for testbench creation for the corresponding design.
I removed the testbench copy in my "output directory" and every is OK now.
There was two copy in my work and output directory. Quartus somehow place a copy in the output directory.
But before I did that, I performed a "Set as top-level entity" to my Top Design But the Quartus compiler still selected my testbench to compile.
Not sure why Quartus keep selecting the Testbench though. Any idea?
Anyway, after I deleted the testbench in the output dir, everything work. Thanks
Your project was probably still pointing to the file. That's why I suggested going to "Add/remove files" to make sure only the correct files would get compiled.