亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? add_cyclic_prefix.vhd

?? OFDM的fpga實現
?? VHD
?? 第 1 頁 / 共 2 頁
字號:
-- ================================================================================
-- (c) 2007 Altera Corporation. All rights reserved.
-- These design examples may only be used within Altera Corporation devices and remain 
-- the property of Altera. They are being provided on "as-is" basis and as an accommodation; 
-- therefore, all warranties, representations, or guarantees of any kind (whether express, 
-- implied, or statutory) including, without limitation, warranties of merchantability,
-- non-infringement, or fitness for a particular purpose, are specifically disclaimed.
-- Altera expressly does not recommend, suggest, or require that these examples be used
-- in combination with any other product not provided by Altera.
-- ================================================================================
-- 
-- Filename    : add_cyclic_prefix.vhd
--
-- Description : IFFT samples are input into this module in blocks of N samples over  
--               N cycles for input clk.
--
--               The first sample in a block of N is denoted by a high on SOP signal.
--               The last sample is denoted by a high on EOP signal.
--
--               This module outputs each block of N samples prepended by a number of 
--               samples CP copied from the end of the block. The output clk rate is at 
--               the required sample rate.
--
--              For worst case scenario, input and output clk rates are assumed to
--              be asynchronous.
--
--              The input buffer that holds the OFDM symbol data being fed into this 
--              submodule is two OFDM symbols deep.
--
--              The output from this submodule is continous.
--
--              This submodule halts the data being fed into this block by deasserting 
--              in_ready signal when the buffers are full. This forces the FFT
--              core feeding data into this submodule to stall.
-- ================================================================================

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
use std.textio.all;

entity add_cyclic_prefix is
  generic
    (
      DFFTOUTWIDTH : natural := 31;
      DOUTWIDTH    : natural := 32;
      NWIDTH       : natural := 12;     -- also works as Max B Width
      MWIDTH       : natural := 64;
      MADDR_WIDTH  : natural := 12;
      MDEPTH       : natural := 4096;
      CPWIDTH      : natural := 10
      );

  port
    (
      clk_in    : in std_logic;
      clk_out   : in std_logic;
      rst_in_n  : in std_logic;
      rst_out_n : in std_logic;

      -- Control 
      L    : in  std_logic_vector (CPWIDTH - 1 downto 0);
      N    : in  std_logic_vector(NWIDTH - 1 downto 0);
      Nout : out std_logic_vector(NWIDTH - 1 downto 0);
      Lout : out std_logic_vector (CPWIDTH - 1 downto 0);

      -- Avalon Streaming Input Interface
      in_real : in std_logic_vector (DFFTOUTWIDTH - 1 downto 0);
      in_imag : in std_logic_vector (DFFTOUTWIDTH - 1 downto 0);

      in_valid : in  std_logic;
      in_sop   : in  std_logic;
      in_eop   : in  std_logic;
      in_ready : out std_logic;

      out_ready : in std_logic;

      out_valid : out std_logic;
      out_sop   : out std_logic;
      out_eop   : out std_logic;
      out_real  : out std_logic_vector (DOUTWIDTH - 1 downto 0);
      out_imag  : out std_logic_vector (DOUTWIDTH - 1 downto 0);

      -- Interface with memory
      mem_dout : in std_logic_vector (MWIDTH - 1 downto 0);

      mem_din    : out    std_logic_vector (MWIDTH - 1 downto 0);
      mem_wren   : out    std_logic := '1';
      mem_wraddr : buffer std_logic_vector (MADDR_WIDTH - 1 downto 0);
      mem_rdaddr : buffer std_logic_vector (MADDR_WIDTH - 1 downto 0)
      );
end add_cyclic_prefix;

