Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HACM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ETTI
DCAE
ARH
Research
HACM
Commits
d3c2e575
Commit
d3c2e575
authored
10 years ago
by
Lucian Petrică
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of zeus.arh.pub.ro:research/vasile
parents
101b41b5
e40fa90f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
rtl/hacm.vhd
+99
-0
99 additions, 0 deletions
rtl/hacm.vhd
rtl/hacm_control.vhd
+24
-9
24 additions, 9 deletions
rtl/hacm_control.vhd
rtl/hacm_core.vhd
+6
-6
6 additions, 6 deletions
rtl/hacm_core.vhd
sim/hacm_tb.vhd
+143
-0
143 additions, 0 deletions
sim/hacm_tb.vhd
with
272 additions
and
15 deletions
rtl/hacm.vhd
0 → 100644
+
99
−
0
View file @
d3c2e575
library
IEEE
;
use
IEEE
.
STD_LOGIC_1164
.
ALL
;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity
hacm
is
port
(
clk_i
:
in
std_logic
;
rst_i
:
in
std_logic
;
--the following inputs are synchronous to clk_o
f_or_s_i
:
in
std_logic
;
ts_i
:
in
std_logic_vector
(
7
downto
0
);
tf_i
:
in
std_logic_vector
(
7
downto
0
);
to_i
:
in
std_logic_vector
(
7
downto
0
);
tsw_i
:
in
std_logic_vector
(
7
downto
0
);
lock_o
:
out
std_logic
;
clk_o
:
out
std_logic
);
end
hacm
;
architecture
Behavioral
of
hacm
is
component
hacm_control
port
(
clk_i
:
in
std_logic
;
rst_i
:
in
std_logic
;
f_or_s_i
:
in
std_logic
;
ts_i
:
in
std_logic_vector
(
7
downto
0
);
tf_i
:
in
std_logic_vector
(
7
downto
0
);
to_i
:
in
std_logic_vector
(
7
downto
0
);
tsw_i
:
in
std_logic_vector
(
7
downto
0
);
mode_o
:
out
std_logic
;
stretch_o
:
out
std_logic_vector
(
1
downto
0
);
sel_o
:
out
std_logic
);
end
component
;
component
hacm_core
port
(
clk_i
:
in
std_logic
;
mode_i
:
in
std_logic
;
--0=CS; 1=CM
stretch_i
:
in
std_logic_vector
(
1
downto
0
);
sel_i
:
in
std_logic
;
--0=PC; 1=CO
lock_o
:
out
std_logic
;
clk_o
:
out
std_logic
);
end
component
;
signal
hacm_mode
:
std_logic
;
signal
hacm_stretch
:
std_logic_vector
(
1
downto
0
);
signal
hacm_sel
:
std_logic
;
signal
clk_internal
:
std_logic
;
begin
control
:
hacm_control
port
map
(
clk_i
=>
clk_internal
,
rst_i
=>
rst_i
,
f_or_s_i
=>
f_or_s_i
,
ts_i
=>
ts_i
,
tf_i
=>
tf_i
,
to_i
=>
to_i
,
tsw_i
=>
tsw_i
,
mode_o
=>
hacm_mode
,
stretch_o
=>
hacm_stretch
,
sel_o
=>
hacm_sel
);
core
:
hacm_core
port
map
(
clk_i
=>
clk_i
,
mode_i
=>
hacm_mode
,
stretch_i
=>
hacm_stretch
,
sel_i
=>
hacm_sel
,
lock_o
=>
lock_o
,
clk_o
=>
clk_internal
);
clk_o
<=
clk_internal
;
end
Behavioral
;
This diff is collapsed.
Click to expand it.
rtl/hacm_control.vhd
+
24
−
9
View file @
d3c2e575
...
@@ -14,17 +14,20 @@ library unisim;
...
@@ -14,17 +14,20 @@ library unisim;
use
unisim
.
vcomponents
.
all
;
use
unisim
.
vcomponents
.
all
;
-- ENTITY ---------------------------------------------------------------------
-- ENTITY ---------------------------------------------------------------------
-- the HACM control unit receives timing and instruction info and
-- decides which ACM strategy to utilize (stretching or multiplexing)
entity
hacm_control
is
entity
hacm_control
is
port
port
(
(
clk_i
:
in
std_logic
;
clk_i
:
in
std_logic
;
rst_i
:
in
std_logic
;
rst_i
:
in
std_logic
;
f_or_s_i
:
in
std_logic
;
--fixed-point, 5.3 format, value in nanoseconds
ts_i
:
in
std_logic_vector
(
7
downto
0
);
f_or_s_i
:
in
std_logic
;
--indicates fast or slow instructions (1=slow, 0=fast)
tf_i
:
in
std_logic_vector
(
7
downto
0
);
ts_i
:
in
std_logic_vector
(
7
downto
0
);
--period of slow clock (desired)
to_i
:
in
std_logic_vector
(
7
downto
0
);
tf_i
:
in
std_logic_vector
(
7
downto
0
);
--period of fast clock
tsw_i
:
in
std_logic_vector
(
7
downto
0
);
to_i
:
in
std_logic_vector
(
7
downto
0
);
--period of slow clock (attainable)
tsw_i
:
in
std_logic_vector
(
7
downto
0
);
--duration of a clock switch
mode_o
:
out
std_logic
;
mode_o
:
out
std_logic
;
stretch_o
:
out
std_logic_vector
(
1
downto
0
);
stretch_o
:
out
std_logic_vector
(
1
downto
0
);
...
@@ -55,12 +58,25 @@ architecture rtl of hacm_control is
...
@@ -55,12 +58,25 @@ architecture rtl of hacm_control is
begin
begin
--f_or_s shift register
process
(
clk_i
)
begin
if
(
clk_i
'event
and
clk_i
=
'1'
)
then
sh_reg_s
(
99
downto
1
)
<=
sh_reg_s
(
98
downto
0
);
if
(
rst_i
=
'1'
)
then
sh_reg_s
(
0
)
<=
'0'
;
else
sh_reg_s
(
0
)
<=
f_or_s_i
;
end
if
;
end
if
;
end
process
;
--CM/CS Decision
--CM/CS Decision
process
(
clk_i
)
process
(
clk_i
)
begin
begin
if
(
clk_i
'event
and
clk_i
=
'1'
)
then
if
(
clk_i
'event
and
clk_i
=
'1'
)
then
if
(
rst_i
=
'1'
)
then
if
(
rst_i
=
'1'
)
then
--sh_reg_s <= (others => '0');
nsi_reg_s
<=
(
others
=>
'0'
);
nsi_reg_s
<=
(
others
=>
'0'
);
nfi_reg_s
<=
"1100011"
;
nfi_reg_s
<=
"1100011"
;
ncs_reg_s
<=
(
others
=>
'0'
);
ncs_reg_s
<=
(
others
=>
'0'
);
...
@@ -75,7 +91,6 @@ begin
...
@@ -75,7 +91,6 @@ begin
tcs
<=
(
others
=>
'0'
);
tcs
<=
(
others
=>
'0'
);
mode_reg_s
<=
'0'
;
mode_reg_s
<=
'0'
;
else
else
sh_reg_s
<=
sh_reg_s
(
98
downto
0
)
&
f_or_s_i
;
nsi_reg_s
<=
nsi_reg_s
+
(
f_or_s_i
&
nand_reduce
(
nsi_reg_s
))
-
(
sh_reg_s
(
99
)
&
or_reduce
(
nsi_reg_s
));
nsi_reg_s
<=
nsi_reg_s
+
(
f_or_s_i
&
nand_reduce
(
nsi_reg_s
))
-
(
sh_reg_s
(
99
)
&
or_reduce
(
nsi_reg_s
));
nfi_reg_s
<=
nfi_reg_s
+
(
not
(
f_or_s_i
)
&
nand_reduce
(
nfi_reg_s
))
-
(
not
(
sh_reg_s
(
99
))
&
or_reduce
(
nfi_reg_s
));
nfi_reg_s
<=
nfi_reg_s
+
(
not
(
f_or_s_i
)
&
nand_reduce
(
nfi_reg_s
))
-
(
not
(
sh_reg_s
(
99
))
&
or_reduce
(
nfi_reg_s
));
ncs_reg_s
<=
ncs_reg_s
+
(
f_or_s_i
xor
sh_reg_s
(
0
))
-
(
sh_reg_s
(
99
)
xor
sh_reg_s
(
98
));
ncs_reg_s
<=
ncs_reg_s
+
(
f_or_s_i
xor
sh_reg_s
(
0
))
-
(
sh_reg_s
(
99
)
xor
sh_reg_s
(
98
));
...
@@ -96,8 +111,8 @@ begin
...
@@ -96,8 +111,8 @@ begin
mode_o
<=
mode_reg_s
;
mode_o
<=
mode_reg_s
;
--CS/CM MUX CTRL
--CS/CM MUX CTRL
stretch_o
<=
"01"
;
stretch_o
<=
"01"
when
f_or_s_i
=
'1'
else
"00"
;
sel_o
<=
'0'
;
sel_o
<=
f_or_s_i
;
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
end
rtl
;
end
rtl
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
rtl/hacm_core.vhd
+
6
−
6
View file @
d3c2e575
...
@@ -133,26 +133,26 @@ begin
...
@@ -133,26 +133,26 @@ begin
COMPENSATION
=>
"ZHOLD"
,
COMPENSATION
=>
"ZHOLD"
,
STARTUP_WAIT
=>
FALSE
,
STARTUP_WAIT
=>
FALSE
,
DIVCLK_DIVIDE
=>
1
,
DIVCLK_DIVIDE
=>
1
,
CLKFBOUT_MULT_F
=>
1
1
.
000
,
CLKFBOUT_MULT_F
=>
1
0
.
000
,
CLKFBOUT_PHASE
=>
0
.
000
,
CLKFBOUT_PHASE
=>
0
.
000
,
CLKFBOUT_USE_FINE_PS
=>
FALSE
,
CLKFBOUT_USE_FINE_PS
=>
FALSE
,
CLKOUT0_DIVIDE_F
=>
1
1
.
000
,
CLKOUT0_DIVIDE_F
=>
1
0
.
000
,
CLKOUT0_PHASE
=>
0
.
000
,
CLKOUT0_PHASE
=>
0
.
000
,
CLKOUT0_DUTY_CYCLE
=>
0
.
500
,
CLKOUT0_DUTY_CYCLE
=>
0
.
500
,
CLKOUT0_USE_FINE_PS
=>
FALSE
,
CLKOUT0_USE_FINE_PS
=>
FALSE
,
CLKOUT1_DIVIDE
=>
1
1
,
CLKOUT1_DIVIDE
=>
1
0
,
CLKOUT1_PHASE
=>
90
.
000
,
CLKOUT1_PHASE
=>
90
.
000
,
CLKOUT1_DUTY_CYCLE
=>
0
.
500
,
CLKOUT1_DUTY_CYCLE
=>
0
.
500
,
CLKOUT1_USE_FINE_PS
=>
FALSE
,
CLKOUT1_USE_FINE_PS
=>
FALSE
,
CLKOUT2_DIVIDE
=>
1
1
,
CLKOUT2_DIVIDE
=>
1
0
,
CLKOUT2_PHASE
=>
180
.
000
,
CLKOUT2_PHASE
=>
180
.
000
,
CLKOUT2_DUTY_CYCLE
=>
0
.
500
,
CLKOUT2_DUTY_CYCLE
=>
0
.
500
,
CLKOUT2_USE_FINE_PS
=>
FALSE
,
CLKOUT2_USE_FINE_PS
=>
FALSE
,
CLKOUT3_DIVIDE
=>
1
1
,
CLKOUT3_DIVIDE
=>
1
0
,
CLKOUT3_PHASE
=>
270
.
000
,
CLKOUT3_PHASE
=>
270
.
000
,
CLKOUT3_DUTY_CYCLE
=>
0
.
500
,
CLKOUT3_DUTY_CYCLE
=>
0
.
500
,
CLKOUT3_USE_FINE_PS
=>
FALSE
,
CLKOUT3_USE_FINE_PS
=>
FALSE
,
CLKOUT4_DIVIDE
=>
1
0
,
CLKOUT4_DIVIDE
=>
1
1
,
CLKOUT4_PHASE
=>
0
.
000
,
CLKOUT4_PHASE
=>
0
.
000
,
CLKOUT4_DUTY_CYCLE
=>
0
.
500
,
CLKOUT4_DUTY_CYCLE
=>
0
.
500
,
CLKOUT4_USE_FINE_PS
=>
FALSE
,
CLKOUT4_USE_FINE_PS
=>
FALSE
,
...
...
This diff is collapsed.
Click to expand it.
sim/hacm_tb.vhd
0 → 100644
+
143
−
0
View file @
d3c2e575
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 15:56:40 03/02/2015
-- Design Name:
-- Module Name: /home/lpetrica/Documents/git/vasile/rtl/hacm/hacm_tb.vhd
-- Project Name: hacm
-- Target Device:
-- Tool versions:
-- Description:
--
-- VHDL Test Bench Created by ISE for module: hacm
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
-- Notes:
-- This testbench has been automatically generated using types std_logic and
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
-- that these types always be used for the top-level I/O of a design in order
-- to guarantee that the testbench will bind correctly to the post-implementation
-- simulation model.
--------------------------------------------------------------------------------
LIBRARY
ieee
;
USE
ieee
.
std_logic_1164
.
ALL
;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--USE ieee.numeric_std.ALL;
ENTITY
hacm_tb
IS
END
hacm_tb
;
ARCHITECTURE
behavior
OF
hacm_tb
IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT
hacm
PORT
(
clk_i
:
IN
std_logic
;
rst_i
:
IN
std_logic
;
f_or_s_i
:
IN
std_logic
;
ts_i
:
IN
std_logic_vector
(
7
downto
0
);
tf_i
:
IN
std_logic_vector
(
7
downto
0
);
to_i
:
IN
std_logic_vector
(
7
downto
0
);
tsw_i
:
IN
std_logic_vector
(
7
downto
0
);
lock_o
:
OUT
std_logic
;
clk_o
:
OUT
std_logic
);
END
COMPONENT
;
--Inputs
signal
clk_i
:
std_logic
:
=
'0'
;
signal
rst_i
:
std_logic
:
=
'1'
;
signal
f_or_s_i
:
std_logic
:
=
'0'
;
signal
ts_i
:
std_logic_vector
(
7
downto
0
)
:
=
"01011000"
;
--11.0ns
signal
tf_i
:
std_logic_vector
(
7
downto
0
)
:
=
"01010000"
;
--10.0ns
signal
to_i
:
std_logic_vector
(
7
downto
0
)
:
=
"01100100"
;
--12.5ns
signal
tsw_i
:
std_logic_vector
(
7
downto
0
)
:
=
"01110000"
;
--14.0ns
signal
alternate_period
:
integer
:
=
10
;
signal
alternate_counter
:
integer
:
=
0
;
--Outputs
signal
lock_o
:
std_logic
;
signal
clk_o
:
std_logic
;
-- Clock period definitions
constant
clk_i_period
:
time
:
=
10
ns
;
constant
clk_o_period
:
time
:
=
10
ns
;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut
:
hacm
PORT
MAP
(
clk_i
=>
clk_i
,
rst_i
=>
rst_i
,
f_or_s_i
=>
f_or_s_i
,
ts_i
=>
ts_i
,
tf_i
=>
tf_i
,
to_i
=>
to_i
,
tsw_i
=>
tsw_i
,
lock_o
=>
lock_o
,
clk_o
=>
clk_o
);
-- Clock process definitions
clk_i_process
:
process
begin
clk_i
<=
'0'
;
wait
for
clk_i_period
/
2
;
clk_i
<=
'1'
;
wait
for
clk_i_period
/
2
;
end
process
;
process
(
clk_o
)
begin
if
(
clk_o
'event
and
clk_o
=
'1'
)
then
if
(
alternate_counter
=
alternate_period
)
then
f_or_s_i
<=
'1'
;
alternate_counter
<=
0
;
else
f_or_s_i
<=
'0'
;
alternate_counter
<=
alternate_counter
+
1
;
end
if
;
end
if
;
end
process
;
-- Stimulus process
stim_proc
:
process
begin
-- hold reset state until after MMCM locks.
wait
until
lock_o
=
'1'
;
wait
for
clk_i_period
*
200
;
rst_i
<=
'0'
;
-- insert stimulus here
wait
for
20
us
;
alternate_period
<=
9
;
wait
for
20
us
;
alternate_period
<=
8
;
wait
for
20
us
;
alternate_period
<=
7
;
wait
for
20
us
;
alternate_period
<=
6
;
wait
for
20
us
;
alternate_period
<=
5
;
wait
for
20
us
;
alternate_period
<=
4
;
wait
for
20
us
;
alternate_period
<=
3
;
wait
for
20
us
;
alternate_period
<=
2
;
wait
for
20
us
;
alternate_period
<=
1
;
wait
;
end
process
;
END
;
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