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

📄 usbf_rf.v

📁 完整的用VERILOG语言开发的USB2.0 IP核源代码,包括文档
💻 V
📖 第 1 页 / 共 4 页
字号:
	else	if(ep3_match)	buf0 <= #1 ep3_buf0;	else	if(ep4_match)	buf0 <= #1 ep4_buf0;	else	if(ep5_match)	buf0 <= #1 ep5_buf0;	else	if(ep6_match)	buf0 <= #1 ep6_buf0;	else	if(ep7_match)	buf0 <= #1 ep7_buf0;	else	if(ep8_match)	buf0 <= #1 ep8_buf0;	else	if(ep9_match)	buf0 <= #1 ep9_buf0;	else	if(ep10_match)	buf0 <= #1 ep10_buf0;	else	if(ep11_match)	buf0 <= #1 ep11_buf0;	else	if(ep12_match)	buf0 <= #1 ep12_buf0;	else	if(ep13_match)	buf0 <= #1 ep13_buf0;	else	if(ep14_match)	buf0 <= #1 ep14_buf0;	else	if(ep15_match)	buf0 <= #1 ep15_buf0;always @(posedge clk)	if(ep0_match)	buf1 <= #1 ep0_buf1;	else	if(ep1_match)	buf1 <= #1 ep1_buf1;	else	if(ep2_match)	buf1 <= #1 ep2_buf1;	else	if(ep3_match)	buf1 <= #1 ep3_buf1;	else	if(ep4_match)	buf1 <= #1 ep4_buf1;	else	if(ep5_match)	buf1 <= #1 ep5_buf1;	else	if(ep6_match)	buf1 <= #1 ep6_buf1;	else	if(ep7_match)	buf1 <= #1 ep7_buf1;	else	if(ep8_match)	buf1 <= #1 ep8_buf1;	else	if(ep9_match)	buf1 <= #1 ep9_buf1;	else	if(ep10_match)	buf1 <= #1 ep10_buf1;	else	if(ep11_match)	buf1 <= #1 ep11_buf1;	else	if(ep12_match)	buf1 <= #1 ep12_buf1;	else	if(ep13_match)	buf1 <= #1 ep13_buf1;	else	if(ep14_match)	buf1 <= #1 ep14_buf1;	else	if(ep15_match)	buf1 <= #1 ep15_buf1;always @(posedge clk)	if(ep0_match)	dma_in_buf_sz1 <= #1 ep0_dma_in_buf_sz1;	else	if(ep1_match)	dma_in_buf_sz1 <= #1 ep1_dma_in_buf_sz1;	else	if(ep2_match)	dma_in_buf_sz1 <= #1 ep2_dma_in_buf_sz1;	else	if(ep3_match)	dma_in_buf_sz1 <= #1 ep3_dma_in_buf_sz1;	else	if(ep4_match)	dma_in_buf_sz1 <= #1 ep4_dma_in_buf_sz1;	else	if(ep5_match)	dma_in_buf_sz1 <= #1 ep5_dma_in_buf_sz1;	else	if(ep6_match)	dma_in_buf_sz1 <= #1 ep6_dma_in_buf_sz1;	else	if(ep7_match)	dma_in_buf_sz1 <= #1 ep7_dma_in_buf_sz1;	else	if(ep8_match)	dma_in_buf_sz1 <= #1 ep8_dma_in_buf_sz1;	else	if(ep9_match)	dma_in_buf_sz1 <= #1 ep9_dma_in_buf_sz1;	else	if(ep10_match)	dma_in_buf_sz1 <= #1 ep10_dma_in_buf_sz1;	else	if(ep11_match)	dma_in_buf_sz1 <= #1 ep11_dma_in_buf_sz1;	else	if(ep12_match)	dma_in_buf_sz1 <= #1 ep12_dma_in_buf_sz1;	else	if(ep13_match)	dma_in_buf_sz1 <= #1 ep13_dma_in_buf_sz1;	else	if(ep14_match)	dma_in_buf_sz1 <= #1 ep14_dma_in_buf_sz1;	else	if(ep15_match)	dma_in_buf_sz1 <= #1 ep15_dma_in_buf_sz1;always @(posedge clk)	if(ep0_match)	dma_out_buf_avail <= #1 ep0_dma_out_buf_avail;	else	if(ep1_match)	dma_out_buf_avail <= #1 ep1_dma_out_buf_avail;	else	if(ep2_match)	dma_out_buf_avail <= #1 ep2_dma_out_buf_avail;	else	if(ep3_match)	dma_out_buf_avail <= #1 ep3_dma_out_buf_avail;	else	if(ep4_match)	dma_out_buf_avail <= #1 ep4_dma_out_buf_avail;	else	if(ep5_match)	dma_out_buf_avail <= #1 ep5_dma_out_buf_avail;	else	if(ep6_match)	dma_out_buf_avail <= #1 ep6_dma_out_buf_avail;	else	if(ep7_match)	dma_out_buf_avail <= #1 ep7_dma_out_buf_avail;	else	if(ep8_match)	dma_out_buf_avail <= #1 ep8_dma_out_buf_avail;	else	if(ep9_match)	dma_out_buf_avail <= #1 ep9_dma_out_buf_avail;	else	if(ep10_match)	dma_out_buf_avail <= #1 ep10_dma_out_buf_avail;	else	if(ep11_match)	dma_out_buf_avail <= #1 ep11_dma_out_buf_avail;	else	if(ep12_match)	dma_out_buf_avail <= #1 ep12_dma_out_buf_avail;	else	if(ep13_match)	dma_out_buf_avail <= #1 ep13_dma_out_buf_avail;	else	if(ep14_match)	dma_out_buf_avail <= #1 ep14_dma_out_buf_avail;	else	if(ep15_match)	dma_out_buf_avail <= #1 ep15_dma_out_buf_avail;/////////////////////////////////////////////////////////////////////// Interrupt Generation//always @(posedge wclk)	attach_r <= usb_attached;always @(posedge wclk)	attach_r1 <= attach_r;always @(posedge wclk)	suspend_r <= suspend;always @(posedge wclk)	suspend_r1 <= suspend_r;always @(posedge wclk)	usb_reset_r <= #1 usb_reset;always @(posedge wclk)	rx_err_r <= #1 rx_err;always @(posedge wclk)	nse_err_r <= #1 nse_err;always @(posedge wclk)	pid_cs_err_r <= #1 pid_cs_err;always @(posedge wclk)	crc5_err_r <= #1 crc5_err;assign	attach = !attach_r1 & attach_r;assign	deattach = attach_r1 & !attach_r;assign	suspend_start = !suspend_r1 & suspend_r;assign	suspend_end   = suspend_r1 & !suspend_r;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[8] <= #1 0;	else	if(usb_reset_r)		int_srcb[8] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[7] <= #1 0;	else	if(rx_err_r)		int_srcb[7] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[6] <= #1 0;	else	if(deattach)		int_srcb[6] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[5] <= #1 0;	else	if(attach)		int_srcb[5] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[4] <= #1 0;	else	if(suspend_end)		int_srcb[4] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[3] <= #1 0;	else	if(suspend_start)	int_srcb[3] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[2] <= #1 0;	else	if(nse_err_r)		int_srcb[2] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[1] <= #1 0;	else	if(pid_cs_err_r)	int_srcb[1] <= #1 1;always @(posedge wclk)	if(!rst | int_src_re)	int_srcb[0] <= #1 0;	else	if(crc5_err_r)		int_srcb[0] <= #1 1;always @(posedge wclk)   begin	int_srca[15] <= #1 ep15_inta | ep15_intb;	int_srca[14] <= #1 ep14_inta | ep14_intb;	int_srca[13] <= #1 ep13_inta | ep13_intb;	int_srca[12] <= #1 ep12_inta | ep12_intb;	int_srca[11] <= #1 ep11_inta | ep11_intb;	int_srca[10] <= #1 ep10_inta | ep10_intb;	int_srca[09] <= #1 ep9_inta | ep9_intb;	int_srca[08] <= #1 ep8_inta | ep8_intb;	int_srca[07] <= #1 ep7_inta | ep7_intb;	int_srca[06] <= #1 ep6_inta | ep6_intb;	int_srca[05] <= #1 ep5_inta | ep5_intb;	int_srca[04] <= #1 ep4_inta | ep4_intb;	int_srca[03] <= #1 ep3_inta | ep3_intb;	int_srca[02] <= #1 ep2_inta | ep2_intb;	int_srca[01] <= #1 ep1_inta | ep1_intb;	int_srca[00] <= #1 ep0_inta | ep0_intb;   endassign inta_ep =ep0_inta  | ep1_inta  | ep2_inta  | ep3_inta  |		ep4_inta  | ep5_inta  | ep6_inta  | ep7_inta  |		ep8_inta  | ep9_inta  | ep10_inta | ep11_inta |		ep12_inta | ep13_inta | ep14_inta | ep15_inta;assign intb_ep =ep0_intb  | ep1_intb  | ep2_intb  | ep3_intb  |		ep4_intb  | ep5_intb  | ep6_intb  | ep7_intb  |		ep8_intb  | ep9_intb  | ep10_intb | ep11_intb |		ep12_intb | ep13_intb | ep14_intb | ep15_intb;assign inta_rf = |(int_srcb & inta_msk);assign intb_rf = |(int_srcb & intb_msk);always @(posedge wclk)	inta <= #1 inta_ep | inta_rf;always @(posedge wclk)	intb <= #1 intb_ep | intb_rf;/////////////////////////////////////////////////////////////////////// Endpoint Register Files//usbf_ep_rf	u0(	.clk(			clk			),		.wclk(			wclk			),		.rst(			rst			),		.adr(			adr[1:0]		),		.re(			ep0_re			),		.we(			ep0_we			),		.din(			din			),		.dout(			ep0_dout		),		.inta(			ep0_inta		),		.intb(			ep0_intb		),		.dma_req(		dma_req[0]		),		.dma_ack(		dma_ack[0]		),		.idin(			idin			),		.ep_sel(		ep_sel			),		.ep_match(		ep0_match		),		.buf0_rl(		buf0_rl			),		.buf0_set(		buf0_set		),		.buf1_set(		buf1_set		),		.uc_bsel_set(		uc_bsel_set		),		.uc_dpd_set(		uc_dpd_set		),		.int_buf1_set(		int_buf1_set		),		.int_buf0_set(		int_buf0_set		),		.int_upid_set(		int_upid_set		),		.int_crc16_set(		int_crc16_set		),		.int_to_set(		int_to_set		),		.int_seqerr_set(	int_seqerr_set		),		.out_to_small(		out_to_small		),		.csr(			ep0_csr			),		.buf0(			ep0_buf0		),		.buf1(			ep0_buf1		),		.dma_in_buf_sz1(	ep0_dma_in_buf_sz1	),		.dma_out_buf_avail(	ep0_dma_out_buf_avail	)		);`ifdef USBF_HAVE_EP1usbf_ep_rf	u1(	.clk(			clk			),		.wclk(			wclk			),		.rst(			rst			),		.adr(			adr[1:0]		),		.re(			ep1_re			),		.we(			ep1_we			),		.din(			din			),		.dout(			ep1_dout		),		.inta(			ep1_inta		),		.intb(			ep1_intb		),		.dma_req(		dma_req[1]		),		.dma_ack(		dma_ack[1]		),		.idin(			idin			),		.ep_sel(		ep_sel			),		.ep_match(		ep1_match		),		.buf0_rl(		buf0_rl			),		.buf0_set(		buf0_set		),		.buf1_set(		buf1_set		),		.uc_bsel_set(		uc_bsel_set		),		.uc_dpd_set(		uc_dpd_set		),		.int_buf1_set(		int_buf1_set		),		.int_buf0_set(		int_buf0_set		),		.int_upid_set(		int_upid_set		),		.int_crc16_set(		int_crc16_set		),		.int_to_set(		int_to_set		),		.int_seqerr_set(	int_seqerr_set		),		.out_to_small(		out_to_small		),		.csr(			ep1_csr			),		.buf0(			ep1_buf0		),		.buf1(			ep1_buf1		),		.dma_in_buf_sz1(	ep1_dma_in_buf_sz1	),		.dma_out_buf_avail(	ep1_dma_out_buf_avail	)		);`elseusbf_ep_rf_dummy u1(	.clk(			clk			),		.wclk(			wclk			),		.rst(			rst			),		.adr(			adr[1:0]		),		.re(			ep1_re			),		.we(			ep1_we			),		.din(			din			),		.dout(			ep1_dout		),		.inta(			ep1_inta		),		.intb(			ep1_intb		),		.dma_req(		dma_req[1]		),		.dma_ack(		dma_ack[1]		),		.idin(			idin			),		.ep_sel(		ep_sel			),		.ep_match(		ep1_match		),		.buf0_rl(		buf0_rl			),		.buf0_set(		buf0_set		),		.buf1_set(		buf1_set		),		.uc_bsel_set(		uc_bsel_set		),		.uc_dpd_set(		uc_dpd_set		),		.int_buf1_set(		int_buf1_set		),		.int_buf0_set(		int_buf0_set		),		.int_upid_set(		int_upid_set		),		.int_crc16_set(		int_crc16_set		),		.int_to_set(		int_to_set		),		.int_seqerr_set(	int_seqerr_set		),		.out_to_small(		out_to_small		),		.csr(			ep1_csr			),		.buf0(			ep1_buf0		),		.buf1(			ep1_buf1		),		.dma_in_buf_sz1(	ep1_dma_in_buf_sz1	),		.dma_out_buf_avail(	ep1_dma_out_buf_avail	)		);`endif`ifdef USBF_HAVE_EP2usbf_ep_rf	u2(	.clk(			clk			),		.wclk(			wclk			),		.rst(			rst			),		.adr(			adr[1:0]		),		.re(			ep2_re			),		.we(			ep2_we			),		.din(			din			),		.dout(			ep2_dout		),		.inta(			ep2_inta		),		.intb(			ep2_intb		),		.dma_req(		dma_req[2]		),		.dma_ack(		dma_ack[2]		),		.idin(			idin			),		.ep_sel(		ep_sel			),		.ep_match(		ep2_match		),		.buf0_rl(		buf0_rl			),		.buf0_set(		buf0_set		),		.buf1_set(		buf1_set		),		.uc_bsel_set(		uc_bsel_set		),		.uc_dpd_set(		uc_dpd_set		),		.int_buf1_set(		int_buf1_set		),		.int_buf0_set(		int_buf0_set		),		.int_upid_set(		int_upid_set		),		.int_crc16_set(		int_crc16_set		),		.int_to_set(		int_to_set		),		.int_seqerr_set(	int_seqerr_set		),		.out_to_small(		out_to_small		),		.csr(			ep2_csr			),		.buf0(			ep2_buf0		),		.buf1(			ep2_buf1		),		.dma_in_buf_sz1(	ep2_dma_in_buf_sz1	),		.dma_out_buf_avail(	ep2_dma_out_buf_avail	)		);`elseusbf_ep_rf_dummy u2(	.clk(			clk			),		.wclk(			wclk			),		.rst(			rst			),		.adr(			adr[1:0]		),		.re(			ep2_re			),		.we(			ep2_we			),		.din(			din			),		.dout(			ep2_dout		),		.inta(			ep2_inta		),		.intb(			ep2_intb		),		.dma_req(		dma_req[2]		),		.dma_ack(		dma_ack[2]		),		.idin(			idin			),		.ep_sel(		ep_sel			),		.ep_match(		ep2_match		),		.buf0_rl(		buf0_rl			),		.buf0_set(		buf0_set		),		.buf1_set(		buf1_set		),		.uc_bsel_set(		uc_bsel_set		),		.uc_dpd_set(		uc_dpd_set		),		.int_buf1_set(		int_buf1_set		),		.int_buf0_set(		int_buf0_set		),		.int_upid_set(		int_upid_set		),		.int_crc16_set(		int_crc16_set		),		.int_to_set(		int_to_set		),		.int_seqerr_set(	int_seqerr_set		),		.out_to_small(		out_to_small		),		.csr(			ep2_csr			),		.buf0(			ep2_buf0		),		.buf1(			ep2_buf1		),		.dma_in_buf_sz1(	ep2_dma_in_buf_sz1	),		.dma_out_buf_avail(	ep2_dma_out_buf_avail	)		);`endif`ifdef USBF_HAVE_EP3usbf_ep_rf	u3(	.clk(			clk			),		.wclk(			wclk			),		.rst(			rst			),		.adr(			adr[1:0]		),		.re(			ep3_re			),		.we(			ep3_we			),		.din(			din			),		.dout(			ep3_dout		),		.inta(			ep3_inta		),		.intb(			ep3_intb		),		.dma_req(		dma_req[3]		),		.dma_ack(		dma_ack[3]		),		.idin(			idin			),		.ep_sel(		ep_sel			),		.ep_match(		ep3_match		),		.buf0_rl(		buf0_rl			),		.buf0_set(		buf0_set		),		.buf1_set(		buf1_set		),		.uc_bsel_set(		uc_bsel_set		),		.uc_dpd_set(		uc_dpd_set		),		.int_buf1_set(		int_buf1_set		),		.int_buf0_set(		int_buf0_set		),

⌨️ 快捷键说明

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