Debian Codegraph @

generic/viaduct/fabulous/fab_cfg.h

raw
1 /*
2 * nextpnr -- Next Generation Place and Route
3 *
4 * Copyright (C) 2021-22 gatecat <[email protected]>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 *
18 */
19 #ifndef FAB_CFG_H
20 #define FAB_CFG_H
21
22 #include "fab_defs.h"
23 #include "hashlib.h"
24 #include "idstring.h"
25 #include "nextpnr_assertions.h"
26 #include "nextpnr_namespaces.h"
27
28 #include <string>
29 #include <vector>
30
31 NEXTPNR_NAMESPACE_BEGIN
32
33 /*
34 This set of structures is designed to enumerate the different configurable options for a fabulous architecture,
35 affecting the packer etc...
36 */
37
38 struct ControlSetConfig
39 {
40 /*
41 CLB signal routing masks for fast validity checking
42 for each unique CLK/CE/SR input to a CLB, add an entry to this vector, and set the bits to 1 for each ff that
43 signal can drive for a CLB with 8 FFs and 2 clocks split at halfway, the first entry would be 0x0F and the second
44 0xF0
45 */
46 std::vector<route_mask_t> routing; // default 1 shared between all
47 bool have_signal = true;
48 int can_mask = -1;
49 bool can_invert = false;
50 };
51
52 struct LogicConfig
53 {
54 // ** Core CLB config
55 unsigned lc_per_clb = 8; // number of logic cells per clb
56 bool split_lc = false; // whether to represent SLICE as a single bel or separate lut+ff (latter important if ff and
57 // lut can be used separately)
58
59 // ** LUT config
60 unsigned lut_k = 4; // base number of inputs for lookup table
61 enum LutType
62 {
63 SINGLE_LUT,
64 // ...
65 } lut_type = LutType::SINGLE_LUT; // different types of fracturable LUT structure
66
67 enum LutCascade
68 {
69 NO_CASCADE,
70 // ...
71 } lut_casc = LutCascade::NO_CASCADE; // different types of cascading between LUTs
72
73 // TODO: other features we might want to represent...
74 // TODO: fracLUT/FF/mux/carry output sharing matrices
75
76 // ** Carry config
77 enum CarryType
78 {
79 NO_CARRY, // no carry chain
80 HA_PRE_LUT, // half addder before LUT (classic fabulous LC)
81 PG_POST_LUT, // prop/gen logic after a fractured LUT
82 FA_POST_LUT, // full adder after a fractured LUT
83 } carry_type = CarryType::HA_PRE_LUT;
84 int carry_lut_frac = -1; // how the LUT is fractured for PG_POST_LUT/FA_POST_LUT, if the LUT fracturing is different
85 // (or only supported) for carry modes and not in general
86
87 // ** FF config
88 unsigned ff_per_lc = 1; // number of flipflops per logic cell
89 uint32_t dedi_ff_input = 0; // mask of flipflops in a LC that have dedicated inputs
90 uint32_t dedi_ff_output = 0; // mask of flipflops in a LC that have dedicated outputs
91
92 ControlSetConfig clk, sr, en; // flipflop control set routing
93 };
94
95 struct FabricConfig
96 {
97 LogicConfig clb;
98 // DSP cascading, BRAM, IP rules, IO, clocking ...
99 };
100
101 NEXTPNR_NAMESPACE_END
102
103 #endif