📄 hy5ps121621f.vhd
字号:
NextState := READ; When others => assert false report "WARNING : (STATE_MACHINE) : Illegal Command Issued. Command Ignored." severity warning; NextState := READ; End Case; When WRITE => Case CurrentCommand Is When DSEL => NextState := WRITE; When NOP => NextState := WRITE; When RD => if (TimingCheckFlag = TRUE) then assert (SelfRefExt2RDFlag /= TRUE) report "ERROR : (tXSRD_CHECK) : Needs tXSRD Timing after Self Refresh." severity error; end if; Read_CA <= '1', '0' after 2 ns; NextState := READ; When RDAP => if (TimingCheckFlag = TRUE) then assert (SelfRefExt2RDFlag /= TRUE) report "ERROR : (tXSRD_CHECK) : Needs tXSRD Timing after Self Refresh." severity error; end if; AutoPrechargeFlag(conv_integer(BkAdd)) <= transport '1' after (ExtModeRegister.AL + ModeRegister.BURST_LENGTH/2 - 2) * clk_cycle + tRTP, '0' after (ExtModeRegister.AL + ModeRegister.BURST_LENGTH/2 - 2) * clk_cycle + tRTP + 2 ns; Read_CA <= '1', '0' after 2 ns; NextState := READ; When WR => Write_CA <= '1', '0' after 2 ns; NextState := WRITE; When WRAP => AutoPrechargeFlag(conv_integer(BkAdd)) <= transport '1' after (ExtModeRegister.AL + ModeRegister.CAS_LATENCY - 1 + ModeRegister.BURST_LENGTH/2 + ModeRegister.TWR) * clk_cycle, '0' after (ExtModeRegister.AL + ModeRegister.CAS_LATENCY - 1 + ModeRegister.BURST_LENGTH/2 + ModeRegister.TWR) * clk_cycle + 2 ns; Write_CA <= '1', '0' after 2 ns; NextState := WRITE; When ACT => BankActivateFlag <= TRUE; NextState := WRITE; When PCG => PrechargeFlag <= TRUE; NextState := WRITE; When PCGA => PrechargeAllFlag <= TRUE; NextState := WRITE; When others => assert false report "WARNING : (STATE_MACHINE) : Illegal Command Issued. Command Ignored." severity warning; NextState := WRITE; End Case; When others => assert false report "ERROR : (STATE_MACHINE) : Invalid Command Issued." severity error; End case; end if; if (BankActivateFinFlag = TRUE) then BankActivateFlag <= FALSE; end if; if (PrechargeFinFlag = TRUE) then PrechargeFlag <= FALSE; end if; if (PrechargeAllFinFlag = TRUE) then PrechargeAllFlag <= FALSE; end if; if (PUSCheckFinFlag'EVENT and PUSCheckFinFlag = TRUE) then NextState := IDLE; end if; if (BankActivatedFlag'EVENT and BankActivatedFlag /= BankActivatedFlag'LAST_VALUE) then if (BankActivatedFlag = "0000") then NextState := IDLE; else NextState := RACT; end if; end if; CurrentState <= NextState;end process;-----------------------------------------------------------------------------------------------------MEMORY_BANK_ACTIVATE_PRECHARGE : process (PrechargeFlag, AutoPrechargeFlag, PrechargeAllFlag, BankActivateFlag, CLK)variable BkAdd : std_logic_vector ((NUM_OF_BANK_ADD - 1) downto 0) := (others => 'X');variable RA : std_logic_vector ((NUM_OF_ROW_ADD - 1) downto 0) := (others => 'X');variable MEM_CELL_ARRAY0, MEM_CELL_ARRAY1, MEM_CELL_ARRAY2, MEM_CELL_ARRAY3 : MEM_CELL_TYPE;variable i, j, k, l, m, u : integer := 0;begin if (CLK'EVENT and CLK = '0') then if ((BankActivateFlag = TRUE) or ((BankActivateFlag = FALSE) and (tmp_act_trans0 = '1'))) Then tmp_act_trans0 <= '0'; end if; if ((BankActivateFlag = TRUE) or ((BankActivateFlag = FALSE) and (tmp_act_trans1 = '1'))) Then tmp_act_trans1 <= '0'; end if; if ((BankActivateFlag = TRUE) or ((BankActivateFlag = FALSE) and (tmp_act_trans2 = '1'))) Then tmp_act_trans2 <= '0'; end if; if ((BankActivateFlag = TRUE) or ((BankActivateFlag = FALSE) and (tmp_act_trans3 = '1'))) Then tmp_act_trans3 <= '0'; end if; end if; if (BankActivateFlag'EVENT and BankActivateFlag = TRUE) then BkAdd := (BA); RA := ADDR(NUM_OF_ROW_ADD - 1 downto 0); BankActivatedFlag(conv_integer(BkAdd)) <= '1'; i := 0; j := 0; u := 0; if (BankActivatedFlag (conv_integer (BkAdd)) = '1') then assert false report "WARNING : (MEMORY_BANK_ACTIVATE) : Activating same bank without precharge. Command Ignored." severity warning; BankActivateFinFlag <= TRUE, FALSE after 2 ns; elsif (BankActivatedFlag (conv_integer (BkAdd)) = '0') then if (TimingCheckFlag = TRUE) then if (now - refresh_check(conv_integer(BkAdd), conv_integer(RA)) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms. So, This Row's Data Is Lost." severity warning; end if; end if; case BkAdd is when "00" => b0_last_activate <= transport now; RA_Activated_B0 <= RA; when "01" => b1_last_activate <= transport now; RA_Activated_B1 <= RA; when "10" => b2_last_activate <= transport now; RA_Activated_B2 <= RA; when "11" => b3_last_activate <= transport now; RA_Activated_B3 <= RA; when others => assert false report "WARNING : (MEMORY_REFRESH) : Impossible Bank Address" severity warning; end case; if (conv_integer (BkAdd) = 0) then if (MEM_CELL_ARRAY0(conv_integer (RA)) = NULL) then MEM_CELL_ARRAY0(conv_integer (RA)) := NEW ROW_DATA_TYPE; loop exit when u >= NUM_OF_COLS; MEM_CELL_ARRAY0(conv_integer (RA))(u) := 0; u := u + 1; end loop; end if; loop exit when i >= NUM_OF_COLS; SA_ARRAY_A0(i) <= MEM_CELL_ARRAY0(conv_integer (RA))(i); i := i + 1; end loop; tmp_act_trans0 <= '1'; elsif (conv_integer (BkAdd) = 1) then if (MEM_CELL_ARRAY1(conv_integer (RA)) = NULL) then MEM_CELL_ARRAY1(conv_integer (RA)) := NEW ROW_DATA_TYPE; loop exit when u >= NUM_OF_COLS; MEM_CELL_ARRAY1(conv_integer (RA))(u) := 0; u := u + 1; end loop; end if; loop exit when i >= NUM_OF_COLS; SA_ARRAY_A1(i) <= MEM_CELL_ARRAY1(conv_integer (RA))(i); i := i + 1; end loop; tmp_act_trans1 <= '1'; elsif (conv_integer (BkAdd) = 2) then if (MEM_CELL_ARRAY2(conv_integer (RA)) = NULL) then MEM_CELL_ARRAY2(conv_integer (RA)) := NEW ROW_DATA_TYPE; loop exit when u >= NUM_OF_COLS; MEM_CELL_ARRAY2(conv_integer (RA))(u) := 0; u := u + 1; end loop; end if; loop exit when i >= NUM_OF_COLS; SA_ARRAY_A2(i) <= MEM_CELL_ARRAY2(conv_integer (RA))(i); i := i + 1; end loop; tmp_act_trans2 <= '1'; elsif (conv_integer (BkAdd) = 3) then if (MEM_CELL_ARRAY3(conv_integer (RA)) = NULL) then MEM_CELL_ARRAY3(conv_integer (RA)) := NEW ROW_DATA_TYPE; loop exit when u >= NUM_OF_COLS; MEM_CELL_ARRAY3(conv_integer (RA))(u) := 0; u := u + 1; end loop; end if; loop exit when i >= NUM_OF_COLS; SA_ARRAY_A3(i) <= MEM_CELL_ARRAY3(conv_integer (RA))(i); i := i + 1; end loop; tmp_act_trans3 <= '1'; end if; BankActivateFinFlag <= TRUE, FALSE after 2 ns; else end if; end if; if ((PrechargeFlag'EVENT and PrechargeFlag = TRUE) or (AutoPrechargeFlag(0)'EVENT and AutoPrechargeFlag(0) = '1') or (AutoPrechargeFlag(1)'EVENT and AutoPrechargeFlag(1) = '1') or (AutoPrechargeFlag(2)'EVENT and AutoPrechargeFlag(2) = '1') or (AutoPrechargeFlag(3)'EVENT and AutoPrechargeFlag(3) = '1')) then i := 0; j := 0; if (PrechargeFlag = TRUE) then BkAdd := (BA); elsif (AutoPrechargeFlag(0) = '1') then BkAdd := "00"; elsif (AutoPrechargeFlag(1) = '1') then BkAdd := "01"; elsif (AutoPrechargeFlag(2) = '1') then BkAdd := "10"; elsif (AutoPrechargeFlag(3) = '1') then BkAdd := "11"; end if; if (BkAdd = "00") then if (AutoPrechargeFlag(0) = '1' and (now - b0_last_activate) < tRAS) then b0_last_precharge <= transport (tRAS + b0_last_activate) after 1 ns; else b0_last_precharge <= transport now after 1 ns; end if; if (BankActivatedFlag (0) /= '1') then assert false report "WARNING : (MEMORY_PRECHARGE) : Precharging deactivated bank." severity warning; else RA := RA_Activated_B0; i := 0; loop exit when i >= NUM_OF_COLS; MEM_CELL_ARRAY0(conv_integer (RA))(i) := SA_ARRAY (conv_integer(BkAdd))(i); i := i + 1; end loop; if (AutoPrechargeFlag(0) = '1' and (now - b0_last_activate) < tRAS) then BankActivatedFlag (0) <= transport '0' after (tRAS - (now - b0_last_activate)); else BankActivatedFlag (0) <= '0'; end if; tmp_ref_addr2 <= RA&"00"; end if; elsif (BkAdd = "01") then if (AutoPrechargeFlag(1) = '1' and (now - b1_last_activate) < tRAS) then b1_last_precharge <= transport (tRAS + b1_last_activate) after 1 ns; else b1_last_precharge <= transport now after 1 ns; end if; if (BankActivatedFlag (1) /= '1') then assert false report "WARNING : (MEMORY_PRECHARGE) : Precharging deactivated bank." severity warning; else RA := RA_Activated_B1; i := 0; loop exit when i >= NUM_OF_COLS; MEM_CELL_ARRAY1(conv_integer (RA))(i) := SA_ARRAY (conv_integer(BkAdd))(i); i := i + 1; end loop; if (AutoPrechargeFlag(1) = '1' and (now - b1_last_activate) < tRAS) then BankActivatedFlag (1) <= transport '0' after (tRAS - (now - b1_last_activate)); else BankActivatedFlag (1) <= '0'; end if; tmp_ref_addr2 <= RA&"01"; end if; elsif (BkAdd = "10") then if (AutoPrechargeFlag(2) = '1' and (now - b2_last_activate) < tRAS) then b2_last_precharge <= transport (tRAS + b2_last_activate) after 1 ns; else b2_last_precharge <= transport now after 1 ns; end if; if (BankActivatedFlag (2) /= '1') then assert false report "WARNING : (MEMORY_PRECHARGE) : Precharging deactivated bank." severity warning; else RA := RA_Activated_B2; i := 0; loop exit when i >= NUM_OF_COLS; MEM_CELL_ARRAY2(conv_integer (RA))(i) := SA_ARRAY (conv_integer(BkAdd))(i); i := i + 1; end loop; if (AutoPrechargeFlag(2) = '1' and (now - b2_last_activate) < tRAS) then BankActivatedFlag (2) <= transport '0' after (tRAS - (now - b2_last_activate)); else BankActivatedFlag (2) <= '0'; end if; tmp_ref_addr2 <= RA&"10"; end if; elsif (BkAdd = "11") then if (AutoPrechargeFlag(3) = '1' and (now - b3_last_activate) < tRAS) then b3_last_precharge <= transport (tRAS + b3_last_activate) after 1 ns; else b3_last_precharge <= transport now after 1 ns; end if; if (BankActivatedFlag (3) /= '1') then assert false report "WARNING : (MEMORY_PRECHARGE) : Precharging deactivated bank." severity warning; else RA := RA_Activated_B3; i := 0; loop exit when i >= NUM_OF_COLS; MEM_CELL_ARRAY3(conv_integer (RA))(i) := SA_ARRAY (conv_integer(BkAdd))(i); i := i + 1; end loop; if (AutoPrechargeFlag(3) = '1' and (now - b3_last_activate) < tRAS) then BankActivatedFlag (3) <= transport '0' after (tRAS - (now - b3_last_activate)); else BankActivatedFlag (3) <= '0'; end if; tmp_ref_addr2 <= RA&"11"; end if; end if; if (PrechargeFlag = TRUE) then PrechargeFinFlag <= TRUE, FALSE after 2 ns; end if; tmp_ref_addr2_trans <= transport '1', '0' after 1 ns;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -