Home.Verilog.Digital Design.Digital Basics.Python.RF Basics.
Custom Search

Legal Disclaimer

Chip Designing for ASIC/ FPGA Design engineers and Students
Digital-logic Design...  Dream for many students… start learning front-end…

Legal Disclaimer

@TYH :- 4G LTE Long Term Evolution Tutorial, CloudComputing
Verilog Tutorial.
Get Noticed:- Submit your own content to be published on fullchipdesign.com

Send it to fullchip@gmail.com

Digital Basics Tutorial.
Calling Classes using Main function.
~\Desktop\code_fcd\calling_classes.py.html #!/usr/bin/python

# Calling a function from class using main function.
# return a function call outside the class
# Inheritance
# Class objects
import sys
class tables:
    def __init__(self,w):
        # 2.4 Definitions of tables for the FSM
        ans = self.T0_r(w)
        print "Result = %s" % (ans)
    def T0_r(self, w):
        self.w = w
        self.s1_t0_r = self.T0[self.w]
        return self.s1_t0_r
    def tables_ls(self):    
        self.T0 = ['0xFF563C6' ,'0x84FF7CF8' ,'0x897788EE' ,'0x8EFB7BF6',
                '0xFE2F2FF ' ,'0xBCAF6BD6' ,'0xAA6F6FDE' ,'0xFFC5C591']

def main ():
    # Calling a class
    # Read 0 elemant of the table array
    y = tables(0x4)


Other reference Python code.

Open and read file as a single string.

Command line arguments lists as string with ‘sys.argv’.

Glob module in Python code 

Classes, global variables and functions

Open and write file.

Generate diamond pattern.

Specify files to be written

from the command line.

Writes using classes and

global variables

Conditional statements,

string to hexadecimal conversion 

Strip off white space at end

Convert 12 bit hexadecimal values to 12 bit signed values.

conversion from Hexadecimal to Signed Magnitude

UNIX shell commands, read lines from a text file, ‘sysargv’ command line operations, use of class and multiple functions. 

Python error’s with complete code examples:-

TypeError: __init__() takes exactly 2 arguments (1 given),

TypeError: 'str' object is not callable,

TypeError: not all arguments converted during string formatting,

AttributeError:  ** instance has no attribute **


Python call a function from a class using function “main”. So by using this method a function call can be returned outside its class.  

LTE Long Term Evolution topics.
Read bin files.