atmega 8 to generate pwm

how to program atmega 8 to generate pwm with a frequency 100khz by subtracting ramp and Vref and compare them to drive mosfet of dc-dc converter , where Vref is input for the atmega and the ramp is internally generated

any help

Did you read the datasheet ? With all the pwm modes and registers ? You can have a look at http://www.avrfreaks.net/ If you log in, you can see the projects, type the word 'pwm' without clicking anything, and you see on the right the projects.