Thursday, 23 April 2015

EE2020 Report on Pseudo-Random Number Generator

Pseudo-Random Number Generator
A pseudo-random number generator is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers.  It is central in applications such as simulations, electronic games, and cryptography. This report involves the design for building a basic pseudo-random number generator, and how the design is being carried out.  

Objectives
  1. Implement a 4-bits pseudo-random number generator defined by xk+1= (axk+c) mod m. Set a = 2, c = output of a 4-bit counter and m = 5. x0 can be keyed in by a 4-bit DIP switch.
  2. A push button resets back to the initial state, x0.
  3. A 7-segment displays the current number only if it is less than the previous number. Otherwise, nothing will be displayed on the 7-segment.

Design Overview
The system can be separated into three main blocks. A 2xk+ccircuit is implemented to read in initial state value from DIP and perform the operation by using an adder and counter. The sum is pass to mod 5 circuit to get the remainder. The output then feedback to 2xk+ccircuit to read the next state value. The display circuit will hold the current value xk+1as well as the previous value xk. A magnitude comparator is used to compare these two values and display xk+1if it is less that  xk.

QQ图片20150410153325.png
Figure 1: General design

Implementation

2Xk+C and reset control

74157 multiplexer is introduced to select between the read-in of the initial state or the subsequent states. The select signal is controlled by the push button. When the button is being pressed and hold, the next rising edge of the clock triggers select signal to be LOW for exactly one clock duration. The system is reset back to the initial state with multiplexer output the value from DIP switch. After which the select signal goes back to HIGH and remains HIGH. Multiplexer will then output the value obtained from mod 5 circuit.

Figure 2 shows the result of doubling a 4-bits number. It can be observed that by shifting the connections one bit to the left and wire the LSB to ‘0’, it is able to obtain 2xkwithout using any IC chip. The c value is obtained from a 74191 counter that counts up from 0000 to 1111. With its LD connected to the select signal, it will load back to 0000 when the system resets. The outputs from the multiplexer and the counter are feed into a 74283 adder.

xk
2xk
0001
0010
0010
0100
0011
0110
0100
1000
Figure 2: Doubling a 4-bits number

QQ图片20150411001837.png
Figure 3: 2xk+ccircuit

Mod 5

The output from the 2xk+c circuit is input to an adder and adds 0110 (6). If the result does not generate a carry, it shows the input number is less than 10. If the input is greater or equals to 10, a carry will be generated and the 4-bit adder output will be input+6-16which is equivalent to input-10. This reduces the input to a magnitude that is less than 10. The outputs from 2xk+c circuit and adder go into a multiplexer with adder’s CARRY OUT as the select signal. When CARRY OUT is ‘0’, the original number is less than 10, thus select the output from 2xk+ccircuit. When CARRY OUT is ‘1’, the original number is greater or equals to 10, but after minus 10 it will be less than 10, thus select the adder output. After obtain a number that is less than 10, the process repeats again. However, instead of adding 6, the second adder adds 1011 (11). Carry will be generated if the input is greater or equals to 5. Thus, the second multiplexer will output the mod 5 result.

The result is input to a shift register to hold for one clock duration. While shift register’s output is holding the value, it is feedback to the 2xk+ccircuit to perform the next operation.

QQ图片20150411015802.png
Figure 4: Mod 5 circuit

7-segment display

A 7-segment displays the current number xk+1only if it is less than the previous number xk. These two numbers can be obtained from the input and output of the shift register. The input stores the current value xk+1 while the output holds the previous value xk. A magnitude comparator is used to compare these two values and output a signal when xk+1is smaller than xk.
Signal from magnitude comparator will be HIGH only if xk+1< xk. This signal goes into the BI/RBO pin of the BCD-to-seven-segment decoder. If BI/RBO receives a LOW logic, all display will be blanked out. If it receives a HIGH logic, the decoder will decode the 4-bit input and display the corresponding decimal value on the common anode LED display.   
QQ图片20150411104553.png
Figure 5: BCD-7-segment display
Experiment Results
Figure 6 shows the predicted results when DIP switch is set to 0001. The system is able to output the correct  (2xk+1+c) mod 5value. After blank-out current outputs that are larger or equal to the previous output, only values quoted with ‘display’ is displayed. Whenever the push button is pressed, the system resets back to its initial state at the next rising edge clock. Thus, the system is able to meet all the project requirements.
QQ图片20150411225808.png
Figure 6: Predicted outputs

Repeated Counter Output
The counter will repeat 0000 twice after the system is reset back to the initial state by the push button. This is because the push button signal is aligned with the clock signal. When the push button signal goes LOW, it stays LOW for the entire clock duration, during this period counter inputs reflect to outputs which are 0000. When the push button signal goes back to HIGH after one clock duration, its rising edge overlaps with the rising edge of the clock. This prevents the counter from reacting to this clock rising edge, and it remains 0000 till the next clock rising edge.

If this repetition is not desired, the counter’s load signal can be modified such that it is able to react to the first clock rising edge after the system resets. Connect the push button as shown in Figure 7 below. The resultant output will be LOW when the button is being pressed, and HIGH when released. Input this new signal to the counter load pin while keeping the original push button signal connected to the multiplexer select pin. To reset, press and hold the pushbutton. The load signal goes LOW immediately, counter load back to 0000. The select signal goes LOW when there is a clock rising edge, multiplexer select the initial value. Release the push button while the select signal is still LOW, this will start the counting process from 0000. At the next clock rising edge, the multiplexer will select x1and counter will count up to 0001. A LED connected to the select signal may serve as an indicator for the timing to release the push button.
QQ图片20150412014935.png     QQ图片20150412022055.png
Figure 7: Load signal

Conclusion
This project provides a good exposure to various wiring skills. Most of the ICs used in this project involves 4-bit parallel inputs and outputs. This requires a very systematic way of color coding and the placement of ICs. Instead of using different color to represent different sub-blocks, it will be easier to observe if different color represents different 4-bit value at any point of time. Also, due to the limited space (two breadboards), it is extremely crucial to implement this project in an area efficient way. Thus, the experience gained from this project better equipped me for future journey.

Presentation Reflection

In terms of preparation, I did not prepare well for this presentation. I started to prepare my slides and scripts only on the morning of the presentation date. I went through my scripts a couple of times but I did not have enough time to practice. I thought it would not be a difficult task since I only required to deliver what I wrote in my problem solution essay. However it was not the case here. Due to the lack of practice, I could not remember what I had to say. I have to constantly refer back to my script. I was so nervous, because of that I could not identify the line where I should continue from. During the presentation one of my slides had overlapping contents. It was probably due to the errors in file conversion. This allow me to learn that it is important to check all the presentation materials one more time before the actual presentation starts. In conclusion, I will take this experience as a precious lesson learned and improve on my future presentation skills.

Friday, 17 April 2015

Problem Solution Essay Draft 3

Nowadays, social media deeply penetrate young people's daily life. From sustaining friendships to expanding social circles, teenagers are heavily dependent on social media to construct their relationships with other people. In Alone Together by Turkle (2012), she mentions that while social media is used as a tool to connect people, it is now causing wider separation. This isolation is extremely harmful to teenagers as they are in a crucial age of developing self-awareness through interacting with other people. Singapore has a 73% Internet penetration rate, this will cause great impact if social isolation becomes a new normal. The only effective solution is for Infocomm Development Authority of Singapore (iDA) to pose regulations that draw clearer distinctions between individual's online social life from real life, so that teenagers will not trade offline social with social media.

In order to gain public usage, social network providers are making their services as close as possible to people's real life. Real life friends become online follower and online followers become real life friends. Teenagers growing up in such environment do not observe the difference between online social and offline social. As social media appears to be more efficient and powerful, it will draw teenager’s attention away from their offline social life. It is more common to observe groups of young people gather together but instead of spending time with their friends, they put more attention to their phones. As the definitions of virtual and real are not clearly defined and differentiated, teenagers who spend on average 5.5 hours per day on social media, will be most vulnerable to social isolation.

