Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
3
381_Project_1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
erdunn
381_Project_1
Merge requests
!1
Revert "register_File"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Revert "register_File"
revert-105ad4ed
into
main
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
erdunn
requested to merge
revert-105ad4ed
into
main
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
This reverts commit
105ad4ed
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
cd9c1c35
1 commit,
1 year ago
1 file
+
57
−
37
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/RegFile/registerFile.vhd
+
57
−
37
Options
@@ -6,54 +6,74 @@ entity RegisterFile is
i_CLK
:
in
std_logic
;
i_RST
:
in
std_logic
;
i_WE
:
in
std_logic
;
i_RD_ADDR1
:
in
std_logic_vector
(
4
downto
0
);
i_RD_ADDR2
:
in
std_logic_vector
(
4
downto
0
);
i_WR_ADDR
:
in
std_logic_vector
(
4
downto
0
);
i_WR_DATA
:
in
std_logic_vector
(
31
downto
0
);
o_RD_DATA1
:
out
std_logic_vector
(
31
downto
0
);
o_RD_DATA2
:
out
std_logic_vector
(
31
downto
0
)
i_RD_ADDR1
:
in
std_logic_vector
(
4
downto
0
);
-- Read address 1 (5 bits)
i_RD_ADDR2
:
in
std_logic_vector
(
4
downto
0
);
-- Read address 2 (5 bits)
i_WR_ADDR
:
in
std_logic_vector
(
4
downto
0
);
-- Write address (5 bits)
i_WR_DATA
:
in
std_logic_vector
(
31
downto
0
);
-- Data to be written (32 bits)
o_RD_DATA1
:
out
std_logic_vector
(
31
downto
0
);
-- Read Data 1 (32 bits)
o_RD_DATA2
:
out
std_logic_vector
(
31
downto
0
)
-- Read Data 2 (32 bits)
);
end
RegisterFile
;
architecture
Structural
of
RegisterFile
is
signal
s_WR_DATA
:
std_logic_vector
(
31
downto
0
);
signal
s_RD_DATA1
:
std_logic_vector
(
31
downto
0
);
signal
s_RD_DATA2
:
std_logic_vector
(
31
downto
0
);
component
reg
is
Port
(
CLK
:
in
std_logic
;
RESET
:
in
std_logic
;
D
:
in
std_logic_vector
(
31
downto
0
);
Q
:
out
std_logic_vector
(
31
downto
0
)
);
end
component
;
architecture
Dataflow
of
RegisterFile
is
signal
s_decoder_out
:
std_logic_vector
(
31
downto
0
);
-- Output of the decoder (32 bits)
signal
s_decoder_match
:
std_logic
;
-- Decoder match signal
signal
s_register_we
:
std_logic
;
-- Write enable signal for the selected register
signal
s_register_q
:
std_logic_vector
(
31
downto
0
);
-- Data output from the selected register
begin
WR_REG1
:
reg
-- Decoder instantiation
Decoder
:
entity
work
.
decoder_5x32
port
map
(
I
=>
i_RD_ADDR1
,
O
=>
s_decoder_out
);
-- Generate write enable signal for the selected register
s_decoder_match
<=
'1'
when
(
s_decoder_out
(
4
downto
0
)
=
i_WR_ADDR
)
else
'0'
;
s_register_we
<=
i_WE
when
s_decoder_match
=
'1'
else
'0'
;
-- Register banks (32 registers)
Register0
:
entity
work
.
NBitRegister
generic
map
(
N
=>
32
)
port
map
(
CLK
=>
i_CLK
,
RESET
=>
i_RST
,
D
=>
i_WR_DATA
,
Q
=>
s_WR_DATA
i_CLK
=>
i_CLK
,
i_RST
=>
i_RST
,
i_WE
=>
s_register_we
,
i_D
=>
i_WR_DATA
,
o_Q
=>
s_register_q
);
RD_REG1
:
reg
-- Assign the selected register's output to RD_DATA1
o_RD_DATA1
<=
s_register_q
;
-- Repeat the process for the second read address (i_RD_ADDR2) and output to RD_DATA2
Decoder2
:
entity
work
.
decoder_5x32
port
map
(
CLK
=>
i_CLK
,
RESET
=>
i_RST
,
D
=>
(
others
=>
'0'
),
Q
=>
s_RD_DATA1
I
=>
i_RD_ADDR2
,
O
=>
s_decoder_out
);
RD_REG2
:
reg
-- Generate write enable signal for the selected register
s_decoder_match
<=
'1'
when
(
s_decoder_out
(
4
downto
0
)
=
i_WR_ADDR
)
else
'0'
;
s_register_we
<=
i_WE
when
s_decoder_match
=
'1'
else
'0'
;
-- Register banks (32 registers)
Register1
:
entity
work
.
NBitRegister
generic
map
(
N
=>
32
)
port
map
(
CLK
=>
i_CLK
,
RESET
=>
i_RST
,
D
=>
(
others
=>
'0'
),
Q
=>
s_RD_DATA2
i_CLK
=>
i_CLK
,
i_RST
=>
i_RST
,
i_WE
=>
s_register_we
,
i_D
=>
i_WR_DATA
,
o_Q
=>
s_register_q
);
o_RD_DATA1
<=
s_RD_DATA1
;
o_RD_DATA2
<=
s_RD_DATA2
;
end
Structural
;
-- Assign the selected register's output to RD_DATA2
o_RD_DATA2
<=
s_register_q
;
end
Dataflow
;
Loading