SIMULATION to test code and circuit

I need to determine if some circuits will work how I want. Is there an actual simulator that runs the code with the circuit? If so I have not seen any link.
Thanks,
Tim