verilogsystem-verilogmodelsimdigital-design

SystemVerilog not reading data correctly


The data read from A_arr, B_arr and C_arr are incorrect. The value I have in Moddelsim is not what I defined in the testbench.

I have a testbench for my design. It should fetch inputs from A_arr and B_arr, and calculate the output to compare with expected values in C_arr. But, when simulate it using modelsim, it seems the data are not read correctly. Does anyone know what is going on?

`timescale 1ns/1ps

`define delay   10

class seq_item #();
 
  const bit [255:0] A_arr[99:0] = {"256'b4d819e7ab429c2225ef8a33bc4974da79b0bd5dbd16e76c1edac5ff9c2c7553f", "256'b55fe1398f5b7d7a377ee1c86b9a7c9c519fa17e7bdac013afc7ada8faeb05f68", "256'b086642bfdb39f7d4d5dc0da19aff222bd073b6ed00feb9ff4b3aae84341c9cf2", "256'b3d3bbdbfd94d00927d83ce631c0a5bb45ef502524de17293a316629ffc39529e", "256'b69f26658990a54c576933b9b257cc748ff35015cfdd636ac56928b252044e8d6", "256'b42820dd7a1eb64cb1d0b2cc65398a3a3533a51debfd7440a32481518233d2846", "256'b71e90d183e649c3e0f0e18ecd50d15891a0c78053d04b8379850c68e26e641df", "256'b2d3856aa3aa5cc80252ab6662666f4a4c74494759e090b14a6a8612736533d3b", "256'b60ef9a0f3aa57b0bb16c3e484303dee485d70356dd07f4a4ce84738da7f6682e", "256'b0c3e37fdb6c0056f166b1ae0d57095a86869a0965662787b079a5bd97a68eed6", "256'b68b7f0629fe5bd5df070238f0f4e344d2b5930a6e7294eee4a294779e97b34db", "256'b549b2081857ebcfa04f02cda514e6b6a3d27cffc693d514f8dc5ccf57fe55734", "256'b11eccc9624b27a4b90bda86ecb0d29b9d60c08bc3cf7b78dfa511e54ac7d1a0f", "256'b30f4b1a28e206932276357e65c043fb41b4c9cab79e52db8213bd38de8f1bac0", "256'b14128749208baac41f1968c58ede7aaca2e6b490ddc2d6de58dcef3bbb894599", "256'b195e1b3aeddb076706bd790592454488326236e54b4e2e23c1f677f4a4cbb4e2", "256'b251e7cbd0f30f74e91cabb75fde9e3351215c5e7ca24344858a3521aaf497e81", "256'b1d80eace1db509d0683993718cff98fb63abe6eb54a825e36bb4c726a623f8a8", "256'b1f1084e77d07e3e191bd9c77415c3650bfbd526ee3cb21e7c95631e6b50349d2", "256'b65194a2da14ce7221f5b6b4a289c5dcd884b5022d15d861f5d785ea64b213131", "256'b117a865de18b54cee464017905fdeaad26637a8b1b1b48aeaae9fd786322b0f1", "256'b53e2649df3d01616e68ab361db436de386302cd3bf9eaa57e921c02bca0f4064", "256'b3e61563435e26acd967f6ce70b073087b37a8d8a9445c50a875aac64ba864450", "256'b47646fdf208901a8045e26f066624ea15fb6f8e81db0d342cff1280720b950bd", "256'b21cea42b01c82193fb45b9137a1e70a8494a822a61be6a63946d42113c8417b9", "256'b608eff3fe5992a883cd6fd649f079cfac4149e94142eee5bed9714f77ce7d432", "256'b2b7c4bf0e5bdf811de31b84edc5366cb7f3a29ae732046d346559b49493d5665", "256'b5ff286bd9cbe16a496ed5a3d9ab6201fda96339ae2e83e570647ed9472abeac6", "256'b3324f2d35f0f3439b1b41b4050a57758f747aa468c8510fbd08c5eae9b5bbd7f", "256'b50c55f5d84821152eae9223fae65119ab0bf1ee131bb03ff0f1dc8860de7e1ad", "256'b6de67d4476db1a07b64b914673b6717368376cfe14ebac4abfecf77026b09a46", "256'b3d95350e77c2d7cc095f1387c47832c9425743609e84375d3a8832fa91ef468d", "256'b006e9345abc5f215650fed99887486a4f03023764ac4bcf656fdc8c709f7f019", "256'b055ba8803f7527f1c5ce833dcf6e3be0495b133dad777067dce668fd786f3f40", "256'b3a7a5fb8c4f73e643107221c926fb63153968cf3362395c6a5b416d58c2419ac", "256'b315c8d03d5fb5071b516f2fe577e7126a27382c4eb57032ee5ddbfce0d6bb9d4", "256'b2543c7e025725a2e333c7ae1a2c872f1dfe4d19722023f022745a8aa7e178400", "256'b1b9e1454aa405091ad3da4cf2c2755ccd5777db330e51177ece4b8b1f1b757db", "256'b5d2f295eb42c5f206717bcfc9ace9a2a70f08166a17c2a067c54a927b0feefb5", "256'b201e1be6de3c921f85c927ee97fe2396ffd4525ce1189ca62b66f091ce0f68cc", "256'b633e3da14f97246890f830cd22c6d4da61979b039fa4ede8b2edaed049161de4", "256'b34ede78c79c58827e520303618ae502219ee8be326ec4db076aac41ed12cf2c1", "256'b17b77fa0fb60d97df55fe79ceb4195c68f86b499b6bc30b71eb7c325edca48ae", "256'b494d2809e30d4394210ebd2efd452405a0b37d5148e19d7572efa718616a5d0c", "256'b6816328384a73da1502903ee716a0dcb594a4fffd9205b23ff12e25b971fdf76", "256'b0be9198db2baab6f17c3aa18e10e3606e752a6ca57cb643e414e1cfc106dc89e", "256'b054e82b90dae38c61c096d2345b805a3113d5b5b46870c78a41824b98ab5d179", "256'b204242ec8c490a6ad617aa593e208a0a7392a0d422dc57b210a73b90d5d4d894", "256'b231f93deed1e3d72bbccdd2c0817e2b0f3f43803f7008a1b40237da130645f30", "256'b37174df94e8c178cf00429250d473575e2c62b1eb6317e1970be65c9f6c68a62", "256'b57a58d5b8a097f8295f05af86251470324248a16949469be2ce3f87e5c8078ee", "256'b0b16357a886fdd4d25860b56b6897292c953784915c42d003530d2c501f80bbf", "256'b394a6108464a81c8525f3fff68ef1b7902075160a334b1fccc72b0d57fb2044c", "256'b0d409c7f08dc8dc81bf626941237aa452720fc573a5d40dbde5672bedd4fa0f7", "256'b5f9dedc765a2673f7ca72f4567c80256d65ea49fc66aeb82e7f2a51ad8a19541", "256'b4f5da57602dd246df2a3ef01f32abe45ad7bdebec8c5f62ec4c12f13622ba306", "256'b0dfbed85da173532f48f2d3814d7baa6ad4d3a25ebc7b85af4afc0d345659f8f", "256'b558019f96841ea12ec50e9b2b00754dd1f4e4cea5d258db0672ad191f3a76c7b", "256'b1194eff3de771d6f57ce9c87d75eb990a095f0b05e4c451fa277116155621e65", "256'b42e3626f60679fe85a54a09f80b1d52f48f7694a6c2001c927beb68df6190453", "256'b6cab27b1464227af00eabb7a4dfeb3bc4161ba65d68ce9c4ac632cf8e75b5e21", "256'b37fd3fca521490232953207650d9cafe14a848d4728188ca60465dfae4d9e9d0", "256'b3ed4c30d5166ccaa811356efab711e5292b32222cc886c649279618ddd05ff68", "256'b065edf47e1c0fe576d1129196794cbf118e2e1763546cf9cc3d109613c5dfd7f", "256'b6cd7766761fb6f3631c31e8074cc55fd10401e85f978e0fbc325fb8c6053d87a", "256'b61fe2585b217e2c08d3b9898ae340bd061cae9ccc0ad933195aea3f0eff38574", "256'b5043d24841b89f4c1d0b53df3c7374148f7be7353d3be442f9ebad4af062c5cb", "256'b15458ffeed3e85ec3d34bd4b48e97234a8670812797054c7615fe75bf5387070", "256'b3ebc0d97e72072763bbbcaca0a1d0700108234f9df5b8a99761f663392171b38", "256'b31533ee2f6283963eb76256078367e1bcb9341a6bbdee7c0803a5e703779d873", "256'b18a7861eb50d061cbe5793c9b83e443af8488f55be5d713778327c18b9915737", "256'b13d3d61057deb9487d6dfc86d3d48dc3e0d0a5f8e040dbc9d07a177a5ba880f1", "256'b59d740118f767b614738d0cc710c028b026964f384a1074e5ac524c34c33b625", "256'b60cdf4fa673792a8b53a4f8b4bcd3cf2a81a1a075691242c2573e04416889f26", "256'b38defa43b907ad06473fcbf4a5c50ff78162a0f5e934cfd72d25c02fba5c6068", "256'b4757221b4edd99dcb5318160c3ec298486b246b8504bd5cf9b7750644ac2072c", "256'b54069d5ac59f412887c322110cf6d11176aa7e03f6d437d6f485eb38470394ca", "256'b14b39bfbecb1945ff99b72a736d3768a253425ce90fef6abe8d7f475c91704a9", "256'b168c4103ca8bc1533ef22cdbf14259df32cf2dca6952c7cb00ce9f501a1e77e1", "256'b0154ea6cc6df3e365ffd31278429257b38677f99f11ca0059535e822cf5d5326", "256'b5c609c64f1b685762fc2b59ff720881d02112c13c512ad202d74b5c927563ffd", "256'b47bcbe6d988974d08a7fb4832ea6d3536846944a1f3dfe8b8e12ef1835ec187e", "256'b43f3ecac4e0319d5abc5323b455ecb55523e7f8e89ee49e402a75e19a9e6a990", "256'b3b16e0677bda26a3dd29efb203ce71136d86f9135e5c59cac7bd76746aee5225", "256'b151e2996c26e7ad48d3b4ae98c12f39284e3a8f106fb867a1450ffc51e3b6c24", "256'b3b49a357f3d996172d2340c15524ac32bdd2b535c1b967b923828aa4f97b5603", "256'b6578b43e59b00839fb2f50ca17c0af8ee63a27691d0e1f1a4aa3b13776110352", "256'b3600e8ab413a2c01ddfd2723abeed4969b8a448ce3e1aefc4e5987d9a1cf7a6d", "256'b292ee354b09c52fde7c568a9d81c143db2f86e224e64f8958f2addac4b3b89c9", "256'b4c01fb47fb6c5990f1bc2deb46caf7557cb3f543eb67212cd43d37c8a2be07e6", "256'b6ce671afddef76d40a0612d52d3ee2347e885b6a1817162d9357e36790c645da", "256'b148e089570214248fc1d33330181ff88d7eb8b87286be22af9d839b157ee0794", "256'b0f9f01f60a21225d02ee8d17fb3750226840435640ea13f0621369f62460650f", "256'b68b40a5a5f5313aac0730afdcfbaf63a70528f26d363cb3ea7d99f6234dd0f8b", "256'b214fd3623fa1b5cfa2c19e3b90751a95bd11f2c5b6e6b09adfc7e8d544a670df", "256'b1549f727bb483ca31b2e315bf299ff16469780e44c10c3eaef9679cf8b9e2d10", "256'b4a35d84f509741dee522a7f7eae73c9e8faed16293df53be46662c5ac580cfde", "256'b26d9f06f5b6e8962c553e8475f6879d0582c4ab25837546a618b66b7fe240194", "256'b30760fb9d6d609e1c9f5362fcc1b51741234be5b87d96e6915828e38a53400c1", "256'b14cba8f3db57bee398c86a6ec7610a995164bbc31492726f35a73668b18d06b4"};
  const bit [255:0] B_arr[99:0] = {"256'b5c42d309baa783df1ba99427489b16e0fcdbec0369555d48e8ba85464c35dd3d", "256'b597de73e95ab6daa6cb79aedd21eb58b98f92739ba3e5b1924b1239d2f773b84", "256'b107fe24c559036f85ed1e5ac250f403bfab981ee4ebf6f8836d9ae3584570db7", "256'b33d45978b1d25ba4fa764b1720b2791d69a696dbdd8d46ae416a3bf46afaf6db", "256'b2d9c86d37a54ec23d127a7ea85c7a7b0fb9116c8ee974f9c48ddf1f110be3116", "256'b4c327cf256a8a0c689fe03aa9a69f0252e1c3f6f56985d288ab4a2d081112cc8", "256'b3b0a7acf6330b9e55ec8b1924d5229351e46b91384c6205087f4012ca728ce6a", "256'b53ec2099b3728db776f713a56909600de5e814ba9e507d7b9ff724e59bc6bf26", "256'b25a6b74288d1c6aec6bf0828ed7c1ef251990a689fb7af5a3fe4df24bf81b245", "256'b71ac14a2e2e213953d57ff2cf9be14660fe9738fd150f009bec16bf3486886a7", "256'b555c22a6072cc0e2400ee0c80dd62d4d0d913a638106c59f51c56e18076c7584", "256'b49a9a5191ad30e494703cbeb0189e661121a60d3a8bb57540f0a6489af907740", "256'b1de0f81bd0f74918c2d276a8218b665e87842e4811c694fe2bf4078b3fcb6941", "256'b271313ddf62965b161cf8faebb35e1e7303764b741c8e4bdf9698cf3e50a5c53", "256'b24a8d84d86142e90e51679e9a4cbd160136ec2d51dc0f1382be677f7ec558d74", "256'b345e97278383ac4522c87c4d66f6f08759e419defa675d80952e4a54c0d77578", "256'b28e96fe0d03c6f3bb86739728df1853e65fee334228731adf404cb467e19f7bd", "256'b68cbded27998aee9a95158adab9a5936b146b5f0d307109e7d5aa9eb893bd9f2", "256'b438bd28a967e876b7e791ce8c36c9e0fbb03a0bc773eb8af3db1c8c37abde67e", "256'b0bf728fbc4f145815a104fe7cb73c07949eef5413b60a04897ecb4d843f5c455", "256'b6374a4b256ee40b3f29db52149cff963e7f1769b0f12eb7415bbd94188c52deb", "256'b5de63d47a072b96aeb5926aa7f3bce20cf49a35afdee526e6dbfaeb935a4b42b", "256'b26cdb1029981feffc0ea9ca221614b127d46a4fab4170559b215aee09fcfa737", "256'b550ae61f58569e8d76f8ac06943f15d31f7249356c4a00f259732d301ed94ede", "256'b2ba42e2c99616284f69499f12964a4bbce075b300c7d07a1c605a55d2376b872", "256'b31d6957be8f91a90d70d280b3bd89ddf459685b8ad8c621754254925ab9ec6df", "256'b07c058c8ab8b76fcb27b5fa8cc22c11b76962ad5f6977d8dbf95729fd06bb115", "256'b07d25461f1092b537e9891ba39607c71ee3c892ee66b9afc2d90a9af6a846892", "256'b3bec8f166758db65fea618b8634b812f91fe56a9bb8ec968fc71b75bb144065a", "256'b422d4ac4a09c204fca9287bdb86d35277b43d9980c6efb31d65ff2d08902b355", "256'b000dea5ebe004aade244eb36ed990bc52dfabe5f05d0be441490626ecd1c0fb7", "256'b0ab9aecfd98d54fdc36ffc81319191e8edc5a7beafb433ecf373eb995cccf046", "256'b6312d6b42995f548c7dd341accb97f0eb0202beed980593a2d63e32b55ffe202", "256'b1ee95eb5e8bc355f15aaab00a335574e3d73d15363ec73ac1978edd3381a22e9", "256'b38acec696e51532ccd74c014a6b235721652d6ca3bee616fdc9409ca9722e72f", "256'b03de06fcc3e3c4ffccfcb9f99eb824579227d0b9377a1127182192b3aa74f561", "256'b30a2f1821ba44bc222a818634e9b75a32c741c11585dfeb10341fb2738dc416e", "256'b442c13d0459a45f1fd56e954c663aa30704ea3c1f437d3c7022c71ba69103010", "256'b28a31aa8f040acf9433fa5f6db294450f705f5116ac45544367e743f025e4027", "256'b0107f96491fa7e3a73547e4d8a5ec3dda17bfbf6be8653fd79bc6e6dd559b2d7", "256'b0a8449fab1264d7ccce8601db47b50c02602c796be735672af34f570aade4789", "256'b52378d068462843104f031500b49f8bcbdad8714b40d7115dc2e25dd89600473", "256'b4a193d779f2fb04e2c591ea15b845fffc0ae5107dae40ae8397146ded0a0fdcc", "256'b3d80c7816d2d8b486b918da1f865da5f29d3ba63f09d43f425803a6631aba07b", "256'b59858690f0b3fe417090d2e89258fb99bcc4469ba93a05575641c37ef02f85bc", "256'b1dd3e26523f86351ecf5fdf8f16c1054a6b2eb950324a30f8c40ac9a76277bb2", "256'b60fe7d6db7ca49856acdac79f9a7bd41637f2f2ce32c962427a4f3e352b9f6dd", "256'b1a8b8c2d0c087eeffe28c920efffc0c5b711e9abd7eb45941ae33e953bddb686", "256'b550dd980924f9561d1300f2c7dbe6a917da6cab076cb45ba6f4e34bfaa13d9b9", "256'b06a548368db426938958950907b8eb72ea68db43d249a0580cc949db05df8fec", "256'b0ab34576fe66a9a623db893dca10d760ee368595420dc0d2f5ceb04307e938b7", "256'b7364caa0bad4915c8211752a0cf0886a5cdb6f9bb4c71f08a79b8e01d047c367", "256'b256a2f0004301a843ace9be52c8e3037d56d4351ea701796ee8e69c3d34bbd26", "256'b2cbcbe9b8ebf3c9414e597628bcdf602aadbdeffdc7b8a6189cb7fc4b330e7bb", "256'b5bc90b6f7999d678945fa816d5d47a859fc6b4e4e3506a12f4c5fced8169482c", "256'b11519cf5755f82345d3e4949a93b36bd931fc878dffa29301359457249d9e8ec", "256'b54f3740d17576f2f54751f92376bb29482f40b659849bb3396e51dc1ebe75078", "256'b3a57314b0bb55ef2ceafeed335df2c9b26ce9b6c004bf533266582df863f422b", "256'b2b0362ff89d6023bd767566d65eb05ce1ce4253cf56ee3f1da5537d7685ecfdd", "256'b0a0d7df749e530b2d12ca662b5d0707b95cee36c9dfc35beaabd4565f0ad7b31", "256'b5241fd2bae47106382c9e5d98c832fd1d9e0f62ed5879fadaf41a211ce2568e3", "256'b0e5c116ee07889c2215ec731d7295d8c8264691cd71d6ea4e95d93bdfe4ce66b", "256'b5425d2f12e6c5820b872bd5f2210f5c05f227406b057bc1b606a14291bfa9486", "256'b4d4081eac63bcb5ef4bab57abc4ca92921d1cba918428d6288cbb04d24e774b6", "256'b3ec8ed262a105b01bc530ef5a22209c0e698b3b8f9d39e6c49c39e9cdbcd43f7", "256'b1e08e816e21ac44a0da3e71f9cec9ede3a7a47f4877906e9cf47497f9cd67cd9", "256'b6a6bb69f1185e3bcc6ed025b332fa427df9c6c0132c4003ff112a023a4ee6a77", "256'b1500b8050e8d2c17fd642c19588c2552efbafc5ec29a1b41f06a6e0d2fbfa161", "256'b32e870f51298eb60b61ba59e220147db000881c1064dc3eb22d49a0b9f6be9c3", "256'b2be6b5f385e0766fb88e3df36245ba152a984a6f793ad83675398bdb46203515", "256'b3e30a5bc0c6352855dd2bf4062f79a1fcd916b2ff343cc84f7864a6069e61b21", "256'b1aa4eb28bc908435305201f9199ff1712bca244d60be0e2e8c32c9c319bb954f", "256'b0ce53f752b73fd42e814a837241716c1640839feceb6528a47173b94e3db0ae4", "256'b62d52aba10917b3469dc8588ccf5f14278a59dddabec54bd1abeb7653682a552", "256'b1423746a387de2713cf533ea5b1b1854a2f574b27d79f8bb4f6d7411d71a2e49", "256'b0e9257219c6c057228241242f95ec4321e4b7646b7613a1af19c2a9c3d7465eb", "256'b51b122bf749381d45b61732e9bd3480dc1833fe7b5e948e41e1656369aa3ea85", "256'b5d0d9a8019891879f96f93ee4399781a38dce19d9f3225ae75e42c1d3e76e5c3", "256'b4750d78a185cc5d0bbb51feb9474d6d1233a7d68a89b5b5d251fb805e58235fe", "256'b0baea5625a9a0488788eb0cc21fb0977680313df2d477bd590c9c2605c280bdd", "256'b1eccbbe0cd7763bc7c3557e5d334d7e30c84cdaae1ceff2e36eaed996ce70d77", "256'b2d66eae28d50411929e348d37d45ee4c37efbdbe4f391d1fe7b6664c9522f90b", "256'b3cd7998e759b6b934c45a1693f3775fb79161f5231e0971d2c290bb13b49a3b9", "256'b1e7fa57f1fc3591412eaf4dd46d01622f65977afcd196e6bef0299991d6e7b6d", "256'b435a9b81b3a90810dc103d45ae3f491cd2df443813328d5258d0166e620bf7da", "256'b55d334dff5487746955cd77933d3d18c434b4e06b174fd55d46eff574ad00778", "256'b3a3022d7ef16610b83435ad66d81c7f9fb23d9bdd6df3ce603afdc85dde6aa65", "256'b29491795cebdc078abfe1b53c10335b8c80598fe78c0c4e2a5c22f098c5e36e4", "256'b6af5bd124b45355a25f86924353fc7e1cd929ecad1a0271175285997c416b416", "256'b096a577c46aec8f54c413edf8e4616548ad4a00c71cb2197cf0ab3aaa6868afa", "256'b104858e1ef9f18b965810eedb54b87c8f503b447919b89dc5eedcee643c0600c", "256'b22ce5c28b7e774d12fa74363fb6a5c942e834b9b80365f5c8978a2ec167bae19", "256'b073cfd8c2e3af4ce27c9c6693fcdcecf6e4c9b7efcad9e082b5071fc1c933557", "256'b1ef08867a40348f4cd2ae64fc9c4f150e317b1013efe97b6b9709ea499a7cbbe", "256'b6a286f603e645d13ac3115e88ec4d7bff027cf509f907d1c9013f99b61356c7c", "256'b03dbce3cd014075325b3ca2115da7c0b00f4836f7d2bb1873ecbe092c5fc8152", "256'b19d55e238c13f9758d2d972cfa40a175cb36b34fff946ce49c7eebec3492d24f", "256'b081e423e6bcaae816a376b5648bdac4902805ed26212ce14ec9a707781b9f87f", "256'b723766d5ab86bf49e3517ee32f04cd1d319394ca8eae2a52b1446173d1079fdf", "256'b39afd3bc25b40f17561769f96584fee84052e89129a4944d23b4c62c68877d8e"};
  const bit [255:0] C_arr[99:0] = {"256'b34327a00906513cb9ea8f4744c0eb83e1963623fda52e46df2afdaa2cc3f3d8e", "256'b53abf6938dc9cd32e64007567624e90690723a224e3e36fc1f1a09fb4b725913", "256'b437610d94f5b557590187c978ed7e2c3ce668eae6aab326021c1bc7388dd8602", "256'b2f69f663be313f5cade6d28cad1a35fedcfb310d75424cb4ed483e279072f9ff", "256'b03c84bb643d3a967fa6b1876e28e7ca244c22f9f65c1e81ba9ebb83ceae18b5f", "256'b11f2d28a2f02fb1ff3e15a5c534d6dea57aa4641a2161b1e5faaeab23acded12", "256'b2422e5e41149c8c09cd2e611c3fd105889e5c21734b120364ac352069d16461d", "256'b0ead79dfab047fc6dc17eb8da684e3b2ef014637b7aa28d6767fa7cbd8b2b1f5", "256'b17a604f9b219b3a0a50146106b1817433cd3b19a8146ce930a1a7344c85767be", "256'b22f4fde719e12876d5352cc2d1aa0aaf601eaef587b69c87cb3195e277809850", "256'b26c3341fe7353a8ec96d459f4f5bbeaefe607575719442ba51aa5ba032d65d53", "256'b1755ac6b2f6404b1162a256be3ec7f2c4f6276584005c3163635cf4e2f068a21", "256'b072e76c2a78905de1adc263f2feac2df35e99e87017fc6fad10800673744562f", "256'b462d4e7be354476eac66c76b0be372793fe7fb290731ccd32e0a12e923507184", "256'b5f4581feeb5dd2d6aaf08ed789f89fd8b7a32962b2297556b6802e3a03855116", "256'b080e2eb3085f0ff76a72e0336ea8f56f1bd78f07af8cd341fdc71707cb989c72", "256'b508ba73dc9f4e00734ac895408beaf71ad1397176bb7b58a86d859f7978bee22", "256'b109aa67b27af60cd49a05ece45d0dd32daf0e2923a1420a332a355e3fdc83fda", "256'b3b65a4f943eb21251b02262bb1cad565a003cb617355314cc48d8be2101d120d", "256'b64e36ab8534ac8f1bf2d5ae1fe9a27293b3092a536dc4a4c225f1ee756c5ccbc", "256'b0776cac8a1bbbdf7683832c8d1f2511da1eb36f332a04987a904d0aea2dcc1c7", "256'b077b29839e485b211a5d2f74dddbcca607c922c3a29f0e31ad3b8cd8cd9c7b94", "256'b3f344320eb97d1fd4c7c8fca4e418afff399524f1d8d250cede39dda41e47a15", "256'b6fcc5ee9fe10d443a885d06733adba1881d136129bd833cd7833d6f39cf8785d", "256'b4ae503c641501d21eb6d8a4fd87c3eb2ddb36ce68ce832657f61067fb99f1c37", "256'b58de0fa27779b5bd660bb2cc985e4cc5dfb3783ca31338fb10e30b41f5012d95", "256'b0b7980932912d91cefce62fa0dbd396eff023f87638368ec8aad8df0b468662a", "256'b314363d14dc82a2ad3e9d318db3d788cc3c5b3eaeba77b1fe6fa787fd1b185c1", "256'b11208c3ff30748b5bbe5d93c9a9dbbb881329c4445ad69efa086ae8ca5a254b0", "256'b1bb09eebdd37151e9a65bb06c5b748822920b034e4647ff6d642416ff1d321f0", "256'b5442cf1d3bf7afbcc08f9eddb31e265ebf3340b335f339d03d69966c00b9e2d6", "256'b3629a8ea7afaf2429b52aef08b8b83e72f85079040bc84b87b573335d75272e9", "256'b6939795772e25839e45608a90de00e705a8d94c96200e17446476cacdca8bb7f", "256'b27b2b377f7913a50dd297969895e98bd688ea7753385753572d38ec3221bb297", "256'b607bc15c766cf432b358c6e34c15babe5f99907f37bb44a716f73fa72f7458c5", "256'b19174f019d3548e6119b9381864024db10c8bc31be6757b675ae080b6dbf7ab6", "256'b70411d368b8ba6c37aa4429f6e79f698239c45137321be09d14c573665c34943", "256'b0b00bff7d9a2c32feb7eb1f22a80d911de9ec929b7eeab0680085becebf8565d", "256'b28d2517dbc7c6e4dfdbdf0de78460433ab69acf526e800a1f520816d98cfa6ca", "256'b60c6dcb0b4abaf05a5be988580b9fae353e4aa87b43ec9f759b7682f3ddc552e", "256'b06ef8d4bb21f1146f3000f3ef5a0b48a284d590789773450cbee43da5dc67690", "256'b709183269846840d2cbeb8673c62659889d0857b87fb9d8453229f255befe082", "256'b6c1eb397fd64105908269947f50a9425990d2fe75fd85abed781df69a573d338", "256'b6f4a0c13f11bc06eff2c47bd6b9905f8ff8ce24b1e2b3edb0a3eaa4971e57c51", "256'b317e8956c7b8624584e6171d6af0e8a648861612110fdfb9df11b9bcf7a93ffb", "256'b50e2518c7d4188c271ef33e547df898403dc0c58cd17d8131a84e145235efaa3", "256'b6efdbca4ec6eab39d9a2c6acdcfe369797fbc95fc4adf7f9897206f3069520b8", "256'b48e76c4ce7c85cb77be7ab0c29fe50b1d7c23c6268c9f3bcc75d22333696abd5", "256'b136dfa8bc39c4f6560de278e5a584b94c27880af68895a40ff7eed9b88c04a43", "256'b04d242256053ccfc24cd71ebd3a1ff1319ba3741aef2054551c5cab5347c59cb", "256'b717c4df90279332fcb72bbb2fa14e6307f69cf9baf8e1a4caa531b5ef35d1b15", "256'b31c7e1426b8a538431ce162a0d97147ab44521c939c3da27bb1bdfde092f48fd", "256'b4b9f961edd83a9bd9f5d4766410b0ecd251d2ec31c9f79aa8a3e3e9a2f53ab4d", "256'b4e0ef4c1004244fbb7df5b465a181f0aae0f51fd45a238dddbad0f64a2a0c066", "256'b289ad78dce4ea17d780605890129c88b696d68959bd6ab5fd9d026e81e682481", "256'b68d25912504818666f162fc90d5bf595a00c646db6303071755f05813e13311e", "256'b1947f6a094ff620a0b7576a561ac59dec749860747b7defdda644f8890ac4c64", "256'b6c93a83bf23e29efd1519fece45eac348435ef2dac98214ea3a95b351bd21202", "256'b0bc0311e26c0d96556001fbb32637ce566a67d52ed3cd7fae05d7132c214c563", "256'b661bba316be1cbd859cd97a1fd79e56f8721e1732a49ce83c9760043204de346", "256'b25e52cbc2b244dace176e80e0331662d46d06c0bad1ca2d199704aed8a2331bc", "256'b1120987b2941d1f4db800d83a13410544ea7a1227a82248566b434a9083a61d6", "256'b40718171210a8eff265787da7c312c3c46c571a109dd7d13ac1660cd16cf5e41", "256'b0d52f35feb03ea850ad5c7377c5d3082165c3b0921620c63df6c5c0c668de16c", "256'b488d82cd958374ef1317a9098bf239e90da44c4ccbf3875442d67a7f9860246e", "256'b1fba103d9cafb6e5eacde28b93e29f66962a44239f8fb64941aefbfe0e7a848a", "256'b723d2abbeb382a75fb24c49de647cc560e5ad26d31a30b1f0a1201a6a906d55d", "256'b580f0eb4a0cfc5bc020916874f62d56ba73148ffcd0d590fbba1f7406a4c4449", "256'b25c46f1cefaee864ef0e14d6acfada1a4d27a96b456bc3d8a620a44dadbfe5b0", "256'b62152735013d2569ab411565b99d947bb5b68529bbd393eb8ac89119560b7178", "256'b45a2dae6f5dbf15b2cfd4a4271d999a1a16072f39798fa643114444e2282a9c0", "256'b309e7204835c5276ec12b520c0a16e383ee651e489d83276b55bc3ca6f3c5c46", "256'b1b3289dba74858d412ff81638787307380effc56d1640850f72033b66f44697b", "256'b0484669273809f335987578160838c56c46e04c931e40b3089d553b31a60473c", "256'b05aa54c2c0e02127a9bea8bd879f30a8cb15d796f1efc39cd7f571789c73f9dc", "256'b4da41262f54cf44645ef9b4f27e07f20357510df117f55f5b744d8b758d814cd", "256'b5deccb701aa2be058d0617bf9abb6dc438dc3fef737ed33c212e1f6a0fc6c713", "256'b6a9641209e092ebf96468f8d5008e2b3c24c7f1a0afbd368808884c4353d10f0", "256'b06d4f20d3eeffc1fdeeb6556fc9cf8646d1addb9604298fe6bf8135b03585c61", "256'b6e7eee94a5d1c6d798bfac81ccca7fb3918438dd74fce0ae941d1cc10bfb93e9", "256'b00640396b45ebec7eeed2d4743be1f9327ac921e5eaf7ba9ebb184a51ebf9634", "256'b492ebf14ed50b718891a42064bc42d4d3fcc54c39604d91805cc1fa5f601f370", "256'b4c5510e65edb911b5d02998150ae996d81688b12d7b94ecbb85035129422d105", "256'b4254acd2b39cec2cc1a55c398e4d91f9ad2caf0a774adefc8f581e8056168ea7", "256'b47128f25c26d4a5defa739bf754ee2decc95c3afe292eb12b10cc753a86923a8", "256'b37f160d5d6c4798d023355456f3f8790fea534ba766a9d26ac3e927ced43f6c9", "256'b1966906b9e703b408732f8873ffcd72f1a1f2586f903f8de224e9f67be1e56a5", "256'b2322c31397a2f3ad14c3c52231bffd59c215fe5bee149f870ea80391aaff9ea5", "256'b14102369b0b51f0173bd431affc33311a39782f7d640d5d1c032037d73757ae9", "256'b0eb22b5c9807bed387b2ff5a65e4fe6d4e56d3deedf94f3dadc2a3f01d18934c", "256'b0a06d6390ae9c681e4847112fd29e01bf55186a8f18d9941493c10b7bcbc782c", "256'b09c47b3976182ead38564c4371def2d6aa1c564acc2b1677b7afd9682c7e4a94", "256'b1a7d7585266a27f25b2e27627ecf5f72784d74941f0023fec5ee0a9bd4d990f9", "256'b0729b4238ce7f40bbdcc8bb4f9d261539a137c5d565a9b6fd33289191f950bc5", "256'b3e355d313460dad4dbecaed8b61f7c240c14fdc4c477c95ca4345dc30018c075", "256'b39b3d0514936e025875ffb70b7fb7556a11bcdd2465f27e373b6ea365281fb3d", "256'b192fb82638fcfe3e781304fcc807c3807e96b4775411e90e9442c89e3564d6b0", "256'b43472365f2c4962a3e015868f5a37dfa1bc449ca5dec33f1afa9e477da8e5c1c", "256'b5e21f076f2eded1c652163e7559e2c0eb36734bd5bdbdb20f1ab30c965dc0789", "256'b1d5dd14cd8f4f6543eb2769a47ba5d34a8bc5eead85b9864fcaf1284430bd9fa"};
  
