Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Deike, Benedikt
Projekt
Commits
54d80ef1
Commit
54d80ef1
authored
4 years ago
by
Deike, Benedikt
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
741fa58d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Hardware/components/PC.vhd
+84
-0
84 additions, 0 deletions
Hardware/components/PC.vhd
with
84 additions
and
0 deletions
Hardware/components/PC.vhd
0 → 100644
+
84
−
0
View file @
54d80ef1
library
ieee
;
use
ieee
.
std_logic_1164
.
all
;
use
ieee
.
numeric_std
.
all
;
entity
PC
is
port
(
--------------------------------------------------
-- external processor signals --------------------
--------------------------------------------------
clock
:
in
std_logic
;
nR
:
in
std_logic
;
--------------------------------------------------
-- internal processor signals --------------------
--------------------------------------------------
omnibus
:
out
std_logic_vector
(
15
downto
0
);
-- signals that are required by the adder
imm12
:
in
std_logic_vector
(
11
downto
0
);
-- signals that are required by the 4 to 1
-- multiplexer
muxPC
:
in
std_logic_vector
(
1
downto
0
);
DX
:
in
std_logic_vector
(
15
downto
0
);
-- signals that are required by the PC
-- register and PC buffer
ePC
:
in
std_logic
;
eBuffPC
:
in
std_logic
);
end
PC
;
architecture
arcPC
of
PC
is
-- output signal of the PC register:
-- from PC register to adder and PC buffer
signal
outPC
:
std_logic_vector
(
15
downto
0
);
-- output signal of adder
-- from adder to 4 to 1 multiplexer
signal
outAdd
:
std_logic_vector
(
15
downto
0
);
-- output signal of the 4 to 1 multiplexer
-- from 4 to 1 multiplexer to PC register
signal
outMux
:
std_logic_vector
(
15
downto
0
);
begin
adder
:
process
(
imm12
,
outPC
)
is
begin
outAdd
<=
std_logic_vector
(
signed
(
outPC
)
+
resize
(
signed
(
imm12
),
outPC
'length
));
end
process
adder
;
mux4
:
process
(
muxPC
,
DX
,
outAdd
,
outPC
)
is
begin
case
muxPC
is
when
"00"
=>
outMux
<=
std_logic_vector
(
unsigned
(
outPC
)
+
2
);
when
"01"
=>
outMux
<=
outAdd
;
when
"10"
=>
outMux
<=
DX
;
when
others
=>
outMux
<=
(
others
=>
'0'
);
end
case
;
end
process
mux4
;
regPC
:
process
(
clock
,
nR
,
ePC
)
is
begin
if
nR
=
'0'
then
outPC
<=
(
others
=>
'0'
);
else
if
rising_edge
(
clock
)
then
if
ePC
=
'1'
then
outPC
<=
outMux
;
end
if
;
end
if
;
end
if
;
end
process
regPC
;
buffPC
:
process
(
outPC
,
eBuffPC
)
is
begin
if
eBuffPC
=
'1'
then
omnibus
<=
outPC
;
else
omnibus
<=
(
others
=>
'Z'
);
end
if
;
end
process
buffPC
;
end
arcPC
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment