Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Uart Transmitter FPGA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamási Benjamin
Uart Transmitter FPGA
Commits
95a20cbf
Commit
95a20cbf
authored
Oct 17, 2014
by
Tamási Benjamin
Browse files
Options
Downloads
Patches
Plain Diff
Tonz of debugging
parent
9c5d64f2
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
cntr.v
+2
-2
2 additions, 2 deletions
cntr.v
data.v
+1
-1
1 addition, 1 deletion
data.v
debouncer.v
+4
-6
4 additions, 6 deletions
debouncer.v
rategen.v
+3
-5
3 additions, 5 deletions
rategen.v
uartop.v
+44
-19
44 additions, 19 deletions
uartop.v
with
54 additions
and
33 deletions
cntr.v
+
2
−
2
View file @
95a20cbf
...
...
@@ -13,7 +13,7 @@ always @ (posedge clk) begin
else
if
(
en
)
begin
if
(
par
)
begin
if
(
cntr
>=
9
)
begin
if
(
cntr
>=
10
)
begin
cntr
<=
0
;
end
else
begin
...
...
@@ -22,7 +22,7 @@ always @ (posedge clk) begin
end
else
begin
if
(
cntr
>=
8
)
begin
if
(
cntr
>=
9
)
begin
cntr
<=
0
;
end
else
begin
...
...
This diff is collapsed.
Click to expand it.
data.v
+
1
−
1
View file @
95a20cbf
...
...
@@ -20,7 +20,7 @@ module data(
end
else
if
(
en
)
begin
data
<=
{
0
,
data
[
41
:
1
]
}
;
// Shift -> LSB
data
<=
{
1'b
0
,
data
[
41
:
1
]
}
;
// Shift -> LSB
end
end
...
...
This diff is collapsed.
Click to expand it.
debouncer.v
+
4
−
6
View file @
95a20cbf
...
...
@@ -3,20 +3,18 @@ input clk, rst, din,
output
q
);
reg
in
;
reg
state
;
always
@
(
posedge
clk
)
begin
if
(
rst
)
begin
in
<=
0
;
state
<=
0
;
end
else
begin
if
(
din
)
begin
state
<=
1
;
end
else
begin
state
<=
0
;
end
in
<=
din
;
state
<=
in
;
end
end
...
...
This diff is collapsed.
Click to expand it.
rategen.v
+
3
−
5
View file @
95a20cbf
// SYSCLK is 50MHz
module
rategen
(
input
clk
,
rst
,
start
,
sw_speed
,
sw_par
,
output
iclk
,
pulse
output
iclk
);
reg
[
15
:
0
]
cntr
;
...
...
@@ -19,22 +19,20 @@ module rategen(
if
(
cntr
>=
5208
)
begin
cntr
<=
0
;
end
else
cntr
<=
cntr
+
1
;
end
else
begin
// Baud rate at 1200
if
(
cntr
>=
41666
)
begin
cntr
<=
0
;
end
else
cntr
<=
cntr
+
1
;
end
cntr
<=
cntr
+
1
;
end
end
assign
fast
=
(
cntr
>=
5208
)
?
1
:
0
;
// pulse width of clk for SYNC
assign
slow
=
(
cntr
>=
41666
)
?
1
:
0
;
// pulse width of clk for SYNC
assign
p_fast
=
(
cntr
>=
2704
)
?
1
:
0
;
// pulse width of 50%
assign
p_slow
=
(
cntr
>=
20833
)
?
1
:
0
;
// pulse width of 50%
assign
iclk
=
(
sw_speed
)
?
fast
:
slow
;
assign
pulse
=
(
sw_speed
)
?
p_fast
:
p_slow
;
endmodule
This diff is collapsed.
Click to expand it.
uartop.v
+
44
−
19
View file @
95a20cbf
...
...
@@ -10,26 +10,39 @@ module uartop(
reg
outbuf
;
reg
[
6
:
0
]
datacntr
;
reg
main_en
;
wire
iclk
;
// Internal CLK for correct Baud Rate
wire
starten
;
// Main enabler
wire
[
3
:
0
]
count
;
wire
mpx
en
;
wire
shift
en
;
wire
dout
;
wire
pulse
;
wire
parity
;
wire
w_parity
;
wire
uart_data
;
wire
[
15
:
0
]
uart_mpx
;
wire
wordend
;
wire
[
6
:
0
]
data_count
;
wire
eot
;
// End of transmit
wire
dbnc
;
assign
uart_mpx
[
15
]
=
0
;
// Start bit
assign
uart_mpx
[
14
:
8
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
7
]
=
(
sw7
)
?
parity
:
1
;
// Parity or stop bit
assign
uart_mpx
[
6
:
0
]
=
1
;
// Stop bits
assign
uart_mpx
[
0
]
=
0
;
// Start bit
assign
uart_mpx
[
1
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
2
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
3
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
4
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
5
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
6
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
7
]
=
dout
;
// UART DATA 7bit
assign
uart_mpx
[
8
]
=
(
sw7
)
?
w_parity
:
1
;
// Parity or stop bit
assign
uart_mpx
[
9
]
=
1
;
// Stop bits
assign
uart_mpx
[
10
]
=
1
;
// Stop bits
assign
uart_mpx
[
11
]
=
1
;
// Stop bits
assign
uart_mpx
[
12
]
=
1
;
// Stop bits
assign
uart_mpx
[
13
]
=
1
;
// Stop bits
assign
uart_mpx
[
14
]
=
1
;
// Stop bits
assign
uart_mpx
[
15
]
=
1
;
// Stop bits
assign
mpx
en
=
(
count
==
0
||
(
count
>=
8
&&
count
<=
10
));
assign
shift
en
=
!
(
count
==
0
||
(
count
>=
8
&&
count
<=
10
));
rategen
rategen
(
.
clk
(
clk
),
...
...
@@ -37,15 +50,14 @@ module uartop(
.
start
(
btn1
),
.
sw_speed
(
sw6
),
.
sw_par
(
sw7
),
.
iclk
(
iclk
),
.
pulse
(
pulse
)
.
iclk
(
iclk
)
);
debouncer
debouncer
(
.
clk
(
clk
),
.
rst
(
rst
),
.
din
(
btn1
||
eot
),
.
q
(
starten
)
.
q
(
dbnc
)
);
cntr
cntr
(
...
...
@@ -59,7 +71,7 @@ module uartop(
data
data
(
.
clk
(
clk
),
.
rst
(
rst
),
.
en
(
mpx
en
&&
iclk
&&
starten
),
.
en
(
shift
en
&&
iclk
&&
starten
),
.
q
(
dout
)
);
...
...
@@ -69,7 +81,7 @@ module uartop(
.
din
(
dout
),
.
en
(
iclk
),
.
par
(
1
),
// Odd Parity
.
q
(
parity
)
.
q
(
w_
parity
)
);
udata
udata
(
...
...
@@ -83,19 +95,32 @@ module uartop(
always
@
(
posedge
clk
)
begin
if
(
rst
)
begin
outbuf
<=
0
;
outbuf
<=
1
;
datacntr
<=
0
;
main_en
<=
0
;
end
else
if
(
datacntr
==
41
&&
mpxen
)
begin
else
begin
if
(
dbnc
)
main_en
<=
~
main_en
;
// T FF
if
(
datacntr
==
41
&&
shiften
&&
iclk
)
begin
datacntr
<=
0
;
end
else
if
(
mpxen
)
begin
else
if
(
shiften
&&
iclk
)
begin
datacntr
<=
datacntr
+
1
;
end
end
if
(
starten
&&
iclk
)
begin
outbuf
<=
uart_data
;
end
end
assign
data_count
=
datacntr
;
assign
wordend
=
(
data_count
%
6
==
0
);
assign
wordend
=
(
(
data_count
%
6
)
==
0
);
assign
eot
=
(
data_count
==
42
);
assign
starten
=
main_en
;
assign
txd
=
outbuf
;
assign
rts
=
starten
;
endmodule
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