Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
conv-common-gw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
level-conversion
conv-common-gw
Commits
3833a065
Commit
3833a065
authored
Dec 07, 2016
by
Denia Bouhired-Ferrag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Counter specific to one-wire registers functionality
parent
cce8e778
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
wf_decr_counter.vhd
modules/wf_decr_counter.vhd
+78
-0
No files found.
modules/wf_decr_counter.vhd
0 → 100644
View file @
3833a065
library
ieee
;
use
ieee
.
std_logic_1164
.
all
;
use
ieee
.
numeric_std
.
all
;
use
work
.
gencores_pkg
.
all
;
use
work
.
wishbone_pkg
.
all
;
use
work
.
conv_common_gw_pkg
.
all
;
entity
wf_decr_counter
is
generic
(
g_counter_lgth
:
natural
:
=
4
);
-- default length
port
(
-- INPUTS
-- nanoFIP User Interface general signal
uclk_i
:
in
std_logic
;
-- 40 MHz clock
-- Signal from the wf_reset_unit
counter_rst_i
:
in
std_logic
;
-- resets counter to all '1'
-- Signals from any unit
counter_decr_i
:
in
std_logic
;
-- decrement enable
counter_load_i
:
in
std_logic
;
-- load enable; loads counter to counter_top_i
counter_top_i
:
in
unsigned
(
g_counter_lgth
-1
downto
0
);
-- load value
-- OUTPUTS
-- Signal to any unit
counter_o
:
out
unsigned
(
g_counter_lgth
-1
downto
0
);
-- counter
counter_is_zero_o
:
out
std_logic
);
-- empty counter indication
end
entity
wf_decr_counter
;
--=================================================================================================
-- architecture declaration
--=================================================================================================
architecture
rtl
of
wf_decr_counter
is
signal
s_counter
:
unsigned
(
g_counter_lgth
-1
downto
0
);
--=================================================================================================
-- architecture begin
--=================================================================================================
begin
---------------------------------------------------------------------------------------------------
-- Synchronous process Decr_Counter
Decr_Counter
:
process
(
uclk_i
)
begin
if
rising_edge
(
uclk_i
)
then
if
counter_rst_i
=
'1'
then
s_counter
<=
(
others
=>
'1'
);
else
if
counter_load_i
=
'1'
then
s_counter
<=
counter_top_i
;
elsif
counter_decr_i
=
'1'
then
s_counter
<=
s_counter
-
1
;
end
if
;
end
if
;
end
if
;
end
process
;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
counter_o
<=
s_counter
;
counter_is_zero_o
<=
'1'
when
s_counter
=
to_unsigned
(
0
,
s_counter
'length
)
else
'0'
;
end
architecture
;
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