architecture rtl of add_cyclic_prefix is

  -----------------------------------------------------------------------------
  -- SIGNAL DECLARATIONS
  -----------------------------------------------------------------------------
  signal in_eop_r          : std_logic;
  signal in_eop_r2         : std_logic;
  signal in_sop_r          : std_logic;
  signal in_valid_r        : std_logic;
  signal in_real_r         : std_logic_vector(DFFTOUTWIDTH - 1 downto 0);
  signal in_imag_r         : std_logic_vector(DFFTOUTWIDTH - 1 downto 0);
  signal cp_start_addra    : std_logic_vector (MADDR_WIDTH - 1 downto 0);
  signal cp_start_addrb    : std_logic_vector (MADDR_WIDTH - 1 downto 0);
  -- for bit reversal
  signal tmp_mem_wraddr    : std_logic_vector (MADDR_WIDTH-1 downto 0);
  signal tmp_mem_wraddr_r  : std_logic_vector (MADDR_WIDTH-1 downto 0);
  signal mem_wraddr_offset : std_logic_vector (MADDR_WIDTH - 1 downto 0);
  signal d_real            : std_logic_vector(DOUTWIDTH - 1 downto 0);
  signal d_imag            : std_logic_vector (DOUTWIDTH -1 downto 0);

  signal buf_b_a_n              : std_logic;  -- current buffer being written to
  -- bufa_wr_tog: flip after finishing writing to A; keeps current value for 2
  -- packets (clk_in domain)
  signal bufa_wr_tog            : std_logic;
  signal bufb_wr_tog            : std_logic;
  -- bufa_wr_early_tog: flip when starting to write to A; keeps current value
  -- for 2 writing-packets (clk_in domain)
  signal bufa_wr_early_tog      : std_logic;
  signal bufb_wr_early_tog      : std_logic;
  -- bufa_wr_tog_r and _r2, sync to clk_out domain
  signal bufa_wr_tog_r          : std_logic;
  signal bufa_wr_tog_r2         : std_logic;
  signal bufb_wr_tog_r          : std_logic;
  signal bufb_wr_tog_r2         : std_logic;
  -- bufa_rd_tog: flip after reading out all the contents of A AND finishing
  -- writing to B; keeps current value for 2 reading-packets (clk_out domain)
  signal bufa_rd_tog            : std_logic;
  signal bufb_rd_tog            : std_logic;
  -- bufa_rd_tog_r, bufa_rd_tog_r2: sync to clk_in domain
  signal bufa_rd_tog_r          : std_logic;
  signal bufa_rd_tog_r2         : std_logic;
  signal bufb_rd_tog_r          : std_logic;
  signal bufb_rd_tog_r2         : std_logic;
  -- Buffer-can-be-read-out signal in clk_out domain; bufa_full asserts after
  -- finishing writing to A, and deasserts after finishing writing to B
  signal bufa_full              : std_logic;
  signal bufb_full              : std_logic;
  -- buffer-is-not-empty signal in clk_in domain;  bufa_taken asserts
  -- after starting writing to A and deasserts after starting reading out from
  -- B.  It is used to halt fft if buffer A and B are full.  Because two clk
  -- domains are used, it is possible that fft is halted while input-output
  -- control signals are synchronizing
  signal bufa_taken, bufb_taken : std_logic;

  -- clk_out domain signal; deasserts when outputing cyclic prefix
  signal post_cp       : std_logic;
  -- clk_out signal; indicates start of output data;
  signal start_read    : std_logic;
  signal bufa_sym_strt : std_logic_vector (2 downto 0);
  signal bufb_sym_strt : std_logic_vector (2 downto 0);

  -- cnt: clk_in domain counter recording how many fft output values have been
  -- written to memory; from 0 to FFT Size-1
  signal cnt     : std_logic_vector (NWIDTH - 1 downto 0);
  signal cnt_int : natural range 0 to MDEPTH;

  -- Avalon streaming in_ready signal
  signal in_ready_tmp : std_logic;
  signal in_ready_r   : std_logic;

  -- FFT Size for current buffer
  signal N_int  : natural range 0 to 2**(NWIDTH)-1;          
  signal Na, Nb : natural range 0 to MDEPTH/2 := MDEPTH/2;  -- clk_in domain signal
  signal B_int  : natural range 0 to 12;            -- = log2(N)

  -- L_int: integer version of CP size
  signal L_int  : natural range 0 to  2**(CPWIDTH)-1;
  signal La, Lb : natural range 0 to MDEPTH/2 := 0;

  -- output AST signals
  signal out_eop_a, out_eop_b : std_logic;
  signal out_eop_sr           : std_logic_vector (1 downto 0);
  signal out_valid_sr         : std_logic_vector (3 downto 0);
  signal tmp_eop              : std_logic;

  constant Nmax : natural := 2**(NWIDTH-1);
  
