stall-sample.dml
unknown
text
a year ago
2.6 kB
20
Indexable
Never
/* the first device */ //---> here some signal interface is triggering actions, namely jtag operations via bitbang // this takes care of retry operations if a read was stalled // clock raise may call read // clock lower re-does the read if stalled on raise //---> here device 2 is connected to connect memory { interface memory_space { parameter required=true; } method read(uint32 Address, int Len) -> (uint32 data, exception_type_t exc) { local buffer_t buffer; local generic_transaction_t mop; exc=Sim_PE_IO_Not_Taken; if($memory_space) { $Regs.CSW.TrInProg=0; buffer.data = cast(&data,uint8*); buffer.len = Len; mop = SIM_make_mem_op_read(Address, buffer, false,$obj); exc=$memory_space.access(&mop); //---> goal is to see the exc==Sim_PE_Stall_Cpu that occured in second device if(exc==Sim_PE_Stall_Cpu) $CapturePending=true; else $CapturePending=false; } } /* the second device */ bank regs { register CSW @ 0x00; register TARH @ 0x04; register TARL @ 0x08; register DRW @ 0x0C { data bool read_pending; //---> get called from first device above via memory.read(...) method before_read(generic_transaction_t *mop) { local exception_type_t exc; local int size; local uint32 ret; size=$CSW[3:0]; call $memory.read($TARH<<32|$TARL,size,mop) -> (ret,exc); if(exc==Sim_PE_Stall_Cpu) { //---> what we need to do here so first device will see the stall ??? $read_pending=true; log info,1:"DRW before read returned exc==Sim_PE_Stall_Cpu"; } else { $this=ret; $read_pending=false; } } } } //---> here a memory link is connected to connect memory { interface memory_space { parameter required=true; } method read(uint32 Address, int Len) -> (uint32 data, exception_type_t exc) { local buffer_t buffer; local generic_transaction_t mop; exc=Sim_PE_IO_Not_Taken; $Regs.CSW.TrInProg=0; buffer.data = cast(&data,uint8*); buffer.len = Len; mop = SIM_make_mem_op_read(Address, buffer, false, $obj); //---> here we may get the exc==Sim_PE_Stall_Cpu from a memory link //we return that to the caller (register DRWs before_read method exc=$memory_space.access(&mop); } }