Open LegalizeAdulthood opened 6 years ago
internally kvasir should be oring all the bitmasks of modified fields with the "has default value" bitmask and if that ends up as 0xFFFFFFFF then it should turn it into a blind write. I'll have a look and get back to you.
it might be that I hard coded it to look for 0xFFFFFFFF rather than the actual width of the register, I see this is a 16 bit register
Hrm. I see that the mask helper function I was using is generating 32-bit masks. I will adjust my field definitions and see if that gets me to a blind write.
Having gotten my basic GBA prototype working, I attempted to reproduce the first tonc demo and compared the assembly dump of my .o to the one produced by that first code example. Their code results in a blind write to the DISPCNT register, but my Kvasir code results in a read-modify-write to the register. At first I thought this was because I wasn't writing all fields of the register, but even when I did that, I got a read-modify-write implementation.
I thought kvasir would optimize writing to all bits in the register as a blind write?
Perhaps I am not defining my DISPCNT register correctly (see GBA.hpp), or I am doing something wrong in using my register definitions?
My first assumption is user error on my part :)
Is there a shortcut for saying "clear all bits/fields in the register except those explicitly given a value"?