📄 mb811643242.vhd
字号:
IF cur_bank = bank THEN -- It is only an error if this bank is selected ASSERT (command = nop OR command = pre) REPORT InstancePath & partID & BankString &": Illegal command received" & " during precharge." SEVERITY SeverityMode; END IF; WHEN idle => IF (command = nop OR command = bst OR command = pre) OR (cur_bank /= bank) THEN null; ELSIF (command = mrs) THEN IF (statebank = idle & idle & idle & idle) THEN ModeReg := AddressIn; statebank <= mode_set & mode_set & mode_set & mode_set; END IF; ELSIF (command = ref) THEN IF (statebank = idle & idle & idle & idle) THEN IF (CKEIn = '1') THEN statebank(bank) <= auto_refresh, idle AFTER tdevice_TRCAR; ELSE statebank(bank) <= self_refresh; END IF; END IF; ELSIF (command = act) THEN statebank(bank) <= bank_act; ras_in(bank) <= '1', '0' AFTER 70 ns; rct_in <= '1', '0' AFTER 1 ns; rcdt_in(bank) <= '1', '0' AFTER 1 ns; MemAddr(bank)(18 downto 8) := AddressIn; -- latch row addr ELSE -- IF cur_bank = bank THEN ASSERT false REPORT InstancePath & partID & ": Illegal command" & " received in idle state." SEVERITY SeverityMode; END IF; WHEN mode_set => statebank <= idle & idle & idle & idle; ASSERT (ModeReg(7) = '0' AND ModeReg(8) ='0') REPORT InstancePath & partID & BankString &": Illegal operating mode set." SEVERITY SeverityMode; ASSERT command = nop REPORT InstancePath & partID & BankString & ": Illegal command received during mode_set." SEVERITY SeverityMode; -- read burst length IF (ModeReg(2 downto 0) = "000") THEN Burst_Length := 1; Burst_Bits := 0; ELSIF (ModeReg(2 downto 0) = "001") THEN Burst_Length := 2; Burst_Bits := 1; ELSIF (ModeReg(2 downto 0) = "010") THEN Burst_Length := 4; Burst_Bits := 2; ELSIF (ModeReg(2 downto 0) = "011") THEN Burst_Length := 8; Burst_Bits := 3; ELSIF (ModeReg(2 downto 0) = "111") THEN Burst_Length := 256; Burst_Bits := 7; ELSE ASSERT false REPORT InstancePath & partID & BankString &": Invalid burst length specified." SEVERITY SeverityMode; END IF; -- read burst type IF (ModeReg(3) = '0') THEN Burst := sequential; ELSIF (ModeReg(3) = '1') THEN Burst := interleave; ELSE ASSERT false REPORT InstancePath & partID & BankString &": Invalid burst type specified." SEVERITY SeverityMode; END IF; -- read CAS latency IF (ModeReg(6 downto 4) = "010") THEN CAS_Lat <= 2; ELSIF (ModeReg(6 downto 4) = "011") THEN CAS_Lat <= 3; ELSE ASSERT false REPORT InstancePath & partID & BankString & ": CAS Latency set incorrecty " SEVERITY SeverityMode; END IF; -- read write burst mode IF (ModeReg(9) = '0') THEN WB := programmed; ELSIF (ModeReg(9) = '1') THEN WB := single; ELSE ASSERT false REPORT InstancePath & partID & BankString & ": Invalid burst type specified." SEVERITY SeverityMode; END IF; WHEN auto_refresh => IF (Ref_Cnt < 4096) THEN Ref_Cnt := Ref_Cnt + 1; END IF; ASSERT command = nop REPORT InstancePath & partID & BankString & ": Illegal command received during auto_refresh." SEVERITY SeverityMode; WHEN bank_act => IF (command = pre) AND ((cur_bank = bank) OR (AddressIn(10) = '1')) THEN ASSERT ras_out(bank) = '1' REPORT InstancePath & partID & BankString & ": precharge command" & " does not meet tRAS time." SEVERITY SeverityMode; statebank(bank) <= precharge, idle AFTER tdevice_TRP; ELSIF (command = nop OR command = bst) OR (cur_bank /= bank) THEN null; ELSIF (command = read) THEN ASSERT rcdt_out(bank) = '0' REPORT InstancePath & partID & BankString & ": read command received too soon after active." SEVERITY SeverityMode; ASSERT ((AddressIn(10) = '0') OR (AddressIn(10) = '1')) REPORT InstancePath & partID & BankString & ": AddressIn(10) = X" & " during read command. Next state unknown." SEVERITY SeverityMode; MemAddr(bank)(7 downto 0) := (others => '0'); -- clr old addr MemAddr(bank)(7 downto Burst_Bits) := AddressIn(7 downto Burst_Bits); --latch col addr IF (Burst_Bits > 0) THEN Burst_Inc(bank) := to_nat(AddressIn(Burst_Bits-1 downto 0)); END IF; StartAddr(bank) := Burst_Inc(bank) mod 8; BaseLoc(bank) := to_nat(MemAddr(bank)); Location := BaseLoc(bank) + Burst_Inc(bank); DataDrive(3) := to_slv(MemData3(Bank)(Location),8); DataDrive(2) := to_slv(MemData2(Bank)(Location),8); DataDrive(1) := to_slv(MemData1(Bank)(Location),8); DataDrive(0) := to_slv(MemData0(Bank)(Location),8); Burst_Cnt(bank) := 1; IF (AddressIn(10) = '0') THEN statebank(bank) <= read; ELSIF (AddressIn(10) = '1') THEN statebank(bank) <= read_auto_pre; END IF; ELSIF (command = writ) THEN ASSERT rcdt_out(bank) = '0' REPORT InstancePath & partID & BankString & ": write command" & " received too soon after active." SEVERITY SeverityMode; ASSERT ((AddressIn(10) = '0') OR (AddressIn(10) = '1')) REPORT InstancePath & partID & BankString & ": AddressIn(10) = X" & " during write command. Next state unknown." SEVERITY SeverityMode; MemAddr(bank)(7 downto 0) := (others => '0'); --clr old addr MemAddr(bank)(7 downto Burst_Bits) := AddressIn(7 downto Burst_Bits); --latch col addr IF (Burst_Bits > 0) THEN Burst_Inc(bank) := to_nat(AddressIn(Burst_Bits-1 downto 0)); END IF; StartAddr(bank) := Burst_Inc(bank) mod 8; BaseLoc(bank) := to_nat(MemAddr(bank)); Location := BaseLoc(bank) + Burst_Inc(bank); IF (DQM3_nwv = '0') THEN MemData3(Bank)(Location) := to_nat(DataIn(31 downto 24)); END IF; IF (DQM2_nwv = '0') THEN MemData2(Bank)(Location) := to_nat(DataIn(23 downto 16)); END IF; IF (DQM1_nwv = '0') THEN MemData1(Bank)(Location) := to_nat(DataIn(15 downto 8)); END IF; IF (DQM1_nwv = '0') THEN MemData0(Bank)(Location) := to_nat(DataIn(7 downto 0)); END IF; Burst_Cnt(bank) := 1; wrt_in <= '1'; IF (AddressIn(10) = '0') THEN statebank(bank) <= write; ELSIF (AddressIn(10) = '1') THEN statebank(bank) <= write_auto_pre; END IF; written := true; ELSIF (cur_bank = bank) OR (command = mrs) THEN ASSERT false REPORT InstancePath & partID & BankString & ": Illegal command " & "received in active state." SEVERITY SeverityMode; END IF; WHEN write => IF (command = bst) THEN statebank(bank) <= bank_act; Burst_Cnt(bank) := 0; ELSIF (command = read) THEN IF (bank = cur_bank) THEN MemAddr(bank)(7 downto 0) := (others => '0'); --clr old addr MemAddr(bank)(7 downto Burst_Bits) := AddressIn(7 downto Burst_Bits); --latch col addr IF (Burst_Bits > 0) THEN Burst_Inc(bank) := to_nat(AddressIn(Burst_Bits-1 downto 0)); END IF; StartAddr(bank) := Burst_Inc(bank) mod 8; BaseLoc(bank) := to_nat(MemAddr(bank)); Location := BaseLoc(bank) + Burst_Inc(bank); DataDrive(3) := to_slv(MemData3(Bank)(Location),8); DataDrive(2) := to_slv(MemData2(Bank)(Location),8); DataDrive(1) := to_slv(MemData1(Bank)(Location),8); DataDrive(0) := to_slv(MemData0(Bank)(Location),8); Burst_Cnt(bank) := 1; IF (AddressIn(10) = '0') THEN statebank(bank) <= read; ELSIF (AddressIn(10) = '1') THEN statebank(bank) <= read_auto_pre; END IF; ELSE statebank(bank) <= bank_act; END IF; ELSIF (command = writ) THEN IF cur_bank = bank THEN MemAddr(bank)(7 downto 0) := (others => '0'); --clr old addr MemAddr(bank)(7 downto Burst_Bits) := AddressIn(7 downto Burst_Bits); --latch col addr IF (Burst_Bits > 0) THEN Burst_Inc(bank) := to_nat(AddressIn(Burst_Bits-1 downto 0)); END IF; StartAddr(bank) := Burst_Inc(bank) mod 8; BaseLoc(bank) := to_nat(MemAddr(bank)); Location := BaseLoc(bank) + Burst_Inc(bank); IF (DQM3_nwv = '0') THEN MemData3(Bank)(Location) := to_nat(DataIn(31 downto 24)); END IF; IF (DQM2_nwv = '0') THEN MemData2(Bank)(Location) := to_nat(DataIn(23 downto 16)); END IF; IF (DQM1_nwv = '0') THEN MemData1(Bank)(Location) := to_nat(DataIn(15 downto 8)); END IF; IF (DQM0_nwv = '0') THEN MemData0(Bank)(Location) := to_nat(DataIn(7 downto 0)); END IF; Burst_Cnt(bank) := 1; wrt_in <= '1'; IF (AddressIn(10) = '1') THEN statebank(bank) <= write_auto_pre; END IF; ELSE statebank(bank) <= bank_act; END IF; ELSIF (command = pre) AND ((cur_bank = bank) OR (AddressIn(10) = '1')) THEN ASSERT ras_out(bank) = '1' REPORT InstancePath & partID & BankString & ": precharge command" & " does not meet tRAS time." SEVERITY SeverityMode; ASSERT (DQM0_nwv = '1' AND DQM1_nwv = '1' AND DQM2_nwv = '1' AND DQM3_nwv = '1') REPORT InstancePath & partID & BankString & ": DQMs should be"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -