Skip to content

Commit 7da95fe

Browse files
authored
Merge pull request #8496 from Pinata-Consulting/mock-array-cleanup
Mock array cleanup
2 parents 73350db + e6a7d4d commit 7da95fe

File tree

5 files changed

+118
-41
lines changed

5 files changed

+118
-41
lines changed

.scalafmt.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "3.7.15"
2+
runner.dialect = scala213

test/orfs/mock-array/BUILD

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ POWER_STAGE_STEM = {
2525
# each number is a unit
2626
# current unit is configured as 2.16 which is on the routing grid for M5
2727

28-
# table of Elements - (rows cols width height pitch_x pitch_y)
29-
MOCK_ARRAY_TABLE = [
30-
8,
31-
8,
32-
20,
33-
20,
34-
20,
35-
22,
36-
]
37-
3828
MOCK_ARRAY_SCALE = 45
3929

4030
# Routing pitches for relevant metal layers.
@@ -50,7 +40,7 @@ placement_grid_x = 0.048 * MOCK_ARRAY_SCALE
5040
placement_grid_y = 0.048 * MOCK_ARRAY_SCALE
5141

5242
# number of Elements in row and column, can be control by user via environment variable
53-
# MOCK_ARRAY_TABLE (rows, cols, width, height, pitch_x, pitch_y)
43+
#
5444
# rows, cols - number of Element in rows, cols
5545
# width, height - width and height of each Element
5646
#
@@ -59,7 +49,17 @@ placement_grid_y = 0.048 * MOCK_ARRAY_SCALE
5949
#
6050
# pitch_x, pitch_y - placement pitch for each Element, in x and y direction
6151
# specification are in unit of placement grid
62-
rows, cols, ce_x, ce_y, pitch_x, pitch_y = MOCK_ARRAY_TABLE
52+
rows = 8
53+
54+
cols = 8
55+
56+
ce_x = 20
57+
58+
ce_y = 20
59+
60+
pitch_x = 20
61+
62+
pitch_y = 22
6363

6464
# Element size is set to multiple of placement grid above
6565
ce_width = ce_x * placement_grid_x
@@ -83,16 +83,16 @@ array_spacing_y = margin_y * 2
8383

8484
# top level core and die size
8585
core_width = (
86-
2 * array_spacing_x + ((placement_grid_x * pitch_x) * (cols - 1)) + ce_width
86+
2 * margin_x + ((placement_grid_x * pitch_x) * (cols - 1)) + ce_width
8787
)
8888

8989
core_height = (
90-
2 * array_spacing_y + ((placement_grid_y * pitch_y) * (rows - 1)) + ce_height
90+
2 * margin_y + ((placement_grid_y * pitch_y) * (rows - 1)) + ce_height
9191
)
9292

93-
die_width = core_width + (margin_x * 2)
93+
die_width = core_width + (array_spacing_x * 2)
9494

95-
die_height = core_height + (margin_y * 2)
95+
die_height = core_height + (array_spacing_y * 2)
9696

9797
filegroup(
9898
name = "mock-array-constraints",
@@ -122,10 +122,10 @@ VARIANTS = [
122122
name = "MockArray",
123123
arguments = {
124124
"CORE_AREA": "{} {} {} {}".format(
125-
margin_x,
126-
margin_y,
127-
core_width + margin_x,
128-
core_height + margin_y,
125+
array_spacing_x,
126+
array_spacing_y,
127+
array_spacing_x + core_width,
128+
array_spacing_y + core_height,
129129
),
130130
"DETAILED_ROUTE_END_ITERATION": "6",
131131
"DIE_AREA": "0 0 {} {}".format(
@@ -155,7 +155,7 @@ VARIANTS = [
155155
macros = ["Element_generate_abstract"],
156156
sources = {
157157
"IO_CONSTRAINTS": [":mock-array-io"],
158-
"RULES_JSON": [":rules-base.json"],
158+
"RULES_JSON": [":rules-{variant}.json".format(variant = variant)],
159159
"SDC_FILE": [":mock-array-constraints"],
160160
},
161161
tags = ["manual"],
@@ -232,8 +232,8 @@ fir_library(
232232
],
233233
generator = ":generate_verilog",
234234
opts = [
235-
"--width=8",
236-
"--height=8",
235+
"--width=" + str(cols),
236+
"--height=" + str(rows),
237237
"--dataWidth=64",
238238
"--",
239239
# Imagine Chisel arguments here
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
{
22
"synth__design__instance__area__stdcell": {
3-
"value": 14384.92,
3+
"value": 14398.9,
44
"compare": "<="
55
},
66
"constraints__clocks__count": {
77
"value": 1,
88
"compare": "=="
99
},
1010
"placeopt__design__instance__area": {
11-
"value": 137948,
11+
"value": 137855,
1212
"compare": "<="
1313
},
1414
"placeopt__design__instance__count__stdcell": {
15-
"value": 12335,
15+
"value": 9152,
1616
"compare": "<="
1717
},
1818
"detailedplace__design__violations": {
1919
"value": 0,
2020
"compare": "=="
2121
},
2222
"cts__design__instance__count__setup_buffer": {
23-
"value": 1073,
23+
"value": 796,
2424
"compare": "<="
2525
},
2626
"cts__design__instance__count__hold_buffer": {
27-
"value": 2000,
27+
"value": 1521,
2828
"compare": "<="
2929
},
3030
"globalroute__antenna_diodes_count": {
3131
"value": 0,
3232
"compare": "<="
3333
},
3434
"detailedroute__route__wirelength": {
35-
"value": 73938,
35+
"value": 128034,
3636
"compare": "<="
3737
},
3838
"detailedroute__route__drc_errors": {
@@ -48,23 +48,23 @@
4848
"compare": "<="
4949
},
5050
"finish__timing__setup__ws": {
51-
"value": -87,
51+
"value": -114.39,
5252
"compare": ">="
5353
},
5454
"finish__design__instance__area": {
55-
"value": 137975,
55+
"value": 138041,
5656
"compare": "<="
5757
},
5858
"finish__timing__drv__setup_violation_count": {
5959
"value": 1040,
6060
"compare": "<="
6161
},
6262
"finish__timing__drv__hold_violation_count": {
63-
"value": 100,
63+
"value": 159,
6464
"compare": "<="
6565
},
6666
"finish__timing__wns_percent_delay": {
67-
"value": -30.0,
67+
"value": -39.79,
6868
"compare": ">="
6969
}
7070
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"synth__design__instance__area__stdcell": {
3+
"value": 14398.9,
4+
"compare": "<="
5+
},
6+
"constraints__clocks__count": {
7+
"value": 1,
8+
"compare": "=="
9+
},
10+
"placeopt__design__instance__area": {
11+
"value": 137855,
12+
"compare": "<="
13+
},
14+
"placeopt__design__instance__count__stdcell": {
15+
"value": 9152,
16+
"compare": "<="
17+
},
18+
"detailedplace__design__violations": {
19+
"value": 0,
20+
"compare": "=="
21+
},
22+
"cts__design__instance__count__setup_buffer": {
23+
"value": 796,
24+
"compare": "<="
25+
},
26+
"cts__design__instance__count__hold_buffer": {
27+
"value": 1521,
28+
"compare": "<="
29+
},
30+
"globalroute__antenna_diodes_count": {
31+
"value": 0,
32+
"compare": "<="
33+
},
34+
"detailedroute__route__wirelength": {
35+
"value": 128034,
36+
"compare": "<="
37+
},
38+
"detailedroute__route__drc_errors": {
39+
"value": 0,
40+
"compare": "<="
41+
},
42+
"detailedroute__antenna__violating__nets": {
43+
"value": 0,
44+
"compare": "<="
45+
},
46+
"detailedroute__antenna_diodes_count": {
47+
"value": 5,
48+
"compare": "<="
49+
},
50+
"finish__timing__setup__ws": {
51+
"value": -114.39,
52+
"compare": ">="
53+
},
54+
"finish__design__instance__area": {
55+
"value": 138041,
56+
"compare": "<="
57+
},
58+
"finish__timing__drv__setup_violation_count": {
59+
"value": 1040,
60+
"compare": "<="
61+
},
62+
"finish__timing__drv__hold_violation_count": {
63+
"value": 159,
64+
"compare": "<="
65+
},
66+
"finish__timing__wns_percent_delay": {
67+
"value": -39.79,
68+
"compare": ">="
69+
}
70+
}

test/orfs/mock-array/src/main/scala/MockArray.scala

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class BusesVec(singleElementWidth: Int, width: Int, height: Int)
4343
def asSeq: Seq[Vec[UInt]] = routes.map(_._2).toSeq
4444
}
4545

46-
class MockArrayBundle(width: Int, height: Int, singleElementWidth: Int) extends Bundle {
46+
class MockArrayBundle(width: Int, height: Int, singleElementWidth: Int)
47+
extends Bundle {
4748
val ins = Input(new BusesVec(singleElementWidth, width, height))
4849
val outs = Output(new BusesVec(singleElementWidth, width, height))
4950
val lsbs = Output(Vec(width * height, Bool()))
@@ -98,8 +99,11 @@ class MockArray(width: Int, height: Int, singleElementWidth: Int)
9899
// left <-> down
99100
// up <-> right
100101
(io.outs.asSeq zip (io.ins.asSeq ++ Seq(io.ins.asSeq.head))
101-
.sliding(2).toSeq.reverse.map(_.map(RegNext(_)))).foreach {
102-
case (a, b) => a := RegNext({
102+
.sliding(2)
103+
.toSeq
104+
.reverse
105+
.map(_.map(RegNext(_)))).foreach { case (a, b) =>
106+
a := RegNext({
103107
val mult = Module(new Multiplier())
104108
mult.io.a := b(0)
105109
mult.io.b := b(1)
@@ -110,8 +114,9 @@ class MockArray(width: Int, height: Int, singleElementWidth: Int)
110114
})
111115
}
112116

113-
// Combinational logic, but a maximum flight path of 4 elements
114-
val MAX_FLIGHT = 4
117+
// Combinational logic, but a maximum flight path of number of
118+
// elements horizontally / 2
119+
val MAX_FLIGHT = width / 2
115120
io.lsbOuts := (io.lsbIns
116121
.drop(1)
117122
.reverse
@@ -186,9 +191,10 @@ case class ArrayConfig(
186191
remainingArgs: Seq[String] = Seq.empty
187192
)
188193

189-
190194
object parse {
191-
def apply(args:Array[String]) : (ArrayConfig, Array[String], Array[String]) = {
195+
def apply(
196+
args: Array[String]
197+
): (ArrayConfig, Array[String], Array[String]) = {
192198
val builder = OParser.builder[ArrayConfig]
193199
val parser = {
194200
import builder._
@@ -216,7 +222,6 @@ object parse {
216222
val (chiselArgs, secondDelimiter) = firstDelimiter.drop(1).span(_ != "--")
217223
val firtoolArgs = secondDelimiter.drop(1)
218224

219-
220225
OParser.parse(parser, configArgs, ArrayConfig()) match {
221226
case Some(c) =>
222227
return (c, chiselArgs, firtoolArgs)

0 commit comments

Comments
 (0)