📄 hy5ps121621f.vhd
字号:
UDQSB <= 'Z'; LDQSB <= 'Z'; end if;end process;-----------------------------------------------------------------------------------------------------MEMORY_READ : process (DQS_S, CLK_DLY2, ExtModeRegister.OCD_PGM)variable BkAdd : std_logic_vector ((NUM_OF_BANK_ADD - 1) downto 0) := (others => 'X');variable CRBI : integer := 0;variable i, k, l : integer := 0;begin if (CLK_DLY2'EVENT and CLK_DLY2 = '1') then if (casp6_rd = '1' or (ReadFlag = TRUE and yburst = '1')) then if (casp6_rd = '1') then BkAdd := ADD_PIPE_REG(ExtModeRegister.AL)(NUM_OF_BANK_ADD + NUM_OF_COL_ADD - 1 downto NUM_OF_BANK_ADD + NUM_OF_COL_ADD - 2); CRBI := 0; end if; if (BankActivatedFlag (conv_integer(BkAdd)) = '1') then DataBuffer(i, 0) <= conv_std_logic_vector(SA_ARRAY (conv_integer(BkAdd))(conv_integer(real_col_addr(0))), WORD_SIZE); DataBuffer(i, 1) <= conv_std_logic_vector(SA_ARRAY (conv_integer(BkAdd))(conv_integer(real_col_addr(1))), WORD_SIZE); DataBuffer(i, 2) <= conv_std_logic_vector(SA_ARRAY (conv_integer(BkAdd))(conv_integer(real_col_addr(2))), WORD_SIZE); DataBuffer(i, 3) <= conv_std_logic_vector(SA_ARRAY (conv_integer(BkAdd))(conv_integer(real_col_addr(3))), WORD_SIZE); i := i + 1; if (i = NUM_OF_BUFFERS) then i := 0; end if; CRBI := CRBI + 4; if (CRBI = ModeRegister.BURST_LENGTH) then ReadFinFlag <= TRUE, FALSE after 2 ns; CRBI := 0; end if; else assert false report "WARNING : (MEMORY_READ_PROCESS) : Accessing deactivated bank." severity WARNING; CRBI := CRBI + 4; if (CRBI = ModeRegister.BURST_LENGTH) then ReadFinFlag <= TRUE, FALSE after 2 ns; CRBI := 0; end if; end if; end if; end if; if (ExtModeRegister.OCD_PGM'event and ExtModeRegister.OCD_PGM = DRIVE0) then DQ <= (others => '0'); elsif (ExtModeRegister.OCD_PGM'event and ExtModeRegister.OCD_PGM = DRIVE1) then DQ <= (others => '1'); elsif (ExtModeRegister.OCD_PGM'event and ExtModeRegister.OCD_PGM = CAL_EXIT) then DQ <= (others => 'Z'); end if; if (DQS_S'EVENT and DQS_S = '1' and DQS_S'LAST_VALUE = '0' and WriteFlag = FALSE) then DQ <= transport DataBuffer(k, l), (others => 'Z') after 0.5 * clk_cycle; l := l + 1; elsif (DQS_S'EVENT and DQS_S = '0' and DQS_S'LAST_VALUE = '1' and WriteFlag = FALSE) then DQ <= transport DataBuffer(k, l), (others => 'Z') after 0.5 * clk_cycle; if (l = 3) then l := 0; k := k + 1; if (k = NUM_OF_BUFFERS) then k := 0; end if; else l := l + 1; end if; end if;end process;-----------------------------------------------------------------------------------------------------BURST_RD_WR_ADDR_GEN : process(CLK_DLY15, casp6_rd, casp6_wt, ReadFlag, WriteFlag)variable CA : std_logic_vector ((NUM_OF_COL_ADD - 1) downto 0) := (others => 'X');variable i, j : integer := 0;variable col_addr_count : integer := 0;begin if ((ReadFlag = FALSE) and (WriteFlag = FALSE)) then real_col_addr(0) <= (others => '0'); real_col_addr(1) <= (others => '0'); real_col_addr(2) <= (others => '0'); real_col_addr(3) <= (others => '0'); col_addr_count := 0; i := 0; j := 0; end if; if ((casp6_rd'EVENT and casp6_rd = '1') or (casp6_wt'EVENT and casp6_wt = '1') or (CLK_DLY15'EVENT and CLK_DLY15 = '1' and yburst = '1')) then if (casp6_rd = '1') then CA := ADD_PIPE_REG(ExtModeRegister.AL)(NUM_OF_COL_ADD - 1 downto 0); col_addr_count := 0; i := 0; j := 0; elsif (casp6_wt = '1') then CA := ADD_PIPE_REG(ExtModeRegister.AL + ModeRegister.CAS_LATENCY + 1)(NUM_OF_COL_ADD - 1 downto 0); col_addr_count := 0; i := 0; j := 0; end if; if (col_addr_count < ModeRegister.BURST_LENGTH/4) then loop exit when (j > 3); if ((col_addr_count = 0) and (j = 0)) then real_col_addr(0) <= CA; elsif (ModeRegister.BURST_LENGTH = 4) then if (ModeRegister.BURST_MODE = SEQUENTIAL) then real_col_addr(j) <= CA((NUM_OF_COL_ADD - 1) downto 2)& conv_std_logic_vector(remainder((conv_integer(CA(1 downto 0)) + i), 4), 2); elsif (ModeRegister.BURST_MODE = INTERLEAVE) then real_col_addr(j) <= CA((NUM_OF_COL_ADD - 1) downto 2)& xor_func(CA(1 downto 0), conv_std_logic_vector(i, 2)); end if; elsif (ModeRegister.BURST_LENGTH = 8) then if (ModeRegister.BURST_MODE = SEQUENTIAL) then real_col_addr(j) <= CA((NUM_OF_COL_ADD - 1) downto 3)& conv_std_logic_vector((conv_integer(CA(2)) + col_addr_count), 2)(0)& conv_std_logic_vector(remainder((conv_integer(CA(1 downto 0)) + i), 4), 2); elsif (ModeRegister.BURST_MODE = INTERLEAVE) then real_col_addr(j) <= CA((NUM_OF_COL_ADD - 1) downto 3)& xor_func(CA(2 downto 0), conv_std_logic_vector(i, 3)); end if; end if; i := i + 1; j := j + 1; end loop; end if; j := 0; col_addr_count := col_addr_count + 1; end if;end process;-----------------------------------------------------------------------------------------------------MEMORY_WRITE : process (CLK_DLY2, LDQS, UDQS, CLK)variable BkAdd : std_logic_vector ((NUM_OF_BANK_ADD - 1) downto 0) := (others => 'X');variable TMP_VALUE : std_logic_vector ((WORD_SIZE - 1) downto 0) := (others => '0');variable WriteDriver : SA_TYPE;variable i, j, k, l, m : integer := 0;variable CWBI : integer := 0;variable dq_buffL, dq_buffH : DATA_BUFFER_TYPE;begin if (CLK'event and CLK = '1') then dq_buffL(0) := dq_bufferL(0); dq_buffL(1) := dq_bufferL(1); dq_buffL(2) := dq_bufferL(2); dq_buffL(3) := dq_bufferL(3); dq_buffH(0) := dq_bufferH(0); dq_buffH(1) := dq_bufferH(1); dq_buffH(2) := dq_bufferH(2); dq_buffH(3) := dq_bufferH(3); end if; if (CLK_DLY2'EVENT and CLK_DLY2 = '1') then if (casp6_wt = '1' or (WriteFlag = TRUE and yburst = '1')) then if (casp6_wt = '1') then BkAdd := ADD_PIPE_REG(ExtModeRegister.AL + ModeRegister.CAS_LATENCY + 1) (NUM_OF_BANK_ADD + NUM_OF_COL_ADD - 1 downto NUM_OF_BANK_ADD + NUM_OF_COL_ADD - 2); CWBI := 0; WriteDriver := SA_ARRAY (conv_integer(BkAdd)); end if; if (BankActivatedFlag (conv_integer(BkAdd)) = '1') then TMP_VALUE := conv_std_logic_vector(WriteDriver(conv_integer(real_col_addr(0))), WORD_SIZE); if (dq_buffL(0)(8) = '0' and dq_buffH(0)(8) = '0') then TMP_VALUE := (dq_buffH(0)(7 downto 0) & dq_buffL(0)(7 downto 0)); elsif (dq_buffL(0)(8) = '0' and dq_buffH(0)(8) = '1') then TMP_VALUE := (TMP_VALUE(15 downto 8) & dq_buffL(0)(7 downto 0)); elsif (dq_buffL(0)(8) = '1' and dq_buffH(0)(8) = '0') then TMP_VALUE := (dq_buffH(0)(7 downto 0) & TMP_VALUE(7 downto 0)); elsif (dq_buffL(0)(8) = '1' and dq_buffH(0)(8) = '1') then TMP_VALUE := (TMP_VALUE); end if; WriteDriver (conv_integer(real_col_addr(0))) := conv_integer(TMP_VALUE); TMP_VALUE := conv_std_logic_vector(WriteDriver(conv_integer(real_col_addr(1))), WORD_SIZE); if (dq_buffL(1)(8) = '0' and dq_buffH(1)(8) = '0') then TMP_VALUE := (dq_buffH(1)(7 downto 0) & dq_buffL(1)(7 downto 0)); elsif (dq_buffL(1)(8) = '0' and dq_buffH(1)(8) = '1') then TMP_VALUE := (TMP_VALUE(15 downto 8) & dq_buffL(1)(7 downto 0)); elsif (dq_buffL(1)(8) = '1' and dq_buffH(1)(8) = '0') then TMP_VALUE := (dq_buffH(1)(7 downto 0) & TMP_VALUE(7 downto 0)); elsif (dq_buffL(1)(8) = '1' and dq_buffH(1)(8) = '1') then TMP_VALUE := (TMP_VALUE); end if; WriteDriver (conv_integer(real_col_addr(1))) := conv_integer(TMP_VALUE); TMP_VALUE := conv_std_logic_vector(WriteDriver(conv_integer(real_col_addr(2))), WORD_SIZE); if (dq_buffL(2)(8) = '0' and dq_buffH(2)(8) = '0') then TMP_VALUE := (dq_buffH(2)(7 downto 0) & dq_buffL(2)(7 downto 0)); elsif (dq_buffL(2)(8) = '0' and dq_buffH(2)(8) = '1') then TMP_VALUE := (TMP_VALUE(15 downto 8) & dq_buffL(2)(7 downto 0)); elsif (dq_buffL(2)(8) = '1' and dq_buffH(2)(8) = '0') then TMP_VALUE := (dq_buffH(2)(7 downto 0) & TMP_VALUE(7 downto 0)); elsif (dq_buffL(2)(8) = '1' and dq_buffH(2)(8) = '1') then TMP_VALUE := (TMP_VALUE); end if; WriteDriver (conv_integer(real_col_addr(2))) := conv_integer(TMP_VALUE); TMP_VALUE := conv_std_logic_vector(WriteDriver(conv_integer(real_col_addr(3))), WORD_SIZE); if (dq_buffL(3)(8) = '0' and dq_buffH(3)(8) = '0') then TMP_VALUE := (dq_buffH(3)(7 downto 0) & dq_buffL(3)(7 downto 0)); elsif (dq_buffL(3)(8) = '0' and dq_buffH(3)(8) = '1') then TMP_VALUE := (TMP_VALUE(15 downto 8) & dq_buffL(3)(7 downto 0)); elsif (dq_buffL(3)(8) = '1' and dq_buffH(3)(8) = '0') then TMP_VALUE := (dq_buffH(3)(7 downto 0) & TMP_VALUE(7 downto 0)); elsif (dq_buffL(3)(8) = '1' and dq_buffH(3)(8) = '1') then TMP_VALUE := (TMP_VALUE); end if; WriteDriver (conv_integer(real_col_addr(3))) := conv_integer(TMP_VALUE); if (conv_integer(BkAdd) = 0) then SA_ARRAY_W0 <= WriteDriver; tmp_w_trans0 <= '1', '0' after 2 ns; b0_last_data_in <= (now - 2 ns); elsif (conv_integer(BkAdd) = 1) then SA_ARRAY_W1 <= WriteDriver; tmp_w_trans1 <= '1', '0' after 2 ns; b1_last_data_in <= (now - 2 ns); elsif (conv_integer(BkAdd) = 2) then SA_ARRAY_W2 <= WriteDriver; tmp_w_trans2 <= '1', '0' after 2 ns; b2_last_data_in <= (now - 2 ns); elsif (conv_integer(BkAdd) = 3) then SA_ARRAY_W3 <= WriteDriver; tmp_w_trans3 <= '1', '0' after 2 ns; b3_last_data_in <= (now - 2 ns); end if; CWBI := CWBI + 4; if (CWBI = ModeRegister.BURST_LENGTH and casp_wtI /= '1' and caspwt /= '1') then WriteFinFlag <= transport TRUE, FALSE after 2 ns; CWBI := 0; end if; else assert false report "WARNING : (MEM_WRITE_PROCESS) : Accessing deactivated bank." severity WARNING; CWBI := CWBI + 4; if (CWBI = ModeRegister.BURST_LENGTH and casp_wtI /= '1' and caspwt /= '1') then WriteFinFlag <= transport TRUE, FALSE after 2 ns; CWBI := 0; end if; end if; end if; end if; if (LDQS'EVENT and LDQS = '0' and LDQS'LAST_VALUE = '1' and WriteFlag = TRUE) then dq_bufferL(2) <= transport dq_bufferL(6); dq_bufferL(1) <= transport dq_bufferL(5); dq_bufferL(0) <= transport dq_bufferL(4); dq_bufferL(3) <= transport (LDM & DQ(7 downto 0)); end if; if (LDQS'EVENT and LDQS = '1' and WriteFlag = TRUE) then dq_bufferL(5) <= transport dq_bufferL(3); dq_bufferL(4) <= transport dq_bufferL(2); dq_bufferL(6) <= transport (LDM & DQ(7 downto 0)); end if; if (UDQS'EVENT and UDQS = '0' and UDQS'LAST_VALUE = '1' and WriteFlag = TRUE) then dq_bufferH(2) <= transport dq_bufferH(6); dq_bufferH(1) <= transport dq_bufferH(5); dq_bufferH(0) <= transport dq_bufferH(4); dq_bufferH(3) <= transport (UDM & DQ(15 downto 8)); end if; if (UDQS'EVENT and UDQS = '1' and WriteFlag = TRUE) then dq_bufferH(5) <= transport dq_bufferH(3); dq_bufferH(4) <= transport dq_bufferH(2); dq_bufferH(6) <= transport (UDM & DQ(15 downto 8)); end if;end process;-----------------------------------------------------------------------------------------------------REFRESH_COUNTER : process(AutoRefFlag, SelfRefFlag, CLK) variable rc : integer := 0;begin if (AutoRefFlag'EVENT and AutoRefFlag = TRUE and TimingCheckFlag = TRUE) then if (rc >= 8192) then rc := rc - 8192; end if; if (now - refresh_check(0, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank0" severity warning; end if; if (now - refresh_check(1, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank1" severity warning; end if; if (now - refresh_check(2, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank2" severity warning; end if; if (now - refresh_check(3, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank3" severity warning; end if; tmp_ref_addr1 <= conv_std_logic_vector (rc, NUM_OF_ROW_ADD); tmp_ref_addr1_trans <= transport '1', '0' after 1 ns; rc := rc + 1; end if; if (CLK'EVENT and CLK = '1') then if (SelfRefFlag = TRUE and TimingCheckFlag = TRUE) then Ref_time <= Ref_time + clk_cycle; if (Ref_time >= 7812.5 ns/(conv_integer(ExtModeRegister2.SREF_HOT) + 1)) then Ref_time <= 0 ns; if (rc >= 8192) then rc := rc - 8192; end if; if (now - refresh_check(0, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank0" severity warning; end if; if (now - refresh_check(1, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank1" severity warning; end if; if (now - refresh_check(2, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank2" severity warning; end if; if (now - refresh_check(3, rc) > tREF) then assert false report "WARNING : (REFRESH_INTERVAL) : Refresh Interval Exceeds 64ms for Bank3" severity warning; end if; tmp_ref_addr1 <= conv_std_logic_vector (rc, NUM_OF_ROW_ADD); tmp_ref_addr1_trans <= transport '1', '0' after 1 ns; rc := rc + 1; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -