The Chip Specification document explains the Universal Asynchronous Receiver Transmitter (UART) data transmission module and Memory Interface Block (MIB) memory manager module as used in a terminal communication project. The transmit engine and receive engine work together to communicate the SOPC with the terminal. ASCII values are output to the terminal, and sent from the terminal to be interpreted by the TramelBlaze. These engines combined form the UART engine. In addition, A Memory Interface Block gives the TramelBlaze the ability to access Micron Memory from the Nexys A7.
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
Chip specification
1. Final Project
System on Chip Specification
TramelBlaze, UART & MIB
CECS 460: System on Chip Design
Paul Valenzuela
018469189
Submitted On:
May 12, 2020
COLLEGE OF ENGINEERING
Department of Computer Engineering and Computer Science
2. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
This document contains information proprietary to the CSULB
student that created the file – any reuse without adequate approval and
documentation is prohibited.
In submitting this file for class work at CSULB I am confirming that this is
my work and the work of no one else.
In the event, other sources are utilized I will document
which portion of code and who is the author.
In submitting this project, I acknowledge that plagiarism in student
project work is subject to dismissal from the class.
Valenzuela 2
6. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
I. Introduction
The Chip Specification document explains the Universal Asynchronous Receiver Transmitter (UART)
data transmission module and Memory Interface Block (MIB) memory manager module as used in a terminal
communication project. The transmit engine and receive engine work together to communicate the SOPC with
the terminal. ASCII values are output to the terminal, and sent from the terminal to be interpreted by the
TramelBlaze. These engines combined form the UART engine. In addition, A Memory Interface Block gives
the TramelBlaze the ability to access Micron Memory from the Nexys A7.
I.1 Purpose
This project was essential in understanding how the Transmit and Receive engine of UART
data transmission worked. This meant input can be put into the terminal and data was output back
out and displayed on the terminal. In addition, this project was the first time a Memory
Interface Block was used to manage the memory addresses and data that communicated with
the Micron Memory. This document will go in depth about what each module within the project does.
This includes top level diagrams, a description, details on the I/O ports, logic tables, and
register map tables. A chip level test is then added at the end to indicate that the project
fulfilled all requirements.
Valenzuela 6
7. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
II. External Documents
II.1 TramelBlaze
II.1.1 Detailed Block Diagram
These documents explain the architecture, instruction set, and logic of the TramelBlaze and its interfaces. It
helped to create the design of the project and the Programmable Read-Only Memory (PROM) within the design.
The TramelBlaze is a 16-Bit PicoBlaze emulator. The PicoBlaze is an embedded 8-bit RISC microcontroller. The
PicoBlaze had similar logic, architecture, and instruction set to the TramelBlaze. The PicoBlaze documentation provided the
basis for our TramelBlaze programming and usage.
Valenzuela 7
8. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
II.1.2 Data Transmission:
Memory:
The TramelBlaze is able to run using 4 different types of memory.
1. 512 x 16 Scratch RAM - This is where interpreted data is stored
2. 128 x 16 Stack RAM - Holds temporary data storage that behaves as a FILO buffer
3. 4096 x 16 TB ROM - Instructions are stored in the TramelBlaze ROM
4. 16 x 16 Register Array
Valenzuela 8
9. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
II.1.3 TramelBlaze Instructions:
An essential part of learning to program
The TramelBlaze is understanding the
Instructions that can be performed on
The scratch RAM memory, and the registers.
These diagrams demonstrate
how to send and grab data from the
TramelBlaze. It also shows each operation
and how to perform them on the registers.
Valenzuela 9
10. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
II.1.4 Software Design
Trambler Directives
Assembler directives are “instructions” added to the assembly language program that are intended to communicate with the
assembler – they are not instructions to be converted into machine language instructions
ADDRESS – default address is 000. This directive changes where the instructions are placed in the range 000…FFF
EQU – Equate a label with a constant value to be substituted prior to final assembly
END – End of the source
Source Code Organization
TramelBlaze code should be organized into six main portions:
Declarations – define all constants and string substitutions
Initialization – all setup required before enabling interrupts and entering main loop
Main Loop – routine where the processor spends most of its time. Cycling is achieved by JUMP at the end
of the loop
Service Routines – all of the routines needed to implement the functionality of the software (typically
executed with interrupt enables.
Interrupt Service Routine (ISR) – routine invoked when interrupt occurs. Best to minimize time spent in
ISE with interrupts disabled.
Vector to ISE found at FFE/FFF
Top Level Design
Valenzuela 10
12. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
II.2.2 Input/Output
This figure shows the switch, LED,
Button, and Seven Segment Display
connections of the Nexys A7. This shows
the pin names and how to
connect them to the top module
through the constraint file
II.2.3 Nexys A7 UART Configuration
Valenzuela 12
13. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
III. Requirements
III.1 Interface Requirements
This project uses three components: the TramelBlaze, the UART Engine, and the Memory Interface Block.
These components are instantiated within the top module. The MIB takes characters from the Receive Engine of the UART,
and places them in Micron Memory. Once a special character is received, a certain value is transmitted to the terminal. For
example, ‘*’ causes hometown transmission. To accomplish this, the TramelBlaze takes the ASCII values stored in Micron
Memory and outputs the values to the terminal using the Transmit Engine. Before any input can be received by the Transmit
Engine however, a banner displaying ‘WELCOME CECS !’ is transmitted to the terminal.
Since UART Protocol is being used, Baud Rate is an essential part of data communication. All components
involved need to operate at the same bit transmitting/receiving frequency. The switches of the Nexys A7 control the Baud
Rate and UART Parity values.
Baud Switches Baud Rate Bit Time Nexys A7 Count
0000 300 0.0033333333 3333333
0001 1200 0.000833333 83333
0010 2400 0.000041667 41667
0011 4800 0.000208333 20833
0100 9600 0.000104167 10417
0101 19200 5.20833E-05 5208
0110 38400 2.60417E-05 2604
0111 57600 1.73611E-05 1736
1000 115200 8.68056E-06 868
1001 230400 4.34028E-06 434
1010 460800 2.17014E-06 217
1011 921600 1.08507E-06 109
This logic table describes how switches[3:1] are in charge of the number of bits and the parity bit. Switch[3] decides
whether the data is 8 or 7 bits. Switch[2] is in charge of if there is a parity bit. Switch[1] manages either even
or odd parity.
Switches[3:1] Data Size (Bits) Parity
000 7 None
001 7 None
010 7 Even
011 7 Odd
100 8 None
101 8 None
110 8 Even
111 8 Odd
Valenzuela 13
14. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
III.2 Physical Requirements
This table demonstrates how the switches are the input values for BAUD[3:0], eight, pen, ohel.
Eight: This input signal connects to switch[3] and indicates whether or not the data being
transmitted is 8 bits wide. ‘1’ for yes, ‘0’ for no.
PEN: This input signal connects to switch[2] and indicates whether or not the data has parity
enabled. ‘1’ for yes, ‘0’ for no.
OHEL: This input signal connects to switch[1] and indicates what kind of parity the data has.
‘1’ means odd parity, ‘0’ means even.
BTNU BTND BTNC BTNL BTNR
Reset N/A N/A N/A N/A
Only one button is used in this design to connect to the AISO block. When this button is pressed,
a global reset is sent to the AISO block. The output of the AISO block is then sent to all flops in the
design.
LEDS[7] LEDS[6] LEDS[5] LEDS[4] LEDS[3] LEDS[2] LEDS[1] LEDS[0]
The LEDs are used to walk a ‘1’ through them from LSB to MSB. The walking LED effect
demonstrates that the system is running.
Switches[7] Switches[6] Switches[5] Switches[4] Switches[3] Switches[2] Switches[1] Switches[0]
Baud[3] Baud[2] Baud[1] Baud[0] Eight PEN OHEL N/A
Valenzuela 14
15. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
IV. Top Level Design
IV.1 Description
The top level module connects all the modules together. This is done by instantiating the AISO ,
TramelBlaze Top, UART, Seven Segment Display, RS Flop, and two Address Decoders. The inputs/outputs are
connected to the FPGA.
IV.2 Top Level Diagram
Valenzuela 15
17. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
IV.4 Data Flow Description
This project required that the user was able to interact with the terminal using the UART processor.
This project is important because it fully incorporated the UART design. The program
will display the banner “WELCOME CECS !” and then it will wait for the user input from the terminal. If the
terminal notices an input, it will check which character has been input. If it detects “*”, a hometown will be
printed. If it detects “@”, the terminal will print the amount of characters stored from previous inputs. If a
<backspace> is detected, a backspace occurs. Lastly if <cr> is detected, a new prompt is printed. In addition,
a ‘1’ is walked through the LEDs to indicate that the program is running. This project was also the first
time a Memory Interface Block was used to manage the memory addresses and data that communicated
with the Micron Memory. The TramelBlaze will be able to grab data from the terminal and place
those characters into a location in the memory
IV.5 Input/Output
Signal Size I/O Connection
clk 1 Input 100MHz Oscillator
reset 1 Input AISO
switches 7 Input Nexys A7 Switches[7:0]
TX 1 Output Nexys A7 Transmit USB
RX 1 Input Nexys A7 Receive USB
memoryAddress 23 Output Micron Memory
currentStatus 8 Output Micron Memory
cCE 1 Output Micron Memory
cWE 1 Output Micron Memory
cOE 1 Output Micron Memory
cADV 1 Output Micron Memory
CRE 1 Output Micron Memory
cUB 1 Output Micron Memory
cLB 1 Output Micron Memory
MIBInOut 16 Output Micron Memory
anode 8 Output Nexys A7 Anode
cathode 8 Output Nexys A7 Cathode
LEDs 8 Output Nexys A7 LED[7:0]
Valenzuela 17
18. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
IV.6 Pin Assignments
Input Signals Assignment Output Signals Assignment
clk E3 leds[0] H17
reset M18 leds [1] K15
rx C4 leds [2] J13
eight R15 leds[3] N14
pen M13 leds[4] R18
Ohel L16 leds[5] V17
baud[0] R17 leds[6] U17
baud[1] T18 leds[7] U16
baud[2] U18 tx D4
baud[3] R13
IV.7 Electrical Requirements
Buttons
3.3V equates to logic ‘1’
0V equates to logic ‘0’
Switches
1.8 V equates to logic ‘1’
0V equates to logic ‘0’
IV.8 Clock
The Nexys A7 clock is regulated by a 100MHz crystal oscillator. All flops in this design use the clock and update their
register values at rising clock edges.
IV.9 Resets
The Reset of the project is connected to Pin M18 of the Nexys A7 board. It is a button and every time that button is pressed,
the reset signal is sent to the AISO block which sends a synchronized reset signal to all flops in the design.
Source Code: Appendix VIII.18
Valenzuela 18
19. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
IV.10 Software
1 ; Paul Valenzuela
2 ; 018469189
3 ; CECS 460
4 ; This code transmits
5 ; '<CR><LF>WELCOME CECS !' banner then
6 ; prompt on reset and detect four chars
7 ; that choose to DISPLAY hometown (*)
8 ; amount of characters in line (@)
9 ; backspace (BACKSP)
10 ; new prompt (<CR>)
11 ; Also 8 onboard walking LEDS indicate that
12 ; the code is working correctly
13
14
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ; Define and initialize global variables
17 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18 ZERO EQU 0000
19 ONE EQU 0001
20 TWO EQU 0002
21 THREE EQU 0003
22 FOUR EQU 0004
23 FIVE EQU 0005
24 LEDDELAY EQU BA03
25 TOP EQU 0028
26 BACKSP EQU 0008
27 CARRET EQU 000D
28 PROMPTCHECK EQU 0010
29 BNCHK EQU 0014
30 HTCHK EQU 0020
31 ASTSYM EQU 002A
32 ATSYM EQU 0040
33
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35 ; Define Registers
36 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 TEMP EQU R0 ; Temp to hold temporary data
38 POINTER EQU R1 ; Pointer to RAM
39 TXCHECK EQU R2 ; TX Check
40 VALUE EQU R3 ; Check if UART Ready
41 LEDCOUNT2 EQU R4 ; Counter for LED Delay
42 LEDS EQU R5 ; LEDs
43 COUNTER EQU R6 ; Counter
44 LEDCOUNT EQU R7 ; Counter for LED Delay
45 STATUS EQU R8 ; Status of RX and TX
46 ERROR EQU R9 ; Check possible errors
47 DIVISOR EQU RA ; Divisor for ASCII Convert
48 QUOTIENT EQU RB ; Quotient for ASCII Convert
49 TXSTATE EQU RC ; Transmit State
50 WORKS EQU RD ; Checks if value is valid
51 COUNT EQU RE ; Temporarily holds counter
52
53
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55 ; Initialize variables and RAM
56 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Valenzuela 19
20. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
57 INIT
58 ENINT
59 LOAD POINTER, ZERO ; Pointer = 0
60 LOAD VALUE, ZERO ; Value = 0
61 LOAD LEDS, ONE ; LEDS = 0001
62 LOAD LEDCOUNT2, ZERO ; LEDcount2 = 0
63 LOAD LEDCOUNT, ZERO ; LEDcount = 0
64 LOAD TXSTATE, ZERO ; TXState = 0
65 LOAD STATUS, ZERO ; Status = 0
66 LOAD COUNTER, ZERO ; Counter = 0
67 CALL BANNER ; Insert Banner into Scratch RAM
68 CALL PROMPT ; Insert Prompt into Scratch RAM
69 CALL HOMETOWN ; Insert Hometown into Scratch RAM
70 CALL BACKSPACE ; Insert <bs> into Scratch RAM
71 CALL HEXCONVERT ; Initialize Binary to ASCII Converter
72
73
74 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75 ; Main Routine that cycles through LED
76 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77 MAIN
78 OUTPUT LEDS, ONE ; Output LED values to board
79 COMP LEDS, 0080 ; LEDS == 0080 ?
80 CALLZ RESETLEDS ; If true call reset LEDS
81 RL LEDS ; Shift LEDS left 1 bit
82 CALL LEDCOUNTER ; Call subroutine to slow LEDs
83 JUMP MAIN ; Super Loop Main
84
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
86 ; Resets LED value to "0000 0001"
87 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
88 RESETLEDS
89 LOAD LEDS, ONE ; LEDS = 0001
90 RETURN
91
92
93 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
94 ; Counter that delays the walking '1' in LED value
95 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96 LEDCOUNTER
97 ADD LEDCOUNT, ONE ; Increment counter1
98 NOP ; Wait
99 COMP LEDCOUNT, LEDDELAY ; Check once counter1 reaches 11
100 JUMPC LEDCOUNTER ; Loop until true
101 LOAD LEDCOUNT, ZERO ; Reset counter1
102 ADD LEDCOUNT2, ONE ; Increment counter2
103 COMP LEDCOUNT2, FOUR ; Check once counter2 reaches 4
104 JUMPNZ LEDCOUNTER ; Loop until true
Valenzuela 20
21. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
105 LOAD LEDCOUNT2, ZERO ; Reset counter2
106 RETURN
107
108 ; ISR ADDRESS
109 ADDRESS 0300
110
111 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
112 ; Interrupt Service Routine
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114 ISR
115 STORE POINTER, 0031 ; RAM[65] = Pointer
116 INPUT STATUS, ONE ; Read the Status Value
117
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 ; Checks if txReady is active
120 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121 LOAD TEMP, STATUS ; Temp = status
122 COMP TXSTATE, FOUR ; TXState == 4 ?
123 JUMPZ RXCHECK ; If true, check if RX is ready
124 AND TEMP, TWO ; Temp = Temp & 0002
125 COMP TEMP, TWO ; TXReady ?
126 JUMPNZ FALSEINTERRUPT ; If False, Exit
127
128 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
129 ; Store temp value into SCRATCH RAM[POINTER]
130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
131 STORERAM
132 STORE TEMP, POINTER ; RAM[Pointer] = Temp
133 ADD POINTER, ONE ; Pointer += 1
134 RETURN
135
136
137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
138 ; Place initial banner in RAM[0] (<CARRET><LF>WELCOME CECS !) (16 Characters)
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
140 BANNER
141 LOAD TEMP, 000D ; Temp = <CARRET>
142 CALL STORERAM
143 LOAD TEMP, 000A ; Temp = <lf>
144 CALL STORERAM
145 LOAD TEMP, 0057 ; Temp = 'W'
146 CALL STORERAM
147 LOAD TEMP, 0045 ; Temp = 'E'
148 CALL STORERAM
149 LOAD TEMP, 004C ; Temp = 'L'
150 CALL STORERAM
151 LOAD TEMP, 0043 ; Temp = 'C'
152 CALL STORERAM
153 LOAD TEMP, 004F ; Temp = 'O'
154 CALL STORERAM
Valenzuela 21
27. 408 FALSEINTERRUPT
409 FETCH POINTER, 0031 ; Pointer = RAM[65]
410 RETEN
411
412
413 ADDRESS 0400
414
415
416
417
418 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
419 ; Converts binary value of counter to ASCII to output to terminal
420 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
421 HEXCONVERT
422 LOAD WORKS, ZERO ; Works = 0
423 LOAD POINTER, 0011 ; Pointer = 17
424 LOAD DIVISOR, 2710 ; Divisor = 10,000
425 LOAD QUOTIENT, ZERO ; Quotient = 0
426 LOAD COUNT, COUNTER ; Count = Counter
427
428 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
429 ; Check if using the correct divisor value
430 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
431 CHECK
432 COMP COUNTER, DIVISOR ; Counter < Divisor ?
433 JUMPC CHANGEDIVISOR ; If true, jumpt to changedivisor subroutine
434 ADD QUOTIENT, ONE ; Quotient += 1
435 SUB COUNTER, DIVISOR ; Counter -= Divisor
436 JUMP CHECK ; Jump to check subroutine
437
438
439
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Makes sure quotient value is WORKS, then jumps to subroutine that changes divisor
440 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
441 CHANGEDIVISOR
442 COMP WORKS, ONE ; Works == 1 ?
443 JUMPZ QUOTASCII ; If true, jump to quotient to ascii conversion
444 COMP QUOTIENT, ZERO
445 JUMPZ SETSPACE ; If true, jump to add a hexi space subroutine
446 LOAD WORKS, ONE ; Works = 1
447
448
449
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Convert quotient value to ASCII
450
451
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
QUOTASCII
452 ADD QUOTIENT, 0030 ; Change quotient to ascii
453 JUMP DIVIDE
454
455 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Valenzuela 27
28. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
456 ; Adds a space between banner and <count> value
457 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
458 SETSPACE
459 ADD QUOTIENT, 0020 ; Make quotient a ' '
460
461 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
462 ; Algorithm that divides binary value by 10,000, 1,000, 100, then 10 to convert it to
463 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
464 DIVIDE
465 STORE QUOTIENT, POINTER ; RAM[POINTER] = Quotient
466 LOAD QUOTIENT, ZERO ; Quotient = 0
467 ADD POINTER, ONE ; Pointer += 1
468 COMP DIVISOR, 000A ; Divisor == 10 ?
469 JUMPZ LASTVALUE ; If true, jump to lastvalue subroutine
470 COMP DIVISOR, 0064 ; Divisor == 100 ?
471 JUMPZ TEN ; If true, jump to ten subroutine
472 COMP DIVISOR, 03E8 ; Divisor == 1,000 ?
473 JUMPZ HUNDRED ; If true, jump to hundred subroutine
474 JUMP THOUSAND ; Else, jump to thousand subroutine
475
476 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
477 ; Stores the 1's place of the counter into SCRATCH RAM
478 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
479 LASTVALUE
480 ADD QUOTIENT, COUNTER ; Quotient += counter
481 ADD QUOTIENT, 0030 ; Convert quotient to ASCII
482 STORE QUOTIENT, POINTER ; RAM[POINTER] = quotient
483 LOAD POINTER, ZERO ; Pointer = 0
484 LOAD COUNTER, COUNT ; Counter = count
485 RETURN
486
487 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
488 ; Subrountine to change divisor to 1000
489 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
490 THOUSAND
491 LOAD DIVISOR, 03E8 ; Divisor = 1,000
492 JUMP CHECK
493
494 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
495 ; Subrountine to change divisor to 100
496 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
497 HUNDRED
498 LOAD DIVISOR, 0064 ; Divisor = 100
499 JUMP CHECK
500
501 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Valenzuela 28
29. 502 ; Subrountine to change divisor to 100
503 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
504 TEN
505 LOAD DIVISOR, 000A ; Divisor = 10
506 JUMP CHECK 507
508 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
509 ; Vector to Interrupt Service Routine - NO CHANGES HERE
510 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
511 ADDRESS 0FFE ; Interrupt At Vector Address 0FFE
512 ENDIT
513 JUMP ISR ; Jump to ISR
514 END
Valenzuela 29
30. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
V. External Developed Blocks
V.1 Asynchronous In, Synchronous Out (AISO)
V.1.1 Description V.1.2 Top Level Diagram
This block prevents metastability by creating
a synchronized reset signal. The reset input
of this block is connected to a button on the
Nexys A7 board. The output resets every signal.
V.1.3 Input/Output
Signal I/O Connected to
clk Input 100MHz Crystal Oscillator
reset Input Button
sRst Output mRst
V.1.4 Register Map
Register Usage Description
{d2,q2} Synchronize Once resets, sends a single pulse to all modules
Source Code: Appendix VIII.1
Valenzuela 30
31. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
V.2 TramelBlaze
V.2.1 Description V.2.2 Top Level Diagram
The TramelBlaze is 16-bit soft-core
microcontroller that emulates the PicoBlaze.
The TramelBlaze reads and performs actions
based on instructions provided by the ROM.
The TramelBlaze is used in this project to
receive and transmit ASCII values to a Serial
terminal. The WRITE_STROBE and
READ_STROBE communicate with the
UART which helps to establish whether
the design will be using the transmit
or receive engine.
V.2.3 Input/Output
Signal I/O Connection
CLK Input 100MHz Crystal Oscillator
RESET Input AISO
INTERRUPT Input RS Flop
IN_PORT[15:0] Input UART
PORT_ID[15:0] Output UART + AddressDecoder
OUT_PORT[15:0] Output UART
READ_STROBE Output UART
WRITE_STROBE Output UART
INTERRUPT_ACK Output RS Flop
V.2.4 Register Map
Register Usage Description
TB_ROM[15:0] Read Only Memory Holds Instructions for TramelBlaze to execute
Source Code: Appendix VIII.16
Valenzuela 31
32. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI. Internally Developed Blocks
VI.1 Memory Block Interface
VI.1.1 Description
The Memory Interface Block consists of a state machine and control flops. The state machine
inputs are the PORT_ID values. There are three possible states: MEMWRITE, MEMREAD, IDLE. The
outputs of each state are CE, WE, OE, and T. The flops of the MIB then use these signals to control the
memory addresses and the data being communicated between them and the Micron Memory. Prior to this,
the TramelBlaze Read Only Memory had been in charge of this data flow.
VI.1.2 Top Level Diagram
Valenzuela 32
33. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.1.3 Input/Output
Signal Size (Bits) Input/Output Connection
clk 1 Input 100MHz Crystal Oscillator
rst 1 Input AISO
READ 1 Input TramelBlaze
WRITE 1 Input TramelBlaze
PORT_ID 16 Input TramelBlaze
memoryDataIn 16 Input Micron Memory
OUT_PORT 16 Input TramelBlaze
cCE 1 Output Micron Memory
cWE 1 Output Micron Memory
cOE 1 Output Micron Memory
cADV 1 Output Micron Memory
cCRE 1 Output Micron Memory
cUB 1 Output Micron Memory
cLB 1 Output Micron Memory
memoryAddress 23 Output Micron Memory
memoryDataOut 16 Output Micron Memory
IN_PORT 16 Output TramelBlaze
VI.1.4 Register Map
Register Module Description
cCE MIB Chip Enable Signal to Micron Memory
cWE MIB Write Enable Signal to Micron Memory
cOE MIB Output Enable Signal to Micron Memory
cIOBUF_T MIB Controller for IOBUF
cADV MIB Address Valid Signal for Micron Memory
CRE MIB Control Register Enable Signal for Micron Memory
cUB MIB Upper Byte Signal for Micron Memory
cLB MIB Lower Byte Signal for Micron Memory
memoryAddress MIB Memory Address Location
memoryDataOut MIB Data to Micron Memory
IN_PORT MIB Data from TramelBlaze
state MIB State of MIB
nState MIB Next State of MIB
WCLK MIB Counter to Stay in Write State for 130ns
RCLK MIB Counter to Stay in Read State for 130ns
nCE MIB Chip Enable Next State
nWE MIB Write Enable Next State
nOE MIB Output Enable Next State
nIOBUF_T MIB T Next State
Valenzuela 33
35. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.2 Universal Asynchronous Receiver and Transmitter (UART)
VI.2.1 Description
The UART module is built by five components: the Transmit Engine, the Receive Engine, the
Baud Rate Decoder, and two Positive Edge Detectors. The Transmit Engine shifts serial data out to the
Transmit Line through the micro-USB connection. The Receive Engine shifts serial data into a register. It
then takes the data in the register and sends it to the TramelBlaze to be processed. A UART module
communicates data between modules without a clock to synchronize data transmission. In order to make
sure the data is valid, a common frequency is required. This is accomplished by both engines sharing the
Baud Rate. The Baud Rate is determined by decoding the switch values from the Nexys A7 board. Baud
Rate represents the speed that data is transmitted and received.
The UART block communicated to the TramelBlaze when the receive engine/transmit engine us
ready to interpret data. This signal is communicated by an interrupt signal. The Interrupt reaches the
TramelBlaze and causes it to enter the Interrupt Service Routine. This signal sent from the UART is
called UARTready.
VI.2.2 Top Level Diagram
Valenzuela 35
38. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.3 Transmit Engine
VI.3.1 Description
The Transmit Engine consists of five components: Bit Counter, Bit Time Counter, Shift Register,
Bit 10/9 Decoder, and the Transmit Controller. These components combine to help transmit data to the
computer terminal. The Bit Time Counter will decide the speed at which the transmit engine will shift
data out. The speed is set by the output of the Baud Rate Decoder. The Bit Counter makes sure the
register only shifts out 11 bits of data. The Shift Register helps to shift data outwards from the least
significant bit (LSB) to most significant bit (MSB). The Transmit Controller is in charge of setting the
values of the wires between the components. These wires tell the counters when to reset, and are in charge
of other circumstances such as parity enable, and the UART Interrupt. Lastly, the Bit 10/9 Decoder
decides what values to insert into bit 9 and bit 10 of the shift register. These values depend on how many
bits wide the signal to transmit is. All of these components are essential to build the Transmit Engine.
VI.3.2 Top Level Diagram
Valenzuela 38
40. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.3.5 Input / Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Crystal Oscillator
rst 1 Input AISO
load 1 Input Address Decoder
eight 1 Input Nexys A7 Switch[3]
pen 1 Input Nexys A7 Switch[2]
ohel 1 Input Nexys A7 Switch[1]
OUT_PORT 8 Input TramelBlaze
k 19 Input Baud Rate Decoder
tx 1 Output Nexys A7 USB
txReady 1 Output Nexys A7 USB
VI.3.6 Register Map
Register Module Description
bit10 Decoder Bit 10 into the Shift Register
bit9 Decoder Bit 9 into the Shift Register
doit Transmit Controller Allows counter to increment
load1 Transmit Controller Delays data transmission by 1 clock period
nTX [10:0] Shift Register Holds data to be shifted out into board
lData [7:0] Shift Register Grabs data from TramelBlaze
bitTimeCount [18:0] Bit Time Counter Baud Rate Counter
bitCount [3:0] Bit Counter How many bits to shift Counter
Source Code: Appendix VIII.5
Valenzuela 40
41. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.4 Transmit Shift Register
VI.4.1 Description
The shift register is sent data from OUT_PORT on the TramelBlaze and shifts data outwards 1 bit
at a time in the output value tx. The tx usually has a value of ‘1’. The ‘start bit’ for the transmit engine is a
‘0’. So when a ‘0’ is initially sent, the tx will start outputting the register data 1 bit at a time. When the
module is reset, the shift register will continue to output 11 bits of ‘1’, to show its inactive state. The data
is sent out from LSB to MSB. With the first bit always being a ‘0’. The bit after the MSB will either be
the parity bit or the stop bit. But data transmission always ends with a ‘1’ stop bit. When the bit time
counter is done counting, a ‘1’ is sent to the TX engine and the UART interprets this as the end of the
data transmission.
VI.4.2 Top Level Diagram
VI.4.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Crystal Oscillator
Rst 1 Input AISO
load 1 Input TX Controller
btu 1 Input TX Bit Time Counter
nTX 11 Input Bit10/9 Decoder, TX Controller
tx 1 Output Nexys A7 USB
Source Code: Appendix VIII.5
Valenzuela 41
42. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.5 Bit 10 Bit 9 Decoder
VI.5.1 Description
This module oversaw deciding what values bit10 and bit9 receive. This is because these
bits depend entirely on the number of bits being transmitted and the parity of the transmission.
The data will either be 7 or 8 bits. This directly effects what bit9 will be. Also, if there is a parity,
the parity bit will be placed in bit9 or bit10, depending on how many bits the data is. All of these
conditions are evaluated and assigned based on the decoder. The inputs of the decoder are eight,
pen, and ohel.
VI.5.2 Top Level Diagram
VI.5.3 Input/Output
Signal Size (Bits) I/O Connection
lData 8 Input TX Controller
eight 1 Input Nexys A7 Switch[3]
pen 1 Input Nexys A7 Switch[2]
ohel 1 Input Nexys A7 Switch[1]
bit10 1 Output TX Shift Register
bit9 1 Output TX Shift Register
VI.5.4 Logic Table
eight pen ohel bit10 bit9
0 0 0 1 1
0 0 1 1 1
0 1 0 1 ^lData[6:0]
0 1 1 1 ~^lData[6:0]
0 0 0 1 lData[7]
1 0 1 1 lData[7]
1 1 0 ^lData[7:0] lData[7]
1 1 1 ~^lData[7:0] lData[7]
Source Code: Appendix VIII.5
Valenzuela 42
43. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.6 Transmit Controller
VI.6.1 Description VI.6.2 Top Level Diagram
The transmit controller is in
charge of the wires between the flops
and indicative signals. This includes
doit, done, btu, etc. It communicates
between the flops and tells them how
to behave. It is also in charge of telling
the shift register when to load new
data with the load1 signal.
VI.5.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Clock Oscillator
rst 1 Input AISO
done 1 Input TX Bit Count
load 1 Input Address Decoder
OUT_PORT 8 Input TramelBlaze
txReady 1 Output PED
load1 1 Output TX Shift Register
doit 1 Output Both TX Counters
lData 8 Output TX Shift Register
Source Code: Appendix VIII.5
Valenzuela 43
44. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.7 Transmit Bit Counter
VI.7.1 Description VI.7.2 Top Level Diagram
This counter counts from 0-11 in decimal.
Each increment is to indicate how many
bits have been transmitted. It increments
every time the “doit” and “btu” signals
are high. This means that the bit time counter
has reached its value. This is important
because a bit is only sent every time the
bit time counter has reached its comparable value.
VI.7.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Clock Oscillator
rst 1 Input AISO
doit 1 Input TX Controller
btu 1 Input TX Bit Time Counter
done 1 Output TX Controller
Source Code: Appendix VIII.5
Valenzuela 44
45. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.8 Transmit Bit Time Counter
VI.8.1 Description VI.8.2 Top Level Diagram
The bit time counter is used to
transmit bits at a very specific baud
rate. The bit time counter increments
at every clock signal and will continue
to increment until it reaches its indicated
baud rate. The bit time counter resets when
the “done” signal is high. This means that
the baud rate has been reached and a bit
is ready to transmit.
VI.8.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100 MHz Clock Oscillator
rst 1 Input AISO
doit 1 Input TX Controller
k 19 Input Baud Rate Decoder
btu 1 Output TX Shift Register
Source Code: Appendix VIII.5
Valenzuela 45
46. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.9 Receive Engine
VI.9.1 Description
The Receive engine works in the opposite direction of the transmit engine. It inputs data 1 bit at a
time and shifts them into a shift register. It then interprets this data and sends it to the TramelBlaze via
IN_PORT. The receive engine consists of 5 components: a Bit Time Counter, a Bit Counter, a State
Machine, Receive Controller, and the Receive Shift Register. All these components combine to allow the
UART to receive data 1 bit at a time and interpret it into a valid ASCII value. It is important that the
shifted data is shifted at the correct baud rate for the appropriate amount of times. The shift register grabs
data from the rx input and shifts it into a register. However, the number of bits of data and parity bit need
to be taken into consideration. Due to this, the data needs to be remapped accordingly.
VI.9.2 Top Level Diagram
Valenzuela 46
48. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.9.5 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100 MHz Crystal Oscillator
rst 1 Input AISO
READ 8 Input Address Decoder
k 19 Input Baud Rate Decoder
rx 1 Input Nexys A7 USB
eight 1 Input Nexys A7 Switch[3]
pen 1 Input Nexys A7 Switch[2]
ohel 1 Input Nexys A7 Switch[1]
rxStatus 8 Output TramelBlaze
rxReady 1 Output UART PED
UART_RDATA 8 Output TramelBlaze
VI.9.6 Register Map
Register Module Description
start State Machine Detection of start bit
nStart State Machine Holds next start value
done State Machine Resets counter values
doit State Machine Allows counter to count
nDoit State Machine Holds the next doit value
Parity_error Receive Controller Indicates a parity error
Framing_error Receive Controller Indicates a framing error
Overflow_error Receive Controller Indicates an overflow error
State State Machine State that holds done + start values
nState State Machine Registers the next State
nRX Shift Register Register holding raw data from Nexys Board
shiftedReg Right Justify Register Register with proper parity bit
BitTimeCount Bit Time Counter Baud Rate Counter
BitCount Bit Counter How many times register shift counter
newK Baud Rate Divider Baud Rate Decoder
Source Code: Appendix VIII.6
Valenzuela 48
49. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.10 Receive Shift Register
VI.10.1 Description VI.10.2 Top Level Diagram
The shift register is a shift register that operates
under specific conditions. The 2 MSBs will either
be 0s or the data interpreted from the rx line,
depending on the values of eight and pen.
This module uses a switch case statement to assess
the values of eight and pen. If both values are high,
the data is not shifted. If only one of the values is high,
the data is shifted once to the right. If both are inactive,
the data is shifted twice to the right.
VI.10.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Crystal Oscillator
rst 1 Input AISO
shiftHigh 1 Input RX Controller
rx 1 Input Nexys A7 USB
eight 1 Input Nexys A7 Switch[3]
pen 1 Input Nexys A7 Switch[2]
ohel 1 Input Nexys A7 Switch[1]
shiftedReg 10 Output RX Controller
UART_RDATA 8 Output TramelBlaze
Source Code: Appendix VIII.6
Valenzuela 49
50. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.11 Receive State Machine
VI.11.1 Description VI.11.2 Top Level Diagram
The state machine is implemented using
a Modified Moore technique. The state machine
guarantees that the start bit remains low-active
until it is mid-bit time. At this point, data collection
will continue at normal bit time until all the
data is received. This state machine outputs start
and doit. Start means that the engine has just
received the start bit. Doit means that the engine
is receiving actual data. The state machine
conditions are rx, done, and btu.
VI.11.3 State Transition Diagram
VI.11.4 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100 MHz Crystal Oscillator
rst 1 Input AISO
rx 1 Input Nexys A7 USB
btu 1 Input RX Bit Time Counter
done 1 Input RX Bit Counter
start 1 Output RX Bit Time Counter
doit 1 Output Both RX Counters
Source Code: Appendix VIII.6
Valenzuela 50
51. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.12 Receive Controller
VI.12.1 Description VI.12.2 Top Level Diagram
The receive controller is in charge of
the wires between the flops and indicative signals.
This includes doit, done, btu, etc. It communicates
between the flops and tells them how to behave.
It in charge of when to divide the baud value
by 2, and communicating the status of the
receive engine. An example being when
there is an overflow/parity/framing error.
VI.21.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Clock Oscillator
rst 1 Input AISO
done 1 Input RX Bit Counter
eight 1 Input Nexys A7 Switch[3]
pen 1 Input Nexys A7 Switch[2]
ohel 1 Input Nexys A7 Switch[1]
shiftedReg 10 Input Receive Shift Register
rxReady 1 Output TramelBlaze
parity_error 1 Output UART
framing_error 1 Output UART
overflow_error 1 Output UART
Source Code: Appendix VIII.6
Valenzuela 51
52. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.13 Receive Bit Counter
VI.13.1 Description VI.13.2 Top Level Diagram
This counter counts from 0-11 in decimal.
Each increment is to indicate how many bits
have been received. It increments every time
the “doit” and “btu” signals are high. This means
that the bit time counter has reached its value.
This is important because a bit is only grabbed every
time the bit time counter has reached its comparable
value. In addition, the Receive Bit Counter has to
constantly change the comparable value depending
on how many bits are received. This
depends on the values of pen and eight.
VI.13.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Clock Oscillator
rst 1 Input AISO
doit 1 Input State Machine
btu 1 Input RX Bit Time Counter
eight 1 Input Nexys A7 Switch[3]
pen 1 Input Nexys A7 Switch[2]
done 1 Output State Machine
VI.13.4 Logic Table
eight pen == ?
0 0 9
0 1 10
1 0 11
1 1 11
Source Code: Appendix VIII.6
Valenzuela 52
53. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.14 Receive Bit Time Counter
VI.14.1 Description VI.14.2 Top Level Diagram
The bit time counter is used to receive bits
at a very specific baud rate. The bit
time counter increments at every clock
signal and will continue to increment until
it reaches its indicated baud rate. The bit time
counter resets when the “done” signal is high.
This means that the baud rate has been
reached and a bit is ready to be received. The
only difference is that this bit time counter
counts to a value of k/2, where k is the
interpreted baud rate.
VI.14.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100 MHz Clock Oscillator
rst 1 Input AISO
doit 1 Input State Machine
start 1 Input State Machine
k 19 Input Baud Rate Decoder
btu 1 Output RX Controller
Source Code: Appendix VIII.6
Valenzuela 53
54. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.15 Baud Rate Decoder
VI.15.1 Description VI.15.1 Top Level Diagram
The Baud Rate Decoder is a 4 to 19-bit
Decoder that chooses the speed that the UART
communicates data. The 4 inputs of the decoder come
from switches[7:4] on the Nexys A7 board.
VI.15.3 Input/Output
Signal Size (Bits) I/O Connection
switches 4 Input Nexys A7 Switches[7:4]
k 19 Output Transmit + Receive Engine
VI.15.4 Register Map
Register Usage Description
k[18:0] Constant The rate that data is sent/received
Source Code: Appendix VIII.4
Valenzuela 54
55. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.16 Positive Edge Detect
VI.16.1 Description VI.16.2 Top Level Diagram
This block detects a rising edge on
A given signal. It is used in the UART block to
detect when txReady and rxReady reach a
rising edge.
VI.16.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Crystal Oscillator
rst 1 Input AISO
in 1 Input Transmit + Receive Engine
yes 1 Output UART
VI.16.4 Register Map
Register Usage Description
q[1:0] PED Sends PED values when flop goes from {1,0} to {0,1}
Source Code: Appendix VIII.8
Valenzuela 55
56. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.17 RS Flop
VI.17.1 Description VI.17.2 Top Level Diagram
The RS Flop behaves as a typical
RS flop. It holds a value until each rising
clock signal. If input s is high, the flop
outputs 1. The flop will then hold this value
until the flop reset or functional reset are high.
VI.17.3 Input/Output
Signal Size (Bits) I/O Connection
clk 1 Input 100MHz Crystal Oscillator
rst 1 Input AISO
funcrst 1 Input TramelBlaze
set 1 Input Transmit PED + Receive PED
q 1 Output TramelBlaze
VI.17.4 Register Map
Register Usage Description
q Interrupt Output interrupt when set high
Source Code: Appendix VIII.9
Valenzuela 56
57. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.18 Address Decode (READ)
VI.18.1 Description VI.18.2 Top Level Diagram
This module determines the values
of READ[7:0] based on READ_STROBE
and PORT_ID[15:0]. It helps the UART
understand which values to send to the
TramelBlaze.
VI.18.3 Input/Output
Signal Size (Bits) I/O Connection
READ_STROBE 1 Input TramelBlaze
PORT_ID[15] 1 Input TramelBlaze
PORT_ID[2] 1 Input TramelBlaze
PORT_ID[1] 1 Input TramelBlaze
PORT_ID[0] 1 Input TramelBlaze
READS 8 Output Receive Engine
VI.9.1 Register Map
Register Usage Description
enable {READ_STROBE &
PORT_ID[15]}
Determines whether to write to TramelBlaze
Source Code: Appendix VIII.7
Valenzuela 57
58. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VI.19 Address Decode (WRITE)
VI.19.1 Description VI.19.2 Top Level Diagram
This module determines the values
of WRITE[7:0] based on WRITE_STROBE
and PORT_ID[15:0]. It helps the UART
understand which values to grab from the
TramelBlaze.
VI.19.3 Input/Output
Signal Size (Bits) I/O Connection
WRITE_STROBE 1 Input TramelBlaze
PORT_ID[15] 1 Input TramelBlaze
PORT_ID[2] 1 Input TramelBlaze
PORT_ID[1] 1 Input TramelBlaze
PORT_ID[0] 1 Input TramelBlaze
WRITE 8 Output Transmit Engine
VI.9.4 Register Map
Register Usage Description
enable {WRITE_STROBE &
PORT_ID[15]}
Determines whether to read from TramelBlaze
Source Code: Appendix VIII.7
Valenzuela 58
59. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VII. Chip Level Verification
VII.1 Transmit Engine
As demonstrated by the screenshot above, the transmit engine works appropriately by transmitting a
banner to the terminal and incrementing the counter every time the banner is printed
Valenzuela 59
61. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
Input
The following keyboard inputs were entered into the terminal:
1. *
2. 12345<cr>
3. 12345@
4. 01234567@
5. <cr>
6. Paull
7. <bs>
8. <cr>
9. The Backspace Works…
Requirements
This demonstrates that the UART engine works as expected. It is able to receive data from the terminal,
interpret that data, and transmit new data to the terminal. In this specific design,
“*” - Prints hometown
<cr> - Creates newline
“@” - Counts the amount of characters entered
<bs> - Deletes the previous character
Verified
As shown above, all of the inputs gave the expected outputs. This means that the UART design satisfied
its requirements.
Valenzuela 61
62. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VIII.Appendix
VIII.1 AISO
1 `timescale 1ns / 1ps
2 //******************************************************************************//
3 // File name: AISO.v //
4 // //
5 // Created by Paul Valenzuela on 9/16/19. //
6 // Copyright (C) 2018 Paul Valenzuela. All rights reserved. //
7 // //
8 // //
9 // In submitting this file for class work at CSULB //
10 // I am confirming that this is my work and the work //
11 // of no one else. In submitting this code I acknowledge that //
12 // plagiarism in student project work is subject to dismissal //
13 // from the class //
14 //******************************************************************************//
15 //******************************************************************************//
16 // AISO.v //
17 // //
18 // The AISO block ensures that all the blocks within the design share a //
19 // synchronous reset input. The AISO block works by converting the input //
20 // of reset into two flops. This makes sure that reset is stable and //
21 // helps prevent metastability //
22 // //
23 // @input clk, rst, //
24 // @output sRst //
25 // //
26 //******************************************************************************//
27 module AISO(clk, rst, sRst);
28 //Declare Variables
29 input wire clk,rst;
30 output wire sRst;
31 reg d2, q2;
32
33 //Sequential Block
34 always@(posedge clk,posedge rst)
35 //If Rst is on, both flops input 0
36 if(rst)
37 d2 <= 1'b0;
38 //Otherwise, the first flop gets 1 and the second gets the output of the first
flop
39 else
40 {d2,q2} <= {1'b1,d2};
41
42 //Output wire is assigned to the inverted output of the second flop
43 assign sRst = ~q2;
44
45 endmodule
46
Valenzuela 62
63. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VIII.2 TramelBlaze Top
1 //****************************************************************//
2 // This document contains information proprietary to the //
3 // CSULB student that created the file - any reuse without //
4 // adequate approval and documentation is prohibited //
5 // //
6 // Class: CECS 460 //
7 // Project name: TRAMBLAZE PROCESSOR //
8 // File name: tramelblaze_top3.0_sim.v //
9 // Release: 3.0 Release Date 02mar2017 //
10 // Release: 5.0 Release Date 07nov2017 //
11 // to be used for simulation only //
12 // assumes following hierarchy //
13 // project //
14 // assembler//
15 // design (file in design looks in assembler for instr) //
16 // //
17 // Created by John Tramel on 20Feburary2016 //
18 // Copyright 2016 John Tramel. All rights reserved. //
19 // //
20 // Abstract: Top level for TRAMBLAZE processor //
21 // Edit history: 2016JAN25 - created //
22 // 20FEB - top created for processor and memory //
23 // tramelblaze_top //
24 // - tramelblaze //
25 // - tramelblaze_mem //
26 // 14feb2020 - modified path for sim.sim for Vivado //
27 // assumes Assembler directory same level as project //
28 // Top Level Directory //
29 // Assembler //
30 // code.tba, code.lst, sim.sim //
31 // Project //
32 // vivado project file //
33 // 18apr202 - startup error with memory - 1st instruction //
34 // not executed properly. Believe I fixed it //
35 // //
36 // In submitting this file for class work at CSULB //
37 // I am confirming that this is my work and the work //
38 // of no one else. //
39 // //
40 // In the event other code sources are utilized I will //
41 // document which portion of code and who is the author //
42 // //
43 // In submitting this code I acknowledge that plagiarism //
44 // in student project work is subject to dismissal from the class //
45 //****************************************************************//
46
47 `timescale 1ns/1ns
48
49 module tramelblaze_top (CLK, RESET, IN_PORT, INTERRUPT,
50 OUT_PORT, PORT_ID, READ_STROBE, WRITE_STROBE, INTERRUPT_ACK);
51
52 input CLK;
53 input RESET;
54 input [15:0] IN_PORT;
55 input INTERRUPT;
56
Valenzuela 63
67. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VIII.4 UART Decode
1 `timescale 1ns / 1ps
2 //******************************************************************************//
3 // File name: uart_decode.v //
4 // //
5 // Created by Paul Valenzuela on 4/19/20. //
6 // Copyright (C) 2020 Paul Valenzuela. All rights reserved. //
7 // //
8 // //
9 // In submitting this file for class work at CSULB //
10 // I am confirming that this is my work and the work //
11 // of no one else. In submitting this code I acknowledge that //
12 // plagiarism in student project work is subject to dismissal //
13 // from the class //
14 //******************************************************************************//
15 //******************************************************************************//
16 // uart_decode.v //
17 // //
18 // The uart_decode module decodes values from switches to determine //
19 // baud rate //
20 // //
21 // @input [3:0] switches //
22 // @output [18:0] k //
23 // //
24 //******************************************************************************//
25 module uart_decode(switches,k);
26
27 input [ 3:0] switches; // Switches [7:4]:
28 output reg [18:0] k; // output as seen in transmit engine diagram
29
30 always @(*) begin
31 case (switches)
32 4'b0000: k = 19'd333333; //300 -- RATE
33 4'b0001: k = 19'd83333; //1200
34 4'b0010: k = 19'd41667; //2400
35 4'b0011: k = 19'd20833; //4800
36 4'b0100: k = 19'd10417; //9600
37 4'b0101: k = 19'd5208; //19200
38 4'b0110: k = 19'd2604; //38400
39 4'b0111: k = 19'd1736; //57600
40 4'b1000: k = 19'd868; //115200
41 4'b1001: k = 19'd434; //230400
42 4'b1010: k = 19'd217; //460800
43 4'b1011: k = 19'd109; //921600
44 default: k = 19'd333333; //300
45 endcase
46 end
47 endmodule
48
Valenzuela 67
68. Prepared by:
Paul Valenzuela
Date:
May 12, 2020
Document Name:
Final Specification
VIII.5 Transmit Engine
1 `timescale 1ns / 1ps
2 //******************************************************************************//
3 // File name: transmit.v //
4 // //
5 // Created by Paul Valenzuela on 4/19/20. //
6 // Copyright (C) 2020 Paul Valenzuela. All rights reserved. //
7 // //
8 // //
9 // In submitting this file for class work at CSULB //
10 // I am confirming that this is my work and the work //
11 // of no one else. In submitting this code I acknowledge that //
12 // plagiarism in student project work is subject to dismissal //
13 // from the class //
14 //******************************************************************************//
15 //******************************************************************************//
16 // transmit.v //
17 // //
18 // The transmit module serves as the top level for the trasnmit block. //
19 // It consists of several components and will later be used in the UART //
20 // block //
21 // //
22 // @input clk, rst, load, eight, pen, ohel, [7:0] OUT_PORT, [19:0] k //
23 // @output txReady, tx //
24 // //
25 //******************************************************************************//
26 module transmit(clk, rst, load, k, eight, pen, ohel, OUT_PORT, txReady, tx);
27 input clk, rst, load, eight, pen, ohel;
28 input [7:0] OUT_PORT;
29 input [18:0] k;
30
31 output reg txReady;
32 output wire tx;
33
34 wire btu, done;
35 reg bit10, bit9, doit, load1;
36 reg [10:0] nTX;
37 reg [7:0] lData;
38 reg [18:0] bitTimeCount;
39 reg [3:0] bitCount;
40
41
42 // Bit Counter
43 always@(posedge clk, posedge rst)
44 if (rst)
45 bitCount <= 4'b0;
46 else if(done)
47 bitCount <= 4'b0;
48 else if({doit,btu} == 2'b11)
49 bitCount <= bitCount + 4'b1;
50 else
51 bitCount <= bitCount;
52
53 assign done = (bitCount == 4'b1011);
54
55
56 // DOIT Signal
Valenzuela 68