clin684
Newbie level 3
- Joined
- Apr 12, 2015
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 77
Hi there,
I'm trying to get DDR3 interfacing to work on an Artix-7 evaluation board for my school project.
The Artix-7 evaluation board has a SODIMMs (MT8JTF12864HZ-1G6) of 1GB with a data width of 64 bits. It runs at a clock rate of 400 MHz, with 200 MHz PLL input clock, and a 100 MHz output clock which I used with my interface logic. I have attached the specs of the RAM the MIG 7 generated.
My test interface only does two simple write in sequence, at address 8 (x"4869") and 16 (x"ACE"), and then two simple reads at the same locations. The result is then displayed on the LCD display come with the board. When I programmed this and ran it on the board, somehow the 1st data being read is x"0000" and the 2nd data being read id x"202". After I pressed reset and let it run again, the first data become x"08CE" and the 2nd data become x"ACE". I have tried adding wait states between the write and the read and performing the read right after each write, but the result is never what I'm expecting. Does anyone what the problem is? I have copied my sample code below.
Another question I have is about the address the UI uses. It is a 28 bit address, but the ram only has 3 bits for the bank, 14 bits for the row, and 10 bits for the columns, 27 bits total. So, why is there one extra bit in the app_addr? How can I find out easily which bit I can't use?
Thanks for your generous help!
Cheng
I'm trying to get DDR3 interfacing to work on an Artix-7 evaluation board for my school project.
The Artix-7 evaluation board has a SODIMMs (MT8JTF12864HZ-1G6) of 1GB with a data width of 64 bits. It runs at a clock rate of 400 MHz, with 200 MHz PLL input clock, and a 100 MHz output clock which I used with my interface logic. I have attached the specs of the RAM the MIG 7 generated.
My test interface only does two simple write in sequence, at address 8 (x"4869") and 16 (x"ACE"), and then two simple reads at the same locations. The result is then displayed on the LCD display come with the board. When I programmed this and ran it on the board, somehow the 1st data being read is x"0000" and the 2nd data being read id x"202". After I pressed reset and let it run again, the first data become x"08CE" and the 2nd data become x"ACE". I have tried adding wait states between the write and the read and performing the read right after each write, but the result is never what I'm expecting. Does anyone what the problem is? I have copied my sample code below.
Another question I have is about the address the UI uses. It is a 28 bit address, but the ram only has 3 bits for the bank, 14 bits for the row, and 10 bits for the columns, 27 bits total. So, why is there one extra bit in the app_addr? How can I find out easily which bit I can't use?
Thanks for your generous help!
Cheng
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity Simple_Memory is Port ( Clock : in STD_LOGIC; Reset : in STD_LOGIC; App_Rd_Data : in STD_LOGIC_VECTOR (511 downto 0); App_Rd_Data_End : in STD_LOGIC; App_Rd_Data_Valid : in STD_LOGIC; App_Rdy : in STD_LOGIC; App_Wdf_Rdy : in STD_LOGIC; App_Addr : out STD_LOGIC_VECTOR (27 downto 0); App_Cmd : out STD_LOGIC_VECTOR (2 downto 0); App_En : out STD_LOGIC; App_Wdf_Data : out STD_LOGIC_VECTOR (511 downto 0); App_Wdf_End : out STD_LOGIC; App_Wdf_Wren : out STD_LOGIC; Data_1_Out : out STD_LOGIC_VECTOR (15 downto 0); Data_2_Out : out STD_LOGIC_VECTOR (11 downto 0); Curr_State : out STD_LOGIC_VECTOR (2 downto 0)); end Simple_Memory; architecture Behavioral of Simple_Memory is CONSTANT READ_CMD : STD_LOGIC_VECTOR (2 downto 0) := "001"; CONSTANT WRITE_CMD : STD_LOGIC_VECTOR (2 downto 0) := "000"; signal data_1 : std_logic_vector (63 downto 0); signal data_2 : std_logic_vector (63 downto 0); type state_machine is (Init, Write_1, Write_2, Read_1, Read_Wait_1, Read_2, Read_Wait_2, Done); signal state : state_machine := Init; signal next_state : state_machine; begin state_transition_proc : process (Clock) begin if rising_edge (Clock) then if Reset = '1' then state <= Init; else state <= next_state; end if; end if; end process state_transition_proc; state_proc : process (state, App_Rdy, App_Wdf_Rdy, App_Rd_Data_Valid, App_Rd_Data) begin App_En <= '0'; App_Wdf_Wren <= '0'; App_Wdf_End <= '0'; App_Cmd <= (others => '0'); App_Addr <= (others => '0'); App_Wdf_Data <= (others => '0'); case state is when Init => Curr_State <= "001"; data_1 <= (others => '0'); data_2 <= (others => '0'); if App_Rdy = '0' then next_state <= Init; else next_state <= Write_1; end if; when Write_1 => Curr_State <= "010"; App_Cmd <= WRITE_CMD; App_Addr(3 downto 0) <= x"8"; App_En <= '1'; App_Wdf_Wren <= '1'; App_Wdf_End <= '1'; App_Wdf_Data(15 downto 0) <= x"4869"; if App_Rdy = '1' and App_Wdf_Rdy = '1' then next_state <= Write_2; else next_state <= Write_1; end if; when Write_2 => Curr_State <= "011"; App_Cmd <= WRITE_CMD; App_Addr(7 downto 0) <= x"10"; App_En <= '1'; App_Wdf_Wren <= '1'; App_Wdf_End <= '1'; App_Wdf_Data(11 downto 0) <= x"ACE"; if App_Rdy = '1' and App_Wdf_Rdy = '1' then next_state <= Read_1; else next_state <= Write_2; end if; when Read_1 => Curr_State <= "100"; App_Cmd <= READ_CMD; App_Addr(3 downto 0) <= x"8"; App_En <= '1'; if App_Rdy = '1' then next_state <= Read_Wait_1; else next_state <= Read_1; end if; when Read_Wait_1 => Curr_State <= "101"; App_Cmd <= READ_CMD; App_Addr(3 downto 0) <= x"8"; if App_Rd_Data_Valid = '1' then data_1 <= App_Rd_Data(63 downto 0); next_state <= Read_2; else next_state <= Read_Wait_1; end if; when Read_2 => Curr_State <= "110"; App_Cmd <= READ_CMD; App_Addr(7 downto 0) <= x"10"; App_En <= '1'; if App_Rdy = '1' then next_state <= Read_Wait_2; else next_state <= Read_2; end if; when Read_Wait_2 => Curr_State <= "111"; App_Cmd <= READ_CMD; App_Addr(7 downto 0) <= x"10"; if App_Rd_Data_Valid = '1' then data_2 <= App_Rd_Data(63 downto 0); next_state <= Done; else next_state <= Read_Wait_2; end if; when Done => Curr_State <= "000"; next_state <= Done; end case; end process; Data_1_Out <= data_1(15 downto 0); Data_2_Out <= data_2(11 downto 0); end Behavioral;
Attachments
Last edited by a moderator: