Adding multiple files to Modelsim using Quartus - modelsim

I have 2 modules and a testbench which i'm connecting the two modules together and experimenting with the outputs. Design passes analysis & synthesis in Quartus, then I'm trying to start RTL simulation from Tools > Run Simulating Tool > RTL Simulation. My top level entity file is "add_b.v" and it has only module add_b in it. In testbench, I'm instantiating another module called "add_v" which is written in "add_v.v". On modelsim, it can't find the corresponding file to "add_v".
Error: add_b_tb.v(10): Module 'add_v' is not defined.
Normally when I try to testbench only the top level entity without "add_v" (so there's add_b.v and add_b_tb.v), it works fine but when I add "add_v" to my testbench, modelsim cannot find the module.
Project Folder
This is my project folder. Quartus only load top level design "add_b.v" and testbench "add_b_tb.v" to modelsim but I don't know how can I also include "add_v.v" file since I can only use only one top level entity and one testbench at a time (as far as I know)
It also works fine when I add the "add_v" module to "add_b.v" so there's two modules (add_v and add_b) in the file. Simulation works but I just wonder if there's an easier way because if I had lot's of modules connected on a testbench, it's not a good practice loading all your modules in one verilog file.

just add `include "add_v.v" in the top of testbench file.

Related

Forward declaring a class in a UI file

I just wondered if there was a way to forward-declare a class in a Qt UI file. The issue that I have is that I use (the same version of) a same widget in two different projects : a project that uses the widget and an independant project that allows me to do testing with this widget while I'm working on its features.
Now, what happens is that when uic generates the ui_widget.h file, it adds this in it:
#include "widgets/custom_line_edit.h"
That's the include path for one of my promoted widgets. The thing is that the path to this file is not the same on the "real" project, as it should be
#include "modules/this_module/widgets/custom_line_edit.h"
I don't really know what to do not to have to edit my UI file each time to match my "current" project's file organization.
I've found this which was quite satisfying:
It is sometimes necessary to forward declare classes, particularly if code is being written in .ui.h files within Qt Designer. Each forward declaration is listed as it should appear in the generated C++ code.
<forwards>
<forward>class QStringList;</forward>
</forwards>```
But unfortunately this documentation is quite old (Qt 3.3) and the syntax seems not to work anymore - I get an Error 1.
What are my options here?
The issue isn't one of forward declarations. I've never seen that "forward" mechanism in a UI file, but even it still works somehow, all that it does is put "class QStringList;" (or whatever) in the include file that uic generates. If you look at those include files, they will have "new SomeWidget ()" statements, and you can't create an object without its full declaration, so a forward declaration for something the UI file creates isn't helpful.
The UI definition needs the include file where the widget is defined for exactly that reason. It has to include the class definition in the file generated from uic, and the relationship between where the files reside is going to have to be consistent.
What I would do to solve this is put the widget(s) in a library, and then reference the library from my main application and my test application. Then the uic generation happens within the library, not the applications, and within the library, the relative locations of the files will remain constant. The applications don't need access to the .ui file nor the generated include file, so how the application source files are laid out in folders won't matter.
I don't see any other way to do this.

How to rename the .mcs output file when synthesizing a design with Xilinx ISE

When I synthesize a design using Xilinx ISE, the output file is named untitled.mcs. I would like to configure the project to use an output filename more appropriate to the project I am synthesizing.
I have examined all the properties easily reachable by right clicking the the implementation panel in the tool, but I can't find a configuration option to change output file names. I have also searched the help, but couldn't find anything useful. Can anyone suggest where I need to configure the output filename or tell me where or what to search?
I am aware of at least two things I could be doing wrong and would appreciate comments. First, I am not using TCL to synthesize my project. I just right click in the implementation panel and choose run. Perhaps if I create a TCL script to I would have finer control or output file naming. Second, I can see several files named untitled.x where x is [cfi|mcs|prm|sig]. I guess these are a sequence of files processed from one format to another, and if I understood the process, I could configure the name of the first and see all the derived files change their names to follow.
The answer to my question is that you don't use ISE to configure output PROM file names, you do it in the iMPACT tool. When it is properly configured, ISE will run iMPACT to create the programming file.
If anyone needs the precise details on configuring iMPACT, the built in help has the details. See the section entitled "Creating Xilinx Flash/PROM Files". During the setup of the programming file, you get to choose the output file name.
One extra pointer from me: The help says you double click to open a wizard. For me that didn't work, but there is an icon (or tool bar button) to launch the PROM file formatter wizard when Create PROM File is highlighted in the iMPACT Flows panel.
When you have created an saved an iMPACT project file, you select it in ISE and ISE will create a PROM programming file at the last step of the synthesize process.

cmake: qt resources inside a module

i have this tree structure:
repository/modules/module1
repository/modules/module2
repository/modules/module..
repository/apps/application1
repository/apps/application2
repository/apps/application..
where the applications are using some modules.
now, I'd like to put some resources inside a module (like a very colorfull icons inside a widget used by several applications) but.. something gets wrong.
inside the module CMakeLists.txt if I use only:
set(${MODULE_NAME}_RCS
colors.qrc
)
...
qt4_add_resources (${MODULE_NAME}_RHEADERS ${${MODULE_NAME}_RCS})
no qrc_colors.cxx are created anywhere. so I've tried to add:
ADD_EXECUTABLE (${MODULE_NAME}
${${MODULE_NAME}_RHEADERS}
)
but.. I get this weird error:
CMake Error at repo/modules/ColorModule/CMakeLists.txt:51 (ADD_EXECUTABLE):
add_executable cannot create target "ColorModule" because another
target with the same name already exists. The existing target is a static
library created in source directory
"repo/modules/ColorModule". See documentation for
policy CMP0002 for more details.
(I've changed the path of the error of course)
so.. don't know what to think because i'm new both to cmake and qt..
what can i try?
EDIT:
if I add the ${MODULE_NAME}_RHEADERS and ${MODULE_NAME}_RCS in the add_library command the qrc_colors.cxx is created BUT it is in repository/modules/module1/built and not copied in the application built directory...
There is at least two errors in your code.
1) It is usually not necessary to use ${MODULE_NAME} everywhere like that, just "MODULE_NAME". You can see that the difference is the raw string vs. variable. It is usually recommended to avoid double variable value dereference if possible.
2) More importantly, you seem to be setting ${MODULE_NAME} in more than one executable place, which is "ColorModule" according to the error output. You should have individual executable names for different binaries.
Also, the resource file focus is a bit of red herring in here. There are several other issues with your project.
You can cmake files as CmakeLists.txt instead of CMakeLists.txt which inherently causes issues on case sensitive systes as my Linux box.
You use Findfoo.cmake, and find_package(foo) for that matter, rather than the usual FindFoo.cmake convention alongside find_package(Foo).
Your FindFoo.cmake is quite odd, and you should probably be rewritten.
Most importantly, you should use config files rather than find modules.
Documentation and examples can be found at these places:
http://www.cmake.org/Wiki/CMake/Tutorials#CMake_Packages
https://projects.kde.org/projects/kde/kdeexamples/repository/revisions/master/show/buildsystem
When you would like use a find module, you need to have that at hand already. That will tell you what to look for, where things are, or if they are not anywhere where necessary. It is not something that you should write. You should just reuse existing ones for those projects that are not using cmake, and hence the find modules are added separately.
It is a bit like putting the treasure map just next to the treasure. Do you understand the irony? :) Once you find the map, you would automatically have the treasure as well. i.e. you would not look for it anymore.

