From cc56cafbe5d1e8b426bd8cad618df73ad0608d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Mon, 29 Jun 2015 14:06:11 +0200 Subject: Added testcase from c model that tests montprod with a lot of bit twiddling. --- src/tb/tb_montprod.v | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/tb/tb_montprod.v b/src/tb/tb_montprod.v index cd27949..9a6d2b0 100644 --- a/src/tb/tb_montprod.v +++ b/src/tb/tb_montprod.v @@ -351,7 +351,7 @@ module tb_montprod(); input [0 : 8192-1] expected ); begin - $display("*** Mongomry multiplier test started"); + $display("*** Montgomery multiplier test started"); begin: copy_test_vectors integer i; integer j; @@ -420,19 +420,19 @@ module tb_montprod(); begin : short_tests //* A= b B= 11 M= 13 A*B= 10 Ar= 9 Br= 7 Ar*Br= 1 A*B= 10 - test_mont_prod( 1, {32'h9, 8160'h0}, {32'h7, 8160'h0}, {32'h13,8160'h0}, {32'h1,8160'h0} ); +// test_mont_prod( 1, {32'h9, 8160'h0}, {32'h7, 8160'h0}, {32'h13,8160'h0}, {32'h1,8160'h0} ); //* A= b B= 13 M= 11 A*B= 5 Ar= b Br= 2 Ar*Br= 5 A*B= 5 - test_mont_prod( 1, {32'hb, 8160'h0}, {32'h2, 8160'h0}, {32'h11,8160'h0}, {32'h5,8160'h0} ); +// test_mont_prod( 1, {32'hb, 8160'h0}, {32'h2, 8160'h0}, {32'h11,8160'h0}, {32'h5,8160'h0} ); //* A= 11 B= b M= 13 A*B= 10 Ar= 7 Br= 9 Ar*Br= 1 A*B= 10 - test_mont_prod( 1, {32'h7, 8160'h0}, {32'h9, 8160'h0}, {32'h13,8160'h0}, {32'h1,8160'h0} ); +// test_mont_prod( 1, {32'h7, 8160'h0}, {32'h9, 8160'h0}, {32'h13,8160'h0}, {32'h1,8160'h0} ); //* A= 11 B= 13 M= b A*B= 4 Ar= 2 Br= a Ar*Br= 5 A*B= 4 - test_mont_prod( 1, {32'h2, 8160'h0}, {32'ha, 8160'h0}, {32'h0b,8160'h0}, {32'h5,8160'h0} ); +// test_mont_prod( 1, {32'h2, 8160'h0}, {32'ha, 8160'h0}, {32'h0b,8160'h0}, {32'h5,8160'h0} ); //* A= 13 B= b M= 11 A*B= 5 Ar= 2 Br= b Ar*Br= 5 A*B= 5 //* A= 13 B= 11 M= b A*B= 4 Ar= a Br= 2 Ar*Br= 5 A*B= 4 @@ -453,6 +453,16 @@ module tb_montprod(); //debug B => 0 0 4000 //debug M => 1ffffff ffffffff ffffffff //debug s => 0 0 80 + + $display("*** testcase for montprod with lots of bit twiddling."); + test_mont_prod(2, + {64'hffeeffee12345678, 8128'h0}, + {64'hffeeffeeaabbaabb, 8128'h0}, + {64'hffeeffeedeadbeef, 8128'h0}, + {64'h0068e96e67b14db3, 8128'h0}); + + + $display("*** 96 bit test case.."); test_mont_prod( 3, {96'h1, 8096'h0}, {96'h4000, 8096'h0}, {96'h1ffffffffffffffffffffff,8096'h0}, {96'h80,8096'h0} ); end endtask // short_tests -- cgit v1.2.3