Origen-SDK / o2

MIT License
4 stars 0 forks source link

Register mask/enable methods #81

Closed ginty closed 4 years ago

ginty commented 4 years ago

What should the polarity be for masking? I think I got this wrong for O1 and want to make sure that I get it right for O2...

Say we have a method called my_reg.read_mask() where the intention is to return a value where a 1 or 0 indicates whether a specific bit is enabled for read or not.

What should a 1 mean when returned from such a method?

Should we have methods named mask() and enable_mask() to return the opposite state? Is enable_mask() a contradiction? Are there better names for this?

Honestly, I have hardly ever used masks so I would appreciate guidance from those who have and who feel that they have an intuitive sense for how these things should work.

chrishume commented 4 years ago

On the design side, a mask value of 1 usually means let the but through for read/write.

On Wed, Feb 5, 2020, 5:18 AM Stephen McGinty notifications@github.com wrote:

What should the polarity be for masking? I think I got this wrong for O1 and want to make sure that I get it right for O2...

Say we have a method called my_reg.read_mask() where the intention is to return a value where a 1 or 0 indicates whether a specific bit is enabled for read or not.

What should a 1 mean when returned from such a method?

Should we have methods named mask() and enable_mask() to return the opposite state? Is enable_mask() a contradiction? Are there better names for this?

Honestly, I have hardly ever used masks so I would appreciate guidance from those who have and who feel that they have an intuitive sense for how these should work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Origen-SDK/o2/issues/81?email_source=notifications&email_token=ADJFOPDBNW7YG2TI3C7YKIDRBKOBLA5CNFSM4KQJJFFKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILFSSNQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJFOPAAWWHI624HJVXKZHTRBKOBLANCNFSM4KQJJFFA .

chrishume commented 4 years ago

Bit, not but. Phone autocorrected me.

On Wed, Feb 5, 2020, 5:18 AM Stephen McGinty notifications@github.com wrote:

What should the polarity be for masking? I think I got this wrong for O1 and want to make sure that I get it right for O2...

Say we have a method called my_reg.read_mask() where the intention is to return a value where a 1 or 0 indicates whether a specific bit is enabled for read or not.

What should a 1 mean when returned from such a method?

Should we have methods named mask() and enable_mask() to return the opposite state? Is enable_mask() a contradiction? Are there better names for this?

Honestly, I have hardly ever used masks so I would appreciate guidance from those who have and who feel that they have an intuitive sense for how these should work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Origen-SDK/o2/issues/81?email_source=notifications&email_token=ADJFOPDBNW7YG2TI3C7YKIDRBKOBLA5CNFSM4KQJJFFKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILFSSNQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJFOPAAWWHI624HJVXKZHTRBKOBLANCNFSM4KQJJFFA .

pderouen commented 4 years ago

I think of it the opposite way (set mask = 1 to enable masking, disable reading, block the operation). But, I can make sense of the other way as well.

Really what we're typically using the mask to do is enable or disable comparisons for the data contained in the bit. Would compare_enable or some other variation work?

ginty commented 4 years ago

Yeah, I think we should stay away from mask then as it can obviously mean different things to different people. enable is fine, or also flags, my_reg.read_flags(), my_reg.capture_flags(), etc.

chrishume commented 4 years ago

Agreed. Enable removes the ambiguity.

On Wed, Feb 5, 2020, 9:46 AM Stephen McGinty notifications@github.com wrote:

Yeah, I think we should stay away from mask then as it can obviously mean different things to different people. enable is fine, or also flags, my_reg.read_flags(), my_reg.capture_flags(), etc.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Origen-SDK/o2/issues/81?email_source=notifications&email_token=ADJFOPCDHGZG3AA7MP5QTJLRBLNNFA5CNFSM4KQJJFFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK343NQ#issuecomment-582471094, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJFOPD2BPOIEGANNNDCV6LRBLNNFANCNFSM4KQJJFFA .

ginty commented 4 years ago

Went with my_reg.read_enables(), capture_enables() and overlay_enables().