Dealing with Inout Ports - design and testbench writing

My design requires me to multiplex one single databus that takes care of reading and writing, into two separate buses for reading and writing each. 

For this, I've included an in-out port, then tried to multiplex it into two different ports depending on control signals. 

This doesn't seem to work perfectly in the simulations, though I couldnt spot any mistakes in my code.

Also, I am facing trouble with writing a testbench for a design with inout ports. How to assign values and also read from the same port in testbench?