ãŸããçŽ æŽãããããã¥ã¡ã³ãAN82156 Designing PSoC Creator Components with UDB Datapathsããå§ãããŸãã ãã®äžã«ãå žåçãªãœãªã¥ãŒã·ã§ã³ãšããã€ãã®æšæºãããžã§ã¯ãããããŸãã ããã«ãããã¥ã¡ã³ãã®åé ã§éçºã¯UDBãšãã£ã¿ãŒã䜿çšããŠå®è¡ãããæåŸã«åãã£ãŠãããŒã¿ãã¹æ§æããŒã«ã䜿çšããŠå®è¡ãããŸããã€ãŸããããã¥ã¡ã³ãã¯éçºã®ãã¹ãŠã®åŽé¢ãã«ããŒããŸãã ããããæ®å¿µãªãããåäžã®PSoCãããã®äŸ¡æ ŒãèŠããšããã®ããã¥ã¡ã³ãã§èª¬æãããŠããåé¡ãã解決ã§ããªãå Žåãã³ã³ãããŒã©ãŒã¯éåžžã«é倧è©äŸ¡ãããŠãããšèšããŸãã PWMãšæšæºã·ãªã¢ã«ããŒãã¯ãPSoCãªãã§å®è¡ã§ããŸãã 幞ããªããšã«ãPSoCã¿ã¹ã¯ã®ç¯å²ã¯ã¯ããã«åºãã§ãã ãããã£ãŠãAN82156ãèªã¿çµããããä»ã®ã€ã³ã¹ãã¬ãŒã·ã§ã³ã®æºãæ¢ãå§ããŸãã
次ã«åœ¹ç«ã€ãœãŒã¹ã¯ãPSoC Creatorã«ä»å±ã®ãµã³ãã«ã§ãã ç§ã¯ãã§ã«ãäŒç€Ÿææžã®ç¿»èš³ã®äžéšã®1ã€ãžã®ã¡ã¢ã§ããããåç §ããŠããŸãïŒ ãã¡ããã芧ãã ãã ïŒã ãããã¯ããããããã«ä¿åãããŸãïŒãã£ã¹ã¯ã¯ç°ãªãå ŽåããããŸãïŒïŒ
EïŒ\ Program FilesïŒx86ïŒ\ Cypress \ PSoC Creator \ 4.2 \ PSoC Creator \ psoc \ content \ CyComponentLibraryã
* .vãã¡ã€ã«ãã€ãŸããVerilogããã¹ãããŸãã¯* .vhdãæ¢ãå¿ èŠããããŸããããã¯ãVHDLèšèªã®æ§æã説æããããã«ããå°ãå¿ èŠãªããã§ãã åé¡ã¯ããããã¯äŸã§ã¯ãªããæ¢æã®ãœãªã¥ãŒã·ã§ã³ã§ãããšããããšã§ãã ããã¯çŽ æŽããããå®å šã«ãããã°ãããŠããŸãããåçŽãªããã°ã©ããŒã¯ãµã€ãã¬ã¹ã®ããã°ã©ããŒãšã¯ç°ãªãç®æšãæã£ãŠããŸãã ç§ãã¡ã®ä»äºã¯ãçæéã§è£å©çãªããšãããããšã§ãããã®åŸãç§ãã¡ã®ãããžã§ã¯ãã§ããã䜿ãå§ããã»ãšãã©ã®æéãè²»ãããŸãã ä»æ¥ç§ãã¡ã«å²ãåœãŠãããã¿ã¹ã¯ãçæ³çã«è§£æ±ºããå¿ èŠããããææ¥ã¯ãã¹ãŠããããã«ç°ãªãå¥ã®ãããžã§ã¯ãã«åãã³ãŒããæ¿å ¥ãããå Žåãææ¥ã¯ãã®ç¶æ³ã§ãããçµäºããŸãã ãµã€ãã¬ã¹éçºè ã«ãšã£ãŠãã³ã³ããŒãã³ãã¯æçµè£œåã§ãããããã»ãšãã©ã®æéãè²»ããããšãã§ããŸãã ãããŠããããã¯ãã¹ãŠãã¹ãŠãæäŸããªããã°ãªããŸããã ã§ãããããããã®ããã¹ããèŠããšããç§ã¯æ²ããæããŸããã æåã®éçºã®ã€ã³ã¹ãã¬ãŒã·ã§ã³ãåŒãåºãå Žæãæ¢ãå§ããã°ããã®äººã«ã¯ãããŸãã«ãè€éã§ãã ããããåèæžãšããŠããããã®ããã¹ãã¯éåžžã«é©ããŠããŸãã ããªãèªèº«ã®ãã®ãäœæãããšãã«å¿ èŠãªå€ãã®è²Žéãªãã¶ã€ã³ããããŸãã
ãŸããéåžžã«èå³æ·±ãã³ãŒããŒããããŸãã äŸãã°ãä»ãç§ã¯ããã¿ãŒãªã€ã«ãã®ã¹ã¿ã€ã«ã§ãã¢ããªã³ã°ã®ããã®ã¢ãã«ããããŸãïŒæãå³ããæåž«ã¯ãã¢ããªã³ã°ã以å€ã®æ¹æ³ã§ã·ãã¥ã¬ãŒã·ã§ã³ã翻蚳ããããšãç§ã«æããšã©ãŸãããŸããïŒã ãããã¯ã«ã¿ãã°ã«ãããŸãã
EïŒ\ Program FilesïŒx86ïŒ\ Cypress \ PSoC Creator \ 4.2 \ PSoC Creator \ warp \ lib \ sim
Verilogããã°ã©ãã«ãšã£ãŠæãèå³æ·±ããã£ã¬ã¯ããªã¯æ¬¡ã®ãšããã§ãã
EïŒ\ Program FilesïŒx86ïŒ\ Cypress \ PSoC Creator \ 4.2 \ PSoC Creator \ warp \ lib \ sim \ presynth \ vlg
ããã¥ã¡ã³ãå ã®ã³ã³ããŒãã³ãã®èª¬æã¯é©åã§ãã ãã ããããã§ã¯ãã¹ãŠã®æšæºã³ã³ããŒãã³ãã®åäœã¢ãã«ã«ã€ããŠèª¬æããŸãã ããã¯ãããã¥ã¡ã³ããããåªããŠããå ŽåããããŸãïŒéãèšèªã§æžãããŠãããããã€ãã®éèŠãªè©³çŽ°ãçç¥ãããŠããŸãïŒã ãã®ã³ã³ããŒãã³ããŸãã¯ãã®ã³ã³ããŒãã³ãã®åäœãæ確ã§ãªãå Žåã¯ããã®ãã£ã¬ã¯ããªã®ãã¡ã€ã«ã衚瀺ããŠãã³ã³ããŒãã³ããæ£ç¢ºã«ç解ããŠã¿ã䟡å€ããããŸãã æåã¯Googleã§æ€çŽ¢ããããšããŸããããèŠã€ãã£ããã©ãŒã©ã ã§åºäŒã£ãã®ã¯æšè«ã ãã§ã詳现ã¯ãããŸããã§ããã 詳现ã¯æ¬¡ã®ãšããã§ãã
ããã«ãããããããåèæžã¯çŽ æŽãããã§ãããã©ãã§æç§æžãæ¢ãã¹ãããäœããåŠã¶ã¹ãã§ããïŒ æ£çŽãªãšãããç¹å¥ãªããšã¯äœããããŸããã äžè¬ã«ãUDB Editorã®æ¢è£œã®è¯ãäŸã¯ã»ãšãã©ãããŸããã çªç¶ãRGB LEDããã¬ã€ããããšã«æ±ºãããšããUDB Editorã®äžã§çŸããäŸãèŠã€ããŸããïŒãµã€ã¯ã«å šäœãéå§ããèšäºã§æžããŸããïŒã ãã ããæ€çŽ¢ãšã³ãžã³ã§å€ãã®äœæ¥ãè¡ãå Žåã¯ãDatapath Config Toolã®äŸããŸã ãããŸãããã®ããããã®ããŒã«ã®äœ¿çšæ¹æ³ãå šå¡ãç解ã§ããããã«ã åã®èšäºãäœæããŸãã ã ãããŠãå€ãã®äŸãéããããŠããçŽ æŽãããããŒãžãããã«ãããŸã ã
ãã®ããŒãžã«ã¯ããµãŒãããŒãã£ã®éçºè ã«ããéçºããµã€ãã¬ã¹ã«ãã£ãŠæ€èšŒãããŠããŸãã ã€ãŸãããŸãã«å¿ èŠãªãã®ã§ããç§ãã¡ã¯ãµãŒãããŒãã£ã®éçºè ã§ããããŸãããæ£ç¢ºã«æ€èšŒããããã®ããåŠã³ããã®ã§ãã ãã®ããŒãžãèŠã€ããäŸ-å¹³æ¹æ ¹ããŒããŠã§ã¢èšç®æ©ãèŠãŠã¿ãŸãããã ãšã³ããŠãŒã¶ãŒã¯ãããä¿¡å·åŠçãã¹ã«å«ããåè·¯ã«ã³ã³ããŒãã³ããæããŸãã ãã®äŸã§ã¯ãåæ§ã®ã³ãŒããåæããããã®ãã¬ãŒãã³ã°ãè¡ããŸããããããã°ã誰ããèªåã®æ°Žæ³³ãå§ããããšãã§ããŸãã ãã®ãããå¿ èŠãªãµã³ãã«ã¯ãªã³ã¯ããããŠã³ããŒãã§ããŸãã
調ã¹ãŸãã äŸãããïŒèª°ããåå¥ã«æ€èšããŸãïŒã\ CJCU_SquareRoot \ Library \ CJCU_SquareRoot.cylibãã£ã¬ã¯ããªã«ã©ã€ãã©ãªããããŸãã
ã¿ã€ãïŒæŽæ°ãŸãã¯åºå®å°æ°ç¹ïŒããã³ãããããšã«è§£æ±ºçããããŸãã ããã«æ³šæããå¿ èŠããããŸãã UDBãšãã£ã¿ãŒã§éçºããå Žåã®æ±çšæ§ã¯åªããŠããŸãããããŒã¿ãã¹ç·šéããŒã«ã䜿çšããŠéçºããå Žåãã芧ã®ãšããã人ã ã¯ãã®ããã«èŠãããããŸãã ããªããæ®éçã«ãããè¡ãããšãã§ããªãå ŽåïŒãããããããããŸãããå ŽåïŒæãããªãã§ãã ããã
ãããã¬ãã«ïŒåè·¯ïŒã§ãç§ã¯ãããŸãããPSoCã§ã¯åäœãããUDBã§åäœããããšãç 究ããŠããŸãã äžçšåºŠã®è€éãã®ãªãã·ã§ã³-16ãããã§ããæŽæ°ãèŠãŠã¿ãŸãããã ããã¯ããã£ã¬ã¯ããªCJCU_B_Isqrt16_v1_0ã«ãããŸãã
æåã«è¡ãããšã¯ããã¡ãŒã ãŠã§ã¢ã®é·ç§»ã°ã©ããæ¡åŒµããããšã§ãã Googleã«ã¯ããã€ãã®æ ¹æ¬çã«ç°ãªãã¢ã«ãŽãªãºã ã®éžæè¢ãçšæãããŠãããããããããªããšãã©ã®ãããªå¹³æ¹æ ¹ã¢ã«ãŽãªãºã ãé©çšãããŠãããæšæž¬ããããšããã§ããŸããã
ãããŸã§ã®ãšãããäœãæ確ã§ã¯ãããŸããããäºæž¬å¯èœã§ãã ããã«æ å ±ãè¿œå ããå¿ èŠããããŸãã ç¶æ ã®ã³ãŒãã£ã³ã°ãèŠãŸãã éåžžã®ã€ã³ã¯ãªã¡ã³ã¿ã«ãã€ããªã³ãŒãã§ãšã³ã³ãŒããããŠããªãããšã¯å°è±¡çã§ãã
ç§ã¯ãã§ã«ãã®ã¢ãããŒããèšäºã§èšåããŸããããç¹å®ã®äŸã§äœ¿çšããããšã¯ã§ããŸããã§ããã RAMåçæ§æALUã«ã¯3ã€ã®ã¢ãã¬ã¹å ¥åãããããŸããã ã€ãŸããALUã¯8ã€ã®æäœã®ãããããå®è¡ã§ããŸãã ãªãŒãããã³ã«ããã«ç¶æ ãããå Žåããåç¶æ ã«ç¬èªã®æäœãããããšããã«ãŒã«ã¯äžå¯èœã«ãªããŸãã ãããã£ãŠãALUã®æäœãåäžã§ããç¶æ ãéžæãããåçæ§æã®RAMã¢ãã¬ã¹ïŒéåžžã¯äžäœïŒã«3ããããäŸçµŠãããåãæ¹æ³ã§ãšã³ã³ãŒããããæ®ãã¯ç°ãªãæ¹æ³ã§ãšã³ã³ãŒããããŸãã ãã®ãããªãœãªãã£ã¢ãè¿œå ããæ¹æ³ã¯ããã§ã«éçºè ã®åé¡ã§ãã 調æ»ããã³ãŒãã®éçºè ã¯ãäžèšã®ãšããæ£ç¢ºã«æããããŸããŠããŸãã
ãã®æ å ±ãã°ã©ãã«è¿œå ããALUã§åãæ©èœãå®è¡ããç¶æ ãåæ§ã®è²ã§è²ä»ãããŸãã
ãã¿ãŒã³ã¯ãŸã çŸããŠããŸããããã°ã©ããæããã«ãç¶ããŠããŸãã Datapath Edit Toolãéãããã®äžã®ããžãã¯ãæ¢ã«èª¿ã¹ãŠããŸãã
2ã€ã®Datapathãããã¯ããã§ãŒã³ã§æ¥ç¶ãããŠããããšã«æ³šæããŠãã ããã ç¬èªã®æäœãè¡ãå Žåããããå¿ èŠã«ãªãå ŽåããããŸãïŒãã ããããŒã¿ãã¹ç·šéããŒã«ã¯æ¢ã«ãã§ãŒã³ã§çµåããããããã¯ãäœæã§ãããããããã¯æããªãã§ãïŒã
ALUã«å¯Ÿå¿ããã°ã©ããèªã¿åãïŒããã³èšå ¥ããïŒãšãã¯ãåžžã«æ¬¡ã®å³ã®ããã¥ã¡ã³ããéããŸãã
確ãã«ããã®äŸã®éçºè ã¯ç§ãã¡ã®é¢åãèŠãŠãã³ã¡ã³ãæ¬ã«èšå ¥ããŸããã ããã䜿çšããŠãäœãæ§æãããŠããããç解ã§ããŸãã åæã«ãã³ã¡ã³ããæžãããšã¯ãã³ãŒãã«åè¡ãã人ã«ãšã£ãŠãã6ãæåŸã«ãããå¿ãããšãããç§ãã¡ã«ãšã£ãŠåžžã«åœ¹ç«ã€ããšã«çæããŠããŸãã
ç¶æ 0ããã³12ã«å¯Ÿå¿ããX000ã³ãŒãã確èªããŸãã
解説ãããããã§äœãèµ·ãã£ãŠãããã¯ãã§ã«æããã§ãïŒã¬ãžã¹ã¿D0ã®å 容ã¯ã¬ãžã¹ã¿A0ã«ã³ããŒãããD1ã®å 容ã¯ã¬ãžã¹ã¿A1ã«ã³ããŒãããŸãããããç¥ã£ãŠãå°æ¥ã®çŽæãèšç·Žããèšå®ãã£ãŒã«ãã§åæ§ã®ãšã³ããªãèŠã€ããŸãïŒ
ALUã¯PASSã¢ãŒãã§åäœããã·ããã¬ãžã¹ã¿ãPASSã§ãããããä»ã®ã¢ã¯ã·ã§ã³ãå®éã«å®è¡ãããªãããšãããããŸãã
éäžã§ãVerilogã®ããã¹ããèŠãŠãã¬ãžã¹ã¿D0ãšD1ã®å€ãçããå Žæã確èªããŸãã
å¿ èŠã«å¿ããŠã[衚瀺]-> [åæã¬ãžã¹ã¿å€]ãéžæããŠãããŒã¿ãã¹æ§æããŒã«ã§åãããšã確èªã§ããŸãã
衚瀺ããã«ã¯ãVerilogã³ãŒããçŽæ¥åæããç¬èªã®ããŒãžã§ã³ãäœæããæ¹ã䟿å©ã§ããæ§æãèæ ®ããªãããã«ãšãã£ã¿ãŒã§äœæ¥ããŠãã ããã
åæ§ã«ãä»ã®ãã¹ãŠã®ALUé¢æ°ã解æããŸãïŒæåã«ã³ã¡ã³ããèŠãŠãã ããïŒã
æ°ããç¥èãèæ ®ããŠããªãŒãããã³ã®é·ç§»ã°ã©ããåäœæããŸãã
ãã§ã«äœããè¿«ã£ãŠããŸããããããŸã§ã®ãšããããã®ã°ã©ãã§GoogleãèŠã€ããã¢ã«ãŽãªãºã ãèªä¿¡ãæã£ãŠèšããŸããã ããããèªåã§ã¯ãªããšèªä¿¡ãæã£ãŠèšãã人ãããŸãããä¿¡ããããªãã»ã©ã®äººã§ããã圌ãã ãšèªä¿¡ãæã£ãŠçããããšã¯ã§ããŸããã ã¬ãžã¹ã¿FIFO F0ããã³F1ã®ã¢ã¯ãã£ããªäœ¿çšãæ··ä¹±ãããŸãã äžè¬çã«ãã¡ã€ã«å
\ CJCU_SquareRoot \ Library \ CJCU_SquareRoot.cylib \ CJCU_Isqrt_v1_0 \ API \ CJCU_Isqrt.c
F1ã䜿çšããŠåŒæ°ãæž¡ããçµæãè¿ãããšãããããŸãã
åãããã¹ãïŒ
void `$INSTANCE_NAME`_ComputeIsqrtAsync(uint`$regWidth` square) { /* Set up FIFOs, start the computation. */ CY_SET_REG`$dpWidth`(`$INSTANCE_NAME`_F1, square); CY_SET_REG8(`$INSTANCE_NAME`_CTL, 0x01); } ⊠uint`$resultWidth` `$INSTANCE_NAME`_ReadIsqrtAsync() { /* Read back result. */ return CY_GET_REG`$dpWidth`(`$INSTANCE_NAME`_F1); }
ãããã1ã€ã®åŒæ°ãš1ã€ã®çµæã ãããŠããªãäœæ¥äžã«FIFOãžã®åŒã³åºããéåžžã«å€ãã®ã§ããïŒ ãããŠãFIFO0ã¯ãããšäœã®é¢ä¿ããããŸããïŒ ç§ããã©ãã©ã«åããŸããããèè ã¯ããã¥ã¡ã³ãã®ç¿»èš³ã«èŠãããã¢ãŒããå©çšããããã§ããæ¬æ ŒçãªFIFOã®ä»£ããã«ããã®ãããã¯ã¯åäžã®ã¬ãžã¹ã¿ãšããŠæ©èœããŸããã èè ãã¬ãžã¹ã¿ã»ãããæ¡åŒµããããšã«æ±ºãããšããŸãã ãããããªãã圌ãã®æ¹æ³è«ã¯ç§ãã¡ã®å®éã®ä»äºã§ç§ãã¡ã«åœ¹ç«ã€ã§ãããã詳现ãå匷ããŸãããã å®éãããã¥ã¡ã³ãã§ã¯ãFIFOãæäœããããŸããŸãªã¢ãããŒãã«ã€ããŠèª¬æããŠããŸãã ã§ãã-ãããã§ãã-ãããã§ãã§ãã-ããçš®ã®ã ãããŠã詳现ã¯ãããŸããã ç¹°ãè¿ããŸãããå€åœã®ãã¹ããã©ã¯ãã£ã¹ã«ã€ããŠåŠã¶æ©äŒããããŸãã èè ã¯FIFOã§äœãããŸããïŒ
ãŸãããããã¯ä¿¡å·ã®å²ãåœãŠã§ãã
wire f0_load = (state == B_SQRT_STATE_1 || state == B_SQRT_STATE_4); wire f1_load = (state == B_SQRT_STATE_1 || state == B_SQRT_STATE_3 || state == B_SQRT_STATE_9 || state == B_SQRT_STATE_11); wire fifo_dyn = (state == B_SQRT_STATE_0 || state == B_SQRT_STATE_12);
次ã«ãDatapathãžã®æ¥ç¶ã次ã«ç€ºããŸãã
/* input */ .f0_load(f0_load), /* input */ .f1_load(f1_load), /* input */ .d0_load(1'b0), /* input */ .d1_load(fifo_dyn),
ã³ã³ãããŒã©ãŒã®èª¬æããããã®ãã¹ãŠãäœãæå³ãããã¯ç¹ã«æ確ã§ã¯ãããŸããã ããããã¢ããªã±ãŒã·ã§ã³ããŒãããããã®èšå®ããã¹ãŠã®åå ã§ããããšãããããŸããã
ãšããã§ããŸãã«ãã®èšå®ã®ããããã®ãããã¯ã¯UDBãšãã£ã¿ãŒã䜿çšããŠèšè¿°ã§ããŸããã ãããã®å¶åŸ¡ããããONã®å ŽåãFIFOã¯ç°ãªããœãŒã¹ãšã¬ã·ãŒããŒã§åäœã§ããŸãã Dx_LOADã1ã«çããå Žåã Fxã¯ã·ã¹ãã ãã¹ãšäº€æãããŒãã®å Žåãããã§éžæãããã¬ãžã¹ã¿ãšäº€æããŸãã
F0ã¯åžžã«ã¬ãžã¹ã¿A0ãšãç¶æ 12ããã³0ã®F1ãš-ã·ã¹ãã ãã¹ãšïŒçµæãã¢ããããŒãããŠåŒæ°ãããŒãããããã«ïŒãä»ã®ç¶æ ãš-A1ãšåžžã«äº€æããããšãããããŸãã
ããã«ãVerilogã³ãŒããããF0ã§ã¯ããŒã¿ãç¶æ 1ããã³4ã§ããŒããããF1ã§ã¯ç¶æ 1ã3ã9ã11ã§ããŒããããããšãããããŸããã
ååŸããç¥èãã°ã©ãã«è¿œå ããŸãã äžé£ã®æäœäžã®æ··ä¹±ãé¿ããããã«ãå²ãåœãŠããŒã¯ãa la UDB EditorããVerilogovã®ç¢å°ã«çœ®ãæããŠããœãŒã¹ããããã¯ã«å ¥ãåã®ä¿¡å·ã®å€ã§ããããšã匷調ããŸãã
ã¢ã«ãŽãªãºã ã®åæã®èŠ³ç¹ããã¯ããã¹ãŠããã§ã«æ確ã«ãªã£ãŠããŸãã ãã®ãããªã¢ã«ãŽãªãºã ã®ä¿®æ£ã次ã«ç€ºããŸãã
uint32_t SquareRoot(uint32_t a_nInput) { uint32_t op = a_nInput; uint32_t res = 0; uint32_t one = 1uL << 30; // The second-to-top bit is set: use 1u << 14 for uint16_t type; use 1uL<<30 for uint32_t type // "one" starts at the highest power of four <= than the argument. while (one > op) { one >>= 2; } while (one != 0) { if (op >= res + one) { op -= res + one; res += one << 1; } res >>= 1; one >>= 2; } return res; }
ã·ã¹ãã ãšã®é¢ä¿ã§ã®ã¿ã次ã®ããã«ãªããŸãã
uint32_t SquareRoot(uint32_t a_nInput) { uint32_t op = a_nInput; uint32_t res = 0; uint32_t one = 1uL << 14; // The second-to-top bit is set while (one != 0) { if (op >= res + one) { op -= res + one; res += one << 1; } res >>= 1; one >>= 2; } return res; }
ç¶æ 4ããã³10ã¯ãæååãæ瀺çã«ãšã³ã³ãŒãããŸãã
res >>= 1;
ããŸããŸãªæ¯åºåãã
è¡ã¯æ¬¡ã®ãšããã§ãã
one >>= 2;
ç¶æ 6ãš7ã®ãã¢ããŸãã¯ç¶æ 9ãš7ã®ãã¢ã®ããããã«ãã£ãŠæ瀺çã«ãšã³ã³ãŒããããŠããŸããããã³åé¿çïŒã
ç¶æ 2ã¯æ¡ä»¶åå²ããšã³ã³ãŒãããŸãã ç¶æ 7ã¯ã«ãŒãã¹ããŒãã¡ã³ãããšã³ã³ãŒãããŸãã ã¹ããã2ã®æ¯èŒæäœã¯éåžžã«é«äŸ¡ã§ãã äžè¬ã«ãå€ãã®å Žåãã¬ãžã¹ã¿A0ã«ã¯å€æ°1ãå«ãŸããŠããŸãã ããããã¹ããã1ã§å€æ°oneãF0ã«ã¢ã³ããŒãããã代ããã«å€res + oneãããŒããããŸãããã®åŸãã¹ããã2ã§æ¯èŒã®ããã«æžç®ãå®è¡ãããã¹ããã3ããã³8ã§1ã®å€ã埩å ãããŸãã ã¹ããã4ã§ãA0ãåã³F0ã«ã³ããŒãããã®ã¯ãªããããããŸããã§ããã ããããããã¯ããçš®ã®åæ©ã§ãã
誰ãresã§èª°ãopã§ããããææ¡ããããšã¯æ®ã£ãŠããŸãã æ¡ä»¶ãopãšåèšres + 1ãæ¯èŒããããšãç¥ã£ãŠããŸãã ç¶æ 1ã§ã¯ãA0ïŒ one ïŒãšA1ãåèšãããŸãã A1ã¯resã§ãã ç¶æ 11ã§ã¯ãA1ãresã§ãããé¢æ°ã®åºåã«äŸçµŠãããF1ã«å ¥ãã®ã¯åœŒã§ãã ç¶æ 1ã®F1ã¯æããã«opã§ãã å€æ°ã®
å®éãå šäœã®çå®ãæããã«ãããŠããŸãã æ¯èŒãšèšç®ã®ããã«A1ãäžæçã«F1ã§äžæçã«ã©ã®ããã«å€åããããæ¯èŒïŒå®éã«ã¯ãããCãçæïŒãšåŒãžã®åå ã®äž¡æ¹ã«åãå·®ãã©ã®ããã«äœ¿çšããããã確èªããŸãã Cã¢ã«ãŽãªãºã ã®ç©ºã®ã¹ããŒã¹ïŒãã€ãã¹ïŒããªãŒãããã³ã®é·ç§»ã°ã©ãã®é·ããã©ã³ãã«ãã£ãŠãšã³ã³ãŒããããçç±ããããããŸãïŒãã®ãã©ã³ãã§ã¯ãã¬ãžã¹ã¿ã¯ã¡ã€ã³ã³ãŒããã©ã³ãã§çºçãã亀æãšåãããã«äº€æãããŸãïŒã ãã¹ãŠãèŠããŸãã
ç§ãèŠãããããšã®ãªãå¯äžã®è³ªåã¯ãèè ãã©ã®ããã«FIFOãã·ã³ã°ã«ãã€ãã¢ãŒãã«åãæ¿ããã®ã§ããïŒ ããã¥ã¡ã³ãã«ã¯ããã®ããã«è£å©å¶åŸ¡ã¬ãžã¹ã¿ã®CLRãããããŠãããã«äžããå¿ èŠããããšæžãããŠããŸãããAPIã«åæ§ã®ãšã³ããªãããããšã¯ããããŸããã ãããã誰ãããããç解ããã³ã¡ã³ããæžãã§ãããã
ããŠããããŠç¬èªã®äœããéçºãã-ååŸããã¹ãã«ã䜿çšããŠãéã®é åºã§ã
ãããã«
UDBã«åºã¥ããŠããã¡ãŒã ãŠã§ã¢ããéçºããã¹ãã«ãéçºããã«ã¯ãããã¥ã¡ã³ããèªãã ãã§ãªããä»ã®äººã®ãã¶ã€ã³ããã€ã³ã¹ãã¬ãŒã·ã§ã³ãåŒãåºãããšã圹ç«ã¡ãŸãã PSoC Creatorã«ä»å±ããã³ãŒãã¯ãªãã¡ã¬ã³ã¹ãšããŠåœ¹ç«ã¡ãã³ã³ãã€ã©ãŒãæäŸããããã€ãã¢ãŒã¢ãã«ã¯ãããã¥ã¡ã³ãã®æå³ãããããç解ããã®ã«åœ¹ç«ã¡ãŸãã ãã®èšäºã§ã¯ããµãŒãããŒãã£ã®ã¡ãŒã«ãŒã®ãµã³ãã«ã»ãããžã®ãªã³ã¯ãæäŸãããã®ãããªãµã³ãã«ã®1ã€ã解æããããã»ã¹ã瀺ããŠããŸãã
ããã«ã€ããŠã¯ãUDBã§ã®äœæ¥ã«é¢ããèäœæš©ã®èšäºã®ãµã€ã¯ã«ã¯å®äºãããšèŠãªãããšãã§ããŸãã 圌ã誰ããå®éã«åœ¹ç«ã€ç¥èãåŸãã®ãæäŒã£ãŠããããå¬ããã§ãã ãŸã ããã¥ã¡ã³ãã®ç¿»èš³ãããã€ããããŸãããçµ±èšã§ã¯ã»ãšãã©èª°ãèªãã§ããªãããšã瀺ãããŠããŸãã ãããã¯ãç°¡åã«èª¬æããããã«ããããã¯ãããã«èšç»ãããŠããŸãã