[patch][commit] Add hw-cache-buffer-8 and hw-blocking-cache-buffer-8

Dave Brolley <[email protected]>
Newsgroups gmane.comp.emulators.sid.devel
Message-ID <[email protected]>
Hi,

I've committed the attached patch which adds the hardware types 
hw-cache-buffer-8 and hw-blocking-cache-buffer-8. The patch adds a table 
of allowable lengths for these caches, so future expansion need only 
update the table.

Dave
sid-cache.ChangeLog (text/plain, 303 B)
2006-05-10  Dave Brolley  <[email protected]>

	* cache.cxx (buffer_sizes): New static table.
	(CacheListTypes): List hw-cache-buffer-* using buffer_sizes. Same for
	hw-blocking-cache-buffer-*.
	(CacheCreate): Parse hw-cache-buffer-N and hw-blocking-cache-buffer-N
	in order to determine buffer size.
sid-cache.patch.txt (text/plain, 2.8 KB)
Index: sid/component/cache/cache.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/cache/cache.cxx,v
retrieving revision 1.21
diff -c -p -r1.21 cache.cxx
*** sid/component/cache/cache.cxx	1 Mar 2006 21:07:00 -0000	1.21
--- sid/component/cache/cache.cxx	10 May 2006 20:23:23 -0000
*************** using std::endl;
*** 26,31 ****
--- 26,34 ----
  
  #include "cache.h"
  
+ static string buffer_sizes[] =
+   { "4", "8" };
+ 
  static string line_sizes[] =
    { "16", "32", "64", "128" };
  
*************** CacheListTypes ()
*** 1054,1061 ****
  
    types.push_back ("hw-cache-basic");
    types.push_back ("hw-blocking-cache-basic");
!   types.push_back ("hw-cache-buffer-8");
!   types.push_back ("hw-blocking-cache-buffer-8");
  
    for (unsigned i = 0; i < (sizeof (assocs) / sizeof (string)); i++)
      for (unsigned j = 0; j < (sizeof (cache_sizes) / sizeof (string)); j++)
--- 1057,1068 ----
  
    types.push_back ("hw-cache-basic");
    types.push_back ("hw-blocking-cache-basic");
! 
!   for (unsigned i = 0; i < (sizeof (buffer_sizes) / sizeof (string)); i++)
!     {
!       types.push_back ("hw-cache-buffer-" + buffer_sizes[i]);
!       types.push_back ("hw-blocking-cache-buffer-" + buffer_sizes[i]);
!     }
  
    for (unsigned i = 0; i < (sizeof (assocs) / sizeof (string)); i++)
      for (unsigned j = 0; j < (sizeof (cache_sizes) / sizeof (string)); j++)
*************** CacheCreate (const string& typeName)
*** 1095,1106 ****
    if (typeName == "hw-blocking-cache-basic")
      return new blocking_cache_component (1, 16384, 32, null_replacement, internal_line_factory);
  
!   if (typeName == "hw-cache-buffer-8")
!     return new cache_component (0, 8, 8, null_replacement, internal_line_factory);
    
-   if (typeName == "hw-blocking-cache-buffer-8")
-     return new blocking_cache_component (0, 8, 8, null_replacement, internal_line_factory);
-    
    vector<string> parts = sidutil::tokenize (typeName, "-/");
  
    unsigned extra_ix;
--- 1102,1123 ----
    if (typeName == "hw-blocking-cache-basic")
      return new blocking_cache_component (1, 16384, 32, null_replacement, internal_line_factory);
  
!   if (typeName.substr (0, 16) == "hw-cache-buffer-")
!     {
!       unsigned size;
!       if (parse_attribute (typeName.substr (16), size) != sid::component::ok)
! 	return 0;
!       return new cache_component (0, size, size, null_replacement, internal_line_factory);
!     }
!   
!   if (typeName.substr (0, 25) == "hw-blocking-cache-buffer-")
!     {
!       unsigned size;
!       if (parse_attribute (typeName.substr (25), size) != sid::component::ok)
! 	return 0;
!       return new blocking_cache_component (0, size, size, null_replacement, internal_line_factory);
!     }
    
    vector<string> parts = sidutil::tokenize (typeName, "-/");
  
    unsigned extra_ix;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.