صفحه 1:
Synthesis وگو رگضي صاحب الزماني

صفحه 2:
Transformation of an abstract description into a more detailed description * "+" operator is transformed into a gate netlist + “if (VEC_A = VEC _B) then" is realized as a comparator which controls a Lol sigs" nol ans: What is 93901 maarocel N library ‏مت‎ ‎technalogy x library 2 3 ل ص 2 5 2 multiplexer ‏كه ساده (مثل 01۴ ,۸, مقایسه) به گيتهاي‎ ۰ ‏عملگرهاي پیچیده تر مثل‎ we Jas tool ul yal> slglus Sdepebdb: |] ‏هسب مراجرى‎ Bs ۲ موه ۱۴۳۷۲۵ (Gate) VHDL code 2

صفحه 3:
Field Programmable Gate 7 7 Arrav (FPGA) 1 logic _] routing blocks tracks a8 8) \e oe aoe fe ۶ #و#وركضي صاحب الز ‏ _ ‎switches‏ ‏70

صفحه 4:
74 * مزایا: * کوتاه شدن پروسه ي طراحي. * نوآوري بیشتر (پروسه ی طراحي به مراحل بالاتر رفتاري منتقل مي شود) (تشابه با زبانهاي سطح بالا) ‎Debug +‏ طرح بسیار ‎Lal‏ يعتر. ‎see‏ اجرا- کامپار برنامه ‏* مانند مانند سیکل برنامه 3 ‎ae‏ ‎eee cles‏ ‏شبیه ‎oa deal Ese‏ ورود‌ظرل. > را ‏«تعييرات أن قرع تسيا انق ۳ ‎ ‎ ‎ ‎

صفحه 5:
Synthesizability 100 % Tod C * Onlya subset of VHDL is synthesizable Tod * Different Tool rt Tool A ‘ifferent Tools suppo: different subsets * 7 * arrays of integers? 0% ٠ clock edge detection? * sensitivity list? وگو رگضي صاحب الزماني

صفحه 6:
rocess (CLK) egin FCLK='1'then Q<=D; endif; lend process; sensitivity ist Supported sensitivity ist not supported flip flop transparentlatch وگو رگضي صاحب الزماني

صفحه 7:
Macrocells ٠ adder * comparator * Bus interface Constraints * speed * area * power Optimizations ٠ boolean: mathematic * gate: technological وگو رگضي صاحب الزماني macrocell ‏مود‎ ‘constraints technology lorary How to Do? | Boolean 10 gate netlist (aes 1 VHDL code preprocessed VHDL code boolean equations

صفحه 8:
Non-functional requiremen ١ - Clock speed is generally a primary requirement. - Usually expressed as a lower bound. + Design cycle and Timing Closure * Size: - Determines manufacturing cost. - If your design doesn’t fit into one size FPGA, you must use the next larger FPGA. - For very large designs: multi-FPGAs. * Power/energy: - Power/Energy related to battery life and heat. * May have more cost: - More expensive packaging to dissipate heat. - More extreme measures (e.g. cooling fans). - Many digital systems are power- or energy- limited. a رگضي صاحب الزماني

صفحه 9:
Mapping into an FPGA ~ * Must choose the FPGA: - Capacity. - Pinout/package type. - Maximum speed. وگو رگضي صاحب الزماني

صفحه 10:
با 7 Synthesis Process in Practi awl YSoo usjlu ang: Sleojil&e ‏باوجود‎ ٠ ‏بعد از سنتزء همة محدودیتها برآورده نشده‎ ۲ = 5 a2. yes OK 99 no ُضي صاحب الزماني

صفحه 11:
Path delay * Combinational network delay i measured over paths through network. * Can trace a causality chain from inputs to worst-case output. وگو رگضي صاحب الزماني

صفحه 12:
Path delay example ‏5هطل د جر ا لهي‎ network > B | = ۱ graph a seo 7 model b OO © ‏و‎ ۱

صفحه 13:
Critical path ° Critical path = path which creates longest delay. * Can trace transitions which cause delays that are elements” of the critical delay path. وگو رگضي صاحب الزماني

صفحه 14:
Critical path through delay, me,

صفحه 15:
Delay Paths in a design man register2output input2register register2register input2output ‏لس‎ وگو رگضي صاحب الزماني 15

صفحه 16:
False paths * Logic gates are not simple nodes—some input changes don’t cause output changes. * A false path is a path which never happens due to Boolean gate conditions * False paths cause pessimistic delay estimates. وگو رگضي صاحب الزماني 16

صفحه 17:
Placement and delay * Placement helps determine routi: * Routing determines wire length. * Wire length determines capacitive ۱ load. وگو رگضي صاحب الزماني

صفحه 18:
delay ¢ N-bit adder: (optimal placement) وگو رگضي صاحب الزماني

صفحه 19:
0 routing رگضي صاحب الزماني placement

صفحه 20:
«Adder has been distributed throughout the FP ۰1/0 pins have been spread around the chip.

صفحه 21:
routing With delay constraints. Better placement and ۸ 1 2 eT 5 * Better but far from optimal (less spread out horizontally but spread out vertically) ۳ ‏گضي صاحب الزماني‎

صفحه 22:
How to improve? * Use macros (optimized), * Put constraints on the placement of objects, ¢ Hand place objects. - Example: later. وگو رگضي صاحب الزماني

صفحه 23:
Power Optimization وگو رگضي صاحب الزماني 27

صفحه 24:
Power optimization * Transitions cause power consumption. * Logic network design helps control power consumption: - minimizing capacitance; - eliminating unnecessary glitches وگو رگضي صاحب الزماني 24

صفحه 25:
Power optimization * Leakage in more advanced processes. - Even when logic is idle. - The only way: disconnect the power ‏أ‎ ‎supply from the logic when not needéq for some time. ~ It generally takes a considerable peri (larger than a clock period) to reconnect power and let the circuits stabilize. وگو رگضي صاحب الزماني 25

صفحه 26:
Glitching example a 5 * Gate network: آفگورگضي صاحب الزماني 2

صفحه 27:
Glitching example behavie * NOR gate produces 0 output a beginning and end: - beginning: bottom input is 1; - end: NAND output is 1; Difference in delay between application of primary inputs and generation of new NAND output causes glitch. فسن ساحب الوماس

صفحه 28:
Adder Chain Glitching GS ki 7 وركضي صاحب الزماني ‎bad‏

صفحه 29:
Explanation * Unbalanced chain has signals arriving at different times at each adder. * A glitch downstream propagat¢ all the way upstream. ¢ Balanced tree introduces وگو رگضي صاحب الزماني

صفحه 30:
a: High transition probability h2 > bad good 30 ‏رگضي صاحب الزماني‎ ae

صفحه 31:
low ‏تسیب‎ ‎* Reduce number of logic leve 139 8 آفگورگضي صاحب الزماني

صفحه 32:
Example (ALU) ¢ ALU output is not used for every cyclé 0 > If ALU inputs change, the energy i: needlessly consumed وگو رگضي صاحب الزماني 32

صفحه 33:
Example (ALU) * Control Signal selects whether data is allowed to pass the logic or the previous value is held to avoid transitions. Dat ۳ Control ‏بن ابن اقرواس‎ A

صفحه 34:
Layout for low power * Place and route to minimize capacitance of nodes with hig glitching activity. ٠ Feed back wiring capacitanc@% values to power analysis for better estimates. وگو رگضي صاحب الزماني

صفحه 35:
State assignment for low 2 3 power 5 ٠١ Later وگو رگضي صاحب الزماني

صفحه 36:
Case Study 16 x 16 multiplier example. وگو رگضي صاحب الزماني 27

صفحه 37:
The FPGA design 52066552 ¢ Xilinx ISE (Integrated Synthesis Environment) - Translation from HDL. * (Synthesis, Translation) - Logic synthesis. * (Mapping) - Placement and routing. * (Place and Route) - Configuration generation. * (Program File Generation) وگو رگضي صاحب الزماني 37

صفحه 38:
Design experiments * Synthesize with no constraints. * Synthesize with timing constraint. - Tighten timing constraint. ¢ Synthesize with placement constraip ° Power: - Many tools don’t allow us to directly specify power consumption >» > must rewrite our h/w description for bette: power consumption characteristics. 38

صفحه 39:
model ۰ No timing or area constraints * HDL model in terms of FPGA primitives, ٠ Example: “ ‎X LOPE ۱۳90 0009 7) >‏ (1006۴ م0060 1006 9 )6060 ([] 9 2066 ([6] سس 9066 ([9۲سمم. ‎ ‎ ‏وگو رگضي صاحب الزماني ‎39

صفحه 40:
Mapping report Odour 4,066 6 Ovober oP vowed Olww: OGG nuh 608 0 ‎bie: COS ouch 666 96‏ لصوام يلت وعدم سانا حت ساس( ‎Oni COO 0%‏ تا لام موی مق طلست وا یی چاه این سا اه بسشججاويت مت ‎*@ee DOTEO bebw Por‏ ‎۱ ® eps LOT: 600 ‏چیه‎ 4,06 ۸ ‎OP ou . 9 0‏ 100 یا و حطس 9 تم + سحت سب تس فجه لا ‏6 :1۵۵۰ ۱ مه سم ۳00 تمدق ‎Prk Drwory Draw: OF OP‏ ‎ ‎ ‎۳ ‎40 ‎ ‎

صفحه 41:
Static timing analysis report/ Protay rostrata: TS _POP = DOXOELOY FROO TIDEGRE "P®OG" TO MIOEERP "PCOS" 68.980 ‏قد‎ ; fod evrory), Ountwuw ‏ع بواط‎ 90.96۶ After Mapping: > estimated delays (no 5 information about interconnects)! Wot. 04 a

صفحه 42:
‎paths‏ نسم ‎Octe Gheet report: ‎Ol udkes deployed to cseroads (7) ‎۳ & Pad ‎mann nnn nnn nn ban nn nn nn nn ‏سا سس سس‎ ‏یوق‎ Pad |Desicaton Pad] Deby | ann nnn ‏سا تست تست سس تست تست سب تست سا ساب‎ x<O> jp<o> ۱ 966 x<O> lp<ao> | ٩۵:76 x<O> lp<aa> | cae] x<O> ‏<49>م‎ | ars] ‎ ‏فسن ساحب الوماس ‎43

صفحه 43:
600 006۶ < 906 ۳۵ :تسه بمب ۳۹۵۵ ۰۳۵ ۲۳6۵0۵۵۳ ۰۳۱۵۵۵66 كف 69,99 و .سس سوه داص (0 لدو ادمه ود 900096909 ‎errs, O bold errors)‏ جد (0) ,46 عا روا مهو( * (vs 20.916 ns in mapping report) Because of interconnect delays. ‏وگو رگضي صاحب الزماني‎ 45

صفحه 44:
Timing constraint * Use timing constraint e itar. TIMESPEC Name: 7 وگو رگضي صاحب الزماني 46

صفحه 45:
report ‎OOXOELCY PROD.‏ < ۲86۳9۴ :له پم( ‎MOEGRE "PBOG" TMOEGRE "PHO‏ : ۰۵ 0 ‎Pad to pad 7 ‎6009969 ‏رها ( ,للم سب‎ errors detevied. (DO pet errors, O bok errors) ‎Outwuw thy ‏عء‎ 90.06» ‎Hasn’t changed since this design has limited opportunities for logic synthesis to change delays by restructuring logic. ‏وگو رگضي صاحب الزماني 47

صفحه 46:
report ‎TS_POP = DOEXOEL®Y PROD‏ :مه پم "تاه" ۳۹۵۵ ‎TIOEGRE "PCOG" TO‏ ‏: م 66 ‎ ‎ ‎ ‎COIOSOE tewe wxrihrzed, D tote errors deed. (VJ ‏مب‎ errors, boll evrore) ‎Out dey + O1.00P ws. ‎Tools generally try to meet the delay goal as closely as possible to minimize area. ‏وگو رگضي صاحب الزماني 48

صفحه 47:
Tighter timing constrain * Tighten requirement to 25 ns. * Post-place-route timing report: Protay costa: TS_POP = DPXOELCY Es (۳1066606 ۲۵۵۳ TO MOCGRE " 9 ‏هه‎ : اسص سس بیجع حجري ست 00060000 ح عد ‎(aq‏ vetup errors, O رز »06 ها روا مهو( وگو رگضي صاحب الزماني 5

صفحه 48:
Report on a violated path? ‎po)‏ مد - مسسنمم) »6,166 تس (۵۵) <0>ر وه ‎p<Q0> (PHO)‏ یی ‎Cried: C9.000w ‎Det Poke Doky: 0.2 Ocw (Levels oF Lowes = SM) ‎Modify the logic and/or physical design to improve the delay. ‎50

صفحه 49:
Power report Power mower: We) Plo) errs Owen 9.600: ‏موه مه‎ Helps us determine whether we need 51

صفحه 50:
Improving area ۰ Floorplanner window: - Floorplanner > View/edit placed des rectangles| : mapped componen| ts to CLBs * Green 52

صفحه 51:
Rat’s nest wiring + If you click on a component in the deign hierarchy window, its rat’s nest is shown. تمه هو همه و و 53

صفحه 52:
Routing editor view ‎al‏ و ‎el = Tare ‎ ‎ ‎ ‎ ‎ ‎* FPGA Editor > View/Edit Routed Design ‎ ‎ ‎ ‎ ‎ ‎

صفحه 53:
Editing constraints * Use constraints editor to place constraints: - This tool allws you to constrain the placement of logic as well as the assignment of chip 1/0s to ToBs (e.g useful for PCB lesign) a مس سس ددص | 1 8 سرت 55

صفحه 54:
wile, ‏احب الز.‎ Le ‏#ضب‎ ‏وش‎

صفحه 55:
Drag and drop constraints We وگو رکضي صاحب الزماني

صفحه 56:
Change the shape of constraints وگو رکضي صاحب الزماني

صفحه 57:
* We place the rows of the multiplier one below the other to create the row structure of the floorplan. اني )59

صفحه 58:

صفحه 59:
New timing report * After placement constraints: 2 16۵066 ‏وه سای بت‎ errors A ‏.لس‎ "© 59۳ 5277215 O wht errors) Ouxtvuw dehy & OF * Compares to 31 ns for unconstrained placement. وگو رگضي صاحب الزماني

