短训练序列---Verilog代码

Posted chensimin1990

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了短训练序列---Verilog代码相关的知识,希望对你有一定的参考价值。

短训练序列---Verilog代码

module short_generator(

    input  wire       FFT_CLK,
    input  wire       RESET,
    input  wire       SHORT_ACK,
    output reg  [7:0] SHORT_RE,
    output reg  [7:0] SHORT_IM,
    output reg  [7:0] SHORT_INDEX,
    output reg        SHORT_DV
);


//---------------------------------------------------------------

reg[3:0] i;
reg[3:0] j;
reg [7:0] shortrom_re [15:0];
reg [7:0] shortrom_im [15:0];


always @ (negedge RESET or posedge FFT_CLK)
begin
    if(!RESET)
    begin
        i=0;
        j=0;

        SHORT_RE=0;
        SHORT_IM=0;
        SHORT_INDEX=0;
        SHORT_DV=0;

        shortrom_re[0]=8b00001100;
        shortrom_re[1]=8b11011110;
        shortrom_re[2]=8b11111101;
        shortrom_re[3]=8b00100100;
        shortrom_re[4]=8b00011000;
        shortrom_re[5]=8b00100100;
        shortrom_re[6]=8b11111101;
        shortrom_re[7]=8b11011110;
        shortrom_re[8]=8b00001100;
        shortrom_re[9]=8b00000001;
        shortrom_re[10]=8b11101100;
        shortrom_re[11]=8b11111101;
        shortrom_re[12]=8b00000000;
        shortrom_re[13]=8b11111101;
        shortrom_re[14]=8b11101100;
        shortrom_re[15]=8b00000001;

        shortrom_im[0]=8b00001100;
        shortrom_im[1]=8b00000001;
        shortrom_im[2]=8b11101100;
        shortrom_im[3]=8b11111101;
        shortrom_im[4]=8b00000000;
        shortrom_im[5]=8b11111101;
        shortrom_im[6]=8b11101100;
        shortrom_im[7]=8b00000001;
        shortrom_im[8]=8b00001100;
        shortrom_im[9]=8b11011110;
        shortrom_im[10]=8b11111101;
        shortrom_im[11]=8b00100100;
        shortrom_im[12]=8b00011000;
        shortrom_im[13]=8b00100100;
        shortrom_im[14]=8b11111101;
        shortrom_im[15]=8b11011110;
        
    end
    else 
    begin
        if(SHORT_ACK)
        begin
            if(i<=9)
            begin
                if(j<15)
                begin
                   SHORT_RE=shortrom_re[j];
                      SHORT_IM=shortrom_im[j];
                   SHORT_DV=1;
                   if(i==0&j==0)
                   begin
                        SHORT_RE=SHORT_RE>>1;
                        SHORT_IM=SHORT_IM>>1;
                   end
                   j=j+1;
                   SHORT_INDEX=SHORT_INDEX+1;
                end
                else 
                begin
                    SHORT_RE=shortrom_re[j];
                    SHORT_IM=shortrom_im[j];
                    SHORT_INDEX=SHORT_INDEX+1;
                    SHORT_DV=1;
                    j=0;
                    i=i+1;
                end
            end
            else 
            begin
                i=0;
                SHORT_RE=shortrom_re[j]>>1; 
                SHORT_IM=shortrom_im[j]>>1;
                SHORT_INDEX=SHORT_INDEX+1;
            end
        end
        else 
        begin
            i=0;
            j=0;
            SHORT_RE=0;
            SHORT_IM=0;
            SHORT_INDEX=0;
            SHORT_DV=0;
        end
    end
end

endmodule



/*


add_force {/short_generator/FFT_CLK} -radix hex {1 0ns} {0 50000ps} -repeat_every 100000ps
add_force {/short_generator/RESET} -radix hex {1 0ns} {0 200ns} {1 300ns}
add_force {/short_generator/SHORT_ACK} -radix hex {0 0ns} {1 600ns}



*/

 

以上是关于短训练序列---Verilog代码的主要内容,如果未能解决你的问题,请参考以下文章

Notepad++编辑器——Verilog代码片段直接编译

序列检测器(两种设计方法和四种检测模式|verilog代码|Testbench|仿真结果)

Verilog-检测输入序列能否被3整除

php 一个短代码片段准备在WooCommerce Thank You页面上输出货件跟踪UI。

verilog状态机检测110序列,急救!!!!!!!!!

六位数字序列连续出现,输出高电平并报警的verilog语言怎么写?