Inferring RAM is to be preferred, and simple templates ought to work.
But for specialised purposes, a more complex template may work with one
vendor but not another; this isn't any better than instantiating RAM
blocks directly.
Nope, inferring rams is still better. Instantiated rams cannot store
anything but std_logic[_vector]. Inferred rams can store integers,
booleans, enumerated types, arrays, records, and virtually any other
data type that can be synthesized. I've never encountered a situation
that required two different pieces of code to infer the same resource
in two different tools/architectures. It was always a case of dumbing
down the code so that the dumbest tool could handle it, and then the
smarter tools took it just fine. Aggravating as heck, but it worked.
That said, I have had to instantiate resources that could not be
inferred optimally in one architecture or another, like data bus width
translation HW built into some xilinx rams.
I like to create and use a generic entity as a wrapper for the RAM,
whose architecture instantiates the device-specific block. Then you can
write an alternative architecture to do the same for another vendor, or
a (possibly non-synthesisable) generic description of the same block for
simulation.
If the entity and architecture are in separate files, you should only
need to recompile the architecture when changing vendors; the rest of
the design only sees the wrapper entity, so hopefully no recompilation
is necessary.
However I keep entity and architecture together in the same file.
IMO this is one case where instantiating the RAM as a component in my
design is preferable to direct entity instantiation; I can select Brand
X or Brand A components from different libraries via configuration
statements, without recompiling the design.
This is a good step, except I've gotten to the point where I'll use an
if-generate driven by a generic to instantiate the appropriate entity/
architecture, and pass the generic down from the top level, where it
can be overridden by the tool. Configurations and components have
their place, but it is getting smaller and smaller in my book.
Andy