Social media only provide a mental relief but leave people physically and emotionally alone. It is true that social media provides a fast channel for teenagers to reach out to one another and easily get connect to people across space. While teenagers start to rely on social media to develop their relationships, they also let the technology led them to undesirable places,  slowly without notice. Online information can be created, edited and deleted in a way that people can choose how they are perceived. Teenagers begin to build their relationships merely for the sake of connections and hide their true self from one another. This generates a wider separation between teenagers and the society.

Social isolation caused by social media largely affects teenager's communication skill. As efficiency is the priority in online social media communications, the language used is generally short, plain and straight to the point. When conveying a message, some details are skipped in order to obtain a fast response and feedbacks. Other factors such as body language, eye contact, the tone of voice are crucial in conducting an effective communication, but none of these can be seen in social media communications which opposite parties interact with each other through a flat screen and digitized information.

The solution proposed by Jones in ‘Technology: Creator or Savior of Social Isolation’ suggests that, technology can provide a platform to bring people together, to tighten social bonds. But the author does not demonstrate that it is the same technology that is causing all the trouble. As people demand more on technology and less on each other, there will be absolutely no way that technology can reverse the situation no matter how advance it will be. Instead, it will only exacerbate the social isolation.

In order to solve the problem, it is necessary to target at its root cause. iDA should restrict social media providers from allowing their teenage users to access their full services. Some ways include limiting the time which teenagers are allowed to access their social network accounts and the amount of contents they are allowed to upload. This will force teenagers to keep their social lives away from social media. Once the connection between online social life and real life is broken, teenagers will begin to realize that they cannot apply what they obtain from online to real life. They will slowly but definitely move their focus away from the virtual world.

Schools, being the most important education center, play an important role in prevent social isolation among teenagers. Schools should have their networks block out all major social networking sites and at the same time reinforce the difference between online and offline social. Even though this may seem to be a restrictive  measure, but it is necessary for teenagers to develop a right and healthy social life. Schools can also organize activities such as class outings and overseas trips, to reconstruct the importance of real world interactions and communications.

Individuals must not forgo their real social life in exchange for greater dependence on the virtual. Teenagers been a most vulnerable group will easily being carried away and become isolated and at the same time losing their communication skills. It is necessary for powerful authorities such as iDA to reverse the situation. As such, teenagers are able to enjoy the benefits of social media while minimize the harm associated with it.



Reference
Turkle, S. (2012). Alone together. New York, NY: Basic Books.

Government of Singapore. Infocomm Development Authority of Singapore. (2012). Individuals who are Internet users 2012. [Data file]. Retrieved from: http://www.ida.gov.sg/Tech-Scene-News/Facts-and-Figures

Sim, F. (2013 January 11). S’pore youths spending more time online: study. Yahoo News Singapore. Retrieved from: https://sg.news.yahoo.com/s-pore-youths-spending-more-time-online--study-100333925.html

Jones, C. Technology: Creator or Savior of Social Isolation [Supplemental material]. De Vry University. Retrieved from http://www.academia.edu/6879244/Technology_Creator_or_Savior_of_Social_Isolation

Critical Reflection

ES1102 expose me to the opportunity of giving and receiving feedback from my peers. Initially, I was not very comfortable in giving feedback as I was not confident in my English ability. Whenever I thought there might be a grammar mistake or an unclear phrasing, I would do a lot of double checkings before I gave feedback as I was unsure if I could provide the correct feedback. I was a very slow process in the beginning. But this also greatly improve my editing skills. I soon became comfortable in raising up my own opinion and provide my peers with suggestions.

I was very weak at writing essays. I often spend the entire day planning what to include and what would my arguments be. In the past, whenever I finished my essay I was unable to identify errors on my own as I had spent too much time on it. At ES1102, I am able to obtain feedback from my peers and tutor. They will share with me their feelings towards my essay and give suggestions. I am able to make improvements based on the feedback that they have given. After learning the skills of giving critical feedback, I can now easily review my own writing and make changes.

I will definitely apply the skills learned in the course to writing assignments in other modules. I had already applied the critical writing skills in my other module report. I found that I was able to organise my thoughts faster and in a clearer way. That greatly smooth out my report writing process. In the future, I will continue to improve my English skills and apply what I learned to practice.