صفحه 60:
Hardware realisation با x On|_Loxte (dO ol XODPLO & pont (D, ©, O, X : ‏مس )سس ی اون‎ O); 1 ‏فى‎ ok xpo_vevier(© shure Bc A ©) rand IP_OXOOPLE; ‎oP AP_OXOOPLE &‏ 0 انیت ‎bows‏ ‎provess (8, ©, ©,‏ بسا ‎P(X = "4000" ) thew‏ ‎DL <=;‏ ‎ebP (0 = "Od0A") thew‏ ‎DL <= 0;‏ ‎he‏ ‏بن ع> ره ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎eed PS a 62 ‏لع‎ proven ‏العامة‎ ae cel 4 ag

صفحه 61:
8 و .وه ‎Sensitivity List‏ ‎D, GOL)‏ ,( سس ‎bests * If SEL is missing in the‏ ‎sensitivity list, what will‏ 1 ۳9 ‎the behavior‏ ‎(simulation) be?‏ ;=< 1 ‎BY‏ اج ‎ ‎vend proves) ‎* Sensitivity list is usually ignored during synthesis. * Equivalent behavior of simulation model and ‎hardware ‎> + Allsignals which are read are entered into the ‎sensitivity list. ‏ده‎ Complete if-statement for the synthesis"tf ‏رضي صاحب ا‎ ‎

صفحه 62:
168; ‎What is the value of Z,‏ * موسر 7 > ۳۲ 1 <10_طوجو0 0ت نسم ‎What hardware would‏ * ههد 6۵ 0۳ مس ‎be generated during‏ 0۵0000۳ مس ‎synthesis ? ‎100۵0 ۰ ‎ ‎"SEL < 1 ‏هنگام‎ aS Latch ‏شفافاست‎ ‎.(Transparent latch) *‏ هم احتمالاً ناخواسته است ‏هم در مدارهاي سنکرون ‎LFF‏ ‏بهترند چون قبل از پايداري مدار ‏از مقادیر سيگنالهاي مياني 7 نو ا ی مي کند. 64 ‎

صفحه 63:
man bbrary “Id 1 wwe IOCO.On|_Linte_ (IOP oh ext PLO® ts port (D, OL: oi_slowirs a nd otd_ddowe); ‏لس‎ PLOW; orchtcctay (DP PLOP ‏ع‎ ‎brats ‏و‎ ‏تسیا‎ ‏سمب‎ «xa OLOCevet oxnd LUC"; ‏ع> و‎ 0: ead proves; :© لع رگضي صاحب الزماني 4 Modeling of Flip-Flops 65

صفحه 64:
‎for Sheek‏ دب * سنتزکننده ها معمولاً لیست حساسیت را نادیده مي گیرند. ‏°* همه ي ]ها را هم پشتيباني نمي کنند. ‎PES a‏ یم ‎wae supported)‏ ام ) (---_أجوص ساد ) 216106606۵ )توس لیلجت 2000 و لب امد لیلجت توس لسوت سید لیلجت 00/۵ و لب ماد ‎or‏ ‏ی للد تن 66 ‎

صفحه 65:
کی یت ‎for‏ رت R1C1WC_COCE ( rbck_stqad_ wave) vbk_stgrd_ ence’ COCO vad chok_styra_xnve="' thich_stgad _xene='0' vad obok_ stg ‏سمج‎ 6008601١ ‎ox’ OTPBLE vod pbch_stqad_uxve="("'‏ متسه اس ‎vad wot chok_stqrd_wawe'STRBLE‏ جوم _ لمیر 0س اممو اماد ‏1 سر 0076.6 606 5 ‎ale ed‏ صاحب الزماني حامت ف روا سید بح کی ‎ ‎ ‎ ‎

صفحه 66:
۰ In Std_Logic_1164 Ree PAOD 5G (ect UX owl slow) ع ما و سر ما ‎tl RIGIDB_COBE(OK);‏ سمب ‎ao;‏ ‎eal process}‏ B (CLC eves ‏مه‎ ۲ 2 ce OLA bet uch") fr سم ‎eed RIGIOG_COGE;‏ وگو رگضي صاحب الزماني 68

صفحه 67:
Gated Clock * Designers avoid using gated clocks because of problematic timing behavior of the circuit (adds skew). * Low power designs deliberately disable clocks to reduce or eliminate power waste by useless switching of transistors. pro ‏مسا‎ ‎ura wil ۲۱۵/۱۵ ۵۵ Do 1 DGATE} # (OOOTE) ben as; CLK eal proves} رگضي صاحب الزماني 69 4

صفحه 68:
شمارندة يك رقمي ‎For all signaGDich‏ ‎receive an assignment‏ ‎in clocked processes,‏ ‎memory is synthesized.‏ ‎COUNT: 4 FF‏ * ‎(constrained‏ * ‎integer)‏ ‎Qnot used in‏ * ‎clocked process.‏ اشکال: مکانیزم ۲۵50۲ هنكام COUNT Register Inference ‎10K‏ ابا :فك :0064 عبسل نم5 ‎ver WEEE‏ ‏0۰ رهم | ‏۱ ‏00۵۸ سس ‏00۳۵۸ ۱ 0 سای ©0 د © صم وس : ‎000001١‏ امد ‎bers‏ ‎proces (OK)‏ مسا ‎md OL = °C tea‏ مس ‎FOL‏ ‎F (COMO? >= 9) fea‏ © =< ۵۵00 ‎rhe‏ ‎COO <= COOMT +4;‏ ‎won FY‏ ‎ex‏ ‎exe prowess}‏ ‎@Q <= 00007;‏ :© اعم ‎ ‎70 ‎ ‎ ‎

صفحه 69:
* iffelsif - structure * The last elsif has an edge * Noelse * براي 560/26561 سنکرون فقط 011 در لیست حساسیت| قرار مي كيرد (مي توان با ‎wait until‏ هم مدلسازي كرد). * اما براي آسنكرون فقط با ليست حساسيت مي توان مدلسازي كرد * حتماً همة وروديهاي آسنكرو, در ليست حساسيت وارد شوند والا نتيجة شبيه سازي :100 مارا ‎BBO .Onl_ Lore MOE +‏ سس ع ‎DOVOO_PP‏ بسر ‎ROP | kr older‏ ۵۵ ,0 ۵ ) مص ‎a ‎vt ok dex ‎v); ‏ام‎ 00۷00 00: ‏۵ 00۷۵0( 0 مات سا ‎(LK, ROT, GOP)‏ سم ‎۸) ‎act: ‎eb (OLUC ever rd OL = °C) te ‏ع> و‎ 0: ‏بع لمم‎ ead proves; ‎

صفحه 70:
Hardware realization A B A © SEL 2 Hardware realization 68 A SEE ber POO :0 +۵ > رز ‎he‏ :0+0 > رز بع ‎ead‏ eel provesy OXODPLEG, @XOOPLES: proves (O@L0,0) verte PDP : ba; bey POOL =" bea 2۵۵ = ©: whe POP = 0; eal ©: ‏ع> رز‎ 0 + POO; wad proves PXOOPLES; ۰ Ouced ‏حور‎ ‏یلو‎ فقط يك جمع کننده نیاز دارد. اگر ‎٩1‏ دیرتر عن رفع عدار بالايي سریعتر عمل مي كندة7

صفحه 71:
ره ۳ شاه پوس لوط امن موه ).۰ ‎QUT2 <= ((INT+IN2)-+( INS + INA) )+ (INS + ING‏ لابقا فا معا اس رای ‎ ‎۰ Ae ae description the joogest po yee vic Pve, to the ver desorpiod Ute three addiica poeppurcs - soe ppieizaiod took ‏ره‎ ‎dong he descriptivd uzvorday to ‏.جام ساصممت مجنف جك‎ ‎73

صفحه 72:
Source Code Optimization 2 ۱ AP ove oP te topus arrives hier thon vhers, tt coa be choses Por WO t'9 fe LEY koplewecktion. AA AP power ts ‏رم له و‎ 109 could be used Por the stycrad trot ‎Prequediy to the fePt roplewectuiva stave tf posses throug‏ وه ون ‎poly poe udder.‏ ‎QUT <= INT + IN2+ INS + IN + INS + INE ‎

صفحه 73:
سنتز عملگرها بسته به عملگر و عناصر کتابخانه اي (برحسب گيتهاي استاندارد یا برحسب اه ها (یا ماکروسلها در 6810)) ماجولي در اه ایجاد مي شود. این ماجولها برحسب سرعت يا مساحت بهینه شده اند (که کاربر مشخص مي کند) در بعضي سنتز کننده ها مي توان در كد سس ا0ر1نهايي نوشت تا ‎Wis‏ سوه لملاسا یا رربعن طم۳؟) انتخاب کند. وگو رگضي صاحب الزماني 75

صفحه 74:
Example: Adder ‎BOO te‏ ره ‎port (,@ : v ‎a 8 8 ‎vod BOO; Package with “+“functions ‎ ‎ ‎ ‎wwohiectre PRIM LOEMO of BOO te |] rey OLOOOR IY; ۵ ser OCDOOR_LV p_vwrthworte L<=0+0; ‎cea OO) COD ss‏ ل ‎erento);‏ ۵) چم اجه 1 @ ‎et (B,‏ ‎1D: nt oikoxie_uectr (P shout ©) J; rend DOL_OOO; ‎ ‎ ‎BRIM LOEMC vf 00۷ ۵۵‏ جات ‎Il cer chawed‏ ;® + ع> رز ‎eed BRIPLOE MO;‏ ‎Odbontages oP 0 rodge devlaratvs with tateyer pes! 1) Ourtay skouktion: chert Por "pul oP roo...” ‎16 b) Outaq svokess: vy F bt bus widk ‏رگضي صاحب الزماني‎ ‎ ‎

صفحه 75:
IF Structure <-> CASE Structure Different descriptions may be synthesized differenth ‏سس < 6000 م‎ 0 ۳ We 0 ebP (1 <0?) how OO? <= ©; thea ۵ << OO” <= ©; ‏سا‎ OO? <= 0; 00 > ۵: thes vers => p ۱ OO? <= 0; = ‏:سل‎ ‎A ‎B OUT IN yea ‏يلحم‎ ‎IN 17 IN our ۸ eT سنتزکننده ها ممکن است ‎optimize‏ ‏کنند. افرگورگضي صاحب الزماني ۰ 77

صفحه 76:
Variables in 0 Processes * Registers are generated for all variables that might, be read before they are updated OOR_A: proveve(OLAK) OOR_@: provevs(CLKK) rank: POOP : ‏جرج‎ varie POOP : steer; berger beeper B (Olver exnd OL ‏مد(‎ B (Orv axed OL = 'C!) hea PEO = WOT * ‏بج‎ OOTPOT <= PEO + G; OONPOT_W <= POOE + ‏:ل‎ POOP = WOOT * O; OOPPON_D <= POOP +O; el PS weed PS eed pr ead provess O@R_(; ۵086: * How many registers are generated? 78

صفحه 77:
۳۱,۵۳ ۲۵۲ 010016 0 * در بیشتر سنتز کننده ها اگر براي آشكارسازي کلاك, ۵156 به کار برده باشیم انجام نمي دهند (نمي دانند جطور بايد ان را د). 010 سس مسا ‎event onl OL") thew‏ را0) ۶ :0 > تس :© ع> و ل سس اور وگو رگضي صاحب الزماني 79

صفحه 78:
Don’t Care * درشبیه سازها مقایسه با -* در شرطها عموماً نتيجة :۳۸151 مي دهد (هیچگاه مقدار سیگنال < “-” نمي شود): اكر مثلاً 1000“ < ه2” شود شرط 118118 نمي شود. بر مي توان از (52 ,560222]65)51 (در بكيج 232_5]0عتصتام) | 80

صفحه 79:
Synthesis Tips sf itime y character 9 Real* ۴ ‏فا‎ *محدود به ‎estbench‏ 81

صفحه 80:
Synthesis Tips وگو رگضي صاحب الزماني 82

صفحه 81:
Finite State Machines and ‘, 3% VHDL 4 * One- , two- or three- processes * State Coding ٠١ FSM Types * Medvedev * Moore ٠ Mealy ¢ Registered Output وگو رگضي صاحب الزماني

صفحه 82:
State Registers. 60 : whoa GDPERD ‏م جد‎ XSBO_O1 tea GDOVE <= OWWOLE ; wha KOOP => F XSBO_OTPOP tea wher GPOP => F XSBO_OTORD tou ۵۵۵ > 6100001١ ‎vhers => GPONE <= GNORT ;‏ مان ‎ ‏۵ ,0 سم :۵ ۵۵ مسا ‎tora‏ ۵۵ + 6۱08 > ۵۳0۵ ‎fara‏ را نمی مسج )ما ‎vee ODPNE‏ ‎ ‎ ‎ ‎ ‏زع اعم 0 ع لم عاسم ‎exe coer |‏ ‎pod B eer process POD_PP | ‎84 ‎ ‎ ‎

صفحه 83:
۳۵۵ 0۵۵6۵: ‏سس‎ (OPONE , X) ‏معط‎ ‎cee OPOTE tx 0 ‏مد ۵0_01۵عر‎ 0۵۱۵۱۵۵ > 0۵۵ RESET و ۳ ‎P‏ لحم ۳۷۵۸۵ مان ‎START ns MIDDLE‏ 52 ‎Se /‏ : ۵0۵۸ > ۵/۵/۸۵ 00 سییر 5 ‎weal owe | 7‏ ‎ ‎ ‎ ‎ ‎POO_LOBIO ; ۳ a8‏ سدسم لم با ‎PCO_E: process (LK, RBGEP)‏ ‎P ROOOT=C tes‏ ‎GPOVE <= GPORT ;‏ ‎eb OL (Cevect cod OLUE'( tea‏ ‎GPOTE <= OGXP_OPOTE ;‏ :2 لدم 5 ‏ا لو ‎ ‎

صفحه 84:
Structure and Readability * Asynchronous combinatoric # synchronous storing N elements => 2 processes * Graphical FSM (without output equations) resembles, one state process => 1 process Simulation ٠ Error detection easier with two state processes di access to intermediate signals. => 2 processes Synthesis 2 state processes can lead to smaller generic net list and therefore to better synthesis results (depends on synthesizer but in general, it is closer to, 7 ‏و‎ ‎hardware) Ey => 2 processes وگو رگضي صاحب الزماني 86

صفحه 85:
. ص0۵6 ۵۵4 ۱۳۱۵/۲۵ سید OTOP ); piegred GNODD : ONONG_ TCE 5 OPORP -< " 00 " ۰] ‏همین‎ 5 OWOLe -< " 00" OTOP > "dO" OTORT > "@OOa" +] ‏دوي لسر‎ dePot OWOLO > "Odo" ‏نت‎ ‏مومه‎ << "000" | P low (Ht oF otter)! # buy (if oP ottes) } => ‏محص‎ POO! ‏ی‎ 7 8

