-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsiso.v
More file actions
44 lines (36 loc) · 974 Bytes
/
Copy pathsiso.v
File metadata and controls
44 lines (36 loc) · 974 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
`timescale 1ns / 1ps
module siso(
input rst,enb,sin,clk,output reg sout);
reg [3:0] temp;
// shifting using shift operator
// always@(posedge clk)
// begin
// if(rst)
// temp <= 4'b0000;
// else if(enb) begin
// temp <= temp >> 1'b1;
// temp [3] <= sin;
// sout <= temp[0];
// end
// end
//right shifting using cancatenation operator
// always@(posedge clk)
// begin
// if(rst)
// temp <= 4'b0000;
// else if(enb) begin
// temp <= {sin,temp[3:1]};
// sout <= temp[0];
// end
// end
//left shifting using cancatenation operator
always@(posedge clk)
begin
if(rst)
temp <= 4'b0000;
else if(enb) begin
temp <= {temp[2:0],sin};
sout <= temp[3];
end
end
endmodule