[SDRAM CMD FSM]
- bugfix Burst mode git-svn-id: http://moon:8086/svn/vhdl/trunk@1228 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -51,6 +51,9 @@ end sdram_cmd;
|
||||
|
||||
architecture behaviour of sdram_cmd is
|
||||
|
||||
subtype cycle_cnt_t is natural range 0 to 15;
|
||||
subtype burst_cnt_t is natural range 0 to 2**(LMR_BL_CURR)-1;
|
||||
|
||||
signal st_sdr, st_sdr_next : sdr_state_t;
|
||||
|
||||
signal cc_preset : natural range 0 to 15;
|
||||
@@ -59,8 +62,7 @@ architecture behaviour of sdram_cmd is
|
||||
|
||||
signal burst_load_en : std_logic;
|
||||
signal burst_finished : std_logic;
|
||||
|
||||
subtype cycle_cnt_t is natural range 0 to 15;
|
||||
signal burst_cnt : burst_cnt_t;
|
||||
|
||||
type part_timing_array_t is array (sdr_cmd_t) of cycle_cnt_t;
|
||||
constant TIMING : part_timing_array_t :=
|
||||
@@ -163,36 +165,38 @@ fsm_sdr_state:
|
||||
when WRITE =>
|
||||
phy_ctrl.drive_en <= '1';
|
||||
phy_ctrl.we <= '1';
|
||||
if burst_finished = '1' then
|
||||
if cmd_we = '1' and cmd = SD_WRITE then
|
||||
phy_ctrl.part.addr(col_addr_t'range) <= col_addr;
|
||||
cmd_ack <= '1';
|
||||
phy_ctrl.part.cmd <= COMMAND(SD_NOP);
|
||||
if cmd_we = '1' and cmd = SD_WRITE then
|
||||
cmd_ack <= '1';
|
||||
phy_ctrl.utag_we <= '1';
|
||||
phy_ctrl.part.addr(col_addr_t'range) <= col_addr;
|
||||
if burst_finished = '1' then
|
||||
burst_load_en <= '1';
|
||||
phy_ctrl.part.cmd <= COMMAND(cmd);
|
||||
phy_ctrl.utag_we <= '1';
|
||||
else
|
||||
phy_ctrl.drive_en <= '0';
|
||||
cc_load_en <= '1';
|
||||
cc_preset <= TIMING(SD_WRITE)+1;
|
||||
st_sdr_next <= ROW_ACT;
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
phy_ctrl.drive_en <= '0';
|
||||
cc_load_en <= '1';
|
||||
cc_preset <= TIMING(SD_WRITE)+1;
|
||||
st_sdr_next <= ROW_ACT;
|
||||
end if;
|
||||
|
||||
when READ =>
|
||||
phy_ctrl.re <= '1';
|
||||
if burst_finished = '1' then
|
||||
if cmd_we = '1' and cmd = SD_READ then
|
||||
phy_ctrl.part.addr(col_addr_t'range) <= col_addr;
|
||||
cmd_ack <= '1';
|
||||
phy_ctrl.part.cmd <= COMMAND(SD_NOP);
|
||||
if cmd_we = '1' and cmd = SD_READ then
|
||||
cmd_ack <= '1';
|
||||
phy_ctrl.utag_we <= '1';
|
||||
phy_ctrl.part.addr(col_addr_t'range) <= col_addr;
|
||||
if burst_finished = '1' then
|
||||
burst_load_en <= '1';
|
||||
phy_ctrl.part.cmd <= COMMAND(cmd);
|
||||
phy_ctrl.utag_we <= '1';
|
||||
else
|
||||
cc_load_en <= '1';
|
||||
cc_preset <= TIMING(SD_READ);
|
||||
st_sdr_next <= ROW_ACT;
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
cc_load_en <= '1';
|
||||
cc_preset <= TIMING(SD_READ);
|
||||
st_sdr_next <= ROW_ACT;
|
||||
end if;
|
||||
|
||||
when WRITE_A => -- not implemented yet
|
||||
cmd_ack <= '1';
|
||||
@@ -265,19 +269,18 @@ cycle_counter:
|
||||
------------------------------------------------------------------------------------------
|
||||
burst_counter:
|
||||
process (clk)
|
||||
variable burst_cnt : natural range 0 to 2**(LMR_BL_CURR);
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
if burst_load_en = '1' then
|
||||
burst_finished <= '0';
|
||||
burst_cnt := 2**(LMR_BL_CURR);
|
||||
burst_cnt <= burst_cnt_t'high;
|
||||
if 2**(LMR_BL_CURR) = DATA_RATE_FACTOR then
|
||||
burst_finished <= '1';
|
||||
end if;
|
||||
elsif burst_cnt < DATA_RATE_FACTOR then
|
||||
elsif burst_cnt <= DATA_RATE_FACTOR then
|
||||
burst_finished <= '1';
|
||||
else
|
||||
burst_cnt := burst_cnt - DATA_RATE_FACTOR;
|
||||
burst_cnt <= burst_cnt - DATA_RATE_FACTOR;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
@@ -47,7 +47,7 @@ package sdram_config is
|
||||
constant BIT_PRE_ALL : positive := 10; -- bit-position in column address for precharge all (see Data Sheet)
|
||||
constant ENABLE_PRE_ALL : std_logic := '1';
|
||||
constant ENABLE_AUTO_PRE : std_logic := '0';
|
||||
constant LMR_BL_CURR : natural := LMR_BL1;
|
||||
constant LMR_BL_CURR : natural := LMR_BL8;
|
||||
|
||||
-- DDR-SDR TIMING constants ------------------------------------------------------------------
|
||||
-- After REFRESH_CLOCKS a refresh cycle is necessary, 64ms / 8192 = max every 7.8125 us refesh
|
||||
|
||||
Reference in New Issue
Block a user