-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPISO.v
26 lines (22 loc) · 820 Bytes
/
PISO.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -------------------------------------------------------
// Parellel Input Serial Output
// -------------------------------------------------------
`timescale 1ns/1ns
module piso (input load, clk, rst,
input [31:0] data_in,
output reg data_out);
// PISO register array to load and shift data
reg [31:0] data_reg;
always @ (posedge clk or negedge rst) begin
if (~rst)
data_reg <= 8'h00; // Reset PISO register array on reset
else begin
// Load the data to the PISO register array and reset the serial data out register
if (load)
{data_reg, data_out} <= {data_in, 1'b0};
// Shift the loaded data 1 bit right; into the serial data out register
else
{data_reg, data_out} <= {1'b0, data_reg[31:0]};
end
end
endmodule