Yes, you could do that.

Gabe

Veydan Wu wrote:
> Hi, Gabe. Thank you for your reply. In my first implementation I put
> the handling function in the write() function which receives the data
> from the CPU, and wait for the handling to finish before returning the
> write() function. But It seems that it is not the right way in real
> hardware as the handling would take far more than 1 cycle thus the
> write() and thus the tick would be prolonged. That is not the true
> case in real hardware.
> As you said, I can implement an event to get scheduled in the write()
> function. Do you mean that I should put the event in the
> mainEventQueue and just return? then the event would be serviced in
> the cycle I designated? Thank you very much!
>
> 在 2010年3月13日 上午2:37,Gabe Black <[email protected]
> <mailto:[email protected]>>写道:
>
>     You could make your device actually process the data in the function
>     that receives it. If you want that to have latency or to process the
>     data gradually (although it sounds like you don't) you could use that
>     function to schedule an event or events for later. Conceptually
>     you'd be
>     implementing an interrupt (or event, or callback, or ...) driven
>     architecture instead of a polling architecture, but external to the
>     device it would look the same. On top of being easier to
>     implement, your
>     simulation should run faster.
>
>     Gabe
>
>     Veydan Wu wrote:
>     > I just want my I/O device to run in parallel with CPU. Does the CPUs
>     > run over and over? More specifically speaking, CPU may send
>     something
>     > to the I/O device to handle, but the time is not fixed. So it is
>     > better to let the device keep running and when it receive data ( by
>     > the write() function ), it can handle it. I do want the handling
>     > invoked within the write() function, I want it to act like a real
>     > hardware device. Is there any way I can do this? Thank you very
>     much!
>     >
>     > Weidan
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> m5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to