File tree Expand file tree Collapse file tree 7 files changed +14
-35
lines changed Expand file tree Collapse file tree 7 files changed +14
-35
lines changed Original file line number Diff line number Diff line change @@ -23,15 +23,6 @@ var FlatModule = /** @class */ (function () {
2323 // populated by createWires
2424 this . wires = [ ] ;
2525 }
26- FlatModule . prototype . getNodes = function ( ) {
27- return this . nodes ;
28- } ;
29- FlatModule . prototype . getWires = function ( ) {
30- return this . wires ;
31- } ;
32- FlatModule . prototype . getName = function ( ) {
33- return this . moduleName ;
34- } ;
3526 // converts input ports with constant assignments to constant nodes
3627 FlatModule . prototype . addConstants = function ( ) {
3728 // find the maximum signal number
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ var WireDirection;
1212 WireDirection [ WireDirection [ "Right" ] = 3 ] = "Right" ;
1313} ) ( WireDirection || ( WireDirection = { } ) ) ;
1414function drawModule ( g , module ) {
15- var nodes = module . getNodes ( ) . map ( function ( n ) {
15+ var nodes = module . nodes . map ( function ( n ) {
1616 var kchild = _ . find ( g . children , function ( c ) { return c . id === n . Key ; } ) ;
1717 return n . render ( kchild ) ;
1818 } ) ;
Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ var ElkModel;
88 ElkModel . edgeIndex = 0 ;
99} ) ( ElkModel = exports . ElkModel || ( exports . ElkModel = { } ) ) ;
1010function buildElkGraph ( module ) {
11- var children = module . getNodes ( ) . map ( function ( n ) {
11+ var children = module . nodes . map ( function ( n ) {
1212 return n . buildElkChild ( ) ;
1313 } ) ;
1414 ElkModel . edgeIndex = 0 ;
1515 ElkModel . dummyNum = 0 ;
16- var edges = _ . flatMap ( module . getWires ( ) , function ( w ) {
16+ var edges = _ . flatMap ( module . wires , function ( w ) {
1717 // at least one driver and at least one rider and no laterals
1818 if ( w . drivers . length > 0 && w . riders . length > 0 && w . laterals . length === 0 ) {
1919 var ret = [ ] ;
@@ -92,7 +92,7 @@ function buildElkGraph(module) {
9292 return [ ] ;
9393 } ) ;
9494 return {
95- id : module . getName ( ) ,
95+ id : module . moduleName ,
9696 children : children ,
9797 edges : edges ,
9898 } ;
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ export interface Wire {
1818}
1919
2020export class FlatModule {
21- private moduleName : string ;
22- private nodes : Cell [ ] ;
23- private wires : Wire [ ] ;
21+ public moduleName : string ;
22+ public nodes : Cell [ ] ;
23+ public wires : Wire [ ] ;
2424
2525 constructor ( netlist : Yosys . Netlist ) {
2626 this . moduleName = null ;
@@ -41,18 +41,6 @@ export class FlatModule {
4141 this . wires = [ ] ;
4242 }
4343
44- public getNodes ( ) : Cell [ ] {
45- return this . nodes ;
46- }
47-
48- public getWires ( ) : Wire [ ] {
49- return this . wires ;
50- }
51-
52- public getName ( ) : string {
53- return this . moduleName ;
54- }
55-
5644 // converts input ports with constant assignments to constant nodes
5745 public addConstants ( ) : void {
5846 // find the maximum signal number
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ enum WireDirection {
1212}
1313
1414export default function drawModule ( g : ElkModel . Graph , module : FlatModule ) {
15- const nodes : any [ ] = module . getNodes ( ) . map ( ( n : Cell ) => {
15+ const nodes : any [ ] = module . nodes . map ( ( n : Cell ) => {
1616 const kchild : ElkModel . Cell = _ . find ( g . children , ( c ) => c . id === n . Key ) ;
1717 return n . render ( kchild ) ;
1818 } ) ;
Original file line number Diff line number Diff line change @@ -82,12 +82,12 @@ export namespace ElkModel {
8282 }
8383}
8484export function buildElkGraph ( module : FlatModule ) : ElkModel . Graph {
85- const children : ElkModel . Cell [ ] = module . getNodes ( ) . map ( ( n ) => {
85+ const children : ElkModel . Cell [ ] = module . nodes . map ( ( n ) => {
8686 return n . buildElkChild ( ) ;
8787 } ) ;
8888 ElkModel . edgeIndex = 0 ;
8989 ElkModel . dummyNum = 0 ;
90- const edges : ElkModel . Edge [ ] = _ . flatMap ( module . getWires ( ) , ( w ) => {
90+ const edges : ElkModel . Edge [ ] = _ . flatMap ( module . wires , ( w ) => {
9191 // at least one driver and at least one rider and no laterals
9292 if ( w . drivers . length > 0 && w . riders . length > 0 && w . laterals . length === 0 ) {
9393 const ret : ElkModel . Edge [ ] = [ ] ;
@@ -163,7 +163,7 @@ export function buildElkGraph(module: FlatModule): ElkModel.Graph {
163163 return [ ] ;
164164 } ) ;
165165 return {
166- id : module . getName ( ) ,
166+ id : module . moduleName ,
167167 children,
168168 edges,
169169 } ;
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ function createFlatModule(testFile: string): FlatModule {
2828test ( 'split join' , ( ) => {
2929 const flatModule = createFlatModule ( 'ports_splitjoin' ) ;
3030 // there are 5 external ports
31- const numStartNodes = flatModule . getNodes ( ) . length ;
31+ const numStartNodes = flatModule . nodes . length ;
3232 flatModule . addSplitsJoins ( ) ;
33- const nodes = flatModule . getNodes ( ) ;
33+ const nodes = flatModule . nodes ;
3434 // should have 3 more nodes, one split, two joins
3535 expect ( nodes . length - numStartNodes ) . toEqual ( 3 ) ;
3636 const splits = nodes . filter ( ( node : Cell ) => node . Type === '$_split_' ) ;
@@ -50,7 +50,7 @@ test('split join', () => {
5050test ( 'create wires' , ( ) => {
5151 const flatModule = createFlatModule ( 'hyperedges' ) ;
5252 flatModule . createWires ( ) ;
53- const wires = flatModule . getWires ( ) ;
53+ const wires = flatModule . wires ;
5454 expect ( wires . length ) . toEqual ( 3 ) ;
5555 expect ( wires . find ( ( wire ) => wire . drivers . length === 3 ) ) . toBeDefined ( ) ;
5656 expect ( wires . find ( ( wire ) => wire . riders . length === 3 ) ) . toBeDefined ( ) ;
You can’t perform that action at this time.
0 commit comments