Verification professor

Gửi bài trả lời

Mã xác nhận
Nhập vào đoạn mã xác nhận mà bạn thực sự nhìn thấy trong hình. Tất cả chữ cái đều được phân biệt với chữ số và không có số O.

Nếu bạn muốn đính kèm một hay nhiều tập tin trong bài viết, hãy sử dụng công cụ bên dưới.

Kích thước tệp tối đa cho mỗi tệp đính kèm: 1 MiB.

Xem toàn bộ Xem lại chủ đề: Verification professor

Re:Verification professor

Viết bởi langtu » Ba T11 18, 2008 1:41 pm

cac ban xem thu doan code nay nha:

`timescale 1ns / 1ps

module tb_chip_basic;

parameter t = 10;
parameter CLKHI = t/2;            
parameter CLKLO = t/2;
parameter wdtclkH = (25*CLKLO);                  
parameter wdtclkL = (25*CLKLO);            
parameter t0clkH = (12.5*CLKLO);                  
parameter t0clkL = (12.5*CLKLO);      
parameter t1clkH = (12.5*CLKLO);            
parameter t1clkL = (12.5*CLKLO);

// *** Basic Interface to the SigmaK3_CPU
reg            clk;
reg             por;
reg             mclr;
reg            clkwdt;

reg            t0cki;
reg            t1cki;

reg            extint;
reg            wdte;      
     
wire            sleep;

// Declare I/O Port connections
//reg  [7:0]      porta;
tri  [7:0]      porta;
tri  [7:0]      portb;
tri  [7:0]      portc;
tri  [7:0]      portd;


// Declare RAM signals

//wire    [7:0]   ramdatai;            
//wire      [7:0]      ramdatao;
//wire    [8:0]   rdaddr;
//wire    [8:0]   wraddr;              
//wire            ramwe;      
     
// Declare ROM signals
wire      [13:0]      prgdata;
wire      [15:0]      prgaddr;

// Peripheral
//------CCP1-----
reg      ccp1i;
wire      ccp1o;

//------USART-----
reg      rxdti;
reg      rxcki;
wire      txdto;
wire      txcko;

// Debug output ports on the chip.  These are just internal signals brought out so
// they can be observed.
//
vn08chip_gez        vn08chip_gez
                                        (
                                          .clk_i(clk),
                                          .clkwdt_i(clkwdt),
                                          .por_i(por),
                                          .mclr_i(mclr),
                                          .prgdata_i(prgdata),
                                          .extint_i(extint),
                                          .t0cki_i(t0cki),
                                          .t1cki_i(t1cki),
                                          .ccp1i_i(ccp1i),
                                          .rxdti_i(rxdti),
                                          .rxcki_i(rxcki),
                                          .wdte_i(wdte),
                                         

                                          .prgaddr_o(prgaddr),
                                          .sleep_o(sleep),
                                          .ccp1o_o(ccp1o),
                                          .txdto_o(txdto),
                                          .txcko_o(txcko),
                                          .porta(porta),
                                          .portb(portb),
                                          .portc(portc),
                                          .portd(portd)                                        
                                        );
// Instantiate the program memory.
rom64k rom64k(
           .prg_addr(prgaddr),
           .prg_data(prgdata)
     );
     
// Instantiate the RAM512      
     



// This is the only initial block in the test module and this is where
// you select what test you want to do.

initial begin
  $display ("************* VN8_01 ***************************");  
  basic;    
end




//initial begin
 //$sdf_annotate ("sigmak3.mapped.sdf", sigmak3);    
//end




// Event should be emitted by any task to kill simulation.  Tasks should
// use this to close files, etc.
//
event ENDSIM;

// Capture some data
task capture_data;
  begin      
     $vcdplusfile("tb_chip_basic.vpd");
     $dumpvars (0, tb_chip_basic);
     $vcdpluson;
     $vcdplusdeltacycleon;
     @(ENDSIM);
     $dumpflush;    
  end
endtask


//-------------------------
task reset_por;
  begin
     por = 0;
     # (5*CLKLO) por = 1;
     $display ("End RESET_POR.");
  end
endtask
//=================================
//Reset master clear
task reset_pic;
  begin
          mclr = 1;
     #(5*CLKLO) mclr = 0;
     #(5*CLKLO) mclr = 1;
     $display ("End RESET_MCLR.");
     //#(700*CLKLO) mclr = 0;
     //#(20*CLKLO) mclr = 1;
     //#(94000*CLKLO) mclr = 0;
     //#(6*CLKLO) mclr = 1;
  end
endtask

// Drive the clock input
task drive_clock;
  begin
     clk  = 0;
     forever
     begin
        #(CLKLO) clk = ~clk;        
           end
  end
endtask

//--------------------------------
task drive_t0cki;
  begin
     t0cki  = 0;
     forever
     begin
        #(t0clkL) t0cki = ~t0cki;        
           end
  end
endtask

//--------------------------------
task drive_t1cki;
  begin
     t1cki  = 0;
     forever
     begin
        #(t1clkH) t1cki = ~t1cki;        
           end
  end
endtask

//------------------------------
task drive_wdtclk;
  begin
     clkwdt = 0;
     forever
     begin
        #(wdtclkH) clkwdt = ~clkwdt;
       end
  end
endtask

//------------------------------
task drive_wdte;
  begin
     wdte  = 0;
     //#(10*CLKHI)
      //wdte = 1;
     
  end
endtask

//------------------------------
task drive_extint;
  begin
     extint  = 0;
  end
endtask

//------------------------------
//task basic_drive_portain;
  //begin
     //forever begin
assign         porta = 8'h55;
        //repeat (64) @(posedge clk);
        //portai = 8'hAA;
        //repeat (64) @(posedge clk);
     //end
  //end
//endtask
/*
//------------------------------
continue...
Mong la de tai nay duoc cac ban quan tam

Re:Verification professor

Viết bởi Tuan » Năm T11 06, 2008 3:52 pm

・テストベンチとは、自分が作成した回路(module)に、シミュレーション上で信号を
   印加/観察するためのデータ構造を指します。
Verilog-HDLではテストベンチもmodule構造を持っています。以下にテストベンチの
構成を示します。module myrtlが観測対象の回路という想定です。
 
・Fig.1のように、テストベンチのmoduleは外部のポートを持っていません。信号を印
加するためのregと、出力観測用のwireのみです。
  
・「わかりやすさ」の点から考えれば、テストベンチmoduleのreg, wire名は、観測moduleの入出力ポート名と同じにすることがほとんどです。
     reg 信号 <===> 入力ポート
     wire信号 <===> 出力ポート

Verification professor

Viết bởi langtu » Năm T11 06, 2008 1:37 pm

Tui la dan thiet ke IC, dang lam trong team Verification. Mong la topic nay giup duoc cac ban va giup duoc chinh ban than tui??
Bat dau ne: cau truc cua mot testbench bang verilog la???START