⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lowpassfiltervhdlcord.txt

📁 低通滤波器的VHDL代码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
  b1sum1 <= resize( shift_right( add_temp(37 DOWNTO 17) + 1, 1), 20);

  add_temp_1 <= resize(b1sum1 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b3mul1, 39);
  b2sum1 <= resize( shift_right( add_temp_1(37 DOWNTO 17) + 1, 1), 20);

  sub_temp <= resize(b2sum1 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a2mul1, 39);
  a2sum1 <= resize( shift_right( sub_temp(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_1 <= resize(a2sum1 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a3mul1, 39);
  a1sum1 <= resize( shift_right( sub_temp_1(37 DOWNTO 17) + 1, 1), 20);

  -- ------------------ Section 2 ------------------

  numtypeconvert2 <= dentypeconvert1;

  dentypeconvert2 <= resize( a1sum2(15 DOWNTO 0) & '0' & '0' & '0' & '0', 20);

  -- Reusing denominator delays from last section as this section's numerator delays

  dendelay_process_section2 : PROCESS (clk, reset)
  BEGIN
    IF reset = '1' THEN
      dendelay_section2(0 TO 1) <= (OTHERS => (OTHERS => '0'));
    ELSIF clk'event AND clk = '1' THEN
      IF clk_enable = '1' THEN
        dendelay_section2(0) <= dentypeconvert2;
        dendelay_section2(1) <= dendelay_section2(0);
      END IF;
    END IF; 
  END PROCESS dendelay_process_section2;


  a2mul2 <= dendelay_section2(0) * coeff_a2_section2;

  a3mul2 <= dendelay_section2(1) * coeff_a3_section2;

  b1mul2 <= numtypeconvert2 * coeff_b1_section2;

  b2mul2 <= dendelay_section1(0) * coeff_b2_section2;

  b3mul2 <= dendelay_section1(1) * coeff_b3_section2;

  b1multypeconvert2 <= resize( shift_right( (b1mul2(35) & b1mul2(35 DOWNTO 17) + 1), 1), 20);

  add_temp_2 <= resize(b1multypeconvert2 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b2mul2, 39);
  b1sum2 <= resize( shift_right( add_temp_2(37 DOWNTO 17) + 1, 1), 20);

  add_temp_3 <= resize(b1sum2 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b3mul2, 39);
  b2sum2 <= resize( shift_right( add_temp_3(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_2 <= resize(b2sum2 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a2mul2, 39);
  a2sum2 <= resize( shift_right( sub_temp_2(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_3 <= resize(a2sum2 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a3mul2, 39);
  a1sum2 <= resize( shift_right( sub_temp_3(37 DOWNTO 17) + 1, 1), 20);

  -- ------------------ Section 3 ------------------

  numtypeconvert3 <= dentypeconvert2;

  dentypeconvert3 <= resize( a1sum3(15 DOWNTO 0) & '0' & '0' & '0' & '0', 20);

  -- Reusing denominator delays from last section as this section's numerator delays

  dendelay_process_section3 : PROCESS (clk, reset)
  BEGIN
    IF reset = '1' THEN
      dendelay_section3(0 TO 1) <= (OTHERS => (OTHERS => '0'));
    ELSIF clk'event AND clk = '1' THEN
      IF clk_enable = '1' THEN
        dendelay_section3(0) <= dentypeconvert3;
        dendelay_section3(1) <= dendelay_section3(0);
      END IF;
    END IF; 
  END PROCESS dendelay_process_section3;


  a2mul3 <= dendelay_section3(0) * coeff_a2_section3;

  a3mul3 <= dendelay_section3(1) * coeff_a3_section3;

  b1mul3 <= numtypeconvert3 * coeff_b1_section3;

  b2mul3 <= dendelay_section2(0) * coeff_b2_section3;

  b3mul3 <= dendelay_section2(1) * coeff_b3_section3;

  b1multypeconvert3 <= resize( shift_right( (b1mul3(35) & b1mul3(35 DOWNTO 17) + 1), 1), 20);

  add_temp_4 <= resize(b1multypeconvert3 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b2mul3, 39);
  b1sum3 <= resize( shift_right( add_temp_4(37 DOWNTO 17) + 1, 1), 20);

  add_temp_5 <= resize(b1sum3 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b3mul3, 39);
  b2sum3 <= resize( shift_right( add_temp_5(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_4 <= resize(b2sum3 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a2mul3, 39);
  a2sum3 <= resize( shift_right( sub_temp_4(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_5 <= resize(a2sum3 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a3mul3, 39);
  a1sum3 <= resize( shift_right( sub_temp_5(37 DOWNTO 17) + 1, 1), 20);

  -- ------------------ Section 4 ------------------

  numtypeconvert4 <= dentypeconvert3;

  dentypeconvert4 <= resize( a1sum4(15 DOWNTO 0) & '0' & '0' & '0' & '0', 20);

  -- Reusing denominator delays from last section as this section's numerator delays

  dendelay_process_section4 : PROCESS (clk, reset)
  BEGIN
    IF reset = '1' THEN
      dendelay_section4(0 TO 1) <= (OTHERS => (OTHERS => '0'));
    ELSIF clk'event AND clk = '1' THEN
      IF clk_enable = '1' THEN
        dendelay_section4(0) <= dentypeconvert4;
        dendelay_section4(1) <= dendelay_section4(0);
      END IF;
    END IF; 
  END PROCESS dendelay_process_section4;


  a2mul4 <= dendelay_section4(0) * coeff_a2_section4;

  a3mul4 <= dendelay_section4(1) * coeff_a3_section4;

  b1mul4 <= numtypeconvert4 * coeff_b1_section4;

  b2mul4 <= dendelay_section3(0) * coeff_b2_section4;

  b3mul4 <= dendelay_section3(1) * coeff_b3_section4;

  b1multypeconvert4 <= resize( shift_right( (b1mul4(35) & b1mul4(35 DOWNTO 17) + 1), 1), 20);

  add_temp_6 <= resize(b1multypeconvert4 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b2mul4, 39);
  b1sum4 <= resize( shift_right( add_temp_6(37 DOWNTO 17) + 1, 1), 20);

  add_temp_7 <= resize(b1sum4 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b3mul4, 39);
  b2sum4 <= resize( shift_right( add_temp_7(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_6 <= resize(b2sum4 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a2mul4, 39);
  a2sum4 <= resize( shift_right( sub_temp_6(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_7 <= resize(a2sum4 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a3mul4, 39);
  a1sum4 <= resize( shift_right( sub_temp_7(37 DOWNTO 17) + 1, 1), 20);

  -- ------------------ Section 5 ------------------

  numtypeconvert5 <= dentypeconvert4;

  dentypeconvert5 <= resize( a1sum5(15 DOWNTO 0) & '0' & '0' & '0' & '0', 20);

  -- Reusing denominator delays from last section as this section's numerator delays

  dendelay_process_section5 : PROCESS (clk, reset)
  BEGIN
    IF reset = '1' THEN
      dendelay_section5(0 TO 1) <= (OTHERS => (OTHERS => '0'));
    ELSIF clk'event AND clk = '1' THEN
      IF clk_enable = '1' THEN
        dendelay_section5(0) <= dentypeconvert5;
        dendelay_section5(1) <= dendelay_section5(0);
      END IF;
    END IF; 
  END PROCESS dendelay_process_section5;


  a2mul5 <= dendelay_section5(0) * coeff_a2_section5;

  a3mul5 <= dendelay_section5(1) * coeff_a3_section5;

  b1mul5 <= numtypeconvert5 * coeff_b1_section5;

  b2mul5 <= dendelay_section4(0) * coeff_b2_section5;

  b3mul5 <= dendelay_section4(1) * coeff_b3_section5;

  b1multypeconvert5 <= resize( shift_right( (b1mul5(35) & b1mul5(35 DOWNTO 17) + 1), 1), 20);

  add_temp_8 <= resize(b1multypeconvert5 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b2mul5, 39);
  b1sum5 <= resize( shift_right( add_temp_8(37 DOWNTO 17) + 1, 1), 20);

  add_temp_9 <= resize(b1sum5 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b3mul5, 39);
  b2sum5 <= resize( shift_right( add_temp_9(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_8 <= resize(b2sum5 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a2mul5, 39);
  a2sum5 <= resize( shift_right( sub_temp_8(37 DOWNTO 17) + 1, 1), 20);

  sub_temp_9 <= resize(a2sum5 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) - resize(a3mul5, 39);
  a1sum5 <= resize( shift_right( sub_temp_9(37 DOWNTO 17) + 1, 1), 20);

  -- ------------------ Section 6 ------------------

  numtypeconvert6 <= dentypeconvert5;

  dentypeconvert6 <= resize( a1sum6(15 DOWNTO 0) & '0' & '0' & '0' & '0', 20);

  -- Reusing denominator delays from last section as this section's numerator delays

  dendelay_process_section6 : PROCESS (clk, reset)
  BEGIN
    IF reset = '1' THEN
      dendelay_section6(0 TO 1) <= (OTHERS => (OTHERS => '0'));
    ELSIF clk'event AND clk = '1' THEN
      IF clk_enable = '1' THEN
        dendelay_section6(0) <= dentypeconvert6;
        dendelay_section6(1) <= dendelay_section6(0);
      END IF;
    END IF; 
  END PROCESS dendelay_process_section6;


  a2mul6 <= dendelay_section6(0) * coeff_a2_section6;

  a3mul6 <= dendelay_section6(1) * coeff_a3_section6;

  b1mul6 <= numtypeconvert6 * coeff_b1_section6;

  b2mul6 <= dendelay_section5(0) * coeff_b2_section6;

  b3mul6 <= dendelay_section5(1) * coeff_b3_section6;

  b1multypeconvert6 <= resize( shift_right( (b1mul6(35) & b1mul6(35 DOWNTO 17) + 1), 1), 20);

  add_temp_10 <= resize(b1multypeconvert6 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b2mul6, 39);
  b1sum6 <= resize( shift_right( add_temp_10(37 DOWNTO 17) + 1, 1), 20);

  add_temp_11 <= resize(b1sum6 & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0', 39) + resize(b3mul6, 39);
  b2sum6 <= resize( shift_right( add_temp_11(37 DOWNTO 17) + 1, 1), 20);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -