OpenCores
URL https://opencores.org/ocsvn/ahb_slave/ahb_slave/trunk

Subversion Repositories ahb_slave

[/] [ahb_slave/] [trunk/] [src/] [base/] [ahb_slave_trace.v] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 2... Line 2...
OUTFILE PREFIX_trace.v
OUTFILE PREFIX_trace.v
 
 
INCLUDE def_ahb_slave.txt
INCLUDE def_ahb_slave.txt
 
 
module PREFIX_trace(PORTS);
module PREFIX_trace(PORTS);
 
 
   parameter                  SLAVE_NUM = 0;
   parameter                  SLAVE_NUM = 0;
 
 
   parameter                  FILE_NAME     = "PREFIX.trc";
 
 
 
   input                      clk;
   input                      clk;
   input                      reset;
   input                      reset;
 
 
   input                      GROUP_STUB_MEM;
   input                      GROUP_STUB_MEM;
 
 
Line 19... Line 16...
   reg [ADDR_BITS-1:0]         ADDR_RD_d;
   reg [ADDR_BITS-1:0]         ADDR_RD_d;
 
 
   wire [31:0]                 ADDR_WR_disp =  ADDR_WR;
   wire [31:0]                 ADDR_WR_disp =  ADDR_WR;
   wire [31:0]                 ADDR_RD_disp =  ADDR_RD_d;
   wire [31:0]                 ADDR_RD_disp =  ADDR_RD_d;
 
 
 
   reg [64*8-1:0]             filename;
   integer                    file_ptr;
   integer                    file_ptr;
 
 
   initial
 
     file_ptr = $fopen(FILE_NAME, "w");
 
 
 
 
   initial
 
     begin
 
        //erase trace
 
        file_ptr = $fopen({"PREFIX.trc"}, "w");
 
        $fwrite(file_ptr, "\n");
 
        $fclose(file_ptr);
 
     end
 
 
   always @(posedge clk or posedge reset)
   always @(posedge clk or posedge reset)
     if (reset)
     if (reset)
       begin
       begin
          ADDR_RD_d <= #FFD 'd0;
          ADDR_RD_d <= #FFD 'd0;
Line 39... Line 42...
          RD_d <= #FFD RD;
          RD_d <= #FFD RD;
       end
       end
 
 
   always @(posedge clk)
   always @(posedge clk)
     if (WR)
     if (WR)
       $fwrite(file_ptr, "%16d: %0s WR: Addr: 0x%8h, Data: 0x%8h, Bsel: 0x%2h\n", $time, FILE_NAME, ADDR_WR_disp, DIN, BSEL);
       begin
 
          file_ptr = $fopen({"PREFIX.trc"}, "a");
 
          $fwrite(file_ptr, "%16d: PREFIX%0d WR: Addr: 0x%EXPR(ADDR_BITS/4)h, Data: 0x%EXPR(DATA_BITS/4)h, Bsel: 0x%EXPR(DATA_BITS/32)h\n", $time, SLAVE_NUM, ADDR_WR_disp, DIN, BSEL);
 
          $fclose(file_ptr);
 
       end
 
 
   always @(posedge clk)
   always @(posedge clk)
     if (RD_d)
     if (RD_d)
       $fwrite(file_ptr, "%16d: %0s RD: Addr: 0x%8h, Data: 0x%8h\n", $time, FILE_NAME, ADDR_RD_disp, DOUT);
       begin
 
          file_ptr = $fopen({"PREFIX.trc"}, "a");
 
          $fwrite(file_ptr, "%16d: PREFIX%0d RD: Addr: 0x%EXPR(ADDR_BITS/4)h, Data: 0x%EXPR(DATA_BITS/4)h\n", $time, SLAVE_NUM, ADDR_RD_disp, DOUT);
 
          $fclose(file_ptr);
 
       end
 
 
endmodule
endmodule
 
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.