simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] [PATCH] use static callbacks instead of template pa


From: panic
Subject: Re: [Simulavr-devel] [PATCH] use static callbacks instead of template param for IOReg
Date: Sun, 02 Jul 2017 12:59:00 +0000

Hi Klaus,

Klaus:
> @panic: Thanks for your reply!
> 
> I did a look in the source and... ups. ;)

Have you looked at my first patch that uses static mamber methods and
macros? If so, then it ws the wrong patch you looked at. They were
already rejected a while ago for valid reasons.
I sent a new patch that makes use of C++11 std::bind and std::function
(see my email to the list from 2017-06-19 13:24).
Current GCC (as on Debian stable) uses C++14 by default, so te feature
comes for free. If you're on an older system (with some ancient C++ as
default), you can test it with "make CXXFLAGS='std=c++11'".

The patch does not fix the actual problem (bit accessible registers)
yet, but removes CRTP with std::function in order to later add a set_bit
method to IOReg.

> Up to the point that we simply forward bit access to RWMemoryMember is
> quite easy. But after that I looked in the code where the hw registers
> are implemented and I am also can not understand what is written there :-)
> 
> I assumed that we simple have specialized overloads to RWMemory members,
> but there access to registers is implemented with catching the address
> of a function to the getter and setter. This makes me wonder! My
> assumption was that we simple have a virtual function to overload and
> that we use CRTP for this. But I did not found CRTP but some strange
> P::get_the_getter stuff :-)

Of course it is possible to add bitwise setters/getters to
RWMemoryMember, but I don't like that because it looks
"dirty"/conceptually wrong to me. SRAM should not be bitaccessible.

> Sounds like a "bit" rework needed. OK, not the problem. For the first
> step, it should be easy to extend the get_the_getter things to add a
> get_the_bit_getter and set_a_bit_getter ( you can understand my
> stumbling? ) :-)
> 
> I started a branch for me, which I published just now. Look at git for
> this. Maybe the work is bullshit and we simply drop the branch... Take
> it as a first of my ideas... ;)

I'd have some comments on you branch but let's discuss the broader
things first (see above): I don't really see the need for CRTP here and
think that std::function is much clearer.

> What I scary about is that C++ have virtual methods or overloads and
> CRTP in place. Why "we" use some manual get_the_getter is something I do
> not understand...  I will look for that topic but please give me some
> time for that.
> 
> Feel free to kick me from time to time if you do not hear any good or
> bad news :-)

Sure :)
It's not urgent for me, I have my own working "fork" with the fixes.
Only I was impatient because there was no reply at all to my emails for
some time.


Cheers,
panic



reply via email to

[Prev in Thread] Current Thread [Next in Thread]