📄 mt47h256m4.vhd
字号:
DQ0_nwv <= To_UX01(DQ0_ipd); DQ1_nwv <= To_UX01(DQ1_ipd); DQ2_nwv <= To_UX01(DQ2_ipd); DQ3_nwv <= To_UX01(DQ3_ipd); DQS_nwv <= To_UX01(DQS_ipd); DQSNeg_nwv <= To_UX01(DQSNeg_ipd); ---------------------------------------------------------------------------- -- Main Behavior Block ---------------------------------------------------------------------------- Behavior: BLOCK PORT ( ODT : IN std_ulogic := 'U'; CK : IN std_ulogic := 'U'; CKNeg : IN std_ulogic := 'U'; CKE : IN std_ulogic := 'U'; CSNeg : IN std_ulogic := 'U'; RASNeg : IN std_ulogic := 'U'; CASNeg : IN std_ulogic := 'U'; WENeg : IN std_ulogic := 'U'; DM : IN std_ulogic := 'U'; BAIn : IN std_logic_vector(2 DOWNTO 0) := (OTHERS => 'U'); AIn : IN std_logic_vector(13 DOWNTO 0) := (OTHERS => 'U'); DQIn : IN std_logic_vector(3 DOWNTO 0) := (OTHERS => 'U'); DQOut : OUT std_ulogic_vector(3 DOWNTO 0) := (OTHERS => 'Z'); DQSIn : IN std_ulogic := 'U'; DQSOut : OUT std_ulogic := 'Z'; DQSNegIn : IN std_ulogic := 'U'; DQSNegOut : 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, DM => DM_nwv, BAIn(0) => BA0_nwv, BAIn(1) => BA1_nwv, BAIn(2) => BA2_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, AIn(13) => A13_nwv, DQIn(0) => DQ0_nwv, DQIn(1) => DQ1_nwv, DQIn(2) => DQ2_nwv, DQIn(3) => DQ3_nwv, DQOut(0) => DQ0, DQOut(1) => DQ1, DQOut(2) => DQ2, DQOut(3) => DQ3, DQSIn => DQS_nwv, DQSOut => DQS, DQSNegIn => DQSNeg_nwv, DQSNegOut => DQSNeg ); --zero delay signals SIGNAL DQOut_zd : std_logic_vector(3 DOWNTO 0) := (OTHERS => 'Z'); SIGNAL DQSOut_zd : std_logic := 'Z'; SIGNAL DQSNegOut_zd : std_logic := 'Z'; --differential inputs SIGNAL CKDiff : std_logic := 'Z'; SIGNAL DQSDiff : 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); --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; ------------------------------------------------------------------------ -- DYNAMIC MEMORY ALLOCATION VARIABLES & PROCEDURES ------------------------------------------------------------------------ ------------------------------------------------------------------------ -- Data types required to implement link list structure ------------------------------------------------------------------------ TYPE mem_data_t; TYPE mem_data_pointer_t IS ACCESS mem_data_t; TYPE mem_data_t IS RECORD key_address : integer; val_data : integer; successor : mem_data_pointer_t; END RECORD; ------------------------------------------------------------------------ -- Array of linked lists. -- Support memory region partitioning for faster access. ------------------------------------------------------------------------ TYPE mem_data_pointer_array_t IS ARRAY(natural RANGE <>) OF mem_data_pointer_t; ------------------------------------------------------------------------ -- Create linked listed ------------------------------------------------------------------------ PROCEDURE create_list( key_address : IN integer; val_data : IN integer; root : INOUT mem_data_pointer_t) IS BEGIN root := NEW mem_data_t; root.successor := NULL; root.key_address := key_address; root.val_data := val_data; END PROCEDURE create_list; ----------------------------------------------------------------------- -- Iterate through linked listed comparing key values -- Stop when key value greater or equal ----------------------------------------------------------------------- PROCEDURE position_list( key_address : IN integer; root : INOUT mem_data_pointer_t; found : INOUT mem_data_pointer_t; prev : INOUT mem_data_pointer_t) IS BEGIN found := root; prev := NULL; WHILE ((found /= NULL) AND (found.key_address < key_address)) LOOP prev := found; found := found.successor; END LOOP; END PROCEDURE position_list; ---------------------------------------------------------------------- -- Add new element to a linked list ----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -