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

📄 tb_top.v

📁 本系统由服务器软件控制平台和fpga硬件处理系统组成
💻 V
字号:
`timescale 1ns/10psmodule tb_top(//VPERL : &PORTLIST;// VPERL: GENERATED_BEG    //  # u    //  t _    //  y t    //  p o    //  e p// VPERL: GENERATED_END);/*-------------------------------------------------------------------*\                          Parameter Description\*-------------------------------------------------------------------*/parameter D = 2;/*-------------------------------------------------------------------*\                          Reg/Wire Description\*-------------------------------------------------------------------*/reg        sys_clk;reg        rx_clk;reg        tx_clk;reg        sys_rst_n;reg [7:0]  rd_data_out;reg        rd_sof_n;reg        rd_eof_n;reg        rd_src_rdy_n;reg        wr_dst_rdy_n;reg        ppc_ce_n_conf;reg        ppc_we_n_conf;reg        ppc_re_n_conf;reg        ppc_clr_n_conf;reg  [7:0] ppc_addr_conf;reg  [15:0]ppc_wdat_conf;wire       rd_dst_rdy_n;wire [7:0] wr_data;wire       wr_sof_n;wire       wr_eof_n;wire       wr_src_rdy_n;wire [15:0]conf_rdat_ppc;/*-------------------------------------------------------------------*\                               Main Codes\*-------------------------------------------------------------------*/top u_top (    .sys_clk        (sys_clk),    .rx_clk         (rx_clk),    .tx_clk         (tx_clk),    .sys_rst_n      (sys_rst_n),    .rd_data_out    (rd_data_out[7:0]),    .rd_sof_n       (rd_sof_n),    .rd_eof_n       (rd_eof_n),    .rd_src_rdy_n   (rd_src_rdy_n),        .wr_dst_rdy_n   (wr_dst_rdy_n),        .ppc_ce_n_conf  (ppc_ce_n_conf),          .ppc_we_n_conf  (ppc_we_n_conf),          .ppc_re_n_conf  (ppc_re_n_conf),          .ppc_clr_n_conf (ppc_clr_n_conf),         .ppc_addr_conf  (ppc_addr_conf[7:0]),     .ppc_wdat_conf  (ppc_wdat_conf[15:0]),    .rd_dst_rdy_n   (rd_dst_rdy_n),    .wr_data        (wr_data[7:0]),    .wr_sof_n       (wr_sof_n),        .wr_eof_n       (wr_eof_n),        .wr_src_rdy_n   (wr_src_rdy_n),    .conf_rdat_ppc  (conf_rdat_ppc[15:0])    );//clockinitial beginsys_clk = 1'b1;endalways # 4 sys_clk = ~sys_clk;initial beginrx_clk = 1'b1;endalways # 5 rx_clk = ~rx_clk;initial begintx_clk = 1'b1;endalways # 5 tx_clk = ~tx_clk;//resetinitial begin	sys_rst_n = 1'b0;	#100 sys_rst_n = 1'b1;endinitialbegin	 rd_data_out   = 8'h0;	 rd_sof_n      = 1;	 rd_eof_n      = 1;	 rd_src_rdy_n  = 1;	 wr_dst_rdy_n  = 0;	 ppc_ce_n_conf   = 0;	 ppc_we_n_conf   = 1;	 ppc_re_n_conf   = 1;	 ppc_clr_n_conf  = 1;	 ppc_addr_conf   = 8'h0;	 ppc_wdat_conf   = 16'h0;	#2000 //first packet   rd_data_out   = 8'hbb;	 rd_sof_n      = 0;	 rd_eof_n      = 1;	 rd_src_rdy_n  = 0;	#10   rd_data_out   = 8'hbb;	 rd_sof_n      = 1;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'haa;	#10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'h08;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h45;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h05;	 #10	 rd_data_out   = 8'hec;	 #10	 rd_data_out   = 8'h01;	 #10	 rd_data_out   = 8'h2c;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h06;	 #10	 rd_data_out   = 8'h81;	 #10	 rd_data_out   = 8'h93;	 #10	 rd_data_out   = 8'hc0;	 #10	 rd_data_out   = 8'ha8;	 #10	 rd_data_out   = 8'h58;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'hc0;	 #10	 rd_data_out   = 8'ha8;	 #10	 rd_data_out   = 8'h58;	 #10	 rd_data_out   = 8'hfe;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h50;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h28;	 #10	 rd_data_out   = 8'h00;	 #80	 rd_data_out   = 8'h50;	 #10	 rd_data_out   = 8'h00;	 #100	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h01;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h02;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h03;	 #430	 rd_data_out   = 8'hdd;//	 #10//	 rd_data_out   = 8'h04;//	 #10//	 rd_data_out   = 8'h00;	#10	 rd_eof_n      = 0;	 rd_data_out   = 8'hf;	#10	 rd_eof_n      = 1;//	 rd_src_rdy_n  = 1;	 //second packet   rd_data_out   = 8'h01;	 rd_sof_n      = 0;//	 rd_eof_n      = 1;	 rd_src_rdy_n  = 0;	#10   rd_data_out   = 8'h02;	 rd_sof_n      = 1;	#10	 rd_data_out   = 8'h03;	#10	 rd_data_out   = 8'h04;	#10	 rd_data_out   = 8'h05;	#10	 rd_data_out   = 8'h06;	#10	 rd_data_out   = 8'h07;	#10	 rd_data_out   = 8'h08;	 #10	 rd_data_out   = 8'h09;	 #10	 rd_data_out   = 8'h10;	 #10	 rd_data_out   = 8'h11;	 #10	 rd_data_out   = 8'h12;	 #10	 rd_data_out   = 8'h13;	 #10	 rd_data_out   = 8'h14;	 #10	 rd_data_out   = 8'h15;	 #10	 rd_data_out   = 8'h16;	 #10	 rd_data_out   = 8'h17;	 #10	 rd_data_out   = 8'h18;	 #10	 rd_data_out   = 8'h19;	 #10	 rd_data_out   = 8'h20;	 #10	 rd_data_out   = 8'h21;	 #10	 rd_data_out   = 8'h22;	 #10	 rd_data_out   = 8'h23;	 #10	 rd_data_out   = 8'h24;	 #10	 rd_data_out   = 8'h25;	 #10	 rd_data_out   = 8'h26;	 #10	 rd_data_out   = 8'h27;	 #10	 rd_data_out   = 8'h28;	 #10	 rd_data_out   = 8'h29;	 #10	 rd_data_out   = 8'h30;	 #10	 rd_data_out   = 8'h31;	 #10	 rd_data_out   = 8'h32;	 #10	 rd_data_out   = 8'h33;	 #10	 rd_data_out   = 8'h34;	 #10	 rd_data_out   = 8'h35;	 #10	 rd_data_out   = 8'h36;	 #10	 rd_data_out   = 8'h37;	 #10	 rd_data_out   = 8'h38;	 #10	 rd_data_out   = 8'h39;	 #10	 rd_data_out   = 8'h40;	 #10	 rd_data_out   = 8'h41;	 #10	 rd_data_out   = 8'h42;	 #10	 rd_data_out   = 8'h43;	 #10	 rd_data_out   = 8'h44;	 #10	 rd_data_out   = 8'h45;	 #10	 rd_data_out   = 8'h46;	 #10	 rd_data_out   = 8'h47;	 #10	 rd_data_out   = 8'h48;	 #10	 rd_eof_n      = 0;	 rd_data_out   = 8'h49;	 #10	 rd_eof_n      = 1;	 rd_src_rdy_n  = 1;	 	 #10//second packet   rd_data_out   = 8'hbb;	 rd_sof_n      = 0;	 rd_eof_n      = 1;	 rd_src_rdy_n  = 0;	#10   rd_data_out   = 8'hbb;	 rd_sof_n      = 1;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'hbb;	#10	 rd_data_out   = 8'haa;	#10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'haa;	 #10	 rd_data_out   = 8'h08;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h45;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h05;	 #10	 rd_data_out   = 8'hec;	 #10	 rd_data_out   = 8'h01;	 #10	 rd_data_out   = 8'h2c;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h06;	 #10	 rd_data_out   = 8'h81;	 #10	 rd_data_out   = 8'h93;	 #10	 rd_data_out   = 8'hc0;	 #10	 rd_data_out   = 8'ha8;	 #10	 rd_data_out   = 8'h58;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'hc0;	 #10	 rd_data_out   = 8'ha8;	 #10	 rd_data_out   = 8'h58;	 #10	 rd_data_out   = 8'hfe;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h50;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h28;	 #10	 rd_data_out   = 8'h00;	 #80	 rd_data_out   = 8'h50;	 #10	 rd_data_out   = 8'h00;	 #100	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h01;	 #10	 rd_data_out   = 8'h02;	 wr_dst_rdy_n  = 1'b1;	 #10	 rd_data_out   = 8'h00;	 #10	 rd_data_out   = 8'h03;	 wr_dst_rdy_n  = 1'b0;	 #420	 rd_data_out   = 8'hdd;	 #10	 rd_eof_n      = 0;	 rd_data_out   = 8'hf;	 #10	 rd_eof_n      = 1;	 rd_src_rdy_n  = 1;	 	#2500 $finish;endinitial 	begin		#150		wr_configure(8'h01,46);		wr_configure(8'h02,1536);//		wr_configure(8'h11,2);//		wr_configure(8'h12,3);		wr_configure(8'h13,16'hc0a8);		wr_configure(8'h14,16'h5800);		wr_configure(8'h15,16'hc0a8);		wr_configure(8'h16,16'h58fe);		wr_configure(8'h17,16'h0050);//		wr_configure(8'h18,16'h0028);//		wr_configure(8'h19,1);		wr_configure(8'h10,1);		wr_configure(8'h1a,16'h8201);		wr_configure(8'h1a,16'h0001);		wr_configure(8'h1b,16'h000e);		wr_configure(8'h1c,16'hffff);		wr_configure(8'h30,16'h0000);		wr_configure(8'h31,16'h0000);		#3000		wr_configure(8'h32,16'h0000);		rd_configure(8'h33);		rd_configure(8'h34);		rd_configure(8'h35);		rd_configure(8'h36);		rd_configure(8'h37);		rd_configure(8'h38);		rd_configure(8'h39);		wr_configure(8'h32,16'h0001);		rd_configure(8'h33);		rd_configure(8'h34);		rd_configure(8'h35);		rd_configure(8'h36);		rd_configure(8'h37);		rd_configure(8'h38);		rd_configure(8'h39);	endtask wr_configure;	input [7:0] addr;	input [15:0] data;	begin	   ppc_addr_conf <= addr;	   ppc_wdat_conf <= data;	   @(posedge sys_clk);	   ppc_we_n_conf <= 0;	   @(posedge sys_clk);	   ppc_we_n_conf <= 1;	   repeat(2)	   		@(posedge sys_clk);	endendtaskinitial 	begin		#600		rd_configure(8'h01);		rd_configure(8'h02);		rd_configure(8'h19);		rd_configure(8'h10);		rd_configure(8'h1a);	endtask rd_configure;	input [7:0] addr;	begin	   ppc_addr_conf <= addr;	   @(posedge sys_clk);	   ppc_re_n_conf <= 0;	   @(posedge sys_clk);	   ppc_re_n_conf <= 1;	   repeat(4)	   		@(posedge sys_clk);	endendtaskinitialbegin    $fsdbDumpvars;    $fsdbDumpfile("wave.fsdb");endendmodule

⌨️ 快捷键说明

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