@@ -31,7 +31,9 @@ public static ChipDescription[] CreateAllBuiltinChipDescriptions()
3131 CreatePulse ( ) ,
3232 // ---- Memory ----
3333 dev_CreateRAM_8 ( ) ,
34- CreateROM_8 ( ) ,
34+ CreateROM ( ChipType . Rom_256x2x8 ) ,
35+ CreateROM ( ChipType . Rom_256x16 ) ,
36+ CreateROM ( ChipType . Rom_256x32 ) ,
3537 // ---- Merge / Split ----
3638 CreateBitConversionChip ( ChipType . Split_4To1Bit , PinBitCount . Bit4 , PinBitCount . Bit1 , 1 , 4 ) ,
3739 CreateBitConversionChip ( ChipType . Split_8To4Bit , PinBitCount . Bit8 , PinBitCount . Bit4 , 1 , 2 ) ,
@@ -94,22 +96,76 @@ static ChipDescription dev_CreateRAM_8()
9496 return CreateBuiltinChipDescription ( ChipType . dev_Ram_8Bit , size , col , inputPins , outputPins ) ;
9597 }
9698
97- static ChipDescription CreateROM_8 ( )
99+ static ChipDescription CreateROM ( ChipType type )
98100 {
99- PinDescription [ ] inputPins =
100- {
101- CreatePinDescription ( "ADDRESS" , 0 , PinBitCount . Bit8 )
102- } ;
103- PinDescription [ ] outputPins =
104- {
105- CreatePinDescription ( "OUT B" , 1 , PinBitCount . Bit8 ) ,
106- CreatePinDescription ( "OUT A" , 2 , PinBitCount . Bit8 )
107- } ;
101+ switch ( type ) {
102+ case ChipType . Rom_256x2x8 :
103+ {
104+ PinDescription [ ] inputPins =
105+ {
106+ CreatePinDescription ( "ADDRESS" , 0 , PinBitCount . Bit8 )
107+ } ;
108+ PinDescription [ ] outputPins =
109+ {
110+ CreatePinDescription ( "OUT B" , 1 , PinBitCount . Bit8 ) ,
111+ CreatePinDescription ( "OUT A" , 2 , PinBitCount . Bit8 )
112+ } ;
113+
114+ Color col = new ( 0.25f , 0.35f , 0.5f ) ;
115+ Vector2 size = new ( GridSize * 12 , SubChipInstance . MinChipHeightForPins ( inputPins , outputPins ) ) ;
108116
109- Color col = new ( 0.25f , 0.35f , 0.5f ) ;
110- Vector2 size = new ( GridSize * 12 , SubChipInstance . MinChipHeightForPins ( inputPins , outputPins ) ) ;
117+ return CreateBuiltinChipDescription ( ChipType . Rom_256x2x8 , size , col , inputPins , outputPins ) ;
118+ }
119+ case ChipType . Rom_256x16 :
120+ {
121+ PinDescription [ ] inputPins =
122+ {
123+ CreatePinDescription ( "ADDRESS" , 0 , PinBitCount . Bit8 )
124+ } ;
125+ PinDescription [ ] outputPins =
126+ {
127+ CreatePinDescription ( "OUT A" , 1 , PinBitCount . Bit16 )
128+ } ;
129+
130+ Color col = new ( 0.25f , 0.35f , 0.5f ) ;
131+ Vector2 size = new ( GridSize * 12 , SubChipInstance . MinChipHeightForPins ( inputPins , outputPins ) ) ;
132+
133+ return CreateBuiltinChipDescription ( ChipType . Rom_256x16 , size , col , inputPins , outputPins ) ;
134+ }
135+ case ChipType . Rom_256x32 :
136+ {
137+ PinDescription [ ] inputPins =
138+ {
139+ CreatePinDescription ( "ADDRESS" , 0 , PinBitCount . Bit8 )
140+ } ;
141+ PinDescription [ ] outputPins =
142+ {
143+ CreatePinDescription ( "OUT B" , 1 , PinBitCount . Bit16 ) ,
144+ CreatePinDescription ( "OUT A" , 2 , PinBitCount . Bit16 )
145+ } ;
111146
112- return CreateBuiltinChipDescription ( ChipType . Rom_256x16 , size , col , inputPins , outputPins ) ;
147+ Color col = new ( 0.25f , 0.35f , 0.5f ) ;
148+ Vector2 size = new ( GridSize * 12 , SubChipInstance . MinChipHeightForPins ( inputPins , outputPins ) ) ;
149+
150+ return CreateBuiltinChipDescription ( ChipType . Rom_256x32 , size , col , inputPins , outputPins ) ;
151+ }
152+ default :
153+ {
154+ PinDescription [ ] inputPins =
155+ {
156+ CreatePinDescription ( "ADDRESS" , 0 , PinBitCount . Bit8 )
157+ } ;
158+ PinDescription [ ] outputPins =
159+ {
160+ CreatePinDescription ( "OUT A" , 1 , PinBitCount . Bit16 )
161+ } ;
162+
163+ Color col = new ( 0.25f , 0.35f , 0.5f ) ;
164+ Vector2 size = new ( GridSize * 12 , SubChipInstance . MinChipHeightForPins ( inputPins , outputPins ) ) ;
165+
166+ return CreateBuiltinChipDescription ( ChipType . Rom_256x16 , size , col , inputPins , outputPins ) ;
167+ }
168+ }
113169 }
114170
115171 static ChipDescription CreateInputKeyChip ( )
@@ -216,30 +272,30 @@ static ChipDescription CreateDisplay7Seg()
216272
217273 static ChipDescription CreateDisplayRGB ( )
218274 {
219- float height = GridSize * 21 ;
220- float width = height ;
221- float displayWidth = height - GridSize * 2 ;
275+ float displayWidth = GridSize * 19 ;
222276
223277 Color col = new ( 0.1f , 0.1f , 0.1f ) ;
224- Vector2 size = new ( width , height ) ;
225278
226279 PinDescription [ ] inputPins =
227280 {
228281 CreatePinDescription ( "ADDRESS" , 0 , PinBitCount . Bit8 ) ,
229- CreatePinDescription ( "RED" , 1 , PinBitCount . Bit4 ) ,
230- CreatePinDescription ( "GREEN" , 2 , PinBitCount . Bit4 ) ,
231- CreatePinDescription ( "BLUE" , 3 , PinBitCount . Bit4 ) ,
282+ CreatePinDescription ( "RED" , 1 , PinBitCount . Bit8 ) ,
283+ CreatePinDescription ( "GREEN" , 2 , PinBitCount . Bit8 ) ,
284+ CreatePinDescription ( "BLUE" , 3 , PinBitCount . Bit8 ) ,
232285 CreatePinDescription ( "RESET" , 4 ) ,
233286 CreatePinDescription ( "WRITE" , 5 ) ,
234287 CreatePinDescription ( "REFRESH" , 6 ) ,
235288 CreatePinDescription ( "CLOCK" , 7 )
236289 } ;
290+ float height = SubChipInstance . MinChipHeightForPins ( inputPins , null ) ;
291+ float width = height ;
292+ Vector2 size = new ( width , height ) ;
237293
238294 PinDescription [ ] outputPins =
239295 {
240- CreatePinDescription ( "R OUT" , 8 , PinBitCount . Bit4 ) ,
241- CreatePinDescription ( "G OUT" , 9 , PinBitCount . Bit4 ) ,
242- CreatePinDescription ( "B OUT" , 10 , PinBitCount . Bit4 )
296+ CreatePinDescription ( "R OUT" , 8 , PinBitCount . Bit8 ) ,
297+ CreatePinDescription ( "G OUT" , 9 , PinBitCount . Bit8 ) ,
298+ CreatePinDescription ( "B OUT" , 10 , PinBitCount . Bit8 )
243299 } ;
244300
245301 DisplayDescription [ ] displays =
@@ -361,7 +417,7 @@ static ChipDescription CreateDisplayRGBLED()
361417 new ( )
362418 {
363419 Position = Vector2 . right * PinRadius / 3 * 0 ,
364- Scale = displayWidth ,
420+ Scale = GridSize * 1 ,
365421 SubChipID = - 1
366422 }
367423 } ;
0 commit comments