URL
                    https://opencores.org/ocsvn/uart2bus_testbench/uart2bus_testbench/trunk
                
            Subversion Repositories uart2bus_testbench
[/] [uart2bus_testbench/] [trunk/] [tb/] [interfaces/] [rf_interface.sv] - Rev 2
Go to most recent revision | Compare with Previous | Blame | View Log
//-----------------------------------------------------------------------------//// UART2BUS VERIFICATION////-----------------------------------------------------------------------------// CREATOR : HANY SALAH// PROJECT : UART2BUS UVM TEST BENCH// UNIT : INTERFACE//-----------------------------------------------------------------------------// TITLE : UART Interface// DESCRIPTION: This//-----------------------------------------------------------------------------// LOG DETAILS//-------------// VERSION NAME DATE DESCRIPTION// 1 HANY SALAH 25122015 FILE CREATION//-----------------------------------------------------------------------------// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR// OPENCORES MEMBERS ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE// CREATOR'S PERMISSION//-----------------------------------------------------------------------------`include "defin_lib.svh"interface rf_interface (input bit clock, // Global Clock Signalinput bit reset); // Global Asynchronous Reset Signal//--------------------------------//// Register File Side Signals////--------------------------------logic [15:0] int_address; // Address Bus To Register Filelogic [7:0] int_wr_data; // Write Data To Register Filelogic int_write; // Write Contorl To Register Filelogic [7:0] int_rd_data; // Read Data From Register Filelogic int_read; // Read Control To Register File//--------------------------------//// CONTROL SIGNALS////--------------------------------logic int_gnt;logic int_req;//--------------------------------//// Internal Variables////--------------------------------// Memory of 64K bytes as Register Filebyte register_file [`mem_size-1:0];//--------------------------------//// Operation Blocks////--------------------------------alwaysbegin@(posedge clock or posedge reset);beginif (reset)beginreset_mem();endelse if (int_write)beginfill_byte(int_address,int_wr_data);endelse if (int_read)beginint_rd_data = read_mem_data(int_address);endendend//--------------------------------//// Non Standard Routines////--------------------------------// fill_byte routine is a function that fill only single byte in the register// filefunction void fill_byte (bit [`size-1:0] address,byte data);register_file[address] = data;endfunction:fill_byte// fill_block routine is a function that fill continuous block of locations// in the register filefunction automatic void fill_block(bit [`size-1:0] address,ref byte data [],int unsigned block_length);for (int unsigned index = 0; index < block_length; index++)beginregister_file[address+index] = data [index];endendfunction:fill_block// reset_mem routine is a function that fill reset the register file to contents// zerofunction void reset_mem();for (int unsigned index = 0; index < `mem_size; index++)beginregister_file[index] = 8'b0;endendfunction:reset_mem// read_mem_data routine is a function that load bus with the data contentfunction byte read_mem_data(bit [`size-1:0] address);return register_file[address];endfunction: read_mem_datatask automatic read_block(input int unsigned data_length,input bit [15:0] address,ref byte data []);data = new [data_length];for (int unsigned index=0;index<data_length;index++)begindata[index] = read_mem_data(address+index);endendtask:read_block//-----------------------------------------//// MONITOR ROUTINES////-----------------------------------------task automatic capture_transaction (output bit[`size-1:0] address,ref byte data []);int index;index = 0;@(posedge int_gnt);while (int_gnt)begin@(posedge clock);if(index == 0)beginaddress = int_address;endif(int_read)begindata [index] = int_rd_data;endelse if (int_write)begindata [index] = int_wr_data;endelsebegin$error("both int_write and int_read is inactive");endindex++;endendtask:capture_transactionendinterface:rf_interface
Go to most recent revision | Compare with Previous | Blame | View Log

