代码拉取完成,页面将自动刷新
/** \file
* Test the serial input/output to the FTDI chip.
*
* This configures the serial port at 3 Mb/s and directly routes
* the incoming data to the outbound serial port.
*
* The schematic disagrees with the PCF, but the PCF works...
*
* The SPI flash chip select *MUST* be pulled high to disable the
* flash chip, otherwise they will both be driving the bus.
*/
`include "util.v"
`include "uart.v"
module top(
output led_r,
output led_g,
output led_b,
output serial_txd,
input serial_rxd,
output spi_cs,
output gpio_2
);
assign spi_cs = 1; // it is necessary to turn off the SPI flash chip
wire debug0 = gpio_2;
wire clk_48;
wire reset = 0;
SB_HFOSC u_hfosc (
.CLKHFPU(1'b1),
.CLKHFEN(1'b1),
.CLKHF(clk_48)
);
// pulse the green LED to know that we're alive
reg [31:0] counter;
always @(posedge clk_48)
counter <= counter + 1;
wire pwm_g;
pwm pwm_g_driver(clk_48, 1, pwm_g);
assign led_g = !(counter[25:23] == 0 && pwm_g);
assign led_b = serial_rxd; // idles high
assign led_r = serial_txd; // idles high
assign debug0 = serial_txd;
// generate a 3 MHz/12 MHz serial clock from the 48 MHz clock
// this is the 3 Mb/s maximum supported by the FTDI chip
wire clk_1, clk_4;
divide_by_n #(.N(16)) div1(clk_48, reset, clk_1);
divide_by_n #(.N( 4)) div4(clk_48, reset, clk_4);
wire [7:0] uart_rxd;
wire uart_rxd_strobe;
uart_tx txd(
.mclk(clk_48),
.reset(reset),
.baud_x1(clk_1),
.serial(serial_txd),
.data(uart_rxd),
.data_strobe(uart_rxd_strobe)
);
uart_rx rxd(
.mclk(clk_48),
.reset(reset),
.baud_x4(clk_4),
.serial(serial_rxd),
.data(uart_rxd),
.data_strobe(uart_rxd_strobe)
);
endmodule
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。