http://youtu.be/nUheLfsGyYo
VHDL8 Practical example v2b
Part 1
General concept of memory
memory
Keyboard mouse
Memory systems
RAM/ROM
Since we only discuss static (SRAM) here, so the terms SRAM and RAM will be used interchangeably.
VHDL8 Practical example v2b
UV-EPROM
Flash memory
25 72 3B 24
Instruction j+3 Instruction j+2 Instruction j+1 Instruction j xx Instruction 2 v2b 2BVHDL8 Practical example Instruction 1
CPU and Static memory (SRAM) interface Exercise: show the address space of the CPU and memory
Data bus is bi-directional DIN,DOUT are using the same bus (D0-D7)
VHDL8 Practical example v2b
Exercises 8.1
A) What is the address space for an address bus of 24 bits? B) How many address bits are required for a space of 4G bytes? C) Why do most computers use 8-bit as the bit length of an address?
Memory read/write
Timing diagrams
CPU and Static memory (SRAM) read (from SRAM to CPU) timing
T0 T1 T2
Data bus is bi-directional DIN,DOUT are using the same bus (D0-D7)
Address bus
/CS /OE
8-bit data bus
Data bus(DOUT)
Figure 1
CPU and Static memory (SRAM) write (from CPU to SRAM) timing
Address bus
/CS
/WE
Data bus(DIN)
Figure 2
Exercises 8.2A
(A): Redesign the CPU/SRAM interfaces circuit in figure 1 so that the address-range is 8000-FFFFH instead of 0000-7FFFH.
Data bus is bi-directional DIN,DOUT are using the same bus (D0-D7) Figure 1
VHDL8 Practical example v2b
Exercises 8.2B
(B): Redesign the CPU/SRAM interface circuit in figure 1 to add another SRAM to make the system occupies the whole 0000-FFFFH address-range.
Data bus is bi-directional DIN,DOUT are using the same bus (D0-D7) Figure 1 VHDL8 Practical example v2b
valid
Address decoding
Usually a large memory storage requires multiple memory chips We need a memory decoder to control these chips
From http://www.myconfinedspace.com/2008/09/30/ddr-1x-ssd-ram-drive/
VHDL8 Practical example v2b
Exercises 8.4
A CPU supports 128K-byte (has address pin A0-A16 = 17 pins, so 217=128K) of memory area.
Exercise: How many 32K-SRAMs do we need?
Exercise 8.5a
A CPU supports 128K-byte (has address pin A0-A16 = 17 pins, so 2^17=128K) of memory area. We need an address decoder to enable the (/CS) input of each SRAM. Complete the following diagram.
Address decoder /CS0 A0,A1 /CS1 /CS2 /CS3 Address lines: A15, A16 32K SRAM1 /CS A0-A14 /OE /RD 32K SRAM2 /CS A0-A14 /OE /RD 32K SRAM3 /CS A0-A14 /OE /RD 32K SRAM4 /CS A0-A14 /OE /RD
D0-D7
D0-D7
VHDL8 Practical example v2b
D0-D7
D0-D7
system with 128K-byte size using four 32-byte RAM chips , fill in the blanks.
Range size
32K 0 0xxx xxxx xxxx xxxx 0 0000 - 0 7FFF H 32K 0 1xxx xxxx xxxx xxxx 0 8000 - 0 FFFFH
__ K
_ _xxx xxxx xxxx xxxx 1 0000 - 1 7FFFH _ ____ - _ ____H 1 1xxx xxxx xxxx xxxx VHDL8 Practical example v2b 32K
/CS1
/CS2
/CS3
Exercise 8.6
Fill in the modes (in, out, inout or buffer) of the input/output signal. SRAM (memory) address lines (A0A16) data lines (D0-D7) /CS,/OE and /WE lines CPU
Exercise 8.7
Referring to the figure, what would happen if /RD of the CPU (connected to /OE) goes up before the data valid region occurs?
Exercise 8.8 :
Referring to the Figure, if tAS=0ns, twc=100ns,tCW= 80ns, give comments on the limits of tAW, tWP and tDW..
Part 2
The sound recorder
microphone
ram
Flow diagram
s_rec_address_change :rec01
s_rec_we_ce_down :rec02
s_play_ce_oe_down : play02
ram_address_buf =not all1 ram_address_buf =all1 ram_address_buf =not all1 VHDL8 Practical example v2b ram_address_buf =all1
architecture
architecture record1_arch of record1_entity is -- SYMBOLIC ENCODED state machine: Sreg0 type Sreg0_type is (s_init, s_rec_address_change, s_rec_we_ce_down, s_rec_read_from_da_to_reg1, s_rec_writeto_da_ram, s_play_address_change,s_play_ce_oe_down, s_play_read_in_reg1, s_play_writeto_da ); signal state_ram1: Sreg0_type; signal data_reg1: std_logic_vector (7 downto 0); -- temporary storage begin -- concurrent signal assignement --diagram ACTIONS; --clock divider --to be continued ;
VHDL8 Practical example v2b
State s_rec_address_change
------------ sound record cycle starts here, ram write cycle when s_rec_address_change => -- state: rec01 bar_ram_we27<='1'; --make sure all ram pins up bar_ram_ce20<='1'; bar_ram_oe22<='1'; if (ram_address_buf="111111111111111") then state_ram1<=s_init; --ram fully filled; done else ram_address_buf<=ram_address_buf+1; state_ram1<=s_rec_read_from_da_to_reg1; end if; --to be continued
VHDL8 Practical example v2b
--to be continued
VHDL8 Practical example v2b
when s_rec_writeto_da_ram=> -- state: rec04 bar_ram_we27<='0'; bar_ram_ce20<='0'; bar_ram_oe22<='1'; da_data_out<=data_reg1; --play out and ram_data_inout<=data_reg1;--write --goback to record another sample state_ram1<=s_rec_address_change; --the ram control pin is up at state rec01 -s_rec_address_change VHDL8 Practical example v2b --to be continued
State: s_play_address_change
--------- sound playback state machine cycle starts here To be done by students in the lab.
Conclusion
Showed how to make a single board sound recorder by VHDL Can be modified for digital camera, mp3 player etc.