When you edit the TARGETS in Makefile, you should consider enabling the compiler optimization for your bot, by adding "FLAGS_[yourbot] = -O3" (it's O not 0 !!)
Define your produce (named as "word_produce" if you like) as an unsigned int, assign a word to it by shifting the char "produce" with different offsets, then concatenating them by a bit-wise OR
Your farmer will be stunned for 1,000,000 cycles.
The stalling time will be accumulated.
There is a mips_core_data structure, which contains an array R, storing the content in registers.
It stores the memory contents from the location you fetch.
No, the cache will fetch an entire block (256 bytes). It will start to fetch the block containing the address into the cache.
No, there is a chance you will get caught/killed only if the opponent is checking its taunt array and accusing farmers.
Use the rdctag function to read a cache tag. Check titfortat.c for an example of the proper usage
The cache is write-allocate: If you want to write to an address, it must be in the cache first (and therefore you suffer a cache miss if it wasn't in there already). The cache is write-through: Once a line is in the cache, any writes to it immediately appear in memory (and therefore immediately increase your score). Finally, the cache automatically updates from memory: In particular, if you have the taunt array in cache, and a new bot enters exploit mode, the taunt array in cache updates immediately.
It's possible to prefetch too early, such that the line you prefetch arrives in the cache while you're still working on a different line. In this case, you'll doubly penalize yourself, as you'll suffer a miss for the line you're currently accessing, and then miss on the line you meant to prefetch in the first place. Oops! Don't do that. If you prefetch slightly late, you only lose the difference. If address 0x01000000 is not in the cache, but you prefetch it, wait 50 cycles, then try to write to/read from it, you'll still miss but only stall 50 cycles instead of the usual 100, since 50 of the cycles were alerady taken up by the prefetch. This is why prefetching is beneficial. If you run the simulator in "very verbose mode" via simulate -vvvv, you'll see messages like "upgrades existing prefetch", and this is the meaning of that message. On the other hand, if address 0x01000400 is in the cache, you prefetch 0x01000200, then try to read/write 0x01000000, the prefetch is canceled, You miss 0x01000000, and stall the full 100 cycles, no matter how far along the prefetch was.