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灯, 水草

请输入看板名称,例如:WOW 或 站内搜寻

TOP