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

📄 cic3s32.v

📁 这是基于s3c2410+uCos的LCD驱动程序源码
💻 V
字号:
//*********************************************************
// IEEE STD 1364-1995 Verilog file: cic3s32.v
// Author-EMAIL: Uwe.Meyer-Baese@ieee.org
//*********************************************************
module cic3s32 (clk, x_in, y_out); //----> Interface

  input        clk;
  input  [7:0] x_in;
  output [8:0] y_out;
  reg    [7:0] y;

  parameter hold=0, sample=1;
  reg [1:0] state;
  reg [4:0]  count;
  reg  clk2;
  reg  [7:0]  x;                     // Registered input
  wire [25:0] sxtx;                  // Sign extended input
  reg  [25:0] i0;                    // I section 0
  reg  [20:0] i1;                    // I section 1
  reg  [15:0] i2;                    // I section 2
  reg  [13:0] i2d1, i2d2, i2d3, i2d4, c1, c0; // I + COMB 0
  reg  [12:0] c1d1, c1d2, c1d3, c1d4, c2; // COMB section 1
  reg  [11:0] c2d1, c2d2, c2d3, c2d4, c3; // COMB section 2
      
  always @(negedge clk)
  begin : FSM
    case (state) 
      hold : begin   
        if (count < 31)
           state <= hold;
        else
           state <= sample;
        end
      default :
        state <= hold;
    endcase  
  end

  assign sxtx = {{18{x[7]}},x};

  always @(posedge clk) 
  begin : Int
      x   <= x_in;
      i0  <= i0 + sxtx;        
      i1  <= i1 + i0[25:5];        
      i2  <= i2 + i1[20:5];  
    case (state) 
      sample : begin   
        c0    <= i2[15:2];
        count <= 0;
      end
      default : 
        count <= count + 1;
    endcase  
    if ((count > 8) && (count < 16))
      clk2  <= 1;
    else
      clk2  <= 0;
  end

  always @(posedge clk2) 
  begin : Comb
      i2d1 <= c0;
      i2d2 <= i2d1;
      c1   <= c0 - i2d2;
      c1d1 <= c1[13:1];
      c1d2 <= c1d1;
      c2   <= c1[13:1] - c1d2;
      c2d1 <= c2[12:1];
      c2d2 <= c2d1;
      c3   <= c2[12:1] - c2d2;
  end

  assign y_out = c3[11:3];

endmodule

⌨️ 快捷键说明

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