1 |
10 |
maheshpalv |
////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// ////
|
4 |
|
|
//// This file is part of the project ////
|
5 |
|
|
//// "instruction_list_pipelined_processor_with_peripherals" ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// http://opencores.org/project,instruction_list_pipelined_processor_with_peripherals ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// Author: ////
|
11 |
|
|
//// - Mahesh Sukhdeo Palve ////
|
12 |
|
|
//// ////
|
13 |
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
14 |
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
15 |
|
|
//// ////
|
16 |
|
|
//// ////
|
17 |
|
|
//// ////
|
18 |
|
|
//// This source file may be used and distributed without ////
|
19 |
|
|
//// restriction provided that this copyright statement is not ////
|
20 |
|
|
//// removed from the file and that any derivative work contains ////
|
21 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
22 |
|
|
//// ////
|
23 |
|
|
//// This source file is free software; you can redistribute it ////
|
24 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
25 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
26 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
27 |
|
|
//// later version. ////
|
28 |
|
|
//// ////
|
29 |
|
|
//// This source is distributed in the hope that it will be ////
|
30 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
31 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
32 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
33 |
|
|
//// details. ////
|
34 |
|
|
//// ////
|
35 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
36 |
|
|
//// Public License along with this source; if not, download it ////
|
37 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
38 |
|
|
//// ////
|
39 |
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
40 |
3 |
maheshpalv |
|
41 |
|
|
`include "timescale.v"
|
42 |
|
|
`include "defines.v"
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
module tcAccum (tcAccumRead, tcAddr, tcAccumIn, tcAccumOut);
|
46 |
|
|
|
47 |
|
|
input tcAccumRead;
|
48 |
|
|
input [`tcAddrLen-1:0] tcAddr;
|
49 |
|
|
input [(`tcAccLen*`tcNumbers)-1:0] tcAccumIn;
|
50 |
|
|
|
51 |
|
|
output [`tcAccLen-1:0] tcAccumOut;
|
52 |
|
|
|
53 |
|
|
wire [`tcAccLen-1:0] ACC_all [`tcNumbers-1:0]; // used in continuous assignment
|
54 |
|
|
reg [`tcAccLen-1:0] tcAccumOut;
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
always @ (tcAccumRead or tcAddr)
|
58 |
|
|
begin
|
59 |
|
|
if (tcAccumRead)
|
60 |
|
|
begin
|
61 |
|
|
tcAccumOut = ACC_all[tcAddr];
|
62 |
8 |
maheshpalv |
$write ("\nreading t/c accumulated value : module tcAccum ");
|
63 |
3 |
maheshpalv |
end
|
64 |
|
|
end
|
65 |
|
|
|
66 |
|
|
assign ACC_all[0] = tcAccumIn[`tcAccLen-1:0];
|
67 |
|
|
assign ACC_all[1] = tcAccumIn[(`tcAccLen*2)-1:`tcAccLen];
|
68 |
|
|
assign ACC_all[2] = tcAccumIn[(`tcAccLen*3)-1:(`tcAccLen*2)];
|
69 |
|
|
assign ACC_all[3] = tcAccumIn[(`tcAccLen*4)-1:(`tcAccLen*3)];
|
70 |
|
|
assign ACC_all[4] = tcAccumIn[(`tcAccLen*5)-1:(`tcAccLen*4)];
|
71 |
|
|
assign ACC_all[5] = tcAccumIn[(`tcAccLen*6)-1:(`tcAccLen*5)];
|
72 |
|
|
assign ACC_all[6] = tcAccumIn[(`tcAccLen*7)-1:(`tcAccLen*6)];
|
73 |
|
|
assign ACC_all[7] = tcAccumIn[(`tcAccLen*8)-1:(`tcAccLen*7)];
|
74 |
7 |
maheshpalv |
// assign ACC_all[8] = tcAccumIn[(`tcAccLen*9)-1:(`tcAccLen*8)];
|
75 |
|
|
// assign ACC_all[9] = tcAccumIn[(`tcAccLen*10)-1:(`tcAccLen*9)];
|
76 |
|
|
// assign ACC_all[10] = tcAccumIn[(`tcAccLen*11)-1:(`tcAccLen*10)];
|
77 |
|
|
// assign ACC_all[11] = tcAccumIn[(`tcAccLen*12)-1:(`tcAccLen*11)];
|
78 |
|
|
// assign ACC_all[12] = tcAccumIn[(`tcAccLen*13)-1:(`tcAccLen*12)];
|
79 |
|
|
// assign ACC_all[13] = tcAccumIn[(`tcAccLen*14)-1:(`tcAccLen*13)];
|
80 |
|
|
// assign ACC_all[14] = tcAccumIn[(`tcAccLen*15)-1:(`tcAccLen*14)];
|
81 |
|
|
// assign ACC_all[15] = tcAccumIn[(`tcAccLen*16)-1:(`tcAccLen*15)];
|
82 |
3 |
maheshpalv |
|
83 |
|
|
|
84 |
|
|
endmodule
|