ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bacPrsTrans.c
Go to the documentation of this file.
1
20
21#include "bac.h"
22#include "bacPrs.h"
23
25
29
30typedef struct Bac_Trip_t_ Bac_Trip_t;
32{
34 char * pName;
35 char * pCode;
36 char * pSigs[6];
37};
38/*
39static Bac_Trip_t s_Types[100] =
40{
41 { BAC_BOX_CT , "VERIFIC_PWR", "1", {"o"} },
42 { BAC_BOX_CF , "VERIFIC_GND", "1", {"o"} },
43 { BAC_BOX_CX , "VERIFIC_X", "1", {"o"} },
44 { BAC_BOX_CZ , "VERIFIC_Z", "1", {"o"} },
45 { BAC_BOX_INV , "VERIFIC_INV", "11", {"i","o"} },
46 { BAC_BOX_BUF , "VERIFIC_BUF", "11", {"i","o"} },
47 { BAC_BOX_AND , "VERIFIC_AND", "111", {"a0","a1","o"} },
48 { BAC_BOX_NAND , "VERIFIC_NAND", "111", {"a0","a1","o"} },
49 { BAC_BOX_OR , "VERIFIC_OR", "111", {"a0","a1","o"} },
50 { BAC_BOX_NOR , "VERIFIC_NOR", "111", {"a0","a1","o"} },
51 { BAC_BOX_XOR , "VERIFIC_XOR", "111", {"a0","a1","o"} },
52 { BAC_BOX_XNOR , "VERIFIC_XNOR", "111", {"a0","a1","o"} },
53 { BAC_BOX_MUX , "VERIFIC_MUX", "1111", {"c","a1","a0","o"} }, // changed order
54 { (Bac_ObjType_t)-1, "VERIFIC_PULLUP", "1", {"o"} },
55 { (Bac_ObjType_t)-1, "VERIFIC_PULLDOWN", "1", {"o"} },
56 { BAC_BOX_TRI , "VERIFIC_TRI", "111", {"i","c","o"} },
57 { BAC_BOX_LATCH , "VERIFIC_DLATCH", "11111", {"d","async_val","async_cond","gate","q"} }, // changed order
58 { BAC_BOX_LATCHRS , "VERIFIC_DLATCHRS", "11111", {"d","s","r","gate","q"} }, // changed order
59 { BAC_BOX_DFF , "VERIFIC_DFF", "11111", {"d","async_val","async_cond","clk","q"} }, // changed order
60 { BAC_BOX_DFFRS , "VERIFIC_DFFRS", "11111", {"d","s","r","clk","q"} }, // changed order
61 { (Bac_ObjType_t)-1, "VERIFIC_NMOS", "111", {"c","d","o"} },
62 { (Bac_ObjType_t)-1, "VERIFIC_PMOS", "111", {"c","d","o"} },
63 { (Bac_ObjType_t)-1, "VERIFIC_CMOS", "1111", {"d","nc","pc","o"} },
64 { (Bac_ObjType_t)-1, "VERIFIC_TRAN", "111", {"inout1","inout2","control"} },
65 { BAC_BOX_ADD , "VERIFIC_FADD", "11111", {"cin","a","b","o","cout"} },
66 { (Bac_ObjType_t)-1, "VERIFIC_RCMOS", "1111", {"d","nc","pc","o"} },
67 { (Bac_ObjType_t)-1, "VERIFIC_RNMOS", "111", {"c","d","o"} },
68 { (Bac_ObjType_t)-1, "VERIFIC_RPMOS", "111", {"c","d","o"} },
69 { (Bac_ObjType_t)-1, "VERIFIC_RTRAN", "111", {"inout1","inout2","control"} },
70 { (Bac_ObjType_t)-1, "VERIFIC_HDL_ASSERTION", "1", {"condition"} },
71 { BAC_BOX_ADD , "add_", "1aba1", {"cin","a","b","o","cout"} },
72 { BAC_BOX_MUL , "mult_", "ab?", {"a","b","o"} }, // ? = a * b
73 { BAC_BOX_DIV , "div_", "ab?", {"a","b","o"} }, // ? =
74 { BAC_BOX_MOD , "mod_", "ab?", {"a","b","o"} }, // ? =
75 { BAC_BOX_REM , "rem_", "ab?", {"a","b","o"} }, // ? =
76 { BAC_BOX_SHIL , "shift_left_", "1aba", {"cin","a","amount","o"} },
77 { BAC_BOX_SHIR , "shift_right_", "1aba", {"cin","a","amount","o"} },
78 { BAC_BOX_ROTL , "rotate_left_", "aba", {"a","amount","o"} },
79 { BAC_BOX_ROTR , "rotate_right_", "aba", {"a","amount","o"} },
80 { BAC_BOX_RAND , "reduce_and_", "ab1", {"a","o"} },
81 { BAC_BOX_ROR , "reduce_or_", "ab1", {"a","o"} },
82 { BAC_BOX_RXOR , "reduce_xor_", "ab1", {"a","o"} },
83 { BAC_BOX_RNAND , "reduce_nand_", "ab1", {"a","o"} },
84 { BAC_BOX_RNOR , "reduce_nor_", "ab1", {"a","o"} },
85 { BAC_BOX_RXNOR , "reduce_xnor_", "ab1", {"a","o"} },
86 { BAC_BOX_LTHAN , "LessThan_", "1ab1", {"cin","a","b","o"} },
87 { BAC_BOX_NMUX , "Mux_", "ab1", {"sel","data","o"} },
88 { BAC_BOX_SEL , "Select_", "aaa", {"sel","data","o"} },
89 { BAC_BOX_DEC , "Decoder_", "a?", {"a","o"} }, // ? = (1 << a)
90 { BAC_BOX_EDEC , "EnabledDecoder_", "1a?", {"en","i","o"} }, // ? = (1 << a)
91 { BAC_BOX_PSEL , "PrioSelect_", "1aaa", {"cin","sel","data","o"} },
92 { BAC_BOX_RAM , "DualPortRam_", "1abab", {"write_enable","write_address","write_data","read_address","read_data"} },
93 { BAC_BOX_RAMR , "ReadPort_", "1a1b", {"read_enable", "read_address", "RAM", "read_data" } },
94 { BAC_BOX_RAMW , "WritePort_", "1ab1", {"write_enable","write_address","write_data", "RAM"} },
95 { BAC_BOX_RAMWC , "ClockedWritePort_", "11ab1", {"clk","write_enable","write_address","write_data", "RAM"} },
96 { BAC_BOX_LUT , "lut", "?", {"i","o"} },
97 { BAC_BOX_AND , "and_", "aaa", {"a","b","o"} },
98 { BAC_BOX_OR , "or_", "aaa", {"a","b","o"} },
99 { BAC_BOX_XOR , "xor_", "aaa", {"a","b","o"} },
100 { BAC_BOX_NAND , "nand_", "aaa", {"a","b","o"} },
101 { BAC_BOX_NOR , "nor_", "aaa", {"a","b","o"} },
102 { BAC_BOX_XNOR , "xnor_", "aaa", {"a","b","o"} },
103 { BAC_BOX_BUF , "buf_", "aa", {"i","o"} },
104 { BAC_BOX_INV , "inv_", "aa", {"i","o"} },
105 { BAC_BOX_TRI , "tri_", "a1a", {"i","c","o"} },
106 { BAC_BOX_SUB , "sub_", "aaa", {"a","b","o"} },
107 { BAC_BOX_MIN , "unary_minus_", "aa", {"i","o"} },
108 { BAC_BOX_EQU , "equal_", "aa1", {"a","b","o"} },
109 { BAC_BOX_NEQU , "not_equal_", "aa1", {"a","b","o"} },
110 { BAC_BOX_MUX , "mux_", "1aaa", {"cond","d1","d0","o"} }, // changed order
111 { BAC_BOX_NMUX , "wide_mux_", "ab?", {"sel","data","o"} }, // ? = b / (1 << a)
112 { BAC_BOX_SEL , "wide_select_", "ab?", {"sel","data","o"} }, // ? = b / a
113 { BAC_BOX_DFF , "wide_dff_", "aaa1a", {"d","async_val","async_cond","clock","q"} },
114 { BAC_BOX_DFFRS , "wide_dlatch_", "aaa1a", {"d","set","reset","clock","q"} },
115 { BAC_BOX_LATCHRS , "wide_dffrs_", "aaa1a", {"d","set","reset","clock","q"} },
116 { BAC_BOX_LATCH , "wide_dlatchrs_", "aaa1a", {"d","async_val","async_cond","clock","q"} },
117 { BAC_BOX_PSEL , "wide_prio_select_", "ab??", {"sel","data","carry_in","o"} }, // ? = b / a
118 { BAC_BOX_POW , "pow_", "abc", {"a","b","o"} }, // ? =
119 { BAC_BOX_PENC , "PrioEncoder_", "a?", {"sel","o"} },
120 { BAC_BOX_ABS , "abs", "aa", {"i","o"} }
121};
122*/
123
127
139static inline int Psr_ManRangeSizeName( Psr_Ntk_t * p, int Name )
140{
141 return 1;
142}
143static inline int Psr_ManRangeSizeRange( Psr_Ntk_t * p, int Range )
144{
145 char * pStr;
146 int Left, Right;
147 if ( Range == 0 )
148 return 1;
149 pStr = Psr_NtkStr( p, Range );
150 assert( pStr[0] == '[' );
151 Left = Right = atoi( pStr + 1 );
152 pStr = strstr( pStr, "=" );
153 if ( pStr )
154 Right = atoi( pStr + 1 );
155 return 1 + (Left > Right ? Left - Right : Right - Left);
156}
157static inline int Psr_ManRangeSizeConst( Psr_Ntk_t * p, int Const )
158{
159 return atoi( Psr_NtkStr(p, Const) );
160}
161static inline int Psr_ManRangeSizeConcat( Psr_Ntk_t * p, int Con )
162{
163 extern int Psr_ManRangeSizeArray( Psr_Ntk_t * p, Vec_Int_t * vSlices, int Start, int Stop );
164 Vec_Int_t * vSigs = Psr_CatSignals(p, Con);
165 return Psr_ManRangeSizeArray( p, vSigs, 0, Vec_IntSize(vSigs) );
166}
167static inline int Psr_ManRangeSizeSignal( Psr_Ntk_t * p, int Sig )
168{
169 int Value = Abc_Lit2Var2( Sig );
170 Psr_ManType_t Type = (Psr_ManType_t)Abc_Lit2Att2( Sig );
171 if ( Type == BAC_PRS_NAME )
172 return Psr_ManRangeSizeName( p, Value );
173 if ( Type == BAC_PRS_SLICE )
174 return Psr_ManRangeSizeRange( p, Psr_SliceRange(p, Value) );
175 if ( Type == BAC_PRS_CONST )
176 return Psr_ManRangeSizeConst( p, Value );
177 if ( Type == BAC_PRS_CONCAT )
178 return Psr_ManRangeSizeConcat( p, Value );
179 assert( 0 );
180 return 0;
181}
182int Psr_ManRangeSizeArray( Psr_Ntk_t * p, Vec_Int_t * vSlices, int Start, int Stop )
183{
184 int i, Sig, Count = 0;
185 assert( Vec_IntSize(vSlices) > 0 );
186 Vec_IntForEachEntryStartStop( vSlices, Sig, i, Start, Stop )
187 Count += Psr_ManRangeSizeSignal( p, Sig );
188 return Count;
189}
190
191
203
204
208
209
211
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Bac_Trip_t_ Bac_Trip_t
DECLARATIONS ///.
Definition bacPrsTrans.c:30
int Psr_ManRangeSizeArray(Psr_Ntk_t *p, Vec_Int_t *vSlices, int Start, int Stop)
struct Psr_Ntk_t_ Psr_Ntk_t
BASIC TYPES ///.
Definition bacPrs.h:51
Psr_ManType_t
INCLUDES ///.
Definition bacPrs.h:39
@ BAC_PRS_CONST
Definition bacPrs.h:42
@ BAC_PRS_CONCAT
Definition bacPrs.h:43
@ BAC_PRS_NAME
Definition bacPrs.h:40
@ BAC_PRS_SLICE
Definition bacPrs.h:41
Bac_ObjType_t
INCLUDES ///.
Definition bac.h:43
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
Bac_ObjType_t Type
Definition bacPrsTrans.c:33
char * pCode
Definition bacPrsTrans.c:35
char * pSigs[6]
Definition bacPrsTrans.c:36
char * pName
Definition bacPrsTrans.c:34
#define assert(ex)
Definition util_old.h:213
char * strstr()
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition vecInt.h:60