Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog input seeding - Help

Status
Not open for further replies.

kobay000

Newbie level 1
Newbie level 1
Joined
May 27, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,288
Hi guys, i am new at Verilog. I generated a working Verilog file using Matlab HDL Generation Tool. I tested it with 16 binary bits using assign parameters and it worked for this values. But i need an input [1x1000000] random binary matrix. The following code must use this matrix with 16 bits block. How can produce a random [1x1000000] binary matrix and use this matrix dividing it 16 bits blocks (at total 1000000/16=62500 blocks) ? I searched at the internet and found a parameter named "initial" and some says i need a testbench file. Also I must show bit changes on quartus ii with waveform. Here is my code. Thanks in advance.

Code:
`timescale 1 ns / 1 ns

module serpistirici
          (
           clk,
           reset,
           clk_enable,
           veri_0,
           veri_1,
           veri_2,
           veri_3,
           veri_4,
           veri_5,
           veri_6,
           veri_7,
           veri_8,
           veri_9,
           veri_10,
           veri_11,
           veri_12,
           veri_13,
           veri_14,
           veri_15,
           ce_out,
           serpistirilmis_veri_0,
           serpistirilmis_veri_1,
           serpistirilmis_veri_2,
           serpistirilmis_veri_3,
           serpistirilmis_veri_4,
           serpistirilmis_veri_5,
           serpistirilmis_veri_6,
           serpistirilmis_veri_7,
           serpistirilmis_veri_8,
           serpistirilmis_veri_9,
           serpistirilmis_veri_10,
           serpistirilmis_veri_11,
           serpistirilmis_veri_12,
           serpistirilmis_veri_13,
           serpistirilmis_veri_14,
           serpistirilmis_veri_15
          );


  input   clk;
  input   reset;
  input   clk_enable;
  input   signed [15:0] veri_0;  // int16
  input   signed [15:0] veri_1;  // int16
  input   signed [15:0] veri_2;  // int16
  input   signed [15:0] veri_3;  // int16
  input   signed [15:0] veri_4;  // int16
  input   signed [15:0] veri_5;  // int16
  input   signed [15:0] veri_6;  // int16
  input   signed [15:0] veri_7;  // int16
  input   signed [15:0] veri_8;  // int16
  input   signed [15:0] veri_9;  // int16
  input   signed [15:0] veri_10;  // int16
  input   signed [15:0] veri_11;  // int16
  input   signed [15:0] veri_12;  // int16
  input   signed [15:0] veri_13;  // int16
  input   signed [15:0] veri_14;  // int16
  input   signed [15:0] veri_15;  // int16
  output  ce_out;
  output  signed [15:0] serpistirilmis_veri_0;  // int16
  output  signed [15:0] serpistirilmis_veri_1;  // int16
  output  signed [15:0] serpistirilmis_veri_2;  // int16
  output  signed [15:0] serpistirilmis_veri_3;  // int16
  output  signed [15:0] serpistirilmis_veri_4;  // int16
  output  signed [15:0] serpistirilmis_veri_5;  // int16
  output  signed [15:0] serpistirilmis_veri_6;  // int16
  output  signed [15:0] serpistirilmis_veri_7;  // int16
  output  signed [15:0] serpistirilmis_veri_8;  // int16
  output  signed [15:0] serpistirilmis_veri_9;  // int16
  output  signed [15:0] serpistirilmis_veri_10;  // int16
  output  signed [15:0] serpistirilmis_veri_11;  // int16
  output  signed [15:0] serpistirilmis_veri_12;  // int16
  output  signed [15:0] serpistirilmis_veri_13;  // int16
  output  signed [15:0] serpistirilmis_veri_14;  // int16
  output  signed [15:0] serpistirilmis_veri_15;  // int16


  wire enb;
  wire signed [15:0] veri [0:15];  // int16 [16]
  reg signed [15:0] serpistirilmis_veri [0:15];  // int16 [16]
  reg signed [15:0] serpistirici_A_1 [0:15];  // int16 [16]
  reg signed [31:0] serpistirici_k_1;  // int32
  reg signed [31:0] serpistirici_t_0_1;  // int32
  reg signed [31:0] serpistirici_t_1_1;  // int32
  reg signed [31:0] serpistirici_t_2_1;  // int32
  reg signed [31:0] serpistirici_t_3_1;  // int32
  reg signed [63:0] serpistirici_cast_1 [0:3];  // sfix64 [4]
  reg signed [63:0] serpistirici_add_cast_2 [0:3];  // sfix64 [4]
  reg signed [63:0] serpistirici_add_cast_0_1 [0:3];  // sfix64 [4]
  reg signed [63:0] serpistirici_add_cast_1_1 [0:3];  // sfix64 [4]


  assign veri[0] = veri_0;
  assign veri[1] = veri_1;
  assign veri[2] = veri_2;
  assign veri[3] = veri_3;
  assign veri[4] = veri_4;
  assign veri[5] = veri_5;
  assign veri[6] = veri_6;
  assign veri[7] = veri_7;
  assign veri[8] = veri_8;
  assign veri[9] = veri_9;
  assign veri[10] = veri_10;
  assign veri[11] = veri_11;
  assign veri[12] = veri_12;
  assign veri[13] = veri_13;
  assign veri[14] = veri_14;
  assign veri[15] = veri_15;

  assign enb = clk_enable;

  always @* begin
    //spssa
    //Oluþturulacak ara matrisin satýr sayýsý
    //Gönderilecek verinin 4 ün katý olup olmadýðýný kontrol etme, eðer deðilse
    //eksik bit sayýsý kadar boþluðu temsil eden sýfýr deðerini girme
    //Ara matrisi oluþturma

    for(serpistirici_k_1 = 0; serpistirici_k_1 <= 15; serpistirici_k_1 = serpistirici_k_1 + 1) begin
      serpistirici_A_1[serpistirici_k_1] = veri[serpistirici_k_1];
    end

    //Oluþturulan ara matris yardýmýyla serpiþtirilmiþ veriyi bulma

    for(serpistirici_t_0_1 = 0; serpistirici_t_0_1 <= 3; serpistirici_t_0_1 = serpistirici_t_0_1 + 1) begin
      serpistirici_cast_1[serpistirici_t_0_1] = {{30{serpistirici_t_0_1[31]}}, {serpistirici_t_0_1, 2'b00}};
      serpistirilmis_veri[serpistirici_t_0_1] = serpistirici_A_1[serpistirici_cast_1[serpistirici_t_0_1]];
    end


    for(serpistirici_t_1_1 = 0; serpistirici_t_1_1 <= 3; serpistirici_t_1_1 = serpistirici_t_1_1 + 1) begin
      serpistirici_add_cast_2[serpistirici_t_1_1] = {{30{serpistirici_t_1_1[31]}}, {serpistirici_t_1_1, 2'b00}};
      serpistirilmis_veri[serpistirici_t_1_1 + 4] = serpistirici_A_1[1 + serpistirici_add_cast_2[serpistirici_t_1_1]];
    end


    for(serpistirici_t_2_1 = 0; serpistirici_t_2_1 <= 3; serpistirici_t_2_1 = serpistirici_t_2_1 + 1) begin
      serpistirici_add_cast_0_1[serpistirici_t_2_1] = {{30{serpistirici_t_2_1[31]}}, {serpistirici_t_2_1, 2'b00}};
      serpistirilmis_veri[serpistirici_t_2_1 + 8] = serpistirici_A_1[2 + serpistirici_add_cast_0_1[serpistirici_t_2_1]];
    end


    for(serpistirici_t_3_1 = 0; serpistirici_t_3_1 <= 3; serpistirici_t_3_1 = serpistirici_t_3_1 + 1) begin
      serpistirici_add_cast_1_1[serpistirici_t_3_1] = {{30{serpistirici_t_3_1[31]}}, {serpistirici_t_3_1, 2'b00}};
      serpistirilmis_veri[serpistirici_t_3_1 + 12] = serpistirici_A_1[3 + serpistirici_add_cast_1_1[serpistirici_t_3_1]];
    end

  end



  assign serpistirilmis_veri_0 = serpistirilmis_veri[0];

  assign serpistirilmis_veri_1 = serpistirilmis_veri[1];

  assign serpistirilmis_veri_2 = serpistirilmis_veri[2];

  assign serpistirilmis_veri_3 = serpistirilmis_veri[3];

  assign serpistirilmis_veri_4 = serpistirilmis_veri[4];

  assign serpistirilmis_veri_5 = serpistirilmis_veri[5];

  assign serpistirilmis_veri_6 = serpistirilmis_veri[6];

  assign serpistirilmis_veri_7 = serpistirilmis_veri[7];

  assign serpistirilmis_veri_8 = serpistirilmis_veri[8];

  assign serpistirilmis_veri_9 = serpistirilmis_veri[9];

  assign serpistirilmis_veri_10 = serpistirilmis_veri[10];

  assign serpistirilmis_veri_11 = serpistirilmis_veri[11];

  assign serpistirilmis_veri_12 = serpistirilmis_veri[12];

  assign serpistirilmis_veri_13 = serpistirilmis_veri[13];

  assign serpistirilmis_veri_14 = serpistirilmis_veri[14];

  assign serpistirilmis_veri_15 = serpistirilmis_veri[15];

  assign ce_out = clk_enable;

endmodule
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top