By using a newly developed simulation program "PEGASUS", plasma behavior was analyzed for the plasma immersion ion implantation and deposition (PIII&D). For plasma analysis of low pressure gas which is used in PIII&D, the software uses a particle in cell (PIC) method for the analysis of electric and magnetic fields and the motion of charged particles. A Monte Carlo collision method is used for collisions of ions, electrons and neutrals in the plasma, and the dynamic-SASAMAL code is used for the ion-solid surface interactions. Spatial distributions of potential, electron density and ion density together with the ion flux distribution on the target surface were calculated for the case where a negative pulse voltage was applied to a trench shaped target immersed in a high density Ar plasma (1010 cm-3). The time evolution of sheath length obtained by the simulations for a flat plane part of the surface agreed with the analytical result obtained by the Child-Langmuir method. In a bipolar pulse PIII&D system, a positive and a negative pulse voltages are applied alternately to a workpiece without any other external plasma source. Simulation has been conducted for a target immersed in a very low density Ar plasma (107 cm-3) to compare the plasma generated by a negative and a positive pulse voltage applied to the target. When a negative pulse voltage is applied to the target, only a weak plasma is generated. In contrast to it, when a positive pulse voltage is applied, a two-order or more high density plasma is generated under the same condition. The plasma behavior around a trench shaped target is also presented.