Comment arch.h
This commit is contained in:
parent
b8ca1a5582
commit
dc3256e62f
35
ice40/arch.h
35
ice40/arch.h
@ -328,15 +328,28 @@ struct ArchArgs
|
|||||||
std::string package;
|
std::string package;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Forward declare proxy classes for Arch.
|
||||||
|
|
||||||
class ArchRWProxyMethods;
|
class ArchRWProxyMethods;
|
||||||
class ArchRProxyMethods;
|
class ArchRProxyMethods;
|
||||||
class ArchRWProxy;
|
class ArchRWProxy;
|
||||||
class ArchRProxy;
|
class ArchRProxy;
|
||||||
|
|
||||||
|
|
||||||
|
/// Arch/Context
|
||||||
|
// Arch is the main state class of the PnR algorithms. It keeps note of mapped
|
||||||
|
// cells/nets, locked switches, etc.
|
||||||
|
//
|
||||||
|
// In order to mutate state in Arch, you can do one of two things:
|
||||||
|
// - directly call one of the wrapper methods to mutate state
|
||||||
|
// - get a read or readwrite proxy to the Arch, and call methods on it
|
||||||
|
|
||||||
class Arch : public BaseCtx
|
class Arch : public BaseCtx
|
||||||
{
|
{
|
||||||
|
// We let proxy methods access our state.
|
||||||
friend class ArchRWProxyMethods;
|
friend class ArchRWProxyMethods;
|
||||||
friend class ArchRProxyMethods;
|
friend class ArchRProxyMethods;
|
||||||
|
// We let proxy objects access our mutex.
|
||||||
friend class ArchRWProxy;
|
friend class ArchRWProxy;
|
||||||
friend class ArchRProxy;
|
friend class ArchRProxy;
|
||||||
private:
|
private:
|
||||||
@ -359,7 +372,13 @@ public:
|
|||||||
ArchArgs args;
|
ArchArgs args;
|
||||||
Arch(ArchArgs args);
|
Arch(ArchArgs args);
|
||||||
|
|
||||||
|
// Get a readwrite proxy to arch - this will keep a readwrite lock on the
|
||||||
|
// entire architecture until the proxy object goes out of scope.
|
||||||
ArchRWProxy rwproxy(void);
|
ArchRWProxy rwproxy(void);
|
||||||
|
// Get a read-only proxy to arch - this will keep a read lock on the
|
||||||
|
// entire architecture until the proxy object goes out of scope. Other read
|
||||||
|
// locks can be taken while this one still exists. Ie., the UI can draw
|
||||||
|
// elements while the PnR is going a RO operation.
|
||||||
ArchRProxy rproxy(void) const;
|
ArchRProxy rproxy(void) const;
|
||||||
|
|
||||||
std::string getChipName();
|
std::string getChipName();
|
||||||
@ -378,6 +397,9 @@ public:
|
|||||||
/// Wrappers around getting a r(w)proxy and calling a single method.
|
/// Wrappers around getting a r(w)proxy and calling a single method.
|
||||||
// Deprecated: please acquire a proxy yourself and call the methods
|
// Deprecated: please acquire a proxy yourself and call the methods
|
||||||
// you want on it.
|
// you want on it.
|
||||||
|
// Warning: these will content with locks taken by the r(w)proxies, and
|
||||||
|
// thus can cause difficult to debug deadlocks - we'll be getting rid of
|
||||||
|
// them because of that.
|
||||||
void unbindWire(WireId wire);
|
void unbindWire(WireId wire);
|
||||||
void unbindPip(PipId pip);
|
void unbindPip(PipId pip);
|
||||||
void unbindBel(BelId bel);
|
void unbindBel(BelId bel);
|
||||||
@ -554,6 +576,7 @@ public:
|
|||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
|
// TODO(q3k) move this to archproxies?
|
||||||
GroupId getGroupByName(IdString name) const;
|
GroupId getGroupByName(IdString name) const;
|
||||||
IdString getGroupName(GroupId group) const;
|
IdString getGroupName(GroupId group) const;
|
||||||
std::vector<GroupId> getGroups() const;
|
std::vector<GroupId> getGroups() const;
|
||||||
@ -564,6 +587,8 @@ public:
|
|||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
|
// These are also specific to the chip and not state, so they're available
|
||||||
|
// on arch directly.
|
||||||
void estimatePosition(BelId bel, int &x, int &y, bool &gb) const;
|
void estimatePosition(BelId bel, int &x, int &y, bool &gb) const;
|
||||||
delay_t estimateDelay(WireId src, WireId dst) const;
|
delay_t estimateDelay(WireId src, WireId dst) const;
|
||||||
delay_t getDelayEpsilon() const { return 20; }
|
delay_t getDelayEpsilon() const { return 20; }
|
||||||
@ -608,7 +633,9 @@ public:
|
|||||||
IdString id_dff_en, id_neg_clk;
|
IdString id_dff_en, id_neg_clk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Read-only methods on Arch that require state access.
|
||||||
class ArchRProxyMethods {
|
class ArchRProxyMethods {
|
||||||
|
// We let proxy objects access our private constructors.
|
||||||
friend class ArchRProxy;
|
friend class ArchRProxy;
|
||||||
friend class ArchRWProxy;
|
friend class ArchRWProxy;
|
||||||
private:
|
private:
|
||||||
@ -641,7 +668,6 @@ public:
|
|||||||
WireId getWireBelPin(BelId bel, PortPin pin) const;
|
WireId getWireBelPin(BelId bel, PortPin pin) const;
|
||||||
PipId getPipByName(IdString name) const;
|
PipId getPipByName(IdString name) const;
|
||||||
|
|
||||||
|
|
||||||
IdString getConflictingWireNet(WireId wire) const;
|
IdString getConflictingWireNet(WireId wire) const;
|
||||||
IdString getConflictingPipNet(PipId pip) const;
|
IdString getConflictingPipNet(PipId pip) const;
|
||||||
IdString getConflictingBelCell(BelId bel) const;
|
IdString getConflictingBelCell(BelId bel) const;
|
||||||
@ -653,6 +679,8 @@ public:
|
|||||||
BelId getBelByName(IdString name) const;
|
BelId getBelByName(IdString name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A proxy object that keeps an Arch shared/readonly lock until it goes out
|
||||||
|
// of scope. All const/read-only ArchRProxyMethods are available on it.
|
||||||
class ArchRProxy : public ArchRProxyMethods {
|
class ArchRProxy : public ArchRProxyMethods {
|
||||||
friend class Arch;
|
friend class Arch;
|
||||||
friend class ArchRWProxy;
|
friend class ArchRWProxy;
|
||||||
@ -675,7 +703,9 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// State mutating methods on Arch.
|
||||||
class ArchRWProxyMethods {
|
class ArchRWProxyMethods {
|
||||||
|
// We let proxy objects access our private constructors.
|
||||||
friend class ArchRWProxy;
|
friend class ArchRWProxy;
|
||||||
private:
|
private:
|
||||||
Arch *parent_;
|
Arch *parent_;
|
||||||
@ -691,9 +721,12 @@ public:
|
|||||||
void bindWire(WireId wire, IdString net, PlaceStrength strength);
|
void bindWire(WireId wire, IdString net, PlaceStrength strength);
|
||||||
void bindPip(PipId pip, IdString net, PlaceStrength strength);
|
void bindPip(PipId pip, IdString net, PlaceStrength strength);
|
||||||
void bindBel(BelId bel, IdString cell, PlaceStrength strength);
|
void bindBel(BelId bel, IdString cell, PlaceStrength strength);
|
||||||
|
// Returned pointer is valid as long as Proxy object exists.
|
||||||
CellInfo *getCell(IdString cell);
|
CellInfo *getCell(IdString cell);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A proxy object that keeps an Arch readwrite lock until it goes out of scope.
|
||||||
|
// All ArchRProxyMethods and ArchRWProxyMethods are available on it.
|
||||||
class ArchRWProxy : public ArchRProxyMethods, public ArchRWProxyMethods {
|
class ArchRWProxy : public ArchRProxyMethods, public ArchRWProxyMethods {
|
||||||
friend class Arch;
|
friend class Arch;
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user