mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 05:08:56 +00:00
Add support for packed multidimensional arrays
* Generalization of dimensions metadata (also simplifies $size et al.) * Parsing and elaboration of multidimensional packed ranges
This commit is contained in:
parent
ac0fb2e301
commit
39fea32c6e
7 changed files with 247 additions and 267 deletions
|
@ -202,9 +202,17 @@ namespace AST
|
|||
// set for IDs typed to an enumeration, not used
|
||||
bool is_enum;
|
||||
|
||||
// if this is a multirange memory then this vector contains offset and length of each dimension
|
||||
std::vector<int> multirange_dimensions;
|
||||
std::vector<bool> multirange_swapped; // true if range is swapped
|
||||
// Declared range for array dimension.
|
||||
struct dimension_t {
|
||||
int range_right; // lsb in [msb:lsb]
|
||||
int range_width; // msb - lsb + 1
|
||||
bool range_swapped; // if the declared msb < lsb, msb and lsb above are swapped
|
||||
};
|
||||
// Packed and unpacked dimensions for arrays.
|
||||
// Unpacked dimensions go first, to follow the order of indexing.
|
||||
std::vector<dimension_t> dimensions;
|
||||
// Number of unpacked dimensions.
|
||||
int unpacked_dimensions;
|
||||
|
||||
// this is set by simplify and used during RTLIL generation
|
||||
AstNode *id2ast;
|
||||
|
@ -371,6 +379,10 @@ namespace AST
|
|||
// localized fixups after modifying children/attributes of a particular node
|
||||
void fixup_hierarchy_flags(bool force_descend = false);
|
||||
|
||||
// helpers for indexing
|
||||
AstNode *make_index_range(AstNode *node, bool unpacked_range = false);
|
||||
AstNode *get_struct_member() const;
|
||||
|
||||
// helper to print errors from simplify/genrtlil code
|
||||
[[noreturn]] void input_error(const char *format, ...) const YS_ATTRIBUTE(format(printf, 2, 3));
|
||||
};
|
||||
|
@ -416,10 +428,6 @@ namespace AST
|
|||
// Helper for setting the src attribute.
|
||||
void set_src_attr(RTLIL::AttrObject *obj, const AstNode *ast);
|
||||
|
||||
// struct helper exposed from simplify for genrtlil
|
||||
AstNode *make_struct_member_range(AstNode *node, AstNode *member_node);
|
||||
AstNode *get_struct_member(const AstNode *node);
|
||||
|
||||
// generate standard $paramod... derived module name; parameters should be
|
||||
// in the order they are declared in the instantiated module
|
||||
std::string derived_module_name(std::string stripped_name, const std::vector<std::pair<RTLIL::IdString, RTLIL::Const>> ¶meters);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue