下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、module sin(reset,clk,sync,freq,sin_out,cos_out; input reset; input clk; input sync; input 7:0 freq; output 7:0 sin_out; output 7:0 cos_out; reg 7:0 sin_out; reg 7:0 cos_out; reg 7:0 phase; reg 5:0 max_phase; reg 7:0 output_zeros; reg 5:0 sin_index; reg 7:0 sin_table; reg 1:0 phase_d1; reg 1:0 phase_
2、d2; reg 5:0 cos_index; reg 7:0 cos_table; assign saw_out=phase15 : 8; always(posedge reset or posedge clk begin if (reset=1'b1 phase<=8'b0; else begin if (sync=1'b1 phase<=8'b0; else phase<=phase+freq; end end always(posedge clk or posedge reset begin if (reset=1'b1 phas
3、e=8'b0000000; else if(clk begin if (sync=1'b1 phase=8'b00000000; else phase=phase+freq; end end always (posedge clk or posedge reset begin if (reset=1'b1 begin sin_index =1'b0; phase_d1 =2'b00; end else if(clk begin phase_d1=phase7 : 6; if (phase6=1'b0 sin_index=phase5:0;
4、 else sin_index=max_phase-phase5 : 0; end end always(posedge clk or posedge reset begin if (reset=1'b1 begin sin_index =1'b0; phase_d2 =2'b00; end else if(clk begin phase_d2 =phase_d1; case (sin_index5:0 6'b000000 : sin_index=8'b00000000; 6'b000001 : sin_index=8'b00000011
5、; 6'b000010 : sin_index=8'b00000110; 6'b000011 : sin_index=8'b00001001; 6'b000100 : sin_index=8'b00001100; 6'b000101 : sin_index=8'b00001111; 6'b000110 : sin_index=8'b00010010; 6'b000111 : sin_index=8'b00010101; 6'b001000 : sin_index=8'b0001100
6、0; 6'b001001 : sin_index=8'b00011011; 6'b001010 : sin_index=8'b00011110; 6'b001011 : sin_index=8'b00100001; 6'b001100 : sin_index=8'b00100100; 6'b001101 : sin_index=8'b00100111; 6'b001110 : sin_index=8'b00101010; 6'b001111 : sin_index=8'b001011
7、01; 6'b010000 : sin_index=8'b00110000; 6'b010001 : sin_index=8'b00110011; 6'b010010 : sin_index=8'b00110110; 6'b010011 : sin_index=8'b00111001; 6'b010100 : sin_index=8'b00111011; 6'b010101 : sin_index=8'b00111110; 6'b010110 : sin_index=8'b01000
8、001; 6'b010111 : sin_index=8'b01000011; 6'b011000 : sin_index=8'b01000110; 6'b011001 : sin_index=8'b01001001; 6'b011010 : sin_index=8'b01001011; 6'b011011 : sin_index=8'b01001110; 6'b011100 : sin_index=8'b01010000; 6'b011101 : sin_index=8'b0101
9、0010; 6'b011110 : sin_index=8'b01010101; 6'b011111 : sin_index=8'b01010111; 6'b100000 : sin_index=8'b01011001; 6'b100001 : sin_index=8'b01011011; 6'b100010 : sin_index=8'b01011110; 6'b100011 : sin_index=8'b01100000; 6'b100100 : sin_index=8'b011
10、00010; 6'b100101 : sin_index=8'b01100100; 6 9;b100110 : sin_index=8'b01100110; 6'b100111 : sin_index=8'b01100111; 6'b101 000 : sin_index=8'b01101001; 6'b101001 : sin_index=8'b01101011; 6'b101010 : sin_index=8'b01101100; 6'b101011 : sin_index=8'b011
11、01110; 6'b101100 : sin_index=8'b01110000; 6'b101101 : sin_index=8'b01110001; 6'b101110 : sin_index=8'b01110010; 6'b101111 : sin_index=8'b01110100; 6'b110000 : sin_index=8'b01110101; 6'b110001 : sin_index=8'b01110110; 6'b110010 : sin_index=8'b01
12、110111; 6'b110011 : sin_index=8'b01111000; 6'b110100 : sin_index=8'b01111001; 6'b110101 : sin_index=8'b01111010; 6'b110110 : sin_index=8'b01111011; 6'b110111 : sin_index=8'b01111011; 6'b111000 : sin_index=8'b01111100; 6'b111001 : sin_index=8'b0
13、1111101; 6'b111010 : sin_index=8'b01111101; 6'b111011 : sin_index=8'b01111110; 6'b111100 : sin_index=8'b01111110; 6'b111101 : sin_index=8'b01111110; 6'b111110 : sin_index=8'b01111110; 6'b111111 : sin_index=8'b01111110; default : sin_index=8'b000000
14、00; endcase end end always(posedge clk or posedge reset begin if (reset=1'b1 sin_out =1'b0; else if (clk begin if (phase_d21=1'b0 sin_out = sin_table; else sin_out=output_zeros-sin_table; end end always (posedge clk or posedge reset begin if (reset=1'b1 cos_index =1'b0; else if(c
15、lk begin if (phase6=1'b0 cos_index=phase5:0; else cos_index=max_phase-phase5 : 0; end end always(posedge clk or posedge reset begin if (reset=1'b1 cos_table =1'b0; else if(clk case (cos_index5:0 6'b000000 : cos_table=8'b01111111; 6'b000001 : cos_table=8'b01111110; 6'b
16、000010 : cos_table=8'b01111110; 6'b000011 : cos_table=8'b01111110; 6'b000100 : cos_table=8'b01111110; 6'b000101 : cos_table=8'b01111110; 6'b000110 : cos_table=8'b01111101; 6'b000111 : cos_table=8'b01111101; 6'b001000 : cos_table=8'b01111100; 6'
17、b001001 : cos_table=8'b01111011; 6'b001010 : cos_table=8'b01111011; 6'b001011 : cos_table=8'b01111010; 6'b001100 : cos_table=8'b01111001; 6'b001101 : cos_table=8'b01111000; 6'b001110 : cos_table=8'b01110111; 6'b001111 : cos_table=8'b01110110; 6'
18、;b010000 : cos_table=8'b01110101; 6'b010001 : cos_table=8'b01110100; 6'b010010 : cos_table=8'b01110010; 6'b010011 : cos_table=8'b01110001; 6'b010100 : cos_table=8'b01110000; 6'b010101 : cos_table=8'b01101110; 6'b010110 : cos_table=8'b01101100; 6
19、9;b010111 : cos_table=8'b01101011; 6'b011000 : cos_table=8'b01101001; 6'b011001 : cos_table=8'b01100111; 6'b011010 : cos_table=8'b0110011 0; 6'b011011 : cos_table=8'b01100100; 6'b011100 : cos_table=8'b01100010; 6'b011101 : cos_table=8'b01100000; 6&
20、#39;b011110 : cos_table=8'b01011110; 6'b011111 : cos_table=8'b01011011; 6'b100000 : cos_table=8'b01011001; 6'b100001 : cos_table=8'b01010111; 6'b100010 : cos_table=8'b01010101; 6'b100011 : cos_table=8'b01010010; 6'b100100 : cos_table=8'b01010000; 6
21、'b100101 : cos_table=8'b01001110; 6'b100110 : cos_table=8'b01001011; 6'b100111 : cos_table=8'b01001001; 6'b101000 : cos_table=8'b01000110; 6'b101001 : cos_table=8'b01000011; 6'b101010 : cos_table=8'b01000001; 6'b101011 : cos_table=8'b00111110;
22、6'b101100 : cos_table=8'b00111011; 6'b101101 : cos_table=8'b00111001; 6'b101110 : cos_table=8'b00110110; 6'b101111 : cos_table=8'b00110011; 6'b110000 : cos_table=8'b00110000; 6'b110001 : cos_table=8'b00101101; 6'b110010 : cos_table=8'b00101010; 6'b110011 : cos_table=8'b00100111; 6'b110100 : cos_ta
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 課題申報(bào)參考:近代日本對(duì)中國(guó)茶業(yè)的侵奪研究
- 課題申報(bào)參考:教育高質(zhì)量發(fā)展視域下大學(xué)體育一流本科課程建設(shè)實(shí)證研究
- 2025年園林景觀綠化地使用權(quán)轉(zhuǎn)讓合同4篇
- 2025年度新能源汽車充電站車位租賃合作協(xié)議書4篇
- 2025版委托擔(dān)保合同范本:知識(shí)產(chǎn)權(quán)質(zhì)押貸款擔(dān)保合同3篇
- 2025年度家具行業(yè)綠色供應(yīng)鏈管理合同4篇
- 二零二五版橋梁建設(shè)施工合作協(xié)議2篇
- 2025年度個(gè)人沿街店房租賃合同(含合同解除條件與爭(zhēng)議解決)4篇
- 二零二五年度國(guó)際交流項(xiàng)目教師選拔與聘用協(xié)議
- 2025年度星級(jí)酒店廚房設(shè)備采購(gòu)與定期檢修合同4篇
- 數(shù)學(xué)-山東省2025年1月濟(jì)南市高三期末學(xué)習(xí)質(zhì)量檢測(cè)濟(jì)南期末試題和答案
- 中儲(chǔ)糧黑龍江分公司社招2025年學(xué)習(xí)資料
- 湖南省長(zhǎng)沙市2024-2025學(xué)年高一數(shù)學(xué)上學(xué)期期末考試試卷
- 船舶行業(yè)維修保養(yǎng)合同
- 2024年林地使用權(quán)轉(zhuǎn)讓協(xié)議書
- 物流有限公司安全生產(chǎn)專項(xiàng)整治三年行動(dòng)實(shí)施方案全國(guó)安全生產(chǎn)專項(xiàng)整治三年行動(dòng)計(jì)劃
- 基于ADAMS的汽車懸架系統(tǒng)建模與優(yōu)化
- 當(dāng)前中國(guó)個(gè)人極端暴力犯罪個(gè)案研究
- 中國(guó)象棋比賽規(guī)則
- 7天減肥餐食譜給你最能瘦的一周減肥食譜
- GB/T 31525-2015圖形標(biāo)志電動(dòng)汽車充換電設(shè)施標(biāo)志
評(píng)論
0/150
提交評(píng)論