Skip to content

Commit 78e2827

Browse files
committed
Upd tb and create Makefile for docker
1 parent 21badbd commit 78e2827

17 files changed

+152
-388
lines changed

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,10 @@ sim/modelsim/*
99
sim/vivado/*
1010
!Manifest.py
1111
!xsim.tcl
12-
sim/iverilog/*
13-
!Manifest.py
14-
sim/cocotb/modelsim/*
12+
sim/cocotb/*
1513
!transceiver_tb.py
1614
!test.py
1715
!wave.do
18-
sim/cocotb/icarus/*
19-
!transceiver_tb.py
20-
!transceiver_top.v
21-
!test.py
22-
!gtkw.gtkw
2316
platform/xilinx/clk_wiz/*
2417
!clk_wiz.xci
2518
myenv

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ RUN git clone https://github.com/steveicarus/iverilog && \
2020

2121
COPY . .
2222

23-
# RUN git clone --recurse-submodules https://github.com/RDSik/verilog-transceiver.git && \
2423
RUN cd top && \
25-
iverilog -o transceiver tb/transceiver_tb.v transceiver_top.v ../modules/bpsk/bpsk_modulator.v ../modules/bpsk/bpsk_demodulator.v ../modules/bpsk/sin_generator.v ../modules/hamming/hamming_decoder.v ../modules/hamming/hamming_encoder.v ../modules/uart/UART/Verilog/source/UART_RX.v ../modules/uart/UART/Verilog/source/UART_TX.v && \
26-
vvp transceiver
27-
24+
make
25+

modules/bpsk/tb/bpsk_modulator_tb.v

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,38 @@ reg clk;
66
reg arstn;
77
reg en;
88
reg [11:0] data;
9-
reg [11:0] sine_in;
10-
reg [11:0] neg_sine_in;
9+
reg [11:0] sin_in;
10+
reg [11:0] neg_sin_in;
1111
reg [7:0] cnt_in;
1212

1313
wire [11:0] signal_out;
1414
wire [3:0] sel_cnt;
1515
wire [11:0] sel;
1616

17-
reg [11:0] sine_rom [255:0];
18-
reg [11:0] neg_sine_rom [255:0];
17+
reg [0:11] sin_rom [0:255];
18+
reg [0:11] neg_sin_rom [0:255];
1919

2020
integer i;
2121

2222
initial
2323
begin
24-
$readmemb("sine_value.dat", sine_rom);
25-
$readmemb("neg_sine_value.dat", neg_sine_rom);
24+
$readmemb("sin_value.dat", sin_rom);
25+
$readmemb("neg_sine_valu.dat", neg_sin_rom);
2626
end
2727

2828
bpsk_modulator #(
2929
.SAMPLE_NUMBER (256),
3030
.SAMPLE_WIDTH (12),
3131
.DATA_WIDTH (12)
3232
) dut (
33-
.clk (clk),
34-
.arstn (arstn),
35-
.en (en),
36-
.data (data),
37-
.sine_in (sine_in),
38-
.neg_sine_in (neg_sine_in),
39-
.cnt_in (cnt_in),
40-
.signal_out (signal_out)
33+
.clk (clk),
34+
.arstn (arstn),
35+
.en (en),
36+
.data (data),
37+
.sin_in (sin_in),
38+
.neg_sin_in (neg_sin_in),
39+
.cnt_in (cnt_in),
40+
.signal_out (signal_out)
4141
);
4242

4343
assign sel_cnt = dut.sel_cnt;
@@ -49,8 +49,8 @@ initial begin
4949
#1; arstn = 1; en = 1;
5050
for (i = 0; i <= 2500; i = i + 1) begin
5151
#2; cnt_in = i;
52-
sine_in = sine_rom[cnt_in];
53-
neg_sine_in = neg_sine_rom[cnt_in];
52+
sin_in = sin_rom[cnt_in];
53+
neg_sin_in = neg_sin_rom[cnt_in];
5454
end
5555
end
5656

modules/bpsk/tb/bpsk_top_tb.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bpsk_top #(
1919
.DATA_WIDTH (12)
2020
) dut (
2121
.clk (clk),
22-
.rst_n (arstn),
22+
.arstn (arstn),
2323
.en (en),
2424
.data (data),
2525
.q (q)

modules/bpsk/tb/sin_generator_tb.v

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
`timescale 1ps / 1ps
2+
3+
module sin_generator_tb();
4+
5+
reg clk;
6+
reg arstn;
7+
reg en;
8+
9+
wire [11:0] sin_out;
10+
wire [11:0] neg_sin_out;
11+
wire [7:0] cnt_out;
12+
13+
sin_generator #(
14+
.SAMPLE_NUMBER (256),
15+
.SAMPLE_WIDTH (12)
16+
) dut (
17+
.clk (clk),
18+
.arstn (arstn),
19+
.en (en),
20+
.sin_out (sin_out),
21+
.neg_sin_out (neg_sin_out),
22+
.cnt_out (cnt_out)
23+
);
24+
25+
initial begin
26+
clk = 0;
27+
#1; arstn = 0; en = 0;
28+
#1; arstn = 1; en = 1;
29+
end
30+
31+
always #1 clk = ~clk;
32+
33+
initial
34+
$monitor("time=%g, clk=%b, sin_out=%b, neg_sin_out=%b, cnt_out=%b", $time, clk, sin_out, neg_sin_out, cnt_out);
35+
36+
initial begin
37+
$dumpfile("out.vcd");
38+
$dumpvars(0, sin_generator_tb);
39+
#8000 $stop;
40+
end
41+
42+
endmodule

modules/bpsk/tb/sine_generator_tb.v

Lines changed: 0 additions & 42 deletions
This file was deleted.

modules/hamming/humming_coder12_8.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ module humming_coder12_8 (
1313

1414
hamming_encoder HE(
1515
.clk (clk ),
16-
.rst_n (arstn ),
16+
.arstn (arstn ),
1717
.wren (wren ),
1818
.data (data ),
1919
.hc_out (hc_out)
2020
);
2121

2222
hamming_decoder HD(
2323
.clk (clk ),
24-
.rst_n (arstn),
24+
.arstn (arstn),
2525
.rden (rden ),
2626
.q (q ),
2727
.hc_in (hc_in)

sim/cocotb/icarus/gtkw.gtkw

Lines changed: 0 additions & 45 deletions
This file was deleted.

sim/cocotb/icarus/test.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

sim/cocotb/icarus/transceiver_tb.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)