Debugging complete!

The CPU works now except for the multiply commands. Pipelining is next! Woooo!
This commit is contained in:
Kacper 2020-06-08 23:07:52 +01:00
parent c2ce212ed5
commit 2f6cbeae56
7 changed files with 452 additions and 448 deletions

View file

@ -19,6 +19,9 @@ Intel and sold by Intel or its authorized distributors. Please
refer to the applicable agreement for further details. refer to the applicable agreement for further details.
*/ */
(header "graphic" (version "1.4")) (header "graphic" (version "1.4"))
(properties
(page_setup "orientation\n1\npaper_size\n0\npaper_source\n12\nmargin\n1.000:1.000:1.000:1.000\n")
)
(pin (pin
(input) (input)
(rect 168 720 344 736) (rect 168 720 344 736)
@ -1255,7 +1258,7 @@ refer to the applicable agreement for further details.
) )
) )
(symbol (symbol
(rect 256 16 408 128) (rect 304 24 456 136)
(text "SM" (rect 5 0 20 12)(font "Arial" )) (text "SM" (rect 5 0 20 12)(font "Arial" ))
(text "SM" (rect 8 96 23 108)(font "Arial" )) (text "SM" (rect 8 96 23 108)(font "Arial" ))
(port (port
@ -1304,287 +1307,6 @@ refer to the applicable agreement for further details.
(rectangle (rect 16 16 136 96)) (rectangle (rect 16 16 136 96))
) )
) )
(symbol
(rect 1168 -136 1376 264)
(text "DECODE" (rect 5 0 52 12)(font "Arial" ))
(text "DECODE" (rect 8 384 55 396)(font "Arial" ))
(port
(pt 0 32)
(input)
(text "instr[15..0]" (rect 0 0 53 12)(font "Arial" ))
(text "instr[15..0]" (rect 21 27 74 39)(font "Arial" ))
(line (pt 0 32)(pt 16 32)(line_width 3))
)
(port
(pt 0 48)
(input)
(text "FETCH" (rect 0 0 36 12)(font "Arial" ))
(text "FETCH" (rect 21 43 57 55)(font "Arial" ))
(line (pt 0 48)(pt 16 48))
)
(port
(pt 0 64)
(input)
(text "EXEC1" (rect 0 0 34 12)(font "Arial" ))
(text "EXEC1" (rect 21 59 55 71)(font "Arial" ))
(line (pt 0 64)(pt 16 64))
)
(port
(pt 0 80)
(input)
(text "EXEC2" (rect 0 0 34 12)(font "Arial" ))
(text "EXEC2" (rect 21 75 55 87)(font "Arial" ))
(line (pt 0 80)(pt 16 80))
)
(port
(pt 0 96)
(input)
(text "COND_result" (rect 0 0 66 12)(font "Arial" ))
(text "COND_result" (rect 21 91 87 103)(font "Arial" ))
(line (pt 0 96)(pt 16 96))
)
(port
(pt 208 32)
(output)
(text "R0_count" (rect 0 0 47 12)(font "Arial" ))
(text "R0_count" (rect 148 27 187 39)(font "Arial" ))
(line (pt 208 32)(pt 192 32))
)
(port
(pt 208 48)
(output)
(text "R0_en" (rect 0 0 31 12)(font "Arial" ))
(text "R0_en" (rect 161 43 187 55)(font "Arial" ))
(line (pt 208 48)(pt 192 48))
)
(port
(pt 208 64)
(output)
(text "R1_en" (rect 0 0 31 12)(font "Arial" ))
(text "R1_en" (rect 161 59 187 71)(font "Arial" ))
(line (pt 208 64)(pt 192 64))
)
(port
(pt 208 80)
(output)
(text "R2_en" (rect 0 0 31 12)(font "Arial" ))
(text "R2_en" (rect 161 75 187 87)(font "Arial" ))
(line (pt 208 80)(pt 192 80))
)
(port
(pt 208 96)
(output)
(text "R3_en" (rect 0 0 31 12)(font "Arial" ))
(text "R3_en" (rect 161 91 187 103)(font "Arial" ))
(line (pt 208 96)(pt 192 96))
)
(port
(pt 208 112)
(output)
(text "R4_en" (rect 0 0 31 12)(font "Arial" ))
(text "R4_en" (rect 161 107 187 119)(font "Arial" ))
(line (pt 208 112)(pt 192 112))
)
(port
(pt 208 128)
(output)
(text "R5_en" (rect 0 0 31 12)(font "Arial" ))
(text "R5_en" (rect 161 123 187 135)(font "Arial" ))
(line (pt 208 128)(pt 192 128))
)
(port
(pt 208 144)
(output)
(text "R6_en" (rect 0 0 31 12)(font "Arial" ))
(text "R6_en" (rect 161 139 187 151)(font "Arial" ))
(line (pt 208 144)(pt 192 144))
)
(port
(pt 208 160)
(output)
(text "R7_en" (rect 0 0 31 12)(font "Arial" ))
(text "R7_en" (rect 161 155 187 167)(font "Arial" ))
(line (pt 208 160)(pt 192 160))
)
(port
(pt 208 176)
(output)
(text "s1[2..0]" (rect 0 0 37 12)(font "Arial" ))
(text "s1[2..0]" (rect 156 171 187 183)(font "Arial" ))
(line (pt 208 176)(pt 192 176)(line_width 3))
)
(port
(pt 208 192)
(output)
(text "s2[2..0]" (rect 0 0 37 12)(font "Arial" ))
(text "s2[2..0]" (rect 156 187 187 199)(font "Arial" ))
(line (pt 208 192)(pt 192 192)(line_width 3))
)
(port
(pt 208 208)
(output)
(text "s3[2..0]" (rect 0 0 37 12)(font "Arial" ))
(text "s3[2..0]" (rect 156 203 187 215)(font "Arial" ))
(line (pt 208 208)(pt 192 208)(line_width 3))
)
(port
(pt 208 224)
(output)
(text "s4" (rect 0 0 11 12)(font "Arial" ))
(text "s4" (rect 178 219 187 231)(font "Arial" ))
(line (pt 208 224)(pt 192 224))
)
(port
(pt 208 240)
(output)
(text "RAMd_wren" (rect 0 0 57 12)(font "Arial" ))
(text "RAMd_wren" (rect 139 235 187 247)(font "Arial" ))
(line (pt 208 240)(pt 192 240))
)
(port
(pt 208 256)
(output)
(text "RAMd_en" (rect 0 0 47 12)(font "Arial" ))
(text "RAMd_en" (rect 148 251 187 263)(font "Arial" ))
(line (pt 208 256)(pt 192 256))
)
(port
(pt 208 272)
(output)
(text "RAMi_en" (rect 0 0 43 12)(font "Arial" ))
(text "RAMi_en" (rect 151 267 187 279)(font "Arial" ))
(line (pt 208 272)(pt 192 272))
)
(port
(pt 208 288)
(output)
(text "ALU_en" (rect 0 0 38 12)(font "Arial" ))
(text "ALU_en" (rect 155 283 187 295)(font "Arial" ))
(line (pt 208 288)(pt 192 288))
)
(port
(pt 208 304)
(output)
(text "E2" (rect 0 0 12 12)(font "Arial" ))
(text "E2" (rect 177 299 187 311)(font "Arial" ))
(line (pt 208 304)(pt 192 304))
)
(port
(pt 208 320)
(output)
(text "stack_en" (rect 0 0 44 12)(font "Arial" ))
(text "stack_en" (rect 150 315 187 327)(font "Arial" ))
(line (pt 208 320)(pt 192 320))
)
(port
(pt 208 336)
(output)
(text "stack_rst" (rect 0 0 46 12)(font "Arial" ))
(text "stack_rst" (rect 149 331 187 343)(font "Arial" ))
(line (pt 208 336)(pt 192 336))
)
(port
(pt 208 352)
(output)
(text "stack_rw" (rect 0 0 43 12)(font "Arial" ))
(text "stack_rw" (rect 151 347 187 359)(font "Arial" ))
(line (pt 208 352)(pt 192 352))
)
(drawing
(rectangle (rect 16 16 192 384))
)
)
(symbol
(rect 600 -8 816 136)
(text "ram_instr" (rect 81 0 144 16)(font "Arial" (font_size 10)))
(text "RAMi" (rect 8 128 33 140)(font "Arial" ))
(port
(pt 0 32)
(input)
(text "data[15..0]" (rect 0 0 60 14)(font "Arial" (font_size 8)))
(text "data[15..0]" (rect 4 18 64 32)(font "Arial" (font_size 8)))
(line (pt 0 32)(pt 88 32)(line_width 3))
)
(port
(pt 0 48)
(input)
(text "wren" (rect 0 0 30 14)(font "Arial" (font_size 8)))
(text "wren" (rect 4 34 34 48)(font "Arial" (font_size 8)))
(line (pt 0 48)(pt 88 48))
)
(port
(pt 0 64)
(input)
(text "address[10..0]" (rect 0 0 82 14)(font "Arial" (font_size 8)))
(text "address[10..0]" (rect 4 50 86 64)(font "Arial" (font_size 8)))
(line (pt 0 64)(pt 88 64)(line_width 3))
)
(port
(pt 0 112)
(input)
(text "clock" (rect 0 0 29 14)(font "Arial" (font_size 8)))
(text "clock" (rect 4 98 33 112)(font "Arial" (font_size 8)))
(line (pt 0 112)(pt 80 112))
)
(port
(pt 0 128)
(input)
(text "clken" (rect 0 0 29 14)(font "Arial" (font_size 8)))
(text "clken" (rect 4 114 33 128)(font "Arial" (font_size 8)))
(line (pt 0 128)(pt 16 128))
)
(port
(pt 216 32)
(output)
(text "q[15..0]" (rect 0 0 42 14)(font "Arial" (font_size 8)))
(text "q[15..0]" (rect 177 18 219 32)(font "Arial" (font_size 8)))
(line (pt 216 32)(pt 136 32)(line_width 3))
)
(drawing
(text "16 bits" (rect 109 24 121 57)(font "Arial" )(vertical))
(text "2048 words" (rect 120 12 132 67)(font "Arial" )(vertical))
(text "Block type: AUTO" (rect 48 130 137 142)(font "Arial" ))
(line (pt 104 24)(pt 136 24))
(line (pt 136 24)(pt 136 96))
(line (pt 136 96)(pt 104 96))
(line (pt 104 96)(pt 104 24))
(line (pt 118 58)(pt 123 63))
(line (pt 118 62)(pt 123 57))
(line (pt 88 27)(pt 96 27))
(line (pt 96 27)(pt 96 39))
(line (pt 96 39)(pt 88 39))
(line (pt 88 39)(pt 88 27))
(line (pt 88 34)(pt 90 36))
(line (pt 90 36)(pt 88 38))
(line (pt 80 36)(pt 88 36))
(line (pt 96 32)(pt 104 32)(line_width 3))
(line (pt 88 43)(pt 96 43))
(line (pt 96 43)(pt 96 55))
(line (pt 96 55)(pt 88 55))
(line (pt 88 55)(pt 88 43))
(line (pt 88 50)(pt 90 52))
(line (pt 90 52)(pt 88 54))
(line (pt 80 52)(pt 88 52))
(line (pt 96 48)(pt 104 48))
(line (pt 88 59)(pt 96 59))
(line (pt 96 59)(pt 96 71))
(line (pt 96 71)(pt 88 71))
(line (pt 88 71)(pt 88 59))
(line (pt 88 66)(pt 90 68))
(line (pt 90 68)(pt 88 70))
(line (pt 80 68)(pt 88 68))
(line (pt 96 64)(pt 104 64)(line_width 3))
(line (pt 80 112)(pt 80 36))
(line (pt 0 0)(pt 217 0))
(line (pt 217 0)(pt 217 146))
(line (pt 0 146)(pt 217 146))
(line (pt 0 0)(pt 0 146))
(line (pt 0 0)(pt 0 0))
(line (pt 0 0)(pt 0 0))
(line (pt 0 0)(pt 0 0))
(line (pt 0 0)(pt 0 0))
)
)
(symbol (symbol
(rect 896 608 1080 752) (rect 896 608 1080 752)
(text "LIFOstack" (rect 5 0 56 12)(font "Arial" )) (text "LIFOstack" (rect 5 0 56 12)(font "Arial" ))
@ -1789,6 +1511,287 @@ refer to the applicable agreement for further details.
(rectangle (rect 16 16 232 176)) (rectangle (rect 16 16 232 176))
) )
) )
(symbol
(rect 600 -8 816 136)
(text "ram_instr" (rect 81 0 144 16)(font "Arial" (font_size 10)))
(text "RAMi" (rect 8 128 33 140)(font "Arial" ))
(port
(pt 0 32)
(input)
(text "data[15..0]" (rect 0 0 60 14)(font "Arial" (font_size 8)))
(text "data[15..0]" (rect 4 18 64 32)(font "Arial" (font_size 8)))
(line (pt 0 32)(pt 88 32)(line_width 3))
)
(port
(pt 0 48)
(input)
(text "wren" (rect 0 0 30 14)(font "Arial" (font_size 8)))
(text "wren" (rect 4 34 34 48)(font "Arial" (font_size 8)))
(line (pt 0 48)(pt 88 48))
)
(port
(pt 0 64)
(input)
(text "address[10..0]" (rect 0 0 82 14)(font "Arial" (font_size 8)))
(text "address[10..0]" (rect 4 50 86 64)(font "Arial" (font_size 8)))
(line (pt 0 64)(pt 88 64)(line_width 3))
)
(port
(pt 0 112)
(input)
(text "clock" (rect 0 0 29 14)(font "Arial" (font_size 8)))
(text "clock" (rect 4 98 33 112)(font "Arial" (font_size 8)))
(line (pt 0 112)(pt 80 112))
)
(port
(pt 0 128)
(input)
(text "clken" (rect 0 0 29 14)(font "Arial" (font_size 8)))
(text "clken" (rect 4 114 33 128)(font "Arial" (font_size 8)))
(line (pt 0 128)(pt 16 128))
)
(port
(pt 216 32)
(output)
(text "q[15..0]" (rect 0 0 42 14)(font "Arial" (font_size 8)))
(text "q[15..0]" (rect 177 18 219 32)(font "Arial" (font_size 8)))
(line (pt 216 32)(pt 136 32)(line_width 3))
)
(drawing
(text "16 bits" (rect 109 24 121 57)(font "Arial" )(vertical))
(text "2048 words" (rect 120 12 132 67)(font "Arial" )(vertical))
(text "Block type: AUTO" (rect 48 130 137 142)(font "Arial" ))
(line (pt 104 24)(pt 136 24))
(line (pt 136 24)(pt 136 96))
(line (pt 136 96)(pt 104 96))
(line (pt 104 96)(pt 104 24))
(line (pt 118 58)(pt 123 63))
(line (pt 118 62)(pt 123 57))
(line (pt 88 27)(pt 96 27))
(line (pt 96 27)(pt 96 39))
(line (pt 96 39)(pt 88 39))
(line (pt 88 39)(pt 88 27))
(line (pt 88 34)(pt 90 36))
(line (pt 90 36)(pt 88 38))
(line (pt 80 36)(pt 88 36))
(line (pt 96 32)(pt 104 32)(line_width 3))
(line (pt 88 43)(pt 96 43))
(line (pt 96 43)(pt 96 55))
(line (pt 96 55)(pt 88 55))
(line (pt 88 55)(pt 88 43))
(line (pt 88 50)(pt 90 52))
(line (pt 90 52)(pt 88 54))
(line (pt 80 52)(pt 88 52))
(line (pt 96 48)(pt 104 48))
(line (pt 88 59)(pt 96 59))
(line (pt 96 59)(pt 96 71))
(line (pt 96 71)(pt 88 71))
(line (pt 88 71)(pt 88 59))
(line (pt 88 66)(pt 90 68))
(line (pt 90 68)(pt 88 70))
(line (pt 80 68)(pt 88 68))
(line (pt 96 64)(pt 104 64)(line_width 3))
(line (pt 80 112)(pt 80 36))
(line (pt 0 0)(pt 217 0))
(line (pt 217 0)(pt 217 146))
(line (pt 0 146)(pt 217 146))
(line (pt 0 0)(pt 0 146))
(line (pt 0 0)(pt 0 0))
(line (pt 0 0)(pt 0 0))
(line (pt 0 0)(pt 0 0))
(line (pt 0 0)(pt 0 0))
)
)
(symbol
(rect 1168 -136 1376 264)
(text "DECODE" (rect 5 0 52 12)(font "Arial" ))
(text "DECODE" (rect 8 384 55 396)(font "Arial" ))
(port
(pt 0 32)
(input)
(text "instr[15..0]" (rect 0 0 53 12)(font "Arial" ))
(text "instr[15..0]" (rect 21 27 74 39)(font "Arial" ))
(line (pt 0 32)(pt 16 32)(line_width 3))
)
(port
(pt 0 48)
(input)
(text "FETCH" (rect 0 0 36 12)(font "Arial" ))
(text "FETCH" (rect 21 43 57 55)(font "Arial" ))
(line (pt 0 48)(pt 16 48))
)
(port
(pt 0 64)
(input)
(text "EXEC1" (rect 0 0 34 12)(font "Arial" ))
(text "EXEC1" (rect 21 59 55 71)(font "Arial" ))
(line (pt 0 64)(pt 16 64))
)
(port
(pt 0 80)
(input)
(text "EXEC2" (rect 0 0 34 12)(font "Arial" ))
(text "EXEC2" (rect 21 75 55 87)(font "Arial" ))
(line (pt 0 80)(pt 16 80))
)
(port
(pt 0 96)
(input)
(text "COND_result" (rect 0 0 66 12)(font "Arial" ))
(text "COND_result" (rect 21 91 87 103)(font "Arial" ))
(line (pt 0 96)(pt 16 96))
)
(port
(pt 208 32)
(output)
(text "R0_count" (rect 0 0 47 12)(font "Arial" ))
(text "R0_count" (rect 148 27 187 39)(font "Arial" ))
(line (pt 208 32)(pt 192 32))
)
(port
(pt 208 48)
(output)
(text "R0_en" (rect 0 0 31 12)(font "Arial" ))
(text "R0_en" (rect 161 43 187 55)(font "Arial" ))
(line (pt 208 48)(pt 192 48))
)
(port
(pt 208 64)
(output)
(text "R1_en" (rect 0 0 31 12)(font "Arial" ))
(text "R1_en" (rect 161 59 187 71)(font "Arial" ))
(line (pt 208 64)(pt 192 64))
)
(port
(pt 208 80)
(output)
(text "R2_en" (rect 0 0 31 12)(font "Arial" ))
(text "R2_en" (rect 161 75 187 87)(font "Arial" ))
(line (pt 208 80)(pt 192 80))
)
(port
(pt 208 96)
(output)
(text "R3_en" (rect 0 0 31 12)(font "Arial" ))
(text "R3_en" (rect 161 91 187 103)(font "Arial" ))
(line (pt 208 96)(pt 192 96))
)
(port
(pt 208 112)
(output)
(text "R4_en" (rect 0 0 31 12)(font "Arial" ))
(text "R4_en" (rect 161 107 187 119)(font "Arial" ))
(line (pt 208 112)(pt 192 112))
)
(port
(pt 208 128)
(output)
(text "R5_en" (rect 0 0 31 12)(font "Arial" ))
(text "R5_en" (rect 161 123 187 135)(font "Arial" ))
(line (pt 208 128)(pt 192 128))
)
(port
(pt 208 144)
(output)
(text "R6_en" (rect 0 0 31 12)(font "Arial" ))
(text "R6_en" (rect 161 139 187 151)(font "Arial" ))
(line (pt 208 144)(pt 192 144))
)
(port
(pt 208 160)
(output)
(text "R7_en" (rect 0 0 31 12)(font "Arial" ))
(text "R7_en" (rect 161 155 187 167)(font "Arial" ))
(line (pt 208 160)(pt 192 160))
)
(port
(pt 208 176)
(output)
(text "s1[2..0]" (rect 0 0 37 12)(font "Arial" ))
(text "s1[2..0]" (rect 156 171 187 183)(font "Arial" ))
(line (pt 208 176)(pt 192 176)(line_width 3))
)
(port
(pt 208 192)
(output)
(text "s2[2..0]" (rect 0 0 37 12)(font "Arial" ))
(text "s2[2..0]" (rect 156 187 187 199)(font "Arial" ))
(line (pt 208 192)(pt 192 192)(line_width 3))
)
(port
(pt 208 208)
(output)
(text "s3[2..0]" (rect 0 0 37 12)(font "Arial" ))
(text "s3[2..0]" (rect 156 203 187 215)(font "Arial" ))
(line (pt 208 208)(pt 192 208)(line_width 3))
)
(port
(pt 208 224)
(output)
(text "s4" (rect 0 0 11 12)(font "Arial" ))
(text "s4" (rect 178 219 187 231)(font "Arial" ))
(line (pt 208 224)(pt 192 224))
)
(port
(pt 208 240)
(output)
(text "RAMd_wren" (rect 0 0 57 12)(font "Arial" ))
(text "RAMd_wren" (rect 139 235 187 247)(font "Arial" ))
(line (pt 208 240)(pt 192 240))
)
(port
(pt 208 256)
(output)
(text "RAMd_en" (rect 0 0 47 12)(font "Arial" ))
(text "RAMd_en" (rect 148 251 187 263)(font "Arial" ))
(line (pt 208 256)(pt 192 256))
)
(port
(pt 208 272)
(output)
(text "RAMi_en" (rect 0 0 43 12)(font "Arial" ))
(text "RAMi_en" (rect 151 267 187 279)(font "Arial" ))
(line (pt 208 272)(pt 192 272))
)
(port
(pt 208 288)
(output)
(text "ALU_en" (rect 0 0 38 12)(font "Arial" ))
(text "ALU_en" (rect 155 283 187 295)(font "Arial" ))
(line (pt 208 288)(pt 192 288))
)
(port
(pt 208 304)
(output)
(text "E2" (rect 0 0 12 12)(font "Arial" ))
(text "E2" (rect 177 299 187 311)(font "Arial" ))
(line (pt 208 304)(pt 192 304))
)
(port
(pt 208 320)
(output)
(text "stack_en" (rect 0 0 44 12)(font "Arial" ))
(text "stack_en" (rect 150 315 187 327)(font "Arial" ))
(line (pt 208 320)(pt 192 320))
)
(port
(pt 208 336)
(output)
(text "stack_rst" (rect 0 0 46 12)(font "Arial" ))
(text "stack_rst" (rect 149 331 187 343)(font "Arial" ))
(line (pt 208 336)(pt 192 336))
)
(port
(pt 208 352)
(output)
(text "stack_rw" (rect 0 0 43 12)(font "Arial" ))
(text "stack_rw" (rect 151 347 187 359)(font "Arial" ))
(line (pt 208 352)(pt 192 352))
)
(drawing
(rectangle (rect 16 16 192 384))
)
)
(connector (connector
(pt 856 192) (pt 856 192)
(pt 936 192) (pt 936 192)
@ -1815,31 +1818,6 @@ refer to the applicable agreement for further details.
(pt 936 208) (pt 936 208)
(pt 880 208) (pt 880 208)
) )
(connector
(text "FETCH" (rect 418 32 449 49)(font "Intel Clear" ))
(pt 408 48)
(pt 448 48)
)
(connector
(text "CLK" (rect 236 32 256 49)(font "Intel Clear" ))
(pt 256 48)
(pt 224 48)
)
(connector
(text "E2" (rect 234 48 245 65)(font "Intel Clear" ))
(pt 256 64)
(pt 224 64)
)
(connector
(text "EXEC2" (rect 418 64 449 81)(font "Intel Clear" ))
(pt 408 80)
(pt 448 80)
)
(connector
(text "EXEC1" (rect 418 48 449 65)(font "Intel Clear" ))
(pt 408 64)
(pt 448 64)
)
(connector (connector
(text "Rd[15..0]" (rect 818 576 860 593)(font "Intel Clear" )) (text "Rd[15..0]" (rect 818 576 860 593)(font "Intel Clear" ))
(pt 816 592) (pt 816 592)
@ -2041,23 +2019,12 @@ refer to the applicable agreement for further details.
(pt 632 304) (pt 632 304)
(bus) (bus)
) )
(connector
(text "PC[10..0]" (rect 448 145 465 188)(font "Intel Clear" )(vertical))
(pt 464 144)
(pt 464 192)
(bus)
)
(connector (connector
(text "PC[15..0]" (rect 410 176 453 193)(font "Intel Clear" )) (text "PC[15..0]" (rect 410 176 453 193)(font "Intel Clear" ))
(pt 408 192) (pt 408 192)
(pt 464 192) (pt 464 192)
(bus) (bus)
) )
(connector
(pt 464 192)
(pt 632 192)
(bus)
)
(connector (connector
(text "s1[2..0]" (rect 602 160 636 177)(font "Intel Clear" )) (text "s1[2..0]" (rect 602 160 636 177)(font "Intel Clear" ))
(pt 632 176) (pt 632 176)
@ -2144,11 +2111,6 @@ refer to the applicable agreement for further details.
(pt 632 720) (pt 632 720)
(bus) (bus)
) )
(connector
(pt 464 192)
(pt 464 400)
(bus)
)
(connector (connector
(pt 464 400) (pt 464 400)
(pt 464 608) (pt 464 608)
@ -2550,16 +2512,6 @@ refer to the applicable agreement for further details.
(pt 1168 -88) (pt 1168 -88)
(pt 1128 -88) (pt 1128 -88)
) )
(connector
(text "SM_rst" (rect 226 64 259 81)(font "Intel Clear" ))
(pt 224 80)
(pt 256 80)
)
(connector
(pt 464 144)
(pt 208 144)
(bus)
)
(connector (connector
(text "CLK" (rect 578 88 598 105)(font "Intel Clear" )) (text "CLK" (rect 578 88 598 105)(font "Intel Clear" ))
(pt 568 104) (pt 568 104)
@ -2570,26 +2522,6 @@ refer to the applicable agreement for further details.
(pt 560 120) (pt 560 120)
(pt 600 120) (pt 600 120)
) )
(connector
(pt 600 56)
(pt 568 56)
(bus)
)
(connector
(pt 568 56)
(pt 568 8)
(bus)
)
(connector
(pt 568 8)
(pt 208 8)
(bus)
)
(connector
(pt 208 144)
(pt 208 8)
(bus)
)
(connector (connector
(pt 872 24) (pt 872 24)
(pt 872 224) (pt 872 224)
@ -2753,6 +2685,62 @@ refer to the applicable agreement for further details.
(pt 1440 344) (pt 1440 344)
(bus) (bus)
) )
(connector
(pt 464 192)
(pt 464 400)
(bus)
)
(connector
(pt 600 56)
(pt 536 56)
(bus)
)
(connector
(text "PC[10..0]" (rect 512 137 529 180)(font "Intel Clear" )(vertical))
(pt 536 192)
(pt 536 56)
(bus)
)
(connector
(pt 464 192)
(pt 536 192)
(bus)
)
(connector
(pt 536 192)
(pt 632 192)
(bus)
)
(connector
(text "FETCH" (rect 466 40 497 57)(font "Intel Clear" ))
(pt 456 56)
(pt 496 56)
)
(connector
(text "EXEC2" (rect 466 72 497 89)(font "Intel Clear" ))
(pt 456 88)
(pt 496 88)
)
(connector
(text "EXEC1" (rect 466 56 497 73)(font "Intel Clear" ))
(pt 456 72)
(pt 496 72)
)
(connector
(text "CLK" (rect 284 40 304 57)(font "Intel Clear" ))
(pt 272 56)
(pt 304 56)
)
(connector
(text "E2" (rect 282 56 293 73)(font "Intel Clear" ))
(pt 272 72)
(pt 304 72)
)
(connector
(text "SM_rst" (rect 274 72 307 89)(font "Intel Clear" ))
(pt 272 88)
(pt 304 88)
)
(junction (pt 856 192)) (junction (pt 856 192))
(junction (pt 136 320)) (junction (pt 136 320))
(junction (pt 136 352)) (junction (pt 136 352))
@ -2779,3 +2767,4 @@ refer to the applicable agreement for further details.
(junction (pt 576 512)) (junction (pt 576 512))
(junction (pt 1416 496)) (junction (pt 1416 496))
(junction (pt 872 24)) (junction (pt 872 24))
(junction (pt 536 192))

