Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cMIPS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roberto Hexsel
cMIPS
Commits
eea4da3a
Commit
eea4da3a
authored
Apr 01, 2016
by
Roberto Hexsel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
incomplete SDRAM controller
parent
254f4bbb
Pipeline
#1243
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
122 additions
and
0 deletions
+122
-0
cMIPS/vhdl/sdram.vhd
cMIPS/vhdl/sdram.vhd
+122
-0
No files found.
cMIPS/vhdl/sdram.vhd
0 → 100644
View file @
eea4da3a
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- cMIPS, a VHDL model of the classical five stage MIPS pipeline.
-- Copyright (C) 2013 Roberto Andre Hexsel
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, version 3.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- SDRAM controller for Macnica's development board Mercurio IV
-- IS42S16320B, 512Mbit SDRAM, 146MHz, 32Mx16bit
--
-- design premise: banks are not interleaved; BA0,BA1 are MS address bits
--
-- TODO:
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
library
IEEE
;
use
IEEE
.
std_logic_1164
.
all
;
use
IEEE
.
numeric_std
.
all
;
use
work
.
p_wires
.
all
;
use
work
.
p_memory
.
all
;
entity
SDRAM_controller
is
port
(
rst
:
in
std_logic
;
-- FPGA reset
clk
:
in
std_logic
;
-- 100MHz clock
hcs
:
in
std_logic
;
-- host side chip select
rdy
:
in
std_logic
;
-- tell CPU to wait
wr
:
in
std_logic
;
-- host side write enable
bsel
:
in
reg4
;
-- byte select
haddr
:
in
reg26
;
-- host side address
hDinp
:
in
reg32
;
-- host side data input
hDout
:
out
reg32
;
-- host side data output
cke
:
out
std_logic
;
-- ram side clock enable
scs
:
out
std_logic
;
-- ram side chip select
ras
:
out
std_logic
;
-- ram side RAS
cas
:
out
std_logic
;
-- ram side CAS
we
:
out
std_logic
;
-- ram side write enable
dqm0
:
out
std_logic
;
-- ram side byte0 output enable
dqm1
:
out
std_logic
;
-- ram side byte0 output enable
ba0
:
out
std_logic
;
-- ram side bank select 0
ba1
:
out
std_logic
;
-- ram side bank select 1
saddr
:
out
reg12
;
-- ram side address
sdata
:
inout
reg16
);
-- ram side data
type
sdram_cmd
is
(
cmd_NOP
,
cmd_PALL
,
cmd_ARF
,
cmd_LMR
,
cmd_ACT
,
cmd_RD
,
cmd_WR
,
cmd_invalid
);
end
entity
SDRAM_controller
;
architecture
simple
of
SDRAM_controller
is
component
registerN
is
generic
(
NUM_BITS
:
integer
;
INIT_VAL
:
std_logic_vector
);
port
(
clk
,
rst
,
ld
:
in
std_logic
;
D
:
in
std_logic_vector
;
Q
:
out
std_logic_vector
);
end
component
registerN
;
signal
reset_done
,
same_row
:
boolean
:
=
FALSE
;
signal
addr
:
reg26
;
signal
last_row
:
reg13
;
signal
col_bits
:
reg10
;
signal
rwo_bits
:
reg13
;
begin
-- simple
U_address
:
registerN
generic
map
(
26
,
b"00"
&
x"000000"
)
port
map
(
clk
,
rst
,
hcs
,
haddr
,
addr
);
row_bits
<=
addr
(
23
downto
11
);
col_bits
<=
addr
(
10
downto
1
);
ba0
<=
addr
(
24
);
ba1
<=
addr
(
25
);
U_last_row
:
registerN
generic
map
(
13
,
'0'
&
x"000"
)
port
map
(
clk
,
rst
,
active
,
haddr
(
23
downto
11
),
last_row
);
-- purpose: wait for 100us after reset
U_rst_100us
:
process
(
clk2x
,
rst
)
variable
cnt
:
integer
:
=
0
;
begin
-- process clk2x
if
rst
=
'0'
then
cnt
:
=
0
;
reset_done
<=
FALSE
;
elsif
rising_edge
(
clk
)
then
cnt
:
=
cnt
+
1
;
if
cnt
=
10000
then
-- 100us elapsed
reset_done
<=
TRUE
;
wait
;
end
if
;
end
if
;
end
process
clk2x
;
end
simple
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment