; This file contains all graphic components of design
; Each graphic component can be represented as set of
; graphics atoms (such as line, box, etc)
; ***************************************************
;
; Description of format used in this file
; ***************************************
;
; {
; <component1_header>
; [component1_body]
; }
;
; {
; <component2_header>
; [component2_body]
; }
; 
; .....
;
;
; Description
; ***********
;
; Component header is line of following format:
; <component_name> [text_comment]
;
; Component body is set of lines of following format:
; <graphic_atom_name> <layer> <param1, param2, ...> [color]
;
; <layer> is 31-bit integer value that represents layers to what 
; belongs this atom. Every bit in value corresponds to one 
; of 31 layers. So, atom with specified layer value "5" will belong 
; to layers "0" and "2". Atom with layer value "0" will never be drawn 
; (because it not belongs to any layer). Typical layers are:
;	0 (value: 1) - default (drawed in standart case)
;	1 (value: 2) - drawed only if component is not highlighted
;	2 (value: 4) - drawed only if component is highlighted
;
; Note: When atom needs to be highlighted layer "5" (default+highlight)
; is set, otherwise layer "3" (default+not highlight) is set.
;	
;
; <params> are described in graphic atoms section
; [color] - This tag that defines color of atom is optional.
;	    It can be represented as a 24-bit value (RGB) or 
;	    name of some predefined color:
;		"black", "blue", "cyan", "darkGray", "gray", 
;		"green", "lightGray", "magenta", "orange", 
;		"pink", "red", "white",	"yellow"	
;
; If color not specified then default color is used
;
;
; Possible graphic atoms
; **********************
; 
; NAME		PARAM
;
; box  		<x> <y> <width> <height>
; rect 		<x> <y> <width> <height>
; line 		<x1> <y1> <x2> <y2>
; text		<x> <y> <size> <text>
; polyline 	<nPoints> <x1> <y1> <x2> <y2> ... <xn> <yn>
; polygon  	<nPoints> <x1> <y1> <x2> <y2> ... <xn> <yn>
; round    	<x> <y> <radius>
; point    	<x> <y> <radius>
; arrow    	<x> <y> <"down"|"up"|"left"|"right">
; null		none
;
; IMPORTANT NOTICE
; ****************
; All text lines (for example in <text> and [comment] fields) should
; not contain spaces. If you need space use underline ('_') symbol
; instead of it. It will be converted to space during file parsing
;

{
null null_componenet
null
}

{
border
rect 	1 0 0 559 299 magenta
}

{
datapath_rect DataPath_rectangle
rect 	1 0 0 350 280 49152
text	1 210 273 24 Data_path  49152
}

{
mux	mux
rect 	1 0  0 70 50
text	1 10 35 24 MUX
}

{
out	data_out_wire
line 	1 0 0 -40 0
arrow	1 -40 0 left
text	1 -70 -5 14 Data
text	1 -65 15 14 OUT
}

{
dmux	dmux
rect 	1 0  0 70 50
text	1 7 35 24 DMUX
}

{
in	data_in_wire
line 	1 0 0 -40 0
arrow	1 0 0 right
text	1 -70 -5  14 Data
text	1 -65  15 14 IN
}

{
regs	block_of_registers
rect 	1 0  0 70 110
line 	1 19 0 19 110
line 	1 52 0 52 110 
text	1 54 40 24 R
text	1 54 60 24 E
text	1 54 80 24 G

line 	1 0 17 52 17
line 	1 0 32 52 32 
line 	1 0 47 52 47 
line 	1 0 62 52 62 
line 	1 0 77 52 77 
line 	1 0 92 52 92 

text	1 2 15 12 R1
text	1 2 30 12 R2
text	1 2 45 12 R3
text	1 2 60 12 R4
text	1 2 75 12 R5
text	1 2 90 12 R6 
text	1 2 105 12 R7 
}

{ 
cond	conditions 
rect 	1 0  0  80 30
text	1 15 13 14 Status  49152
text	1 12 25 14 signals 49152
}


{
rline1	line_from_reg_to_mux
line 	1 0 0 0 -15
arrow	1 0 -25  up
}

{
rline2	line_from_dmux_to_reg
line 	1 0 0 0 -15
arrow	1 0 -25  up
}


{
mline1	line_from_mux_to_f1
polyline 1 3 0 0 50 0 50 10
arrow	 1 50 20 down
}

{
mline2	line_from_mux_to_f2
polyline 1 3 0 0 115 0 115 90
arrow	 1 115 100 down
}

{
mline2g	line_from_mux_to_f2
polyline 1 3 0 0 115 0 115 90 lightgray
arrow	 1 115 100 down       lightgray
}

{
mline41	line_from_mux_to_f4_1
polyline 1 3 0 0 175 0 175 50
arrow	 1 175 60 down
}

{
mline42	line_from_mux_to_f4_2
polyline 1 3 0 0 205 0 205 60
arrow	 1 205 70 down
}

{
mline42g line_from_mux_to_f4_2
polyline 1 3 0 0 205 0 205 60 lightgray
arrow	 1 205 70 down        lightgray
}


{
fline12	line_from_f1_to_f2
polyline 1 4 0 0 0 10 35 10  35 35
arrow	 1 35 45 down
}

{
fline23	line_from_f2_to_f3
line	1 0 0 0 15
arrow	1 0 25 down

}

{
dline3	line_from_f3_to_dmux
polyline 1 3 0 0 90 0 90 -25
arrow	 1 -10 0 left
}

{
dline4	line_from_f4_to_dmux
polyline 1 3 0 0 180 0 180 -140
arrow	 1 -10 0 left
}


{
CONTROL	control_part_of_device
rect 	1 0  0 128 150 49152
text	1 10 40 24 Control 49152
text	1 35 80 24 part    49152

line	1 0   113 128 113  49152
line	1 0   130 128 130  49152
line	1 16  113 16  150  49152
line	1 32  113 32  150  49152
line	1 48  113 48  150  49152
line	1 64  113 64  150  49152
line	1 80  113 80  150  49152
line	1 96  113 96  150  49152
line	1 112 113 112 150  49152

text	1 2   127 12  C1   49152
text	1 18  127 12  C2   49152
text	1 34  127 12  C3   49152
text	1 50  127 12  C4   49152
text	1 66  127 12  C5   49152
text	1 82  127 12  C6   49152
text	1 98  127 12  C7   49152
text	1 114 127 12  C8   49152
}

}

{
cout	control_signals_from_control_part_to_data_path
polyline 1 3 0 0 75 0 75 30  49152
arrow	1 0 0 left           49152
text	1 15 -5 14 Control
text	1 15 15 14 signals
}

{
status	status_signals_from_data_path_to_control_part
line	1 0   0  35  0  49152
line	1 75 -15 75 -30 49152
arrow	1 75 -40 up	49152
}

{
F1m	Sign_F1_in_a_box
text	1 3 10 10 F1
}
{
F2m	Sign_F2_in_a_box
text	1 3 10 10 F2
}
{
F3m	Sign_F3_in_a_box
text	1 3 10 10 F3
}
{
F4m	Sign_F4_in_a_box
text	1 3 10 10 F4
}

; Functional blocks
{
Disabled1	Disabled_block_(1_pin)
rect 	1 0  0  80 25 
line 	1 16 0  16 12 
line 	1 0 12  80 12 

line	8 40 0  40 -5
line	8 40 25 40 30

text	1 20 11 12 disabled	lightgray
}
{
Disabled2	Disabled_block_(2_pins)
rect 	1 0  0  80 25 
line 	1 16 0  16 12 
line 	1 0 12  80 12 

line	8 25 0  25 -5
line	8 55 0  55 -5
line	8 40 25 40 30

text	1 20 11 12 disabled	lightgray
}

{ 
Enabled1	Enabled_block_(1_pin) 
rect 	1 0  0  80 25  
line 	1 16 0  16 12 
line 	1 0 12  80 12 

line	8 40 0  40 -5
line	8 40 25 40 30

text	1 22 11 12 enabled	49152
} 
{ 
Enabled2	Enabled_block_(2_pins) 
rect 	1 0  0  80 25 
line 	1 16 0  16 12 
line 	1 0 12  80 12 

line	8 25 0  25 -5
line	8 55 0  55 -5
line	8 40 25 40 30

text	1 22 11 12 enabled	49152
} 

; Functions
{
None	No_operation
rect 	0 3  13 75 11
text	1 5  23 10 NO_OPERATION	lightgray
}
{
INV	Invert_operation
rect 	0 3  13 75 11
text	1 28 23 14 INV red
}
{
NEG	Negative_operation
rect 	0 3  13 75 11
text	1 28 23 14 NEG red
}
{
INC	Increment
rect 	0 3  13 75 11
text	1 28 23 14 INC red
}
{
DEC	Decrement
rect 	0 3  13 75 11
text	1 28 23 14 DEC red
}
{
SHL0	Shift_Left_(Pad_0)
rect 	0 3  13 75 11
text	1 25 23 14 SHL0 red
}
{
SHL1	Shift_Left_(Pad_1)
rect 	0 3  13 75 11
text	1 25 23 14 SHL1 red
}
{
SHR0	Shift_Right_(Pad_0)
rect 	0 3  13 75 11
text	1 25 23 14 SHR0 red
}
{
SHR1	Shift_Right_(Pad_1)
rect 	0 3  13 75 11
text	1 25 23 14 SHR1 red
}
{
CSHL	Cyclic_Shift_Left
rect 	0 3  13 75 11
text	1 25 23 14 CSHL red
}
{
CSHR	Cyclic_Shift_Right
rect 	0 3  13 75 11
text	1 25 23 14 CSHR red
}
{
AND	Logical_AND
rect 	0 3  13 75 11
text	1 28 23 14 AND red
}
{
NAND	Logical_NOT_AND
rect 	0 3  13 75 11
text	1 24 23 14 NAND red
}
{
OR	Logical_OR
rect 	0 3  13 75 11
text	1 32 23 14 OR red
}
{
NOR	Logical_NOT_OR
rect 	0 3  13 75 11
text	1 28 23 14 NOR red
}
{
XOR	Logical_XOR_(eXclusive_OR)
rect 	0 3  13 75 11
text	1 28 23 14 XOR red
}
{
EQ	Test_Equality
rect 	0 3  13 75 11
text	1 35 23 14 = red
}
{
ADD	Adder
rect 	0 3  13 75 11
text	1 35 23 14 + red
}


; Watch component
{
watch	Simple_watch_rect
rect 	1 -1 -12 29 15 orange
text	1 0 0 12 _
}

{
watchreg Register_watch_rect
rect 	0 -1 -12 29 13
text	1 0 0 12 _
}

{
watchcond Status_watch_rect
rect 	0 -1 -12 9 13
text	1 0 0 12 _
}


; Using fo disabling wathces
; Trick: polyline has no bounds - clipping
; area will be set to (0,0,0,0) when string is drawn
{
nowatch	Simple_watch_rect
polyline 1 5 -1 -12 28 -12 28 3 -1 3 -1 -12 lightgray
text	1 0 0 2 _ white
}


; Conditions components
{
cborder conditions_border_with_title
rect 1 0 0 250 185
text 1 45 18 24 Conditions
line 1 0 20 250 20 
line 1 0 22 250 22 

line 1 30  22 30  185 
line 1 225 22 225 185 

line 1 0 60  250 60
line 1 0 100 250 100
line 1 0 140 250 140
line 1 0 163 250 163
}

