Forum Discussion
Altera_Forum
Honored Contributor
18 years agoDon't forget that you can declare components in packages for better re-use. Essentially, a component is a useful abstraction between an instance and the underlying entity. The component declaration can define specific defaults for generics or input ports, omit generics and ports altogether to provide a simpler interface, etc. In most cases, the component binds to the entity of the same name but you can explicitly bind a component to another entity using a configuration. It's a pretty powerful feature of the language.
How low-level do you need to model your MUX? Altera devices don't have internal tri-states, so you probably don't want to implement a clever 2:1 MUX the way you might if you were designing an ASIC. If you can use behavior constructs, it's trivial
if(sel)
o <= a
else
o <= b;
end if;
If you need to model it at the structural level, then you just need to implement the boolean function a & sel | b & !sel in gates. :)