صفحه 86:
4 رگضي صاحب الزماني ‎(SPORT, OWOLE, ©‏ & ۱/۵۵ 0۳۵۳۱۵ بر ‎POP) ;‏ 0۵۷۸۵ : ۵۳۵/۱۵ سیم ۰ ۲۵ سم مان ۵۵۸۵ مان مان اه مان ‏إعص اع ‎

صفحه 87:
Extension of Type tae OPOPD_DVOE w (SPOR oY); paard OPDPG 1 GOPOVO_PVRO | vw OPONO & wher ODOR wher DDOLE ‏مارد‎ واه مان چا مب جع 00000007 ات ۳ A ‏سید لب - مها و)‎ vitor ‎deve shtew)‏ 16 << 90عم) ‎Oberg to poe hot roday => uccevessay hardware‏ ‎oD ‏۵0-م)‎ => (0 umevroray Ply Pops) ‏پرضي صاحب الزما‎ ‎

صفحه 88:
مس م0 + بلس ‎oP‏ سیون ۰ + Oke PEO + Porebe cooks نمی ۰ ۰ ‏تاه بوخ‎ wwhea deste oboe) منم (( ‎to otl_vexte_vevior‏ ۵۳۳۵۳۵۱۳۷۵ منوا ©); okand OPONG 1 GLOVO_PVCO | ‎OPORD | OPODE_MVPO‏ سدم ‎eaemant DIDOLE | ODOHPO_MVOD‏ ‎varwant OPOP ۵۷۵۵‏ ‎> ‎> ‎pwr OTOP &‏ <كجا0) ‎0/1٠‏ مارد ۵۵ مسانن مارد مان ‎whew‏ ‎eed expe | ‎ ‎90

صفحه 89:
FSM: Medvedev NEXT State STATE ۲ Registers: 8 Dhe oie vevtor rewrwbler te ote veviors > =O Ow ‏مه‎ ‎hterture RPL oP DEOOCOCO & Tue Proveveer orchterture RPL of OBOOCOCO & 7 سا ‎wth Lowe Ol‏ م۱ و6 و6 0 سس امس ۱ 7 ‎prowess (LK, REGO) ‎ ‎prove ‏رن‎ OTOTO) ‎— Dent Ortee Leste rod proves OOO | ‎ ‎ ‎ ‎ ‎

