1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00

DV cleanup

-removing all redundant build files, there must be only one...
This commit is contained in:
Andreas Olofsson 2016-03-08 21:23:02 -05:00
parent 2ef626b91a
commit d9f18e7b58
24 changed files with 31 additions and 546 deletions

View File

@ -41,10 +41,27 @@
```sh
./build.sh gpio/dv/dut_gpio.v # compile gpio testbench (example)
./sim.sh gpio/dv/tests/test_regs.emf # run a simulation with "test_regs.emf"
./sim.sh gpio/dv/tests/test_basic.emf # run a simulation with "test_regs.emf"
./view.sh # open the waveform with gtkwave
```
**Short-cut:**
* Builds $name/dv/dut_$name.v
* Runs test $name/dv/tests/test_basic.emf
```sh
./run.sh accelerator
./run.sh elink
./run.sh emailbox
./run.sh emmu
./run.sh gpio
./run.sh spi
./run.sh pic
```
## LICENSE
The OH! repository source code is licensed under the MIT license unless otherwise specified. See [LICENSE](LICENSE) for MIT copyright terms. Design specific licenses can be found in the folder root (eg: aes/LICENSE)

View File

@ -1,13 +0,0 @@
#!/bin/bash
dut="axi_accelerator"
top="../../common/dv/dv_top.v"
iverilog -g2005 -DTARGET_SIM=1 -DTARGET_XILINX=1 $top dut_${dut}.v -f ../../common/dv/libs.cmd -o ${dut}.vvp $1
#-Wtimescale
#PUT TARGET_SIM
#-pfileline=1
#-Wall

View File

@ -1,9 +1,9 @@
`include "elink_regmap.v"
//`include "elink_regmap.v"
module dut(/*AUTOARG*/
// Outputs
dut_active, wait_out, access_out, packet_out,
dut_active, clkout, wait_out, access_out, packet_out,
// Inputs
clk, nreset, vdd, vss, access_in, packet_in, wait_in
clk1, clk2, nreset, vdd, vss, access_in, packet_in, wait_in
);
//##########################################################################
@ -18,11 +18,13 @@ module dut(/*AUTOARG*/
parameter N = 1;
//clock,reset
input clk;
input clk1;
input clk2;
input nreset;
input [N*N-1:0] vdd;
input vss;
output dut_active;
output clkout;
//Stimulus Driven Transaction
input [N-1:0] access_in;
@ -127,13 +129,16 @@ module dut(/*AUTOARG*/
wire s_axi_wvalid; // From emaxi of emaxi.v
// End of automatics
assign clkout = clk1;
assign dut_active = 1'b1;
//######################################################################
//ACCELERATOR
//######################################################################
axi_accelerator
axi_accelerator (.sys_nreset (nreset),
.sys_clk (clk),
.sys_clk (clk1),
.m_axi_aresetn (nreset),
.s_axi_aresetn (nreset),
.s_axi_wstrb (s_axi_wstrb[7:4] | s_axi_wstrb[3:0]),
@ -231,7 +236,7 @@ module dut(/*AUTOARG*/
*/
emaxi #(.M_IDW(M_IDW))
emaxi (.m_axi_aclk (clk),
emaxi (.m_axi_aclk (clk1),
.m_axi_aresetn (nreset),
.m_axi_rdata ({s_axi_rdata[31:0],s_axi_rdata[31:0]}),
.rr_wait (wait_in),
@ -286,7 +291,7 @@ module dut(/*AUTOARG*/
assign dut_active = 1'b1;
//Tie off master output for now
@ -294,7 +299,7 @@ module dut(/*AUTOARG*/
);
*/
axislave_stub m_stub (.s_axi_aclk (clk),
axislave_stub m_stub (.s_axi_aclk (clk1),
.s_axi_aresetn (nreset),
/*AUTOINST*/
// Outputs

View File

@ -1,7 +0,0 @@
#!/bin/bash
if [ -e "test_0.emf" ]
then
rm test_0.emf
fi
cp $1 test_0.emf
./axi_accelerator.vvp

View File

@ -1,5 +0,0 @@
DEADBEEF_00000001_810f0000_05_0010 //INPUT A
DEADBEEF_00000002_810f0004_05_0010 //INPUT B
00000000_DEADBEEF_810f0008_04_0010 //READ OUTPUT

View File

@ -1,27 +0,0 @@
#!/bin/bash
############################################################################
# Icarus Verilog build script for OH!
# Requires $OH_HOME variable to be set
############################################################################
DUT=$1
#Create directory of all links
mkdir -p $OH_HOME/symlinks/hdl
mkdir -p $OH_HOME/symlinks/dv
pushd $OH_HOME/symlinks/hdl
ln -s ../../*/hdl/*.v .
cd ../dv
ln -s ../../*/dv/*.v .
popd
exit
#Build
iverilog -g2005\
-DTARGET_SIM=1\
$DUT\
$OH_HOME/symlinks/dv/dv_top.v\
-y .\
-y $OH_HOME/symlinks/hdl\
-y $OH_HOME/symlinks/dv\
-I $OH_HOME/symlinks/hdl
-o dut.bin\

View File

@ -1,13 +0,0 @@
#!/bin/bash
# Compiles all dut*.v files in this directory
DV=../../common/dv/dv_top.v
LIBS=$OH_HOME/common/dv/libs.cmd
CFG="cfg_random.v"
for file in dut*.v
do
root=${file%%.*}
iverilog -g2005 -DTARGET_SIM=1 $CFG $file $DV -f $LIBS -o $root.bin
done

View File

@ -1,119 +0,0 @@
//`timescale 1 ns / 100 ps
module dv_embox();
parameter DW = 32;
//Stimulus to drive
reg clk;
reg reset;
reg mi_access;
reg [19:0] mi_addr;
reg [31:0] mi_data_in;
reg mi_write;
reg [1:0] test_state;
reg go;
//Reset
initial
begin
$display($time, " << Starting the Simulation >>");
#0
clk = 1'b0; // at time 0
reset = 1'b1; // reset is active
mi_write = 1'b0;
mi_access = 1'b0;
mi_addr[19:0] = 20'hf0368;
mi_data_in[31:0] = 32'h0;
test_state[1:0] = 2'b00;
go = 1'b0;
#100
reset = 1'b0; // at time 100 release reset
#100
go = 1'b1;
#10000
$finish;
end
//Clock
always
#10 clk = ~clk;
//Pattern generator
//1.) Write in 8 transactions (split into low and high)
//2.) Read back 8 transactions (split into low and high)
always @ (negedge clk)
if(go)
begin
case(test_state[1:0])
2'b00://write
if(~done)
begin
mi_access <= 1'b1;
mi_write <= 1'b1;
mi_addr[19:0] <= mi_addr[19:0] ^ 20'hc;
mi_data_in[31:0] <= mi_data_in[31:0]+1'b1;
end
else
begin
test_state <= 2'b01;
mi_addr[19:0] <= 20'hf0368;
mi_data_in[31:0] <= 32'h0;
end
2'b01://read
if(~done)
begin
mi_write <= 1'b0;
mi_access <= 1'b1;
mi_addr[19:0] <= mi_addr[19:0] ^ 20'hc;
mi_data_in[31:0] <= mi_data_in[31:0]+1'b1;
end
else
begin
test_state <= 2'b10;
mi_write <= 1'b0;
mi_access <= 1'b0;
end
endcase // case (test_state[1:0])
end
wire done = (mi_data_in[19:0]==20'h8);
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire embox_empty; // From embox of embox.v
wire embox_full; // From embox of embox.v
wire [DW-1:0] mi_data_out; // From embox of embox.v
// End of automatics
//DUT
embox embox(
/*AUTOINST*/
// Outputs
.mi_data_out (mi_data_out[DW-1:0]),
.embox_full (embox_full),
.embox_empty (embox_empty),
// Inputs
.reset (reset),
.clk (clk),
.mi_access (mi_access),
.mi_write (mi_write),
.mi_addr (mi_addr[19:0]),
.mi_data_in (mi_data_in[DW-1:0]));
//Waveform dump
initial
begin
$dumpfile("test.vcd");
$dumpvars(0, dv_embox);
end
endmodule // dv_embox
// Local Variables:
// verilog-library-directories:("." "../hdl" "../../memory/hdl ")
// End:

View File

@ -1,10 +0,0 @@
#!/bin/bash
#Compiling sim
iverilog -y ../../fifos/hdl/ \
-y ../../common/hdl \
-y ../../memory/hdl \
-y ../hdl \
dv_embox.v
#Running sim
./a.out

View File

@ -1,149 +0,0 @@
//`timescale 1 ns / 100 ps
module dv_emmu
(input clk,
input reset,
input go);
parameter DW = 32; //data width of
parameter AW = 32; //data width of
parameter IW = 12; //index size of table
parameter PAW = 64; //physical address width of output
parameter MW = PAW-AW+IW; //table data width
parameter MD = 1<<IW; //memory depth
//Stimulus to drive
reg mmu_en;
//Reg interface
reg mi_en;
reg [12:0] mi_addr;
reg [31:0] mi_din;
reg [3:0] mi_we;
//emesh interface
reg emesh_access_in;
reg emesh_write_in;
reg [1:0] emesh_datamode_in;
reg [3:0] emesh_ctrlmode_in;
reg [AW-1:0] emesh_dstaddr_in;
reg [AW-1:0] emesh_srcaddr_in;
reg [DW-1:0] emesh_data_in;
//Test junk
reg [1:0] test_state;
//Pattern generator
//1.) Write some patterns through mi_interface
//2.) Write some patterns from emesh interface
always @ (negedge clk) begin
if(go)
begin
case(test_state[1:0])
2'b00://write entries
if(mi_addr[12:0]<13'h16)
begin
mi_en <= 1'b1;
mi_we[3:0] <= 4'b1111;
mi_addr[12:0] <= mi_addr[12:0] + 1'b1;
/* verilator lint_off WIDTH */
mi_din[31:0] <= mi_addr[0] ? (mi_addr[12:0]+32'hFFFFF000) : 32'hFFFFFFFF;
/* verilator lint_on WIDTH */
end
else
begin
test_state <= 2'b01;
mi_en <= 1'b0;
end
2'b01://
if(emesh_dstaddr_in[31:0]<32'h00800000)
begin
emesh_access_in <= 1'b1;
emesh_write_in <= 1'b1;
emesh_dstaddr_in[31:0] <= emesh_dstaddr_in[31:0] + 32'h00100001;
emesh_ctrlmode_in[3:0] <= 4'b1111;
emesh_datamode_in[1:0] <= 2'b11;
emesh_data_in[31:0] <= 32'h12345678;
emesh_srcaddr_in[31:0] <= 32'h55555555;
end
else
begin
test_state <= 2'b10;
emesh_access_in <= 1'b0;
end // else: !if(~done)
2'b10://init array
begin
mi_addr[5:0] <= mi_addr[5:0]-1'b1;
end
default : test_state <= test_state;
endcase // case (test_state[1:0])
end // if (go)
if (reset) begin
mi_we[3:0] <= 4'b0;
mi_en <= 1'b0;
mi_addr[12:0] <= 13'b0;
mi_din[31:0] <= 32'h55555000;
test_state[1:0] <= 2'b00;
emesh_access_in <= 1'b0;
emesh_write_in <= 1'b0;
emesh_ctrlmode_in[3:0] <= 4'b0;
emesh_datamode_in[1:0] <= 2'b0;
emesh_dstaddr_in[31:0] <= 32'b0;
emesh_srcaddr_in[31:0] <= 32'b0;
emesh_data_in[31:0] <= 32'b0;
mmu_en <= 1'b1;
end
end
wire done = (mi_addr[5:0]==6'b001101);
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire emmu_access_out; // From emmu of emmu.v
wire [3:0] emmu_ctrlmode_out; // From emmu of emmu.v
wire [DW-1:0] emmu_data_out; // From emmu of emmu.v
wire [1:0] emmu_datamode_out; // From emmu of emmu.v
wire [63:0] emmu_dstaddr_out; // From emmu of emmu.v
wire [AW-1:0] emmu_srcaddr_out; // From emmu of emmu.v
wire emmu_write_out; // From emmu of emmu.v
wire [31:0] mi_dout; // From emmu of emmu.v
// End of automatics
/*AUTOWIRE*/
//DUT
emmu emmu(.mi_clk (clk),
/*AUTOINST*/
// Outputs
.mi_dout (mi_dout[31:0]),
.emmu_access_out (emmu_access_out),
.emmu_write_out (emmu_write_out),
.emmu_datamode_out (emmu_datamode_out[1:0]),
.emmu_ctrlmode_out (emmu_ctrlmode_out[3:0]),
.emmu_dstaddr_out (emmu_dstaddr_out[63:0]),
.emmu_srcaddr_out (emmu_srcaddr_out[AW-1:0]),
.emmu_data_out (emmu_data_out[DW-1:0]),
// Inputs
.clk (clk),
.mmu_en (mmu_en),
.mi_en (mi_en),
.mi_we (mi_we[3:0]),
.mi_addr ({3'b000,mi_addr[12:0]}),
.mi_din (mi_din[31:0]),
.emesh_access_in (emesh_access_in),
.emesh_write_in (emesh_write_in),
.emesh_datamode_in (emesh_datamode_in[1:0]),
.emesh_ctrlmode_in (emesh_ctrlmode_in[3:0]),
.emesh_dstaddr_in (emesh_dstaddr_in[AW-1:0]),
.emesh_srcaddr_in (emesh_srcaddr_in[AW-1:0]),
.emesh_data_in (emesh_data_in[DW-1:0]));
endmodule // dv_emmu
// Local Variables:
// verilog-library-directories:("." "../hdl")
// End:

View File

@ -1,39 +0,0 @@
module dv_emmu_tb;
reg clk;
reg reset;
reg go;
//Clock
always
#10 clk = ~clk;
initial
begin
$display($time, " << Starting the Simulation >>");
#0
clk = 1'b0; // at time 0
reset = 1'b1; // reset is active
#100
reset = 1'b0; // at time 100 release reset
#100
go = 1'b1;
#10000
$finish;
end
//Waveform dump
initial
begin
$dumpfile("test.vcd");
$dumpvars(0, dv_emmu);
end
dv_emmu dv_emmu
(.clk (clk),
.reset (reset),
.go (go));
endmodule

View File

@ -1,34 +0,0 @@
#include <verilated.h>
#include <verilated_vcd_c.h>
#include "Vdv_emmu__Syms.h"
int main(int argc, char **argv, char **env)
{
Verilated::commandArgs(argc, argv);
uint64_t t;
//VCD stuff
Verilated::traceEverOn(true);
VerilatedVcdC* tfp = new VerilatedVcdC;
//char *vcdFileName;
Vdv_emmu* top = new Vdv_emmu;
top->trace(tfp, 99);
tfp->open("test.vcd"/*vcdFileName*/);
//Init values
top->clk = 0;
top->reset = 1;
top->go = 0;
while(t<100000) {
if (t==100) top->reset = 0;
if (t==10000) top->go = 1;
top->eval();
top->clk = !top->clk;
tfp->dump((vluint64_t)t);
t++;
}
tfp->close();
}

View File

@ -1,10 +0,0 @@
#!/bin/bash
#Compiling sim
iverilog -y ../../fifos/hdl/ \
-y ../../common/hdl \
-y ../../memory/hdl \
-y ../hdl \
dv_emmu.v
#Running sim
./a.out

View File

@ -1,13 +0,0 @@
#!/bin/bash
dut="etrace"
top="../../common/dv/dv_top.v"
iverilog -g2005 -DTARGET_SIM=1 -DTARGET_XILINX=1 $top dut_${dut}.v -f ../../common/dv/libs.cmd -o ${dut}.vvp $1
#-Wtimescale
#PUT TARGET_SIM
#-pfileline=1
#-Wall

View File

@ -1,7 +0,0 @@
#!/bin/bash
if [ -e "test_0.memh" ]
then
rm test_0.memh
fi
cp $1 test_0.memh
./etrace.vvp

View File

@ -1,19 +0,0 @@
00000000_00000001_810F0000_05_0010 //enable tracer
00000001_00000000_00000001_05_0010 //s0:use source address and write to dummy
10000000_00000000_00000001_05_0010 //s1
10000000_00000000_00000001_05_0010 //s2
00000000_00000000_00000001_05_0010 //s3
11111111_00000000_00000001_05_0010 //s4
00000000_00000000_810A0000_04_0010 //read sample0
00000000_00000000_810A0004_04_0010 //
00000000_00000000_810A0008_04_0010 //read sample1
00000000_00000000_810A000c_04_0010 //
00000000_00000000_810A0010_04_0010 //read sample2
00000000_00000000_810A0014_04_0010 //
00000000_00000000_810A0018_04_0010 //read sample3
00000000_00000000_810A001c_04_0010 //
00000000_00000000_810A0020_04_0010 //read sample4
00000000_00000000_810A0024_04_0010 //

View File

@ -1,16 +0,0 @@
#!/bin/bash
DV="../../common/dv/dv_top.v"
DUT="dut_gpio.v"
ROOT="gpio"
iverilog -o $ROOT.bin -g2005 -DTARGET_SIM=1 \
$DV \
$DUT \
-y ../hdl \
-y ../../common/hdl/ \
-y ../../common/dv/ \
-y ../../emesh/hdl/ \
-y ../../emesh/dv/ \
-I ../hdl

View File

@ -1,7 +0,0 @@
#!/bin/bash
if [ -e "test_0.emf" ]
then
rm test_0.emf
fi
cp $1 test_0.emf
./gpio.bin

View File

@ -1,12 +0,0 @@
#!/bin/bash
# Compiles all dut*.v files in this directory
DV=../../common/dv/dv_top.v
DUT=dut_mio.v
LIBS=$OH_HOME/common/dv/libs.cmd
CFG="../hdl/cfg_mio.vh"
root=${DUT%%.*}
iverilog -g2005 -DTARGET_SIM=1 $CFG $DUT $DV -f $LIBS -o $root.bin

View File

@ -1,16 +0,0 @@
#!/bin/bash
DV=../../common/dv/dv_top.v
LIBS=$OH_HOME/common/dv/libs.cmd
declare -a core_arr=("dut_c2c")
declare -a cfg_arr=("../hdl/cfg_c2c.v")
for core in "${core_arr[@]}"
do
for cfg in "${cfg_arr[@]}"
do
iverilog -g2005 -DTARGET_SIM=1 $cfg $core.v $DV -f $LIBS -o $core.bin
done
done

View File

@ -1,13 +0,0 @@
#!/bin/bash
#ARGUMENTS
#$1=name of "dut*.bin" to simulate
#$2=path to test to run
#Uses BASH $RANDOM variable to set seed
rm test_0.emf
ln -s $2 test_0.emf
./$1 +SEED=$RANDOM

View File

@ -1 +0,0 @@
tests/test_random.emf

View File

@ -1,7 +0,0 @@
#!/bin/bash
top="../hdl/parallella_basic.v"
iverilog -g2005 -DTARGET_SIM=1 -DTARGET_XILINX=1 $top -f ../../common/dv/libs.cmd -o ${dut}.vvp
#-pfileline=1
#-Wall