wave_gen.v

来自「32位单精度浮点加法器」· Verilog 代码 · 共 457 行 · 第 1/2 页

V
457
字号
    .rst_clk_samp    (rst_clk_samp)     // Reset, synchronized to clk_samp  );  // Instantiate the UART receiver  uart_rx #(    .BAUD_RATE   (BAUD_RATE),    .CLOCK_RATE  (CLOCK_RATE_RX)  ) uart_rx_i0 (    .clk_rx      (clk_rx),              // Receive clock    .rst_clk_rx  (rst_clk_rx),          // Reset, synchronized to clk_rx     .rxd_i       (rxd_i),               // RS232 receive pin        .rx_data_rdy (rx_data_rdy),         // New character is ready    .rx_data     (rx_data),             // New character    .frm_err     ()                     // Framing error (unused)  );  // Instantiate the command parser  cmd_parse #(    .PW          (PW),    .NSAMP_WID   (NSAMP_WID)  ) cmd_parse_i0 (    .clk_rx            (clk_rx),         // Clock input    .rst_clk_rx        (rst_clk_rx),     // Reset - synchronous to clk_rx    .rx_data           (rx_data),        // Character to be parsed    .rx_data_rdy       (rx_data_rdy),    // Ready signal for rx_data    // From Character FIFO    .char_fifo_full    (char_fifo_full), // The char_fifo is full    // To/From Response generator    .send_char_val     (send_char_val),  // A character is ready to be sent    .send_char         (send_char),      // Character to be sent    .send_resp_val     (send_resp_val),  // A response is requested    .send_resp_type    (send_resp_type), // Type of response - see localparams    .send_resp_data    (send_resp_data), // Data to be output    .send_resp_done    (send_resp_done), // The response generation is complete    // To the bus clock crossers    .nsamp_clk_rx      (nsamp_clk_rx),   // Current value of nsamp    .nsamp_new_clk_rx  (nsamp_new_clk_rx), // A new nsamp is available    .pre_clk_rx        (pre_clk_rx),     // Current value of prescale    .pre_new_clk_rx    (pre_new_clk_rx), // A new prescale is available    .spd_clk_rx        (spd_clk_rx),     // Current value of speed    .spd_new_clk_rx    (spd_new_clk_rx), // A new speed is available    // To the sample generator    .samp_gen_go_clk_rx(samp_gen_go_clk_rx), // Enable for sample generator    // To/From Sample RAM    .cmd_samp_ram_din  (cmd_samp_ram_din), // Data to write to sample RAM    .cmd_samp_ram_addr (cmd_samp_ram_addr),// Address for sample RAM rd or wr    .cmd_samp_ram_we   (cmd_samp_ram_we),  // Write enable to sample RAM    .cmd_samp_ram_dout (cmd_samp_ram_dout) // Read data from sample RAM  );  // Instantiate sample RAM  samp_ram samp_ram_i0 (    .clka       (clk_rx),    .dina       (cmd_samp_ram_din), // Bus [15 : 0]     .addra      (cmd_samp_ram_addr), // Bus [9 : 0]     .wea        (cmd_samp_ram_we), // Bus [0 : 0]     .douta      (cmd_samp_ram_dout), // Bus [15 : 0]     .clkb       (clk_samp),    .dinb       (16'b0), // Bus [15 : 0]     .addrb      (samp_gen_samp_ram_addr), // Bus [9 : 0]     .web        (1'b0), // Bus [0 : 0]  - we don't write on port B    .doutb      (samp_gen_samp_ram_dout) // Bus [15 : 0]   );  // Instantiate the Response Generator  resp_gen resp_gen_i0 (    .clk_rx             (clk_rx),         // Clock input    .rst_clk_rx         (rst_clk_rx),     // Reset - synchronous to clk_rx    // From Character FIFO    .char_fifo_full     (char_fifo_full), // The char_fifo is full    // To/From the Command Parser    .send_char_val      (send_char_val),  // A character is ready to be sent    .send_char          (send_char),      // Character to be sent    .send_resp_val      (send_resp_val),  // A response is requested    .send_resp_type     (send_resp_type), // Type of response - see localparams    .send_resp_data     (send_resp_data), // Data to be output    .send_resp_done     (send_resp_done), // The response generation is complete    // To character FIFO    .char_fifo_din      (char_fifo_din),  // Character to push into the FIFO    .char_fifo_wr_en    (char_fifo_wr_en) // Write enable (push) for the FIFO  );  // Instantiate the Character FIFO - Core generator module  char_fifo char_fifo_i0 (    .din        (char_fifo_din), // Bus [7 : 0]     .rd_clk     (clk_tx),    .rd_en      (char_fifo_rd_en),    .rst        (rst_i),          // ASYNCHRONOUS reset - to both sides    .wr_clk     (clk_rx),    .wr_en      (char_fifo_wr_en),    .dout       (char_fifo_dout), // Bus [7 : 0]     .empty      (char_fifo_empty),    .full       (char_fifo_full)  );  // Instantiate the UART transmitter  uart_tx #(    .BAUD_RATE    (BAUD_RATE),    .CLOCK_RATE   (CLOCK_RATE_TX)  ) uart_tx_i0 (    .clk_tx             (clk_tx),          // Clock input    .rst_clk_tx         (rst_clk_tx),      // Reset - synchronous to clk_tx    .char_fifo_empty    (char_fifo_empty), // Empty signal from char FIFO (FWFT)    .char_fifo_dout     (char_fifo_dout),  // Data from the char FIFO    .char_fifo_rd_en    (char_fifo_rd_en), // Pop signal to the char FIFO    .txd_tx             (txd_tx)           // The transmit serial signal  );  // Instantiate the loopback controller  lb_ctl lb_ctl_i0 (    .clk_tx     (clk_tx),          // Clock input    .rst_clk_tx (rst_clk_tx),      // Active HIGH reset - synchronous to clk_tx    .lb_sel_i   (lb_sel_i),        // Undebounced slide switch input    .txd_tx     (txd_tx),          // Normal transmit data    .rxd_i      (rxd_i),           // Raw receive data    .txd_o      (txd_o)            // Transmit data to pin  );  // Instantiate the three clock crossing modules for nsamp, speed, and  // prescale  clkx_bus #(    .PW    (PW),    .WIDTH (NSAMP_WID+1)  ) clkx_nsamp_i0 (    .clk_src      (clk_rx),    .rst_clk_src  (rst_clk_rx),    .clk_dst      (clk_tx),    .rst_clk_dst  (rst_clk_tx),    .bus_src      (nsamp_clk_rx),    .bus_new_src  (nsamp_new_clk_rx),    .bus_dst      (nsamp_clk_tx),    .bus_new_dst  (nsamp_new_clk_tx)  );  clkx_bus #(    .PW    (PW),    .WIDTH (16)  ) clkx_pre_i0 (    .clk_src      (clk_rx),    .rst_clk_src  (rst_clk_rx),    .clk_dst      (clk_tx),    .rst_clk_dst  (rst_clk_tx),    .bus_src      (pre_clk_rx),    .bus_new_src  (pre_new_clk_rx),    .bus_dst      (pre_clk_tx),    .bus_new_dst  (pre_new_clk_tx)  );  clkx_bus #(    .PW    (PW),    .WIDTH (16)  ) clkx_spd_i0 (    .clk_src      (clk_rx),    .rst_clk_src  (rst_clk_rx),    .clk_dst      (clk_tx),    .rst_clk_dst  (rst_clk_tx),    .bus_src      (spd_clk_rx),    .bus_new_src  (spd_new_clk_rx),    .bus_dst      (spd_clk_tx),    .bus_new_dst  (spd_new_clk_tx)  );  // Instantiate the sample generator  samp_gen #(    .NSAMP_WID  (NSAMP_WID)  ) samp_gen_i0 (    .clk_tx       (clk_tx),       // Clock input    .rst_clk_tx   (rst_clk_tx),   // Active HIGH reset - synchronous to clk_tx    .clk_samp     (clk_samp),     // Clock input    .rst_clk_samp (rst_clk_samp), // Active HIGH reset - synchronous to clk_samp    .en_clk_samp  (en_clk_samp),  // Last clk_tx phase of clk_samp    .samp_gen_go_clk_rx  (samp_gen_go_clk_rx), // Starts samp_gen - on clk_rx    .nsamp_clk_tx (nsamp_clk_tx), // Current value of nsamp    .spd_clk_tx   (spd_clk_tx),   // Current value of speed    .samp_gen_samp_ram_addr  (samp_gen_samp_ram_addr), // Address to sample RAM    .samp_gen_samp_ram_dout  (samp_gen_samp_ram_dout), // Data from samp RAM    .samp         (samp),         // Sample output    .samp_val     (samp_val),     // New sample is available    .led_o        (led_o)         // Upper bits of samples sent to LEDs  );  // Instantiat the SPI controller  dac_spi dac_spi_i0 (    .clk_tx        (clk_tx),       // Clock input    .rst_clk_tx    (rst_clk_tx),   // Active HIGH reset - synchronous to clk_tx    .en_clk_samp   (en_clk_samp),  // Last clk_tx phase of clk_samp    .samp          (samp),         // Sample output    .samp_val      (samp_val),     // New sample is available    // Control to the A to D converter    .spi_clk_o     (spi_clk_o),    // Clock for SPI - generated by DDR flop    .spi_mosi_o    (spi_mosi_o),   // SPI master-out-slave-in data bit    .dac_cs_n_o    (dac_cs_n_o),   // Chip select for DAC    .dac_clr_n_o   (dac_clr_n_o)   // Active low clear  );endmodule

⌨️ 快捷键说明

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