; Signs 'C1', 'C2'
{
cc1 condition_1
text 1 0 10 14 C1
rect 0 -1 -1 17 12
}
{
cc2 condition_2
text 1 0 10 14 C2
rect 0 -1 -1 17 12 
}
{
cc3 condition_3
text 1 0 10 14 C3
rect 0 -1 -1 17 12 
}
{
cc4 condition_4
text 1 0 10 14 C4
rect 0 -1 -1 17 12 
}
{
cc5 condition_5
text 1 0 10 14 C5
rect 0 -1 -1 17 12 
}
{
cc6 condition_6
text 1 0 10 14 C6
rect 0 -1 -1 17 12 
}
{
cc7 condition_7
text 1 0 10 14 C7
rect 0 -1 -1 17 12 
}
{
cc8 condition_8
text 1 0 10 14 C8
rect 0 -1 -1 17 12 
}
{
c8text condition_8_description
text 1 0 10 12 Overflow_at_F4
}

; Regs
{
creg1 cond_reg_1
rect 0 	0 0 29 11 
text 1 	1 10 12 reg1
}
{
creg2 cond_reg_2
rect 0 	0 0 29 11 
text 1 	1 10 12 reg2
}
{
creg3 cond_reg_3
rect 0 	0 0 29 11 
text 1 	1 10 12 reg3
}
{
creg4 cond_reg_4
rect 0 	0 0 29 11 
text 1 	1 10 12 reg4
}
{
creg5 cond_reg_5
rect 0 	0 0 29 11 
text 1 	1 10 12 reg5
}
{
creg6 cond_reg_6
rect 0 	0 0 29 11 
text 1 	1 10 12 reg6
}
{
creg7 cond_reg_7
rect 0 	0 0 29 11 
text 1 	1 10 12 reg7
}

; Bits
{
cbit0 cond_bit_0
rect 0 	11 0 29 11 
text 1 	1  10 12 : black
text 1 	11 10 12 bit0
}
{
cbit1 cond_bit_1
rect 0 	11 0 29 11 
text 1 	1  10 12 : black
text 1 	11 10 12 bit1
}
{
cbit2 cond_bit_2
rect 0 	11 0 29 11 
text 1 	1  10 12 : black
text 1 	11 10 12 bit2
}
{
cbit3 cond_bit_3
rect 0 	11 0 29 11 
text 1 	1  10 12 : black
text 1 	11 10 12 bit3
}


{
clow condition_0
rect 0 	0 0 29 10 
text 1 	5 10 12 0
}
{
chigh condition_1
rect 0 	0 0 29 10 
text 1 	5 10 12 1
}

{
ceq cond_equals
rect 0 	0 0 8 10
text 1 	1 10 12 =
}
{
cneq cond_not_equals
rect 0 	0 0 8 10
text 1 	1 10 12 =
line 1 	6 3 2 8
}


; Observers
{
obson observer_turned_on
rect 0 0 0 11 11
point 1 2 2 4 49280
polyline 1 9 0 3 3 0 8 0 11 3 11 8 8 11 3 11 0 8 0 3
}
{
obsoff observer_turned_off
rect 0 0 0 11 11
polyline 1 9 0 3 3 0 8 0 11 3 11 8 8 11 3 11 0 8 0 3
}

; LFSRs
{
lfsr_off no_lfsr
rect 1 0 0 12 11
line 1 2 5 10 5 lightgray
line 1 2 6 10 6 lightgray
}
{
lfsr_an analyzer
box 1 0 0 13 12
text 1 2 10 14 A white
}
{
lfsr_gn generator
box 1 0 0 13 12
text 1 2 10 14 G white
}
{
lfsr_cstp analyzer/generator
box 1 0 0 13 12
line 1 2 5 10 5 white
line 1 2 6 10 6 white
line 1 7 3 10 5 white
line 1 7 8 10 5 white
}
