Electronics 板


LINE

現在在弄FFT的程式.... 在pipeline的時候會用到shift register 這部份我想用QuartusII裡面內建mega function的ram-based shift register來實現 =================================以上不是重點================================ 現在我想先寫個測試的程式 希望達成的動作是.... 計數器0~7時,數字1~8會依序輸入到SHIFT1這個shift register 而當計數器8~15時,變成數字9~16依序輸入到SHIFT2另一個shift register,而這時 SHIFT1開始依序輸出1~8 當計數器16~23時,數字17~24再次依序輸入到SHIFT1,而SHIFT2依序輸出數字9~16 但是我看我輸出的結果發現SHIFT2的輸出都是錯誤的,輸出的數值都是0或1,而不是 像9 10 11 12 13 14....這樣的數值 程式看了很久感覺沒有問題....不知道是哪邊錯了...還是mega function使用方法錯誤? 下面是我的測試程式! module test(in,rst,clk,out,count,out1,out2,tap1,tap2); input rst,clk; input [7:0]in; output wire [7:0]out; wire [7:0]in1; wire [7:0]in2; output wire [6:0]count; output wire [7:0]out1; output wire [7:0]out2; output [7:0]tap1; output [7:0]tap2; counter128 c128(clk, rst,count); SHIFT S1(clk,in1,out1,tap1); SHIFT S2(clk,in2,out2,tap2); demux d1(in,count[3],in1,in2); assign out=count[3]? out1:out2; endmodule module counter128(clk, rst,count); input clk; input rst; output [6:0] count; wire [6:0] count; reg [6:0] counter_in; assign count=counter_in; always@(posedge clk) if(rst) counter_in<=1'b0; else counter_in<=counter_in+1'b1; endmodule module demux(in,select,y1,y2); input [7:0]in; input select; output wire [7:0]y1; output wire [7:0]y2; assign y1=~select&in; assign y2=select&in; endmodule ======================================================================== 下面是mega function 的code // megafunction wizard: %Shift register (RAM-based)% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altshift_taps // ============================================================ // File Name: SHIFT.v // Megafunction Name(s): // altshift_taps // ============================================================ // ************************************************************ // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! // // 6.0 Build 178 04/27/2006 SJ Full Version // ************************************************************ //Copyright (C) 1991-2006 Altera Corporation //Your use of Altera Corporation's design tools, logic functions //and other software and tools, and its AMPP partner logic //functions, and any output files any of the foregoing //(including device programming or simulation files), and any //associated documentation or information are expressly subject //to the terms and conditions of the Altera Program License //Subscription Agreement, Altera MegaCore Function License //Agreement, or other applicable license agreement, including, //without limitation, that your use is for the sole purpose of //programming logic devices manufactured by Altera and sold by //Altera or its authorized distributors. Please refer to the //applicable agreement for further details. // synopsys translate_off `timescale 1 ps / 1 ps // synopsys translate_on module SHIFT ( clock, shiftin, shiftout, taps); input clock; input [7:0] shiftin; output [7:0] shiftout; output [7:0] taps; wire [7:0] sub_wire0; wire [7:0] sub_wire1; wire [7:0] taps = sub_wire0[7:0]; wire [7:0] shiftout = sub_wire1[7:0]; altshift_taps altshift_taps_component ( .clock (clock), .shiftin (shiftin), .taps (sub_wire0), .shiftout (sub_wire1) // synopsys translate_off , .clken () // synopsys translate_on ); defparam altshift_taps_component.lpm_hint = "RAM_BLOCK_TYPE=M512", altshift_taps_component.lpm_type = "altshift_taps", altshift_taps_component.number_of_taps = 1, altshift_taps_component.tap_distance = 8, altshift_taps_component.width = 8; endmodule // ============================================================ // CNX file retrieval info // ============================================================ // Retrieval info: PRIVATE: CLKEN NUMERIC "0" // Retrieval info: PRIVATE: GROUP_TAPS NUMERIC "0" // Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Stratix" // Retrieval info: PRIVATE: NUMBER_OF_TAPS NUMERIC "1" // Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0" // Retrieval info: PRIVATE: TAP_DISTANCE NUMERIC "8" // Retrieval info: PRIVATE: WIDTH NUMERIC "8" // Retrieval info: CONSTANT: LPM_HINT STRING "RAM_BLOCK_TYPE=M512" // Retrieval info: CONSTANT: LPM_TYPE STRING "altshift_taps" // Retrieval info: CONSTANT: NUMBER_OF_TAPS NUMERIC "1" // Retrieval info: CONSTANT: TAP_DISTANCE NUMERIC "8" // Retrieval info: CONSTANT: WIDTH NUMERIC "8" // Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL clock // Retrieval info: USED_PORT: shiftin 0 0 8 0 INPUT NODEFVAL shiftin[7..0] // Retrieval info: USED_PORT: shiftout 0 0 8 0 OUTPUT NODEFVAL shiftout[7..0] // Retrieval info: USED_PORT: taps 0 0 8 0 OUTPUT NODEFVAL taps[7..0] // Retrieval info: CONNECT: @shiftin 0 0 8 0 shiftin 0 0 8 0 // Retrieval info: CONNECT: shiftout 0 0 8 0 @shiftout 0 0 8 0 // Retrieval info: CONNECT: taps 0 0 8 0 @taps 0 0 8 0 // Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0 // Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all // Retrieval info: GEN_FILE: TYPE_NORMAL SHIFT.v TRUE // Retrieval info: GEN_FILE: TYPE_NORMAL SHIFT.inc FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL SHIFT.cmp FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL SHIFT.bsf FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL SHIFT_inst.v FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL SHIFT_bb.v FALSE --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.136.175.108 ※ 編輯: arloha 來自: 220.136.175.108 (08/07 23:54)
1F:推 luckyBF:做testbench wave來看吧!!這樣查錯比較快 08/08 00:28
2F:→ arloha:請問testbench waveform 是說用QuartusII拉測試波形嗎? 08/08 10:34
3F:→ arloha:還是說寫testbench......(QuatursII好像沒辦法接受) 08/08 10:35
4F:→ arloha:如果用modelsim的話...megafunction又變成不能用了 08/08 10:36
5F:→ arloha:我現在只用QuartusII拉波形...得到錯誤的結果 08/08 10:37
6F:→ arloha:自己回....應該是demux那邊的問題! 08/08 19:01
7F:推 zxvc:Quartus II可以餵手寫的testbench。那個功能叫NativeLink。 08/08 19:18
8F:→ zxvc:可以參考本板我的一篇關於Quartus II的文章。 08/08 19:19
9F:→ zxvc:不過那篇是先把Quartus II畫出來的波形滙出成Verilog code。 08/08 19:20
10F:→ zxvc:還有也不全然要照那篇文章設定。其實你不須要Quartus II跑完 08/08 19:24
11F:→ zxvc:compliation後再啟動gate-level simulation,因為compliation 08/08 19:24
12F:→ zxvc:的時間有點久。有時你只想作RTL simulation,設定完 08/08 19:25
13F:→ zxvc:NativeLink就可以跑了。詳細的步驟我也忘了,我現在手邊也沒 08/08 19:26
14F:→ zxvc:Quartus II。 08/08 19:27
15F:→ zxvc:如果試不出來,就去找Quartus II說明書來看,搜尋NativeLink 08/08 19:28
16F:→ zxvc:我當初也是看說明書試出來的。 08/08 19:28
17F:→ arloha:謝謝 08/09 11:36
18F:→ sneak: 如果用modelsim https://muxiv.com 11/11 15:19
19F:→ sneak: 的時間有點久。有時你只 https://daxiv.com 01/04 22:00







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:BuyTogether 或 站內搜尋

TOP