Skip to content

Commit

Permalink
Merge pull request #1015 from YosysHQ/gatecat/fabulous-viaduct
Browse files Browse the repository at this point in the history
fabulous: Add a viaduct uarch
  • Loading branch information
gatecat authored Sep 15, 2022
2 parents 3983d4f + f423055 commit 79aad09
Show file tree
Hide file tree
Showing 12 changed files with 1,637 additions and 1 deletion.
2 changes: 1 addition & 1 deletion generic/family.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(VIADUCT_UARCHES "example" "okami")
set(VIADUCT_UARCHES "example" "okami" "fabulous")
foreach(uarch ${VIADUCT_UARCHES})
aux_source_directory(${family}/viaduct/${uarch} UARCH_FILES)
foreach(target ${family_targets})
Expand Down
88 changes: 88 additions & 0 deletions generic/viaduct/fabulous/constids.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
X(FABULOUS_LC)
X(FABULOUS_COMB)
X(FABULOUS_FF)

X(SET_NORESET)
X(ASYNC_SR)
X(NEG_CLK)
X(FF)
X(LATCH_NOFF)

X(IO_1_bidirectional_frame_config_pass)
X(InPass4_frame_config)
X(OutPass4_frame_config)
X(RegFile_32x4)
X(MULADD)
X(MUX8LUT_frame_config)

X(CLK)
X(I)
X(T)
X(O)
X(Q)
X(Ci)
X(Co)

X(X0Y0)

X(REG_CLK)
X(LUT_CLK)
X(global_clock)

X(Global_Clock)
X(O2Q)

X(WRITE_DATA)
X(WRITE_ADDRESS)
X(READ_DATA)
X(READ_ADDRESS)
X(DSP_DATA_OUT)
X(DSP_DATA_IN)
X(DSP_CLR)

X(carry_in)
X(carry_out)

X(LUTFF)
X(LUTFF_E)
X(LUTFF_SR)
X(LUTFF_SS)
X(LUTFF_ESR)
X(LUTFF_ESS)
X(LUTFF_R)
X(LUTFF_S)
X(LUTFF_ER)
X(LUTFF_ES)

X(LUTFF_N)
X(LUTFF_NE)
X(LUTFF_NSR)
X(LUTFF_NSS)
X(LUTFF_NESR)
X(LUTFF_NESS)
X(LUTFF_NR)
X(LUTFF_NS)
X(LUTFF_NER)
X(LUTFF_NES)

X(clr)

X(__disconnected)
X(INIT)

X(E)
X(C)
X(D)
X(S)
X(R)
X(SR)
X(EN)

X(BEL)
X(PAD)
X(LUT1)

X(BelBegin)
X(BelEnd)
X(GlobalClk)
X(CFG)
102 changes: 102 additions & 0 deletions generic/viaduct/fabulous/fab_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2021-22 gatecat <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifndef FAB_CFG_H
#define FAB_CFG_H

#include "fab_defs.h"
#include "hashlib.h"
#include "idstring.h"
#include "nextpnr_assertions.h"
#include "nextpnr_namespaces.h"

#include <string>
#include <vector>

NEXTPNR_NAMESPACE_BEGIN

/*
This set of structures is designed to enumerate the different configurable options for a fabulous architecture,
affecting the packer etc...
*/

struct ControlSetConfig
{
/*
CLB signal routing masks for fast validity checking
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
signal can drive for a CLB with 8 FFs and 2 clocks split at halfway, the first entry would be 0x0F and the second
0xF0
*/
std::vector<route_mask_t> routing = {0b11111111}; // default 1 shared between all
bool have_signal = true;
bool can_invert = false;
};

struct LogicConfig
{
// ** Core CLB config
unsigned lc_per_clb = 8; // number of logic cells per clb
bool split_lc = false; // whether to represent SLICE as a single bel or separate lut+ff (latter important if ff and
// lut can be used separately)

// ** LUT config
unsigned lut_k = 4; // base number of inputs for lookup table
enum LutType
{
SINGLE_LUT,
// ...
} lut_type = LutType::SINGLE_LUT; // different types of fracturable LUT structure

enum LutCascade
{
NO_CASCADE,
// ...
} lut_casc = LutCascade::NO_CASCADE; // different types of cascading between LUTs

// TODO: other features we might want to represent...
// TODO: fracLUT/FF/mux/carry output sharing matrices

// ** Carry config
enum CarryType
{
NO_CARRY, // no carry chain
HA_PRE_LUT, // half addder before LUT (classic fabulous LC)
PG_POST_LUT, // prop/gen logic after a fractured LUT
FA_POST_LUT, // full adder after a fractured LUT
} carry_type = CarryType::HA_PRE_LUT;
int carry_lut_frac = -1; // how the LUT is fractured for PG_POST_LUT/FA_POST_LUT, if the LUT fracturing is different
// (or only supported) for carry modes and not in general

// ** FF config
unsigned ff_per_lc = 1; // number of flipflops per logic cell
uint32_t dedi_ff_input = 0; // mask of flipflops in a LC that have dedicated inputs
uint32_t dedi_ff_output = 0; // mask of flipflops in a LC that have dedicated outputs

ControlSetConfig clk, sr, en; // flipflop control set routing
};

struct FabricConfig
{
LogicConfig clb;
// DSP cascading, BRAM, IP rules, IO, clocking ...
};

NEXTPNR_NAMESPACE_END

#endif
39 changes: 39 additions & 0 deletions generic/viaduct/fabulous/fab_defs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2022 gatecat <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/

#ifndef FAB_DEFS_H
#define FAB_DEFS_H

#include <cstdint>
#include "nextpnr_namespaces.h"

NEXTPNR_NAMESPACE_BEGIN

/*
This defines some compile-time maximums for the fabulous arch
*/

static constexpr unsigned MAX_LUTK = 6; // max number of LUT inputs

typedef uint64_t route_mask_t; // the width of this type defines the max number of FFs in a CLB (for defining control
// set route patterns)

NEXTPNR_NAMESPACE_END

#endif
Loading

0 comments on commit 79aad09

Please sign in to comment.