View file

@ -48,6 +48,7 @@ set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL
set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_global_assignment -name VERILOG_FILE LIFOstack.v set_global_assignment -name VERILOG_FILE LIFOstack.v
set_global_assignment -name VERILOG_FILE alu.v set_global_assignment -name VERILOG_FILE alu.v
set_global_assignment -name MIF_FILE LUTSquares.mif set_global_assignment -name MIF_FILE LUTSquares.mif
@ -66,5 +67,4 @@ set_global_assignment -name VERILOG_FILE min.v
set_global_assignment -name VERILOG_FILE SM.v set_global_assignment -name VERILOG_FILE SM.v
set_global_assignment -name BDF_FILE ALU_top.bdf set_global_assignment -name BDF_FILE ALU_top.bdf
set_global_assignment -name VERILOG_FILE mux_8x16.v set_global_assignment -name VERILOG_FILE mux_8x16.v
set_global_assignment -name VERILOG_FILE mux_3x16.v set_global_assignment -name VERILOG_FILE mux_3x16.v
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

Binary file not shown.

View file

@ -50,33 +50,33 @@ module DECODE
wire NOP = ~msb & op[5] & op[4] & op[3] & op[2] & op[1] & ~op[0]; wire NOP = ~msb & op[5] & op[4] & op[3] & op[2] & op[1] & ~op[0];
wire STP = ~msb & op[5] & op[4] & op[3] & op[2] & op[1] & op[0]; wire STP = ~msb & op[5] & op[4] & op[3] & op[2] & op[1] & op[0];
assign R0_count = EXEC1 & (~(UJMP | (JMP & ~COND_result) | STP)); assign R0_count = EXEC1 & (~(UJMP | (JMP & COND_result) | STP));
assign R0_en = (EXEC1 & (~(STORE | NOP | STP | LOAD) & ~Rd[2] & ~Rd[1] & ~Rd[0] | UJMP | JMP & COND_result)) | (EXEC2 & LOAD & ~Rls[2] & ~Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & ~Rd[1] & ~Rd[0]); assign R0_en = (EXEC1 & (~(STORE | NOP | STP | LOAD | PSH) & ~Rd[2] & ~Rd[1] & ~Rd[0] | UJMP | JMP & COND_result)) | (EXEC2 & LOAD & ~Rls[2] & ~Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & ~Rd[1] & ~Rd[0]);
assign R1_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & ~Rd[2] & ~Rd[1] & Rd[0]) | (EXEC2 & LOAD & ~Rls[2] & ~Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & ~Rd[1] & Rd[0]); assign R1_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & ~Rd[2] & ~Rd[1] & Rd[0]) | (EXEC2 & LOAD & ~Rls[2] & ~Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & ~Rd[1] & Rd[0]);
assign R2_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & ~Rd[2] & Rd[1] & ~Rd[0]) | (EXEC2 & LOAD & ~Rls[2] & Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & Rd[1] & ~Rd[0]); assign R2_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & ~Rd[2] & Rd[1] & ~Rd[0]) | (EXEC2 & LOAD & ~Rls[2] & Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & Rd[1] & ~Rd[0]);
assign R3_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & ~Rd[2] & Rd[1] & Rd[0]) | (EXEC2 & LOAD & ~Rls[2] & Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & Rd[1] & Rd[0]); assign R3_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & ~Rd[2] & Rd[1] & Rd[0]) | (EXEC2 & LOAD & ~Rls[2] & Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & ~Rd[2] & Rd[1] & Rd[0]);
assign R4_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & Rd[2] & ~Rd[1] & ~Rd[0]) | (EXEC2 & LOAD & Rls[2] & ~Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & ~Rd[1] & ~Rd[0]); assign R4_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & Rd[2] & ~Rd[1] & ~Rd[0]) | (EXEC2 & LOAD & Rls[2] & ~Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & ~Rd[1] & ~Rd[0]);
assign R5_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & Rd[2] & ~Rd[1] & Rd[0]) | (EXEC2 & LOAD & Rls[2] & ~Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & ~Rd[1] & Rd[0]); assign R5_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & Rd[2] & ~Rd[1] & Rd[0]) | (EXEC2 & LOAD & Rls[2] & ~Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & ~Rd[1] & Rd[0]);
assign R6_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & Rd[2] & Rd[1] & ~Rd[0]) | (EXEC2 & LOAD & Rls[2] & Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & Rd[1] & ~Rd[0]); assign R6_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & Rd[2] & Rd[1] & ~Rd[0]) | (EXEC2 & LOAD & Rls[2] & Rls[1] & ~Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & Rd[1] & ~Rd[0]);
assign R7_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP) & Rd[2] & Rd[1] & Rd[0]) | (EXEC2 & LOAD & Rls[2] & Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & Rd[1] & Rd[0]); assign R7_en = (EXEC1 & ~(UJMP | JMP | STORE | LOAD | MUL | MLA | MLS | NOP | STP | POP | PSH) & Rd[2] & Rd[1] & Rd[0]) | (EXEC2 & LOAD & Rls[2] & Rls[1] & Rls[0]) | (EXEC2 & (MUL | MLA | MLS | POP) & Rd[2] & Rd[1] & Rd[0]);
assign s1[2] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs1[2]) | (STORE & Rls[2]) | (PSH & Rs1[2]); assign s1[2] = (~(UJMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs1[2]) | (STORE & Rls[2]) | (PSH & Rs1[2]);
assign s1[1] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs1[1]) | (STORE & Rls[1]) | (PSH & Rs1[1]); assign s1[1] = (~(UJMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs1[1]) | (STORE & Rls[1]) | (PSH & Rs1[1]);
assign s1[0] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs1[0]) | (STORE & Rls[0]) | (PSH & Rs1[0]); assign s1[0] = (~(UJMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs1[0]) | (STORE & Rls[0]) | (PSH & Rs1[0]);
assign s2[2] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs2[2]); assign s2[2] = (~(UJMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs2[2]);
assign s2[1] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs2[1]); assign s2[1] = (~(UJMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs2[1]);
assign s2[0] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs2[0]); assign s2[0] = (~(UJMP | STORE | LOAD | NOP | STP | PSH | POP) & Rs2[0]);
assign s3[2] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rd[2]); assign s3[2] = (~(STORE | LOAD | NOP | STP | PSH | POP) & Rd[2]);
assign s3[1] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rd[1]); assign s3[1] = (~(STORE | LOAD | NOP | STP | PSH | POP) & Rd[1]);
assign s3[0] = (~(UJMP | JMP | STORE | LOAD | NOP | STP | PSH | POP) & Rd[0]); assign s3[0] = (~(STORE | LOAD | NOP | STP | PSH | POP) & Rd[0]);
assign s4 = ~LOAD; assign s4 = ~LOAD;
assign RAMd_wren = EXEC1 & STORE; assign RAMd_wren = EXEC1 & STORE;
assign RAMd_en = EXEC1 & (STORE | LOAD); assign RAMd_en = EXEC1 & (STORE | LOAD);
assign RAMi_en = FETCH; assign RAMi_en = FETCH;
assign ALU_en = LOAD | STORE; assign ALU_en = LOAD | STORE;
assign E2 = EXEC1 & (LOAD | MUL | MLA | MLS | POP); assign E2 = EXEC1 & (LOAD | MUL | MLA | MLS | POP);
assign stack_en = (EXEC1 & PSH) | POP; assign stack_en = (EXEC1 & PSH) | ((EXEC1 | EXEC2) & POP);
assign stack_rst = STP; assign stack_rst = STP;
assign stack_rw = POP; assign stack_rw = EXEC1 & PSH;
endmodule endmodule

