Re: Examples of using classes?

Jeremy Herbert <[email protected]>
Newsgroups gmane.comp.python.myhdl
Message-ID <CAHYNNe0-+9eJFJ6zadbNcXb5uFx8YcF9DVZrRAgmwtTGaHi1Aw@mail.gmail.com>
Thanks, I'll take a look!
On Wed, 29 Jul 2015 at 10:18 am Christopher Felton <[email protected]>
wrote:

> On 7/28/15 5:50 PM, Jeremy Herbert wrote:
> > Hi Chris,
> >
> > I was thinking of using inheritance in defining interfaces using classes
> > like so:
> >
> > class FIFO(object):
> > ...
> >
> > class AXIFIFO(FIFO):
> > ...
> >
> > class WishboneFIFO(FIFO):
> > ...
> >
> > Or even mixins:
> >
> > class FIFO(object):
> > ...
> >
> > class AXI4SSlaveMixin(object):
> > ...
> >
> > class AXI4SMasterMixin(object):
> > ...
> >
> > class AXIFIFO(FIFO, AXI4SSlaveMixin, AXI4SMasterMixin):
> > ...
> >
> > Does this make sense? I'd basically like to be able to drop the
> > AXI4SSlaveMixin and replace it with WishboneSlaveMixin and have it "just
> > work".
>
> Yes, defining interfaces like this is great and you
> can attach transactors, adapters, etc.
>
> My approached would be to define the interfaces and
> still use a function (myhdl module/component):
>
>      def fifo(stream_in, stream_o):
>          inst_adapter_i = stream_i.adapter() # bus specific to generic
>          inst_adapter_o = stream_o.adapter() # ""
>
>          # add logic ....
>          @always_seq(stream_i.clock.posedge, ...)
>          def rtl_in():
>              if stream_i.valid:
>
>
>      stream_in = AXI4()  # instantiate the specifi bus
>      stream_out = AXI4() # instantiate the specific bus
>      inst_fifo = fifo(stream_in, stream_out)
>
> This is kinda like what I did here:
> https://github.com/cfelton/minnesota/tree/master/mn/system
>
> Regards,
> Chris
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> myhdl-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/myhdl-list
>

------------------------------------------------------------------------------

_______________________________________________
myhdl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/myhdl-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.