2019-08-18 13:31:59 -05:00
|
|
|
/**************************************************
|
|
|
|
* This file includes a data structure to describe
|
|
|
|
* the multiplexer implementations in FPGA architectures
|
|
|
|
* MuxLibrary is a collection of multiplexers
|
|
|
|
* with various circuit-level description (related to
|
|
|
|
* the information available in CircuitLibrary
|
|
|
|
* and the input size of multiplexers)
|
|
|
|
*************************************************/
|
|
|
|
|
|
|
|
#ifndef MUX_LIBRARY_H
|
|
|
|
#define MUX_LIBRARY_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include "mux_graph.h"
|
|
|
|
#include "mux_library_fwd.h"
|
|
|
|
|
|
|
|
class MuxLibrary {
|
2019-08-19 21:13:18 -05:00
|
|
|
public: /* Types and ranges */
|
|
|
|
typedef vtr::vector<MuxId, MuxId>::const_iterator mux_iterator;
|
|
|
|
|
|
|
|
typedef vtr::Range<mux_iterator> mux_range;
|
|
|
|
public: /* Public accessors: Aggregates */
|
|
|
|
mux_range muxes() const;
|
2019-08-18 13:31:59 -05:00
|
|
|
public: /* Public accessors */
|
|
|
|
/* Get a MUX graph (read-only) */
|
|
|
|
MuxId mux_graph(const CircuitModelId& circuit_model, const size_t& mux_size) const;
|
|
|
|
const MuxGraph& mux_graph(const MuxId& mux_id) const;
|
2019-08-19 21:13:18 -05:00
|
|
|
/* Get a mux circuit model id */
|
|
|
|
CircuitModelId mux_circuit_model(const MuxId& mux_id) const;
|
2019-08-18 13:31:59 -05:00
|
|
|
public: /* Public mutators */
|
|
|
|
/* Add a mux to the library */
|
|
|
|
void add_mux(const CircuitLibrary& circuit_lib, const CircuitModelId& circuit_model, const size_t& mux_size);
|
|
|
|
private: /* Private accessors */
|
|
|
|
bool valid_mux_id(const MuxId& mux) const;
|
|
|
|
bool valid_mux_lookup() const;
|
|
|
|
bool valid_mux_circuit_model_id(const CircuitModelId& circuit_model) const;
|
|
|
|
bool valid_mux_size(const CircuitModelId& circuit_model, const size_t& mux_size) const;
|
|
|
|
private: /* Private mutators: mux_lookup */
|
|
|
|
void build_mux_lookup();
|
|
|
|
/* Invalidate (empty) the mux fast lookup*/
|
|
|
|
void invalidate_mux_lookup();
|
|
|
|
private: /* Internal data */
|
|
|
|
/* MUX graph-based desription */
|
|
|
|
vtr::vector<MuxId, MuxId> mux_ids_; /* Unique identifier for each mux graph */
|
|
|
|
vtr::vector<MuxId, MuxGraph> mux_graphs_; /* Graphs describing MUX internal structures */
|
2019-08-19 21:13:18 -05:00
|
|
|
vtr::vector<MuxId, CircuitModelId> mux_circuit_models_; /* circuit model id in circuit library */
|
2019-08-18 13:31:59 -05:00
|
|
|
|
|
|
|
/* Local encoder description */
|
|
|
|
//vtr::vector<MuxLocalDecoderId, Decoder> mux_local_encoders_; /* Graphs describing MUX internal structures */
|
|
|
|
|
|
|
|
/* a fast look-up to search mux_graphs with given circuit model and mux size */
|
|
|
|
typedef std::map<CircuitModelId, std::map<size_t, MuxId>> MuxLookup;
|
|
|
|
mutable MuxLookup mux_lookup_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|