1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00

Adding siganture checker

- Dead simple, just recreate the same lfsr pattern at destination
This commit is contained in:
aolofsson 2022-06-27 09:28:29 -04:00
parent 5076694f60
commit 7ba6be5a2f

43
stdlib/rtl/oh_verify.v Normal file
View File

@ -0,0 +1,43 @@
//#############################################################################
//# Function: Signature Checker #
//#############################################################################
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
module oh_verify
#(parameter N = 32 // width of verifier
)
(
input clk,
input nreset, //async reset
input en, // enable counter
input entaps, // enable taps input
input [N-1:0] taps, // user driven taps
input [N-1:0] seed, // seed
input [N-1:0] mask, // mask output (1 = active)
input [N-1:0] in, // input data
output [N-1:0] out, // generated random number
output error // difference found
);
// Recreate random number
oh_random oh_random(/*AUTOINST*/
// Outputs
.out (out[N-1:0]),
// Inputs
.clk (clk),
.nreset (nreset),
.en (en),
.entaps (entaps),
.taps (taps[N-1:0]),
.seed (seed[N-1:0]),
.mask (mask[N-1:0]));
// Compare random number to data
// TODO: add
assign error = (out[N-1:0] != in[N-1:0]);
endmodule // oh_random