begin

  N_int <= to_integer(unsigned(N));
  L_int <= to_integer(unsigned(L));
  cnt   <= std_logic_vector(to_unsigned(cnt_int, NWIDTH));

  -----------------------------------------------------------------------------
  -- Writing Data to Dual Port RAM
  --
  -- Depth of RAM is equal to 2 OFDM symbols: Buffer A followed by Buffer B. 
  -----------------------------------------------------------------------------
  d_imag <= std_logic_vector(resize(signed(in_imag_r), DOUTWIDTH));
  d_real <= std_logic_vector(resize(signed(in_real_r), DOUTWIDTH));


  reg_input : process (clk_in, rst_in_n)
  begin
    if (rst_in_n = '0') then
      mem_din    <= (others => '0');
      in_eop_r   <= '0';
      in_sop_r   <= '0';
      in_valid_r <= '0';
      in_real_r  <= (others => '0');
      in_imag_r  <= (others => '0');
      in_eop_r2  <= in_eop_r;
    elsif rising_edge(clk_in) then
      mem_din    <= d_imag & d_real;
      in_eop_r   <= in_eop and in_valid;
      in_eop_r2  <= in_eop_r;
      in_valid_r <= in_valid;
      in_sop_r   <= in_sop;
      in_real_r  <= in_real;
      in_imag_r  <= in_imag;
    end if;
  end process reg_input;

  -- purpose: find B=log2(N)
  bitwidth_lut : process (N_int) is
  begin  -- process bitwidth_lut
    case N_int is
      when 8      => B_int <= 3;
      when 16     => B_int <= 4;
      when 32     => B_int <= 5;
      when 64     => B_int <= 6;
      when 128    => B_int <= 7;
      when 256    => B_int <= 8;
      when 512    => B_int <= 9;
      when 1024   => B_int <= 10;
      when 2048   => B_int <= 11;
      when others => B_int <= 0;
    end case;
  end process bitwidth_lut;

  write_cnt : process (clk_in, rst_in_n)
  begin  -- process write_cnt
    if rst_in_n = '0' then
      -- cnt records write address
      cnt_int <= 0;
    elsif rising_edge(clk_in) then
      -- cnt halts the cycle after fft_source_eop; thus it uses in_ready_tmp
      -- instead of in_ready_r
      if ((in_valid = '1') and (in_sop = '1') and (in_ready_tmp = '1')) then
        cnt_int <= 0;
      elsif in_eop_r = '1' then
        cnt_int <= 0;
      elsif (in_valid = '1') and (in_ready_tmp = '1') then
        cnt_int <= cnt_int + 1;
      end if;
    end if;
  end process write_cnt;

  bit_reversal : process (cnt, rst_in_n)
    variable j : natural range 0 to MADDR_WIDTH - 1;
  begin  -- process bit_reversal
    if rst_in_n = '1' then
      for j in 0 to MADDR_WIDTH - 1 loop
        if j < B_int then
          tmp_mem_wraddr(j) <= cnt(B_int -j-1);
        else
          tmp_mem_wraddr(j) <= '0';
        end if;
      end loop;
    else
      tmp_mem_wraddr <= (others => '0');
    end if;
  end process bit_reversal;

  reg_waddr : process (clk_in, rst_in_n)  -- register write address
  begin
    if (rst_in_n = '0') then
      tmp_mem_wraddr_r <= (others => '0');
    elsif rising_edge(clk_in) then
      tmp_mem_wraddr_r <= tmp_mem_wraddr;
    end if;
  end process reg_waddr;

  mem_wraddr <= tmp_mem_wraddr_r + mem_wraddr_offset;

  process (clk_in, rst_in_n)
  begin
    if (rst_in_n = '0') then
      mem_wren          <= '0';
      mem_wraddr_offset <= (others => '0');
      buf_b_a_n         <= '0';
      bufa_wr_early_tog <= '0';
      bufb_wr_early_tog <= '0';
      Na                <= 0;
      Nb                <= 0;
      La                <= 0;
      Lb                <= 0;
    elsif rising_edge(clk_in) then
      -- use in_ready_r because fft output is registered in this module.      
      if ((in_valid_r = '1') and (in_sop_r = '1') and (in_ready_r = '1')) then
        mem_wren  <= '1';
        buf_b_a_n <= not(buf_b_a_n);
        -- initialising addr counter 
        if (buf_b_a_n = '0') then       -- A being (will be) written to
          mem_wraddr_offset <= (others => '0');
          bufa_wr_early_tog <= not(bufa_wr_early_tog);
          -- Use Na and Nb to indicate what is the fft size for data stored in this
          -- buffer. It makes sure when bufa/b_rd_tog flips mem_raddr is comparing to the
          -- right fft size          
          Na                <= N_int;
          La                <= L_int;
        else
          mem_wraddr_offset <= std_logic_vector(to_unsigned(Nmax, MADDR_WIDTH));
          --offset should be from Nmax
          bufb_wr_early_tog <= not(bufb_wr_early_tog);
          Nb                <= N_int;
          Lb                <= L_int;
        end if;
      elsif (in_eop_r2 = '1') then
        mem_wren <= '0';

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影一区二区三区四区| 高清不卡在线观看av| 久久精品国内一区二区三区| 国产一区二三区| 99久久伊人网影院| 欧美老年两性高潮| 久久久久久97三级| 亚洲永久精品大片| 精品三级av在线| 中文字幕一区二区三区蜜月 | 成人永久免费视频| 在线观看日韩毛片| 久久久蜜臀国产一区二区| 国产精品国产a级| 蜜桃av一区二区| 色一情一伦一子一伦一区| 日韩精品一区国产麻豆| 亚洲美女偷拍久久| 国产成人鲁色资源国产91色综| 在线亚洲免费视频| 久久综合久久综合亚洲| 香蕉影视欧美成人| 欧美激情艳妇裸体舞| 欧美日韩一级二级| 国产欧美日韩在线| 青青草一区二区三区| 91免费版在线| 精品国产免费一区二区三区四区 | 91久久久免费一区二区| 欧美精品在欧美一区二区少妇| 欧美国产日韩在线观看| 美国欧美日韩国产在线播放| 欧美主播一区二区三区美女| 亚洲国产经典视频| 成人av免费观看| 精品日韩99亚洲| 国产又粗又猛又爽又黄91精品| 一本到不卡精品视频在线观看| 欧美日本视频在线| 91黄色免费版| 国产精品视频在线看| 狠狠色丁香婷综合久久| 亚洲国产精品黑人久久久| 欧美日韩国产天堂| 亚洲精品老司机| 欧美日韩在线直播| 中文字幕av一区二区三区高| 久久精品国产一区二区三区免费看| 91亚洲资源网| 国产精品国产三级国产aⅴ中文| 精品一区二区日韩| 91精品国产日韩91久久久久久| 亚洲一区二区三区爽爽爽爽爽| av在线不卡电影| 国产欧美一区二区精品忘忧草| 美腿丝袜一区二区三区| 制服丝袜日韩国产| 亚洲第一会所有码转帖| 色哟哟亚洲精品| 亚洲欧美日本在线| 99re在线精品| 亚洲麻豆国产自偷在线| a亚洲天堂av| 国产精品动漫网站| 99久久精品免费精品国产| 亚洲国产高清aⅴ视频| 懂色av一区二区三区免费看| 国产欧美一区二区精品性色超碰| 国产精品资源在线| 国产午夜亚洲精品羞羞网站| 国产在线视频一区二区三区| 精品对白一区国产伦| 激情久久五月天| 久久综合一区二区| 国产很黄免费观看久久| 久久精品一区二区| 国产成人精品www牛牛影视| 中文字幕欧美激情一区| 99久久伊人久久99| 一区二区三区日本| 这里只有精品视频在线观看| 免费成人在线播放| 久久久亚洲高清| 成人晚上爱看视频| 亚洲乱码精品一二三四区日韩在线| 色综合久久综合网97色综合| 亚洲线精品一区二区三区| 制服丝袜日韩国产| 国产在线一区二区综合免费视频| 中文字幕免费观看一区| 97精品国产97久久久久久久久久久久| 一区二区三区不卡视频| 欧美日本视频在线| 久久精品国产亚洲高清剧情介绍 | 久久亚洲一级片| 成人小视频免费观看| 欧美国产精品一区| 91性感美女视频| 婷婷综合另类小说色区| 久久婷婷国产综合精品青草| 中文字幕国产一区二区| 91国产视频在线观看| 日本在线不卡一区| 欧美高清在线一区| 欧美色男人天堂| 激情综合网天天干| 亚洲人吸女人奶水| 欧美日韩日日骚| 国产自产v一区二区三区c| 亚洲欧美在线观看| 日韩一区二区麻豆国产| 成熟亚洲日本毛茸茸凸凹| 亚洲一区视频在线观看视频| 日韩一级片网址| 91美女蜜桃在线| 蜜桃久久久久久| 日韩美女啊v在线免费观看| 8v天堂国产在线一区二区| 国产成人一区二区精品非洲| 亚洲专区一二三| 精品99一区二区| 色成年激情久久综合| 久久99最新地址| 一区二区三区中文字幕电影| 26uuu久久综合| 欧美色精品天天在线观看视频| 国产精品66部| 日韩不卡在线观看日韩不卡视频| 亚洲国产精品精华液2区45| 67194成人在线观看| 不卡大黄网站免费看| 看电视剧不卡顿的网站| 一区二区三区在线视频播放| 久久噜噜亚洲综合| 在线电影国产精品| 99久久免费精品高清特色大片| 蜜桃一区二区三区四区| 亚洲精品写真福利| 久久精品视频一区二区三区| 欧美日韩视频在线一区二区| 成人动漫一区二区| 久久91精品国产91久久小草| 夜夜嗨av一区二区三区四季av| 国产偷v国产偷v亚洲高清| 91精品国产综合久久福利 | 亚洲男人的天堂av| 久久久高清一区二区三区| 欧美男人的天堂一二区| 色综合久久中文综合久久牛| 国产成人啪免费观看软件| 免费美女久久99| 亚洲成av人影院| 亚洲青青青在线视频| 国产午夜久久久久| 精品久久久久久久久久久久久久久| 欧美吻胸吃奶大尺度电影 | 亚洲欧美另类综合偷拍| 欧美精彩视频一区二区三区| 日韩精品一区二区三区三区免费| 欧美色中文字幕| 色哟哟欧美精品| 国产精品美女久久久久久 | 99re热视频这里只精品| 国产高清成人在线| 国内精品久久久久影院色| 毛片av一区二区三区| 偷拍一区二区三区四区| 亚洲一区二区av电影| 日韩美女视频一区| 国产精品久久午夜夜伦鲁鲁| 中文字幕欧美日韩一区| 久久久久久97三级| 久久久www成人免费无遮挡大片| 欧美一区二区三区的| 欧美精品三级在线观看| 欧美日韩亚洲综合一区| 欧美日本在线看| 91麻豆精品国产| 制服丝袜中文字幕一区| 欧美一区二区高清| 日韩一区二区高清| 精品三级在线看| 久久伊人中文字幕| 国产午夜精品福利| 国产精品麻豆网站| 亚洲日本乱码在线观看| 一区二区免费视频| 亚洲一区二区不卡免费| 午夜精品久久久久久久久| 日本不卡1234视频| 久久福利资源站| 国产精品一区专区| 国产99久久久国产精品潘金网站| 成人精品高清在线| 91在线国产观看| 欧美视频你懂的| 欧美一区二区三区在线视频 | 国产精品1024| aaa欧美日韩| 欧美亚洲一区三区|