--- Quote Start ---
The problem is that one way or another, this toplevel is going to be generated automatically.
--- Quote End ---
Think of it slightly differently.
When you design a PCB and layout an FPGA, the pin functions of the FPGA are then fixed. You can create a single top-level design that represents all designs that will ever be used on the board. The pin names in this top-level design are then fixed and never change, so it makes creating .SDC constraints files a lot easier, since you only need to create them once and the pin names remain the same.
Your "designs" are then one layer below this top-level, and yes, you have to manually connect them to the top-level pins on the FPGA. There really is no automated way to do this, since a tool cannot guess how you want the signals connected.
--- Quote Start ---
it would become a self written program that would read all the inputs and outputs from the components and than decide how these things are going to be connected.
--- Quote End ---
There's really no way that this can work the way you think. Lets say I have some I/O blocks, some memory, an SPI controller, and an I2C controller IP blocks. How can a program decide how these should be connected? You have to tell it, right? That is the purpose of SOPC Builder and Qsys. That tool produces a top-level component that describes the I/O of that one component. That component might be the top-level, or it might be one of many components in a design.
Bottom line, you'll have to manually connect wires from your components to the top-level design that represents your FPGA pins.
--- Quote Start ---
In some way it seems like an impossible thing to do, since it needs to be really general. Thats why I hoped there would be some kind of tool to do such a thing.
So that I dont have to write 20 different toplevels, for all the different designs I want to make(designs that might only differ one component for example).
I'm not sure if you could ''speak'' to qsys via TCL?
I try my best to make it less general, but it isn't as easy as i thought.
--- Quote End ---
If the top-level design that represents the FPGA is the same, and the pins on the Qsys component remain the same, then you can simply regenerate the Qsys instance. However, if your Qsys system has different pins, then those pins need to go somewhere, and you need to route them.
If it was easier to control the pin names on the Qsys system, then you could map the top-level Qsys pins to the FPGA pins, however, your constraints file would have the top-level pin names change ...
Take a look at the design files in this tutorial;
http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial In this design, one Qsys file is used for multiple boards. I know, you probably want something slightly different, but take a look and get ideas.
If you get stuck, ask questions, or describe your design(s) in more detail. Perhaps all you really need is some generate statements.
Cheers,
Dave