blob: 2f1caa47b470c3daee55514fa22fd8a4bdf01d63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
Introduction
============
A heartbeat generator can be used in a digital system to ...
Features
========
Normal rhythm produces four entities – a P wave, a QRS complex, a T wave, and a U wave – that each
have a fairly unique pattern. [[1]](https://en.wikipedia.org/wiki/Electrocardiography)
For simplicity the existing heartbeat module generates the QRS complex and T wave only.
* Models QRS-Complex and T-Wave
* Average time values based on 72 bpm
* Enable input for external prescaler
General Description
===================
{width=40%}
| **Name** | **Type** | **Direction** | **Polarity** | **Description** |
|-------------|-------------------|:-------------:|:------------:|-----------------|
| clk_i | std_ulogic | IN | HIGH | clock |
: Heartbeat Generator - Description of I/O Signals
Functional Description
======================
The shape of an [electrogardiogramm](https://en.wikipedia.org/wiki/Electrocardiography) as a voltage graph over time
{width=20%}
The important QRS complex and T wave are modelled as digital pulses.
{width=80%}
Design Description
==================
A conceptional RTL diagram is shown below.
{width=60%}
The simulation result shows two full periods based on a clock period of 1 ms
{width=80%}
In more detail using cursors to display correct parameters of the QRS complex and T wave.
{width=80%}
Device Utilization and Performance
==================================
The following table shows the utilisation of both modules heartbeat_gen and cntdnmodm.
The following results are extracted from
```pure
pnr/de1_heartbeat_gen/de1_heartbeat_gen.fit.rpt
```
```pure
+--------------------------------------------------------------------------------------+
; Fitter Summary ;
+------------------------------------+-------------------------------------------------+
```
The following results are extracted from
```pure
de1_heartbeat_gen.sta.rpt
```
```pure
+----------------------------------------------------------------------------------------+
; TimeQuest Timing Analyzer Summary ;
+--------------------+-------------------------------------------------------------------+
-----------------------------------------+
; Clocks ;
+------------+------+--------+-----------+
+-----------------------------------------------------------------------------+
; Multicorner Timing Analysis Summary ;
+------------------+-------+-------+----------+---------+---------------------+
```
Application Note
================
The following test environment on a DE1 prototype board uses a system clock frequency of 50 MHz.
A prescaler is parameterised to generate an output signal with a period of 1 ms.
{width=70%}
Appendix
========
References
----------
* [Wiki: Electrocardiography](https://en.wikipedia.org/wiki/Electrocardiography)
Project Hierarchy
-----------------
### Module Hierarchy for Verification
```pure
t_heartbeat_gen(tbench)
heartbeat_gen(rtl)
```
### Prototype Environment
```pure
de1_heartbeat_gen(structure)
heartbeat_gen(rtl)
cntdnmodm(rtl)
```
VHDL Sources
------------
```vhdl
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY heartbeat_gen IS
PORT (clk_i : IN std_ulogic;
rst_ni : IN std_ulogic;
en_pi : IN std_ulogic;
count_o : OUT std_ulogic_vector;
heartbeat_o : OUT std_ulogic
);
END heartbeat_gen;
```
```vhdl
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
ARCHITECTURE rtl OF heartbeat_gen IS
CONSTANT n : natural := 10;
CONSTANT zero : unsigned(n-1 DOWNTO 0) := (OTHERS => '0');
CONSTANT heartbeat_period : unsigned(n-1 DOWNTO 0) := to_unsigned(833, n);
CONSTANT qrs_width : unsigned(n-1 DOWNTO 0) := to_unsigned(100, n);
CONSTANT st_width
CONSTANT t_width
CONSTANT qt_width
SIGNAL next_state, current_state : unsigned(n-1 DOWNTO 0);
SIGNAL tc_qrs : std_ulogic; -- qrs interval
SIGNAL tc_t : std_ulogic; -- T wave
BEGIN
next_state_logic :
state_register :
-- output_logic
t_wave : tc_t <=
qrs_complex : tc_qrs <=
output_value : heartbeat_o <=
END rtl;
```
Revision History
----------------
| **Date** | **Version** | **Change Summary** |
|:----------|:-------------|:--------------------|
| May 2020 | 0.1 | Initial Release |
| April 2021 | 0.2 | Added parameterisation |
|