第六章 本次實驗的成果展示跟比較
6.3 測量結果
測詴程式 同步 非同步
最大公因數 141us 132us
乘除法 163us 174us
開根號 303us 295us
表 5 Quartus II waveform 模擬結果
使用實驗板 DE0 上 50MHz 當輸入源,利用鎖相迴路(Phase Locked Loop,PLL) 將 timer 的 clock 固定為 1MHz。表示 timer 輸出的 output 的單位時間為 1us。同步 8051 的 clock 頻率則依照 quartus II compilation report 所建議的 43MHz。先使用 quartus II 的 waveform 來模擬結果,可得到表 5。再使用硬體來測量結果,同樣使 用 DE0 的 led 作為 timer 輸出,以方便觀察。其中 test all 程式執行時間較長的關 係,所以將 timer 的 clock 調整為 0.01MHz,即 counter 單位時間為 100us。硬體 測量結果如圖 40~43 所示,整理如表 6。
圖 40 測量 GCD 時間 圖 41 測量乘除法時間
圖 42 測量開根號時間 圖 43 測量 test all 時間
同步 非同步 效能提升
最大公因數
(圖 40) 138us 95us 145%
乘除法
(圖 41) 164us 126us 130%
開根號
(圖 42) 304us 213us 142%
TEST ALL
(圖 43) 20700us 13800us 144%
表 6 硬體測量時間結果
對照表 5 和表 6,可以發現在時間測量上同步電路模擬跟實際燒錄至實驗板
53
的結果時間大致符合,但是在非同步電路則有著明顯的誤差。就如同圖 33 所示,
模擬過程中,無法顯示 handshake 的長短延遲時間效果,都是以最長延遲固定當 作輸出。而實驗設計的 handshake 元件中最長的延遲,即是參考同步電路中的 clock 時間為依據,所以在模擬上兩者數據相距不遠。
考量 compilation report 給的時脈可能過於保守,希望在正確執行的前提下提 高頻率。使用 PLL 調整時脈進行測詴程式 test all,可以 85MHz 執行,測得執行 時間為 10500us。而非同步 8051 在 handshake 調整後最快的執行完成時間為 9900us,
仍然有 6%效能
第七章 結論與未來發展
Total logic elements 5584 5745
Combinational functions 5548 5709
Registers 1359 1361
55
克服的地方。
雖然採用 dual-rail Handshake protocol,就可省略掉測量延遲時間的問題,但 隨之而來使用的面積就會付出相對龐大的代價。而且在各個元件都需要重新的設 計或者額外建立溝通的 interface,都增加整體的困難度。不過隨著製程的進步,
延遲時間也越來越小。例如本實驗參考的 IP Core,依照當初的實驗只能以
11.6MHz 的時脈運作,光是現在 FPGA 的進步就已經提升近 4 倍的效能。估算延 遲的方式挑戰會越來越高,將來可以使用 dual-rail 的方式去改寫,以避免延遲時 間誤差的累積。
非同步的另外一項優點:較低的功耗。因為考量 controller 每個 state 作的事 情並不單純跟單一元件溝通,所以使用 ack 取代原本的 clock 效果,所以在功耗 上面並沒有明顯的改善。所以 controller 的改寫也是未來可以改善的方法。讓
controller 每個 state 的控制訊號都只對一個元件,Ack 訊號只給需要動作的元件,
其他未使用的元件就可以暫時進入休眠狀態。這樣可達到省電的效果。
未來也可如先前所介紹的 PA8051,在 CS_2 和 CS_3 以 pipeline 的方式來提 升效能。
附錄一:GCD 程式
/*
* Copyright (c) 1999-2000 Tony Givargis. Permission to copy is granted * provided that this header remains intact. This software is provided * with no warranties.
57
附錄二:乘除法
/*
* Copyright (c) 1999-2000 Tony Givargis. Permission to copy is granted * provided that this header remains intact. This software is provided * with no warranties.
附錄三:平方根
/*
* Copyright (c) 1999-2000 Tony Givargis. Permission to copy is granted * provided that this header remains intact. This software is provided * with no warranties.
59
附錄四:計算機
#include<reg51.h>
unsigned char delay(unsigned int times);
void main(void) {
unsigned char tmp;
unsigned char op;
bit first,finish;
if((P2&0x07) == 0x06) {
op=0xc3;
61
unsigned char delay(unsigned int times) {
附錄五:跑馬燈
#include<reg51.h>
#include<intrins.h>
unsigned char delay(unsigned int times);
void main(void)
led = _crol_(led,1); //char rotation left delay(65530);
goto NORET;
}
unsigned char delay(unsigned int times) {
63
參考文獻
[1]D.E. Muller and W.S. Bartky, "A Theory of Asynchronous Circuits," Proc. Int'l Symp. Theory of Switching, Part 1, Harvard Univ. Press, 1959, pp. 204–243.
[2]林銘波,微算機基本原理與應用-MCS-51 嵌入式微算機系統軟體與硬體,第二 [10]Quartus II Introduction Using VHDL Design 2006
[11]http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=Taiwan&No=371 [12]cyclone3_handbook 2009.9.
[13]J. Sparso and S. Furbe, Principles of Asynchronous Circuit Design. Kluwer Academic, 2001.
[14]楊榮林,淺窺非同步電路設計─沒有 Clock 的數位世界,IC 應用設計月刊,
2005 年 1 月號
[15]A. Martin and M. Nystrom, “Asynchronous Techniques for System-on-Chip Design,” Proc. IEEE, vol. 94, no. 6, pp. 1089-1120, June 2006.
[16] T. Werner and V. Akella, “Asynchronous Processor Survey,” Computer, vol. 30, issue 11, Nov. 1997, pp. 67-76.
[17]K.-R. Cho, K. Okura, and K. Asada, “Design of a 32-bit Fully Asynchronous Microprocessor (FAM),” Proc.35th Midwest Symp. Circuits and Systems, IEEE
Press,Piscataway, N.J., 1992, pp. 1,500-1,503.
[18]E. Brunvand, “The NSR Processor,” Proc. 26th Hawaii Int’l Conf. System
Sciences, Vol. 1, T.N. Mudge, V. Milutinovic, and L. Hunter, eds., IEEE Press, Piscataway, N.J., 1993, pp. 428-435.
[19]J.V. Woods, P. Day, S.B. Furber, J.D. Garside, N.C. Paver, and S. Temple.
AMULET1: An asynchronous ARM processor. IEEE Transactions on Computers, 46(4):385–398, April 1997.
[20]http://www.alteraforum.com/forum
[21]楊明豐,8051 單晶片 C 語言設計實務,碁峰資訊股份有限公司,2003
65
[22] Intel, MCS 51 Microcontroller Family User's Manual: Intel, 1994.
[23]張元騰,低耗電量非同步嵌入式處理器 SA8051 設計與實作,國立交通大學碩 士論文,2005.6
[24]蔡瑞夫,以管線方法改進非同步 8051 處理器之效能,國立交通大學碩士論文,
2006.6