صفحه 90:
v Example (2- -ocess) caer OMBDE te ‏مان‎ و ‎kes DUDOLE => F (Pond 0( bog‏ ‎OEXPEPOME <= OF‏ ۳۹ wif ee hea POP ‏ع(ه مد ه) جح‎ 0 ea ‎SMG Ay‏ ات ‎Ce‏ 5 ‎8 ۳ ‏هم ‏+ .ما : ‎ead provess OM 5 23 ‏فک رس‎ (v1) <= ۵۵ ‏الزماني‎ Lo ‏ل‎ ‎ ‎ ‎ ‎x ‏ماك نسم ‎ ‎ ‎RESET ‎Medvede ‎MwA ‏سس ‎1001 11 ‏لا‎ STATE = Output ‎sublyps STATE TYPE is std_ulogic vestor(t downto 0), coistan! START. : STATE TYPE = ‘00. ‎constant MIDDLE ° STATE_TYPE penstant STDP STATELTYPE ‎ ‎RD 0۵006۵0۵0۵۵‏ امه ‎GOPHONE‏ ۵۱۵۵۵۵۵۱۵۵ نود ‎LOVE |‏ ‎ ‎ ‎PROOCT=1 ton GPOPE <= ۵۵ : ‎eb ‏تیان ليد مجح ارات‎ tow ۵0 > 0۸ ‎pol B ‎2 eal proces ROD;

صفحه 91:
وگو رگضي صاحب الزماني Medvedev Example Waveform CE ‏لشت‎ ‏به‎ ۱۱ LU UU RESET 0 A 0 ‏أ‎ 0 [| ۱ 8 1 | ¥ 0 ‏م ام‎ 2 0 ۳۹ dl I STATE(1:0)|/00 00 (1) = ©POTE => Orde ‏ای‎ 93

صفحه 92:
FSM: Moore NEXT pes, STATE | Stato STATE / output Registers Logie Phe cup vevbr a Pucctou oF fer vite very!’ = P() ‏یه مب‎ ۲ ‎tw‏ 0000۵ ی با ۷ ماس ‎ty‏ 000 تن 0۷ تعاس ‏۵۵0 رن سس ‎ROD:‏ ‏ی ‎i ssn OOPPOP: process (OPOMO)‏ رس لو م ‎OOPPOW: process (e‏ ‎Oulput bows‏ — سا ‎ead process OOTPOT ;‏ تعدبا درف 0) -- :۱00۵ ون ‎eed RL 5 ‎ ‎ ‎ ‎

صفحه 93:
‎Moore Example‏ ها ‏ص ‎poly ou her pred okie,‏ لبط طجه ‎Gree‏ + صر ءا عسي 97016 بو اه م3 5 ‎en‏ ‎aia. fs ame A an ‎subype STATE TYPE i slog vector downto constm START. Stare Tee 7 ۳ ‎Sonstant STOP STATE TYPE ‎vaee ODODE & hea SMBRD => F (B oF @)=(0! bora ‎0۳۵/۱۵۵ > 0۵۵ ‎wes DADOUE => # (B rd B)= fora ‎DEXPENENE <= GOO ; ‎eo ‎hes OTOP => B (P xx ) ‎OEXPEMETE ‏و ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‏۰ 000۵ عن ۲) ماه ۱۵۵ 0۵ نس تست ‎bes‏ ‎REG? preceee (CLE, RESETS beeps‏ > ۵۵۵ _ مد ۵۵2 ۵ ‎tora‏ اجه مسرج زان یر 0۱۵۵۵ > ۵6و ‎ead‏ ‎ ‎ ‎ ‎ ‎ ‎ ‎0" whe SPO ME=DKDOUB or OMNBPE=SPOP eter O's ‎ ‎ ‎pod RPV 5

صفحه 94:
Moore Example Waveform. 7 > 51۸1600 ماسب سوه 3 ‎chem verbo uh ODEN‏ )1/1( وگو رگضي صاحب الزماني 96

صفحه 95:
FSM: Mealy os NEXT, ۲ “3 STATE _ | state STATE output ‏شا‎ IZ Registers oe 2 ‎Provesses‏ مس و ‎erchterture RPL of DEOLY‏ ‎beets ‎— Onate ‏ما‎ “IPerewer wih Dent 1 ‎bow ‏مسج ‏00 ‎Ovi Loxte‏ = ‎ ‎veal proces OD GA eed RPL 5 ‏ل‎ ‎ ‎ ‎ ‎ ‎ ‎

صفحه 96:
0001 ۱۲۱۱۳۱۹۱۳۳۳ ۵۲۵۵ ۵۵ beet vee ODODE & uber OPORD => RESET 10101 a whver DIDLLO => subtype STATE_TYPE is sic_uloge_vecter(1 dewnta 0), constant START - STATE TYP! constant MIDOLE — STATECTY®: constant STOP STATE“TYP! wher OPO => archtecnre RPL of OBO _PCOT veo exard OPODD DOEXPOPOVE : ‏اوه رس‎ ۵۵۷۵ cod RAT

صفحه 97:
Mealy Example (Another RESET 1010" ROO: COO: + -- ‏یی با موی موجه مصطوو()‎ ved subtype STATE_TYPE is sic_uloge_veeter(1 dewrta 0) constant START - STATE TYP! constant MIDOLE — STATECTY®: constant STOP STATE“TYP! ve 0 archtecnre RPL of OBO _PCOT des (OPOPO = OPORD card (D ‏امن‎ 4 5 vr (POND = OKDOL) or exard OPODD DOEXPOPOVE : (©POPO = OPO xxl (D or ) GPTORE_MVPE ; eho ۲: exal RD;

صفحه 98:
افو رکضي صاحب الزماني 0 ا ۲ ‏ات را <2 لوا اس ماه(‎ Dot the "spies" oP ۷ vad L to ‏مومت‎

صفحه 99:
Feed back Woop Modeling Aspects يك + tates hockuare (wo vexrbraicand oii Por ‏(فجقج‎ + Qore Punt y eddovkte ote Vetter, Qoore & preferred bevase oP ae vpercioa * ke oly depres oly ox tte vec. % > cent naa inher ore kde bay be ore ‏ول ناه متس‎ ] wore Rexble, bu doager oP + Ophes + Oewevessary buy pate (waxkounn olock pertod) + Onwwbaratzral Peed buck bev

صفحه 100:
Output Registers Output Registers Output Logie Output Logie optional STATE Registered Output vordey looy poke oad powbetood boy. x State Registers ik poe uddhiond ‏سم سا‎ Otkow addioad plock period

صفحه 101:
Registered Output Exampl (1) ۷ ۱ 2 > ۸ 008: Zot; OMhno beng rape ODODE & hea OPORD => proves (SPODE, O, O) RESET 10101۱۷ ‏8و ی‎ ۷ 4 0۵248 00۳0 2 ۸0۳8: ۳ OOPOOT_ROO: provevs ® OL eve xd OK ۷ vA Let; wend Pj ای (0۳۱۳) سم ام 0۵۰ ۵ 6۷ سای : تک وه : ابر ۱۷ و ‎expr OPOPD, DOXPOEPOVE :‏ ‎OPOPE_AVCO ;‏

صفحه 102:
Reg. Output Example Waveform > STATEC a) Ore ohooh ported dehy bowers OTOP D ced mur coney. put comes wit pooh ede revul on pulpal choad 0 ‏ی ی‎ — )O

صفحه 103:
-- choked ODODE proves RO ‎her Crepe‏ مرا ‎ ‎CoO: ‎ ‎ ‎ ‎ ‎OOTPOT: provess (OOXPOPONO , 0, ©) ‏مسا‎ ‎came DOXPOPOPE uber OTORT ‎ ‎ ‎111۷ <= Anand B: ‎RESET: Ze ore: ‎ ‎ved proms OODPOT ‎ ‎carchteckre RPL oP ROO_MBOTE © ‏تک لاه : ,۷ موه‎ : prep OPDPB, OOXPOPODE + OOTPOT_ROE: provess(CLM) ‎OPOPE_AVCO ; bees ‎# OL eve ‏لعج‎ OLUE'C tre ‏صاحب الزماني ۰ :۷۱ > ۷ ‏عه ره ‎ ‎ ‎ ‎

صفحه 104:
150 1 00 وگو رگضي صاحب الزماني CTU LU Reg. Output Example Waveform 100 50 لبد 190۱ oS Le] 1 8 (ممعتمرة حأ 02 ‏واه تج لجن 9۳۵۲۵ چنیا رولك‎ “Ophes" oP origad Oedy wackke ore yor!

صفحه 105:
* دستگاههاي روي باس با اعلان ۲۳5 ‎mem buffer (F3) sid 7‏ دسترسي به جب باس را آغاز مي كنند. رگضي صاحب الزماني

صفحه 106:
۳۲۸0 1۷۲۲۲ - ‏يك سيكل بعد,‎ ٠ ‏مي شود تا بگوید که يك خواندن‎ "1 ‏مي خواهد انجام شود (یا "0" برای_ ور‎ i ‏نوشتن).‎ رگضي صاحب الزماني

صفحه 107:
*براي خواندن ممکن است 4کلمه ‎a0 42 ub tub (burst read) sl‏ اولین سیکل, ‎burst‏ فعال باشد. ور 9 و رگضي صاحب الزماني

صفحه 108:
*کنترلر به 4 محل از بافر دسترسي مي يابد (به محلهاي بعدي بعد از فعال كردنهاي متوالي ۲6۵0۲ دسترسي ميال هم رگضي صاحب الزماني

صفحه 109:
‎y> mem_buffer‏ طول خواندن ‎ ‏وگورکضي صاحب الزماني فعال مي کند و دو بایت پایین ‎bursk illo: 6 1: .gegal‏ اف ايه ‎ ‎

صفحه 110:
‎(pial A‏ صاحت الزماني ‎ ‎

صفحه 111:
*هنگام نوشتن ۵ فعال مي 7 شود و 121 در محل007655ه ف * خواند تو شتورهون فاطعلان 2620 خاتمه مي 1 ٍ رگضي صاحب الزماني

صفحه 112:
ready ready ready ready burst 7۳ Read_wy kRead_wri te 5 read ready burs! ready, وگو رگضي صاحب الزماني

صفحه 113:
Memory Controller * براي همة حالتها مفروض اسک* وگو رگضي صاحب الزماني

صفحه 114:
library ieee; use ieee.std_logic_1164.all; entity memory controller is port ( reset, read_write, ready, burst, clk : in std_logic; bus id : in std logic_vector(7 downto 0); oe, we : out std logic; addr : out std_logic_vector(1 downto 0)); end memory controller; architecture state_machine of memory controller is type StateType is (idle, decision, read1, read2, read3, read4, write); signal present state, next state : StateType; وگو رگضي صاحب الزماني

صفحه 115:
VHDL Code begin state_comb:process(reset, bus id, present state, burst, read_write, ready) begin if (reset = '1') then u_%Don’t cares assigned to next state e=idle; ‏اه‎ ‎else case present state is when idle => oe <= '0'; we <= '0'; addr <= "00"; if (bus_id = "11110011" and ready = ‘1’) then next_state <= decision; else next_state <= idle; end if; when decision=> oe <= "00"; if (read_write = '1') then else outgadtsyotberidse, unwanted latches. next_state <= write; ‏صاحب الزماني‎ end if:

صفحه 116:
صاحب الزماني 0 addr <= ‘0'; addr <= whenreadl => oe <='1'; we <= “00"; if (ready = '0') then next_state <= read1; elsif (burst = ‘0') then next_state <= idle; else next_state <= read2; end if; when read2 => oe <= "01 if (ready = '1') then next_state <= read3; else next_state <= read2; end if; when read3 => oe <='l'; we <= "10"; if (ready = '1') then next state <= read4; else next state <= read3;

صفحه 117:
VHDL Code ; we <= '0'; addr <= when read4 => oe <=' end process state_comb; ‏صاحب الزماني‎ a1 if (ready = '1') then next state <= idle; else next state <= read4; end if; when write => "00"; if (ready = '1') then next. state <= idle; else next _state <= write; end if end case; end if;

صفحه 118:
VHDL Code state clocked:process(clk) begin if rising edge(clk) then present state <= next state; end if; end process state_clocked; end; وگو رگضي صاحب الزماني

صفحه 119:
تولید خروجیها در ماشينهاي 1۷۲0076 1) خروجيهايي که از بيتهاي حالت به طور 1 قبل) ‎A‏ وركئضي صاحب بیررارآسانتر ‎

صفحه 120:
مر ولید خروجیها در ماشينهاي ۷۲0076[ 2) خروجيهايي که از رجيسترهاي خروجي به طور Inputs State ¢ Registers ——_ ۵ " انتساب به خروجیها باید در خارج ازپروسسي که انتقال حالات در وگن تعاریف ازمطی‌شود انجام گیرد. 7 2

صفحه 121:
architecture state_machine of memory_controller is type StateType is (idle, decision, read1, read2, read3, read4, write); signal present_state, next_state : StateType; signal addr_d: std_logic_vector(1 downto 0); = D-input to addr f-flops begin state_comb:process(bus_id, present_state, burst, read_write, ready) begin case present_state is -- addr outputs not defined when idle <7 'Q;we<= "0; = addr is absent. ‏قرض؛ فقط برای "ده آین کار را‎ ۰ ‏ملفه او ری ی 9 < 14 عناط) عز‎ ‏زماني ند‎ next_state <= decision; ‘7 else next_state <= idle; end if; when decision=> oe <= '0'; we <= '0'; if (read_write = '1') then next_state <= read1; else --read_write next state write: 1 gale fll ‏صاحب‎

صفحه 122:
when read1 => oe <= if (ready = ‘0') then next_state <= read1; elsif (burst = '0') then next_state <= idle; else next_state <= read2; end if; when read2 if (ready = ‘1') then next_state <= read3; else next_state <= read2; end if; when read3 if (ready = '1') then next_state <= read4; else next_state <= read3; end if; ‘we <= we <= oe <= oe <= وگو رکضي صاحب الزماني

صفحه 123:
when read4. => oe <= if (ready = '1') then next state <= idle; else next state <= read4; end if; when write => oe <= if (ready = ‘1') then next. state <= idle; else next_state <= write; end if; end case; end process state_comb; with next_state select -- D-input to addr flip- flops addr_d <= "01" when read2, -- defined here. "10" when read3, "11" when read4, "00" when others; یو رگضي صاحب الزماني

صفحه 124:
state_clocked:process(clk, reset) begin if reset = '1' then present state <= idle; addr <= "00"; -- asynchronous reset for addr flops elsif rising edge(clk) then present_state <= next state; addr <= addr ) ~- value of addr_d stored in addr end if; end process state clocked; end state_machine; وگو رگضي صاحب الزماني

صفحه 125:
#4 تولید خروجیها در ماشینهای 1۷۲0016 7 *مشکلات: 5 2 ۲۳ اضافه. *براي انتشار بيتهاي حالت به ۳۴هاي ۵00۲, از دو مدار تركيبي رد مي شود (اگر در ۳1 از 2 سلول استفاده کند مي تواند فرکانس ماکزیمم را محدود

صفحه 126:
1 ۸ تولید خروجیها در ماشينهاي ‎Moore‏ ‏9 3( خروجيهايي که مستقیماً در بيتهاي حالت انکد شده اند ‎lev)‏ ‎»1L, State encoding ٠‏ بم دقتلنجام شود. ‎٠ 2‏ #هايبيشترولا_زم دارد. ‏رسي صاب النوإي خروجي به مدار تركيبي نياز ندارد ‏ 2[ ‎oy ۳‏ 7 ‎ ‎

صفحه 127:
51 rl ol ol oO] BR] of o s2 ه اد ۵۱ ۵ | ه | ه | سر Idle decisio n Read1 Read2 Read3 Read4 Write State Encoding Addr(1 ) 0 0 ه |ه اد | |ه * فرض: فقط براي 2007 این کار را انجام مي دهیم (براي ‎we‏ ‏و 06 مشکل زماني نداریم) Addr(O ) 0 0 S| RF) of Rio

صفحه 128:
State Encoding * اگر براي ۵ و 06 هم بخواهیم به همین صورت 000006 کنیم: Addr(0 | Addr(1 we ۱0۵ 0 ) ) o 0 0 0 0 Idle 0 0 1 0 0 decisio n 0 1 0 0 0 Read1 | 1 0 3 0 86802 0 1 0 0 1 Read3 | 1 0 1 1 Read4 |; 0 0 : 0 0 Write ‏برئضي صاحب آلزماتي‎ on

صفحه 129:
VHDL Code architecture state_machine of memory controller is -- state signal is a std_logic vector rather than an enumeration type signal state : std_logic_vector(4 downto 0); constant idle: std_logic vector(4 downto 0) : constant decision: std_logic_vector(4 downto 0 "00001"; constant read1_ : std_logic_vector(4 downto 0) constant read2_ : std_logic vector(4 downto 0) constant read3_ : std_logic vector(4 downto 0) constant read4_ : std logic vector(4 downto 0) constant write : std_logic vector(4 downto 0) begin state_tr:process(reset, clk) begin One-process FSM if reset = '1' then state <= idle; elsif rising _edge(clk) then case state is ~- outputs not defined here when idle => if (bus _id = "11110011") then ‏صاحب الزماني‎

صفحه 130:
VHDL Code when decision=> if (read_write = '1') then state <= read: else ~-read_write= state <= write; end if; when read1 state <= read1; elsif (burst = '0') then state <= idle; else state <= read2; end if; when read2 => if (ready = '1') then state <= read3; end if; -- no else; implicit memory وگو رگضي صاحب الزماني

صفحه 131:
when read3. => 1') then read4; -- no else; implicit memory when read4 => if (ready state <= end if; when write if (ready state <= end if; when others state <= end case; end if; end process state tr; -- outputs associated with register values we <= state(1); oe <= state(2); addr <= state(4 downto 3); end state_machine; ‏صاحب الزماني‎

صفحه 132:
State Stated State ثال: يى ‎State2‏ ‏با 2 Stated StateS State State7 States. Stated رگضي صاحب الزماني ‎State10‏ One-Hot Encoding Sequential ‘00000 0001 00010 001i 00100 0101 00110 oon 01000 1001 (01010 One-Hot 22 0 0001 22 0 0 0010 22 022 50 0100 0000000000000 1000 22 1 0000 22 5 020 0000 0000000000100 0000 0000000001000 0000 0000000010000 0000 0000000100000 0000 0000001000000 0000

صفحه 133:
One-Hot Encoding وگو رگضي صاحب الزماني

صفحه 134:
stateO statel state2 S,8;5:8:S,(53l> 00010 01111 10001 cond,cond,cond, أوكر كوك وكيه (بعدي 01111 01111 01111 13 6

صفحه 135:
Sequential ( Encoding 5,602 5 رد ,5 يد +... +0110©. 48 رگ ,5 رگ +... +63 010 .رک گرگ رگ رک +... +0101 .رگ رگ رگ رک +... - و( ‎Dy §,5,5,55,.cond+...+ §,5,555,.COnB+...+ §,8,5,55.cond=‏ Dg, =..+ 55,55, §.Cond + ...+ §,5,5,55,.CONG+ ...+ ‏رک رگ رک‎ 5 3 0 گضي صاحب الزماني > مدار تركيبي بسیار 7 5-3

صفحه 136:
One-Hot Encoding £,=b.cond+ t,,.con@+ t,,.cond * مدار تركيبي بسیار ساده * اما تعداد ‎obj LFF‏ 8 معادلة بسیار ساده به جاي 5 معادلة aie, ‏سطوح كمتر مدار بين ر.‎ > © ‏حالت‎ ‏فرکانس بالاتر‎ > < ۰۲۳0۸ ‏*مناسب براي‎ وگو رگضي صاحب الزماني 22221010100 222211010100 o10 ‘0000000000000 100 ‘0000000000001 ‘000000000000010 ‘0000000000010 00 ‘0000000000100 00 ‘0000000001000 ‘0000000010000 ‘0000000100000 00 1000000010000000 000 om

صفحه 137:
Power Reduction 25510212621 51216 مناسبمي تولند توان مصرفي را کاهش‌دهد. ۰ مثلاً 06-01 در هر سیکل, فقط 2 تغییر سیگنال لازم دارد. ‎٠‏ عوامل دیگر: ‎٠‏ تعداد زيادي رجیستر مي خواهد ٠ء‏ مدار منطقي تولید حالت بعدي > بايد آزمايش كرد. مرئضي صاحب الزمانبوجن0 1۳00 ز۳۵): براي]1٩۳هاي‌شبيم ‎eile‏ ‎a:‏ دا من فد

صفحه 138:
Pipelining چند سیکل انجام مي شوند تقسیم کنیم: 721 *ایدة اصلي: عملیات 12120210 بزرگي را که در یک سیکل ساعت انجام مي شود به چند عمل کوچک که در ۳ 2 2 $| outputs 3 a ale ale on t= x 2 2 ‏عسميم إلا د‎ 3 zh ۳ Ze ale t,= x/3 t,= x/3 t,= x/3 Inputs} Input: inputs|

صفحه 139:
Pipelining 74 ۰ تقریباً 3 برابر مشود (صرفنظر از زمانهایی,؟ و ,با برايرجيسترهاي(6<ذاءمرذم ‎throughput 3°‏ برابر ميشود اما خروجيها 3 كلاكديرتر حاضر مي‌شوند: ‎latency‏ ‏*و نیز هزينة افزودن رجیسترها را دارد. *بیشتر ۳0۸]ها مشكلي ندارند اما در ]۳ ها »ستاعمام كمتر به كار مي رود. ‎array jl passS. > &CPLD*‏ »1و10, عملیات‌زیادیرا می‌تولنند لنجام دهند

صفحه 140:
cu tenet ec src_op ۳ 7

صفحه 141:
AMD AM2901 library ieee; use ieee.std_logic_1164.all; use work.numeric_std.all; use work.am2901_comps.all; entity am2901 is port( clk, rst: in std_logic; a,b: in unsigned(3 downto 0(( -- address. inputs d: in unsigned(3 downto 0); _—_-- direct data i: im std_logic_vector(8 downto 0); -- micro instruction cm: — in std_logi - carry in oe: in std logic; output enable ram0, ram3: inout std_logic; -- shift lines to ram qs0, qs3:_inout std_logic; -- shift lines to q y: buffer unsigned(3 downto 0); -- data outputs (3-state) g_bar,p_bar:buffer std_logic; -- carry generate, propagate buffer std_logic; -- overflow buffer std_logic; -- carryout ‏ماني‎ ‎buffer std_logic; =0

صفحه 142:
architecture am2901 of am2901 is alias dest_ctl: std_logic_vector(2 downto 0) is i(8 downto 6); alias alu_ctl: std_logic_vector(2 downto 0) is i(5 downto 3); alias src_ctl: std_logic_vector(2 downto 0) is i(2 downto 0); signal ad, bd: unsigned(3 downto 0); signal gq: — unsigned(3 downto 0); signal r, s: unsigned(3 downto 0); signal alu_out: — unsigned(3 downto 0); begin -- instantiate and connect components ul: ram_regs port map(clk => clk, rst =: alu_out => alu_out, dest_ctl => dest_ctl, ram0 => ram0, ram3 => ram3, ad => ad, bd => bd); u2: q_reg port map(clk => clk, rst => rst, alu_out = dest_ctl => dest_ctl, alu_out, qs0 => qs0, qs3 => qs3, q => ‏ركو‎ u3: sre_op port map(d => d, ad => ad, bd => bd, q => q, src_ctl => src_ctl, r => 1,8 => 5); u4: alu port map(r => 1, s => s, cn => c_n, alu_ctl => alu_ctl, alu_out => alu_out, g bar => g bar, p bar => p_bar, c_nd => c_n4, ovr => ovr); u5: out_mux port map(ad => ad, alu_out => alu_out, dest_ctl => dest_cti, ‎0e, y => y);‏ >= وه ‎--define f_0 and £3 outputs cas £0 <= '0' when alu_out = "0000" else ‏مضیا صاحب الزماني‎ ‎Pea ‎ ‎ ‎

صفحه 143:
7 آ 00 ۲ 1 1 oP ‏وجبها‎ roa fea ارگ رگضي صاحب الزه ye

صفحه 144:
library ieee; use ieee.std_logic_1164.all; use work.numeric_std.all; use work.am2901_comps.all; entity am2901 is port( clk, rst: in std_logic; a,b: in unsigned(3 downto 0(( -- address. inputs d: in unsigned(3 downto 0); _—_-- direct data i: im std_logic_vector(8 downto 0); -- micro instruction cm: — in std_logi - carry in oe: in std logic; output enable ram0, ram3: inout std_logic; -- shift lines to ram qs0, qs3:_inout std_logic; -- shift lines to q y: buffer unsigned(3 downto 0); -- data outputs (3-state) g_bar_q,p_bar_q:buffer std_logic; -- carry generate, propagate buffer std_logic; -- overflow 'q: — buffer std_logic; -- carry out ‏ماني‎ ‎buffer std_logic; -- alu_out = 0

صفحه 145:
architecture am2901 of am2901 is alias dest_ctl: std_logic_vector(2 downto 0) is i(8 downto 6); i ctl: std logic vector(2 downto 0) is i(5 downto 3); alias sre_ctl: std_logic_vector(2 downto 0) is i(2 downto 0); signal ad, bd: _unsigned(3 downto 0); signal q:' unsigned(3 downto 0); signal r,s: unsigned(3 downto 0); signal alu_out, alu_out_q: — unsigned(3 downto 0); begin -- instantiate and connect components ul: ram_regs port map(clk => clk, rst = alu_out => alu_out_q, dest_cfl => dest_ctl, ram0 => ram0, ram3 => ram3, ad => ad, bd => bd); u2: q_reg port map(clk => clk, rst => rst, alu_out => alu_out dest_ctl => dest ctl, qs0 => qs0, qs3 => qs3, q => q); u3: sre_op port map(d => d, ad =>'ad, bd => bd, a => q, sre_ctl => sre ctl, r => 1, 5 => 5); u4: alu port map(r => r,s => s, cn => ¢ n, alu ctl => alu_ctl, alu_out => alu_out, g bar => g_bar, p_bar => p_bar, end => ¢ nd, ovr => ovr) u5: out_mux port map(ad => ad, alu_out => alu_out, dest_ctl => dest_ctI, oe => 0e, y => y); rst, a => a,b =>b, --define f_0 and £3 outputs £0 <= '0' when alu_out _q = "0000" else ' £3 <= alu_out _q(3); ‏صاحب الزماني‎ No change

صفحه 146:
process (clk) if (rising_edge(clk) then alu_out_q <= alu_out;

صفحه 147:
References * Wayne Wolf, FPGA-Based System Design, Prentice Hall, 2004. * Ulrich Heinkel, Martin Padeffke, Werner Haas, Thomas Buerner, Herbert Braisz, Thomas Gentner, Alexander Grassmann, The VHDL Reference: A Practical Guide to Computer-Aided Integrated Circuit Design including VHDL-AMS , John Wiley & Sons, 2000. وگو رگضي صاحب الزماني

‏Synthesis مرتضي صاحب الزماني 1 What is Synthesis? • 2 Transformation of an abstract description into a more detailed description • "+" operator is transformed into a gate netlist • "if (VEC_A = VEC_B) then" is realized as a comparator which controls a multiplexer مقايسه) به گيتهاي،AND، OR • عملگرهاي ساده (مثل مي•شوند اما عملگرهاي پيچيده تر مثلTransformation مشخصي تبديل مرتضي صاحب الزماني تبديل ميtool ماکروسلهاي خاص آن ضرب ابتدا به depends on several Field Programmable Gate Array (FPGA) 3 مرتضي صاحب الزماني چرخه ي طراحي براي FPLDها • مزايا: • کوتاه شدن پروسه ي طراحي. • نوآوري بيشتر (پروسه ي طراحي به مراحل باالتر رفتاري منتقل مي شود) (تشابه با زبانهاي سطح باال) • Debugطرح بسيار آسانتر و سريعتر. برنامه کامپاي اجرا • مانند سيکل برنامه نويسي ل ويراي نويسي: ش ورود طرح کامپاي شبيه سنتز شبيه ل سازي سازي ويراي ويراي ش ش • تغييرات در طرح بسيار آسانتر. مرتضي صاحب الزماني 4 Synthesizability 5 • Only a subset of VHDL is synthesizable • Different Tools support different subsets • records? • arrays of integers? • clock edge detection? • sensitivity list? • ... مرتضي صاحب الزماني Different Language Support for Synthesis 6 مرتضي صاحب الزماني How to Do? • • • 7 Macrocells • adder • comparator • Bus interface Constraints • speed • area • power Optimizations • boolean: mathematic • gate: technological مرتضي صاحب الزماني Non-functional requirements • Performance: – Clock speed is generally a primary requirement. – Usually expressed as a lower bound. • Design cycle and Timing Closure • Size: – Determines manufacturing cost. – If your design doesn’t fit into one size FPGA, you must use the next larger FPGA. – For very large designs: multi-FPGAs. • Power/energy: – Power/Energy related to battery life and heat. • May have more cost: – More expensive packaging to dissipate heat. – More extreme measures (e.g. cooling fans). – Many digital systems are power- or energylimited. 8 مرتضي صاحب الزماني Mapping into an FPGA • Must choose the FPGA: – Capacity. – Pinout/package type. – Maximum speed. 9 مرتضي صاحب الزماني Synthesis Process in Practice • باوجود مکانيزمهاي بهينه سازي ،ممکن است بعد از سنتز ،همة محدوديتها برآورده نشده باشند تکرار مرتضي صاحب الزماني 10 Path delay • Combinational network delay is measured over paths through network. • Can trace a causality chain from inputs to worst-case output. 11 مرتضي صاحب الزماني Path delay example network graph model 12 مرتضي صاحب الزماني Critical path • Critical path = path which creates longest delay. • Can trace transitions which cause delays that are elements of the critical delay path. 13 مرتضي صاحب الزماني Critical path through delay graph 14 مرتضي صاحب الزماني Delay Paths in a design 15 مرتضي صاحب الزماني False paths • Logic gates are not simple nodes—some input changes don’t cause output changes. • A false path is a path which never happens due to Boolean gate conditions. • False paths cause pessimistic delay estimates. 16 مرتضي صاحب الزماني Placement and delay • Placement helps determine routing. • Routing determines wire length. • Wire length determines capacitive load. • Capacitive load determines delay. 17 مرتضي صاحب الزماني Example: Adder placement and delay • N-bit adder: (optimal placement) + 18 + + + مرتضي صاحب الزماني Bad placement and routing With no delay constraints. placement 19 routing مرتضي صاحب الزماني Bad placement and routing •Adder has been distributed throughout the FPGA. •I/O pins have been spread around the chip.  P&R algorithms do not catch on to regularity. 20 مرتضي صاحب الزماني Better placement and routing With delay constraints. • Better but far from optimal (less spread out horizontally but spread out vertically) 21 مرتضي صاحب الزماني How to improve? • Use macros (optimized), • Put constraints on the placement of objects, • Hand place objects. – Example: later. 22 مرتضي صاحب الزماني Power Optimization 23 مرتضي صاحب الزماني Power optimization • Transitions cause power consumption. • Logic network design helps control power consumption: – minimizing capacitance; – eliminating unnecessary glitches. 24 مرتضي صاحب الزماني Power optimization • Leakage in more advanced processes. – Even when logic is idle. – The only way: disconnect the power supply from the logic when not needed for some time. – It generally takes a considerable period (larger than a clock period) to reconnect power and let the circuits stabilize. 25 مرتضي صاحب الزماني Glitching example • Gate network: 26 مرتضي صاحب الزماني Glitching example behavior • NOR gate produces 0 output at beginning and end: – beginning: bottom input is 1; – end: NAND output is 1; • Difference in delay between application of primary inputs and generation of new NAND output causes glitch. 27 مرتضي صاحب الزماني Adder Chain Glitching d a+b+c c+d +d a+b a+b+c c +c a+b a+b a+ b 28 bad good مرتضي صاحب الزماني Explanation • Unbalanced chain has signals arriving at different times at each adder. • A glitch downstream propagates all the way upstream. • Balanced tree introduces multiple glitches simultaneously, reducing total glitch activity. 29 مرتضي صاحب الزماني Factorization for low power • Proper factorization reduces ac glitching. ac a: High transition probability bad 30 good مرتضي صاحب الزماني Factorization techniques • In example, a has high transition probability, b and c low probabilities. • Reduce number of logic levels through which high-probability signals must travel in order to reduce propagation of glitches. 31 مرتضي صاحب الزماني Example (ALU) • ALU output is not used for every cycle   If ALU inputs change, the energy is needlessly consumed 32 مرتضي صاحب الزماني Example (ALU) • Control Signal selects whether data is allowed to pass the logic or the previous value is held to avoid transitions. Dat a Logic D Q Control 33 مرتضي صاحب الزماني Layout for low power • Place and route to minimize capacitance of nodes with high glitching activity. • Feed back wiring capacitance values to power analysis for better estimates. 34 مرتضي صاحب الزماني State assignment for low power • Later 35 مرتضي صاحب الزماني Case Study • 16 x 16 multiplier example. 36 مرتضي صاحب الزماني The FPGA design process • Xilinx ISE (Integrated Synthesis Environment) – Translation from HDL. • (Synthesis, Translation) – Logic synthesis. • (Mapping) – Placement and routing. • (Place and Route) – Configuration generation. • (Program File Generation) 37 مرتضي صاحب الزماني Design experiments • Synthesize with no constraints. • Synthesize with timing constraint. – Tighten timing constraint. • Synthesize with placement constraints. • Power: – Many tools don’t allow us to directly specify power consumption  must rewrite our h/w description for better power consumption characteristics. 38 مرتضي صاحب الزماني Post-translation simulation model • No timing or area constraints • HDL model in terms of FPGA primitives. • Example: X_LUT4 \p12_Madd__n0015_Mxor_Result_Xo<1>1 ( .ADR0(x_7_IBUF), .ADR1(y_13_IBUF), .ADR2(c12[7]), .ADR3(row12[8]), .O(row13[7]) ); 39 مرتضي صاحب الزماني Mapping report Design Summary -------------Number of errors: 0 Number of warnings: 0 Logic Utilization: Number of 4 input LUTs: 501 out of 1,024 48% Logic Distribution: Number of occupied Slices: 255 out of 512 49% Number of Slices containing only related logic: 255 out of 255 100% Number of Slices containing unrelated logic: 0 out of 255 0% *See NOTES below for an explanation of the effects of unrelated logic Total Number 4 input LUTs: 501 out of 1,024 48% Number of bonded IOBs: 64 out of 92 69% Total equivalent gate count for design: 3,006 Additional JTAG gate count for IOBs: 3,072 Peak Memory Usage: 64 MB 40 مرتضي صاحب الزماني Static timing analysis report Timing constraint: TS_P2P = MAXDELAY FROM TIMEGRP "PADS" TO TIMEGRP "PADS" 99.999 uS ; 20135312 items analyzed, 0 timing errors detected. (0 setup errors, 0 hold errors) Maximum delay is 20.916ns. -------------------------------------------------------------------------------- 42 After Mapping:  estimated delays (no مرتضي صاحب الزماني information about interconnects) Static timing report: delays along paths Data Sheet report: ----------------All values displayed in nanoseconds (ns) Pad to Pad ------------------+----------------------+-----------+ Source Pad |Destination Pad| Delay | ------------------+----------------------+-----------+ x<0> |p<0> | 5.824| x<0> |p<10> | 10.675| x<0> |p<11> | 11.214| x<0> |p<12> | 11.753| 43 مرتضي صاحب الزماني Static timing after routing Timing constraint: TS_P2P = MAXDELAY FROM TIMEGRP "PADS" TO TIMEGRP "PADS" 99.999 uS ; 20135312 items analyzed, 0 timing errors detected. (0 setup errors, 0 hold errors) Maximum delay is 38.424ns. ------------------------------------------------------------------• (vs 20.916 ns in mapping report) Because of interconnect delays. 45 مرتضي صاحب الزماني Timing constraint • Use timing constraint editor: 46 مرتضي صاحب الزماني Post-map static timing report Timing constraint: TS_P2P = MAXDELAY FROM TIMEGRP "PADS" TO TIMEGRP "PADS" 32 nS ; Pad to pad 20135312 items analyzed, 0 timing errors detected. (0 setup errors, 0 hold errors) Maximum delay is 20.916ns. Hasn’t changed since this design has limited opportunities for logic synthesis to change delays by restructuring logic. 47 مرتضي صاحب الزماني Post-routing static timing report Timing constraint: TS_P2P = MAXDELAY FROM TIMEGRP "PADS" TO TIMEGRP "PADS" 32 nS ; 20135312 items analyzed, 0 timing errors detected. (0 setup errors, 0 hold errors) Maximum delay is 31.984ns. Tools generally try to meet the delay goal as closely as possible to minimize area. 48 مرتضي صاحب الزماني Tighter timing constraints • Tighten requirement to 25 ns. • Post-place-route timing report: Timing constraint: TS_P2P = MAXDELAY FROM TIMEGRP "PADS" TO TIMEGRP "PADS" 25 nS ; 20135312 items analyzed, 11 timing errors detected. (11 setup errors, 0 hold errors) Maximum delay is 31.128ns. 49 مرتضي صاحب الزماني Report on a violated path Slack: -6.128ns (requirement - data path) Source: y<0> (PAD) Destination: p<30> (PAD) Requirement: 25.000ns Data Path Delay: 31.128ns (Levels of Logic = 31) Modify the logic and/or physical design to improve the delay. 50 مرتضي صاحب الزماني Power report Power summary: I(mA) P(mW) ---------------------------------------------------------------Total estimated power consumption: 333 --Vccint 1.50V: 0 0 Vccaux 3.30V: 100 330 Vcco33 3.30V: 1 3 --Inputs: 0 0 Logic: 0 0 Outputs: Vcco33 0 0 Signals: 0 0 --Quiescent Vccaux 3.30V: 100 330 Quiescent Vcco33 3.30V: 1 3 Thermal summary: ---------------------------------------------------------------Estimated junction temperature: 36C Ambient temp: 25C Case temp: 35C Theta J-A: 34C/W 51 Helps us determine whether we need additional cooling. مرتضي صاحب الزماني Improving area • Floorplanner window: – Floorplanner  View/edit placed design LEs Chip floorplan • Green rectangles : mapped componen ts to CLBs 52 مرتضي صاحب الزماني Rat’s nest wiring • If you click on a component in the deign hierarchy window, its rat’s nest is shown. 53 مرتضي صاحب الزماني Routing editor view • FPGA Editor  View/Edit Routed Design 54 مرتضي صاحب الزماني Editing constraints • Use constraints editor to place constraints: – 55 This tool allws you to constrain the placement of logic as well as the assignment of chip I/Os to IOBs (e.g useful for PCB design) مرتضي صاحب الزماني Design browser pane 56 مرتضي صاحب الزماني Drag and drop constraints 57 مرتضي صاحب الزماني Change the shape of constraints 58 مرتضي صاحب الزماني Full set of placement constraints • We place the rows of the multiplier one below the other to create the row structure of the floorplan. 59 مرتضي صاحب الزماني Placement results 60 مرتضي صاحب الزماني New timing report • After placement constraints: 19742142 items analyzed, 0 timing errors detected. (0 setup errors, 0 hold errors) Maximum delay is 29.934ns. • Compares to 31 ns for unconstrained placement. 61 مرتضي صاحب الزماني Combinational Process: Sensitivity List Library IEEE; use IEEE.Std_Logic_1164.all; entity IF_EXAMPLE is port (A, B, C, X : in std_ulogic_vector(3 downto 0); Z : out std_ulogic_vector(3 downto 0)); end IF_EXAMPLE; architecture A of IF_EXAMPLE is begin process (A, B, C, X) begin if ( X = "1110" ) then Z <= A; elsif (X = "0101") then Z <= B; else Z <= C; end if; 62 end process; مرتضي صاحب الزماني Combinational Process: Sensitivity List process (A, B, SEL) begin if SEL = `1` then Z <= A; else Z <= B; end if; end process; • • • If SEL is missing in the sensitivity list, what will the behavior (simulation) be? Sensitivity list is usually ignored during synthesis. Equivalent behavior of simulation model and hardware   All signals which are read are entered into the sensitivity list. مرتضي صاحب •63 Complete if-statement for the synthesisالزماني of Combinational Process: Incomplete Assignments Library IEEE; use IEEE.Std_Logic_1164.all; entity INCOMP_IF is port (A, B, SEL :in std_ulogic; Z : out std_ulogic); end INCOMP_IF; architecture RTL of INCOMP_IF is begin process (A, B, SEL) begin if SEL = `1` then Z <= A; end if; end process; end RTL; 64 • • What is the value of Z, if SEL = `0` ? What hardware would be generated during synthesis ? ’SEL = ‘1 هنگامNهNي كLatch تNسNفافاNNش .)Transparent latch( • • هم احتماال ٌ ناخواسته است • هاFF • هم در مدارهاي سنكرون بهترند چون قبل از پايداري مدار تركيبي از مقادير سيگنالهاي مياني الزماني صاحب .جلوگيري مي كند مجاز مرتضي غير Modeling of Flip-Flops Library IEEE; use IEEE.Std_Logic_1164.all; entity FLOP is port (D, CLK Q end FLOP; : in std_ulogic; : out std_ulogic); architecture A of FLOP is begin process begin wait until CLK`event and CLK=`1`; Q <= D; end process; end A; 65 مرتضي صاحب الزماني Description of Rising Clock Edge for Synthesis • ل ا ً ليست حساسيت راN• سنتزكننده ها معمو .ناديده مي گيرند .ها را هم پشتيباني نمي كنندwait • همه ي  synthesis: IEEE • Standard wait until ياif :عناصرحافظه براي for خاص1076.6 به صورت ... if condition RISING_EDGE ( clock_signal_ name) (not always supported) clock_signal_ name'EVENT and clock_signal _name='1' clock_signal _name='1' and clock_signal_ name'EVENT not clock_signal_ name'STABLE and clock_signal_ name='1' clock_signal _name='1' and not clock_signal_ name'STABLE 66 مرتضي صاحب الزماني Description of Rising Clock Edge for Synthesis • • ... wait until condition RISING_EDGE ( clock_signal_ name) clock_signal_ name'EVENT and clock_signal _name='1' clock_signal _name='1' and clock_signal_ name'EVENT not clock_signal_ name'STABLE and clock_signal_ name='1' clock_signal _name='1' and not clock_signal_ name'STABLE clock_signal _name='1' 67 IEEE 1076.6 is not yet fully supported by all tools مرتضي صاحب الزماني Description of Rising Clock Edge for Synthesis • process begin wait until RISING_EDGE(CLK); Q <= D; end process; 68 In Std_Logic_1164 functionpackage RISING_EDGE (signal CLK : std_ulogic) return boolean is begin if ( CLK`event and CLK =`1` and CLK`last_value=`0`) then return true; else return false; end if; end RISING_EDGE; مرتضي صاحب الزماني Gated Clock • • Designers avoid using gated clocks because of problematic timing behavior of the circuit (adds skew). Low power designs deliberately disable clocks to reduce or eliminate power waste by useless switching of transistors. process begin wait until RISING_EDGE(CLK ); if (DGATE) then Q <= D; end process; 69 D DGATE mu x DFF Q CLK مرتضي صاحب الزماني Register Inference Library IEEE; use IEEE.Std_Logic_1164.all; entity COUNTER is port ( CLK : in std_ulogic; Q : out integer range 0 to 15 ); end COUNTER; architecture A of COUNTER is signal COUNT : integer range 0 to 15 ; begin process (CLK) begin if CLK`event and CLK = `1` then if (COUNT >= 9) then COUNT <= 0; else COUNT <= COUNT +1; end if; end if; end process; Q <= COUNT; end A; 70 • شمارندة يك رقمي BCD For all signals which receive an assignment in clocked processes, memory is synthesized. • COUNT: 4 FF • (constrained integer) • Q not used in clocked process. هنگامreset مكانيزم:اشكال روشن شدن ندارد مرتضي صاحب الزماني Asynchronous Set/Reset Library IEEE; use IEEE.Std_Logic_1164.all; entity ASYNC_FF is port ( D, CLK, SET, RST : in std_ulogic ; Q : out std_ulogi c); end ASYNC_FF; architecture A of ASYNC_FF is begin process (CLK, RST, SET) begin if (RST = `1`) then Q <= `0`; elsif SET ='1' then Q <= '1'; elsif (CLK`event and CLK = `1`) then Q <= D; end if; end process; 71 end A; • • • if/elsif - structure The last elsif has an edge No else سنكرونset/reset • براي در ليست حساسيتclk فقط قرار مي گيرد (مي توان با هم مدلسازيwait until .)كرد • اما براي آسنكرون فقط با ليست حساسيت مي توان مدلسازي كرد • حتما ً همة وروديهاي آسنكرون در ليست حساسيت وارد شوند واال نتيجة شبيه سازي .متفاوت مي شود با سنتز مرتضي صاحب الزماني Coding Style Influence • EXAMPLE1: process (SEL,A,B) begin Direct implementation if SEL = `1` then Z <= A + B; else Z <= A + C; end if; end process EXAMPLE1; • Manual resource sharing فقط يك جمع كننده نياز .دارد ديرترSEL اگر مي رسد مدار بااليي سريعتر 72 .عمل مي كند • • EXAMPLE2: process (SEL,A,B) variable TMP : bit; begin if SEL = `1` then TMP := B; else TMP := C; end if; Z <= A + TMP; end process EXAMPLE2; مرتضي صاحب الزماني Source Code Optimization • An operation can be described very efficiently for synthesis, e.g.: • 73 In one description the longest path goes via five, in the other description via three addition components - some optimization tools automatically change the description according to the given constraints. مرتضي صاحب الزماني Source Code Optimization • • 74 If one of the inputs arrives later than others, it can be chosen for IN6 in the left implementation. If power is a consideration, IN6 could be used for the signal that changes more frequently in the left implementation since it passes through only one adder. مرتضي صاحب الزماني سنتز عملگرها • • • بسته به عملگر و عناصر كتابخانه اي (برحسب گيتهاي استاندارد يا برحسب logic cellها (يا ماكروسلها در ))ASICماجولي در netlist ايجاد مي شود. اين ماجولها برحسب سرعت يا مساحت بهينه شده اند (كه كاربر مشخص مي كند) در بعضي سنتز كننده ها مي توان در كد ‏VHDL commentهايي نوشت تا مثال ً Carry- Lookaheadيا Ripple Carryانتخاب كند. مرتضي صاحب الزماني 75 Example: Adder entity ADD is port (A, B : in integer range 0 to 7; Z : out integer range 0 to 15); end ADD; architecture ARITHMETIC of ADD is begin Z <= A + B; end ARITHMETIC; library VENDOR_XY; use VENDOR_XY.p_arithmetic.all; entity MVL_ADD is port (A, B : in stdlogic_vector (3 downto 0); Z : out stdlogic_vector (4 downto 0) ); end MVL_ADD; architecture ARITHMETIC of MVL_ADD is begin Z <= A + B; // not allowed end ARITHMETIC; • 76 Notice: Advantages of a range declaration with integer types: a) During simulation: check for "out of range..." b) During synthesis: only 4 bit bus width مرتضي صاحب الزماني • IF Structure <-> CASE Structure Different descriptions may be synthesized differently ··· if (IN > 17) then OUT <= A ; elsif (IN < 17) then OUT <= B ; else OUT <= C ; end if ; ··· 77 ··· case IN is when 0 to 16 => OUT <= B ; when 17 => OUT <= C ; when others => OUT <= A ; end case ; ··· optimize سنتزكننده ها ممكن است .كنند • مرتضي صاحب الزماني • • 78 Variables in Clocked Processes Registers are generated for all variables that might be read before they are updated VAR_1: process(CLK) variable TEMP : integer; begin VAR_2: process(CLK) variable TEMP : integer; begin if (CLK'event and CLK = '1') then TEMP := INPUT * 2; OUTPUT_A <= TEMP + 1; OUTPUT_B <= TEMP + 2; end if; end process VAR_1; if (CLK'event and CLK = '1') then OUTPUT <= TEMP + 1; TEMP := INPUT * 2; end if; end process VAR_2; How many registers are generated? مرتضي صاحب الزماني ELSE for Clock Checking • در بيشتر سنتز كننده ها اگر براي آشكارسازي كالك else ,به كار برده باشيم انجام نمي دهند (نمي دانند چطور بايد آن را سنتز كرد). )process(CLK ‏begin ‏if (CLK`event and CLK=`1`) then ;Q <= D ‏else ;Q <= A ;end if ;end process مرتضي صاحب الزماني 79 Don’t Care • درشبيه سازها مقايسه با ‘ ’-در شرطها عموما ً نتيجة FALSEمي دهد (هيچگاه مقدار سيگنال = ‘ ’-نمي شود): )”when (a = “1--- …. • اگر مثال ً ”a = “1000شود شرط TRUEنمي شود. براي اين منظور مي توان از )( stdmatch(s1, s2در پکيج )numeric_stdا ))”when (std_match(a, “1--- …. • همة حاالت ‘ ’-را آزمايش مي كند. مرتضي صاحب الزماني 80 Synthesis Tips غير:time وcharacter وReal• نتزNNلسNابNق نويسي وtestbench •محدود به .مدلسازي Shared variables: not to be used in synthesizable code - Loops must have a fixed range - 'while' constructs usually cannot be synthesized Some aggregate constructs may not be supported by your synthesis tool 81 Synthesis tools map enumerations onto a suitable bit pattern automatically. مرتضي صاحب الزماني Synthesis Tips Arrays: Only integer index sets are supported by all synthesis tools Some synthesizers support up to two dimensions Aliases are not always supported by synthesis tools Procedures: Default parameters should not be used in synthesizable code (since some synthesizers initialize absent parameters with type’left  inconsistent with simulation) 82 مرتضي صاحب الزماني Finite State Machines and VHDL • One- , two- or threeprocesses • State Coding • FSM Types • Medvedev • Moore • Mealy • Registered Output 83 مرتضي صاحب الزماني One-Process FSM FSM_FF: process (CLK, RESET) begin if RESET='1' then STATE <= START ; elsif CLK'event and CLK='1' then case STATE is when START => if X=GO_MID then STATE <= MIDDLE ; end if ; when MIDDLE => if X=GO_STOP then STATE <= STOP ; end if ; when STOP => if X=GO_START then STATE <= START ; end if ; when others => STATE <= START ; end case ; end if ; end process FSM_FF ; 84 مرتضي صاحب الزماني Two-Process FSM FSM_LOGIC: process ( STATE , X) begin case STATE is when START => if X=GO_MID then NEXT_STATE <= MIDDLE ; end if ; when MIDDLE => ... when others => NEXT_STATE <= START ; end case ; end process FSM_LOGIC ; FSM_FF: process (CLK, RESET) begin if RESET='1' then STATE <= START ; elsif CLK'event and CLK='1' then STATE <= NEXT_STATE ; 85 end if; مرتضي صاحب الزماني How Many Processes? • • • 86 Structure and Readability • Asynchronous combinatoric ≠ synchronous storing elements => 2 processes • Graphical FSM (without output equations) resembles one state process => 1 process Simulation • Error detection easier with two state processes due to access to intermediate signals. => 2 processes Synthesis • 2 state processes can lead to smaller generic net list and therefore to better synthesis results (depends on synthesizer but in general, it is closer to hardware) => 2 processes مرتضي صاحب الزماني State Encoding type STATE_TYPE is ( START, MIDDLE, STOP ) ; signal STATE : STATE_TYPE ; • State encoding responsible for safety of FSM START -> " 00 " MIDDLE -> " 01 " STOP -> " 10 " • Default encoding: binary START -> " 001 " MIDDLE -> " 010 " STOP -> " 100 " • Speed optimized default encoding: one hot if {log2(# of states) ≠log2(# of states)} => unsafe FSM! 87 مرتضي صاحب الزماني Encoding of CASE Statement type STATE_TYPE is (START, MIDDLE, S TOP) ; signal STATE : STATE_TYPE ; ··· case STATE is when START => · · · when MIDDLE => · · · when STOP => · · · when others • Adding the "when others" choice => · · · end case ; Not necessarily safe; some synthesis tools will ignore "when others" choice 88 مرتضي صاحب الزماني Extension of Type Declaration type STATE_TYPE is (START, MIDDLE, STOP, DUM MY) ; signal STATE : STATE_TYPE ; ··· case STATE is when START => ··· when MIDDLE => ··· when STOP => ··· when DUMMY => ··· -- or when others end case ; • • • Adding dummy values Only for binary encoding Advantages: • Safe FSM after synthesis {2 log2(# of states) - n} dummy states (n=20 => 12 dummy states) 89 Changing to one hot coding => unnecessary hardware (n=20 => 12 unnecessary Flip Flops) مرتضي صاحب الزماني Hand Coding subtype STATE_TYPE is std_ulogic_vector (1 downto 0) ; signal STATE : STATE_TYPE ; constant START : STATE_TYPE := "01"; constant MIDDLE : STATE_TYPE := "11"; constant STOP : STATE_TYPE := "00"; ··· case STATE is when START => ··· when MIDDLE => ··· when STOP => ··· when others => ··· end case ; 90 • • • • • • Defining constants Control of encoding Safe FSM Portable design Disadvantage: More effort (especially when design changes) مرتضي صاحب الزماني FSM: Medvedev • The output vector resembles the state vector: Two Processes architecture RTL of MEDVEDEV is ... begin REG: process (CLK, RESET) begin -- State Registers Inference end process REG ; CMB: process (X, STATE) begin -- Next State Logic end process CMB ; Y <= S ; end RTL ; 91 Y=S One Process architecture RTL of MEDVEDEV is ... begin REG: process (CLK, RESET) begin -- State Registers Inference with Logic Block end process REG ; Y <= S ; end RTL ; مرتضي صاحب الزماني Medvedev Example (2Process) CMB: process (A,B,STATE) begin case STATE is when START => if (A or B)='0' then NEXTSTATE <= MIDDL E; end if ; when MIDDLE => if (A and B)='1' then NEXTSTATE <= STOP ; architecture RTL of MEDVEDEV_TEST is signal STATE,NEXTSTATE : STATE _TYPE ; begin REG: process (CLK, RESET) begin if RESET='1' then STATE <= START ; elsif CLK'event and CLK='1' then STATE <= NEXTSTATE ; end if ; 92 end process REG; end if ; when STOP => if (A xor B)='1' then NEXTSTATE <= STAR T; end if ; when others => NEXTSTATE <= ST ART ; end case ; end process CMB ; -- concurrent signal assignments for output (Y,Z) <= STATE ; مرتضي صاحب الزماني end RTL ; Medvedev Example Waveform • 93 (Y,Z) = STATE => Medvedev machine مرتضي صاحب الزماني FSM: Moore • The output vector is a function of the state vector: Two Processes architecture RTL of MOORE is ... begin REG: process (CLK, RESET) begin -- State Registers Inference with Next State Logic end process REG ; OUTPUT: process (STATE) begin -- Output Logic end process OUTPUT ; end RTL ; 94 Y = f(S) Three Processes architecture RTL of MOORE is ... begin REG: -- Clocked Process CMB: -- Combinational Process OUTPUT: process (STATE) begin -- Output Logic end process OUTPUT ; end RTL ; مرتضي صاحب الزماني Moore Example • Since outputs depend only on the current state, no signals other than STATE appears in the sensitivity list. CMB: process (A,B,STATE) begin architecture RTL of MOORE_TEST is signal STATE,NEXTSTATE : STATE_TYPE ; begin REG: process (CLK, RESET) begin if RESET='1' then STATE <= START ; elsif CLK'event and CLK='1' then STATE <= NEXTSTATE ; end if ; end process REG ; 95 case STATE is when START => if (A or B)='0' then NEXTSTATE <= MIDDLE ; end if ; when MIDDLE => if (A and B)='1' then NEXTSTATE <= STOP ; end if ; when STOP => if (A xor B)='1' then NEXTSTATE <= START ; end if ; when others => NEXTSTATE <= START ; end case ; end process CMB ; -- concurrent signal assignments for output Y <= ‘1’ when STATE=MIDDLE else ‘0’ ; Z <= ‘1’ when STATE=MIDDLE or STATE=STOP else ‘0’; end RTL ; مرتضي صاحب الزماني Moore Example Waveform • 96 (Y,Z) changes simultaneously with STATE  Moore machine مرتضي صاحب الزماني FSM: Mealy • The output vector is a function of the state vector and the input vector: Y = f(X,S) Two Processes Three Processes architecture RTL of MEALY is ... begin MED: process (CLK, RESET) begin -- State Registers Inference with Next State Logic end process MED ; architecture RTL of MEALY is ... begin REG: -- Clocked Process OUTPUT: process (STATE, X) begin -- Output Logic end process OUTPUT ; 97 RTL ; end X) CMB: -- Combinational Process OUTPUT: process (STATE, begin -- Output Logic end process OUTPUT ; صاحب الزماني مرتضي end RTL ; Mealy Example architecture RTL of MEALY_TEST is signal STATE,NEXTSTATE : STATE_TYPE ; begin 98 REG: · · · -- clocked STATE process CMB: · · · -- Like Medvedev and Moore Examples OUTPUT: process (STATE, A, B) begin case STATE is when START => Y <= '0' ; Z <= A and B ; when MIDLLE => Y <= A nor B ; Z <= '1' ; when STOP => Y <= A nand B ; Z <= A or B ; when others => Y <= '0' ; Z <= '0' ; end case; end process OUTPUT; مرتضي صاحب الزماني end RTL ; Mealy Example (Another Code) architecture RTL of MEALY_TEST is signal STATE,NEXTSTATE : STATE_TYPE ; begin 99 REG: · · · -- clocked STATE process CMB: · · · -- Like Medvedev and Moore Examples -- Concurrent signal assignments for outputs Y <= ‘1’ when (STATE = MIDDLE and (A or B) = ‘0’) or (STATE = STOP and (A and B) = ‘0’) else ‘0’; Z <= ‘1’ when (STATE = START and (A and B) = ‘1’) or (STATE = MIDDLE) or (STATE = STOP and (A or B) = ‘1’) else ‘0’; end RTL ; مرتضي صاحب الزماني Mealy Example Waveform • • 10 0 (Y,Z) changes with input => Mealy machine Note the "spikes" of Y and Z in the waveform مرتضي صاحب الزماني Modeling Aspects • • • 10 1 Medvedev is too inflexible • but less hardware (no combinational circuit for output) • More effort to calculate state vector. Moore is preferred because of safe operation • since o/p depends only on state vector.   next output values are stable long before the next clock edge. Mealy more flexible, but danger of • Spikes • Unnecessary long paths (maximum clock period) • Combinational feed back loops مرتضي صاحب الزماني Registered Output • • Avoiding long paths and combinational loops. With one additional clock period • Without additional clock period 10 2 مرتضي صاحب الزماني Registered Output Example (1) REG: · · · -- clocked STATE process CMB: · · · -- Like other Examples OUTPUT: process (STATE, A, B) begin case STATE is when START => Y_I<= '0' ; Z_I<= A and B ; ··· end process OUTPUT architecture RTL of REG_TEST is signal Y_I , Z_I : std_ulogic ; signal STATE,NEXTSTATE : STATE_TYPE ; begin 10 3 -- clocked output process OUTPUT_REG: process(CLK) begin if CLK'event and CLK='1' then Y <= Y_I ; Z <= Z_I ; end if ; end process OUTPUT_REG ; صاحب الزماني مرتضي end RTL ; Reg. Output Example Waveform • • 10 4 One clock period delay between STATE and output changes. Input changes with clock edge result in an output change. (Danger of unmeant values ) مرتضي صاحب الزماني Registered Output Example (2) REG: · · · -- clocked STATE process CMB: · · · -- Like other Examples OUTPUT: process ( NEXTSTATE , A, B) begin case NEXTSTATE is when START => Y_I<= '0' ; Z_I<= A and B ; architecture RTL of REG_TEST2 is signal Y_I , Z_I : std_ulogic ; signal STATE,NEXTSTATE : STATE_TYPE ; begin 10 5 ··· end process OUTPUT OUTPUT_REG: process(CLK) begin if CLK'event and CLK='1' then Y <= Y_I ; مرتضي صاحب الزماني Z <= Z_I ; Reg. Output Example Waveform • • 10 6 No delay between STATE and output changes. "Spikes" of original Mealy machine are gone! مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E FSM SRAM ADDR1 ADDR0 CLK 10 7 Data bus • دستگاههاي روي باس با اعالن دسترسي بهmem_buffer (F3) يid .باس را آغاز مي كنند Memor y Array مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E FSM SRAM ADDR1 ADDR0 CLK 10 8 Data READ_WRITE = ,• يك سيكل بعد ‘’ مي شود تا بگويد كه يك خواندن1 ’ براي0‘ مي خواهد انجام شود (يا .)نوشتن Memor y Array مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E FSM SRAM ADDR1 ADDR0 CLK كلمه4 •براي خواندن ممكن است بايد در مدت:)باشدburst read( اي . فعال باشدburst ,اولين سيكل 10 9 Data Memor y Array مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E FSM SRAM ADDR1 ADDR0 CLK محل از بافر دسترسي مي4 •كنترلر به يابد (به محلهاي بعدي بعد از فعال 11 دسترسي ميready كردنهاي متوالي 0 Data Memor y Array مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E FSM SRAM ADDR1 ADDR0 CLK 11 1 Data را برايoe • كنترلر ل خواندنN در طوmem_buffer فعال مي كند و دو بايت پايين افزايشburst آدرس را در حالت Memor y Array مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E FSM Data SRAM ADDR1 ADDR0 CLK Memor y Array .•نوشتن هميشه يك كلمه اي است 11 2 مرتضي صاحب الزماني Case Study (Memory Controller) BUS_ID Addres s Reset OE READY WE BURST READ_WRIT E CLK FSM Data SRAM ADDR1 ADDR0 Memor y Array فعال ميwe •هنگام نوشتن address در محلdata شود و .شود نوشته مي مي خاتمهready اعالن نوشتن با • خواندن و 11 3 مرتضي صاحب الزماني دياگرام حالت synch reset idle ready ready ready . burst ready Decisio n Read_wri Read_wri te te Write 11 4 read1 read4 ready ready . burst read2 ready read3 مرتضي صاحب الزماني Memory Controller • براي همة حالتها مفروض است: ‏ready ‏state مرتضي صاحب الزماني 11 5 VHDL Code (2-process) library ieee; use ieee.std_logic_1164.all; entity memory_controller is port ( reset, read_write, ready, burst, clk : in std_logic; bus_id : in std_logic_vector(7 downto 0); oe, we : out std_logic; addr : out std_logic_vector(1 downto 0)); end memory_controller; architecture state_machine of memory_controller is type StateType is (idle, decision, read1, read2, read3, read4, write); signal present_state, next_state : StateType; 11 6 مرتضي صاحب الزماني VHDL Code 11 7 begin state_comb:process(reset, bus_id, present_state, burst, read_write, ready) begin if (reset = '1') then •Don’t cares assigned to oe <= '-'; we <= '-'; addr <= "--"; outputs  optimized next_state <= idle; else case present_state is when idle => oe <= '0'; we <= '0'; addr <= "00"; if (bus_id = "11110011“ and ready = ‘1’) then next_state <= decision; else next_state <= idle; end if; when decision=> oe <= '0'; we <= '0'; addr <= "00"; if (read_write = '1') then next_state <= In read1; every case, a signal must be assigned to the outputs; otherwise, unwanted latches. else --read_write='0' مرتضي صاحب الزماني next_state <= write; end if; 11 8 when read1 => oe <= '1'; we <= '0'; addr <= "00"; if (ready = '0') then next_state <= read1; elsif (burst = '0') then next_state <= idle; else next_state <= read2; end if; when read2 => oe <= '1'; we <= '0'; addr <= "01"; if (ready = '1') then next_state <= read3; else next_state <= read2; end if; when read3 => oe <= '1'; we <= '0'; addr <= "10"; if (ready = '1') then next_state <= read4; مرتضي صاحب الزماني else next_state <= read3; VHDL Code 11 9 when read4 => oe <= '1'; we <= '0'; addr <= "11"; if (ready = '1') then next_state <= idle; else next_state <= read4; end if; when write => oe <= '0'; we <= '1'; addr <= "00"; if (ready = '1') then next_state <= idle; else next_state <= write; end if; end case; end if; end process state_comb; مرتضي صاحب الزماني VHDL Code state_clocked:process(clk) begin if rising_edge(clk) then present_state <= next_state; end if; end process state_clocked; end; 12 0 مرتضي صاحب الزماني توليد خروجيها در ماشينهاي Moore )1خروجيهايي كه از بيتهاي حالت به طور تركيبي ديكد شده اند( :كد قبل) ‏outputs ‏Output ‏Logic ‏CurrentNext- State ‏State ‏State Registers • مزايا: • گويايي كد • نگهداري آسانتر مرتضي صاحب الزماني ‏Inputs ‏NextState ‏Logic • اشكال: • كند 12 1 توليد خروجيها در ماشينهاي Moore )2خروجيهايي كه از رجيسترهاي خروجي به طور موازي ديكد مي شوند: ‏outputs ‏Output ‏Registers ‏Output ‏Logic ‏CurrentNext- State ‏State ‏State Registers ‏Inputs ‏NextState ‏Logic • انتساب به خروجيها بايد در خارج ازپروسسي كه انتقال حاالت در الزمانيشود انجام گيرد. تعريف مي آن مرتضي صاحب 12 2 12 3 architecture state_machine of memory_controller is type StateType is (idle, decision, read1, read2, read3, read4, write); signal present_state, next_state : StateType; signal addr_d: std_logic_vector(1 downto 0); -D-input to addr f-flops begin state_comb:process(bus_id, present_state, burst, read_write, ready) begin case present_state is -- addr outputs not defined when idle => oe <= '0'; we <= '0'; - اين كار راaddr فقط براي:• فرض addr is absent. oe وwe انجام مي دهيم (براي if (bus_id = "11110011“ and ready = ‘1’) then )مشكل زماني نداريم next_state <= decision; else next_state <= idle; end if; when decision=> oe <= '0'; we <= '0'; if (read_write = '1') then next_state <= read1; مرتضي صاحب الزماني else --read_write='0' next_state <= write; when read1 => oe <= '1'; we <= '0'; if (ready = '0') then next_state <= read1; elsif (burst = '0') then next_state <= idle; else next_state <= read2; end if; when read2 => oe <= '1'; we <= '0'; if (ready = '1') then next_state <= read3; else next_state <= read2; end if; when read3 => oe <= '1'; we <= '0'; if (ready = '1') then next_state <= read4; else next_state <= read3; end if; 12 4 مرتضي صاحب الزماني when read4 => oe <= '1'; we <= '0'; if (ready = '1') then next_state <= idle; else next_state <= read4; end if; when write => oe <= '0'; we <= '1'; if (ready = '1') then next_state <= idle; else next_state <= write; end if; end case; end process state_comb; with next_state select flops addr_d <= "01" when read2, "10" when read3, "11" when read4, "00" when others; 12 5 -- D-input to addr flip-- defined here. مرتضي صاحب الزماني state_clocked:process(clk, reset) begin if reset = '1' then present_state <= idle; addr <= "00"; -- asynchronous reset for addr flops elsif rising_edge(clk) then present_state <= next_state; addr <= addr_d; -- value of addr_d stored in addr end if; end process state_clocked; end state_machine; 12 6 مرتضي صاحب الزماني توليد خروجيها در ماشينهاي Moore •مشكالت: • FF 2اضافه. •براي انتشار بيتهاي حالت به FFهاي ,addrاز دو مدار تركيبي رد مي شود (اگر در PLDاز 2سلول استفاده كند مي تواند فركانس ماكزيمم را محدود كند) ‏Output outputs ‏Registe ‏rs ‏Output ‏Logic ‏Current ‏Next- State -State ‏State Registe ‏rs مرتضي صاحب الزماني ‏Inputs ‏NextState ‏Logic 12 7 توليد خروجيها در ماشينهاي Moore )3خروجيهايي كه مستقيما ً در بيتهاي حالت انكد )Medvedev شده اند ( ‏outputs (مانند ‏Next- State ‏Currentشمارنده ها): ‏State RegistersState ‏Inputs ‏NextState ‏Logic • State encodingبNNايد بNNه NدNقNتاNنNجام شNNود. • FFهايبNNيشتريالNNزNم دارد. صاحب الزماني مرتضي • براي خروجي به مدار ترکيبي نياز ندارد 12 8 State Encoding we اين كار را انجام مي دهيم (برايaddr فقط براي:• فرض ) مشكل زماني نداريمoe و Addr(0 Addr(1 ) ) 12 9 0 0 0 0 Idle s2 s1 0 0 0 0 0 1 decisio n 0 Read1 0 x 1 0 Read2 0 x x 0 0 1 Read3 0 x x 0 1 1 Read4 1 1 0 0 Write 1 x 0 مرتضي صاحب الزماني State Encoding encode هم بخواهيم به همين صورتoe وwe • اگر براي :کنيم Addr(0 Addr(1 ) ) 0 0 13 0 0 0 Idle we oe s0 0 0 0 0 0 1 1 0 decisio 0 n 0 0 Read1 0 1 0 1 0 Read2 0 1 0 0 1 Read3 0 1 0 1 1 Read4 1 0 0 0 0 Write مرتضي صاحب الزماني VHDL Code 13 1 architecture state_machine of memory_controller is -- state signal is a std_logic_vector rather than an enumeration type signal state : std_logic_vector(4 downto 0); constant idle : std_logic_vector(4 downto 0) := "00000"; constant decision: std_logic_vector(4 downto 0) := "00001"; constant read1 : std_logic_vector(4 downto 0) := "00100"; constant read2 : std_logic_vector(4 downto 0) := "01100"; constant read3 : std_logic_vector(4 downto 0) := "10100"; constant read4 : std_logic_vector(4 downto 0) := "11100"; constant write : std_logic_vector(4 downto 0) := "00010"; begin state_tr:process(reset, clk) begin -- One-process FSM if reset = '1' then state <= idle; elsif rising_edge(clk) then case state is -- outputs not defined here when idle => مرتضي صاحب الزماني if (bus_id = "11110011") then state <= decision; VHDL Code when decision=> if (read_write = '1') then state <= read1; else --read_write='0' state <= write; end if; when read1 => if (ready = '0') then state <= read1; elsif (burst = '0') then state <= idle; else state <= read2; end if; when read2 => if (ready = '1') then state <= read3; end if; -- no else; implicit memory 13 2 مرتضي صاحب الزماني when read3 => if (ready = '1') then state <= read4; end if; -- no else; implicit memory when read4 => if (ready = '1') then state <= idle; end if; -- no else; implicit memory when write => if (ready = '1') then state <= idle; end if; -- no else; implicit memory when others => state <= "-----"; -- don't care if undefined state end case; end if; end process state_tr; 13 3 -- outputs associated with register values we <= state(1); oe <= state(2); addr <= state(4 downto 3); end state_machine; مرتضي صاحب الزماني One-Hot Encoding One-Hot Sequential State 00000000000000 0001 00000 State0 00000000000000 0010 00001 State1 00000000000000 0100 00010 State2 00000000000000 1000 00011 State3 00000000000001 0000 00100 State4 00000000000010 0000 00101 State5 00000000000100 0000 00110 State6 00000000001000 0000 00111 State7 00000000010000 0000 01000 State8 00000000100000 0000 01001 State9 00000001000000 01010 State10 13 0000 4 ت .لNN حاN يNراNN بFF اNNتN • يک:• مثال باFSM . حالت18 مرتضي صاحب الزماني One-Hot Encoding :FSM بخشي از:فرض State2 State17 cond1 cond2 State15 cond 3 cond3 13 5 مرتضي صاحب الزماني State2 State1 7 One-Hot Encoding cond1 cond2 State1 5 Sequential )الف Encoding cond 3 cond3 s4s3s2s1s0( ديNعNNN)ب cond1cond2cond3 s4s3s2s1s0ي ( Nجار …. ) state0 state1 01111 1--------- 00010 state2 ... 01111 --0---- ---- 01111 state1 5 state1 6 13 6 01111 -1-------- 10001 الزماني state1مرتضي صاحب 7 One-Hot Encoding s4s3s2s1s0( ديNعNN)ب cond1cond2con s4s3s2s1s0( جا d3…. يN)ر state0 Sequential )الف Encoding state1 01111 1--------- 00010 state2 ... 01111 --0---- --- 01111 state1 5 state1 6 01111 s0 10001 State D ...- s14-s-3-s-2s- 1-s-0-.cond 1 ... s4s173s2s1s0.cond3 ... s4 s3 s2 s1s0.cond2 Ds1 ... s4 s3 s2s1s0.cond1 ... s4s3s2s1s0.cond3 ... s4 s3 s2 s1s0.cond2 Ds2 ... s4 s3 s2s1s0.cond1 ... s4s3s2s1s0.cond3 ... s4 s3 s2 s1s0.cond2 Ds3 ... s4 s3 s2s1s0.cond1 ... s4s3s2s1s0.cond3 ... s4 s3 s2 s1s0.cond2 Ds4 ... ... 13 7 مدار ترکيبي بسيار .بسيار پيچيده مرتضي صاحب الزماني One-Hot Encoding ‏t15 t2.cond1 t17.cond2 t15.cond3 ‏State ‏One-Hot ‏State0 • مدار ترکيبي بسيار ساده 000000000000000 001 ‏State1 • اما تعداد FFها زياد 000000000000000 010 ‏State2 000000000000000 100 ‏State3 000000000000001 000 • 18معادلة بسيار ساده به جاي 5معادلة بسيار ‏State4 پيچيده 000000000000010 000 ‏State5 رجيسترهاي  سطوح کمتر مدار بين حالت 000000000001000 ‏State6 000000000000100 000 000  فرکانس باالتر • مناسب براي .FPGA مرتضي صاحب الزماني ‏State7 000000000010000 000 ‏State8 000000000100000 000 ‏State9 000000001000000 000 ‏State10 13000000010000000 8 000 Power Reduction • State assignmentمNناسNبمNي تNNواNند تNNواNن مNصرفي را کNNاهشدNهد. • مثال ً One-hotدر هر سيکل ،فقط 2تغيير سيگنال الزم دارد. • عوامل ديگر: • تعداد زيادي رجيستر مي خواهد • مدار منطقي توليد حالت بعدي  بايد آزمايش کرد. مرتضي صاحب • الزماني :Gray EncodingبNNراNيFSMهايشNNبيهN ها مNناسNبتNNر. شNNمارNندهN 13 9 Pipelining Registe rs Inputs Registe rs بزرگي را که در يکdatapath عمليات:• ايدة اصلي د به چند عمل کوچک که درNسيکل ساعت انجام مي شو :چند سيکل انجام مي شوند تقسيم کنيم outputs Datapat h Operati on 14 0 tp= x/3 tp= x/3 tp= x/3 Registe rs Part 1 Registe rs Part 1 Registe rs Part 1 Inputs Registe rs tp = x outputs مرتضي صاحب الزماني Pipelining • fتNNNقريNبا ً 3بNNراNبر مNيشNNود (صNNرفنNNظر از زNمانNهNاي tcoو tsu بNNراNيرNجيسترهاي(pipeline • throughput 3بNNراNبر مNيشNNود اNما خروNجيهNا 3کNNالکدNيرتر حاضر مNيشNNوندlatency : • و نيز هزينة افزودن رجيسترها را دارد. • بيشتر FPGAها مشکلي ندارند اما در CPLDها pipelineکمتر به کار مي رود. • CPLDها در يNNک passاز ،logic arrayعملياتزNيادNيرا مNيتNNواNنNند اNنNجام دNهند مرتضي صاحب الزماني 14 1 Example: AMD AM2901 src_op 14 2 مرتضي صاحب الزماني AMD AM2901 library ieee; use ieee.std_logic_1164.all; use work.numeric_std.all; use work.am2901_comps.all; entity am2901 is port( clk, rst: in std_logic; a, b: in unsigned(3 downto 0); -- address inputs d: in unsigned(3 downto 0); -- direct data i: in std_logic_vector(8 downto 0); -- micro instruction c_n: in std_logic; -- carry in oe: in std_logic; -- output enable ram0, ram3: inout std_logic; -- shift lines to ram qs0, qs3: inout std_logic; -- shift lines to q y: buffer unsigned(3 downto 0); -- data outputs (3-state) g_bar,p_bar:buffer std_logic; -- carry generate, propagate ovr: buffer std_logic; -- overflow مرتضي صاحب الزماني c_n4: buffer std_logic; -- carry out 14 f_0: buffer std_logic; -- f = 0 3 architecture am2901 of am2901 is alias dest_ctl: std_logic_vector(2 downto 0) is i(8 downto 6); alias alu_ctl: std_logic_vector(2 downto 0) is i(5 downto 3); alias src_ctl: std_logic_vector(2 downto 0) is i(2 downto 0); signal signal signal signal begin ad, bd: unsigned(3 downto 0); q: unsigned(3 downto 0); r, s: unsigned(3 downto 0); alu_out: unsigned(3 downto 0); -- instantiate and connect components u1: ram_regs port map(clk => clk, rst => rst, a => a, b => b, alu_out => alu_out, dest_ctl => dest_ctl, ram0 => ram0, ram3 => ram3, ad => ad, bd => bd); u2: q_reg port map(clk => clk, rst => rst, alu_out => alu_out, dest_ctl => dest_ctl, qs0 => qs0, qs3 => qs3, q => q); u3: src_op port map(d => d, ad => ad, bd => bd, q => q, src_ctl => src_ctl, r => r, s => s); u4: alu port map(r => r, s => s, c_n => c_n, alu_ctl => alu_ctl, alu_out => alu_out, g_bar => g_bar, p_bar => p_bar, c_n4 => c_n4, ovr => ovr); u5: out_mux port map(ad => ad, alu_out => alu_out, dest_ctl => dest_ctl, oe => oe, y => y); 14 4 -- define f_0 and f3 outputs f_0 <= '0' when alu_out = "0000" else 'Z'; f3 <= alu_out(3); مرتضي صاحب الزماني Pipelined AM2901 براي هماهنگي زماني خروجيها مرتضي صاحب الزماني ‏src_op 14 5 Pipelined AMD AM2901 library ieee; use ieee.std_logic_1164.all; use work.numeric_std.all; use work.am2901_comps.all; entity am2901 is port( clk, rst: in std_logic; a, b: in unsigned(3 downto 0); -- address inputs d: in unsigned(3 downto 0); -- direct data i: in std_logic_vector(8 downto 0); -- micro instruction c_n: in std_logic; -- carry in oe: in std_logic; -- output enable ram0, ram3: inout std_logic; -- shift lines to ram qs0, qs3: inout std_logic; -- shift lines to q y: buffer unsigned(3 downto 0); -- data outputs (3-state) g_bar_q,p_bar_q:buffer std_logic; -- carry generate, propagate ovr_q: buffer std_logic; -- overflow مرتضي صاحب الزماني c_n4_q: buffer std_logic; -- carry out 14 f_0: buffer std_logic; -- alu_out = 0 6 architecture am2901 of am2901 is alias dest_ctl: std_logic_vector(2 downto 0) is i(8 downto 6); alias alu_ctl: std_logic_vector(2 downto 0) is i(5 downto 3); alias src_ctl: std_logic_vector(2 downto 0) is i(2 downto 0); signal signal signal signal begin No change 14 7 ad, bd: unsigned(3 downto 0); q: unsigned(3 downto 0); r, s: unsigned(3 downto 0); alu_out, alu_out_q: unsigned(3 downto 0); -- instantiate and connect components u1: ram_regs port map(clk => clk, rst => rst, a => a, b => b, alu_out => alu_out_q, dest_ctl => dest_ctl, ram0 => ram0, ram3 => ram3, ad => ad, bd => bd); u2: q_reg port map(clk => clk, rst => rst, alu_out => alu_out _q, dest_ctl => dest_ctl, qs0 => qs0, qs3 => qs3, q => q); u3: src_op port map(d => d, ad => ad, bd => bd, q => q, src_ctl => src_ctl, r => r, s => s); u4: alu port map(r => r, s => s, c_n => c_n, alu_ctl => alu_ctl, alu_out => alu_out, g_bar => g_bar, p_bar => p_bar, c_n4 => c_n4, ovr => ovr); u5: out_mux port map(ad => ad, alu_out => alu_out, dest_ctl => dest_ctl, oe => oe, y => y); -- define f_0 and f3 outputs f_0 <= '0' when alu_out _q = "0000" else 'Z'; f3 <= alu_out _q(3); مرتضي صاحب الزماني Pipelined AMD AM2901 process (clk) if (rising_edge(clk) then alu_out_q <= alu_out; g_bar_q <= g_bar; p_bar_q <= p_bar; ovr_q <= ovr; c_n4_q <= c_n4; end if; end process; end am2901; 14 8 مرتضي صاحب الزماني References • Wayne Wolf, FPGA-Based System Design, Prentice Hall, 2004. • Ulrich Heinkel, Martin Padeffke, Werner Haas, Thomas Buerner, Herbert Braisz, Thomas Gentner, Alexander Grassmann, The VHDL Reference: A Practical Guide to Computer-Aided Integrated Circuit Design including VHDL-AMS , John Wiley & Sons, 2000. 14 9 مرتضي صاحب الزماني

62,000 تومان