⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rom.cpp

📁 基于Systemc的8*8LED扫描电路课程设计的设计文件
💻 CPP
字号:
#include "rom.h"

void memory::prc_memory()
{
sc_lv<WORD_SIZE> allzs(sc_logic_Z);
sc_lv<WORD_SIZE> allxs(sc_logic_X);

  if(en)
  {
       if(rw)
	   {
           if(select4.read()<MEM_SIZE)
			   column8= rom[select4.read()];
		   else
		   {
			   column8=allxs;
		      
             #ifndef SYNTHESIS
	           cout<<"Address"<<select4<<
		           "is out of range for read operation."<<endl;
             #endif
		   }
	   }
	   else
	   {
	   if(select4.read()<MEM_SIZE)
	   {
	      switch(select4.read())
		  {
             case 0:column8=0x01; break;
             case 1:column8=0x02; break;
             case 2:column8=0x04; break;
             case 3:column8=0x08; break;
             case 4:column8=0x10; break;
             case 5:column8=0x20; break;
             case 6:column8=0x40; break;
             case 7:column8=0x80; break;
             case 8:column8=0x80; break;
             case 9:column8=0x40; break;
             case 10:column8=0x20; break;
             case 11:column8=0x10; break;
             case 12:column8=0x08; break;
             case 13:column8=0x04; break;
             case 14:column8=0x02; break;
             case 15:column8=0x01; break;
		  }
		  rom[select4.read()]=column8;
	   }
       #ifndef SYNTHESIS
	       else
			   cout<<"Address"<<select4<<
			     "is out of range for write operation."<<endl;
       #endif
       }
  }
	   else
		   column8=allzs;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -