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

📄 resfunctions.vhd

📁 nand flash NAND01GR3B (st)的仿真模型 (VHDL) 的
💻 VHD
字号:
--   --           _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/--         _/                   _/  ____________________________________________ --         _/                  _/  /                                           / --         _/_/               _/  /                                NAND01GR3B / --          _/_/_/           _/  /                                           /  --             _/_/         _/  /                                     1Gbit / --              _/_/       _/  /        8 bit, 2112 Byte Page, 1.8 V, NAND / --                _/      _/  /                                           / --                _/     _/  /                     VHDL Behavioral Model / --                _/    _/  /                               Version 3.0 / --             _/_/    _/  /                                           /--          _/_/_/    _/  /     Copyright (c) 2006 STMicroelectronics / --        _/_/_/     _/  /___________________________________________/ --  _/_/_/_/_/      _/    --  --LIBRARY IEEE;    Use IEEE.std_logic_1164.all;LIBRARY Work;    use work.UserData.all;    Use Work.data.all;    Use Work.CUIcommandData.all;    Use Work.BlockLib.all;package ResFunctions isFunction EventGuarded(VE: vectorErrorEvent_type) Return ErrorEvent; Function EventTimeGuarded(V: vectorTimeEvent_type) Return TimeEvent;Function PageBufferEventGuarded(V: vectorPageBufferEvent) Return PageBufferEvent;Function CommandGuarded(vComm: vectorCommand_type) Return Command_type;Function IndexCommandGuarded(viCommand : vectorIndexCommand_type) Return IndexCommand_type;Function BufferTaskGuarded(VMT: vectorBufferTask_type) Return BufferTask_type;Function StatusGuarded(VMT: vectorStatus_type) Return status_type;Function PageBufferTaskGuarded(VMT: vectorPageBufferTask_type) Return PageBufferTask_type;Function KernelReportGuarded(VKR: vectorKernelReport_type) Return KernelReport_type;Function StatusRegisterTaskGuarded(VET: vectorStatusRegisterTask_type) Return StatusRegisterTask_type;Function ReadTaskGuarded(VMT: vectorReadTask_type) Return ReadTask_type;Function ReadModeGuarded(VET: vectorReadMode_type) Return ReadMode_type;Function EraseTaskGuarded(VET: vectorEraseTask_type) Return EraseTask_type;Function ProgramTaskGuarded(VPT: vectorProgramTask_type) Return ProgramTask_type;Function BlockLockTaskGuarded(VET: vectorBlockLockTask_type) Return BlockLockTask_type;Function CacheStatusGuarded(VMT: vectorCacheStatus_type) Return CacheStatus_type;end ResFunctions ;package body ResFunctions is-- ---------------- Guarded Function for Guarded Signal -------------------------------Function EventGuarded(VE: vectorErrorEvent_type) Return ErrorEvent isVariable i:Integer; Variable V:ErrorEvent;  Begin      V:='1';     for i in VE'range loop         if VE(i)='X' then                       V:='X';         end if;     end loop;     Return V;End Function;Function EventTimeGuarded(V: vectorTimeEvent_type) Return TimeEvent isVariable i:Integer;Variable big : Time;  Begin   big := V(V'LOW);  for i in V'range loop      if V(i)>big then                 big:=V(i);      end if;  end loop;return big; End Function;Function PageBufferEventGuarded(V: vectorPageBufferEvent) Return PageBufferEvent isVariable i:Integer;Variable big : PageBufferEvent;  Begin   big := V(V'LOW);  for i in V'range loop      if V(i).eventTime>big.eventTime then                 big:=V(i);      end if;  end loop;return big; End Function;Function CommandGuarded(vComm: vectorCommand_type) Return Command_type isVariable i : Integer; Variable result : command_type;  begin    result := None;   for i in vComm'range loop          if vComm(i)/=None then                 result:=vComm(i);                exit;          end if;   end loop;    Return result;End Function;Function IndexCommandGuarded(viCommand : vectorIndexCommand_type) Return IndexCommand_type isVariable i : Integer;Variable Max : IndexCommand_type;Variable cZero: Integer;Begin    cZero := 0;   Max := 1;   for i in viCommand'range loop         if viCommand(i)>Max then Max:=viCommand(i);end if;         if viCommand(i)=0 then cZero:=cZero+1;end if;   end loop;   if cZero = viCommand'length then Max:=1;end if;   return Max;End Function;Function BufferTaskGuarded(VMT: vectorBufferTask_type) Return BufferTask_type is Variable i:Integer;Variable bigMT : BufferTask_type;Variable MTN : BufferTask_type;  Begin   bigMT  := VMT(VMT'LOW);  for i in VMT'low + 1 to VMT'high loop      MTN:= VMT(i);      if VMT(i).eventTime > bigMT.eventTime then bigMT := VMT(i);      elsif VMT(i).eventTime = bigMT.eventTime then          if VMT(i).putTime > BigMT.putTime               then bigMT := VMT(i);          end if;      end if;  end loop;Return bigMT; End Function;-- ==== Status resolution function ==== --Function StatusGuarded(VMT: vectorStatus_type) Return status_type is Variable i:Integer;Variable bigMT : status_type;Variable MTN : status_type;Begin         bigMT  := VMT(VMT'LOW);        for i in VMT'low + 1 to VMT'high loop                MTN:= VMT(i);                if VMT(i).updateTime > bigMT.updateTime then bigMT := VMT(i); end if;                if VMT(i).updateTime = bigMT.updateTime and VMT(i).resIndex > bigMT.resIndex then bigMT := VMT(i); end if;         end loop;        Return bigMT; End Function;-- ==== Page Buffer: Guarded Task ==== --Function PageBufferTaskGuarded(VMT: vectorPageBufferTask_type) Return PageBufferTask_type is Variable i:Integer;Variable bigMT : PageBufferTask_type;Variable MTN : PageBufferTask_type;  Begin   bigMT  := VMT(VMT'LOW);  for i in VMT'low + 1 to VMT'high loop      MTN:= VMT(i);      if VMT(i).eventTime > bigMT.eventTime then bigMT := VMT(i); end if;      if VMT(i).eventTime = bigMT.eventTime and VMT(i).resIndex > bigMT.resIndex then bigMT := VMT(i); end if;  end loop;Return bigMT; End Function;Function KernelReportGuarded(VKR: vectorKernelReport_type) Return KernelReport_type is Variable i:Integer;Variable bigKR : KernelReport_type;Variable KRN   : KernelReport_type;  Begin   bigKR  := VKR(VKR'LOW);    for i in VKR'low + 1 to VKR'high loop      KRN:= VKR(i);      if VKR(i).eventTime > bigKR.eventTime then bigKR := VKR(i); end if;        end loop;Return bigKR; End Function;Function StatusRegisterTaskGuarded(VET: vectorStatusRegisterTask_type) Return StatusRegisterTask_type is Variable i:Integer;Variable bigET : StatusRegisterTask_type;  Begin   bigET  := VET(VET'LOW);    for i in VET'range loop      if VET(i).eventTime > bigET.eventTime then bigET := VET(i); end if;  end loop;return bigET; End Function;-- ==== Page Buffer: Guarded Task ==== --Function ReadTaskGuarded(VMT: vectorReadTask_type) Return ReadTask_type is Variable i:Integer;Variable bigMT : ReadTask_type;Variable MTN : ReadTask_type;  Begin   bigMT  := VMT(VMT'LOW);  for i in VMT'low + 1 to VMT'high loop      MTN:= VMT(i);      if VMT(i).eventTime > bigMT.eventTime then bigMT := VMT(i); end if;  end loop;Return bigMT; End Function;Function ReadModeGuarded(VET: vectorReadMode_type) Return ReadMode_type is Variable i:Integer;Variable bigET : ReadMode_type;  Begin   bigET  := VET(VET'LOW);    for i in VET'range loop      if VET(i).eventTime > bigET.eventTime then bigET := VET(i); end if;        end loop;return bigET; End Function;Function EraseTaskGuarded(VET: vectorEraseTask_type) Return EraseTask_type is Variable i:Integer;Variable bigET : EraseTask_type;  Begin   bigET  := VET(VET'LOW);    for i in VET'range loop      if VET(i).eventTime > bigET.eventTime then bigET := VET(i); end if;  end loop;return bigET; End Function;Function ProgramTaskGuarded(VPT: vectorProgramTask_type) Return ProgramTask_type is Variable i:Integer;Variable bigPT : ProgramTask_type;Variable KRN   : ProgramTask_type;  Begin   bigPT  := VPT(VPT'LOW);  for i in VPT'range loop      KRN:= VPT(i);      if VPT(i).eventTime > bigPT.eventTime then bigPT := VPT(i); end if;  end loop;return bigPT; End Function;Function BlockLockTaskGuarded(VET: vectorBlockLockTask_type) Return BlockLockTask_type is Variable i:Integer;Variable bigET : BlockLockTask_type;  Begin   bigET  := VET(VET'LOW);  for i in VET'range loop      if VET(i).eventTime > bigET.eventTime then bigET := VET(i); end if;  end loop;return bigET; End Function;Function CacheStatusGuarded(VMT: vectorCacheStatus_type) Return CacheStatus_type is Variable i:Integer;Variable bigMT : CacheStatus_type;Variable MTN : CacheStatus_type;  Begin   bigMT  := VMT(VMT'LOW);  for i in VMT'low + 1 to VMT'high loop      MTN:= VMT(i);      if VMT(i).eventTime > bigMT.eventTime then bigMT := VMT(i);           bigMT := VMT(i);       end if;  end loop;Return bigMT; End Function;end ResFunctions;

⌨️ 快捷键说明

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