FC2カウンター FPGAの部屋 Vivado 2104.2でSystemVerilog をやってみた7(アンパック型配列とパック型配列2)
fc2ブログ

FPGAやCPLDの話題やFPGA用のツールの話題などです。 マニアックです。 日記も書きます。

FPGAの部屋

FPGAの部屋の有用と思われるコンテンツのまとめサイトを作りました。Xilinx ISEの初心者の方には、FPGAリテラシーおよびチュートリアルのページをお勧めいたします。

Vivado 2104.2でSystemVerilog をやってみた7(アンパック型配列とパック型配列2)

今回は、”AR# 51836 Vivado 合成のデザイン アシスタント - SystemVerilog - 集合体データ型”のアンパック型配列サンプル (aggregate_data_types_example1.zip) とパック型配列サンプル (aggregate_data_types_example2.zip) のシミュレーションを行う。

共通に使用するテストベンチ (array_tb.sv) をまずは下に貼っておく。

`timescale 1ns / 1ps

module array_tb;
    parameter DELAY = 5;

    logic   clk;
    logic   [7:0]   address;
    wire    [7:0]   data;
    logic           cs;
    logic           we;
    logic           oe;

    logic   [7:0]   dout;

    array_unpacked array_unpacked_i (.*);

    initial begin
        clk = 1'b0;
        forever begin
            clk = #10 ~clk;
        end
    end

    assign data = dout;

    initial begin
        cs = 1'b1;
        oe = 1'b0;
        we = 1'b0;
        address = 8'h0;
        dout = 8'h12;

        @(posedge clk);    // next rising clock
        #DELAY;
        @(posedge clk);    // next rising clock
        #DELAY;
        we = 1'b1;  // Write

        @(posedge clk);    // next rising clock
        #DELAY;
        dout = 8'hzz;
        we = 1'b0;
        
        @(posedge clk);    // next rising clock
        #DELAY;
        oe = 1'b1;

        @(posedge clk);    // next rising clock
        #DELAY;
        @(posedge clk);    // next rising clock
        #DELAY;
        oe = 1'b0;
        
        @(posedge clk);    // next rising clock
        #DELAY;
        address = 8'h8;
        dout = 8'h34;
        we = 1'b1;  // Write

        @(posedge clk);    // next rising clock
        #DELAY;
        dout = 8'hzz;
        we = 1'b0;
        
        @(posedge clk);    // next rising clock
        #DELAY;
        oe = 1'b1;

        @(posedge clk);    // next rising clock
        #DELAY;
         @(posedge clk);    // next rising clock
        #DELAY;
       oe = 1'b0;
    end

endmodule


まずは、アンパック型配列サンプル (aggregate_data_types_example1.zip) の Behavioral Simulation を行った。表示された波形を下に示す。
SystemVerilog_30_140812.png

0番地には 12 が Write できて、Read もできている。(点線のカーソル部分) 8番地は、34 を Write して、Read 時に xx となっている。(実線のカーソル部分)

次に、Post-Synthesis Simulation を行った。表示された波形を下に示す。
SystemVerilog_33_140813.png

0番地に 12 を Write したはずが、Read では00 が読めた。(点線のカーソル部分) 8番地は、34 を Write して、Read 時に 34 を Read できている。(実線のカーソル部分)

Behavioral Simulation と Post-Synthesis Simulation の結果が全く違う。どうしたことだろう?

次に、Post-Implemantaion Simulation を行った。表示された波形を下に示す。
SystemVerilog_34_140813.png

Post-Synthesis Simulation の結果と同様な結果が得られた。

次に、パック型配列サンプル (aggregate_data_types_example2.zip) のシミュレーションを行った。

最初に、Behavioral Simulation を行った。表示された波形を下に示す。
SystemVerilog_35_140813.png

アンパック型配列の Behavioral Simulation と同様の波形だった。

次に、、Post-Synthesis Simulation を行った。表示された波形を下に示す。
SystemVerilog_36_140813.png

0番地に 12 を Write して、Read した結果も、8番地に 34 を Write して Read した結果も、00 となった。

次に、Post-Implemantaion Simulation を行った。表示された波形を下に示す。
SystemVerilog_37_140813.png

Post-Synthesis Simulation と同様に、0番地に 12 を Write して、Read した結果も、8番地に 34 を Write して Read した結果も、00 となった。

アンパック型配列サンプル (aggregate_data_types_example1.zip) とパック型配列サンプル (aggregate_data_types_example2.zip) のシミュレーション結果は、 Behavioral Simulation と、Post-Synthesis Simulation 、Post-Implemantaion Simulation の結果が違ってしまった。これはなぜだろう?論理合成結果は正しいのだろうか?
  1. 2014年08月13日 04:14 |
  2. SystemVerilog
  3. | トラックバック:0
  4. | コメント:0

コメント

コメントの投稿


管理者にだけ表示を許可する

トラックバック URL
https://marsee101.blog.fc2.com/tb.php/2901-b310fc2a
この記事にトラックバックする(FC2ブログユーザー)