Serial sequential adder
v.1.0
Example documentation project, author Vladimir Petrović
quartus_projekat
shiftreg.vhd
Go to the documentation of this file.
1
17
18
19
library
ieee
;
20
21
use
ieee
.std_logic_1164.
all
;
22
use
ieee
.numeric_std.
all
;
23
32
entity
shiftreg
is
33
generic
(
34
reg_width :
integer
:=
8
35
)
;
36
port
(
37
clk
:
in
std_logic
;
38
reset
:
in
std_logic
;
39
load
,
do_shift
:
in
std_logic
;
40
sin
:
in
std_logic
;
41
sout
:
out
std_logic
;
42
pin :
in
std_logic_vector
(reg_width -
1
downto
0
);
43
pout
:
out
std_logic_vector
(
reg_width
-
1
downto
0
)
44
)
;
45
end
shiftreg
;
46
52
architecture
shr_behav_arch
of
shiftreg
is
53
54
signal
reg_state
:
std_logic_vector
(
reg_width
-
1
downto
0
)
;
55
56
begin
57
58
shift_reg_process :
process
(
clk
,
reset
)
59
begin
60
if
reset
=
'
1
'
then
61
sout
<=
'
0
'
;
62
reg_state <= (
others
=> '0');
63
elsif
rising_edge
(
clk
)
then
64
if
load
=
'
1
'
then
65
reg_state <= pin;
66
sout
<=
pin
(
0
)
;
67
elsif
do_shift
=
'
1
'
then
68
sout
<=
reg_state
(
1
)
;
69
reg_state <= sin & reg_state(reg_width -
1
downto
1
);
70
end
if
;
71
end
if
;
72
73
end
process
;
74
75
pout
<=
reg_state
;
76
77
end
shr_behav_arch
;
shiftreg.clk
in clkstd_logic
Definition:
shiftreg.vhd:37
shiftreg
Entitiy declaration for shiftreg.
Definition:
shiftreg.vhd:32
shiftreg.load
in loadstd_logic
Definition:
shiftreg.vhd:39
shiftreg.shr_behav_arch.reg_state
std_logic_vector( reg_width- 1 downto 0) reg_state
Definition:
shiftreg.vhd:54
shiftreg.reset
in resetstd_logic
Definition:
shiftreg.vhd:38
shiftreg.sout
out soutstd_logic
Definition:
shiftreg.vhd:41
shiftreg.reg_width
reg_widthinteger := 8
Definition:
shiftreg.vhd:35
shiftreg.do_shift
in do_shiftstd_logic
Definition:
shiftreg.vhd:39
shiftreg.pin
in pinstd_logic_vector( reg_width- 1 downto 0)
Definition:
shiftreg.vhd:42
serial_adder.ieee
_library_ ieeeieee
Definition:
serial_adder.vhd:16
shiftreg.pout
out poutstd_logic_vector( reg_width- 1 downto 0)
Definition:
shiftreg.vhd:44
shiftreg.sin
in sinstd_logic
Definition:
shiftreg.vhd:40
Generated by
1.8.12