thuc hanh thiet ke mach so voi hdl

Download Thuc Hanh Thiet Ke Mach So Voi Hdl

Post on 05-Dec-2014

17 views

Category:

Documents

4 download

Embed Size (px)

TRANSCRIPT

I HC QUC GIA THNH PH H CH MINH TRNG I HC BCH KHOA KHOA KHOA HC V K THUT MY TNH ------oOo-----

THC HNH THIT K MCH S VI HDL

TP.HCM, 9-2009

Gii thiuB ti liu thc hnh thit kt mch s vi HDL c son tho nhm mc ch h tr cc bn sinh vin trong vic tip xc vi ngn ng c t phn cng. M c th l h tr cho mn hc thit kt mch s vi HDL. Ti liu ny bao gm 9 bi, tng ng vi 9 bui. Ni dung chu yu hng n vic hc t duy thit kt phn cng. Gip sinh vin luyn tp cc k nng lp trnh vi Verilog, m phng trn Model Sim hay trc tip trn board DE2. Mc d rt c gng nhng cng khng th trnh khi nhng sai st. V vy rt mong nhn c kin ng gp t pha bn c hoc cc bn sinh vin. Chn thnh cm n! TP.HCM, ngy 27thng 9 nm 2009

Mc lc Bui 1. Tng quan v cc phn mm thit k trn FPGA ....................................... 7 I. Gii thiu Board DE2 ca Altera ............................................................................. 7 1. Gii thiu .......................................................................................................... 7 2. Thnh phn ....................................................................................................... 7 3. Mt vi ng dng ca board DE2 .................................................................... 8 II. Cch ci t Quartus II 8.0 v Nios II ..................................................................... 9 1. Gii thiu .......................................................................................................... 9 2. Ci t ............................................................................................................. 10 III. Cch np chng trnh cho Quartus II 8.0: ............................................................ 13 1. To 1 project: .................................................................................................. 13 2. Vit chng trnh v bin dch: ...................................................................... 17 3. To file m phng (simulate) v bt u simulate ......................................... 22 4. Cu hnh chn v np ln board...................................................................... 30 Bui 2. Mch t hp v mch tun t...................................................................... 40 I. Gii thiu ............................................................................................................... 40 1. Gii thiu ........................................................................................................ 40 2. Hng dn thit k FPGA thng qua s khi/Schematic .......................... 40 II. Bi tp .................................................................................................................... 46 Bui 3. Lp trnh Verilog vi m hnh cu trc ..................................................... 48 I. Gii thiu ModelSim ............................................................................................. 48 1. Gii thiu ........................................................................................................ 48 2. Ci t ............................................................................................................. 48 3. Hng dn ...................................................................................................... 58 II. Bi tp .................................................................................................................... 65 Bui 4. M hnh hnh vi ............................................................................................ 67 I. Bi tp .................................................................................................................... 67 Bui 5. M hnh hnh vi (tt)...................................................................................... 71 I. Bi tp .................................................................................................................... 71 Bui 6. My trng thi .............................................................................................. 75 I. Gii thiu ............................................................................................................... 75 1. Gii thiu ........................................................................................................ 75 2. Hng dn ...................................................................................................... 75 II. Bi tp .................................................................................................................... 83

Mc lc hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh 1.Board DE2 ............................................................................................................. 7 2. TV Box.................................................................................................................. 8 3. Chng trnh v (paintbrush) ................................................................................ 9 4. My ht Karaoke v my chi nhc t card SD ................................................... 9 5. Thng bo cha ci dirver .................................................................................. 10 6. Chn cch thc ci t driver ............................................................................. 11 7. Chn th mc tm kim driver ............................................................................ 11 8. Chn th mc cha dirver .................................................................................. 12 9. Thng bo li ...................................................................................................... 12 10. Thng bo ci t hon tt ................................................................................ 13 11. To mi mt project .......................................................................................... 14 12. Hp hi thoi to mi project ........................................................................... 15 13. Hp thoi la chn chip .................................................................................... 16 14. Hp thoi tng hp cc thng tin ca project ................................................... 17 15. To mi file....................................................................................................... 18 16. La chn loi file cn to .................................................................................. 19 17. Ca s vit code ................................................................................................ 19 18. Ca s lp trnh ................................................................................................. 20 19. Hp thoi lu file .............................................................................................. 20 20. La chn lop-level cho file ............................................................................... 21 21. Bin dch chng trnh ..................................................................................... 21 22. Thng bo vic bin dch thnh cng ............................................................... 22 23. To mi file testbench....................................................................................... 23 24. Chn tn hiu s c test ................................................................................. 23 25. Hp thoi la chn tn hiu ............................................................................... 24 26. Ca s la chn tn hiu ................................................................................... 24 27. Xc nhn li vic la chn tn hiu ................................................................... 25 28. Thit lp gi tr cho cc tn hiu........................................................................ 25 29. Ca s Save As ................................................................................................. 26 30. La chn ch simulate ................................................................................. 26 31. Ca s thit lp cc thng s ca qu trnh simulate ........................................ 27 32. Thc hin chc nng tng hp v phn tch chng trnh ............................... 27 33. Thng bo thnh cng ....................................................................................... 28 34. Thit lp file testbench cho chng trnh ......................................................... 28 35. La chn ng dn lu tr file testbench ....................................................... 28 36. Ch nh v tr lu tr file testbench .................................................................. 29 37. Tin hnh qu trnh simulation ......................................................................... 29 38. Thng bo simulate thnh cng ........................................................................ 30 39. Kt qu qu trnh m phng (simulation) ......................................................... 30 40. Ca s gn chn ................................................................................................ 31 41. Cc tn hiu cn gn chn ................................................................................. 31 42. Danh sch cc chn c th c gn ................................................................ 32 43. Qu trnh gn chn hon tt .............................................................................. 32 44. Lu li file cu hnh chn ................................................................................. 33

Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh Hnh

45. Hp thoi load file cu hnh chn ..................................................................... 33 46. Ca s lp trnh (np) ....................................................................................... 34 47. Ca s Hardware Setup .................................................................................... 35 48. Ca s lp trnh ...........