📄 mt47h16m16.vhd
字号:
LDM : IN std_ulogic := 'U'; UDM : IN std_ulogic := 'U'; BAIn : IN std_logic_vector(1 DOWNTO 0) := (OTHERS => 'U'); AIn : IN std_logic_vector(12 DOWNTO 0) := (OTHERS => 'U'); DQIn_Hi : IN std_logic_vector(7 DOWNTO 0) := (OTHERS => 'U'); DQIn_Lo : IN std_logic_vector(7 DOWNTO 0) := (OTHERS => 'U'); DQOut : OUT std_ulogic_vector(15 DOWNTO 0) := (OTHERS => 'Z'); UDQSIn : IN std_ulogic := 'U'; UDQSOut : OUT std_ulogic := 'Z'; UDQSNegIn : IN std_ulogic := 'U'; UDQSNegOut : OUT std_ulogic := 'Z'; LDQSIn : IN std_ulogic := 'U'; LDQSOut : OUT std_ulogic := 'Z'; LDQSNegIn : IN std_ulogic := 'U'; LDQSNegOut : OUT std_ulogic := 'Z' ); PORT MAP ( ODT => ODT_nwv, CK => CK_nwv, CKNeg => CKNeg_nwv, CKE => CKE_nwv, CSNeg => CSNeg_nwv, RASNeg => RASNeg_nwv, CASNeg => CASNeg_nwv, WENeg => WENeg_nwv, LDM => LDM_nwv, UDM => UDM_nwv, BAIn(0) => BA0_nwv, BAIn(1) => BA1_nwv, AIn(0) => A0_nwv, AIn(1) => A1_nwv, AIn(2) => A2_nwv, AIn(3) => A3_nwv, AIn(4) => A4_nwv, AIn(5) => A5_nwv, AIn(6) => A6_nwv, AIn(7) => A7_nwv, AIn(8) => A8_nwv, AIn(9) => A9_nwv, AIn(10) => A10_nwv, AIn(11) => A11_nwv, AIn(12) => A12_nwv, DQIn_Lo(0)=> DQ0_nwv, DQIn_Lo(1)=> DQ1_nwv, DQIn_Lo(2)=> DQ2_nwv, DQIn_Lo(3)=> DQ3_nwv, DQIn_Lo(4)=> DQ4_nwv, DQIn_Lo(5)=> DQ5_nwv, DQIn_Lo(6)=> DQ6_nwv, DQIn_Lo(7)=> DQ7_nwv, DQIn_Hi(0)=> DQ8_nwv, DQIn_Hi(1)=> DQ9_nwv, DQIn_Hi(2)=> DQ10_nwv, DQIn_Hi(3)=> DQ11_nwv, DQIn_Hi(4)=> DQ12_nwv, DQIn_Hi(5)=> DQ13_nwv, DQIn_Hi(6)=> DQ14_nwv, DQIn_Hi(7)=> DQ15_nwv, DQOut(0) => DQ0, DQOut(1) => DQ1, DQOut(2) => DQ2, DQOut(3) => DQ3, DQOut(4) => DQ4, DQOut(5) => DQ5, DQOut(6) => DQ6, DQOut(7) => DQ7, DQOut(8) => DQ8, DQOut(9) => DQ9, DQOut(10) => DQ10, DQOut(11) => DQ11, DQOut(12) => DQ12, DQOut(13) => DQ13, DQOut(14) => DQ14, DQOut(15) => DQ15, UDQSIn => UDQS_nwv, UDQSOut => UDQS, UDQSNegIn => UDQSNeg_nwv, UDQSNegOut=> UDQSNeg, LDQSIn => LDQS_nwv, LDQSOut => LDQS, LDQSNegIn => LDQSNeg_nwv, LDQSNegOut=> LDQSNeg ); --zero delay signals SIGNAL DQOut_zd : std_logic_vector(15 DOWNTO 0) := (OTHERS => 'Z'); SIGNAL UDQSOut_zd : std_logic := 'Z'; SIGNAL UDQSNegOut_zd : std_logic := 'Z'; SIGNAL LDQSOut_zd : std_logic := 'Z'; SIGNAL LDQSNegOut_zd : std_logic := 'Z'; --differential inputs SIGNAL CKDiff : std_logic := 'Z'; SIGNAL LDQSDiff : std_logic := 'Z'; SIGNAL UDQSDiff : std_logic := 'Z'; --DLL implementation SIGNAL CKPeriod : time := 3 ns; SIGNAL CKInt : std_ulogic := '0'; SIGNAL CKtemp : std_ulogic := '1'; SIGNAL CKHalfPer : time := 0 ns; SIGNAL CKDLLDelay: time := 0 ns; SIGNAL CK_stable : boolean := FALSE; SIGNAL PoweredUp : boolean := FALSE; SIGNAL In_d : boolean := FALSE; --delay before first precharge all SIGNAL Init_delay : boolean := FALSE;--command during initialization SIGNAL Initialized : boolean := FALSE;--initialization completed SIGNAL DLL_delay : std_logic := '0'; --delay between DLL SIGNAL DLL_delay_elapsed : boolean := TRUE;--reset and read command SIGNAL In_data : std_ulogic := '0';--start of write operation SIGNAL preamble_gen : std_logic := 'Z';--preamble before read operation SIGNAL Out_data : std_logic := 'Z';--start of read operation -- timing check violation SIGNAL Viol : X01 := '0'; --burst sequences TYPE sequence IS ARRAY (0 TO 7) OF integer RANGE -7 TO 7; TYPE seqtab IS ARRAY (0 TO 7) OF sequence; CONSTANT seq0 : sequence := (0, 1, 2, 3, 4, 5, 6, 7); CONSTANT seq1 : sequence := (0, 1, 2,-1, 4, 5, 6, 3); CONSTANT seq2 : sequence := (0, 1,-2,-1, 4, 5, 2, 3); CONSTANT seq3 : sequence := (0,-3,-2,-1, 4, 1, 2, 3); CONSTANT seq4 : sequence := (0, 1, 2, 3,-4,-3,-2,-1); CONSTANT seq5 : sequence := (0, 1, 2,-1,-4,-3,-2,-5); CONSTANT seq6 : sequence := (0, 1,-2,-1,-4,-3,-6,-5); CONSTANT seq7 : sequence := (0,-3,-2,-1,-4,-7,-6,-5); CONSTANT seq : seqtab := (seq0, seq1, seq2, seq3, seq4, seq5, seq6, seq7); CONSTANT inl0 : sequence := (0, 1, 2, 3, 4, 5, 6, 7); CONSTANT inl1 : sequence := (0,-1, 2, 1, 4, 3, 6, 5); CONSTANT inl2 : sequence := (0, 1,-2,-1, 4, 5, 2, 3); CONSTANT inl3 : sequence := (0,-1,-2,-3, 4, 3, 2, 1); CONSTANT inl4 : sequence := (0, 1, 2, 3,-4,-3,-2,-1); CONSTANT inl5 : sequence := (0,-1, 2, 1,-4,-5,-2,-3); CONSTANT inl6 : sequence := (0, 1,-2,-1,-4,-3,-6,-5); CONSTANT inl7 : sequence := (0,-1,-2,-3,-4,-5,-6,-7); CONSTANT inl : seqtab := (inl0, inl1, inl2, inl3, inl4, inl5, inl6, inl7); --memory definition TYPE MemStore IS ARRAY (0 TO MemSize) OF integer RANGE -2 TO MaxData; TYPE MemBlock IS ARRAY (0 TO BankNum) OF MemStore; SHARED VARIABLE Mem_Hi : MemBlock; SHARED VARIABLE Mem_Lo : MemBlock; --mode registers SHARED VARIABLE MR : std_logic_vector(12 DOWNTO 0) := (OTHERS => '0'); SHARED VARIABLE EMR : std_logic_vector(12 DOWNTO 0); SHARED VARIABLE EMR2 : std_logic_vector(12 DOWNTO 0); SHARED VARIABLE EMR3 : std_logic_vector(12 DOWNTO 0); SHARED VARIABLE burst_len : natural RANGE 4 TO 8;--burst length SHARED VARIABLE active_forbid : boolean := FALSE;--more than 4 active --commands during tFAW --bank, row and column of scheduled read or write operation SHARED VARIABLE current_bank : natural RANGE 0 TO BankNum; SHARED VARIABLE current_row : natural RANGE 0 TO RowNum; SHARED VARIABLE current_column : natural RANGE 0 TO ColNum; --bank, row and column of read operation that starts SHARED VARIABLE read_bank : natural RANGE 0 TO BankNum; SHARED VARIABLE read_row : natural RANGE 0 TO RowNum; SHARED VARIABLE read_column : natural RANGE 0 TO ColNum; TYPE write_sch_type IS ARRAY (0 TO 10) OF boolean; TYPE write_sch_bank_type IS ARRAY (0 TO BankNum) OF write_sch_type; --all scheduled reads within all banks SHARED VARIABLE read_sch : write_sch_bank_type := (OTHERS => (OTHERS => FALSE)); --reads that should be preceeded by preamble SHARED VARIABLE preamble : write_sch_bank_type := (OTHERS => (OTHERS => TRUE)); TYPE wait_read_type IS ARRAY (0 TO 10) OF std_ulogic; TYPE wait_read_bank_type IS ARRAY (0 TO BankNum) OF wait_read_type; --wait_read triggers process that counts remaining cycles to the --beggining of scheduled read when aditive latency has elapsed, and --read_delay keeps information of number of remaining cycles SIGNAL wait_read : wait_read_bank_type; SHARED VARIABLE read_delay : natural RANGE 0 TO 7; --needed for check if all rows were refreshed during refresh period SIGNAL Ref_per_start : std_ulogic := '0'; SIGNAL Ref_per_expired : std_ulogic := '0'; SHARED VARIABLE CK_rise : time := 0 ns; SHARED VARIABLE CK_period : time := 0 ns; TYPE Bank_state_type IS (precharged, refreshing, MRsetting, activating, active, reading, readingAP, writting, writtingAP, precharging, prechall); TYPE Bank_state_array_type IS ARRAY (0 TO BankNum) OF Bank_state_type; SHARED VARIABLE Curr_bank_state : Bank_state_array_type; SHARED VARIABLE Next_bank_state : Bank_state_array_type; SHARED VARIABLE SR_cond : boolean := FALSE;--self refresh can be entered SIGNAL SelfRefresh : boolean := FALSE;--self refresh active SIGNAL SR_exit : boolean := FALSE;--CKE high, self refresh exit SHARED VARIABLE SR_enter_cycle : boolean := FALSE;--clock can be --turned off SIGNAL Pre_PD : boolean := FALSE;--precharge power down active SIGNAL Act_PD : boolean := FALSE;--active power down active SHARED VARIABLE Read_Start : boolean := FALSE;--read burst in progress, SIGNAL ReadStart : boolean := FALSE; --no pd entry SIGNAL Reset : boolean := FALSE;--reset function active SHARED VARIABLE Reset_enter_cycle : boolean := FALSE;--clocks can be --turned off SIGNAL SimulationEnd : boolean := FALSE; SIGNAL preamble_check : boolean := FALSE; SIGNAL postamble_check : boolean := FALSE; SIGNAL skew_check : boolean := FALSE; FUNCTION bool_to_nat(tm : boolean) RETURN natural IS VARIABLE Temp : natural; BEGIN Temp := 0; IF tm THEN Temp := 1; END IF; RETURN Temp; END bool_to_nat; BEGIN CK_DLL: PROCESS(CKDiff) VARIABLE Previous : time := 0 ns; VARIABLE TmpPer : time := 0 ns; BEGIN IF rising_edge(CKDiff) THEN TmpPer := NOW - Previous; IF TmpPer > 0 ns THEN CKPeriod <= TmpPer; END IF; Previous := NOW; CKHalfPer <= CKPeriod / 2; CKDLLDelay <= CKPeriod - tpd_CK_DQ1; END IF; END PROCESS CK_DLL; CK_temp: PROCESS(CKDiff) -- generating internal clock from DLL BEGIN CKtemp <= NOT CKDiff AFTER CKHalfPer; END PROCESS CK_temp; CKInt <= TRANSPORT CKtemp AFTER CKDLLDelay; Power_up: PROCESS(CK_stable) BEGIN IF CK_stable THEN PoweredUp <= TRUE AFTER 200 us; END IF; END PROCESS Power_up; Init_d: PROCESS(In_d) BEGIN IF In_d THEN Init_delay <= TRUE AFTER 400 ns; ELSE Init_delay <= FALSE; END IF; END PROCESS Init_d; DLLdelay: PROCESS(DLL_delay, CKDiff) VARIABLE cnt : natural; BEGIN IF rising_edge(DLL_delay) THEN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -