From ed8d29ee2cbb5ba9a4247a7350d2d0a6f65480b2 Mon Sep 17 00:00:00 2001 From: Andreas Olofsson Date: Thu, 10 Mar 2016 17:03:38 -0500 Subject: [PATCH] Fixing serializer bug - SPI now working... --- common/hdl/oh_par2ser.v | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/hdl/oh_par2ser.v b/common/hdl/oh_par2ser.v index 270a3b2..6e723cb 100644 --- a/common/hdl/oh_par2ser.v +++ b/common/hdl/oh_par2ser.v @@ -57,16 +57,20 @@ module oh_par2ser (/*AUTOARG*/ if(~nreset) count[CW-1:0] <= 'b0; else if(start_transfer) - count[CW-1:0] <= datasize[CW-1:0]; - else if(shift & access_out) + count[CW-1:0] <= datasize[CW-1:0]; //1=1 byte + else if(shift & busy) count[CW-1:0] <= count[CW-1:0] - 1'b1; - + + assign access_out = (count[CW-1:0]==1'b1); + //output data is valid while count>0 - assign access_out = |count[CW-1:0]; - + assign busy = |count[CW-1:0]; + + //wait until valid data is finished - assign wait_out = access_out | + assign wait_out = busy | wait_in; + //########################## //# SHIFT REGISTER