csim implementation