From 80b3adbe1994a95a18a29188b09345164061b46f Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Tue, 21 Jan 2020 15:26:36 +0300 Subject: New testbench with two clocks. --- src/tb/tb_fmc.v | 522 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 307 insertions(+), 215 deletions(-) (limited to 'src') diff --git a/src/tb/tb_fmc.v b/src/tb/tb_fmc.v index 20b602c..ba436b9 100644 --- a/src/tb/tb_fmc.v +++ b/src/tb/tb_fmc.v @@ -6,7 +6,7 @@ // // Authors: Pavel Shatov // -// Copyright (c) 2018, NORDUnet A/S +// Copyright (c) 2018-2019, NORDUnet A/S // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: @@ -43,220 +43,312 @@ module tb_fmc; - // - // Clock (100 MHz) - // - localparam CLOCK_PERIOD = 10.0; - localparam HALF_CLOCK_PERIOD = 0.5 * CLOCK_PERIOD; - - reg clk_fmc = 1'b0; - //reg clk_45 = 1'b0; - //reg clk_90 = 1'b0; - - initial begin - forever #HALF_CLOCK_PERIOD clk_fmc = ~clk_fmc; - end - - wire clk_45 = clk_fmc; - wire clk_90 = clk_fmc; - - //initial begin - //#1.25; - //forever #HALF_CLOCK_PERIOD clk_45 = ~clk_45; - //end - - //initial begin - //#2.5; - //forever #HALF_CLOCK_PERIOD clk_90 = ~clk_90; - //end - - - // - // FMC Arbiter - FPGA Side - // - wire [23: 0] sys_fmc_addr; - wire sys_fmc_wren; - wire sys_fmc_rden; - wire [31: 0] sys_fmc_dout; - reg [31: 0] sys_fmc_din; - - reg [23: 0] fmc_a = {24{1'bX}}; - reg [31: 0] fmc_d_drive; - wire [31: 0] fmc_d_bidir; - reg fmc_ne1 = 1'b1; - reg fmc_noe = 1'b1; - reg fmc_nwe = 1'b1; - reg fmc_nl = 1'b1; - wire fmc_nwait_dummy; - - assign fmc_d_bidir = fmc_noe ? fmc_d_drive : 32'hZZZZZZZZ; - - fmc_arbiter #(.NUM_ADDR_BITS(24)) - uut - ( - // fmc bus - .fmc_a (fmc_a), - .fmc_d (fmc_d_bidir), - .fmc_ne1 (fmc_ne1), - .fmc_nl (fmc_nl), - .fmc_nwe (fmc_nwe), - .fmc_noe (fmc_noe), - .fmc_nwait (fmc_nwait_dummy), - - // system clock - .sys_clk (clk_45), - .fmc_clk_aux (clk_90), - - // user bus - .sys_addr (sys_fmc_addr), - .sys_wr_en (sys_fmc_wren), - .sys_data_out (sys_fmc_dout), - .sys_rd_en (sys_fmc_rden), - .sys_data_in (sys_fmc_din) - ); - - - // - // Helper Tasks - // - task wait_ticks; - input integer num_ticks; - integer cnt; - begin - for (cnt=0; cnt