how to access the same RAM module from different modules?
An Arbiter is the general way of doing it.

An Arbiter is esentially a block that is connected to your RAM and reads/writes data from/to the RAM.

The arbiter exports interfaces (can be an arbitrary count) to other modules. Through these interfaces modules can access the RAM via the arbiter. The arbiter internally handles the request from its input. There are several ways of handling requests:


The different modules have different priorities.
The requests are processed in a round-robin-loop
etc.


The specific implementation highly depends on the interface used. The inferface from the arbiter to the RAM is given by the RAM module you use. However these interface standards are mostly not usable for the input ports of an arbiter as they are not able to handle variable timings. If a module wants to write to the RAM but another is given access at the moment the arbiter has to stall the interface until it can process the request.

On Altera systems the AvalonMM bus is a common way and compatible with many Altera IP cores. But you could also go with Wishbone or a custom bus.

I don't have a complete example because it highly depends on your requirements. However, a simple arbiter is a nice project for learning. 



Another quick way to connect two modules to a RAM is generating a dual port RAM with the Altera Wizard. This RAM has 2 independly usable RAM ports.