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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [verilog/] [vpi/] [c/] [jp_vpi.c] - Diff between revs 46 and 397

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

Rev 46 Rev 397
Line 178... Line 178...
#include "gdb.h"
#include "gdb.h"
#include "rsp-rtl_sim.h"
#include "rsp-rtl_sim.h"
#include "rsp-vpi.h"
#include "rsp-vpi.h"
 
 
// Define the port we open the RSP server on
// Define the port we open the RSP server on
#define RSP_SERVER_PORT 5555
#define RSP_SERVER_PORT 50002
 
 
//Function to register the function which sets up the sockets interface
//Function to register the function which sets up the sockets interface
void register_init_rsp_server_functions() ;
void register_init_rsp_server_functions() ;
// Function which sets up the socket interface
// Function which sets up the socket interface
void init_rsp_server();
void init_rsp_server();
Line 395... Line 395...
      printf("  reset\n");
      printf("  reset\n");
      break;
      break;
    case 0xc :
    case 0xc :
      printf("  read jtag id\n");
      printf("  read jtag id\n");
      break;
      break;
 
    case 0xd :
 
      printf("  detach\n");
 
      break;
 
    case 0xe :
 
      printf("  WB read 8\n");
 
      break;
    }
    }
}
}
 
 
// See if there's anything on the FIFO for us
// See if there's anything on the FIFO for us
 
 
Line 627... Line 633...
 
 
  // now get a handle on the next object (memory array)
  // now get a handle on the next object (memory array)
  argh = vpi_scan(args_iter);
  argh = vpi_scan(args_iter);
 
 
  // check we got passed a memory (array of regs)
  // check we got passed a memory (array of regs)
  if (vpi_get(vpiType, argh) != vpiMemory)
  if (!((vpi_get(vpiType, argh) == vpiMemory)
 
#ifdef MODELSIM_VPI
 
        || (vpi_get(vpiType, argh) == vpiRegArray)
 
#endif
 
        ))
    {
    {
      vpi_printf("jp_vpi: ERROR: did not pass a memory to get_command_block_data\n");
      vpi_printf("jp_vpi: ERROR: did not pass a memory to get_command_block_data\n");
 
      vpi_printf("jp_vpi: ERROR: was passed type %d\n", (int)vpi_get(vpiType, argh));
      return;
      return;
    }
    }
 
 
  // check the memory we're writing into is big enough
  // check the memory we're writing into is big enough
  if (vpi_get(vpiSize, argh) < num_words )
  if (vpi_get(vpiSize, argh) < num_words )
Line 689... Line 700...
 
 
  struct t_vpi_value argval;
  struct t_vpi_value argval;
 
 
  int value,i;
  int value,i;
 
 
  int n;
  int n, length;
 
 
  uint32_t data;
  uint32_t data;
 
 
  char* send_buf;
  char* send_buf;
 
 
Line 701... Line 712...
  systfref = vpi_handle(vpiSysTfCall, NULL);
  systfref = vpi_handle(vpiSysTfCall, NULL);
 
 
  // Now call iterate with the vpiArgument parameter
  // Now call iterate with the vpiArgument parameter
  args_iter = vpi_iterate(vpiArgument, systfref);
  args_iter = vpi_iterate(vpiArgument, systfref);
 
 
 
  // get a handle on the length variable
 
  argh = vpi_scan(args_iter);
 
 
 
  argval.format = vpiIntVal;
 
 
 
  // get the value for the length object
 
  vpi_get_value(argh, &argval);
 
 
 
  // now set length
 
  length = argval.value.integer;
 
 
  // get a handle on the object passed to the function
  // get a handle on the object passed to the function
  argh = vpi_scan(args_iter);
  argh = vpi_scan(args_iter);
 
 
  // now store the command value back in the sim
  // now store the command value back in the sim
  argval.format = vpiIntVal;
  argval.format = vpiIntVal;
Line 715... Line 737...
  data = (uint32_t) argval.value.integer;
  data = (uint32_t) argval.value.integer;
 
 
  // Cleanup and return
  // Cleanup and return
  vpi_free_object(args_iter);
  vpi_free_object(args_iter);
 
 
  if (DBG_JP_VPI) printf("jp_vpi: return_command_data 0x%.8x\n",data);
  if (DBG_JP_VPI) printf("jp_vpi: return_command_data %d bytes, 0x%.8x\n",length,data);
 
 
  send_buf = (char *) &data; //cast our long as a char buf
  send_buf = (char *) &data; //cast our long as a char buf
 
 
  // write the data back
  // write the data back
  n = write(vpi_to_rsp_pipe[1],send_buf,4);
  n = write(vpi_to_rsp_pipe[1],send_buf,length);
 
 
  return;
  return;
 
 
}
}
 
 
Line 768... Line 790...
  length = argval.value.integer;
  length = argval.value.integer;
 
 
  // now get a handle on the next object (memory array)
  // now get a handle on the next object (memory array)
  argh = vpi_scan(args_iter);
  argh = vpi_scan(args_iter);
 
 
  // check we got passed a memory (array of regs)
  // check we got passed a memory (array of regs) (modelsim passes back a vpiRegArray, so check for that too)
  if (vpi_get(vpiType, argh) != vpiMemory)
  if (!((vpi_get(vpiType, argh) == vpiMemory)
 
#ifdef MODELSIM_VPI
 
        || (vpi_get(vpiType, argh) == vpiRegArray)
 
#endif
 
      ))
    {
    {
      vpi_printf("jp_vpi: ERROR: did not pass a memory to return_command_block_data\n");
      vpi_printf("jp_vpi: ERROR: did not pass a memory to return_command_block_data\n");
 
      vpi_printf("jp_vpi: ERROR: was passed type %d\n", (int)vpi_get(vpiType, argh));
      return;
      return;
    }
    }
 
 
  // We have to alloc memory here for lengths > 4
  // We have to alloc memory here for lengths > 4
  if (length > 4);
  if (length > 4);

powered by: WebSVN 2.1.0

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