-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransposition.v
More file actions
executable file
·86 lines (67 loc) · 1.98 KB
/
Transposition.v
File metadata and controls
executable file
·86 lines (67 loc) · 1.98 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
File Name: Transposition.v
Date of Creation: November 25, 2018
Author: Caden Sanders
Project: Matrix Math Unit for Final Assignment
Course: Digital System Design using HDL [EE4321]
Professor: Mr. Mark Welker
School: Texas State University - San Marcos
Verilog sequential file for transposition. This module will receive input
from ALU_Control.v to be processed.
IO Visualization
Input from ALU_Control:
RowX from Matrix A - [Column1, Column2, Column3, Column4]
Output to ALU_Control:
RowX for New Matrix - [NewColumn1, NewColumn2, NewColumn3, NewColumn4]
Output to ALU_Control:
Element for New Matrix - [Result]
*/
module Transposition(
Clock, Operation, ClearAll, Column1, Column2, Column3, Column4, Enable,
Error, Done, NewRow1, NewRow2, NewRow3, NewRow4
);
// INPUT PORT DECLARATIONS
//
input Clock, ClearAll, Enable;
input [2:0] Operation;
input [31:0] Column1,
Column2, Column3, Column4; // Incoming ROW from Matrix A
// OUPUT PORT DECLARATIONS
//
output Error, Done;
output [31:0] NewRow1,
NewRow2, NewRow3, NewRow4; //Outgoing Column to New Matrix
// WIRE DECLARATIONS
//
wire Clock, ClearAll, Enable; //inputs
wire [2:0] Operation; //input
wire signed [31:0] Column1,
Column2, Column3, Column4; //inputs
// REGISTER DECLARATIONS
//
reg Error = 1'b0, Done = 1'b0; //outputs
reg signed [31:0] NewRow1,
NewRow2, NewRow3, NewRow4; //outputs
// BEHAVIORAL CODE
//
always @(posedge Clock, posedge ClearAll) begin
if (ClearAll) begin
NewRow1 <= 32'bxxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx;
NewRow2 <= 32'bxxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx;
NewRow3 <= 32'bxxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx;
NewRow4 <= 32'bxxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx;
Done <= 1'b0;
Error <= 1'b0;
end else if (Operation==3'b100 && Enable) begin
NewRow1 <= Column1;
NewRow2 <= Column2;
NewRow3 <= Column3;
NewRow4 <= Column4;
Done <= 1'b1;
end else begin
#2 Done <= 1'b0;
end
end
//
// END OF MODULE
endmodule