From 489beadf61d05f40dd4ac40e4e5290502f7ad078 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 9 Aug 2025 17:35:26 +0300 Subject: format --- include/gran/bfly/fat_bfly.h | 3 ++- include/gran/common.h | 4 ++-- include/gran/component.h | 6 ++++-- include/gran/ideal_noc.h | 3 ++- include/gran/mesh/node3d.h | 12 ++++++++---- include/gran/packet.h | 9 +++++++-- include/gran/torus3d/node.h | 29 ++++++++++++++++------------- 7 files changed, 41 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/gran/bfly/fat_bfly.h b/include/gran/bfly/fat_bfly.h index c3025aa..aa1647e 100644 --- a/include/gran/bfly/fat_bfly.h +++ b/include/gran/bfly/fat_bfly.h @@ -4,7 +4,8 @@ #include struct component *create_fat_bfly(uint32_t elems); -stat fat_bfly_connect(struct component *bfly, struct component *component, uint32_t elem); +stat fat_bfly_connect(struct component *bfly, struct component *component, + uint32_t elem); static inline void addr_fat_bfly(uint64_t addr, uint32_t *elem, uint32_t *off) { diff --git a/include/gran/common.h b/include/gran/common.h index 43814cd..0844e7a 100644 --- a/include/gran/common.h +++ b/include/gran/common.h @@ -55,7 +55,7 @@ stat copy_reg(struct reg *r, struct reg *s); * should be moved to \p out. If there are multiple available registers, oldest * one is selected. NULL entries in \p in are tolerated. */ void propagate(struct reg *out, - size_t count, struct reg *in[static count], - bool (*sel)(struct reg *r, void *data), void *data); + size_t count, struct reg *in[static count], + bool (*sel)(struct reg *r, void *data), void *data); #endif /* GRAN_COMMON_H */ diff --git a/include/gran/component.h b/include/gran/component.h index 4b728a4..3bcf121 100644 --- a/include/gran/component.h +++ b/include/gran/component.h @@ -15,7 +15,8 @@ struct component; -typedef stat (*receive_callback)(struct component *to, struct component *from, struct packet pkt); +typedef stat (*receive_callback)(struct component *to, struct component *from, + struct packet pkt); typedef stat (*clock_callback)(struct component *); typedef stat (*stat_callback)(struct component *, FILE *); typedef stat (*dts_callback)(struct component *, FILE *); @@ -34,7 +35,8 @@ struct component { destroy_callback destroy; }; -static inline stat send(struct component *from, struct component *to, struct packet pkt) +static inline stat send(struct component *from, struct component *to, + struct packet pkt) { assert(to && from); if (!to->receive) { diff --git a/include/gran/ideal_noc.h b/include/gran/ideal_noc.h index 638454a..d08bd34 100644 --- a/include/gran/ideal_noc.h +++ b/include/gran/ideal_noc.h @@ -18,7 +18,8 @@ #include struct component *create_ideal_noc(uint32_t elems, size_t latency); -stat ideal_noc_connect(struct component *noc, struct component *component, uint32_t elem); +stat ideal_noc_connect(struct component *noc, struct component *component, + uint32_t elem); static inline void addr_ideal_noc(uint64_t addr, uint32_t *elem, uint32_t *off) { diff --git a/include/gran/mesh/node3d.h b/include/gran/mesh/node3d.h index 5b1a2fd..dde7ea9 100644 --- a/include/gran/mesh/node3d.h +++ b/include/gran/mesh/node3d.h @@ -4,9 +4,11 @@ #include #include -struct component *create_mesh_node3d(uint8_t x, uint8_t y, uint8_t z, uint8_t elem); +struct component *create_mesh_node3d(uint8_t x, uint8_t y, uint8_t z, + uint8_t elem); -stat mesh_node3d_connect(struct component *c, struct component *e, uint8_t elem); +stat mesh_node3d_connect(struct component *c, struct component *e, + uint8_t elem); stat mesh_node3d_connect_north(struct component *c, struct component *e); stat mesh_node3d_connect_south(struct component *c, struct component *e); stat mesh_node3d_connect_east(struct component *c, struct component *e); @@ -14,7 +16,8 @@ stat mesh_node3d_connect_west(struct component *c, struct component *e); stat mesh_node3d_connect_down(struct component *c, struct component *e); stat mesh_node3d_connect_up(struct component *c, struct component *e); -static inline uint64_t mesh3d_addr(uint8_t x, uint8_t y, uint8_t z, uint8_t elem, +static inline uint64_t mesh3d_addr(uint8_t x, uint8_t y, uint8_t z, + uint8_t elem, uint32_t off) { return off @@ -25,7 +28,8 @@ static inline uint64_t mesh3d_addr(uint8_t x, uint8_t y, uint8_t z, uint8_t elem ; } -static inline void addr_mesh3d(uint64_t addr, uint8_t *x, uint8_t *y, uint8_t *z, uint8_t *elem, uint32_t *off) +static inline void addr_mesh3d(uint64_t addr, uint8_t *x, uint8_t *y, + uint8_t *z, uint8_t *elem, uint32_t *off) { if (off) *off = addr & 0xffffffff; if (elem) *elem = (addr >> 32) & 0xff; diff --git a/include/gran/packet.h b/include/gran/packet.h index 85ff961..2315358 100644 --- a/include/gran/packet.h +++ b/include/gran/packet.h @@ -59,7 +59,10 @@ static inline uint64_t packet_align(uint64_t addr) static inline uint64_t packet_mask(uint64_t addr, uint64_t size) { assert(size <= 64); - uint64_t mask = size == 64 ? ((uint64_t)-1) : (((uint64_t)1 << size) - 1); + uint64_t mask = size == 64 + ? ((uint64_t)-1) + : (((uint64_t)1 << size) - 1); + uint64_t aligned = packet_align(addr); uint64_t diff = addr - aligned; @@ -179,7 +182,9 @@ static inline uint64_t packet_convu64(struct packet *pkt) return res; } -static inline struct packet create_packet(uint64_t from, uint64_t to, uint64_t size, void *data, enum packet_flags flags) +static inline struct packet create_packet(uint64_t from, uint64_t to, + uint64_t size, void *data, + enum packet_flags flags) { assert(size <= 64); assert(packet_align(from) == from); diff --git a/include/gran/torus3d/node.h b/include/gran/torus3d/node.h index bd02a1f..1240bb4 100644 --- a/include/gran/torus3d/node.h +++ b/include/gran/torus3d/node.h @@ -7,15 +7,16 @@ struct component *create_torus3d_node(uint8_t x, uint8_t y, uint8_t z); stat torus3d_node_connect(struct component *node, - struct component *x_in, - struct component *y_in, - struct component *z_in, - struct component *child, - struct component *x_out, - struct component *y_out, - struct component *z_out); + struct component *x_in, + struct component *y_in, + struct component *z_in, + struct component *child, + struct component *x_out, + struct component *y_out, + struct component *z_out); -static inline void addr_torus3d(uint64_t addr, uint8_t *x, uint8_t *y, uint8_t *z, uint32_t *off) +static inline void addr_torus3d(uint64_t addr, uint8_t *x, uint8_t *y, + uint8_t *z, uint32_t *off) { if (off) *off = addr & 0xffffffff; if (x) *x = (addr >> 32) & 0xff; @@ -24,12 +25,14 @@ static inline void addr_torus3d(uint64_t addr, uint8_t *x, uint8_t *y, uint8_t * assert(((addr >> 56) & 0xff) == 0); } -static inline uint64_t torus3d_addr(uint8_t x, uint8_t y, uint8_t z, uint32_t off) +static inline uint64_t torus3d_addr(uint8_t x, uint8_t y, uint8_t z, + uint32_t off) { - return off | ((uint64_t)x << 32) - | ((uint64_t)y << 40) - | ((uint64_t)z << 48) - ; + return off + | ((uint64_t)x << 32) + | ((uint64_t)y << 40) + | ((uint64_t)z << 48) + ; } #endif /* GRAN_TORUS3D_NODE_H */ -- cgit v1.3