endclass

module Mont_tb;

reg [255:0] Expect;

reg clk, start;
reg [255:0] MontA, MontB;
wire [255:0] MontC;
wire Montbusy, Montdone;

bit [255:0] A[99:0], B[99:0], C[99:0];


Mont256 #( .inv(256'h8fac2de6599e1a9fa53ddf925918fe6fff2d6e9209dacc5e13f75b68fe75c041),
   .M(256'h73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001)
    )
Mul
(.clk(clk), .start(start), .A(MontA), .B(MontB), .busy(Montbusy), .done(Montdone), .C(MontC));
seq_item #() item;

initial begin
  $dumpfile("dump.vcd");
  $dumpvars;
  #300000 
  $finish;
end

always #50  clk = ~clk;


initial begin

  clk=1;  // initialize clk
  item = new();
  
  for (int i=0; i<($size(item.A_arr)); i++) begin  
        $display("Test #%d", i);
        start = 0;
        MontA = item.A_arr[i];
        MontB = item.B_arr[i];
        Expect = item.C_arr[i];
        @(posedge clk)  #`delay;
        start = 1;
        @(posedge clk)  #`delay;
        $display("i=%d A=%h B=%h C=%h", i, MontA, MontB, Expect);
        while (Montbusy==1) @(posedge clk);
    
        if(Expect==MontC) begin
            $display("Match A=%h B=%h C=%h Expect=%h", MontA, MontB, MontC, Expect);
        end else begin
            $display("Error A=%h B=%h C=%h Expect=%h", MontA, MontB, MontC, Expect);
        end

    end
$finish;
end
endmodule

For example, the first test should be A=4d819e7ab429c2225ef8a33bc4974da79b0bd5dbd16e76c1edac5ff9c2c7553f, B=5c42d309baa783df1ba99427489b16e0fcdbec0369555d48e8ba85464c35dd3d, and the expected values should be C=34327a00906513cb9ea8f4744c0eb83e1963623fda52e46df2afdaa2cc3f3d8e. But the values modelim gave me are completely different, and they are not even in the pre-defined datasets. Value I have in modelsim: A=3531363462626333313439323732366633356137333636386231386430366234 B=3430353265383931323961343934346432336234633632633638383737643865 C=6138626335656561643835623938363466636166313238343433306264396661

Below is the waveform

Wave


Solution

  • Double quotes are used for strings, but you want numeric values.

    In the class, remove all the double quotes and change 256'b to 256'h:

    const bit [255:0] A_arr[99:0] = {256'h4d819e7ab429c2225ef8a33bc4974da79b0bd5dbd16e76c1edac5ff9c2c7553f, 256'h ...