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

📄 wave_gen.v

📁 32位单精度浮点加法器
💻 V
📖 第 1 页 / 共 2 页
字号:
//-----------------------------------------------------------------------------//  //  Copyright (c) 2009 Xilinx Inc.////  Project  : Programmable Wave Generator//  Module   : wave_gen.v//  Parent   : None//  Children : Many////  Description: //     This is the top level of the wave generator.//     It directly instantiates the I/O pads and all the submodules required//     to implement the design.////  Parameters://     BAUD_RATE:     Desired Baud rate for both RX and TX//     CLOCK_RATE_RX: Clock rate for the RX domain//     CLOCK_RATE_TX: Clock rate for the TX domain////  Local Parameters:////  Notes       : ////  Multicycle and False Paths//    Some exist, embedded within the submodules. See the submodule//    descriptions.//`timescale 1ns/1psmodule wave_gen (  input            clk_pin,        // Clock input (from pin)  input            rst_pin,        // Active HIGH reset (from pin)  // RS232 signals  input            rxd_pin,        // RS232 RXD pin  output           txd_pin,        // RS232 RXD pin  // Loopback selector  input            lb_sel_pin,     // Loopback selector   // DAC output signals  output           spi_clk_pin,    // Serial clock  output           spi_mosi_pin,   // Serial data  output           dac_cs_n_pin,   // DAC chip select (active low)  output           dac_clr_n_pin,  // DAC clear (or reset - active low)  // LED outputs  output     [7:0] led_pins         // 8 LED outputs);//***************************************************************************// Parameter definitions//***************************************************************************  parameter BAUD_RATE           = 115_200;     parameter CLOCK_RATE_RX       = 27_000_000;  parameter CLOCK_RATE_TX       = 27_000_000;   // Minimum width of a pulse to cross between clk_rx and clk_tx  parameter PW                  = 3;    // Number of bits of address for the Sample RAM - RAM can hold 2^NSAMP_WID  // Since NSAMP is coded "naturally" (from 1 to 2**NSAMP_WID, rather than  // from 0 to 2**(NSAMP_WID)-1), an extra bit is required in things that  // carry the actual value of nsamp. However, the RAM address is coded  // 0 to 2**NSAMP_WID-1  parameter NSAMP_WID           = 10; //***************************************************************************// Reg declarations//***************************************************************************//***************************************************************************// Wire declarations//***************************************************************************  // To/From IBUFG/OBUFG  // No pin for clock - the IBUFG is internal to clk_gen  wire        rst_i;            wire        rxd_i;           wire        txd_o;  wire        lb_sel_i;  wire        spi_clk_o;  wire        spi_mosi_o;  wire        dac_cs_n_o;  wire [7:0]  led_o;  // From Clock Generator  wire        clk_rx;         // Receive clock  wire        clk_tx;         // Transmit clock  wire        clk_samp;       // Sample clock  wire        en_clk_samp;    // Enable for clk_samp, syncronous to clk_tx  wire        clock_locked;   // Locked signal from clk_core  // From Reset Generator  wire        rst_clk_rx;     // Reset, synchronized to clk_rx  wire        rst_clk_tx;     // Reset, synchronized to clk_tx  wire        rst_clk_samp;   // Reset, synchronized to clk_samp  // From the RS232 receiver  wire        rx_data_rdy;    // New character is ready  wire [7:0]  rx_data;        // New character  // From the command parser to the response generator  wire        send_char_val;  // A character is ready to be sent  wire [7:0]  send_char;      // Character to be sent  wire        send_resp_val;  // A response is requested  wire [1:0]  send_resp_type; // Type of response - see localparams  wire [15:0] send_resp_data; // Data to be output  // From the command parser to bus clock crossers  wire [NSAMP_WID:0]               nsamp_clk_rx;       // Current value of nsamp  wire        nsamp_new_clk_rx;   // A new nsamp is available    wire [15:0] pre_clk_rx;         // Current value of prescale  wire        pre_new_clk_rx;     // A new prescale is available  wire [15:0] spd_clk_rx;         // Current value of speed  wire        spd_new_clk_rx;     // A new speed is available  // From the command parser to the sample generator  wire        samp_gen_go_clk_rx; // Enable for sample generator  // From the command parser To Sample RAM  wire [15:0] cmd_samp_ram_din; // Data to write to sample RAM  wire [NSAMP_WID-1:0]                cmd_samp_ram_addr;// Address for sample RAM read or write  wire        cmd_samp_ram_we;  // Write enable to sample RAM  // From the response generator back to the command parser  wire        send_resp_done;   // The response generation is complete  // From the response generator to character FIFO  wire [7:0]  char_fifo_din;    // Character to push into the FIFO  wire        char_fifo_wr_en;  // Write enable (push) for the FIFO  // From the character FIFO  wire [7:0]  char_fifo_dout;   // Character to be popped from the FIFO  wire        char_fifo_full;   // The character FIFO is full  wire        char_fifo_empty;  // The character FIFO is full  // From the UART transmitter  wire        char_fifo_rd_en;  // Pop signal to the char FIFO  wire        txd_tx;           // The transmit serial signal  // From the Sample RAM  wire [15:0] cmd_samp_ram_dout;     // Data read back to the command parser  wire [15:0] samp_gen_samp_ram_dout;// Data read to the sample generator  // From the clock crossers for nsamp, pre, and speed  wire [NSAMP_WID:0]               nsamp_clk_tx;       // Current value of nsamp  wire        nsamp_new_clk_tx;   // A new nsamp is available    wire [15:0] pre_clk_tx;         // Current value of prescale  wire        pre_new_clk_tx;     // A new prescale is available  wire [15:0] spd_clk_tx;         // Current value of speed  wire        spd_new_clk_tx;     // A new speed is available  // From the sample generator  wire [NSAMP_WID-1:0]               samp_gen_samp_ram_addr; // Address to sample RAM  wire [15:0] samp;               // Sample output  wire        samp_val;           // New sample is available//***************************************************************************// Code//***************************************************************************  // Instantiate input/output buffers  IBUF IBUF_rst_i0      (.I (rst_pin),      .O (rst_i));  IBUF IBUF_rxd_i0      (.I (rxd_pin),      .O (rxd_i));  IBUF IBUF_lb_sel_i0   (.I (lb_sel_pin),   .O (lb_sel_i));  OBUF OBUF_txd         (.I(txd_o),         .O(txd_pin));  OBUF OBUF_spi_clk     (.I(spi_clk_o),     .O(spi_clk_pin));  OBUF OBUF_spi_mosi    (.I(spi_mosi_o),    .O(spi_mosi_pin));  OBUF OBUF_dac_cs_n    (.I(dac_cs_n_o),    .O(dac_cs_n_pin));  OBUF OBUF_dac_clr_n   (.I(dac_clr_n_o),  .O(dac_clr_n_pin));  OBUF OBUF_led_i0      (.I(led_o[0]),      .O(led_pins[0]));  OBUF OBUF_led_i1      (.I(led_o[1]),      .O(led_pins[1]));  OBUF OBUF_led_i2      (.I(led_o[2]),      .O(led_pins[2]));  OBUF OBUF_led_i3      (.I(led_o[3]),      .O(led_pins[3]));  OBUF OBUF_led_i4      (.I(led_o[4]),      .O(led_pins[4]));  OBUF OBUF_led_i5      (.I(led_o[5]),      .O(led_pins[5]));  OBUF OBUF_led_i6      (.I(led_o[6]),      .O(led_pins[6]));  OBUF OBUF_led_i7      (.I(led_o[7]),      .O(led_pins[7]));  // Instantiate the clock generator  clk_gen clk_gen_i0 (    .clk_pin         (clk_pin),         // Input clock pin - IBUFG is in core    .rst_i           (rst_i),           // Asynchronous input from IBUF    .rst_clk_tx      (rst_clk_tx),      // For clock divider    .pre_clk_tx      (pre_clk_tx),      // Current divider    .clk_rx          (clk_rx),          // Receive clock    .clk_tx          (clk_tx),          // Transmit clock    .clk_samp        (clk_samp),        // Sample clock    .en_clk_samp     (en_clk_samp),     // Enable for clk_samp    .clock_locked    (clock_locked)     // Locked signal from clk_core  );  // Instantiate the reset generator  rst_gen rst_gen_i0 (    .clk_rx          (clk_rx),          // Receive clock    .clk_tx          (clk_tx),          // Transmit clock    .clk_samp        (clk_samp),        // Sample clock    .rst_i           (rst_i),           // Asynchronous input - from IBUF    .clock_locked    (clock_locked),    // Locked signal from clk_core    .rst_clk_rx      (rst_clk_rx),      // Reset, synchronized to clk_rx    .rst_clk_tx      (rst_clk_tx),      // Reset, synchronized to clk_tx

⌨️ 快捷键说明

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