//file spi_top //Rev.: rev.1.0 module spi_top( MISO,MOSI, CS, SCLK,RST,TMP_DATA_OUT,clk_div // osc_clk_w//シミュレーション用内部OSC ); //////////output//// output MOSI; output CS ; output SCLK; output [15:0]TMP_DATA_OUT; //////////input///// input clk_div; input RST ; // input osc_clk_w;//シミュレーション用内部OSC input MISO ; //////////wire/////// wire osc_clk ;//実機の場合はここを繋げる wire osc_clk_w ;////シミュレーション用内部OSC wire scl_w ; wire scl_en_w ; wire wait_en_w ; wire allone_en_w ; wire allzero_en_w ; wire command_en_w ; wire allone_prep_en_w ; wire allzero_prep_en_w; wire command_prep_en_w; wire data_recieve_en_w; wire data_fix_en_w ; wire [4:0]scl_16cnt_w ; wire [17:0]wait_cnt_w ; ////////////////////// spi_state spi_state_Inst( .sclk(SCLK), .sclk_o(scl_w), .cs(CS), .scl_en(scl_en_w) , .wait_en(wait_en_w), .allone_en(allone_en_w), .allzero_en(allzero_en_w), .command_en(command_en_w), .allone_prep_en(allone_prep_en_w), .allzero_prep_en(allzero_prep_en_w), .command_prep_en(command_prep_en_w), .data_recieve_en(data_recieve_en_w), .data_fix_en(data_fix_en_w), .scl_16cnt(scl_16cnt_w), .wait_cnt(wait_cnt_w), .clk_div(clk_div), .rst(RST) ); spi_tx spi_tx_Inst( .tx_data_out(MOSI), .command_en(command_en_w), .allone_en(allone_en_w), .allzero_en(allzero_en_w), .command_prep_en(command_prep_en_w), .allone_prep_en(allone_prep_en_w), .allzero_prep_en(allzero_prep_en_w), .sclk(scl_w), .clk_div(clk_div), .rst(RST) ); spi_rx spi_rx_Inst( .data_in(MISO), .data_recieve_en(data_recieve_en_w), .data_fix_en(data_fix_en_w), .clk_div(clk_div), .sclk(scl_w), .rst(RST), .tmp_data_fix(TMP_DATA_OUT) ); counter counter_Inst( .scl_16cnt(scl_16cnt_w), .wait_cnt(wait_cnt_w), .scl_en(scl_en_w), .wait_en(wait_en_w), .clk_div(clk_div), .rst(RST) ); //ClockDivider Instance /////////////////////////////////////////////// defparam I1.DIV = "4.0"; defparam I1.GSR = "DISABLED"; CLKDIVC I1 (.RST (RST), .CLKI(osc_clk_w),//output .ALIGNWD (0), .CDIV1 (), .CDIVX (clk_div_w) ); //Inteernal oscillator Instance ////////////////////////////////////////////// defparam OSCH_Inst.NOM_FREQ = "2.08" ; OSCH OSCH_Inst ( .STDBY( 0 ), // 0=Enabled, 1=Disabled .OSC( osc_clk_w ) , .SEDSTDBY() ); endmodule