28
SM.v
View file

@ -2,7 +2,7 @@ module SM
( (
input CLK, input CLK,
input E2, input E2,
input RST, input RST, //resets state machine to FETCH
output FETCH, output FETCH,
output EXEC1, output EXEC1,
output EXEC2 output EXEC2
@ -12,12 +12,30 @@ reg [2:0]s = 3'b1; //current state initialised to 001
always @(posedge CLK) //Change on rising edge of clock always @(posedge CLK) //Change on rising edge of clock
begin begin
s[2] <= ~s[2] & s[1] & ~s[0] & E2 & ~RST; case(s)
s[1] <= ~s[2] & ~s[1] & s[0] & ~RST; 3'b000: s = 3'b001; //if in 000, go to FETCH
s[0] <= (~s[2] & s[1] & ~s[0] & ~E2) | (s[2] & ~s[1] & ~s[0]) | RST; 3'b001: begin
end if(!RST)
s = 3'b010;
else
s = 3'b001;
end
3'b010: begin //if in EXEC1, go to EXEC2 if E2=1 or FETCH if E2=0
if(!RST)
if(E2)
s = 3'b100;
else
s = 3'b001;
else
s = 3'b001;
end
3'b100: s = 3'b001; //if in EXEC2, go to FETCH
default: s = 3'b001;
endcase
end
assign FETCH = s[0]; assign FETCH = s[0];
assign EXEC1 = s[1]; assign EXEC1 = s[1];
assign EXEC2 = s[2]; assign EXEC2 = s[2];
endmodule endmodule

View file

@ -27,16 +27,17 @@ CONTENT BEGIN
003 : FFFF; 003 : FFFF;
004 : BFFF; 004 : BFFF;
005 : 000A; 005 : 000A;
006 : 001B; 006 : 0017;
007 : 001E; 007 : 001A;
008 : 0021; 008 : 001D;
009 : 0024; 009 : 0020;
00A : 0027; 00A : 0024;
00B : 0000; 00B : 0000;
00C : 002B; 00C : 0027;
00D : 002E; 00D : 002A;
00E : 0031; 00E : 002D;
00F : 0036; 00F : 0032;
010 : AAAA; 010 : AAAA;
[011..7FF] : 0000; 011 : 0004;
[013..7FF] : 0000;
END; END;

112
instr.mif
View file

@ -28,62 +28,58 @@ CONTENT BEGIN
4 : 2D20; 4 : 2D20;
5 : 3161; 5 : 3161;
6 : 3448; 6 : 3448;
7 : 3993; 7 : D002;
8 : 3AA5; 8 : B002;
9 : D003; 9 : 9804;
10 : 3CE2; 10 : B811;
11 : A003; 11 : 419F;
12 : 9804; 12 : 304F;
13 : 38A5; 13 : 5008;
14 : 3FC0; 14 : 5028;
15 : 419F; 15 : 284F;
16 : 304F; 16 : 43F7;
17 : 5008; 17 : 3568;
18 : 5028; 18 : 45F5;
19 : 284F; 19 : 484D;
20 : 43F7; 20 : 8806;
21 : 3568; 21 : 0040;
22 : 47F5; 22 : B800;
23 : 484D; 23 : 8807;
24 : 8806; 24 : 085A;
25 : 0040; 25 : B800;
26 : B800; 26 : 8808;
27 : 8807; 27 : 0A6F;
28 : 085A; 28 : B800;
29 : B800; 29 : 8809;
30 : 8808; 30 : 0C53;
31 : 0A7D; 31 : B801;
32 : B800; 32 : 880A;
33 : 8809; 33 : B00B;
34 : 0C53; 34 : 0E70;
35 : B801; 35 : B800;
36 : 880A; 36 : 880C;
37 : B00B; 37 : 1063;
38 : 0E70; 38 : B800;
39 : B800; 39 : 880D;
40 : 880C; 40 : 126D;
41 : 1063; 41 : B800;
42 : B800; 42 : 880E;
43 : 880D; 43 : 147E;
44 : 126D; 44 : B800;
45 : B800; 45 : 880F;
46 : 880E; 46 : 5340;
47 : 147A; 47 : 53C0;
48 : B800; 48 : 1678;
49 : 880F; 49 : B800;
50 : 5340; 50 : 1863;
51 : 53C0; 51 : 1A5F;
52 : 1678; 52 : 1FB8;
53 : B800; 53 : 7C00;
54 : 1863; 54 : 1C77;
55 : 1A5A; 55 : 204C;
56 : 1FB8; 56 : A810;
57 : 7C00; 57 : 226D;
58 : 1C77; 58 : 246D;
59 : 204C; 59 : 7E00;
60 : A810; [60..2047] : 0000;
61 : 226D;
62 : 246D;
63 : 7E00;
[64..2047] : 0000;
END; END;