[Libre-soc-bugs] [Bug 450] Create MMU from microwatt mmu.vhdl

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Aug 14 19:23:47 BST 2020


https://bugs.libre-soc.org/show_bug.cgi?id=450

--- Comment #49 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Cole Poirier from comment #48)
> (In reply to Luke Kenneth Casson Leighton from comment #47)
> > (In reply to Cole Poirier from comment #46)
> > 
> > > For example from what I'm struggling to translate in dcache.vhdl:
> > > ```
> > > # Number of ways
> > > NUM_WAYS     =  4
> > 
> > that's a parameter to the class (i'm assuming you've called it Dcache
> >    def __init__(self, NUM_WAYS=4)
> >       self.NUM_WAYS=4
> > 
> > > How should I translate `type cache_tags_set_t is array(way_t) of
> > > cache_tag_t;` into nmigen?
> > 
> > you don't.  manually substitute it.  it's a "type".
> > 
> > whenever you see "cache_tags_set_t", replace it with Array(....)
> 
> Sorry that's not that helpful, can you expand on this.

apologies, i assumed you'd know to expand "..." in the way that all typedefs (c
and other languages) work.

wherever you see a subtype, LITERALLY replace the subtype with its declaration.


subtype way_t is integer range 0 to NUM_WAYS-1;

subtype cache_tag_t is std_logic_vector(TAG_BITS-1 downto 0);

type cache_tags_set_t is array(way_t) of cache_tag_t;
type cache_tags_array_t is array(index_t) of cache_tags_set_t;


becomes



subtype cache_tag_t is std_logic_vector(TAG_BITS-1 downto 0);

type cache_tags_set_t is array(range 0 to NUM_WAYS-1;) of cache_tag_t;
type cache_tags_array_t is array(index_t) of cache_tags_set_t;



becomes


type cache_tags_set_t is array(range 0 to NUM_WAYS-1;) of
std_logic_vector(TAG_BITS-1 downto 0);

type cache_tags_array_t is array(index_t) of cache_tags_set_t;


becomes



type cache_tags_array_t is array(index_t) of 
array(range 0 to NUM_WAYS-1;) of std_logic_vector(TAG_BITS-1 downto 0);



and the substitution is now complete as far as you have given.

of course, it is itself also a type, therefore there will be an additional
substitution.

translating that to nmigen, will invve a 2D Array of Signals.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list