simos_interface.h 2.71 KB
/*
 * Copyright (C) 1996-1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */

#ifndef CHAL2_SIMOS_INTERFACE_H
#define CHAL2_SIMOS_INTERFACE_H

/*
    SimOS cache <-> Chal2 bus-interface declarations
       by Stephen Gold, 6 May 1997
*/

#include "memsys.h"

/*
    SimOS calls this function to trigger the simulation of new bus-cycle
    by Chal2.

    This is the only function in the interface which can advance
    the simulation clock.  All others must return within the current
    bus-cycle.
*/
void Chal2CycleAdvance (void);


/*
    SimOS calls this function to enqueue a new request into the
    bus-interface.  It returns SUCCESS if successful.

    The request_type will be one of:
      MEMSYS_GET
      MEMSYS_GETX
      MEMSYS_UPGRADE

    If writeback_flag is TRUE, the data pointed to by replaced_data_ptr
    is scheduled to be written back to replaced_paddr.  If writeback_flag
    is FALSE, those arguments are ignored.
*/
Result Chal2Request (int cpu_id, int request_type, PA requested_paddr,
   int request_id, PA replaced_paddr, int writeback_flag,
   byte *replaced_data_ptr);


/*
    The bus-interface calls this function to indicate the
    completion of a request.  The status will be MEMSYS_STATUS_SUCCESS
    if the request was successful.
    If the request_type was GET or GETX, returned_data_ptr will point to
    the data returned by the request.

    The new_cache_state will be one of:
      MEMSYS_EXCLUSIVE
      MEMSYS_SHARED
 */
void Chal2Completion (unsigned cpu_id, int request_id, int new_cache_state,
   void *returned_data_ptr);


/*
    The bus-interface calls this function to flush any exclusive copy
    of a line out of a SimOS cache.

    If the line is present in the cache:
      SimOS copies the contents of the line into memory pointed to
      by flushback_data_ptr and returns TRUE.
    If the line is not present in the cache:
      SimOS returns FALSE.
*/
bool Chal2Flush (unsigned cpu_id, PA paddr, void *flushback_data_ptr);


/*
    The bus-interface calls this function to invalidate any copies
    of a line in a SimOS cache.

    If the line is dirty in the cache:
      SimOS copies the contents of the line into memory pointed to
      by flushback_data_ptr, sets *flushback_indicator to TRUE, and
      returns TRUE.
    If the line is shared in the cache:
      SimOS sets *flushback_indicator to FALSE and returns TRUE.
    If the line is not present in the cache:
      SimOS sets *flushback_indicator to FALSE and returns FALSE.
*/
bool Chal2Invalidate (unsigned cpu_id, PA paddr, bool *flushback_indicator,
  void *flushback_data_ptr);

#endif /* CHAL2_SIMOS_INTERFACE_H */