OpenCores
URL https://opencores.org/ocsvn/alu_with_selectable_inputs_and_outputs/alu_with_selectable_inputs_and_outputs/trunk

Subversion Repositories alu_with_selectable_inputs_and_outputs

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /alu_with_selectable_inputs_and_outputs/tags/arelease/verif_env
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

/checker/checker.v
0,0 → 1,387
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//CHECKER
 
module CHECKER(c_clk, c_res,
ic_data_0, ic_data_1, ic_data_2, ic_data_3,
oc_data,
oc_parity,
ic_data_collected,
oc_data_collected);
 
input c_clk, c_res;
input [7:0] ic_data_0, ic_data_1, ic_data_2, ic_data_3;
input [15:0] oc_data;
input oc_parity;
input [0:127] ic_data_collected, oc_data_collected;
 
integer i, j;
 
reg [15:0] checker_result;
reg checker_result_parity;
reg [3:0] checker_operator_type;
reg [2:0] checker_operator_symbol;
 
integer fh;
 
always @ (posedge c_clk or posedge c_res)
if(c_res)
begin
i = 0;
j = 0;
checker_result = 16'b0;
checker_result_parity = 1'b0;
checker_operator_type = 4'b1111;
checker_operator_symbol = 3'b111;
end
 
always @ (ic_data_collected[i])
if(ic_data_collected[i])
begin
#1
if(fh === 32'bx)
fh = $fopen("checker.out");
 
$fdisplay(fh, "%0d INFO: Collected IN transaction no %0d: ic_data_0 = %b, ic_data_1 = %b, ic_data_2 = %b, ic_data_3 = %b",
$time, i, ic_data_0, ic_data_1, ic_data_2, ic_data_3);
 
//calculate checker's alu result
checker_operator_type = ic_data_0[7:4];
checker_operator_symbol = ic_data_0[3:1];
 
case (checker_operator_type)
'd0: //Arithmetic
begin
$fdisplay(fh, "Arithmetic operator");
case(checker_operator_symbol)
'd0: //Multiply
begin
checker_result = (ic_data_1 * ic_data_2);
$fdisplay(fh, "OPERATION * (Multiply): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd1: //Divide
begin
checker_result = (ic_data_1 / ic_data_2);
$fdisplay(fh, "OPERATION / (Divide): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd2: //Add
begin
checker_result = (ic_data_1 + ic_data_2);
$fdisplay(fh, "OPERATION + (Add): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd3: //Substract
begin
checker_result = (ic_data_1 - ic_data_2);
$fdisplay(fh, "OPERATION - (Substract): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd4: //Modulus
begin
checker_result = (ic_data_1 % ic_data_2);
$fdisplay(fh, "OPERATION (Modulus): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd1: //Logical
begin
$fdisplay(fh, "Logical operator");
case(checker_operator_symbol)
'd0: //Logical negation
begin
checker_result = (!ic_data_1);
$fdisplay(fh, "OPERATION ! (Logical negation): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd1: //Logical and
begin
checker_result = (ic_data_1 && ic_data_2);
$fdisplay(fh, "OPERATION && (Logical and): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd2: //Logical or
begin
checker_result = (ic_data_1 || ic_data_2);
$fdisplay(fh, "OPERATION || (Logical or): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd2: //Relational
begin
$fdisplay(fh, "Relational operator");
case(checker_operator_symbol)
'd0: //Greater than
begin
checker_result = (ic_data_1 > ic_data_2);
$fdisplay(fh, "OPERATION > (Greater than): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd1: //Less than
begin
checker_result = (ic_data_1 < ic_data_2);
$fdisplay(fh, "OPERATION < (Less than): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd2: //Greater than or equal
begin
checker_result = (ic_data_1 >= ic_data_2);
$fdisplay(fh, "OPERATION >= (Greater than or equal): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd3: //Less than or equal
begin
checker_result = (ic_data_1 <= ic_data_2);
$fdisplay(fh, "OPERATION <= (Less than or equal): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd3: //Equality
begin
$fdisplay(fh, "Equality operator");
case(checker_operator_symbol)
'd0: //Equality
begin
checker_result = (ic_data_1 == ic_data_2);
$fdisplay(fh, "OPERATION == (Equality): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd1: //Inequality
begin
checker_result = (ic_data_1 != ic_data_2);
$fdisplay(fh, "OPERATION != (Inequality): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd2: //Case equality
begin
checker_result = (ic_data_1 === ic_data_2);
$fdisplay(fh, "OPERATION === (Case equality): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd3: //Case inequality
begin
checker_result = (ic_data_1 !== ic_data_2);
$fdisplay(fh, "OPERATION !== (Case inequality): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd4: //Bitwise
begin
$fdisplay(fh, "Bitwise operator");
case(checker_operator_symbol)
'd0: //Bitwise negation
begin
checker_result = (~ ic_data_1);
$fdisplay(fh, "OPERATION ~ (Bitwise negation): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd1: //Bitwise and
begin
checker_result = (ic_data_1 & ic_data_2);
$fdisplay(fh, "OPERATION & (Bitwise and): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd2: //Bitwise or
begin
checker_result = (ic_data_1 | ic_data_2);
$fdisplay(fh, "OPERATION | (Bitwise or): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd3: //Bitwise xor
begin
checker_result = (ic_data_1 ^ ic_data_2);
$fdisplay(fh, "OPERATION ^ (Bitwise xor): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd4: //Bitwise xnor (1st operator symbol)
begin
checker_result = (ic_data_1 ^~ ic_data_2);
$fdisplay(fh, "OPERATION ^~ (Bitwise xnor (1st operator symbol)): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd5: //Bitwise xnor (2nd operator symbol)
begin
checker_result = (ic_data_1 ~^ ic_data_2);
$fdisplay(fh, "OPERATION ~^ (Bitwise xnor (2nd operator symbol)): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd5: //Reduction
begin
$fdisplay(fh, "Reduction operator");
case(checker_operator_symbol)
'd0: //Reduction and
begin
checker_result = (& ic_data_1);
$fdisplay(fh, "OPERATION & (Reduction and): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd1: //Reduction nand
begin
checker_result = (~& ic_data_1);
$fdisplay(fh, "OPERATION ~& (Reduction nand): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd2: //Reduction or
begin
checker_result = (| ic_data_1);
$fdisplay(fh, "OPERATION | (Reduction or): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd3: //Reduction nor
begin
checker_result = (~| ic_data_1);
$fdisplay(fh, "OPERATION ~| (Reduction nor): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd4: //Reduction xor
begin
checker_result = (^ ic_data_1);
$fdisplay(fh, "OPERATION ^ (Reduction xor): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd5: //Reduction xnor (1st operator symbol)
begin
checker_result = (^~ ic_data_1);
$fdisplay(fh, "OPERATION ^~ (Reduction xnor (1st operator symbol)): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
'd6: //Reduction xnor (2nd operator symbol)
begin
checker_result = (~^ ic_data_1);
$fdisplay(fh, "OPERATION ~^ (Reduction xnor (2nd operator symbol)): ic_data_1 = %b, checker_result = %b",
ic_data_1, checker_result);
end
endcase
end
'd6: //Shift
begin
$fdisplay(fh, "Shift operator");
case(checker_operator_symbol)
'd0: //Right shift
begin
checker_result = (ic_data_1 >> ic_data_2);
$fdisplay(fh, "OPERATION >> (Right shift): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
'd1: //Left shift
begin
checker_result = (ic_data_1 << ic_data_2);
$fdisplay(fh, "OPERATION << (Left shift): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd7: //Concatenation
begin
$fdisplay(fh, "Concatenation operator");
case(checker_operator_symbol)
'd0: //Concatenation
begin
checker_result = {ic_data_1, ic_data_2};
$fdisplay(fh, "OPERATION {} (Concatenation): ic_data_1 = %b, ic_data_2 = %b, checker_result = %b",
ic_data_1, ic_data_2, checker_result);
end
endcase
end
'd8: //Replication
begin
$fdisplay(fh, "Replication operator");
case(checker_operator_symbol)
'd0: //Replication
begin
checker_result = { 2 {ic_data_1} };
$fdisplay(fh, "OPERATION { { } } (Replication): ic_data_1 = %b - replicated twice: checker_result = %b",
ic_data_1, checker_result);
end
endcase
end
'd9: //Conditional
begin
$fdisplay(fh, "Conditional operator");
case(checker_operator_symbol)
'd0: //Conditional
begin
checker_result = (ic_data_1 ? ic_data_2 : ic_data_3);
$fdisplay(fh, "OPERATION ?: (Conditional): ic_data_1 = %b, ic_data_2 = %b, ic_data_3=%b, checker_result = %b",
ic_data_1, ic_data_2, ic_data_3, checker_result);
end
endcase
end
endcase
checker_result_parity = ^checker_result; //Parity = XOR of all result's bits
i = i + 1;
//$fclose(fh);
end
 
always @ (oc_data_collected[j])
begin
if(oc_data_collected[j])
begin
$fdisplay(fh, "%0d INFO: Collected OUT transaction no %0d: %b", $time, j, oc_data);
//checker result
if(checker_result[15:0] === oc_data[15:0])
$fdisplay(fh, "%0d INFO: Calculus of data for transaction no. %0d match! (%b - %b)",
$time, j, checker_result[15:0], oc_data[15:0]);
else
$fdisplay(fh, "%0d ERROR: Calculus of data for transaction no. %0d DO NOT match! (%b - %b)",
$time, j, checker_result[15:0], oc_data[15:0]);
//checker parity
if(checker_result_parity === oc_parity)
$fdisplay(fh, "%0d INFO: Calculus of parity for transaction no. %0d match! (%b - %b)\n",
$time, j, checker_result_parity, oc_parity);
else
$fdisplay(fh, "%0d ERROR: Calculus of parity for transaction no. %0d DO NOT match! (%b - %b)\n",
$time, j, checker_result_parity, oc_parity);
j = j + 1;
end
end
 
endmodule
/bfms/res_bfm.v
0,0 → 1,69
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------BFMs----------------
 
//RESET BFM
 
module RES_BFM(bfm_res);
output bfm_res;
 
reg bfm_res;
 
integer fh;
 
initial
begin
fh = $fopen("res_bfm.out");
 
$fmonitor(fh, "%0d INFO: bfm_res = %0b", $time, bfm_res);
bfm_res = 0;
#20 bfm_res = 1;
#20 bfm_res = 0;
#1
$fclose(fh);
end
 
endmodule
/bfms/clk_gen.v
0,0 → 1,65
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------BFMs----------------
 
//CLK GENERATOR
 
module CLK_GEN(gen_clk);
output gen_clk;
 
reg gen_clk;
 
integer fh;
 
initial
begin
fh = $fopen("clk_gen.out");
 
$fdisplay(fh, "%0d INFO: Toggling CLK every 5 simulation seconds...", $time);
$fclose(fh);
gen_clk = 0;
forever #5 gen_clk = ~gen_clk;
end
 
endmodule
/bfms/data_in_bfm.v
0,0 → 1,170
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------BFMs----------------
 
//DATA_IN BFM
 
module DATA_IN_BFM(bfm_stb, bfm_sel, bfm_data_in_0, bfm_data_in_1, bfm_data_in_2, bfm_data_valid_in);
output bfm_stb;
output [1:0] bfm_sel;
output [7:0] bfm_data_in_0, bfm_data_in_1, bfm_data_in_2;
output bfm_data_valid_in;
 
reg bfm_stb;
reg [1:0] bfm_sel;
reg[7:0] bfm_data_in_0, bfm_data_in_1, bfm_data_in_2;
reg bfm_data_valid_in;
 
reg [3:0] bfm_operator_type;
reg [2:0] bfm_operator_symbol;
reg bfm_output_channel;
 
parameter NO_OF_TRANSACTIONS = 10;
integer i;
 
integer fh;
 
initial
begin
fh = $fopen("data_in_bfm.out");
 
$fmonitor(fh, "%0d INFO: bfm_stb=%b, bfm_sel=%b, bfm_data_in_0=%b, bfm_data_in_1=%b, bfm_data_in_2=%b",
$time, bfm_stb, bfm_sel, bfm_data_in_0, bfm_data_in_1, bfm_data_in_2);
bfm_stb = 0;
bfm_sel = 2'b00;
bfm_data_valid_in = 0;
bfm_data_in_0 = 10'b0;
bfm_data_in_1 = 10'b0;
bfm_data_in_2 = 10'b0;
#50
 
for(i=0; i<NO_OF_TRANSACTIONS; i=i+1)
begin
 
#30 bfm_stb = 1;
$display("Transaction no: %0d", i);
bfm_data_valid_in = 1;
bfm_sel = {$random} % 3;
bfm_operator_type = {$random} % 10;
case(bfm_operator_type)
'd0: //Arithmetic
bfm_operator_symbol = {$random} % 5;
'd1: //Logical
bfm_operator_symbol = {$random} % 3;
'd2: //Relational
bfm_operator_symbol = {$random} % 4;
'd3: //Equality
bfm_operator_symbol = {$random} % 4;
'd4: //Bitwise
bfm_operator_symbol = {$random} % 6;
'd5: //Reduction
bfm_operator_symbol = {$random} % 7;
'd6: //Shift
bfm_operator_symbol = {$random} % 2;
'd7: //Concatenation
bfm_operator_symbol = {$random} % 1; //or bfm_operator_symbol = 0;
'd8: //Replication
bfm_operator_symbol = {$random} % 1; //or bfm_operator_symbol = 0;
'd9: //Conditional
bfm_operator_symbol = {$random} % 1; //or bfm_operator_symbol = 0;
endcase
bfm_output_channel = {$random} % 2;
 
case(bfm_sel[1:0])
2'b00: bfm_data_in_0 = {bfm_operator_type, bfm_operator_symbol, bfm_output_channel};
2'b01: bfm_data_in_1 = {bfm_operator_type, bfm_operator_symbol, bfm_output_channel};
2'b10: bfm_data_in_2 = {bfm_operator_type, bfm_operator_symbol, bfm_output_channel};
endcase
 
#10 bfm_stb = 0;
 
//if at least only one operand is required - there always exists at least one operand
case(bfm_sel[1:0])
2'b00: bfm_data_in_0 = $random;
2'b01: bfm_data_in_1 = $random;
2'b10: bfm_data_in_2 = $random;
endcase
 
//if at least two operands are required
if((bfm_operator_type === 'd0) || //Arithmetic
((bfm_operator_type === 'd1) && (bfm_operator_symbol >= 'd1) && (bfm_operator_symbol <= 'd2)) || //Logical
(bfm_operator_type === 'd2) || //Relational
(bfm_operator_type === 'd3) || //Equality
((bfm_operator_type === 'd4) && (bfm_operator_symbol >= 'd1) && (bfm_operator_symbol <= 'd5)) || //Bitwise
(bfm_operator_type === 'd6) || //Shift
(bfm_operator_type === 'd7) || //Concatenation
(bfm_operator_type === 'd9)) //Conditional
begin
#10
case(bfm_sel[1:0])
2'b00: bfm_data_in_0 = $random;
2'b01: bfm_data_in_1 = $random;
2'b10: bfm_data_in_2 = $random;
endcase
end
 
//if three operands are required
if(bfm_operator_type === 'd9) //Conditional
begin
#10
case(bfm_sel[1:0])
2'b00: bfm_data_in_0 = $random;
2'b01: bfm_data_in_1 = $random;
2'b10: bfm_data_in_2 = $random;
endcase
end
 
#10 bfm_data_valid_in = 0;
 
end
#100
$fclose(fh);
 
$finish;
end
 
endmodule
/collectors/input_collector.v
0,0 → 1,141
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Collectors----------------
 
//INPUT COLLECTOR
 
module INPUT_COLLECTOR(ic_clk, ic_res, ic_stb,
ic_sel,
ic_data_in_0, ic_data_in_1, ic_data_in_2,
ic_data_valid_in,
ic_data_out_0, ic_data_out_1, ic_data_out_2, ic_data_out_3,
ic_data_collected);
 
input ic_clk, ic_res, ic_stb;
input [1:0] ic_sel;
input [7:0] ic_data_in_0, ic_data_in_1, ic_data_in_2;
input ic_data_valid_in;
output [7:0] ic_data_out_0, ic_data_out_1, ic_data_out_2, ic_data_out_3;
output [0:127] ic_data_collected;
 
reg ic_stb_was_1;
 
reg [7:0] ic_data_out_0, ic_data_out_1, ic_data_out_2, ic_data_out_3;
reg [0:127] ic_data_collected;
 
reg [7:0] ic_data[0:3];
integer i, j, k;
 
integer fh;
 
always @ (posedge ic_clk or posedge ic_res)
if(ic_res)
begin
ic_stb_was_1 = 0;
ic_data_out_0 = 0;
ic_data_out_1 = 0;
ic_data_out_2 = 0;
ic_data_out_3 = 0;
ic_data_collected = 0;
for(j = 0; j < 4; j = j + 1)
ic_data[j] = 0;
i = 0;
j = 0;
k = 0;
end
else
begin
if(ic_stb)
ic_stb_was_1 = 1;
if(ic_data_valid_in)
begin
case(ic_sel)
'd0: ic_data[k] = ic_data_in_0;
'd1: ic_data[k] = ic_data_in_1;
'd2: ic_data[k] = ic_data_in_2;
endcase
k = k + 1;
end
else
begin
if(ic_stb_was_1)
begin
k = 0;
for(j = 0; j < 4; j = j + 1)
case(j)
'd0: ic_data_out_0 = ic_data[j];
'd1: ic_data_out_1 = ic_data[j];
'd2: ic_data_out_2 = ic_data[j];
'd3: ic_data_out_3 = ic_data[j];
endcase
end
if(ic_stb_was_1)
begin
ic_data_collected[i] = 1;
i = i + 1;
ic_stb_was_1 = 0;
end
end
end
 
//Print INPUT COLLECTOR buffer contents
always @ (i)
begin
if(fh === 32'bx)
fh = $fopen("input_collector.out");
 
$fdisplay(fh, "%0d INFO: Input Transaction no: %0d", $time, i);
$fdisplay(fh, "%0d INFO: ic_data_out_0 = %b", $time, ic_data_out_0);
// split ic_data_out_0
$fdisplay(fh, "\tINFO: operator type = %0d", ic_data_out_0[7:4]);
$fdisplay(fh, "\tINFO: operator symbol = %0d", ic_data_out_0[3:1]);
$fdisplay(fh, "\tINFO: output channel = %0d", ic_data_out_0[0]);
//
$fdisplay(fh, "%0d INFO: ic_data_out_1 = %b", $time, ic_data_out_1);
$fdisplay(fh, "%0d INFO: ic_data_out_2 = %b", $time, ic_data_out_2);
$fdisplay(fh, "%0d INFO: ic_data_out_3 = %b\n", $time, ic_data_out_3);
//$fclose(fh);
end
 
endmodule
/collectors/output_collector.v
0,0 → 1,109
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Collectors----------------
 
//OUTPUT COLLECTOR
 
module OUTPUT_COLLECTOR(oc_clk, oc_res,
oc_valid_0, oc_valid_1,
oc_out_0, oc_out_1,
oc_parity_0, oc_parity_1,
oc_data,
oc_parity,
oc_data_collected);
 
input oc_clk, oc_res;
input oc_valid_0, oc_valid_1;
input [15:0] oc_out_0, oc_out_1;
input oc_parity_0, oc_parity_1;
output [15:0] oc_data;
output oc_parity;
output [0:127] oc_data_collected;
 
reg [15:0] oc_data;
reg oc_parity;
reg [0:127] oc_data_collected;
 
integer i;
integer fh;
 
always @ (posedge oc_clk or posedge oc_res)
if(oc_res)
begin
i = 0;
oc_data = 0;
oc_parity = 0;
oc_data_collected = 0;
end
else
begin
if(oc_valid_0)
begin
oc_data = oc_out_0;
oc_parity = oc_parity_0;
oc_data_collected[i] = 1;
i = i + 1;
end
if(oc_valid_1)
begin
oc_data = oc_out_1;
oc_parity = oc_parity_1;
oc_data_collected[i] = 1;
i = i + 1;
end
end
 
//Print OUTPUT COLLECTOR buffer contents
always @ (i)
begin
if(fh === 32'bx)
fh = $fopen("output_collector.out");
 
$fdisplay(fh, "%0d INFO: Output Transaction no: %0d", $time, i);
$fdisplay(fh, "%0d INFO: oc_data = %b", $time, oc_data);
$fdisplay(fh, "%0d INFO: oc_parity = %b\n", $time, oc_parity);
 
//$fclose(fh);
end
 
endmodule
/monitors/parity_monitor.v
0,0 → 1,75
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//PARITY MONITOR
 
module PARITY_MONITOR(m_clk, m_res, m_parity_0, m_parity_1);
input m_clk, m_res;
input m_parity_0, m_parity_1;
 
reg res_was_active;
 
integer fh0, fh1;
 
always @ (posedge m_clk)
if(m_res)
res_was_active = 1;
else
if(res_was_active)
begin
if(fh0 === 32'bx)
fh0 = $fopen("parity_0_monitor.out");
if(fh1 === 32'bx)
fh1 = $fopen("parity_1_monitor.out");
if ((m_parity_0 === 1'bx) || (m_parity_0 === 1'bz))
$fdisplay(fh0, "%0d ERROR: PARITY_0 doesn't have a valid value (%b)", $time, m_parity_0);
if ((m_parity_1 === 1'bx) || (m_parity_1 === 1'bz))
$fdisplay(fh1, " ERROR: PARITY_1 doesn't have a valid value (%b)", $time, m_parity_1);
//$fclose(fh0);
//$fclose(fh1);
end
 
endmodule
/monitors/stb_monitor.v
0,0 → 1,64
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//STB MONITOR
 
module STB_MONITOR(m_clk, m_stb);
input m_clk;
input m_stb;
 
integer fh;
 
always @ (posedge m_clk)
begin
if(fh === 32'bx)
fh = $fopen("stb_monitor.out");
if ((m_stb === 1'bx) || (m_stb === 1'bz))
$fdisplay(fh, "%0d ERROR: STB doesn't have a valid value (%b)", $time, m_stb);
 
//$fclose(fh);
end
 
endmodule
/monitors/clk_monitor.v
0,0 → 1,64
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//CLK MONITOR
 
module CLK_MONITOR(m_clk);
input m_clk;
 
integer fh;
 
always
begin
#5
if(fh === 32'bx)
fh = $fopen("clk_monitor.out");
 
if ((m_clk === 1'bx) || (m_clk === 1'bz))
$fdisplay(fh, "%0d ERROR: CLK doesn't have a valid value (%b)", $time, m_clk);
//$fclose(fh);
end
 
endmodule
/monitors/res_monitor.v
0,0 → 1,64
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//RES MONITOR
 
module RES_MONITOR(m_res);
input m_res;
 
integer fh;
 
always
begin
#5
if(fh === 32'bx)
fh = $fopen("res_monitor.out");
if ((m_res === 1'bx) || (m_res === 1'bz))
$fdisplay(fh, "%0d ERROR: RES doesn't have a valid value (%b)", $time, m_res);
 
//$fclose(fh);
end
 
endmodule
/monitors/data_valid_in_monitor.v
0,0 → 1,65
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//DATA_VALID_IN MONITOR
 
module DATA_VALID_IN_MONITOR(m_clk, m_stb, m_data_valid_in);
input m_clk, m_stb;
input m_data_valid_in;
 
integer fh;
 
always @ (posedge m_clk)
if(m_stb)
begin
if(fh === 32'bx)
fh = $fopen("data_valid_in_monitor.out");
if ((m_data_valid_in === 1'bx) || (m_data_valid_in === 1'bz))
$fdisplay(fh, "%0d ERROR: DATA_VALID_IN doesn't have a valid value (%b)", $time, m_data_valid_in);
//$fclose(fh);
end
 
endmodule
/monitors/data_in_monitor.v
0,0 → 1,74
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//DATA_IN MONITOR
 
module DATA_IN_MONITOR(m_clk, m_stb, m_data_in_0, m_data_in_1, m_data_in_2);
input m_clk, m_stb;
input [7:0] m_data_in_0, m_data_in_1, m_data_in_2;
 
integer i;
 
integer fh;
 
always @ (posedge m_clk)
if(m_stb)
begin
if(fh === 32'bx)
fh = $fopen("data_in_monitor.out");
 
for (i = 0; i < 8; i = i + 1)
begin
if ((m_data_in_0[i] === 1'bx) || (m_data_in_0[i] === 1'bz))
$fdisplay(fh, "%0d ERROR: DATA_IN_0[%0d] doesn't have a valid value (%b)", $time, i, m_data_in_0[i]);
if ((m_data_in_1[i] === 1'bx) || (m_data_in_1[i] === 1'bz))
$fdisplay(fh, "%0d ERROR: DATA_IN_1[%0d] doesn't have a valid value (%b)", $time, i, m_data_in_1[i]);
if ((m_data_in_2[i] === 1'bx) || (m_data_in_2[i] === 1'bz))
$fdisplay(fh, "%0d ERROR: DATA_IN_2[%0d] doesn't have a valid value (%b)", $time, i, m_data_in_2[i]);
end
 
//$fclose(fh);
end
 
endmodule
/monitors/valid_monitor.v
0,0 → 1,72
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//VALID MONITOR
 
module VALID_MONITOR(m_clk, m_res, m_valid_0, m_valid_1);
input m_clk, m_res;
input m_valid_0, m_valid_1;
 
reg res_was_active;
 
integer fh;
 
always @ (posedge m_clk)
if(m_res)
res_was_active = 1;
else
if(res_was_active)
begin
if(fh === 32'bx)
fh = $fopen("valid_monitor.out");
if ((m_valid_0 === 1'bx) || (m_valid_0 === 1'bz))
$fdisplay(fh, "%0d ERROR: VALID_0 doesn't have a valid value (%b)", $time, m_valid_0);
if ((m_valid_1 === 1'bx) || (m_valid_1 === 1'bz))
$fdisplay(fh, "%0d ERROR: VALID_1 doesn't have a valid value (%b)", $time, m_valid_1);
//$fclose(fh);
end
 
endmodule
/monitors/data_out_monitor.v
0,0 → 1,76
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//DATA_OUT MONITOR
 
module DATA_OUT_MONITOR(m_clk, m_res, m_out_0, m_out_1);
input m_clk, m_res;
input [15:0] m_out_0, m_out_1;
 
reg res_was_active;
integer i;
 
integer fh;
 
always @ (posedge m_clk)
if(m_res)
res_was_active = 1;
else
if(res_was_active)
begin
if(fh === 32'bx)
fh = $fopen("data_out_monitor.out");
for (i = 0; i < 16; i = i + 1)
begin
if ((m_out_0[i] === 1'bx) || (m_out_0[i] === 1'bz))
$fdisplay(fh, "%0d ERROR: OUT_0[%0d] doesn't have a valid value (%b)", $time, i, m_out_0[i]);
if ((m_out_1[i] === 1'bx) || (m_out_1[i] === 1'bz))
$fdisplay(fh, "%0d ERROR: OUT_1[%0d] doesn't have a valid value (%b)", $time, i, m_out_1[i]);
end
//$fclose(fh);
end
 
endmodule
/monitors/sel_monitor.v
0,0 → 1,70
/////////////////////////////////////////////////////////////////////
//// ////
//// This project has been provided to you on behalf of: ////
//// ////
//// S.C. ASICArt S.R.L. ////
//// www.asicart.com ////
//// eli_f@asicart.com ////
//// ////
//// Author: Dragos Constantin Doncean ////
//// Email: doncean@asicart.com ////
//// Mobile: +40-740-936997 ////
//// ////
//// Downloaded from: http://www.opencores.org/ ////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2007 Dragos Constantin Doncean ////
//// www.asicart.com ////
//// doncean@asicart.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
 
 
//----------------Monitors----------------
 
//SEL MONITOR
 
module SEL_MONITOR(m_clk, m_stb, m_sel);
input m_clk, m_stb;
input [1:0] m_sel;
 
integer i;
 
integer fh;
 
always @ (posedge m_clk)
if(m_stb)
begin
if(fh === 32'bx)
fh = $fopen("sel_monitor.out");
if(m_sel === 2'b11)
$fdisplay(fh, "%0d ERROR: SEL = reserved value (%b)", $time, m_sel);
for (i = 0; i < 2; i = i + 1)
if ((m_sel[i] === 1'bx) || (m_sel[i] === 1'bz))
$fdisplay(fh, "%0d ERROR: SEL[%0d] doesn't have a valid value (%b)", $time, i, m_sel[i]);
//$fclose(fh);
end
 
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.