Beispiel #1
0
 def _display_uvm_entry(self, inst, index, o):
     name = full_token(inst.group, inst.inst, self._reg.token,
                       self._regset_name, index, inst.format)
     o.write("   * - ``%s``\n" % self.text(name))
     name = uvm_name(inst.group, self._reg.token, inst.inst, index,
                     inst.format)
     o.write("     - ``%s``\n" % self.text(name))
Beispiel #2
0
    def _addr_entry(self, o, inst, use_uvm, use_id, addr_maps,
                    grp_inst, group_index, index):

        if inst.grpt == 1:
            u_grp_name = inst.group
            t_grp_name = inst.group
        else:
            u_grp_name = "{0}[{1}]".format(inst.group, grp_inst)
            t_grp_name = "{0}{1}".format(inst.group, grp_inst)

        o.write("   *")
        if use_uvm:
            name = uvm_name(u_grp_name, self._reg.token, inst.inst, group_index)
            if index < 0:
                o.write(" - %s\n" % name)
            else:
                o.write(" - %s[%d]\n" % (name, index))
        if use_id:
            name = full_token(t_grp_name, self._reg.token,
                                  inst.inst, group_index, inst.format)
            if use_uvm:
                o.write("    ")
            o.write(" - %s\n" % name)
        for map_name in addr_maps:
            map_base = self._prj.get_address_base(map_name.name)
            offset = map_base + inst.offset + inst.base + (
                grp_inst * inst.grpt_offset)
            if group_index > 0:
                offset += group_index * inst.roffset

            if index < 0:
                o.write("     - ``%s``\n" % reg_addr(self._reg, offset))
            else:
                o.write("     - ``%s``\n" % reg_addr(self._reg, offset
                                                 + (index * (self._reg.width/8))))
Beispiel #3
0
    def _write_defines(self, o):

        addr_maps = self._prj.get_address_maps()
        if not addr_maps:
            return

        o.write("\n\nAddresses\n---------\n")
        if not in_groups(self._regset_name, self._prj):
            o.write(".. WARNING::\n   Register set was not added to any groups\n\n")
        else:
            o.write(".. list-table::\n")
            o.write("   :header-rows: 1\n")
            o.write("   :class: summary\n\n")
            o.write("   * - ID\n")
            o.write("     - Offset\n")
            for amap in addr_maps:
                o.write("     - %s\n" % self.text(amap.name))
            for inst in in_groups(self._regset_name, self._prj):
                if inst.repeat == 1:
                    name = full_token(inst.group, inst.inst, self._reg.token,
                                      self._regset_name, -1, inst.format)
                    o.write("   * - ``%s``\n" % self.text(name))
                    o.write("     - ``%s``\n" % reg_addr(self._reg, 0))
                    for map_name in addr_maps:
                        map_base = self._prj.get_address_base(map_name.name)
                        offset = map_base + inst.offset + inst.base
                        o.write("     - ``%s``\n" % reg_addr(self._reg, offset))
                else:
                    for i in range(0, inst.repeat):
                        name = full_token(inst.group, inst.inst, self._reg.token,
                                          self._regset_name, i, inst.format)
                        o.write("   * - ``%s``\n" % self.text(name))
                        o.write("     - ``%s``\n" % reg_addr(self._reg, 0))
                        for map_name in addr_maps:
                            base = self._prj.get_address_base(map_name.name)
                            offset = inst.base + inst.offset + (i * inst.roffset)
                            o.write("     - ``%s``\n" % reg_addr(self._reg,
                                                                 offset + base))
        o.write("\n\n")
Beispiel #4
0
    def _write_defines(self, o, use_uvm=True, use_id=True):

        x_addr_maps = self._prj.get_address_maps()
        instances = in_groups(self._regset_name, self._prj)
        addr_maps = set([])

        for inst in instances:
            for x in x_addr_maps:
                groups_in_addr_map = self._prj.get_address_map_groups(x.name)
                if inst.group in groups_in_addr_map:
                    addr_maps.add(x)

        if not addr_maps:
            return

        o.write("\n\nAddresses\n+++++++++++++++++++++++\n\n")
        if not in_groups(self._regset_name, self._prj):
            o.write(
                ".. WARNING::\n   Register set was not added to any groups\n\n")
        else:
            o.write(".. list-table::\n")
            o.write("   :header-rows: 1\n")
            if len(addr_maps) == 1:
                o.write("   :widths: 50, 50\n")
            elif len(addr_maps) == 2:
                o.write("   :widths: 50, 25, 25\n")
            elif len(addr_maps) == 3:
                o.write("   :widths: 50, 16, 16, 17\n")
            o.write("   :class: summary\n\n")
            o.write("   *")
            if use_uvm:
                o.write(" - Register Name\n")
            if use_id:
                if use_uvm:
                    o.write("    ")
                o.write(" - ID\n")
            for amap in addr_maps:
                o.write("     - %s\n" % self.text(amap.name))
            for inst in in_groups(self._regset_name, self._prj):
                if self._group and inst.group != self._group:
                    continue
                if self._inst and inst.inst != self._inst:
                    continue

                for grp_inst in range(0, inst.grpt):
                    if inst.grpt == 1:
                        u_grp_name = inst.group
                        t_grp_name = inst.group
                    else:
                        u_grp_name = "{0}[{1}]".format(inst.group, grp_inst)
                        t_grp_name = "{0}{1}".format(inst.group, grp_inst)

                    if inst.repeat == 1 and not inst.array:
                        o.write("   *")
                        if use_uvm:
                            name = uvm_name(u_grp_name, self._reg.token,
                                            inst.inst, -1)
                            o.write(" - %s\n" % self.text(name))
                        if use_id:
                            name = full_token(t_grp_name, self._reg.token,
                                              inst.inst, -1, inst.format)
                            if use_uvm:
                                o.write("    ")
                            o.write(" - %s\n" % self.text(name))
                        for map_name in addr_maps:
                            map_base = self._prj.get_address_base(map_name.name)
                            offset = map_base + inst.offset + inst.base + (
                                grp_inst * inst.grpt_offset)
                            o.write("     - %s\n" % reg_addr(self._reg, offset))
                    else:
                        for i in range(0, inst.repeat):
                            o.write("   *")
                            if use_uvm:
                                name = uvm_name(u_grp_name, self._reg.token,
                                                inst.inst, i)
                                o.write(" - %s\n" % self.text(name))
                            if use_id:
                                name = full_token(t_grp_name, self._reg.token,
                                                  inst.inst, i, inst.format)
                                if use_uvm:
                                    o.write("    ")
                                o.write(" - %s\n" % self.text(name))
                            for map_name in addr_maps:
                                base = self._prj.get_address_base(map_name.name)
                                offset = inst.base + inst.offset + (
                                    i * inst.roffset
                                ) + (grp_inst * inst.grpt_offset)
                                o.write("     - %s\n" %
                                        reg_addr(self._reg, offset + base))

        o.write("\n\n")
Beispiel #5
0
 def _display_uvm_entry(self, inst, index, o):
     name = full_token(inst.group, self._reg.token, self._regset_name,
                       index, inst.format)
     o.write("   * - %s\n" % name)
     name = uvm_name(inst.group, self._reg.token, inst.inst, index)
     o.write("     - %s\n" % name)