adding modules to my system

I'm designing an information system (in asp.net) in witch will be handling different modules once its done.
and i don't have enough time nor money to make all of the modules at once, so I've decided to do a few modules first and later on when i have time or money continue with the reset of them.
Now the question is: is there a generic way to call a module from a list for example:I would create a directory with modules where i'm planning to drop the .dll of the modules, so when i make a new one i will put the new .dll there. On the other hand, i want to build something like a skeleton where i will generically call all the modules in the directory I've made via code, without having to re write the code of the skeleton whenever new modules are dropped into the directory. finally I've planned that each module should have three layers one for db accessing another one for logic and a the last one for interface drawing so each module should be independent of each other.
is it possible? how should i do this I've been looking but cant find anything yet.
is there a better way you suggest?
You would definitely need to create common interfaces that modules implement and common data contracts. If you need to load dlls dynamically - it is possible but you would need to use reflection. Look here:
http://dranaxum.wordpress.com/2008/02/25/dynamic-load-net-dll-files-creating-a-plug-in-system-c/

Eclipse is telling me a cycle was detected in the building path, but that's not true!

Eclipse is telling me:
a cycle was detected in the build path of -project name-
, although the structure of the project (created by others in the team) does not have cycles.
The same project is deployed on other machines (the same!) and it doesn't give the error.
I need to work from my machine so I need to solve this.
It is giving me the error in 8 different projects.
It was giving me the error in more (10 projects) but with cleaning and building 10 times just changed to 8! (without any changes in the code).
I really need to get this working and cleaning and building over and over is not doing anything. Any tips?
(note: this is not java, this is flex so i can't change the error to warning :))
Thanks a lot!
If it works on other machines but not your own, it must be a "local cache" effect.
You must have an existing library taken into account from a long time, which causes locally the error, while that same file is not present on the other workstations.
Could try and recreate the projects from scratch, on a new empty directory, and see if the problem persist?
If it does (and only then), the exact version of Eclipse and Flex plugin could help.
Try creating a new workspace then import the projects into that.
The problem most often arises after migrating your code. You have always been working on one project at a time, and all the time one of the projects was in a compiled state, so the builder didn’t complain. There is no law of nature that says that code shouldn’t be mutually dependent (it happens within projects all the time), but many builders, also in Eclipse, have problems with this chicken-egg problem and start complaining if both project’s are not compiled: “cycle detected in buildpath”.
Often you’ll get the advise to adjust the severity level of circular dependencies to give only warnings (in Eclipse: Window > Preferences > Java > Compiler > Building > Build path Problems > Circular dependencies), but that’s no real solution.
Make a component-diagram of your projects and their dependencies (I advise to use BOUML, freeware UML-editor, or Rational Rose), and imagine the builder working from right to left starting with nothing. If necessary, make a new project on the right and remove circularities between projects by moving definitions/interfaces that more projects should know of in there. (You could call this a leaf-project, needing nothing else, but the result is not necessarily a tree, it’s a net that you can traverse right to left).
Sorry for reposting. I saw that the text of my earlier answer was scrambled.
The problem most often arises after migrating your code. You have always been working on one project at a time, and all the time the other projects were in a compiled state, so the builder didn't complain. There is no law of nature that says that code shouldn't be mutually dependent (it happens within projects all the time), but many builders, also in Eclipse, have problems with this chicken-egg problem and start complaining if both projects are not compiled: "cycle detected in buildpath". Often you'll get the advise to adjust the severity level of circular dependencies to give only warnings (in Eclipse: Window > Preferences > Java > Compiler > Building > Build path Problems > Circular dependencies), but that's no real solution.Make a component-diagram of your projects and their dependencies (I advise to use BOUML, freeware UML-editor, or Rational Rose), and imagine the builder working from right to left starting with nothing. If necessary, make a new project on the right and remove circularities between projects by moving definitions/interfaces that more projects should know of in there. (You could call this a leaf-project, needing nothing else, but the result is not necessarily a tree, it's a net that you can traverse right to left).

Resources