Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
118 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This doesnt really work, but I want to figure out how to do it | ||
# so putting these helpers here. | ||
vsim: | ||
vlog bench/dacspi_tb.v | ||
vlog rtl/dacspi.v | ||
vsim -c -do "run; quit" dacspi_tb | ||
|
||
vlib: work | ||
vlib work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module dacspi_tb(); | ||
|
||
reg rst_n, clk; | ||
reg [15:0] wr_data; | ||
reg wr; | ||
wire spi_cs_n, spi_sclk, spi_sdout; | ||
|
||
initial | ||
begin | ||
rst_n = 1; | ||
clk = 0; | ||
wr_data = 16'b1010_0110_1100_1101; | ||
wr = 0; | ||
end | ||
|
||
always | ||
#1 clk <= ~clk; | ||
|
||
initial | ||
begin | ||
#4 rst_n = 0; | ||
#4 rst_n = 1; | ||
|
||
#4 wr = 1; | ||
#4 wr = 0; | ||
|
||
#16 if (spi_sdout != 1) | ||
begin | ||
$display("Expected spi_sdout to be high after 16 cycles"); | ||
$finish(1); | ||
end | ||
|
||
end | ||
|
||
dacspi dacspi ( | ||
.wr_data(wr_data), | ||
.wr(wr), | ||
|
||
.spi_cs_n(spi_cs_n), | ||
.spi_sclk(spi_sclk), | ||
.spi_sdout(spi_sdout), | ||
|
||
.clk(clk), | ||
.rst_n(rst_n) | ||
); | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters