`timescale 1ps/1ps
`define TBCLK 20000
module tb_peri_top;
genvar k;
integer i, j, d;
reg ck50m = 1;
always #( `TBCLK /2 ) ck50m = ~ck50m;
reg reset=1;
wire sda;
wire scl;
pullup (sda);
pullup (scl);
reg [3:0] act_iic=0;
iic_unit inst_iic_unit
(
.reset ( reset ),
.sclk ( ck50m ),
.address ( 8'h11 ),
.command ( 8'h91 ),
.data_low ( 8'h0 ),
.data_high ( 8'h0 ),
.action ( act_iic ),
.sda (sda),
.scl (scl)
);
slave_iic inst_slave_iic
(
.reset ( reset ),
.sclk ( ck50m ),
.sda (sda),
.scl (scl)
);
initial begin
#300
for(i=0; i<10; i=i+1) #(`TBCLK) ;
reset = 0;
$write("\n\n\n\n\n");
$write("======================================================================\n");
for(i=0; i<20; i=i+1) #(`TBCLK) ;
act_iic = 1;
for(i=0; i<20; i=i+1) #(`TBCLK) ;
act_iic = 0;
for(i=0; i<300; i=i+1) #(`TBCLK) ;
$stop;
end
endmodule
'Verilog' 카테고리의 다른 글
iic master (0) | 2021.02.25 |
---|---|
iic slave model (0) | 2021.02.25 |