Debian Codegraph @

himbaechel/uarch/ng-ultra/cells.cc

raw
1 /*
2 * nextpnr -- Next Generation Place and Route
3 *
4 * Copyright (C) 2024 The Project Beyond Authors.
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
20 #include "nextpnr.h"
21 #include "pack.h"
22
23 #define HIMBAECHEL_CONSTIDS "uarch/ng-ultra/constids.inc"
24 #include "himbaechel_constids.h"
25
26 NEXTPNR_NAMESPACE_BEGIN
27
28 CellInfo *NgUltraPacker::create_cell_ptr(IdString type, IdString name)
29 {
30 CellInfo *cell = ctx->createCell(name, type);
31
32 auto add_port = [&](const IdString id, PortType dir) {
33 cell->ports[id].name = id;
34 cell->ports[id].type = dir;
35 };
36 if (type == id_BEYOND_FE) {
37 add_port(id_I1, PORT_IN);
38 add_port(id_I2, PORT_IN);
39 add_port(id_I3, PORT_IN);
40 add_port(id_I4, PORT_IN);
41 add_port(id_LO, PORT_OUT);
42 add_port(id_DI, PORT_IN);
43 add_port(id_L, PORT_IN);
44 add_port(id_CK, PORT_IN);
45 add_port(id_R, PORT_IN);
46 add_port(id_DO, PORT_OUT);
47 } else if (type == id_BFR) {
48 add_port(id_I, PORT_IN);
49 add_port(id_O, PORT_OUT);
50 } else if (type == id_DFR) {
51 add_port(id_I, PORT_IN);
52 add_port(id_O, PORT_OUT);
53 add_port(id_L, PORT_IN);
54 add_port(id_CK, PORT_IN);
55 add_port(id_R, PORT_IN);
56 } else if (type == id_DDFR) {
57 add_port(id_I, PORT_IN);
58 add_port(id_O, PORT_OUT);
59 add_port(id_L, PORT_IN);
60 add_port(id_CK, PORT_IN);
61 add_port(id_R, PORT_IN);
62 add_port(id_I2, PORT_IN);
63 add_port(id_O2, PORT_OUT);
64 add_port(id_CKF, PORT_IN);
65 } else if (type == id_IOM) {
66 add_port(id_P17RI, PORT_IN);
67 add_port(id_CKO1, PORT_OUT);
68 add_port(id_P19RI, PORT_IN);
69 add_port(id_CKO2, PORT_OUT);
70 } else if (type == id_WFB) {
71 add_port(id_ZI, PORT_IN);
72 add_port(id_ZO, PORT_OUT);
73 } else if (type == id_GCK) {
74 add_port(id_SI1, PORT_IN);
75 add_port(id_SI2, PORT_IN);
76 add_port(id_CMD, PORT_IN);
77 add_port(id_SO, PORT_OUT);
78 } else {
79 log_error("Trying to create unknown cell type %s\n", type.c_str(ctx));
80 }
81 return cell;
82 }
83
84 NEXTPNR_NAMESPACE_END