// https://doi.org/10.3390/cryptography7040057 `timescale 1ns/1ns module modinv_tb; reg clk, rst_n, start; reg [255:0] b, a, m; wire [255:0] c; wire ready, busy, ready0; modinv inst (clk, rst_n, start, b, a, m, c, ready, busy, ready0); initial begin #0 clk = 1; #0 rst_n = 0; #0 start = 0; #0 a = 256'hd5076ae274e874c2eb0f7778717c39460236549ddd9fc651e68a0c0e787b4ce8; #0 b = 256'h9cfa1c993911914be0f15bd74a878abe0079c6254b961b82e1abda76387d1d85; #0 m = 256'hfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f; #1 rst_n = 1; #2 start = 1; #2 start = 0; wait(ready); #40 $stop; end always #1 clk = !clk; endmodule /* a = 0xd5076ae274e874c2eb0f7778717c39460236549ddd9fc651e68a0c0e787b4ce8 b = 0x9cfa1c993911914be0f15bd74a878abe0079c6254b961b82e1abda76387d1d85 m = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f c = 0xe8e5ac2e1d3358894ce1b3342737b38c39b89059dd55d3c4741626de8270228e */